objects

Looping through localStorage in HTML5 and JavaScript

So, I was thinking I could just loop through localStorage like a normal object as it has a length. How can I loop through this? localStorage.setItem(1,'Lorem'); localStorage.setItem(2,'Ipsum'); localStorage.setItem(3,'Dolor'); If I do a localStorage.length it returns 3 which is correct. So I'd assume a for...in loop would work. I was...

PHP accessing a property of an object

Hi There, I have an object that looks like this when outputted via a print_r Array ( [178] => My_Model_Category Object ( [autoGenerateURLNameIfNotSupplied] => 1 [id] => 178 [name] => Just for Kids [date_created] => 2010-04-06 16:08:40 [last_updated] =...

Java object copy best option?

I need to copy an object in Java (i.e. copy the object "by value not by reference" so that the new object is not just a reference to the old). I'm weary of implementing clonable and would prefer to use a copy constructor. However, the class I need to copy has MANY member variables that need to be copied (over 100) so adding a new const...

VB6 Object Comparison

What VB6 method allows two custom objects of the same type (defined in a class module) to be compared to each other? I think there's an equivalent to Java's compareTo method, but I can't find it anywhere. ...

C# .NET web service and returning list of objects that have children with a list of child objects

I am building a web service to pass back a list of (artist) objects. Inside of the artist object there is a list of (album) objects. Inside the Album object there is a list of songs. SO basically I am building a big parent child tree of music. My question is, how to I pass this using SOAP? What is the best method to use. Right no...

Binding C# Objects to ListView / control

Hey all, I have a class that returns a list of "Category" Objects. I'd like to display them along the left-hand side of the page in a listview (if that's the best way to do it, even). The category objects have normal attributes. Title, User, NumberOfProjects. I'd like to display both the title and the number of projects in this list. ...

send message to multiple objects at once (objective-c)

(or set multiple objects with one value) Is there a way to send multiple objects one message in one line. So like [someObject, otherObject reset]; like in LUA scripts (which I believe is C?) you can set mutliple objects: someThing, otherThing = 1 , 0 ...

Least sloppy way to enforce allowable values or ranges for class properties

Say hypothetically I have a class... class Main { $prop1 = 2; $prop2 = 23; ... $prop42 = "what"; function __construct($arg_array) { foreach ($arg_array as $key => $val) { $this->$key = $val; } } } Say I create and object... $attributes = array("prop1"=>1, "prop2"=>3...

Where to correctly declare and release Objects in Objective C

I would like to know from people with experience where the best place to declare, initialize and release objects is. Should all objects including NSStrings always be declared in the header file? Are variables like an int declared in the header file? If I declare an object or use an object in a method, should it be released in that met...

Calling a function of a 'super' javascript object

I have an object structure/hierarchy like the one below: var obj = { dimensions : { x : 100, y : 100, w : 300, h : 400, cmp : function () { return this.x + this.y; } }, definition : { base : { rect1 : { // how do I get th...

why json_decode isnt working for some code??

for this json api response I am able to parse with json_decode: $string = '{"name": "Google", "permalink": "google", "homepage_url": "http://google.com", "blog_url": "http://googleblog.blogspot.com", "blog_feed_url": "http://googleblog.blogspot.com/feeds/posts/default?alt=rss", "twitter_username": "google", ...

Tracking rectangles with opencv

I want to define the orientation and location of the rectangle from web-camera. I used the algorithm camshift, but it gave poor results (high dependence on lighting). Tell my what mechanisms exist to solve this problem. May be exits some source code with similar program? ...

JavaScript Object.create -- inheriting nested properties

Hi There, I've come across a peculiarity with Douglas Crockfords Object.create method which I'm hoping someone might be able to explain: If I create an object - say 'person' - using object literal notation then use Object.create to create a new object - say 'anotherPerson' - which inherits the methods and properties from the initial 'p...

Difference between quoted and un-quoted JavaScript object properties

Is there a difference between quoted and un-quoted JavaScript object property/method names? For example, what is the difference between these two: var obj1 = { property1 : "Value 1", method1 : function() { return true; } }; var obj2 = { "property1" : "Value 1", "method1" : function() { return true; } }; ...

Validate class/method names with regex

Heya guys. I'm currently working on an MVC Style framework for a company and for security reasons I need to make sure that the controller / method that's passed via the Query String is valid chars to the RFC (which I can't find). I need to be able to validate / sanitize class names according to what's allowed by the PHP interpreter Fo...

Dynamic Object Creation

I have a function that takes a string object name and I need the function to create an new instance of a object that has the same name as the value of the string For example, function Foo(){} function create(name){ return new name(); } create('Foo'); //should be equivalent to new Foo(); While I know this would be possible via eva...

PHP, Array of Arrays vs Array of Objects

I'm in the process of creating a PHP data structure based on some data I'm fetching from somewhere. If I would encode this information in some standard container, like XML or JSON, I would use this structure: [ {'name': 'Lupin', 'age': '13'}, {'name': 'Igor', 'age': '24'}, ... ]; However I'm a bit unsure what to use in PHP ( Array o...

Is it possible to deserialize to the current class? [C#]

I have a settings class that I want to be able to serialize and deserialize to save and load settings to a file. With hindsight, I'd have designed my whole app to create an instance of settings when needed. As it is, my settings are persistent (mimicking the default application settings behaviour). Given my current architecture, I can d...

Can't populate VBA Collection with Custom Objects using Collection.add

I don't understand why the Debug.Print n & " - " & objTrans2.DESC line at the bottom of this code is outputting "Description 2" twice. I want it to output "Description 1" and "Description 2". Is there something wrong with how I am trying to add a custom object (Transaction) through the sampleCollection.Add from within the For loop? Th...

Business objects - Changing destination folder details for multiple reports at DB level

We have 5000 reports built in Business objects and want to change the report delivery folder name from the back-end. How to do this? Anyone knows in which table the information is stored and if it is encrypted? ...