model

Getting an image from a game model

So I'm not 100% sure if it's possible, but what I'd like to do is take a model that someone has created for a game, say in Blender or something similar, in various formats, and from that create an image to show on a website. Are there any Java libraries around that could help me with that? Java3D maybe? Or even something in Flash? Ideal...

ASP.NET MVC Model vs ViewData For Select Lists

I have an ASP.NET MVC application with quite a few drop-down lists and multi-select lists. Essentially, a lot of lists of options. My question is; is it better to pass these lists to the view as part of the Model, or as ViewData? I am currently passing them as ViewData as I don't really need them on the model and they seem potentially ...

Converting a math problem into a discrete-event simulation

I am trying to implement the SIR epidemic model. Basically, the way I understand the model is that at each time step, it tells us how many nodes get infected and how many nodes are recovered. I am now trying to convert this into an discrete-event simulation and am confused at a point. The model is generally solved using Euler's method. ...

Ruby on Rails ActiveRecord: table with foreign keys in more than one other table

I'm new to Ruby on Rails and I'm trying to model my table relationships. To simplify the problem, let's say I have 3 tables: -- Customer (id, address_id, ...) -- Employee (id, address_id, ...) -- Address (id, ...) Would the Address model have the following? has_one :customer has_one :employee I know this is true in the case of a sin...

Ruby on Rails ActiveRecord: pluralization

I'm new to Rails, so forgive my ignorance of ActiveRecord. One of my models is named "campus". I ran the migration and it pluralized everything except "campus". I thought that was lame so I added the code to the environment config to leave everything singular. I deleted the tables, manually edited the migration files to use singu...

Recursive subdirectory SQL problem

This is a mental excercise that has been bothering me for a while. What strategy would you use to solve this sort of problem? Let's consider the following simple database structure. We have directories, obviously a tree of them. Also we have content items, which always reside in some directories. create table directory ( directoryId ...

Generating separate "model" classes from a WCF service

I'd like to be able to generate individual classes (one class per file) for each Data Contract or XML type in a WCF Web Service. I've read the svcutil documentation, and unless I skimmed a little too fast, it doesn't look like the tool supports this behaviour. The reason I want to do this is simple - I'm trying to isolate the service's...

How do I get a value from a composite key table using a Rails model?

I have the following schema (* means primary key): languages id* english_name native_name native_to_target_language native_language_id* target_language_id* target_language_name overview_text (target_language_name is the name of the target language as written in the native language). I want to get the value of target_la...

How do you deal with "defaults" when doing DDD

I am interested to see how people deal with decision trees when doing DDD. For example we have a requirement that when persisting new instance of particular type, some "default" associations have to be built (quite a few). User is free to change them later on though. So if one creates a decision table, how do you represent this in you do...

How to bulk upload in appengine with reference field ?

Hi, I want to bulk upload data for following entity: class Person(db.Model): name = db.StringProperty(required=True) type = db.StringProperty(required=True) refer = db.SelfReferenceProperty() What is best way to load this data into appspot ? Thanks, ...

How do I handle an inventory tracking data model in rails with mysql?

Okay, so I am modeling a Datacenter with an inventory of Parts for replacement of failures inside a Server. (present models italicized). I have an InventoryEntries model because I have a swap model that a datacenter enters on a form to record that a replacement part(cpu,psu,fan,bbwc) has been taken from inventory and placed in a server b...

How to use bll, dal and model?

Dear all, In my company I must use a Bll, Dal and model layer for creating applications with a database. I've learned at school that every databasetable should be an object in my model. so I create the whole model of my database. Also I've learned that for every table (or model object) there should be a DAO created into the DAL. So I d...

Polymorphism on ActiveRecord model

I have two models, say Product and Bundle. products table is related to product_prices table and bundles to bundle_prices (need to make these separations to support multiple currencies) Obviously both Product and Bundle share some similar methods like get_price I have make both Product and Bundle pointing to an abstract Class for this...

using cakephp, how do I handle model operations that return no results so my view doesn't break?

In my controller I have model operations that can return empty results. I've setup the view to display the results using a foreach loop. But if the model opertion is empty and returns no results then the foreach loop is breaking in my view. This is the operation: $match3 = $this->Draw->Match-> find('all',array('conditions'=>array('Matc...

Is there a way to transparently perform validation on SQLAlchemy objects?

Is there a way to perform validation on an object after (or as) the properties are set but before the session is committed? For instance, I have a domain model Device that has a mac property. I would like to ensure that the mac property contains a valid and sanitized mac value before it is added to or updated in the database. It looks ...

If a data model changes (an object) whats the best approach to also update the database ?

Let's say theres a Teacher object and that Teachers holds a list of Courses objects. The courses for the Teacher can change. Some get added, some get deleted. What's the best approach to update this changes in the database. 1. Right after every change, update the database. e.g.: A course get added, immediately add that into the database ...

Making HABTM relationships unique in CakePHP

I have two models, called Book and Tag, which are in a HABTM relationship. I want a couple (book, tag) to be saved only once. In my models I have var $hasAndBelongsToMany = array( 'Tag' => array( 'className' => 'Tag', 'joinTable' => 'books_tags', 'foreignKey' => 'book_id', 'associationForeignKey' => '...

Apps not showing in Django admin site

I have a Django project with about 10 apps in it. But the admin interface only shows Auth and Site models which are part of Django distribution. Yes, the admin interface is up and working but none of my self-written apps shows there. INSTALLED_APPS INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.sites', 'django.co...

Modeling Buyers & Sellers in a Rails Ecommerce App

I'm building a Rails app that has Etsy.com style functionality. In other words, it's like a mall. There are many buyers and many sellers. I'm torn about how to model the sellers. Key facts: There won't be many sellers. Perhaps less than 20 sellers in total. There will be many buyers. Hopefully many thousands :) I already have...

Database structure - is mySQL the right choice?

Hi everyone, We are currently planning the database structure of a quite complex e-commerce web app that has flexibility as its main cornerstone. Our app features a large amount of data (products) and we have run into a slight headache trying to keep performance high without compromizing normalization rules in the database, or leaving ...