model

Attaching conditional methods(or attributes?) to a rails model

I'm using the friendly_id plugin to generate SEO-friendly URLS for some of my models. Currently, I have a model with two attributes: name and display_name. Essentially, display_name is preferred, but if it is blank, the model reverts to name. Friendly_id needs a field to base the URL off of: Class Market < ActiveRecord::Base has_fr...

iphone & rest web service - what is the best practice?

I am developing an iphone app that uses a php web service for all functionalities. I am planning on creating model objects to communication between my UI and web service. Is it better to create model classes on php to communicate between my iphone models and database? or is it ok to communicate directly from database to my model classes...

Setting a field to read-only in Rails after it's created

Hi, I'd like to protect a user-generated entry in a field after its initial creation. I'm asking the user for a unique name when they set up a project, and I want to stop that being changeable after the creation. Is there a way to do this in Rails? Can I set it as attr_accessible at first then switch it to to attr_protected? Cheers ...

How to reference a grails GSP model variable indirectly e.g. via .get(...)

I'm using a GSP for sending out emails based on the MailService plug-in. The sendMail closure passes (amongst others) body(view:..., model:myModel) I know that I can access every item of the myModel Map just using ${itemName} in the GSP. However as I sometimes want to build the item name dynamically like 'item'+i, I need to have some su...

Forcing left join on my simple inner join query

The site is already built from years. I am doing some modifications to it. It has controllers "Posts" and "Topics". On the topics page all recent posts are displayed. So it is a simple find of posts from "Posts" table. The fetch is not all assiciated to topic as we are showing all "Posts" and not "Topic" specific "Posts". In Topics cont...

cakephp validation response returning data to controller

Hi i have made a custom validation in the model. How can i access the result($visitor) from this in the controller? model: <?php class Visitors extends AppModel { var $name = 'Visitors'; var $validate = array( 'xxx' => array( 'rule' => array('checkxxx'), 'message' => 'yyy.' ) );...

Django: preventing QuerySet deletions on a model?

I have a model whose delete() method I have overridden. Because this is not called on a bulk QuerySet delete, I would like to disable QuerySet deletion or somehow assert against it happening. Is there any way to do that? ...

Removing null records from a set in Grails Controller

Hello again, so, Grails is making me feel quite stupid again, I'm new to this. I have A grails domain that maps a table thats in production on a postgresql database. I am trying to track progress on the project by a date field 'migratedDate'. Everytime a process takes place the field is timestamped. I can't seem to make a controller ...

Linear Model with Constraints, [R]

Hi all, I'm quite new to R and I have a following problem: I have a simple 2-factor linear model: Rate~factor1 + factor2 //factor1 has 8 categorical values, factor2 has 6 categories; model1 <- lm(Rate~factor1+factor2, data=myData) And want to put constraints SUM of factor1 coefficients = 0, the same for factor2. None of the manual...

What is a model.cs file?

What is a model.cs file? This appears in a project I am sharing with other dev's. What is a model.cs file? ...

MVC: Are Models and Entity objects separate concepts?

I asked here a while ago for some help in understanding MVC, since I'm very new to the topic. I thought I had a decent understanding of it, and this is documented in a blog post I wrote recently on the subject. My understanding basically boils down to this: Controller: Determines what needs to be done to fulfill a request, and utilizes ...

Convert Cognos Model to Microsoft SQL report model?

Is there any article or documentation describe converting Cognos model to Report Model for Microsoft reporting server? ...

has_many :through association results in NameError

I'm trying to do a many-to-many relationship in rails. It's my first try but I'm having a hard time to succeed. I want to be able to do @user.properties or @property.users. #property.rb has_many :ownages, :dependent => :destroy has_many :users, :through => :ownages #user.rb has_many :ownages, :dependent => :destroy has_many :properties...

How to generate half-edge structure representation for a polygonal mesh?

I would like to generate output to display the numeric data of the Half-Edge Structure that is based from an input of polygonal mesh data (in numeric data form). The concept to read the polygonal model basically is like this: For the INPUT, the file is in OFF format and include datas like (a) First part: the number of vertex, number o...

ASP.NET MVC: Getting ViewModel into partial view on ViewPage

I have a ViewPage, Index.aspx. In it, I have: <%= Html.Partial("~/Index/ViewUserControl/Promo.ascx, new PromoViewModel()); %> Now, the constructor for PromoViewModel requires a MemcachedCache object that the index's controller also uses. How should I pass this MemcachedCache into my partial view? Should I put the MemcachedCache inst...

ASP.NET MVC 2 : Having trouble with creating a Master-Detail View

Hi everyone ! I'm having trouble right now with the creation of a Master-Detail page in an ASP.NET MVC 2 project at the moment. This project uses Entity Framework OR/M for table mapping. I'm using a custom CategoryModel which is passing another list of objects. I've simplified the Model for presentation purposes : public class Cat...

Model Helper Zend

from what i know there is only action helper & view helper available at zend framework. is there any model helper? or how we can implement the model helper? ...

Resources on basics of 3D model rendering

Maybe I've missed something, but I couldn't find any questions about this already. If anyone knows of any then it would be great if you could post the links. I know there's loads of massive opensource engines out there already that it'd be really easy to use, it's not a problem of needing one, but I don't like not knowing how the things...

What is the difference between an MVC Model object, a domain object and a DTO

Hello, What is the difference between a MVC Model object, a domain object and a DTO? My understanding is: MVC Model object: Models the data to be displayed by a corresponding view. As such may not map directly on to a domain object, i.e. may include data from one or more domain objects. Client side May contain business logic, e.g. ...

After updating a model, the values don't reflect on the View

Hi All, I used Visual Web Developer 2010 and ASP .NET with MVC2 to create a simple Customer Management module, where the view will allow entering first name, last name, address, etc., and upon submitting, a new "ID" will be assigned to the CustomerID property of the CustomerModel instance. The Controller method (CustomerController) for...