object

how to find and return objects in java hashset

According to the HashSet javadoc, HashSet.contains only returns a boolean. How can I "find" an object in a hashSet and modify it (it's not a primitive data type)? I see that HashTable has a get() method, but I would prefer to use the set. ...

Mixing arrays and objects

I feel bad about mixing arrays with objects, but I'm not sure that I should. // Populate array foreach($participants as $participant){ $participants[$key]['contestant'] = new Contestant($participant); $participants[$key]['brand'] = new Brand($brand); $key++; } [...] // Print array foreach($participants as $participant){ pr...

Rails will return an object successfully, but complains that the object is NIL if I try to access an attribute of it

I am trying to populate a nested field, product_name, it an Item. In my Item model: class Item < ActiveRecord::Base attr_writer :product_name belongs_to :order belongs_to :product def product_name #Product.find_by_id(self.product_id) #=> returns the product object #self.product #=> returns the product object ...

Python: Determine if method was overridden.

Hey there, ran into the following. Dont need it clarified but find it interesting, though. Consider: >>> class A: ... def __str__(self): ... return "some A()" ... >>> class B(A): ... def __str__(self): ... return "some B()" ... >>> print A() some A() >>> print B() some B() >>> A.__str__ == B.__str__ Fal...

Class with pass-by-reference object gives compile error

I've got a class A defined in a separate header file. I want class B to have a reference to a object of class A stored as a variable. Like this: File: A.h class A { //Header for class A... }; File: B.h #include "A.h" class B { private: (24) A &variableName; public: (36) B(A &varName); }; When i try to co...

Embedding RealPlayer movies

Hi everyone, i need to embed a RealPlayer (yes, RealPlayer!) player in a webpage. I'm running into some cross-browser issues and all the stuff i'm Googling seems to be very outdated (Real's official documentation still refers to Netscape 4, for example). I got my player working with two tags, across all browsers. (Imagine the {url}, {...

why is the ++ operator in php working on an object property?

I showed this code to my friend $user->attempts++; // the attempts property returns an int and he was like saying how stupid that code was, rambling that numeric operators will produce syntax errors when attached to objects; the thing is it worked as I expected it to (increment attempts by 1, oh yeah, I tested it) and so I ask, why t...

Clone object to $this

Dear all, I would like to ask about PHP clone / copy object to $this variable. Currently I am new in MVC, I would like to do something like CodeIgniter. I would like to direct access to the variable. in my __construct(), i always pass the global variable inside to the new controller (class), eg. function __construct($mvc) { $t...

Using variables for referencing objects in vb.net (Visual Studio 2008)

Hello, I'm having a problem when using variables in object names. I have a Public class which is called "Tank" In that class, there is a public property called "direction" of an integer type. I keep getting the error: "Tank is a type and cannot be used as an expression" What I'm doing wrong here ? Public Class mainroutines() ' Creat...

how to convert an object to an array (PHP)?

using the below code for decoding json $categories = json_decode($data); $categories = $categories->data; where i get this {"categories":[{"id":1,"name":"Utilities","apps":897,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/uti.jpg"},{"id":2,"name":"Productivity","apps":477,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/pro....

JNI: How can i check if jobject is a null object in native c code

JNI: How can i check if jobject is a null object in native c code ...

PHP to Javascript, array to array, object to object

I have a list of image paths in my PHP script that I would like to pass to javascript whitout rendering them in the HTML page. I mean, I don't want people go fishing for the path's when do do a > view HTML source. <?php $images_str = "some/dir/001.jpg|*|some/dir/002.jpg|*|some/dir/003.jpg"; $images_arr = array('some/dir/001.jpg'...

create an object in switch-case

hello, i use visual studi 2008. (c++) in my switch case a wanted to create an object, but i doens't work. is it right, that i can't create an object in a switch case? if that's right,whats the best way to work around it, a new method that's creates that object? edit the code: switch (causwahl){ case '1': cAccount *oAccount = new cA...

Is it possible to store multiple objects using object archving?

Okay, of course it is possible, that's no issue. In my code I have multiple objects that I work with, and they need to be data persistent. To do that I've used object encoding and storing them in a data file. Such as: -(NSString *)dataFilePath { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomai...

problem with code. Searching text in a rtb c#

I have 2 forms One includes a richtextbox the other is used to search for text in this rtb My code is showing an error and i dont know how to fix it. This is the line that shows the error RichTextBox box = ((Form1)base.Owner).rtxtEditor; It's saying "Object reference not set to an instance of an object." This is my whole code. p...

GAE python database object design for simple list of values

I'm really new to database object design so please forgive any weirdness in my question. Basically, I am use Google AppEngine (Python) and contructing an object to track user info. One of these pieces of data is 40 Achievement scores. Do I make a list of ints in the User object for this? Or do I make a separate entity with my user id...

Java - How do you read binary objects into an object array without knowing the size?

Java - How do you read binary objects into an object array without knowing the size beforehand? For example, I don't know how many "clients" are within a binary file so how do I read them into an array without knowing the size beforehand? I know I could probably use vector but I have to use an array. ...

get value from javascript object

when alerting a variable in javascript it shows like this.. totally 9 values(name, address, city, friend etc) how to retrive the values [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] ...

While loop value test

I have an array of objects that contains a key value with true or false. These values start as false but switch to true on completion of their work. I was looking to determine when all the values had completed i.e. all switched to true. Is there a deviation(logic below) on a while loop with a test if statement that may solve this. bas...

jQuery - How do you store and access an object within another object

I am trying to store an object as an attribute in another object but can't seem to access it. Is it possible? <script language="javascript"> $(document).ready(function() { //create a TestObject function TestObject() { this.testProperty = "green"; } //and an instance of it var testObject = new TestObject()...