model

Editing a model in Apple's Settings style

Hi there, I woud like to implement some editing mechanism for an iPhone application, that is I want the user to be able to edit an instance of my model. The model contains two types of data: The first is just an NSString where the user can write virtually anything he likes. The second one is a selection where he is able to pick one from...

Query all rows and return most recent of each duplicate

Hey guys, I've got a model that has an id that isn't unique. Each model also has a date. I would like to return all results but only the most recent of each row that shares ids. The model looks something like this: class MyModel(models.Model): my_id = models.PositiveIntegerField() date = models.DateTimeField() title = model...

MVC2 - How to obtain parent model (container) inside template

I'm writing an MVC2 app using DataAnnotations. I have a following Model: public class FooModel { [ScaffoldColumn("false")] public long FooId { get; set; } [UIHint("BarTemplate")] public DateTime? Bar { get; set;} } I want to create a custom display template for Bar. I have created following template: <%@ Control Lan...

COM Threading Model - Perpetual Confusion

Hi, I have been reading MSDN articles about COM Threading Model. In one of those (http://msdn.microsoft.com/en-us/library/ms687205%28VS.85%29.aspx), I came across following line: "Like other servers, in-process servers can be single-threaded, apartment-threaded, or free-threaded.". I am confused about what (COM Client thread and COM S...

JTable cell not reflecting changes, though editable

For a custom TableModel, I am overriding isCellEditable, which is returning true always. I am also overriding setValueAt, but don't know how to use the method, so that, JTable reflects the changes done by editing. Below is the modified code for PersonTableModel :- class PersonTableModel extends AbstractTableModel{ public int getR...

Can I pass arguments into a model function?

Is it even possible to do something like this in codeigniter?Is it considered a good practice in general? ...

Help with Codeigniter and MVC model pattern

I am creating a site much like a wordpress blog whereby the front page will display a post loop: with the post_summary, author info, and tags. I have four tables: posts | users | tags | tag relationships to display all the results i would need to do multiple JOINs for in the SELECT statement However, to stay with the MVC pattern, th...

How can i assure that a set of mapping is valid and eligible in NHibernate?

For example I have a joined-subclass namely Foo and wanna subclass Foo? I don't know even it's valid or not? ...

Alias for column names in Rails.

Hello. I write web-GUI for application and must (!) using names for columns such as 'delete' or 'listen-control' and so on. I find this code but it is dated by 05 Aug 2005 and not works with Rails 3. How can I redefine this names using native Rails mechanism? Is it possible? PS I'm know about problem with hyphens in the Rails. PPS ...

MVC Model with Relational database

I am creating this MVC model and trying to understand best way to do it.How should I get related data when I have relationships between tables.For example in code below I have created a formviewmodel and I am calling function to get all images in Images table for a user. Should I instead keep images property of Users model and fill that ...

Rails: class' id / object_id changes during same request

I have been having a problem when I try to compare two Rails models. They should evaluate as the same, but the way ActiveRecord implements == is causing it to fail. What's even stranger is the unit tests are passing. Suppose a User has many Posts, and Posts has many Comments. User also has_many comments. (and this is comparing two obje...

CakePHP, Email Model and Email Component. I've done somthing stupid.

Hi. I've been silly. I have a model called Emails, which I have build alot of functionality for, however now I have come to actually send emails in the emails controller and have hit a wall. The email component clashes with the model, they are both referenced with $this->Email. My question is how can I rename the component (going bac...

MVC Model best practice - How to handle non-user-input data

So, my question is that I have a model. My model has some data that is populated based on the id passed in through the url and set into a cookie, and the rest is user input, which is validated using data annotations. The "problem" I've come across is how to handle this non user input data. Do I put it in hidden controls and thus infla...

[rails3] How can I use session instance variable within validation?

I currently have below lines for application_controller.rb. Basically, I am using session to check whether user has logged in or not, including authentication. I just used a term m class ApplicationController < ActionController::Base protect_from_forgery protected # Returns the currently logged in member or nil if there isn't on...

Join a Flat Table to an EAV Table with Magento?

Hi, I am trying to manke an Adminhtml Grid which joins a table that I made called "facility" to "customer_entity" and all of its attribtues. I'm noticing that since my table is flat, and the model inherits fomr Mage_Core_Model_Mysql4_Collection_Abstract, I'm not able to use all the class_methods that I've seen as examples on the back...

Problem with deploying asp.net MVC 2 application on XP machine

Hi I have the application which is developed in asp.net mvc 2. I am trying to deploy it on Windows XP machine which having IIS 5.1 . It is deployed fine after I add the extension to web application node in IIS . I added .* by selecting the aspnet_isapi.dll from frameworks path. I know this is not problem of IIS . It is problem of I think...

Making an ASP.NET MVC polynomial root finder

So I've just been experimenting with ASP.NET MVC and I'm really starting to like the way everything has one single purpose (as far as the separation of purpose between the models, views and controllers) but I'm still having some trouble applying my basic knowledge to a somewhat practical purpose. So, I was thinking of trying to create a...

SSRS 2005 Report Model Filter Named Query on Global UserID

Hi, Is it possible to filter a named query in a reporting services data source view on the global user ID? I would like to do something like select UserName, ContactNumber, Email from Users WHERE (Users.UserName = User!UserID) so that it returns the name and contact details of the user running the report. Any help would be much apprec...

MVC View Model Get Child Object

I have a main Contact and ContactViewModel . How do I get contact model and update it to the database ? [HttpPost] public ActionResult EditContact(ContactFormViewModel contactView) { } I was doing like this before I needed ViewModel [HttpPost] public ActionResult EditContact(int id, FormCollection collection) { ...

ASP.NET MVC Complex Model Validation

I have a complex Model public class ComplexModel { public UserModel userModel; public ExtraInfoModel extraModel; } where UserModel may have required fields as in: public class UserModel { [Required] public string email; } how do I validate ComplexModel to make sure that the data annotations on its member mode...