I'm developing a site that will have a model for users, a model for submissions, and a model for ratings. Each submission may have only one rating per user. My question is how should I set this up in my models?
...
I have a controller action which has a nullable DateTime as one of the parameters which comes from a textbox on my form. I noticed that if the user were to type in "blah" in that textbox then I will get a Null value back for the DateTime param and a model error is automatically added. In this case the ModelState error that is added is "T...
Hi! I use the following bit of code in my Django app:
pictures = gallery.picture_set.annotate( score=models.Sum( 'picturevote__value' ) ).order_by( '-score' )
There is a table of galleries. In each of them are some pictures. When a user votes up or down a picture, a new row in 'picturevote' is inserted and connected to the picture. Th...
What's the easiest way to build an applet that has a view with components that are bound to model data and update when the model is updated?
Ideally as little code as possible, preferable none/declarative :)
If a component type is needed for explanation, please consider a JLabel whose text is bound to a bean with a String getText() acc...
Im writing a game engine and I'm wondering what 3D model format should I use/load/export? Obj seems universal and easy but it also appears to be unreliable in that most models out there contain errors and it doesn't store anywhere near as much as other formats.
There appear to be formats specifically for games such as MD2/3/5 but Im not...
I'm building a simple blog with comments. There is a Post model and a Comment model. Every interaction between the two works fine except for creating new comments. I'm having an issue in Rails when trying to post a new comment:
wrong number of arguments (1 for 0)
Here are the request parameters (from the stack trace):
{"commit"=>"Pos...
I'm using ASP.NET MVC RC1 and trying to bind a textbox to an object property like so:
<%= Html.TextBox("Comments.Contacts[0].ContactName") %>
It seems like it should work, since this does:
<%= ((MuralProject)ViewData.Model).Comments.Contacts[0].ContactName %>
But alas, the result in the textbox is an empty string. Am I doing someth...
Let's say I have to model the meals of a diner.
A meal can consist of several "components":
(Fries OR rice OR wedges)
AND (One of six different beverages)
AND (One or two out of seven different sauces OR none at all)
Another meal can consist of:
(Salad OR rice)
AND (Garlic OR no garlic)
Further meals can consist of:
Just fries...
Hi all,
Since the beginning, Rails has had issues with namespaced models. As time went on, pretty much everybody gave up on using it. Myself included.
With Rails 2.3 out, I'd like an update on the situation. Specifics questions I have in mind are:
first off, is it good to go?
table naming, what rule to follow?
associations, how to d...
I've this system that consists of lots of different stages piped together.
Specifically, I've got lots of different processes that communicate via tcp-ip; messages are exchanged
via a packet oriented protocol (more messages can be stuffed together in a single wire-protocol data unit
if certains conditions are met); I've control flow queu...
I'm relatively new to Object Oriented Programming. I pretty much understand the concepts, but practically speaking, I am having a really hard time finding information about how to best use Models in my Zend Framework applications.
Specifically, I have a Model (that doesn't extend anything) that doesn't use a Database Table. It uses gett...
I have a Model as follows
class TankJournal(models.Model):
user = models.ForeignKey(User)
tank = models.ForeignKey(TankProfile)
ts = models.IntegerField(max_length=15)
title = models.CharField(max_length=50)
body = models.TextField()
I have a modelform as follows for that model
class JournalForm(ModelForm):
tank = forms...
Hey everyone,
Setup using a simple example: I've got 1 table (Totals) that holds the sum of the 'amount' column of each record in a second table (Things).
When a thing.amount gets updated, I'd like to simply add the difference between the old value and the new value to total.sum.
Right now I'm subtracting self.amount during 'before_up...
So I am creating a C#/Winforms application in a model-view-controller pattern. My view-controller needs to instantiate multiple groups of objects. The object groups are elements of the model and elements of the view. So for example a textbox and the model to go behind that text box.
I'm wondering if the best way to do this is to put eve...
I'm trying to write a nice GUI in Swing that uses the proper Model-Delegate pattern as much as possible. I have a JComboBox that when changed, needs to update the model with the new data. To get the currently selected item, I am using:
fooCombo.addItemListener(new ItemListener() {
public void itemStateChanged(final ItemEvent arg0) {...
So I would like to use the new possibility to create extensions for Sinatra.
My Extension needs to integrate a model and some views/templates but I don't know how to or where to integrate them?
Did anybody already built something more complex than the example from the documentation?
...
What is the best practice of introducing custom (typically volatile) data into entity model classes? This may sound like a bad practice first, but it seems to be quite a common scenario. In our recent web application we have developed a proper model and in most cases we are fine with loading model entities. But there are cases where we c...
Does anyone have any suggestions on what Model Based Testing Tools to use? Is Spec Explorer/SPEC# worth it's weight in tester training?
What I have traditionally done is create a Visio Model where I call out the states and associated variables, outputs and expected results from each state. Then in a completely disconnected way, I data d...
What is the recommended way to return ad hoc (custom case by case) data from repository which don't fit any model entities or which extend some?
The 101 example would be the ubiquitous hello word application: a blog system. Suppose you want to load a list of posts where post entry has some additional information which does not exists in...
I am trying to create a model for a ruby on rails project that builds relationships between different words. Think of it as a dictionary where the "Links" between two words shows that they can be used synonymously. My DB looks something like this:
Words
----
id
Links
-----
id
word1_id
word2_id
How do I create a relationship between t...