objects

How to catch any method call on object in PHP?

Hi, I am trying to figure out, how to catch any method call on object in PHP. I know about magic function __call, but it is triggered only for method, that does not exist on called object. For example i have something like this: class Foo { public function bar() { echo 'foobar'; } public function override($method_name,$met...

Editing a NSMutableDictionary's attribute that is a string from within UITableView

I have a NSMutableDictionary that I'm loading into a UITableview, The first level has "names" and the second level is "details". I want to be able to edit the attribute (strings) and then save them back into the Dictionary. I can't seem to find how to do this, every example I see uses Managed objects with a separate editor for each item...

The inheritance of javascript

Maybe this question is easy,but I can't understand now. String.prototype.self=function() { return this; } var s="s"; alert("s".self()=="s".self()) //false; alert(s.self()==s.self()) //false; If you know the reason, please tell me why the result is "false". ...

Java string comparisions/quotations

Hi, My problem is the comparision of two objects and the strings that they return (accessed through getters). Object one parses a csv file for dates and when printed out through exampleObject.getDateTime() returns the string: "2010-03-26-10-54-06.471000" Object two has its dateTime string set by the user. When I set the dateTime on o...

How to print object variable ?

How do I print the value of -> event.latitude = [[values objectAtIndex:0] floatValue]; ? Below is some of my code: @interface SeismicEvent : NSObject <MKAnnotation>{ float latitude; float longitude; **This is an object SeismicEvent *event; ** This reads in a float event.latitude = [[values objectAtIndex:0] floatValue]; Ho...

Better option for strongly-typed containers in javascript

I've just discovered the way to create fake 'classes' in javascript, but I wonder how you can store them and still get easy access to their functions in an IDE. Like this: function Map(){ this.width = 0; this.height = 0; this.layers = new Layers(); } Now I've got a function that loops through an XML and creates multiple Map(...

[Ruby] How do I access the string name of the parent class from a class method in a extended class or included module.

My problem basically looks like this: module Foo class Bar def self.who self.class.to_s end end end class World < Foo::Bar end When I call World.who I don't get "World" as a result, I get "Class". Some quick Googling didn't yield anything useful, so hence I'm here hoping someone will know how to get the correct cla...

Clarifications on Bytecode and objects

Hello everyone, I am writing a Bytecode instrumenter. Right now, I am trying to find out how to do that in the presence of objects. I would like some clarifications on two lines I read in the JVMS (section 4.9.4): 1) "The verifier rejects code that uses the new object before it has been initialized." My question is, what does "u...

Removing objects form serialize data

I am trying to integrate two PHP scripts (app1, app2) and I am trying to get session data from app1 in app2. The problem is when I am trying to unserialize the session data from app1 I am getting a small ton of errors because PHP is trying to find the __wakeup() function for each of the objects. I can't use the unserialize_callback_fu...

Evaluate string as Object without eval() dynamically?

EDIT: Thanks Kenny and everyone else who answered similarly. It really was a DOH...So stupid of me not to remember this. Maybe the answer is so simple it's eluding me...but I know someone here can school me on this hopefully. So I've got a rather large project that's dealing with tons of very large JSON, Objects, Arrays, etc..And I ne...

How to get an attribute just from the current class and not from possible parent classes?

How to get an attribute just from the current class and not from possible parent classes? If I use getattr it traverses class hierarchy but I would like to get None if attribute is not defined in the current class (even if it is defined in some parent class). ...

Passing a pointer to an object onto a child application.

So basically, I have two applications. Application 1 launches Application 2 but it remains in memory. When Application 2 is started it needs to be given a pointer to a CALayer object which is stored in the first application. The object represented by the pointer needs to be accessible by both applications. I am using Objective-C. I wou...

How do you stop javascript assigning objects by reference?

I'm using the date.js library. Previous code: alert(incidentDate); var deadlineDate = incidentDate; deadlineDate.add(2).years(); alert(incidentDate); return; Adding to the deadlineDate caused the incidentDate to change too. A bit of reading revealed that this was because objects in javascript are always assigned by reference. I've fo...

Removing falsies from JavaScript object

So I write a short function to remove members from an object that have falsy values: for (var key in object) { if (!object[key]) { delete object[key]; } } A couple days later I check source control and someone has changed this to: var newObject = {}; for (var key in object) { if (object[key]) { newObject[key] = ob...

LINQ checking for duplicate objects (excluding ID)

Hi All, I am using LINQ to SQL (SQL Server) with C#. I have a table called "Cars" which automatically becomes the LINQ class/object called "Car". All well and good. Each car has a number of fields, say CarID(primary key int), EngineID, ColourID. I have 10 existing rows in the Cars table. Using all the cool LINQ stuff, I create a new...

JavaScript context problem using setInterval with prototype

Hi I'm trying to get my head round this context problem while using prototypal inheritence (which I've not really played with before). I have an AutoScroller object: function AutoScroller() { this.timer = null; } AutoScroller.prototype = { stop: function() { if (this.timer == null) { return; } clear...

The value of 'this' inside of a Javascript prototype function used as an event handler

I'm trying to use prototype inheritance in Javascript. The problem with my code below is that when the button is clicked and MyNamespace.MyObj.myEventHandler is called, the value of this is not the instance of MyNamespace.MyObj, but is instead the button that was clicked. Am I structuring things wrong (is there a better way)? Can I so...

Javascript array traversal overwriting key values

Hi, I have a hashmap that I have created to control the events for buttons. It is defined as so: var Signage_Manager = { init: function() { Signage_Manager.buttonActions.set_events(); }, buttonActions: { buttons: { '#add_product': {action: 'navigate', href: '/manager/add_product'}, '.back_to_dashboard': {act...

Javascript error: object seems to "disappear" in the middle of a statement

I am experencing a very odd javascript error that I can't figure out how to get rid of. The following code throws an exception saying "'options' is not defined" on line 29. As you can see, the object is defined (or should be...), and it is being used without exceptions on the line right before, in the middle of an array initializer. Th...

Providing API for communicating with a running application?

Basically I'm trying to find a solution to my issue with sharing an object. I've had a look at SpringBoard's implementation and it looks as if SpringBoard is providing a framework which can be used to retrieve SBDisplay objects (which are basically CALayers). I know this specific issue is related to iPhones, but I also know that this is...