Search Results

Search found 29508 results on 1181 pages for 'object initializers'.

Page 85/1181 | < Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >

  • How to create collection object in vbscript?

    - by Onnesh
    what should be the parameter for create object the following code dim a set a=CreateObject("Collection") //getting a runtime error saying ActiveX //component can't create object: 'Collection a.add(CreateObject("Collection")) a.Items(0).Add(1) MsgBox(a.Items(0).count) MsgBox(a.Items(0).Item(0))

    Read the article

  • Django admin - remove field if editing an object

    - by John McCollum
    I have a model which is accessible through the Django admin area, something like the following: # model class Foo(models.Model): field_a = models.CharField(max_length=100) field_b = models.CharField(max_length=100) # admin.py class FooAdmin(admin.ModelAdmin): pass Let's say that I want to show field_a and field_b if the user is adding an object, but only field_a if the user is editing an object. Is there a simple way to do this, perhaps using the fields attribute? If if comes to it, I could hack a JavaScript solution, but it doesn't feel right to do that at all!

    Read the article

  • Replace Entity Framework object

    - by majkinetor
    In MVC app, I am having this big object that is used in classic view/edit/create pattern. When user edits the object I save it as: public bool SetMyObject(MyObject newObject) { MyObject current = GetObjectById(newObject.Id); current.Prop1 = newObject.Prop1 ... current.PropN = newObject.PropN db.SaveChanges(); } MyObject is pretty big so I am wondering is there any better way to do this, not involving per-property assignments. For instance something along the lines db.MyObject.UpdateObject(current, tnew). Ty.

    Read the article

  • Method-Object pairs in Java

    - by John Manak
    I'd like to create a list of method-object pairs. Each method is a function returning a boolean. Then: foreach(pair) { if method evaluates to true { do something with the object } } One way of modelling this that I can think of is to have a class Constraint with a method isValid() and for each constraint produce an anonymous class (overriding the isValid() method). I feel like there could be a nicer way. Can you think of any?

    Read the article

  • Copy values from one object to another.

    - by BrokeMyLegBiking
    Anyone have a suggestion for a good utility class that maps values from one object to another? I want a utility class that uses reflection and takes two objects and copies values from the 1st object to the second if there is a public property with the same name. I have two entities that are generated from a web service proxy, so I can't change the parent class or impliment an interface or anything like that. But I know that the two objects have the same public properties.

    Read the article

  • Ptyhon date string to date object

    - by elif
    Hi all, How do I convert a string to a date object in python? The string would be: "24052010" (corresponding to the format: "%d%m%Y") I DON'T want a datetime object. I suspect that I'm asking a trivial question but I searched and couldn't find it neither on stackoverflow nor on google. Thank you, Elif

    Read the article

  • Copy a Doctrine object with all relations

    - by elManolo
    I want to copy a record with all his relations. I'm trying with: $o = Doctrine::getTable('Table')->Find(x); $copy = $object->copy(); $relations = $o->getRelations(); foreach ($relations as $name => $relation) { $copy->$relation = $object->$relation->copy(); } $copy->save(); This code doesn't works, but I think it's on the way.

    Read the article

  • Converting a ts object to a plain old vector in R

    - by taskforce145
    I need to use a function on a vector that does not take a ts object. I'm trying to convert it to a plain old vector but I just can't seem to figure it out. I googled around but mostly people are trying to convert data types into ts object. I want to go the other way. Any help would be appreciated.

    Read the article

  • Creating object in database without showing view to user

    - by samuil
    I have controller with action new, and I want it to create ActiveRecord::Base descendant object, and write it into database (without showing it to user). def new active_order = current_user.orders.find {|o| o.status > 0 } active_order = Order.new if active_order.nil? (...) end Order.new creates local object, but my question is -- how to make Rails to fill it with default values and write to database?

    Read the article

  • instantiate object with reflection using constructor arguments

    - by justin
    I'm trying to figure out how to instantiate a case class object with reflection. Is there any support for this? The closest I've come is looking at scala.reflect.Invocation, but this seems more for executing methods that are a part of an object. case class MyClass(id:Long, name:String) def instantiate[T](className:String)(args:Any*) : T = { //your code here } Is close to the API I'm looking for. Any help would be appreciated.

    Read the article

  • Foreach loop problem for Iqueyable object

    - by Vikas
    Hi, Can we use foreach loop for Iqueryable object? I'd like to do something as follow: query = Iqueryable<Myclass> = objDataContext.Myclass; // objDataContext is an object of LINQ datacontext class int[] arr1 = new int[] { 3, 4, 5 }; foreach (int i in arr1) { query = query.Where(q => (q.f_id1 == i || q.f_id2 == i || q.f_id3 == i)); } It gives me wrong output as each time value if i is changed.

    Read the article

  • Killing a thread while deleting an object

    - by viswanathan
    I have an application which does some socket communication with some hardwares. Assume for the particular hardware i have an object and this object intiates a thread which listens on a particular port number say 5001 infinitely until a connection is established. Now if i delete this obect is there anyway by which i can ensure that the thread that is listening on port number 5001 infinitely also gets destroyed.

    Read the article

  • Static member variable containing object instances

    - by tom
    I have the following: function Preferences() { } Preferences.players = { 'player1': new Player() } players is a static member variable of Preferences and I'm trying to make it an object containing an instance of a Player. However, it doesn't appear to let me do this. It seems like it will allow me to define players if I make it a non-static member variable however. Like so: function Preferences() { var players = { 'player1' : new Player() } } Is it possible to create a static member variable containing instances of an object in JS?

    Read the article

  • Convert any object to pretty HTML in java

    - by ripper234
    How can I convert a given object (in a generic way with reflection) to pretty printable HTML? What ready made library do you recommend that does this? I need support for simple nested objects (as long as they don't create loops in the object graph). I tried to convert it to JSON, but DefaultPrettyPrinter is not HTML friendly.

    Read the article

  • LINQ-to-SQL eagerly load entire object graph

    - by Paddy
    I have a need to load an entire LINQ-to-SQL object graph from a certain point downwards, loading all child collections and the objects within them etc. This is going to be used to dump out the object structure and data to XML. Is there a way to do this without generating a large hard coded set of DataLoadOptions to 'shape' my data?

    Read the article

  • Same object in different nib files?

    - by Michael
    View1 object, which is UIViewController subclass is the same object as File's Owner of View1 nib. So I should manually set the class in both places, one in MainWindow and another in View1 nib files? This sound artificial to me... Either I'm doing something wrong or there has to be better way.

    Read the article

  • django update object

    - by John
    Hi, How do I run an update and select statement on the same queryset rather than having to do 2 querys, ones to select the object and one to update the object? the sql would be something like update my_table set field_1 = 'some value' where pk_field = some_value Thanks

    Read the article

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