model

GAE change field name/attribute

Is it possiible to change attribute name on db.Model kind? i have some field name created with dash (e.g. field-name) that resulting error. class DataBulk(db.Model): group_id = db.IntegerProperty() group_name = db.StringProperty() geo_pos = db.GeoPtProperty() group-leader = db.StringProperty() <-----------error impo...

CoreData how to detect new version of an app so I can update the model?

I have a very simple model that is created when the app is launched for the very first time and populated with the contents of a plist. I will need to re-create the model again when an update to the app is downloaded and launched. I know that you can version coredata models but I don't foresee the model itself is going to change. I will ...

One QStandardItemModel for different QTableView, Generic vs Specific Views

I really don't know if this makes sense but this is what I trying to do: I'm doing my game's editor in QT. Currently I'm using a QStandardItemModel to store all my scene items. These items have names, position, Textures(vector of Texture which is a custom class), Animations (vector of Animation), etc. I find it useful to have one item...

Default conditions for Rails models

I have a model which has a field called deleted, which is used to mark those deleted items. So normally I would just want to query those having deleted = false items, and in some special cases to list those deleted items for restoring. Is it possible to do that? What I could do now is just using a named scope having :conditions => {:de...

Report Server Model

Hi I have created a Report Server models and 50+ Reports working off the Model. Now that I have pointed the model to a Live database, I have noticed it limits the results. I can't seem to see data before 2009! Has anyone had this issue and is there a way to get my model to show the data I want? I have done an Explore Data on my table...

Need clarification about nested models

I need an example on how to operate on nested models. Let's assume, we have some order management application and models: Order, Position, Item. Order can contain Positions and Positions can contain Items. The question is: how to handle data selection? Some use cases that is needed: Get list of Orders with Positions and Items (like...

Problem loading models with modules in Zend Framework

I have a folder structure like this and I'm trying to load the News model inside my controller: <?php /** * Login */ class Admin_NewsController extends Zend_Controller_Action { public function preDispatch() { $layout = Zend_Layout::getMvcInstance(); $layout->setLayout('admin'); } public function init() { ...

Why am I getting Application error while trying to load a model?

I've run this code Zend_Loader::loadClass("Admin_Models_DbTable_News"); and my application has this folder structure Why do I get this: An error occurred Application error ...

Problem with Zend_Db_Abstract in Model

I've found out that when I extends Zend_Db_Table_Abstract in my model I get An Error Ocurred Aplication error When I run this code <?php class Admin_Model_News { protected $_name = 'news'; protected $_primary = 'new_id'; public function addNews($data) { $this->insert($data); } } It works properly, but when...

Zend Framework - Where to place Zend_Forms, Controller? Model? Somewhere else?

Hi Where is it best to put the code for building my Zend_Forms? I used to put this logic inside my Controllers, but moved away from that after I needed to use the same form in different places. It meant I had to duplicate the creation of forms in different controllers. So I moved the form creation code into my Models. Does this seem r...

How to use routing helpers in a model with Rails 3?

Hello, In a model callback I make an API call and need to give the API some URLs. Those URLs would be easily generated by a routing helper. The solution given in this answer does not work anymore in Rails 3. Any solution? Thanks :) ...

Are Entity Framework Models Reusable With Multiple Data Sources?

I'm planning an architecture where we have several legacy databases all having somewhat similar (but not exact) schemas. I'd like for my application tier to have a single, unified model that is filled from the appropriate data source at runtime. Does Entity Framework allow me to declare a single conceptual model with mappings to and fr...

TypeError: can't convert Post into Array

I'm using Rails 3 and will_paginate. Pagination works fine in my Posts controller but in my Tags controller I get an error on the second Tag id. Here's the error: TypeError in TagsController#show can't convert Post into Array ... app/controllers/tags_controller.rb:8:in `show' tags_controller.rb#show: def show @tag = ActsAsTaggab...

Using Entities from an Entity Framework (v3.5) Model with Fluent NHibernate

Hi all, Using Microsoft's designer for the Entity Framework (v3.5), I have created an Entity Model (*.edmx) with a generated *.Designer.cs class. I can persist my objects to MS SQL Server using the model without any problems. I am new to NHibernate, and out of curiosity, I now would like to use my model with Fluent NHibernate and SQL...

how to launch my COM out of proc server from a managed com interop dll

I have written a c# com out of proc automation server which references my managed COM Interop dll which holds the application object model, it all works fine. When importing my dll from say unmanaged C++ it works fine it launches the out of proc server and everything works by using COM to access it, but when i do the same from managed...

rails nils in a form

This is probably a simple question, but I noticed a few errors deriving from having empty values instead of nils... If a user leaves a field blank in a standard rails app is there a way to leave the field in the database set to NULL instead of entering an empty value? Basically so a check like @model.info.nil? return true instead of ha...

Is it possible to have too many validations?

Does the number of validation ClassMethods have anything to do with the performance of an application? Could a boatload of validations cause a strain? ...

Codeigniter object in session?

Hey guys, I'm starting out with CI and there's something I don't understand. I'm writing this login page and I'd like to add the users object to the session. How do I do that? The user object comes from my user model.. For a new instance I write: $this->load->model('user_model', 'user'); but this won't work: $this->session->set_userd...

How to create a model for messages in cakephp

Hi, what's the best way in cakephp to get a list of private messages for a user considering my messages table is something like: id: row id left:sender id right: receiver id subject and text with a find all i'll get the results with the user id but i want to display the username, ofcourse i could use a query with a join but probably...

symfony 1.4: adding defailt value to a model

I'd like to add some default values to a model when I'm creating a new entry (like a timestamp) I'm sure there are more than one way of doing this, I'm curious what the different ways are, but mostly what the standard way of doing this is. Thanks ---edit--- solution: for the timestamp the default would be default: CURRENT_TIMESTAM...