object

Database class is not correctly connecting to my database.

I'm just venturing into the world of OOP so forgive me if this is a n00bish question. This is what I have on index.php: $dbObj = new Database(); $rsObj = new RS($dbObj); This is the Database class: class Database { private $dbHost; private $dbUser; private $dbPasswd; private $dbName; private $sqlCount; funct...

Where about should my main class be created in a project?

The problem is where a class should be created in my code. An example is I have a UI class and a main logic class that controls other objects. Should the main logic class create the UI object, or should the UI object create the instance of the main logic class? An explanation of which method is best and why would be ideal. Thanks. ...

What makes the availability of both primitive and object-wrapped values in JavaScript useful?

I wrote a blog post a while ago detailing how the availability of both primitive and object-wrapped value types in JavaScript (for things such as Number, String and Boolean) causes trouble, including but not limited to type-casting to a boolean (e.g. object-wrapped NaN, "" and false actually type-cast to true). My question is, with all ...

How can I define pre/post-increment behavior in Perl objects?

Date::Simple objects display this behavior, where $date++ returns the next day's date. Date::Simple objects are immutable. After assigning $date1 to $date2, no change to $date1 can affect $date2. This means, for example, that there is nothing like a set_year operation, and $date++ assigns a new object to $date. How can one custom-d...

Test, if object was deleted

Look to the following code, please: class Node { private: double x, y; public: Node (double xx, double yy): x(xx), y(yy){} }; int main() { Node *n1 = new Node(1,1); Node *n2 = n1; delete n2; n2 = NULL; if (n1 != NULL) //Bad test { delete n1; //throw an exception } } There are two pointers n1, n2 pointe...

Properties of JavaScript objects

In my JavaScript, I'm using an object as an associative array. It always has the property "main", and may have others. So, when I create it I might do this: var myobject = new Object (); myobject["main"] = somevalue; Other properties may be added later. Now, at some moment I need to know whether myobject has just the one propert...

Cocoa:Testing for the same object with ifs/switches

Ok so here's my code, it works great: - (void)textViewDidChange:(UITextView *)textView{ if (textView==someObject) { [detailItem setValue:textView.text forKey:@"someObjectAttribute"]; } The problem is that I have lots of textviews instances to test for and I would prefer to find some other way to consolidate the code. I was thinkin...

Objects with the same attributes and methods belongs to the same class?

Objects with the same attributes and methods belongs to the same class? Can't I declare two identical classes with the same methods and attributes, instanciate them and have "objects with the same attributes and methods belonging to different classes"? Can't I declare a class A and a sub-class B (children of the class A) both with the ...

jQuery object IE8

So i'm trying to render a template with trimpath in IE8, but when passing the template (a jquery object) there is nothing in it. This all works in chrome,safari,firefox. So to give an example: HTML: <div id="flickr_image_gallery_preview_template"><!-- <img id="flickr_detail_button" src="/devwidgets/flickr/images/external_link.gif...

What is happening in Crockford's object creation technique?

There are only 3 lines of code, and yet I'm having trouble fully grasping this: Object.create = function (o) { function F() {} F.prototype = o; return new F(); }; newObject = Object.create(oldObject); (from Prototypal Inheritance) 1) Object.create() starts out by creating an empty function called F. I'm thinking that a fu...

ArrayList of my objects, indexOf problem

Hello! I have problem with Java's ArrayList. I've created an Object, that contains two attributes, x and y. Now I've loaded some object in my ArrayList. Problem is that I don't know how to find index of some object with x atribute I'm searching. Is there any way to do this? ...

Detect when a new property is added to a Javascript object?

A simple example using a built-in javascript object: navigator.my_new_property = "some value"; //can we detect that this new property was added? I don't want to constantly poll the object to check for new properties. Is there some type of higher level setter for objects instead of explicitly stating the property to monitor? Again, I d...

Is this a good way to identify the type of a javascript object?

Apparently neither instanceof nor typeof deliver in terms of correctly identifying the type of every javascript object. I have come up with this function and I'm looking for some feedback: function getType() { var input = arguments[0] ; var types = ["String","Array","Object","Function","HTML"] ; //!! of the top of ...

Disassemble Microsoft Visual Studio 2003 compiler output

I'm seeing what I think is strange behaviour from object files output by the Microsoft Visual Studio 2003 tools. The file utility tells me: asmfile.obj: 80386 COFF executable not stripped - version 30821 For objects created by the assembler, but for objects coming from C files, I get just: cfile.obj: data Using Microsoft's dumpbin...

Can we create a class from a xml file ?

Hello, Is it possible to create a class dynamically by reading an xml file ( in java preferably) ? if yes, please provide pointers on how to do it. In the process of development, we have come up with a class that has 5 attributes, all these attributes correspond to an entry in the xml file, now if the user adds/modifies the xml entry...

Blob object not working properly even though the class is seralized

I have class which is seralized and does convert a very large amount of data object to blob to save it to database.In the same class there is decode method to convert blob to the actual object.Following is the code for encode and decode of the object. private byte[] encode(ScheduledReport schedSTDReport) { byte[] bytes = null; t...

Python: Hack to call a method on an object that isn't of its class

Assume you define a class, which has a method which does some complicated processing: class A(object): def my_method(self): # Some complicated processing is done here return self And now you want to use that method on some object from another class entirely. Like, you want to do A.my_method(7). This is what you'd ...

Why should I implement toString method for my Object?

Besides printing stuffs for the console what other use have you found for toString() method for your objects? ...

Firefox extension js object initialization

Note: this is about Firefox extension, not a js general question. In Firefox extension project I need my javascript object to be initialized just once per Firefox window. Otherwise each time I open my window a new timers will be engaged, new properties will be used, so everything will start from scratch. hope example below will demysti...

Javascript Object Database

Hi, is there any javascript object database?? Something like http://www.db4o.com/ but for javascript? thanks ...