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?
...
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...
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...
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!
:)
...
What is the difference between package and object?
...
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...
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...
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_...
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...
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
...
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...
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...
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...
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...
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....
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($...
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?
...
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?
...
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'...