Search Results

Search found 15231 results on 610 pages for 'presentation model'.

Page 83/610 | < Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >

  • Programatically adding,changing and removing controls bound to model objects (MVVM)

    - by Ittai
    I have the following scenario and I'm trying to decide how it can and should be implemented in silverlight and c# via MVVM. Scenario: I have the following objects in my scenario: MyModel, MyModelControl, MyView and MyViewModel. MyModelcontrol is a custom UserControl of mine and the rest I think are pretty much self explanatory. MyViewModel is a Subscriber of a message which hands it a Collection<MyModel> newCol and let's mark curCol as the current Collection<MyModel> that MyViewModel holds. I then want to programatically add MyModelControl controls for each MyModel instance which belongs to newCol and not to curCol. I also want to bind the MyModelControl instance to the corresponding MyModel instance. In a similar manner I want to remove the controls which don't belong now to the collection and I want to update a property for those which belong to both. I do not want to remove all controls which belong to curCol and then add all controls for newCol as the creation of MyModelControl is "expensive". I'd appreciate help with how this should be implemented in SL as I'm new to it and to the MVVM pattern. Comments regarding the design would also be welcomed. B.T.W This will run on Windows Phone 7 so I think there are some limitations on versions, if this is an issue please comment and I'll verify which versions exactly I can use on the phone.

    Read the article

  • Redirect on catching an exception in a method in the model

    - by Arkid
    I am using Authlogic-connect to connect various service providers. There is a method in user.rb def complete_oauth_transaction token = token_class.new(oauth_token_and_secret) old_token = token_class.find_by_key_or_token(token.key, token.token) token = old_token if old_token if has_token?(oauth_provider) self.errors.add(:tokens, "you have already created an account using your #{token_class.service_name} account, so it") else self.access_tokens << token end end When a service provider is already added it gives the error as stated in the has_token? method and the page breaks. I need to redirect the app to the same page and flash the error. How do i do this? I have overridden the method in my own user.rb so that I can change the code.

    Read the article

  • Update model objects across different activities

    - by Tom Esterez
    Lets say I have 2 activities: A: A ListView displaying articles titles. Data is fetched from a web server and converted from XML to a list of ArticleSummary. Only user titles and id are returned by the server. Click on a title starts activity B. B: A form to edit an article. Article is fetched from server. When the user hits OK, modifications are sent to the server and activity closed. When the user go back to activity A, I would like to update the article title without any additional web request. I was thinking about the following solution: When article is modified, send a broadcast event with article id and new attributes values. Listen for this event on activity A Update the ArticleSummary object notify data changed on ListView Is there a better approach ?

    Read the article

  • how to create a auto-incremented attribute in xcode managed object model

    - by Mausimo
    Hey, what i want to do is to make a int that will be the ID of the entity and auto increment itself whenever a new entity is added (just like a SQL identity property). Is this possible? i tried using indexed (checked on attribute) however there is no description to what indexed even does. EDIT: I am adding annotations to a map, when you click the pin the annotationview with a chevron shows up. Now when you click this button i would like to load an associated picture. However the only way i know how to link the picture to this button is to give the picture a unique id, and then set the button.tag to this id and then load based on the button.tag.

    Read the article

  • Warehouse Attributes model

    - by Orapps
    i am giving a training project for building a schema the following is the question all i would like to ask you guys is i am not sure what attributes would come in the table please see the problem below... create one new company and attach 10 attributes to the company. the company has two warehouses one in Torrance and another in Costa mesa. each warehouse should have 10 attributes. the company sells 100 products and services. each product and services should have 10 attributes. the company received orders. the orders should have HEADERS and Lines (am not sure what these are). each headers and lin should have 10 attributes. there should be a table for quantity on hand. the quantity on hand will increase once the warehouse receives good. please i only want some hints or clues on what attributes would generally come in this highlighted tables. thanks for help in advance guys....

    Read the article

  • Object model design choice

    - by spinon
    I am currently working on a ASP.NET MVC reporting application using C#. This is a redesign from a PHP application that was just initially thrown together and is now starting to gain some more traction. SowWe are in the process of reworking the backend to have a more OO approach. One of the descisions I am currently wrestling with is how to structure the domain objects. Since 95% of the site is readonly I am not sure if the typical approaches are practical. Should I create domain objects for the primary pieces of the application (ticket, assignment, assignee) and then create static methods off of these areas to pull the reporting data? Or should I just skip that part and create the chart data classes and have some get method off of these classes? It's not a real big application and currenlty I am the only one developing on it. But I feel torn as to which approach. I feel that the first one is the better choice but maybe overkill given that the majority of uses is for aggregate reporting. Anybody have some good insight on why I should go one way or another?

    Read the article

  • Using Session Vars in a MVC Domain Model library

    - by 104286623826380127552
    Hello to all. I have a IQueryable function. In that function, I need to store and retrieve data to Session; can you guys point me in the right direction. I've looked at the HttpSessionStatBase where the session is usually taken from HttpContext.Current but this doesnt seem possible to do in the library. Am I missing something? Thanks in advance.

    Read the article

  • C++ constructor problem, values not being set

    - by 2Real
    Hi, I'm new to C++ and I'm trying to figure out this problem I'm having with my constructor for one of my classes. What happens is... all my variables are initialized properly except two (health and type). #pragma once #include <irrlicht.h> #include <vector> #include <cassert> using namespace irr; using namespace core; using namespace scene; enum { PLAYER = 0, NPC = 1, SOLDIER = 2, CHAINGUNNER = 3 }; class Model { public: Model(void); Model(int id, std::vector<ISceneNode*> modelVec, int modType); ~Model(void); std::vector<int> path; std::vector<ISceneNode*> model; int endNode; int type; int animate; int health; u32 lastAnimation; private: int mId; }; #include "Model.h" Model::Model(void) { //assert(false); } Model::Model(int id, std::vector<ISceneNode*> modelVec, int modType) { path = std::vector<int>(); model = modelVec; endNode = 0; type = modType; animate = 0; health = 100; lastAnimation = 0; mId = id; } Model::~Model(void) {} I create a model with Model soldier(id, model, SOLDIER) Everything is set properly except type and health. I've tried many different things, but I cannot figure out my problem. I'm not sure but the default constructor is being called. It doesn't make sense because I make no called to that constructor. Thanks,

    Read the article

  • How to save to two tables using one SQLAlchemy model

    - by Oatman
    I have an SQLAlchemy ORM class, linked to MySQL, which works great at saving the data I need down to the underlying table. However, I would like to also save the identical data to a second archive table. Here's some psudocode to try and explain what I mean my_data = Data() #An ORM Class my_data.name = "foo" #This saves just to the 'data' table session.add(my_data) #This will save it to the identical 'backup_data' table my_data_archive = my_data my_data_archive.__tablename__ = 'backup_data' session.add(my_data_archive) #And commits them both session.commit() Just a heads up, I am not interested in mapping a class to a JOIN, as in: http://www.sqlalchemy.org/docs/05/mappers.html#mapping-a-class-against-multiple-tables

    Read the article

  • Reduce the number of additional Queries to 0 by overriding functions in the base model

    - by user334017
    my basic database setup is: User:... Info: relations: User: { foreignType:one } When displaying information on the user it takes: 1 query to find info on the user, and 1 query to find additional info I want to reduce this to one query that finds both, I assume I need to override a function from BaseUser.class.php, or something along those lines but I'm not really sure what to do. Thanks!

    Read the article

  • Rails: associate model with two of its kind

    - by Patrick Oscity
    hi all, im trying to do this: class Event < ActiveRecord::Base belongs_to :previous_event has_one :event, :as => :previous_event, :foreign_key => "previous_event_id" belongs_to :next_event has_one :event, :as => :next_event, :foreign_key => "next_event_id" end because i want to enable the user to repeat events and change multiple oncoming events at the same time. what am i doing wrong, or is there another way of doing this? somehow i need to know about the previous and the next event, don't i? when i'm testing this in the consolewith Event.all[1].previous_event, i get the following error: NameError: uninitialized constant Event::PreviousEvent from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2199:in `compute_type' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2195:in `compute_type' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/reflection.rb:156:in `send' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/reflection.rb:156:in `klass' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/belongs_to_association.rb:49:in `find_target' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:239:in `load_target' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:112:in `reload' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1250:in `previous_event' from (irb):2 what is going wrong here? thanks a ton for your help.

    Read the article

  • Rails: id field is nil when calling Model.new

    - by Joe Cannatti
    I am a little confused about the auto-increment id field in rails. I have a rails project with a simple schema. When i check the development.sqlite3 I can see that all of my tables have an id field with auto increment. CREATE TABLE "messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "created_at" datetime, "updated_at" datetime); but when i call Message.new on the console, the resulting object has an id of nil >> a = Message.new => #<Message id: nil, text: nil, created_at: nil, updated_at: nil> shouldn't the id come back populated?

    Read the article

  • RESTful API: How to model 'request new password'?

    - by Jan P.
    I am designing a RESTful API for a booking application and was quite happy to see I could map all details of the application to the 4 HTTP methods. /users - GET, POST /users/({id}|myself) - GET, POST, PUT, DELETE /users/({id}|myself)/bookings - GET, POST /users/({id}|myself)/bookings/{id} - GET, POST, PUT, DELETE Example: Updating my own user uses a PUT to /users/myself. But now I found out that one thing is missing: The possibility to request a new password if I forgot my old one. Any idea how I could add this?

    Read the article

  • jQuery model-view-controller vs Spring MVC

    - by user1515968
    my question is what potential problems or difficulties would be with implementing usual web app with somewhat reach user interface (multiple dynamic tabs, accordians and so on) using jQuery MVC approach with Spring REST vs using Spring MVC. Problems what I can think of could be: I will not be able to use Spring security fully, JavaScript coding could become hard to manage, any form verification becomes not easy to manage... what else? and does jQuery MVC with REST make sense at all? On other side jQuery with MVC and REST move all GUI concerns to JavaScript side (whether it is bad or not) and leave all data manipulation to server side.

    Read the article

  • ASP.NET MVC Access model data in masterpage

    - by Paul
    I have created a UserSiteBaseController that gets commonly used data and sets the data to a UserSiteBaseViewData viewmodel in a method called SetViewData public T CreateViewData<T>() where T : UserSiteBaseViewData, new() { .... } I then create specific Controllers that inherit from the UserSiteBaseController as well as viewModels that inherit from UserSiteHomeViewData and can be created in the controller like so: public ActionResult Index(string slug) { Slug = slug; var viewData = CreateUserSiteHomeViewData<UserSiteHomeViewData>(); //If invalid slug - throw 404 not found if (viewData == null) return PageNotFound(); viewData.Announcements = _announcementsData.All(slug).ToList(); return View(viewData); } private T CreateUserSiteHomeViewData<T>() where T : UserSiteHomeViewData, new() { T viewData = CreateViewData<T>(); return viewData; } The UserBaseViewData holds data that needs to be use on every page so it would be great to be able to access this data from the Masterpage in a strongly typed manner. Is this possible or am I going about this in the incorrect manner?

    Read the article

  • Yii Many_Many Relationship and Form

    - by Thorpe Obazee
    // Post model return array( 'categories' => array(self::HAS_MANY, 'Category', 'posts_categories(post_id, category_id)') ); I already have the setup of tables posts id, title, content categories id, name posts_categories post_id, category_i The problem I have is that I am getting an error when creating this form: <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'post-form', 'enableAjaxValidation'=>false, )); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model,'title'); ?> <?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>255)); ?> <?php echo $form->error($model,'title'); ?> </div> <div class="row"> <?php echo $form->labelEx($model,'uri'); ?> <?php echo $form->textField($model,'uri',array('size'=>60,'maxlength'=>255)); ?> <?php echo $form->error($model,'uri'); ?> </div> <div class="row"> <?php echo $form->labelEx($model,'content'); ?> <?php echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>50)); ?> <?php echo $form->error($model,'content'); ?> </div> <div class="row"> <?php // echo $form->labelEx($model,'content'); ?> <?php echo CHtml::activeDropDownList($model,'category_id', CHtml::listData(Category::model()->findAll(), 'id', 'name')); ?> <?php // echo $form->error($model,'content'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget(); ?> The error is: Property "Post.category_id" is not defined. I am quite confused. What should I be doing to correct this?

    Read the article

  • How to model file system operations with REST?

    - by massive
    There are obvious counterparts for some of file systems' basic operations (eg. ls and rm), but how would you implement not straightforwardly RESTful actions such as cp or mv? As answers to the question REST services - exposing non-data “actions” suggest, the preferred way of implementing cp would include GETting the resource, DELETing it and PUTting it back again with a new name. But what if I would need to do it efficiently? For instance, if the resource's size would be huge? How would I eliminate the superfluous transmission of resource's payload to client and back to the originating server? Here is an illustration. I have a resource: /videos/my_videos/2-gigabyte-video.avi and I want copy it into a new resource: /videos/johns_videos/copied-2-gigabyte-video.avi How would I implement the copy, move or other file system actions the RESTful way? Or is there even a proper way? Am I doing it all wrong?

    Read the article

  • MVC + Repository Pattern - Still depends on Data Model?

    - by Jack
    I've started a project for school in which I am using ASP.NET MVC 2 + LINQ2SQL, and a business layer so my UI doesnt interact with the DB directly. My question is this: In my MVC project, when bringing up views and passing around data, I still have to include my Data project for access to the classes in my Linq2Sql project. Is this correct? Example: Controller: ClassesRepository cr = new ClassesRepository(); // this is from my Business project Class classToEdit = cr.GetByClassId(id); // "Class" is from my data project I still have to reference the Class class in my linq2sql data project - shouldn't my UI be completely independent of my data layer? Or maybe I'm going about this all wrong.

    Read the article

  • Trying to pass variable from 1 Function to Another to Put in Array within same Model

    - by Jason Shultz
    Ok, that sounds really confusing. What I’m trying to do is this. I’ve got a function that uploads/resizes photos to the server. It stores the paths in the DB. I need to attach the id of the business to the row of photos. Here’s what I have so far: function get_bus_id() { $userid = $this->tank_auth->get_user_id(); $this->db->select('b.id'); $this->db->from ('business AS b'); $this->db->where ('b.userid', $userid); $query = $this->db->get(); if ($query->num_rows() > 0) { return $query->result_array(); } That get’s the id of the business. Then, I have my upload function which is below: /* Uploads images to the site and adds to the database. */ function do_upload() { $config = array( 'allowed_types' => 'jpg|jpeg|gif|png', 'upload_path' => $this->gallery_path, 'max_size' => 2000 ); $this->load->library('upload', $config); $this->upload->do_upload(); $image_data = $this->upload->data(); $config = array( 'source_image' => $image_data['full_path'], 'new_image' => $this->gallery_path . '/thumbs', 'maintain_ratio' => true, 'width' => 150, 'height' => 100 ); $this->load->library('image_lib', $config); $this->image_lib->resize(); $upload = $this->upload->data(); $bus_id = $this->get_bus_id(); $data = array( 'userid' => $this->tank_auth->get_user_id(), 'thumb' => $this->gallery_path . '/thumbs/' . $upload['file_name'], 'fullsize' => $upload['full_path'], 'busid'=> $bus_id['query'], ); echo var_dump($bus_id); $this->db->insert('photos', $data); } The problem I’m getting is the following: A PHP Error was encountered Severity: Notice Message: Undefined index: id Filename: models/gallery_model.php Line Number: 48 I’ve tried all sorts of ways to get the value over, but my limited knowledge keeps getting in the way. Any help would be really appreciated.

    Read the article

  • passing a parameter from an other model on ruby

    - by MAGE
    I'm very newbie in ruby and need your help. I must save a "Topic" and make it like this : @topic = Topic.new(params[:topic]) But I would like to pass an other information to this topic. It has a field "community_id" that link it to a community. The logged user has this information on his table. How can I pass the "community_id" from the logged user to the "community_id" of the "topic" created ? thx for your help

    Read the article

  • Authenticating model - best practices

    - by zerkms
    I come into ASP.NET from php so the reason why i ask my question is because it's totally different nature of how application works and handles requests. well, i have an exists table with user creditians, such as: id, login, password (sha hashed), email, phone, room i have built custom membership provider so it can handle my own database authentication schema. and now i'm confused, because User.Identity.Name contains only user's login, but not the complete object (i'm using linq2sql to communicate with database and i need in it's User object to work). at php applications i just store user object at some static method at Auth class (or some another), but here at ASP.NET MVC i cannot do this, because static member is shared across all requests and permanent, and not lives within only current request (as it was at php). so my question is: how and where should i retrieve and store linq2sql user object to work with it within current and only current request? (after request processed successfully i expect it will be disposed from memory and on next request will be created again). or i'm following totally wrong way?

    Read the article

< Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >