model

Django - How to model this correctly?

Hey, I want to model the following situation. I have a table of items, and a table of players, and a player can have many items and have multiple copies of the same item. I can easily model the player having multiple items: class Item(models.Model): name = models.CharField(max_length = 200, blank = False) class Player(models.Model...

How expensive is it to retrieve a model object from an nsarraycontroller?

I've a window with a table. The table lists several model objects by name. Those model objects back a window and that window's components all depend on the model objects for their values. Some tables on that window cannot be bound to the model object and must be populated using a data source. In this situation I retrieve the currently s...

CakePHP App not working on web server

I tried to upload my app to webserver to check it's performance, but unfortunately I got weird error: Error: Database table news for model News was not found. The Most funny things are: - In Model file I got var $useTable = 'other table name'; - This table exist, connection with DB too! - on my local server everythings works gre...

Access field in a many-to-many intermediate table with DQL in Doctrine

i have a model called ContentGroup and another called Content with a many-to-many relation between them. The intermediate table has a field called Position, When i try to write a DQL query to obtain all the contents associated with a ContentGroup i cannot reference the position field usign the aliases of the models or relations involved...

In an MVC web-application, it is correct to think of the models as the "entities"?

We have an ASP.NET MVC application. Is it correct to think of the models as the "entities" in the system? Presumably this comes down to the "type" of model (view or domain) - and if they are domain models then they are equivalent to entities? Edit: I ask the question to determine whether the introduction of the "entity" nomenclature in...

CakePHP Retrieving data from custom model

Hi, I got few models with custom queries, just don't wanna fight with them so I used $this->query method to query DB. Now got question... The only way I can access data is using $model[0][0]['field'], is there any other way to display them in foreach loop? Cheers! ...

Rails trying to send the id for a habtm model join table?

Hi, So I have two rails models - user and role - each specified with a habtm and a join table of users_roles. When I save from my user form, which has checkboxes for which roles to choose, rails is trying to manually insert a value into the id column of the join table. This doesn't make sense to me, as the id column should be set to au...

Wicket: How to change label's text on textarea's onkeyup?

Hi, How do I change label's text on textarea's onkeyup? I've tried this but does not work: Form form; TextArea ta; MyLabel resultDiv; /** * Constructor that is invoked when page is invoked without a session. */ public HomePage(final PageParameters parameters) { this.form = new Form("form"); this.ta = new TextAr...

Converting 3D Max Model to XAML?

Are there any free tools for converting a 3D Max model to WPF XAML? Thank you. ...

Domain model of Team Foundation Server

Did anybody see a domain model (information model) of Microsoft TFS (team foundation server)? Where it can be found? I need to understand ability to integrate it with other product. ...

zend models architecture

Let's say I have two tables in a database: projects and users. I create two models, that extend Zend_Db_Table_Abstract: Model_DbTable_Users and Model_DbTable_Projects. Now, is it a good pattern to create an instance of Model_DbTable_Projects inside the Model_DbTable_Users class ? In other words: is it OK to put any logic in this model, ...

Anyone think django's user model is too tightly coupled with auth?

I'm trying to learn Django and I would like feedback from anyone who has any MVC/MTV/PHP/Ruby framework experience. Does anyone find that the user model is too tightly coupled with auth? Background: When you first implement authentication for Django, you include the module django.contrib.auth This will bring in several models like Use...

rails lazy load of model attributes

Hi! Normally rails loads data with a :select => "*" from the database. I know I could change this. But I'd like to go another way: always only select "id" and load the attributes automatically later on when they are needed. Example: accessing user.description should if it's been loaded yet. if not, trigger a "SELECT description FROM us...

How to get model of a printer in javax.print?

Hello, I use Windows XP Professional. How can i get model of printer in package javax.print.* ? For examples: HP LaserJet M1319f MFP, HP LaserJet 3050 Series PCL 6, ... Here is how i get print services PrintService[] services = PrintServiceLookup.lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PRINTABLE, null); Thank you!, Minhbt...

Rails has_one vs belongs_to semantics

I have a model representing a Content item that contains some images. The number of images are fixed as these image references are very specific to the content. For example, the Content model refers to the Image model twice (profile image, and background image). I am trying to avoid a generic has_many, and sticking to multiple has_one's....

Zend Models Model_DbTable_Articles working, Articles not

Hi, I got problems with my ZF Models. Where I create new model, put it in Dbtable/Articles.php and name class as Model_DbTable_Articles it is working. But when I name class Articles I got error: Fatal error: Class 'Articles' not found Why? :) ...

How to separate model from gui ?

Hello I hope this is not something very trivial and obvious. I have some similar programs that I am working at. In each program I have to implement future about saving projects. I came with following design : Project -- Program1Project -- Program2Project The base class Project : class Project { public: void NewProject(); vo...

dynamically set named_scope based on current_user

Hey all, I keep getting the following error: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.size Based on the current user, when they navigate to a page, I want to limit them to what they can see based on their site. Problem is there is no associat...

Why isn't this model returning any values?

I'm trying to build VERY basic model->controller->view structure with CodeIgniter. I'd rather use models (and model functions, more importantly) and controllers than executing queries within each view. First off, here's the model: class Leads extends Model { function Leads() { parent::Model(); } function fetch...

CakePHP: get user info in models

I'm moving some of my find code inside models. Previously in my controller I had $this->Book->Review->find('first', array( 'conditions' => array( 'Review.book_id' => $id, 'Review.user_id' => $this->Auth->user('id') ) )); so in my Review model I put something like function own($id) { $this->contain(); ...