model

Metalanaguage to describe the Model from MVC to generate identical client and server side code

I am looking for a powerful meta-language to describa behaviour for an application i intend to use in offline mode (google-gears + javascript) and server side sqlite + (php/ruby/java etc) and looking for a good format to describe the model's behaviour which can be easily converted to the target languages. Am I completely off track, and t...

How to create a triple-join table with Django

Using Django's built in models, how would one create a triple-join between three models. For example: Users, Roles, and Events are the models. Users have many Roles, and Roles many Users. (ManyToMany) Events have many Users, and Users many Events. (ManyToMany) But for any given Event, any User may have only one Role. How can this b...

In Rails, What's the Best Way to Get Autocomplete that Shows Names but Uses IDs?

I want to have a text box that the user can type in that shows an Ajax-populated list of my model's names, and then when the user selects one I want the HTML to save the model's ID, and use that when the form is submitted. I've been poking at the auto_complete plugin that got excised in Rails 2, but it seems to have no inkling that this...

Disable Cakephp's Auto Model "feature"

In cake 1.2 there is a feature that allows the developer to no have to create models, but rather have cake do the detective work at run time and create the model for you. This process happens each time and is neat but in my case very hazardous. I read about this somewhere and now I'm experiencing the bad side of this. I've created a plu...

Table and List view with single Model in Qt

I have a 2D model where each row represents a frame in a video, and each column represents an object. The object can have different states on each frame, and this is stored in the model. Then I have a QTableView that shows this data. The model has header data, so each row has a header like "frame k" and each column has a header like "obj...

MS SSRS Report Builder: Semantic query execution failed.?

I have created an end user model and deployed it. Any report that I create and run gives me an error: Report execution error The report might not be valid or the server could not process the data. Semantic query execution failed. Invalid column name 'rowguid'. Query execution failed for data set 'dataSet'. An error has occurred duri...

MVC model design / inheritance

Forgive the vague title, I wasn't sure how to describe it. If you have a generic model "Archive", how do you show different views/forms based on a user selected 'type'? For example, the user creates a new "Archive", then gets the choice of video, book, audio etc. From there they get different forms based on the archive type. Or would ...

How to protect a Rails model attribute?

My Invoice model has an address_id attribute, and I don't want this address_id to change FOREVER. So I don't want this to happen outside the class: invoice.address_id = 1 invoice.address = some_address Rails automatically adds this address_id attribute to the model from the invoice table, so how can I declare this attribute private/pr...

How do I test a django database schema?

I want to write tests that can show whether or not the database is in sync with my models.py file. Actually I have already written them, only to find out that django creates a new database each time the tests are run based on the models.py file. Is there any way I can make the models.py test use the existing database schema? The one tha...

Programming against interfaces: Do you write interfaces for all your domain classes?

Hi, I agree, that programming against interfaces is a good practice. In most cases in Java "interface" in this sense means the language construct interface, so that you write an interface and an implementation class and that you use the interface instead of the implementation class most of the time. I wonder if this is a good practice ...

OSI model - What's the presentation and session layer for?

So I feel I pretty well understand the application layer, and everything below (and including) the transport layer. The session and presentation layers, though, I don't fully understand. I've read the simplistic descriptions in Wikipedia, but it doesn't have an example of why separating out those layers is useful. So: What is the se...

Validation Block vs Nhibernate.Validator

I am looking for validation framework and while I am already using NHibernate I am thinking of using NHibernate.validator from contrib project however I also look at MS Validation Block which seem to be robust but i am not yet get into detail of each one yet so I wonder has anyone had step into these two frameworks and how is the experie...

Django: Model limit_choices_to={'user': user}

I went to all the documentation, also I went to the IRC channel (BTW a great community) and they told me that is not possible to create a model and limit choices in a field where the 'current user' is in a ForeignKey. I will try to explain this with an example: class Project(models.Model): name = models.CharField(max_length=100) emp...

Help for Domain Model in UML

Hi, I would like to ask if it is possible to show Generalization relationship in UML for a Domain Model although I undertstand I can do that in a Class Digram? I did not see much examples of Domain Model displying Generalization Relationship except in Class Diagram. If not possible, what is the best way to display that an Entity in a D...

Java table model design

I have a table class that creates modifies a table of items. I want to display those items in a JTable using a table model. To me table model belongs to my gui package but table needs table model in order to fire changes and table model needs table class in order to display it so i can not separate the two. if you need to do this what wo...

What does a db table created by the Rails framework look like?

I don't have a Rails environment set up and this is actually quite hard to find a quick answer for, so I'll ask the experts. When Rails creates a table based on your "model" that you have set up, does Rails create a table that mirrors this model exactly, or does it add in more fields to the table to help it work its magic? If so, what ...

Recommendations for good book and/or online documentation for Entity Relationship Diagrams

Hi there, The wiki page on ERD has a lot of useful information, but I was wondering if you had any recommendations for good books and/or online documentation for a more in-depth description of ERD's? Thanks. ...

In the Django admin interface, is there a way to duplicate an item?

Just wondering if there is an easy way to add the functionality to duplicate an existing listing in the admin interface? In data entry we have run into a situation where a lot of items share generic data with another item, and to save time it would be very nice to quickly duplicate an existing listing and only alter the changed data. Us...

Ruby on Rails - Can I modify the value of an attribute before it is called?

Let's say I have this model named Product with a field named brand. Suppose the values of brand are stored in the format *this_is_a_brand*. Can I define a method in the model (or anywhere else) that allows me to modify the value of brand before it is called. For example, if I call @product.brand, I want to get This is a Brand, instead of...

MVC model structure in Python

Hi all, I'm having problems structuring classes in the Model part of an MVC pattern in my Python app. No matter how I turn things, I keep running into circular imports. Here's what I have: Model/__init__p.y should hold all Model class names so I can do a "from Model import User" e.g. from a Controller or a unit test case Model/Data...