model

Cakephp: how to access to model "variables" (mapped from db) from the controller after a set?

Ok i have this controller: class ExampleController extends AppController { var $name = 'Example'; public function test_me () { $this->Example->Create(); $this->Example->set( 'variable_from_db_1' => 'random_value_1', 'variable_from_db_2' => 'random_value_2' ); //here, how can i...

deploying to sharepoint using the object model doesn't work reliably

Deploying to sharepoint using the object model or STSADM commands sometimes results in one or more packages being in the "error" state in the web control, a redeploy instantly fixes this, usually, even stranger, if i create two apps one which adds and one which deploys then i get no problems, but putting a delay between a single program ...

Rspec, Model load order, fixtures and named_scope challenge

I have some players and the players have a trade state. Rather than hard code trade states like "active" and "inactive" and then have to go looking for strings, I thought I'd be clever and have a separate TradeState model so that a Player has a trade_state_id (a Player can be in only one trade state at a time). Now, it would be a conve...

Using asp.net mvc model binders generically

I have a hierarchy of classes that all derive from a base type and the base type also implements an interface. What I'm wanting to do is have one controller to handle the management of the entire hierarchy (as the actions exposed via the controller is identical). That being said, I want to have the views have the type specific fields on ...

Accessing ASP.NET MVC Model Data from external Javascript file

Hi, I'm trying to use JQuery's $.getJSON to access Model data from the Controller, and build a JSON object in the javascript to use as the user adds and removes items from a list. All JS is done in an external file. The hit to the server for the Model data is done only once after the page first loads so I can get the full list of option...

Embedding C# code using <%= code %> within javascript <script> tags

Hi All, I'm using ASP.NET MVC and would like to get Model information for use within my javascript. I've strongly typed the view, and thus am able to use <%= Model.Name %> within my HTML to get Model data. But once I'm in the <script> tags, I get no intellisense (in Visual Studio) when using <%, and the information doesn't seem to be r...

Implementing rental store in Rails: how to track an inventory state over time?

Let's say you're implementing rails app for a snowboard rental store. A given snowboard can be in one of 3 states: away for maintenance available at store X on loan to customer Y The company needs to be able to view a rental history for a particular snowboard a particular customer The rental history needs to include temporal dat...

How double underscore works in cakePHP?

which means, can i change the result of find() to another model using sth like: <?php fields = array('sum(vote.score) as Post__score_sum'), ?> and return: array( 'Post'=> array( 'score_sum' => 5 ) ); related: http://stackoverflow.com/questions/1611311/cakephp-pagination-sort-data-out-of-model ...

How can I tell if I'm in beforeSave from an edit or a create? CakePHP

Hello, I have a model where I need to do some processing before saving (or in certain cases with an edit) but not usually when simply editing. In fact, if I do the processing on most edits, the resulting field will be wrong. Right now, I am working in the beforeSave callback of the model. How can I tell if I came from the edit or add...

Conditions in associated models using Model->find() (CakePHP)

Hi, I am having some issues with CakePHP's find() method and conditions in 'deeper' model associations. There are some of these around but I could not find an answer to this so far. My model associations are User hasMany Post hasMany Comment hasMany Vote and Vote belongsTo Comment belongsTo Post belongsTo User respectively. The belongsT...

How to map the NHibernate Data Model to the Domain Model?

I started creating a domain model and now I asking myself, how can I map this domain model to a NHibernate Data Model ((using Fluent NHibernate)? Is there anywhere a good and simple example of how to do that? With Data Model I didn't think about the physical/relational Database Model(!) What I meant was the Data Model in the Data Access...

Reverse order of display of blog entries and comments, Ruby on Rails

I am new to rails so could use some help here. I have followed several tutorials to create a blog with comments and even some of the AJAX bells and whistles and I am stuck on something that I hope is easy. The default display for both blogs and comments is to list the oldest first. How do I reverse that to show the most recent entries an...

R: Use VAR model to predict response to change in values of certain variables

Hi I've fitted a VECM model in R, and converted in to a VAR representation. I would like to use this model to predict the future value of a response variable based on different scenarios for the explanatory variables. Here is the code for the model: library(urca) library(vars) input <-read.csv("data.csv") ts <- ts(input[16:52,],c(200...

Rails Custom Model Functions

I'm in a databases course and the instructor wants us to develop an e-commerce app. She said we can use any framework we like, and now that we're halfway through the semester she decided that Rails does too much and wants me to explicitly write my SQL queries. So, what I'd like to do is to write my own functions and add them to the mode...

How can I find out the model code for my Google mini

Hi there, We are experiencing some problems with our google mini and I need to know what model we're using as referenced here http://code.google.com/apis/searchappliance/documentation/52/troubleshooting/Designing%5FSearch%5FSolution.html#Queueing Our google mini is racked and the label seems to be underneath it, so it's not easy to fin...

EMAIL server FSP model

For my assignment I need to develop FSP model for email server and client. I manage to write simple model which describes one user, server and his mailbox, but I am having problems changing this system into one which have two users with two separate mailboxes. The FSP model that I have developed: USER = (read->USER | write->USER). SERV...

Trouble changing databases for my models in codeigniter

Hey SO, I'm making a website with two different databases. Let's say one is DB1, and the other is DB2. I've set up my database.php in the config folder, so they each have the correct host/password/username/database etc with db['DB1']['hostname'] and the other db['DB2']['hostname'] etc, so I'm pretty sure I've got that part right. Acc...

Book or Website on creating enterprise data model / API

I was recently listening to an interview with Joe Hewitt (Facebook iPhone app creator) and he mentioned that most important portion of an application these days is the core model. He goes onto say that the reason for this is that apps need to be built for every platform but stem from a single core (web, mobile, and 3rd party apps). I...

Associating a model twice, CakePHP

I have the following scheme: My site is a trivia game, so every Question "hasMany" Answers, but a Question also "hasOne" correct Answer that is also represented by the Answer model. I have yet to test this, but my programmer's instinct tells me that the retrieved array will be kind of redundant and it will not separate the correct Answer...

Rails Model With Aggregrate Data (not backed by a table)

Id like to create a model in rails that does not correlate to a table in the database. Instead the model should dynamically pull aggregrate data about other models. Example: I have a Restaurant model stored in the restaurants table in the DB. Id like to have a RestaurantStats model where i can run a RestaurantStats.find_total_visitors...