How to access view model data in jquery?
In my html, I use Model.Subcontract.company How can I reference that data in my jQuery? ...
In my html, I use Model.Subcontract.company How can I reference that data in my jQuery? ...
Hi i'm looking for a asp.net mvc callback for elaborate data before save a model. In rails there is before_save. Thanks ...
let's say i have variables A, B and C that two threads (T1, T2) share. i have the following code: //T1 //~~ A = 1; B = 1; C = 1; InterlockedExchange(ref Foo, 1); //T2 (executes AFTER T1 calls InterlockedExchange) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ InterlockedExchange(ref Bar, 1); WriteLine(A); WriteLine(B); ...
I have the following models: student class teacher a student can have multiple classes, a class can have 0 or 1 teachers. I want to be able to call a method on the student to see if they have a specific teacher, and return true or false. The following code seems to work, but i thought it looked a bit long winded, having to compare eac...
Hi, i googled for an hour now but maybe my Google-Fu is just too weak, i couldn't find a solution. I want to create an application that queries a service via JSON requests (all data and backend/business logic is stored in the service). With plain PHP it's simple enough since i just make a curl request, json_decode the result and get wha...
I have a class Lets say public class Customer { public int id; public string FirstName {get;set;} public string LastName {get;set;} public string JobName {get;set;} public double Salary {get;set;} } A grid shows all these customers on a page. However, depending on Customer selected say id=1 , I want FirstName to have a StringLengt...
Is there a way to do an "insert ignore" in cake without using a model->query function? $this->Model->save(array( 'id' => NULL, 'guid' => $guid, 'name' => $name, )); Generates error: Warning (512): SQL Error: 1062: Duplicate entry 'GUID.....' for key 'unique_guid'...
I posted a question awhile ago asking how I could limit the rate at which a form could be submitted from a rails application. I was helped by a very patient user and their solution works great. The code was for my comments controller, and now I find myself wanting to add this functionality to another controller, my Messages controller. I...
I have two tables registries and names. Consequently, I have two model classes. I'm coding a method in registries model and I need to fetch all names in the names table/model. How'd I do it? Should a simple new Names() work? But, is it recommended? ...
If I was writing a piece of software that attempted to predict what word a user was going to type next using the two previous words the user had typed, I would create two tables. Like so: == 1-gram table == Token | NextWord | Frequency ------+----------+----------- "I" | "like" | 15 "I" | "hate" | 20 == 2-gram table == Token ...
I have a model with a JSON field or a link to a CouchDB document. I can currently access the dynamic informaction in a way such as: genericdocument.objects.get(pk=1) == genericdocument.json_field['sample subfield'] instead I would like genericdocument.sample_subfield to maintain compatibility with all the apps the project currently sh...
Hello, everyone speaks about wrapping a model by a viewmodel. fine so far. But when I want persist my Model, how do I convert a ViewModel into a Model ? Reading all properties from the ViewModel into a new Model object seems very cumbersome. Any better method? ...
For anything but trival view models, I use a view model builder that handles the responsibility of generating the view model object. Right now, I use constructor injection of the builders into my controllers but this smells a little since the builder is really dependent upon which action method is being executed. I have two ideas in mind...
Hi everyone, I've been hunting for an answer to this on South's site, google, and SO, but couldn't find a simple way to do this. I want to rename a Django model using South. Say you have the following: class Foo(models.Model): name = models.CharField() class FooTwo(models.Model): name = models.CharField() foo = models.Fo...
Say I have a model called Book. I have a controller named books and related views for this model. Is it possible if I have another controller work with the model Book? Thanks all. :) ...
I am making a Viewer model with belongs_to :users belongs_to :orders that joins the models Users and Orders with a :has_many :through => :viewers. And the Viewer model has the attributes of user_id and order_id. How would I set it up so that new viewers are only accepted if both user_id and order_id are unique in the same row? I re...
Hi, i implementing a products catalog, that looks, like this: group 1 subgroup 1 subgroup 2 item 1 item 2 ... item n ... subgroup n group 2 subgroup 1 ... subgroup n group 3 ... group n The Models: class CatalogGroup < ActiveRecord::Base has_many: catalog_items has_many :catalog_item...
I am looking to replicate a given object function across various model files As you can see below, the 2 things I need to vary across the model are 1) the "guser" string 2) the self.xxx SIMPLIFIED CODE SAMPLE: def self.get_all statement="SELECT * FROM gusers WHERE" results = results + self.find_by_sql(["#{statement...
I use rich domain model in my app. The basic ideas were taken there. For example I have User and Comment entities. They are defined as following: <?php class Model_User extends Model_Abstract { public function getComments() { /** * @var Model_Mapper_Db_Comment */ $mapper = $this->getMapper(); ...
I have aggregated models like Customer:Order:Product. As my View is bound to the BillingViewModel which has a Property Customers of type ObservableCollection and ONE customer in this collection has a "list" of orders named ObservableCollection and ONE order in this collection has a "list" of products named ObservableCollection Well ...