mvc

MVC multi-model data import (fat model?)

I'm developing an app that will need to import data for three models from a single CSV file (with one-to-many associations). I have set up a Datafile model & controller to handle upload / parsing of the file. Right now, all the logic for parsing and saving the records is in the controller. This allows me to save to several different mode...

Ensuring folder name doesn't show up in the domain name.

Hello, our hosting account is set up with the domain www.nashman.ca, and our application is at www.nashman.ca/hub. We have another domain that forwards to www.nashman.ca/hub and that's hub.mhn.co. The problem i'm having with this is that the forwarded domain adds on the /hub whenever you navigate to another page from hub.mhn.co, so the d...

extracting reusable UI parts in cocoa touch - views vs controllers - how should it be done?

Let's say I am designing an iPad app that presents user a screen. The screen contains several "controls" that for the sake of this example can be simple labels with +/- signs that increment/decrement integer value presented by the label, making sure that the value doesnt exceed max number defined for each control (numerical up/down contr...

Can I get the name of the current controller in the view?

I am rather certain this is a stupid question, but I can't find the answer. Is there a way to figure out what the current controller is from within the view? For an example of why I would want to know this: if several controllers share the same layout, I may have a part in the layout ERB file where I want to highlight the current page'...

How would you setup a small MVC structure?

In a few weeks, I will guide some of our trainees through a customer project, where they have to build a small web application in php. My idea is to setup a small MVC structure for them to learn oop and mvc and to assure code quality. How would you do this? We have no special requirements, just php and mysql. Would you use a template sys...

Url.Action ASP.NET how do i redirect?

I want to redirect a link using url,action(...)to an external site http://external.com/Page.html How do i do that in ASP.NET? ...

Any pattern for "one class per one action/page"?

Hello, MVC is a really good pattern, but sometimes it is really boring to put everything into Controller's methods. Controller is constantly growing and it takes time to get rid of thousands of code lines. Some people highly recommends to put as much as possible into Model, but I prefer to keep Model clean (I don't put controller orient...

Popup window in .NET MVC

I have a requirement of populating a new window (With no menus, no address bar) using the existing data that I have on the page. I am using a java script function for this purpose. function popup() { window.open("../AcknowledgeStatements/OutStandingAckInPdf", '', 'scrollbars=yes,width=740,height=600,resizable=yes'); } <inp...

CAkePHP calling one controller action from a different controller

In my app, I want to add a user notification each time a user receives a comment on an image or other page. Therefore in my add action in my images controller, I'd like to also call the addNotifications action which is in my Notifications controller. I'm trying to stay away from requestAction based on the warnings, but is there another...

Designing view in Interface Builder, but with some logic defined in code

I want to create a simple "control" that will have 4 UILabels defined in it. On one hand I'd like to use Interface Builder to layout my design but on the other hand i'd like to expose some properties that will define contents of each label - is it possible? @interface CompositeView : UIView{ int numberOne; int numberTwo; } @property(n...

Can you have MVC without an ORM?

Can you have an MVC without an ORM? ...

Ajax.BeginForm Bug in MVC2?? Ajax for Posting to Wrong Controller?

I am using an ajax form trying to post back the the CustomerController using the Create method. Here is the code <% using (Ajax.BeginForm("Create", "Customer", new AjaxOptions { LoadingElementId = "saving"}, new { @class = "block_content form" })) {%>... When my html form renders the form looks like this <form onsubmit="Sys....

Should the model or controller be responsible for sending emails?

In a MVC web application, I often send emails. I usually do it in the controller, as I load all my views from the controller (including email views). Now, however, I have some code where the email sends from the model. Which tier is email generally sent from? Does it matter? Does it need to be consistent? ...

Contact page MVC workflow

All my previous projects have had this workflow on Contact pages User submits form Controller gets $_POST details Controller validates details (and sets error messages if necessary) Controller sends email Controller redirects to thanks page Is this the standard workflow? I used to validate everything in controllers, and then did som...

MVC Application with parent child relationship

Hi Guys, In my MVC application i have the parent child relationship. "Billing" is the perfect example. Table structure is Billing{name,address,billno,date,amt) and product(productid,name,qty,price,billno).i can add multiple products for particular billno.that means i am adding item in locally(adding items to grid or table throw JavaScri...

PHP using exit()

I am using Cakephp but this is a MVC/php doubt letting the view display the message vs echo 'Invalid Data'; exit; I would like to know is there any pitfalls in the second case like memory leak etc.. Which one is better EDIT In case of a ajax call is exit good. and what about memory leak and other issues . Are all variables deall...

Delete row in nested Telerik MVC grid

I face a problem - the controller method gets a NULL argument (key field value) from the nested (detail) view. What did I miss? <% Html.Telerik().Grid<mCustomer>() .Name("CustomerGrid") .Columns(columns => { columns.Bound(c => c.CustomerId).Title("CustomerId").Visible(false); columns.Bound(c => c.CustomerNam...

Efficiently updating a QTableView at high speed

I'm using a QTableView with a subclass of QItemDelegate to control the look and feel of the tableview's cells. Each cell displays the name and status of a of an externally connected device, and as many as 100 devices may be connected at once. The name and type of each device is essentially static, updating very rarely (perhaps once an ...

Session variable or if-else error in MVC?

I have faced a strange and very peculiar situation while storing a session variable in a controller. A simple if-else condition has not been working. I checked to see if there were any threaded applications accessing the webservice, any extra instance which was consuming the requests. None. And just for a simple explanation, below is wh...

Load models in Zend Framework

I tried to search here before creating this, but I couldn't find anything. I have a simple project without modules and I'd like to load my models (which are inside application/models) without using any namespace and without usign any extra loading lines. Basically what I want to do is to have my class Projects extends Zend_Db_Table_Abs...