objects

JavaScript prototype limited to functions ??

o.prototype = {...} is working only if o is a Function. Suppose I've the following Code conf = { a: 2, b: 4 }; conf.prototype = { d: 16 } conf.a and conf.b is OK and returns proper values. But conf.d doesn't return 16 rather it goes undefined. Is there any solution suck that prototype based generalization can also be applied...

Objects in PHP including other objects

I think the title is right but please correct me if It is mis-leading. The problem: I have a class which wants to use the DB class, now instead of having to "global $db;" in every method I wish to use the DB object I want to be able to place the object reference in my class properties. Still following? OK here goes: class user { p...

How to synchronize a static variable among threads running different instances of a class in java?

I know that using the synchronize keyword before a method brings synchronization to that object. That is, 2 threads running the same instance of the object will be synchronized. However, since the synchronization is at the object level, 2 threads running different instances of the object will not be synchronized. So, if we have a static ...

Some questions about the performance of PHP Objects

Right now since I am new to using Objects in PHP I feel like in my head, I think of a PHP object as being something big and bulky. This makes me want to use them less often, I feel Like I am taking really simple code and really over-complicating it by putting it into objects. If I have a database, cache, session, core, and user objec...

How to work with several objects in OpenGL-ES

I am trying to learn how to add several objects and working with those in my 3D-world. I am developing for iPhone. Regarding my question below I couldn't find good information about it while Googling. I have a function that creates all vertices-arrays with data in order to create a sphere. No problem adding it as the only object. The p...

Objects becoming null when passed to a Property in C#

I have an abstract class Employee and 2 other classes that extend it (Developer and Manager). My problem is that when I whenever I create a Manager Employee man = new Manager(1234567, 30, "Bob", "Pie") and try to set it in the Manager field of a new Developer, Employee codemonkey = new Developer(1234568, 20, "Code", "Monkey", (Mana...

How do you test PHP classes/objects?

I have read many times on the web that when dealing with dependency in PHP that it is good to use dependency injection instead of Globals because it makes it easiar to test. Can someone explain how this make it easiar to test? And what I would use to do the test? ...

How do I add a count property to an item in a collection in Rails?

I have a data model involving Users and Awards, and joined by a user_awards table. class User < ActiveRecord::Base :has_many :user_awards :has_many :awards, :through => :user_awards # awards the user has won end class Award < ActiveRecord::Base :has_many :user_awards :has_many :users, :through => :user_awards end I'd like th...

New Object Creation in recursive Java program

Hi there, Java newbie here looking for some help. Here is the code in question: public void generateCodeTable(Node tree, StringBuffer buf) { if (tree != null) { StringBuffer newSB = new StringBuffer(); newSB.append(buf); if (tree.key != '$') { System.out.print(tree.key + "(" + ...

Flex looping through object

Im trying to extend flex ArrayCollection to be able to search for an object containing specific data and give it back. Here is my function: public function getItemContaining(value: String): Object { //Loop through the collection for each(var i: Object in this) { ...

Can an object take part in two state machines at the same time?

I am writing an object oriented program whose business process calls for a "ticket" object. The "ticket" object acts in two ways. It is stock to be sold and it is stock we ourselves are either holding on a sale-or-return basis or have committed to buying. For this reason a ticket in the sales process can have a state of being "available...

How to show list of objects in a table in ASP.NET MVC?

I've new to ASP.NET MVC and .NET in general, so just got a simple question. I want to display a list of objects on the web page, what's the best way to do it? The models so far are as follow: public class NoticeBoard { public List<Notice> Notices; public NoticeBoard() { Notices = new List<Notice>(); } } public...

Question regarding iPhone core data and how to duplicate features for multiple users...that doesn't make sense, just read my question :)

So I am working on a simple iPhone app, that uses core data to manage objects. My code is similar in function to Apple's CoreDataBooks app, found here. There is a blank UITableViewCell, and you have the ability to add objects to this blank list. If you hit the add button, a DetailViewController pops up that manages the attribute of each ...

Objects won't persist in Django sessions under Apache

The setup: Django 1.0 default sessions (db, no caching) apache 2.2, mod_python, prefork, 5 processes What I am trying to do: initialize a new object (custom class, several dicts as member variables, a few methods) save it in the session. use that object from several subsequent requests Problem: The process that created the obje...

C# Business Object Architecture question regarding Business and DTO objects

Background We have our own Business Object Architecture, a much lighter (...and loosely based on, but does'nt actually use...) version of the "CSLA" business object framework with similar usage, validation, inclusive DAL etc. All code is generated (stored procs and Business Objects are creaed using CodeSmith) The Business Objects are q...

Should I create new objects every page load or pass them page to page in PHP?

With PHP and MySQL I am working on a user login type site. Here is my plan so far. User logs in with email/password I then set a few things into session (UserID, photoURL, userName, latitude, longitude, gender) These are the basic items that will be saved into session and possibly APC/Memcache when a user is "logged in". I have my...

PHP how to assign class property variables conditionally

Hi, I'm new to php classes, arrays, etc, so pls excuse me if I don't use the correct terminology. What I'm looking for is how to assign easily values to properties from a class without having to depend on "if" statements. For example: Suppose I have an instance of a class test, and "test" has a property "employee" (hope this is the co...

LINQ XML Read different hierarchies into 1 object

Hi All, I have an XML file <searchResponse requestID=“500” status=“success”> <pso> <psoID ID=“770e8400-e29b-41d4-a716-446655448549” targetID=“mezeoAccount”/> <data> <email>[email protected]</email> <quotaMeg>100</quotaMeg> <quotaUsed>23</quotaUsed> <realm>Meze...

Add an object to an array python

Hi I am trying to add an object to an array list but since I'm adding the actual object when I try to reset the array thereafter, all the values in the array are reset. Is there an actual way how I can add a monitor object to the array and change the values and not affect the ones I've already saved in the array? Thanks Code: arrayLi...

comparing jQuery objects

I'm using a selector to get a group of objects (0 or more): var $openMenus = $Triggers.filter(".trigger-hover"); Then I have an event attached to an item that may or may not be in the object above. Within that event where I want to compare the item that triggers the event to c $([selector]) .focus(function(){ var $thisMen...