model

How to generate only one editor for more models in EMF ?

I have more EMF genmodels. It is pretty lame to create new editor for each model. After generation (right click - generateAll) old editor is always overridden. ...

How can you use Controller A to access table B (in the same database)?

I have a "jobs" model in my RoR project and i need the controller to access a table other than "jobs" in the database. Calling: @var = Job.find(:all) is not problem, but calling @var = TableB.find(:all) gets "undefined local variable or method `tableB'" for JobsController:Class Any ideas? Thanks! ...

N:M relation and deleting records

I have three tables: Context, Component and ComponentContext. The ComponentContext table links the Component and Context into an N:M relationship. I'm working on a C# project which imports a bunch of data into these tables. It uses an Entity model and as a result, I only see an Component entity and a Context entity within my code. Now,...

Model object is null in MVC's aspx page

Scenario: I have a page which contains a dropdownlist and a table which contains a list of details based on the value selected in the dropdownlist when the dropdown is changed. Now at first instance when the page is loaded, the dropdownlist contains a blank value followed by other values. So for the first time there won't be any values ...

C# LINQ: What is the difference between a Pull model and a Push model ?

I am currently reading Albahari's C# 3.0 in a Nutshell book and on page 292 it says this about LINQ: LINQ follows a demand-driven pull model, rather than a supply-driven push model. What does the above statement mean? And what is the difference between a pull model and a push model ? ...

cakephp data retrival

hi, I have two tables,Forms and Attributes. I'm tring to retrieve the last inserted id from the Forms table and insert it to the form_id column of the Attributes table, along with the other field columns. Earlier I retrieved the form Id from the Forms table and used it to update the value of the Form name column. It worked fine.The cod...

What type of Rails model relationship would work best for aggregate keys + multiple foreign keys?

I'm considering the following database structure but I'm not sure what type of Rails model relationships would support the database keys I have defined. Could anyone suggest how this might work in Rails? Posts id post_type -- must be 'Q' or 'A' author date content UNIQUE KEY (post_id, post_type) -- to support foreign keys Questions id ...

Should I freak out about Rails deprecation warnings?

When dealing with any framework with which you are not 100% familiar, I've found it advisable to attempt to understand and clean up any extraneous warnings, if only so that you have a better chance of noticing real errors when they occur. The one I've been getting lately has been: DEPRECATION WARNING: @model will not longer be implici...

(Ruby, Rails, Javascript) Managing nested models using javascript windows, etc...?

Hi All, I'm currently developing a Rails app with 4 nested models (as per THIS POST). I've considered using javascript to manage them all on one page. It appears doable (as do many things in Rails), however, it doesn't come highly recommended. That said, I'm looking to manage via proxy pages. Currently the model structure is as foll...

Django: Retrieve active threads by the time the last Post was created

Hallo people, I have two Models, Thread and Post, where one Thread can have many Posts. I want to retrieve the active threads by sorting by 'post_set.createtime'. In the end, I want to get exactly ten Threads that had the most recent activity. Is this possible using no own SQL? Thanks a lot in advance. [Copying the model definitions f...

GUI: Changing panels based on value of combo box

Hi, I have a question about GUI design, specifically with Java Swing and creating clean separation between presentation and model. It's a bit difficult to describe, but essentially we have lots of reference data in our system (i.e. that would correspond to lookup tables in the DB). We want people to be able to edit them all from one scr...

rails session model

How can I treat important session info as if it were a model? I've started toying with it, and some of it works. But I'm not sure what I'm missing? Does anyone know a good place to start or where I can find some good examples? Also, I'm able to use the model to set session variables, but what about getting them from the model as op...

In Rails how do I update form fields in the model?

Let's pretend I want to set all the fields I specify to be = "frog" In the model I can set each one manually using: self.field1 = 'frog' self.desc_field = 'frog' self.fieldx = 'frog' etc.... But how can I this by putting the field names in an array? When I try fields_array=['field1','desc_field','fieldx'] fields_array.each { |f...

Get validations of a Rails model

Given a model that has validations in the model_name.rb file, how can I access those validations manually? I'd like to cook up my own form validation system that would work alongside the built-in Rails tricks and I want to keep everything as DRY as possible. My main problem is that I need to make server-side validations before any of the...

Validating nested models?

To be more specific, "How do I validate that a model requires at least x valid associated models to be created?". I've been trying to validate nested models that get created in the same form as the parent (and ultimately show immediate validations a la jQuery). As a popular example, lets assume the following models and schema. class Pro...

Data Model design and Domain Model design

I'm attempting to model a grocery store. In the store, there are several "aisles". Each "aisle" has a group of "categories" of "items" it stores. Each "category" can only belong to one "aisle". Each "item" can only have one "category". The data model seems straight forward to me: An "aisle" table with an ID and DESCRIPTION A...

Access ExtJS grid's column model from other file

I have an ExtJS grid that has a button set up in it. The button triggers a function that's defined into other JS file that's included in the grid page. The function triggers ok but in that function I want to get the columns count like this: grid.getColumnModel().getColumnCount() The problem is that I get an error like: grid.getColumnM...

Vehicle Make/Model and Parts Database

I am looking to see if there is a web based service I can either access programmatically to access teh following information, or a database I could purchase or interface with. I am looking to see if there are databases out there for: 1) Vehicle makes and models -- I recall something being out there in the $500/yr range 2) Vehicle Par...

"Entity" vs. "entity information" dichotomy in a business model - is it really necessary in an "analysis model"?

My question is not exactly about programming per se, but I think SO has already overgrown its "programming-only" scope... For those who don't like to read long introductions, here is my attempt to formulate the question without any background - the chances are some of you could understand right away what I am asking about: Q: When deve...

Is there another way to create a contract for a LINQ-to-SQL model class?

I have two classes, for this example, that are partial classes against LINQ-to-SQL model classes. public partial class Foo { public bool IsValid { get { return (GetRuleViolations().Count() == 0); } } public IEnumerable<RuleViolation> GetRuleViolations() { yield break; } partial void OnVal...