Search Results

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

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

  • Implementing Excel 2003 COM Add-in UDF in Asyc Programming model using C#(VS 2005)

    - by Venu
    Hi: I am trying to implement a UDF using Excel COM Add-in(2003) with Visual Studio 2005 in C#. I would like to implement the UDF using async programming. The UDF is a slow operation as its results are fetched from a server. As an illustration(not a real world example),the following UDF works fine without any issue: public double mul(double number1, double number2) { return number1 * number2; } How can I do the same functionality in an async way: For example, I would like the UDF return immediately and later when the results are available from a server, I would like to update the desired cells. // This method returns immediately. public object mul(double number1, double number2) { return "calculating"; } // This method of a worker thread will update the results. public OnResultsAvailable(object result) { // Question: how should I update the cells that triggerred the calcualtions above? } Constraints: I cannot use Excel RTD as I have to work with existing codebase written using Excel C# COM Add-in. Thanks for the help. -Venu

    Read the article

  • accepts_nested_attributes with Model.update for multiple models

    - by Ohad
    Hi, I'm trying to follow http://railscasts.com/episodes/198-edit-multiple-individually but I would like to save objects which are nested (accepts_nested_attributes_for). I've added the following in my controller: def edit_multiple @people = Person.find(params[:person_ids], :include => [:parameters]) end def update_multiple keys = params[:people].keys if keys.empty? flash[:error] = "Please select at least one person" redirect_to :back and return end values = keys.map {|k| params[:people][k]} @people = Person.update(keys,values).reject { |h| h.errors.empty? } if @people.empty? flash[:notice] = 'Updated people!' redirect_to person_path else redirect_to edit_multiple_path end end and in the view: <% form_tag update_multiple_people_path, :method => :post do %> <% for person in @people %> <% fields_for "people[]", host do |f| %> <%= f.error_messages :object_name => "person" %> <h3><%= h person.name %></h3> <% for parameter in person.parameters %> <% f.fields_for "person_parameters[]", parameter do |builder| -%> <%= render "common/parameters", :f => builder %> <% end -%> <% end -%> <p><%= link_to_add_fields "Add a parameter", f, :person_parameters, "common/parameters" %></p> <% end %> <% end %> <p><%= submit_tag "Edit these Parameter(s)" %></p> <% end %> but I'm always getting a mistmatch - e.g. ActiveRecord::AssociationTypeMismatch and Parameter(#70341811965140) expected, got Array(#70341874300460) Thanks!

    Read the article

  • Using attr_accessible in a join model with has_many :through relationship

    - by Paulo Oliveira
    I have a USER that creates a COMPANY and become an EMPLOYEE in the process. The employees table has an :user_id and a :company_id. class User has_many :employees has_many :companies, :through => :employees class Employee belongs_to :user belongs_to :company attr_accessible :active class Company has_many :employees has_many :users, :through => employees Pretty basic. But here's the thing, the resource EMPLOYEE has other attributes than its foreign keys, like the boolean :active. I would like to use attr_accessible, but this causes some problems. The attribute :user_id is set right, but :company_id is nil. @user.companies << Company.new(...) Employee id:1 user_id:1 company_id:nil So my question is: if :user_id is set right, despite it is not an attr_accessible, why :company_id isn't set right just the same? It shouldn't be an attr_accessible. I'm using Rails 3.0.8, and have also tested with 3.0.7.

    Read the article

  • Ruby is already using the class name of my model

    - by Octopus Inc
    I'm making a forum application with various levels of authorization, one of which is a Monitor. I am doing this by extending my User class, and I plan on fine tuning this with "-ship" classes (e.g. administratorship, authorship, moderatorship, etc.). Apparently the Monitor class is part of ruby mixin. How do I keep my resource name without the collisions?

    Read the article

  • Retreive value from model into view ib MVC 3

    - by prerna
    public class HomeController : Controller { public ActionResult Index() { return View(); } /* public string Browse() { return "Hello from Browse"; public string Details(int id) { string message = "Store.Details, ID = " + id; return message; // return "Hello from Details"; }*/ public ActionResult Details(int id) { var album = new Album { Title = "Album " + id }; return View(album); } } I am new to MVC 3 ,My View is Details.aspx without Razor engine. <html> <head runat="server"> <title>Details</title> </head> <body> <div> </div> </body> </html> Can anyone help

    Read the article

  • How to access a plugin model from a regular controller in PHP Cake 1.1

    - by Duncan
    Hopefully a simple question: I've a plugin which uses a set of tables (kb_items, kb_item_tags, etc). and I'd like to be able to access these models from another controller (say, my Pages controller), thus: class PagesController extends AppController{ function knowledgebase(){ $items = $this->KbItem->findAll(...); } } I am admittedly breaking the rules a little (by not placing this controller inside the knowledge base plugin), but this in this case its a custom page that doesn't need to be part of the knowledge base plugin code base. Please let me know if you need more details. Thanks in advance for any help!

    Read the article

  • Feature Driven Development Model (SDLC)

    - by j-t-s
    Hi All I've been searching all over the internet for days. Does anybody have, or know of, and can share sample Feature Driven Development documents? I keep coming across gazillions of "samples" with absolutely no useful information whatsoever. Thank you jt

    Read the article

  • RSpec: Expectation on model's not working while testing controller

    - by gmile
    I'm trying to write a functional test. My test looks as following: describe PostsController do it "should create a Post" do Post.should_receive(:new).once post :create, { :post => { :caption => "ThePost", :category => "MyCategory" } } end end My PostsController (a part of it actually) looks as following: PostController < ActiveRecord::Base def create @post = Post.new(params[:post]) end end Running the test I'm always receiving a failure, which says that the Post class expected :new but never got it. Still, the actual post is created. I'm a newbie to RSpec. Am I missing something?

    Read the article

  • MVC Model State

    - by gnome
    Greetings On all my controllers I recycle the same code that wraps my models and to accesses the service layer -- and I'm tired for copy / pasting it into each controller: private IProjectService _service; public New() { _service = new ProjectService(new ModelValidation(this.ModelState)); } public New(IProjectService service) { _service = service; } Is there someplace where I can place this where all my controllers access it?

    Read the article

  • Rails routes and model woes

    - by Chris Maness
    I'm a little new to rails sorry if this seems basic Alright so here's the deal I'm creating an application that will have many users and all the users have many songs. However when I try to create a song I get the following error:No action responded to 1. Actions: create and new and my browser is at the url: http://0.0.0.0:3000/users/1/songs which is not the correct route it should have redirected to songs/create Here is my controller code: class SongsController < ApplicationController def index @user = current_user @songs = @user.songs end def new @user = current_user @song = @user.songs.build end def create @user = current_user @song = @user.songs.build(params[:song]) if @song.save redirect_to user_song_url(@user, @song) else render :action => "new" end end end If anyone can help I would greatly appreciate it.

    Read the article

  • Paypal as in-app Payment model in Android?

    - by sunil
    Hi, I am integrating Paypal into my application for in-app purchase. I am using Paypal Mobile Checkout for this purpose. I will like to know whether Android Market will approve this kind of application which uses a payment gateway other than Google Checkout. Can anyone let me know where I can find information related to this? Thanks & Regards Sunil

    Read the article

  • Find model records by ID in the order the array of IDs were given

    - by defaye
    I have a query to get the IDs of people in a particular order, say: ids = [1, 3, 5, 9, 6, 2] I then want to fetch those people by Person.find(ids) But they are always fetched in numerical order, I know this by performing: people = Person.find(ids).map(&:id) => [1, 2, 3, 5, 6, 9] How can I run this query so that the order is the same as the order of the ids array? I made this task more difficult as I wanted to only perform the query to fetch people once, from the IDs given. So, performing multiple queries is out of the question. I tried something like: ids.each do |i| person = people.where('id = ?', i) But I don't think this works.

    Read the article

  • OO model for nsxmlparser when delegate is not self

    - by richard
    Hi, I am struggling with the correct design for the delegates of nsxmlparser. In order to build my table of Foos, I need to make two types of webservice calls; one for the whole table and one for each row. It's essentially a master-query then detail-query, except the master-query-result-xml doesn't return enough information so i then need to query the detail for each row. I'm not dealing with enormous amounts of data. Anyway - previously I've just used NSXMLParser *parser = [[NSXMLParser alloc]init]; [parser setDelegate:self]; [parser parse]; and implemented all the appropriate delegate methods in whatever class i'm in. In attempt at cleanliness, I've now created two separate delegate classes and done something like: NSXMLParser *xp = [[NSXMLParser alloc]init]; MyMasterXMLParserDelegate *masterParserDelegate = [[MyMasterXMLParser]alloc]init]; [xp setDelegate:masterParserDelegate]; [xp parse]; In addition to being cleaner (in my opinion, at least), it also means each of the -parser:didStartElement implementations don't spend most of the time trying to figure out which xml they're parsing. So now the real crux of the problem. Before i split out the delegates, i had in the main class that was also implementing the delegate methods, a class-level NSMutableArray that I would just put my objects-created-from-xml in when -parser:didEndElement found the 'end' of each record. Now the delegates are in separate classes, I can't figure out how to have the -parser:didEndElement in the 'detail' delegate class "return" the created object to the calling class. At least, not in a clean OO way. I'm sure i could do it with all sorts of nasty class methods. Does the question make sense? Thanks.

    Read the article

  • Restricting Access in ERB code.

    - by LGFaler
    I am trying to build a CMS using ERB. Is there a way you can give ERB code read-only access to your models? For instance, I want to be able to load any information on my models (Model.all, Model.find_by_slug, Model.find_by_name, Model.other_model.name, etc...), but I don't want to be able to change this data. Can you disable ERB from executing commands that would make database changes (Model.save, Model.update, Model.delete, Model.destroy, etc.)???

    Read the article

  • How to limit manytomanyfields on a model ?

    - by Tom
    I would like to check that I get not more than 3 relations set on a manytomanyfield. I tried on the clean method to do this : if self.tags.count()>3: raise ValidationError(_(u'You cannot add more than 3 tags')) But self.tags returns not the current updates... only saved objects. Do you have an idea to access to them ? Thanks

    Read the article

  • Model-layer validation in Doctrine, Symfony

    - by Andree
    Hi there, I have a schema.yml containing something similiar to the following: Character: tableName: characters actAs: { Timestampable: ~ } columns: id: { type: integer(4), primary: true, autoincrement: true } name: { type: string(255), notnull: true, notblank: true, minlength: 3 } I define the minlength of the column name to be 3. I created a unit test to test the minlength validation, and I found out that the validation is not working. $character = new Character(); $character->set('name', 'Dw'); $t->ok(! $character->isValid()); # This test failed Can someone tell me what might be the problem here? Thanks, Andree

    Read the article

  • Can django lazy-load fields in a model?

    - by Leopd
    One of my django models has a large TextField which I often don't need to use. Is there a way to tell django to "lazy-load" this field? i.e. not to bother pulling it from the database unless I explicitly ask for it. I'm wasting a lot of memory and bandwidth pulling this TextField into python every time I refer to these objects. The alternative would be to create a new table for the contents of this field, but I'd rather avoid that complexity if I can.

    Read the article

  • Canonical pattern reference in Actors programming model.

    - by Bubba88
    Hello! Is there a source, which I could use to learn some of the most used and popular practices regarding Actor-/Agent-oriented programming. My primary concern is about parallelism and distribution limited to the mentioned scheme - Actors, message passing. Should I begin with Erlang documentation or maybe there is any kind of book that describes the most important building blocks when programming Actor-oriented? Thank you! (Most useful examples would be in Scala or F#)

    Read the article

  • Can't destroy record in many-to-many relationship

    - by Dmart
    I'm new to Rails, so I'm sure I've made a simple mistake. I've set up a many-to-many relationship between two models: User and Group. They're connected through the junction model GroupMember. Here are my models (removed irrelevant stuff): class User < ActiveRecord::Base has_many :group_members has_many :groups, :through => :group_members end class GroupMember < ActiveRecord::Base belongs_to :group belongs_to :user end class Group < ActiveRecord::Base has_many :group_members has_many :users, :through => :group_members end The table for GroupMembers contains additional information about the relationship, so I didn't use has_and_belongs_to_many (as per the Rails "Active Record Associations" guide). The problem I'm having is that I can't destroy a GroupMember. Here's the output from rails console: irb(main):006:0> m = GroupMember.new => #<GroupMember group_id: nil, user_id: nil, active: nil, created_at: nil, updated_at: nil> irb(main):007:0> m.group_id =1 => 1 irb(main):008:0> m.user_id = 16 => 16 irb(main):009:0> m.save => true irb(main):010:0> m.destroy NoMethodError: undefined method `eq' for nil:NilClass from /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/active_support/whiny_nil.rb:48:in `method_missing' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/persistence.rb:79:in `destroy' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/locking/optimistic.rb:110:in `destroy' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/callbacks.rb:260:in `destroy' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/active_support/callbacks.rb:413:in `_run_destroy_callbacks' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/callbacks.rb:260:in `destroy' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/transactions.rb:235:in `destroy' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/transactions.rb:292:in `with_transaction_returning_status' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/transactions.rb:207:in `transaction' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/transactions.rb:290:in `with_transaction_returning_status' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/transactions.rb:235:in `destroy' from (irb):10 This is driving me crazy, so any help would be greatly appreciated.

    Read the article

  • Ado.net entity model problem

    - by ognjenb
    public ActionResult Index() { using (testEntities korisnici = new testEntities()) { my_aspnet_users user = new my_aspnet_users(); user = from i in korisnici.my_aspnet_users select i; return View(user); } } Error: Cannot implicitly convert type 'System.Linq.IQueryable' to 'MyApp.Models.my_aspnet_users'. An explicit conversion exists (are you missing a cast?)

    Read the article

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