model

Django relation doesnt work?

I have the following in models: class Companies(models.Model): ComName = models.CharField(max_length=255) ComURL = models.CharField(max_length=1024,null=True) class Products(models.Model): PrName = models.CharField(max_length=255) PrCompany = models.ForeignKey(Companies) and the following in the template: {% i...

API Model for Server Push Technologies (COMET)

Hello, I'm whiling to add a support of Server Side events to CppCMS. I understand the technical part of what to do on the level of communication: Client sends long polling XmlHTTPRequest, and waits for respond, server accepts the connection and does not respond until server side event occurs and sends the response to the client. The cli...

How do I setup model associations in an RSpec test?

I've pastied the specs I've written for the posts/show.html.erb view in an application I'm writing as a means to learn RSpec. I am still learning about mocks and stubbing. This question is specific to the "should list all related comments" spec. What I want is to test that the show view displays a post's comments. But what I'm not ...

MVC with Qt widget that uses a QAbstractTableModel subclass

Hi, I'm doing some refactoring. I'm implementing a Model-View-Controller pattern. The view is a Qt widget. Originally, the Qt widget created a new instance of a QAbstractTableModel subclass on the heap. Lets call it FooTableModel. e.g Widget::Widget(QWidget* parent) : QWidget(parent) m_model(new FooTableModel(this)) { Should I ...

QT Model/View programming with complicated data structures

Greetings, I am not a professional application developer so am probably not as familiar with the model/view design pattern as I should be. Nonetheless, I am trying to use it in a hobby app and failing miserably. The primary problem I am having is that the data I am trying to display and modify is not easily represented with an extension...

zend framework mvc model and generating dynamic reports

hi all, i am using zend framework to develop my php applications using mvc model. i want to generate some reports from database. but i dont know how to separate models and views in this case. i fetch information from db, then i should iterate through them and make a html table. then pass this table to a class, making pdf file from the...

Is there a point at which an Enum can get too bloated?

I've defined an Enum as part of the model objects for an ASP.NET MVC application. The Enum is called 'ContentTypes' and looks something like this: public enum ContentTypes { [Description("News story")] NewsStory = 1, [Description("Article")] Article = 2 } Now I'm planning to add another set of attributes to the enum ...

Models and Validation in Multiple UI Delivery Mechanisms

I work with a small team. We have multiple delivery mechanisms, often for the same business models but different exposures. We need some help with our efficiencies sharing models and validation across our applications. What is the best mechanism to create consistent validation for our models, for both user experience and code reuse acro...

Looping through a two-dimensional array in a asp.net MVC View.

Hi, My problem is as follows: I'm making a ranking board for my team. I've managed to get the data out of the database and I put it into a two-dimensional array. I sent it as model data to the view. Now I don't know how to loop through the two-dimensional array. Normally it would be something like this: For Each record in Model ... ...

tco/ip,osi model,socket programming, networking

Hi experts, can anybody give me the names of best books(writer names also) on 1.tcp/ip 2.osi model 3.socket programming and a good book of networking? ...

Database structure for items with varying attributes

Hello there. I am developing a clothes web application and would appreciate advice on how to structure the data in my mysql database. Every product (item of clothing) will be photograped in a number of ways, let's call them 'modes'. For example a shirt would be photographed buttoned or unbuttoned, and/or tucked in/not tucked in. A pa...

PHP: Where should validation functions be stored?

I'm using a PHP MVC Framework, and I've been just lumping all my validation functions in a helper class which get called when I need them. However, isn't the Model for logic about working with data, not exclusively databases? Would it make more sense to put the validation functions in one of my models? Thanks ...

Is there any dependency between view and a model ?

Normally in the MVC Pattern, when a user clicks on a page the request would be sent ,then controller would handle the request ,then process it using the model and route it to the appropriate view. I have read the post about the passive model and active model,but is there a possibility where the view directly interacts with the model, wo...

iPhone dev - help with using Model

(By the way, I don't use Interface Builder) I have a little project consisting of a root UIViewController which manages 5 other View Controllers with a UITabBar, I'm not using UITabBarController. The Root View Controller only ever keeps one of its View Controllers instantiated, when a tab bar item is selected, the View Controller ...

Distributed data model

I work in field robotics and we have a central server keeps track of a whole heap of data to do with vehicle state, environment state, tasks, task grouping and so on. There are processes which deal with different parts of this data, and user interfaces which need to be updated when specific parts change. What I want is a way for systems...

How can I extend the Model in ASP.NET MVC and Entity Framework?

In my first ASP.NET MVC applications, the model was a simple O/R mapping between a table and the classes, managed by the Entity Framework. Now I would like to add some meat to this skeleton, and introduce business methods for the generated classes. What is the recommended approch to this in ASP.NET MVC (with Entity Framework)? My favori...

How to model interpretations of rap music

I just started working on a website that will help people understand what rappers are talking about. Users will see the lyrics to a rap song and they'll be able to click certain lyrics to see an explanation. Here's a screenshot (you can also check out the site itself here): (Original lyrics censored; click here to see them) Anyway, m...

Validate that string belongs to specific language alphabet

How can I validate Rails model string attribute that it belongs to specific language alphabet characters? Thanks. ...

Accessing model properties in Rails

So basically I have a controller. something like this def show @user = User.find[:params[id]] #code to show in a view end User has properties such as name, address, gender etc. How can I access these properties in the model? Can I overload the model accesser for name for example and replace it with my own value or concatenate someth...

How do I get the default value for a field in a Django model?

I have a Django model with some fields that have default values specified. I am looking to grab the default value for one of these fields for us later on in my code. Is there an easy way to grab a particular field's default value from a model? ...