model

Zend Framework fetchAll

Can i override fetchall method in a model? I need to check sth everytime fetchAll is called. The model extends Zend_db_table_abstract ...

Do you buy the reuse story for the presentation layer in MVP and its variations?

Besides the unit testing benefits, what I heard regarding MVP pattern was that the reusability of the presentation layer. So, you would design one presentation layer and use it for WinForms (rich) and Web. I am currently working on a windows forms application in .NET with possibility of creating a web UI in the future. However, when I...

Is it correct that Model::$AssociatedModel is not set if AssociatedModel::$useTable is false?

Basically I have two models that are associated, but im building them to work both with and without an existing database (basically they degrade by not remembering settings). I can do $this->AssociatedModel->find() in my models when they are using a table, but for some reason I get Undefined property: Model::$AssociatedModel [APP\plug...

Best practices for grails index page

What is the right way to populate the model for the index page in a grails app? There is no IndexController by default, is there some other mechanism for getting lists of this and that into the model? ...

Simple Model Checker Tool

Is there a simple Model Checker tool. I am planning to implement a model checker tool which will analyze the code for some of the predefined properties. ...

With MVC, do interactions with autonomous peripherals belong in the Model or the Controller?

Using MVC with an observer pattern, if a user action requires polling a device (such as a camera) for data, should the polling be done in the Controller and the result passed off the Model or should a request be sent to the Model and the Model itself performs the polling. This question is my attempt to reconcile everything I am reading ...

Using MVC, how should one handle communcation between Views? Between Models?

Question number three in my quest to properly understand MVC before I implement it: I have two cases in mind: The primary application window needs to launch the preferences window. (One View invoking another View.) The primary Model for an application needs to access a property in the preferences Model. (One Model accessing another Mo...

ViewData.Model in partial is null

In my main page (call it index.aspx) I call <%Html.RenderPartial("_PowerSearch", ViewData.Model);%> Here the viewdata.model != null When I arrive at my partial <%=ViewData.Model%> Says viewdata.model == null What gives?! ...

in a web application, how do keep the database structure up to date?

If your data change after the application is deployed, how do you keep the database up to date? I mean, you can add or remove table, thats a simple task. Altering an existing table can be trivial too. But if you change the structure often, how do you keep that under a control? I used to keep a table with a current database version in ...

Multiple Table Models with MVC?

Hi All, I am just getting started with MVC, and it seems like it will be a great way to go, once I manage to switch my thinking to it. Most of the material I have come across seems to have a 1-1 relationship between models, views, and tables - ie each model represents a table and allows CRUD, plus more complex functions. What if I hav...

How do you run a "do" block in a Rails Model while still listing a :dependent?

So I have a User model that :has_many other models like Documents, Videos, Posts and the like. My question arises when I execute a "do" block from the User model like so: has_many :posts do def recent find(:all, :order => 'created_at desc', :limit => 12) end end This just lets me call something like user.posts.recent t...

What's the best 3d model format for loading and displaying inanimate textured objects in an OpenGL program?

I just want to know what file formats are the most OpenGL friendly in terms of loading and displaying inanimate textured 3d objects. ...

How to insert rows when using a many-to-many relation

Given the following, how could I insert rows in my db? (Or what should I correct in my schema?) Models: class Item < ActiveRecord::Base has_many :tran_items has_many :transactions, :through => :tran_items end class TranItem < ActiveRecord::Base belongs_to :item belongs_to :transaction end clas...

"Unknown column 'user_id' error in django view

I'm having an error where I am not sure what caused it. Here is the error: Exception Type: OperationalError Exception Value: (1054, "Unknown column 'user_id' in 'field list'") Does anyone know why I am getting this error? I can't figure it out. Everything seems to be fine. My view code is below: if "login" in request.sessi...

Is LINQ to SQL the best way to build a Model or create my own classes

I am develop a medium system in ASP.net with MS SQL Server Database and I wonder what is the best way to create a model layer with LINQ or create own classes that dealing with database? ...

Models in the Zend Framework

What are some of the ways you have implemented models in the Zend Framework? I have seen the basic class User extends Zend_Db_Table_Abstract and then putting calls to that in your controllers: $foo = new User; $foo->fetchAll() but what about more sophisticated uses? The Quickstart section of the documentation offers such an example ...

Rails: Check has_many in View

If I have... class Bunny < ActiveRecord::Base has_many :carrots end ...how can I check in the View if @bunny has any carrots? I want to do something like this: <% if @bunny.carrots? %> <strong>Yay! Carrots!</strong> <% for carrot in @bunny.carrots %> You got a <%=h carrot.color %> carrot!<br /> <% end %> <% end %> I kn...

Rails Model has_many with multiple foreign_keys

Relatively new to rails and trying to model a very simple family "tree" with a single Person model that has a name, gender, father_id and mother_id (2 parents). Below is basically what I want to do, but obviously I can't repeat the :children in a has_many (the first gets overwritten). class Person < ActiveRecord::Base belongs_to :fath...

Efficient C code for Hardware realization in Verilog

Hi, I have a plain C code for a Image codec.My goal is to develop a efficient C model which will be taken and realized in Hardware using Verilog or some such Hardware description language. What i am trying to find out is: 1.) What modifications need to be done in exisitng C code structures to make it hardware efficient 2.)Do data st...

Best way to use Linq2Sql?

I'm struggling to think of a good way to use linq2sql, simply I want to use it, but I can't figure out whether it's best to wrap up the linq2sql generated classes inside my model classes providing some form of generic abstract base class / or interface for the common methods on my model classes like add, update, delete etc, or to extend ...