EDIT2: I try to summarize my problem and the solutions:
I've got a TableViewController named DetailedViewController. My intention was to activate TouchesBegan to recognize actions like sliding etc, and normally, the method touchesbegan is replaced with the DidSelectRow method. In many posts on stackoverflow, subclassing the UITableView ...
If I create two String instances with the same content separately they are identical. This is not the case with custom classes by default (see example below).
If I have my own class (Test below) and I have a variable (@v below) which is unique, ie. two Test instances with the same @v should be treated as identical, then how would I go a...
I'm picking up ObjC and Cocoa, which is also my first serious foray into programming in general.
I'm having trouble with the differences between initWith methods, which are called on instances, and factory methods, which are called on classes.
Firstly, why are they called "factory" methods, and is there a proper term for what I've dubb...
I'm trying to create an instance of a trait using this method
val inst = new Object with MyTrait
This works well, but I'd like to move this creation in to a generator function, ie.
object Creator {
def create[T] : T = new Object with T
}
I'm obviously going to need the manifest to somehow fix the type erasure problems, but before...
Heres some sample code,
class Base
{
private int val;
Base() {
val = lookup();
}
public int lookup() {
//Perform some lookup
// int num = someLookup();
return 5;
}
public int value() {
return val;
}
}
class Derived extends Base
{
private int num = 10;
public int lookup() {
return num;
}
}
clas...
Hey :)
I am currently trying to create an engine for a new application.
Design is quite complex and i realy need a way to create a reference or a pointer or what ever way to remotely modify and access the datas. Datas must be kept in a single place and must not be duplicated.
Is there a way do get an object by reference ?
For example ...
I'm pretty new to OOP in general and just really started working with Obj-c a few months back. So, please be gentle! I appreciate your help in advance. Now to the question!
I have 3 Text Fields where a user inputs name, phone, and email.
I collect and place them in a label using an NSString like this [this is the one for the name]:
- ...
hi all!
I wish best understand the difference between dealloc and release function....
example...
I have my class derived from NSObject calle MyClass
in my code, to use this class, I create an instance of MyClass..
// initialization
MyClass* test = [[MyClass alloc] init];
//do some stuff....
// release??
[ test release];
is right?? ...
Is there a clean way to have a decorator call an instance method on a class only at the time an instance of the class is instantiated?
class C:
def instance_method(self):
print('Method called')
def decorator(f):
print('Locals in decorator %s ' % locals())
def wrap(f):
print('Locals in wrapper ...
Hi all!
I made my own class derived by NSObject, and here is my code:
-(void) parseRow:(NSDictionary*) dictionary {
NSArray* arName = [[dictionary valueForKey:displayname] componentsSeparatedByString:@"+"];
[self setDriverName:[arName objectAtIndex:0]];
[self setDriverSurname:[arName objectAtIndex:1]];
[arName release]; ...
Hi,
I've noticed some strange code on a project I am working on - its a SLSB EJB3, and it uses a private instance variable to maintain a cache of data (it even calls it dataCache or something), with a getter/setter. For EJB2 and bellow, this was a typical EJB antipattern - SLSBs are not meant to retain state in between invocations, ther...
Can I create instance of abstract class in C#/.net like in Java ?
Additional Info
I think a lot of us does not understand what do I mean?
So, In java I can create abstract class like this :
Simple abstract class :
/**
* @author jitm
* @version 0.1
*/
public abstract class TestAbstract
{
public abstract void toDoSmth();
}
Cod...
With Protege I made an ontology that has some classes and instances. Class "Knowledge" has a property "hasSubKnowledge" which domain and range are both of type "Knowledge". I have around 200 individuals of type "Knowledge".
I made a JSP and my job is to somehow graphically represent my "Knowledge" tree (RDF). Is it possible that ontolog...
I have one department class.I want to create one instance department with value HR and one instance of department with value Admin, when my application loads(console app) and then i want to use those instances throughout my program.How can i use same instances everywhere in different classes?.For example i read a employee from csv file a...
I wrote a nice little app that gets Yahoo weather info and posts it to Twitter. It worked flawlessly and now I want to rearrange the code into differently named files so it makes more sense. And that's when I hit some issues.
Previously, I had a Class in libtweather.py. It was my account. It allowed me to do accountName.parseFeed() an...
First, the disclaimer- I'm JUST starting out with jQuery. I apologize for my ineptness. :)
My issue is that I'm attempting to use a jQuery rollover effect on a bunch of separate elements on a page. Right now, when I mouse over one, they all do the effect at once because they have the same class name, and jQuery is selecting all of them...
Being probably one of the worst OOP programmers on the planet, I've been reading through a lot of example code to help 'get' what a class can be used for. Recently I found this example:
class NextClass: # define class
def printer(self, text): # define method
self.message = text ...
I am exploring a pattern where you can save a global reference to the current instance for simple use in anonymous functions where the this keyword is out of context. Consider this:
var instance;
var a = function(id) {
instance = this;
this.id = id;
};
a.prototype.get = function() {
return (function() {
return instance.id;
...
There are multiple MovieClips that will be dynamically placed on stage. These MovieClips are coded to be buttons. I'm trying to figure out--when a user clicks on the MovieClip...figure out which object on the flash stage the user clicked on.
Inside function toggleClick I put the trace statement:
trace("movieClip Instance Name = " + e....
I'm trying to name the instances of MovieClips that I dynamically load.
I tried doing this:
comp = new Comp();
// and also tried doing this--> var comp:MovieClip = new Comp();
comp.name = "comp"; // comp is the name I want the instance to be
BUT in the OUTPUT Window:
ReferenceError: Error #1056: Cannot create prop...