objects

Creating and Destroying Objects for passing between Views

Overview of app My RVC has an object of custom type 'Entry' that has various values (AssetURL, Notes for item). I pass an instance of this to two viewControllers in order to add information about the Entry into this instance for saving. I do this successfully, but am unsure about how I should be creating / destroying my objects. If I ...

Looking for a SQL function to pull data for month selected and previous six months.

I am looking for a SQL function to use in a BOE Report to generate data from the month selected in the prompt and the previous six months. ...

What is the difference between an instance variable/method and a class variable/method in Objective-C?

I've seen many other questions on this same topic but they're not very clear to me, someone new to Objective-C. I need a plain english explanation. 'Coder speak' is much too difficult for me to understand at this point in my learning. ...

sort date objects in Python

I start out with date strings: from operator import itemgetter import datetime as DT # unsorted dates raw = (map(int, "2010-08-01".split("-")), map(int, "2010-03-25".split("-")), map(int, "2010-07-01".split("-"))) transactions = [] for year, month, day in raw: new = (DT.date(year, month, day), "Some data here") t...

Creating interdependent objects

Hi Stackoverflow, I have a design problem I cannot find a clean and nice solution to. I am developing in PHP but I believe this could occur in any language. My basic problem is that I have two objects that have circular interdependence at some level of indirection. That means I have a class (call it F) implementing the Facade pattern whi...

Is it possible to make objects returned by a function immutable in C#?

I am writing a function that returns a reference to an object of some encapsulated data structure and I want nobody to be able to change the object using that reference, is it possible to do this in c#? ...

Accessing an object via jquery

var url_string = '/index.php/dvs/get_dvs/' + id + '/'; $.ll = {}; $.ll.dvs_data = {}; $.post(url_string,{}, function (data) { $.each(data.dvs, function(k,v) { $.each(v, function(dvs_name, dvs_value) { $.ll.dvs_data[dvs_name] = dvs_value; ...

val and object inside a scala class?

What is the difference between declaring a field as val, lazy val and object inside a scala class, as in the following snippet: class A class B { val a1 = new A { def foo = 1 } object a2 extends A { def foo = 1 } lazy val a3 = new A { def foo = 1 } } ...

Difference between a class and an object in Javascript

What's the difference between var myView = function () { //something goes here }; and var myView = function () { //something goes here return { a: x, b: y }(); I think the first snippet creates a "dynamic" class, so that you can say var anotherView = new myView(); and the second snippet is similar to a sing...

Node.js web sockets server: Is my idea for data management stable/scalable?

Hi, I'm developing a html5 browser multi-player RPG with node.js running in the backend with a web sockets plug-in for client data transfer. The problem i'm facing is accessing and updating user data, as you can imagine this process will be taking place many times a second even with few users connected. I've done some searching and fou...

Object creation in Java is slow

My experience shows that object creation in Java is very slow. Often, I optimize my code by just removing object creation and using the same objects repeatedly. I am wondering if its similarly slow in other language with OOP base, because, to me, it is very counter intuitive that a language that's hardcore object oriented, takes so muc...

Targeting (un)known locations in an object with Javascript

I've had trouble with people jumping to conclusions about what I need here, so please read this and think about it before answering. Here is the case: You have an incoming object. You do not know the structure of this object. You do however have a "target" to something in the object. So let's pretend there is myObject, and you have som...

The difference between convert and parse.

Hi I could write the following to convert a object to and integer. Convert.ToInt32(myObject); But i could also write Int.parse(myObject.ToString()); Is there any difference? Which one should I be using? Thanks in advance. ...

TouchesBegan on specific object

hi all, I've been searching on google for that , but didn't found any answer. I want to use TouchesBegan but on a specific object, like a textview, a label, ... I've tried to replace "any object" by the pointer of my object but it doesn't work. Is there on other way to detect the touch on a object with a method , in witch I can tell a...

when to use object.free and freeandnil(object);

Possible Duplicate: Which is preferable: Free or FreeAndNil? when to use free and freeandnil? in my way, i usually use the .free when the object that created is something like "object.create;" that has no self or nil parameter. if there is, that's the time i will use the freeandnil(); am i doing it right? or it has a big def...

PHP sorting object array by certain criteria?

I have something like this: $i = 0; foreach($tracks['results'] as $track){ $trackName[$i] = $track['name']; $trackPlaycount[$track['name']] = $track['playcount']; $trackPercent[$track['name']] = $track['percent']; $i++; } $this->trackName = $trackName; $this->trackPlaycount = $trackPlaycount; $this->trackPercent = $tr...

Variable visibility in callbacks functions.

I did this function for get results of a query directly in an useful datastructure. The problem is the follow: in the first console.log() call , inside the callback function, the stored_data var contains the exact results, in the second console.log() call the stored_data variable looks like not initialized. Suggestions?? Below the code: ...

Android Communicate with a Location Manager started from another activity

Hi all, In my app I want to obtain a gps lock and record the coords. But I do not want to lock the device into looking for the gps. The user is to be free to traverse through the app and the different activities within. So If I call a locationListener in activity A, can I reference it in activities B C and D? if is was still in activ...

How many objects were created in this code execution?

public class Animal { public Animal() { Console.Writeline("Animal"); } } public class Snake : Animal { public Snake() { Console.Writeline("Snake"); } } How many objects will be created in each of the following codes below? (Refer to the above code...) Animal myAni...

Initiallizing an Array of Objects

I am initializing and array of objects, i need something like this: Greyhound[1].StartingPosition = pictureBox1.Location; Greyhound[2].StartingPosition = pictureBox2.Location; and so on.. but I need to make it by a loop for ( ......... ) { Greyhound[i].StartingPosition = ????????? // what should go here } ...