object

How can a Javascript object refer to values in itself?

Hi, Lets say I have the following javascript: var obj = { key1 : "it ", key2 : key1 + " works!" }; alert(obj.key2); This errors with "key1 is not defined". I have tried this.key1 this[key1] obj.key1 obj[key1] this["key1"] obj["key1"] and they never seem to be defined. How can I get key2 to refer to key1's value? ...

Assigning property to JS object using another objects property value as the property name

Hey guys, I want to use the value of an objects property to name the property of another object. Easy to do in PHP: $object1->property = 'name'; $object2->{$object1->property} = "value"; echo $object2->name; //outputs "value" But in Javascript I can't figure out how to do this. The curly braces are used a different way. Anyone kno...

C++ HW - defining classes - objects that have objects of other class problem in header file (out of scope?), (also redefining operators, read in out)

This is my first time with much of this code. With this instancepool.h file below I get errors saying I can't use vector (line 14) or have instance& as a return type (line 20). It seems it can't use the instance objects despite the fact that I have included them. #ifndef _INSTANCEPOOL_H #define _INSTANCEPOOL_H #include "instance.h" #inc...

how to access an object (simpleXML) variable name using a string?

i need to access a simplexml object using a string. ie. $x->a->b = 'obj'; $s = 'a->b'; echo $x->$s; but it doesn't seem to work... please help! :) ...

When should I use package and when object in Scala?

What is the difference between package and object? ...

Null object that is not null

Hello, I use 2 threads to act like a produce/consumer using double queue (http://www.codeproject.com/KB/threads/DoubleQueue.aspx). Sometimes in my 2nd thread, I get an object that is NULL but it should not be as I filled it in the first thread. I tried this: if(myObject.Data == null) { Console.WriteLine("Null Object") // <-- Breakpo...

Applet to Object tags

im trying to get from applet to object so i can resolve z-index issues. The first applet tag works...my conversion to object doesn't. Can anyone point me in the right direction? From: <applet name='previewersGraph' codebase="http://www.mydomain.info/sub/" archive="TMApplets.jar" code='info.tm.web.applet.PreviewerStatsGraphApplet' wid...

How would i access the properties in this object? Twitter API

I have stores this object in an variable called results. How would i access the profile_image_url for example. Here is the return value with print_r: stdClass Object ( [results] => Array ( [0] => stdClass Object ( [profile_image_url] => http://a3.twimg.com/profile_images/685278639/twitter-logo_normal.jpg [created_...

Creating/populating Javascript custom object

I've created an ashx page which is going to serve me an XML document full of basic user information. I'm not sure which is the best way to go about creating and populating my custom javascript object. I've seen them created in two ways: function User() { this.Id; this.FirstName; this.LastName; this.Title; } and var User...

How to pass object array as parameter in java

The method is public static void method(Object[] params), how should I call it in the following scenarios? with one object as parameter ClassA a with more than one objects as parameters ClassA a, ClassB b, ClassC c? thank you ...

The supplied DisplayObject must be a child of the caller

Hello. I am a newbie, and I have seached and tried for weeks on this, and I cannot get the grip on this. The simple code below gives the "The supplied DisplayObject must be a child of the caller" error. var square = new squareObj; addChild(square); addEventListener(Event.ENTER_FRAME, removeSquare); function removeSquare(evt:Event):void...

Reading DATA from an OBJECT asp.net MVC C#

Hi, I am new to the MVC and I am stuck with a wierd situation. I have to read the Data from the type object and I tried different ways and I couldn't get a solution.Please help. IList<User> u = new UserRepository().Getuser(Name.ToUpper(), UserName.ToUpper(), UserCertNumber.ToUpper(), Date.ToUpper(), UserType.ToUpper(), Company.T...

Add attribute to embed tag using jquery

I have the following embed tag: <embed type="application/x-shockwave-flash" width="640" height="505" src="url_to_video" allowscriptaccess="always" allowfullscreen="true"></embed> I have about five of theses on a page, and I'd like to add the attribute wmode="opaque" to all of them. However, I tried to do it like this and it didnt' wor...

Java: load an object saved on hard disk after refactoring => "class not found" exception :/

Hello, I'm developping an application in java that regulary saves objects onto the hard disk using this simple method: public void save(String filename) { try { FileOutputStream fos = new FileOutputStream(filename); GZIPOutputStream gzos = new GZIPOutputStream(fos); ObjectOutputStream out = new ObjectOut...

In Ruby, why does inspect() print out some kind of object id which is different from what object_id() gives?

When the p function is used to print out an object, it may give an ID, and it is different from what object_id() gives. What is the reason for the different numbers? Update: 0x4684abc is different from 36971870, which is 0x234255E >> a = Point.new => #<Point:0x4684abc> >> a.object_id => 36971870 >> a.__id__ => 36971870 >> "%X" % a....

Reference problem when returning an object from array in PHP

I've a reference problem; the example should be more descriptive than me :P I have a class that has an array of objects and retrieve them through a key (string), like an associative array: class Collection { public $elements; function __construct() { $this->elements = array(); } public function get_element($...

What is best practice in converting XML to Java object?

I need to convert XML data to Java objects. What would be best practice to convert this XML data to object? Idea is to fetch data via a web service (it doesn't use WSDL, just HTTP GET queries, so I cannot use any framework) and answers are in XML. What would be best practice to handle this situation? ...

How can I return an object into PHP userspace from my extension?

I have a C++ object, Graph, which contains a property named cat of type Category. I'm exposing the Graph object to PHP in an extension I'm writing in C++. As long as the Graph's methods return primitives like boolean or long, I can use the Zend RETURN_*() macros (e.g. RETURN_TRUE(); or RETURN_LONG(123);. But how can I make Graph->ge...

Asked in PHP interview, Is it possible to insert Object in database?

Asked in PHP interview, Is it possible to insert Object in database? ...

python create object and add attributes to it

Hi, I want to create a dynamic object (inside another object) in python and then add attributes to it. I tried: obj = someobject obj.a = object() setattr(obj.a, 'somefield', 'somevalue') but this didn't work. Any ideas? edit: I am setting the attributes from a for loop which loops through a list of values. e.g. params = ['attr1'...