model

Designing a flexible user repository

Hi all, I'm trying to design and build a flexible user repository (as an extension to Zend Framework) that I can easily drop in new projects. What I have in mind are the following classes: UserRepository UserRepository_Adapter_Interface UserRepository_Adapter_DbTable implements UserRepository_Adapter_Interface UserRepository_Adapter_T...

Game engine for augmented reality

Hi there, For an augmented reality project I want to display a high resolution live camera feed. Then in front of this I want to display a model than can be manipulated (translate, stretch, etc) in real time. I was going to use OpenSceneGraph but realized it will be a lot of work to get the manipulations working. So I would prefer a mo...

In Rails, a Sweeper isn't getting called in a Model-only setup

I'm working on a Rails app, where I'm using page caching to store static html output. The caching works fine. I'm having trouble expiring the caches, though. I believe my problem is, in part, because I'm not expiring the cache from my controller. All of the actions necessary for this are being handled within the model. This seems like i...

MVC How to keep a model skinny

After watching this video, I am wondering if I am using my controllers wrong. What exactly should a controller contain? For my blog, I have a post controller which has methods: create show list loadPost like dislike Whereas my post model only has a few access rules, validation rules and relation information. Are there any examples of a...

"Hierarchical" rowsets in Zend Framework?

I have two tables - let's call them Customers and Orders. It's a 1:n relationship, where each Order is placed by one Customer, and one Customer can have many orders. The Web app is written in Zend Framework. My goal is to query a customer from the database, and get their 10 most recent orders (for example), and to have all this informat...

How to model the concept of "Featuring" (i.e., when an artist is "featured" on a song)

Sometimes more than one artist will be on a song. For example, Jay-z's new song "A Star is Born" features the artist Cole, and thus would be listed as "Jay-z (featuring Cole) - A Star is Born" in a catalog. My question is how to model this in my database. Right now it's pretty simple: every song belongs_to :artist and every artist has_m...

Who is responsible for initializing a model from remote sources

I know that I am for responsible for this in the code, but in a object-oriented and MVC sense, who should really load the model. I have a model for representing RSS feeds that is being loaded from a url. The model is really thin and the controller manages downloading and parsing of the XML and then passes it on to the model. Is it better...

Invalid Cast when trying to loop over entities in EntityCollection in ASP.NET MVC

I'll just jump right into it. I have a model called "Request" which I created using LINQ to SQL. I have another model called "Comment". A "Request" can have many "Comments". In my controller I have this code: public ViewResult Details(int? id) { return View(requestService.GetRequest(id)); } In my view I have this m...

Java OS Process Queue

I'm using the native ProcessBuilder class to create a variably sized list of process objects. Currently, I simply roll through the list calling the start method on each Process instance. I would however like to better control this aspect of the application by limiting the number of my running processes to a custom value (e.g. number of p...

Data reader is incompatible... member does not have corresponding column in data reader.

Using VS 2008, SQL Server 2008 and WPF 3.5, I've made some changes to my schema and updated the model. It compiles and runs fine, until the client app calls for a specific entity and I get the following (actual names replaced): The data reader is incompatible with the specified '<Model>.<ViewBasedEntity>'. A member of the type, '<Prope...

What is the best way to deal with a django model object?

I need some clear thinking on how to handle a save function on a django model. As you'll see below I am at a loss on how to do this elegantly. I'd like to pass the entire object to another module and analyze it there. My motivation for having the analysis broken out and not in models.py is that I will be frequently refining the analy...

How should I split MVC models in my PHP app?

I have a PHP site based on a simple MVC principle. I currently have one model file with many functions for getting data from the database. However, it's becoming a little monolithic now so I'd like to split it into separate models. The question is - what's the best way to do this? Is it a good idea to create a class for each table, so I...

Can a CakePHP model change its table without being re-instantiated?

I'm working with an unchangeable legacy database schema where each instance of an object has its own table in the database with associated records. I need to change a model's useTable every time the model is instantiated, but retain Cake's nice caching and what not. Say I have many pad objects, which each have several note objects (Not...

Problem with CakePHP using autoModel when it shouldn't

I am getting an error in my view: Warning (512): SQL Error: 1054: Unknown column 'Model.id' in 'where clause' [CORE\cake\libs\model\datasources\dbo_source.php, line 525] $sql = "SELECT Model.model_id, Model.pic_location, Model.model_name FROM models AS Model WHERE Model.id = '20' LIMIT 1" $error = "1054: Unknown column '...

how to design model for my case with django?

Here are two roles: Trainer and Trainee. Trainer may have multiple trainees. While each trainee may have only one trainer or have no trainer. Here is my model: class TrainerShip(models.Model): trainer = models.ForeignKey('Trainer') trainee = models.ForeignKey(User) request_date = models.DateTimeField(auto_now_add=True) ...

Call a method in model after find in Ruby on Rails

Hello. I would like to know if it is possible to call a method from a model after using find. Something like after_save, but after_find. Thank you, Gabriel. ...

UI-centric vs domain-centric data model - pros and cons

How closely does your data model map to your UI and domain model? The data model can be quite close to the domain model if it has, for example, a Customer table, an Employee table etc. The UI might not reflect the data model so closely though - for example, there may be multiple forms, all feeding in bits-and-pieces of Customer data al...

Running a single validation in Rails

Hi, I'm sending friends invitations and I want to validate email address using User.validates_format_of :email, except that User.email has a couple of other validations which I'm not really interested in. So is there a way to run a single validation on a model or check if that specific validation has passed (without doing user.errors...

Zend Framework modular app, can't load models for each module, autoloading models?

Is there a way to have models for each module? I have 3 modules, one is a "contacts" module. I created a model for it in modules/contacts/models/Codes.php Codes Controller class Contacts_CodesController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ $this->view->mes...

What software quality model and metrics are you using ?

Hi there, This is a vast area within software development and it can potentially ends up in long debate :-) I've been trying to find the right model and metrics to assess the quality of our software under development (Who didn't at some stage ?). I've settled on a close variation to ISO-9126 as I thought it covers all important aspects ...