model-view-controller

passing data from controller to model in Joomla 2.5

随声附和 提交于 2019-12-23 02:32:37
问题 I am developing a joomla 2.5 component where I need to pass data from controller to model . The controller is receiving data from url. I find that controller is getting the value properly. Now I need to move that value to model from controller. From different post I have found a snippet of code for controller like below. $datevalue = JRequest::getVar('day',$day); //receiving value from view $item = JRequest::setVar('day',$datevalue); //setting variable $model =& $this->getModel('WeeklyProgram

determine if drive is removable (flash or HDD) knowing only the drive letter

点点圈 提交于 2019-12-23 02:20:46
问题 I am trying to determine if a file is on a local drive. I found GetDriveType() WINAPI which retrieves the drive type. However reading the description of the return values it seems, and thats how I understand it, that it retrieves a flash drive as FIXED which is not what I want. Its working fine on local drives: bool IsDriveRemovableOrRemote(CString driveRoot) { UINT driveType = GetDriveType(driveRoot); return (DRIVE_REMOVABLE == driveType || DRIVE_CDROM == driveType || DRIVE_NO_ROOT_DIR ==

How to map routes to controllers in Sinatra?

对着背影说爱祢 提交于 2019-12-23 02:05:10
问题 I'd like to create a simple experimental MVC framework using Sinatra. I'd like to define resources by name "pages" for example should resolve to: /pages (index) /pages/new /pages/:id/show (show) as WELL as map to app/controllers/PagesController.rb with corresponding get('/') to be responsible for the index, post('/pages/create') be responsible for creation, etc. Trouble is even after reading the official documentation I'm terribly confused. I imagine I need to use non-classic Sinatra model

EntityType 'SelectListItem' has no key defined. Define the key for this EntityType

ぃ、小莉子 提交于 2019-12-23 01:45:28
问题 i Have a Model Class public class Student { public int StudentId { get; set; } public string StudentName { get; set; } public ICollection<SelectListItem> CourseList { get; set; } } and the public class StudentContext : DbContext { public DbSet<Student> Students { get; set; } } and i try ti use it as List<Student> sList = db.Students.ToList(); and i am getting following error \tSystem.Data.Entity.Edm.EdmEntityType: : EntityType 'SelectListItem' has no key defined. Define the key for this

In MVC, MVP and MVVM the model could it be a collection of entities?

▼魔方 西西 提交于 2019-12-23 00:41:42
问题 I try to understand what a Model is. I already read this answer. In MVC, MVP and MVVM the model could it be a collection of entities? 回答1: Absolutely. A Model is all what describes a data used by business logic. Ofthen in MVVM Model is encapsulated by the appropriate ViewModel itself. You need to separate a Model layer from ViewModel in case when different models could be handled by a single ViewModel. 回答2: Sure it could, I think of a model as a collection of properties that are used to

How do I preserve data objects in Android/Java?

谁都会走 提交于 2019-12-22 19:00:57
问题 I'm a computer hobbyist who is working on a very small trivia game for the Android platform. In this game, I move the player between multiple activity/view pages (entry, question page, answer page, ultimate score page). I've created a question object that contains all data related to a single trivia question (question, four answers, pointer to correct answer, related comments that the computer makes when responding to the player's guess), and I've successfully populated an ArrayList of

A potentially dangerous Request.Path value was detected from the client

僤鯓⒐⒋嵵緔 提交于 2019-12-22 18:48:25
问题 I am at a complete loss for why I am getting this error. The typical cause of this error has to do with trying to submit HTML markup into a text string or something similar but I'm not doing anything like that. The page I think this is happening on takes in a simple email address. Here is my model with validation... public class Subscriber { [Key] [DisplayName("Email Address")] [Required(ErrorMessage = "{0} is required")] [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.

MVC 3/EF/SQL Server strange connection timeout issue

此生再无相见时 提交于 2019-12-22 18:42:39
问题 Before reading please note that I've googled this and read a ton of articles on SO and elsewhere, no suggestions have worked as of yet. I'm randomly getting a timeout error that occurs when logging into my MVC 3 application. It happens well over half of the time - all other times the application logs on just fine. When it doesn't work, it tries for about 10 seconds then errors. The error: Exception: "An error occurred while executing the command definition. See the inner exception for details

Is it a good idea to combine an Ajax/UI JS Framework (ext,jquery-ui) with an MVC PHP framework (zend, symfony)?

喜你入骨 提交于 2019-12-22 18:41:34
问题 I realize this is a very generic question, but I guess I'm not really looking for a definitive answer. Being new to PHP frameworks I'm having a hard time getting my head around it. Javascript frameworks, especially with UI extensions, seem to have their sort-of MVC-like approach by separating your JS code from your design. It just seems like it would get confusing to use an additional MVC framework on the backend. Is this commonly done for primarily AJAX-driven applications? Is there an

Integrating Ext.grid.panel validation and Ext.data.Model.validations

随声附和 提交于 2019-12-22 18:08:34
问题 I've been learning ExtJS4 after having done quite a bit of dev in ExtJS3. I'm quite intrigued by the new class Ext.data.Models, but I would love to integrate these validations with the validation function in Ext.grid.Panel. Can anyone point me in the direction of any examples of using the validations property of Ext.data.Model in a Grid panel? I've tried adding the validations to the model and putting invalid values in the grid, but it doesn't seem to throw an errors or the normal red lines.