May 26th, 2005

Neko (lofulah)

Oh, so that's why it's so strange.. [objC tech post]

It's based on the "concept of messaging between objects."

objects, being classes? I think.

So a message is [someObject doSomething] or rather, [receiver selector].
Messages can include arbitrary arguments and can return values. Any message can be sent to any receiver. If a receiver doesn't understand the message, a runtime error occurs (this is stupid. Makes it more likely for a mistake to be made as a typo...)

messaging ≠ function call. Hence the odd syntax.

The basic object, is an id. It is a pointer to an object. An id object defined as
id anObject;
will be nil. selectors can be sent to this nil pointer without returning errors, however, values returned from the message to nil is undefined in some cases.
id should be avoided, and used only when very little info is known.

NSString is a string. I need a list of these NS thingies.

More ObjC types:
SEL - used to store selectors
IMP - used to store pointers to the C function that implement messages (wha...?)
Class - use to store pointers to ObjC class objects.
id - used to store pointers to arbitrary ObjC objects.
BOOL - used to store boolean constants YES and NO.

note: caps is important in ObjC.

Class interfaces are defined:
@interface CLASS-NAME : SUPER-CLASS-NAME
{
INSTANCE VARIABLES
}
METHOD DECLARATIONS
@end


instance variables:
@public/@private/@protected type variable;

Instance methods:
- (returnType)methodName:(inputType)inputParameter;

Class methods:
+ (returnType)methodName:(inputType)inputParameter with:(inputType2)inputParam2;

: is part of the method name, so the above two method's real names would be the following.
methodName:
&
methodName:with:

the with could be left out of the second one, but this would result in:
methodName:: -- note the double colon.
Also, note that given - (returnType)methodName; and - (returnType)methodName:(inputType)inputParameter;
methodName is different from methodName:

A method's name = message it handles, and methods are invoked upon receipt of a message. They are selectors~ Message names can be stored as a variable with the type SEL. ie:
SEL aSelector;
aSelector = @selector(setObject:forKey:);
This can then be passed as an argument
-(void)performSelector:(SEL)aSelector withObject:(id)anObject;

Classes are represented at runtime by an object...

categories... are like Java's... thingiemabobbers. They let you add methods to a class, without requiring the source code for the class that is being extended or recompiled. The limitation, however, is that, unlike subclasses, you can't add instance variables.
@interface classname (categoryname)
@implementation classname (categoryname)
Neko (lofulah)

ROD TV (read or die) based game!

http://egs.cug.net/circle/epa.html

Screenshots look pretty =^^=

----

I'd also like to point out Azureus' (a BitTorrent client) new Swarm display (v2.3.0.2) for detailed torrent view... your peers are shown as circles - filled in based on how much of the file they have. Packets are shown as dots that travel to you on a line - you're in the center, represented as a large circle. It's spiffy!
Neko (lofulah)

Huh. Now that's interesting.

Aoccdrnig to rsereach at Cmabrigde Uinervtisy, it deosn't mttaer inwaht oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Amzanig huh? Yaeh and I awlyas thought

Still, I think it requires context. I mean, given:
iprmoatnt
one doesn't think of important. I know I think of moats. and IP addresses.

But that'd be the first level of recognition... Hmmm. Assigning each word two values. One: length of the word. Two: sum of each character, as a number. Put all the words into a 3D matrix.. rows as lengths of the word, columns as the sum. Then from there, match.

So if we could teach our OCR (and voice recognition systems) grammar, we'd get better results. But that would require the systems to have knowledge of each word. That'd be the second level of recognition.

The third level would be common sense. That's going to be hard, considering how little of it's around. But just so it doesn't come up with "That tree humped." or something equally absurd. Of course, it depends on context... so...
  • Current Music
    Lies-Evanescence-Origin