Thursday, August 21, 2008

Lac [k] of updates

Hey!!!!

Sorry for the lack of updates but I'm recently very very busy in things that I'm forced to do such as homework!!

Anyways, let me tell you that I'm becoming an XML expert. That's right. Hopefully by the end of the month I'll have everything ready. Web Services + Java + iPhone SDK (mobile application)

:)

See you around!!
-igo

Wednesday, July 23, 2008

Protocol Objects?

Not again!!

Now Protocol Objects it seems this never stops. The objects created by protocols (seen earlier) just creates more mess since they are instances of Protocol Class!! Now who did that?!!

Special way of calling them:

Protocol *myXMLSupportProtocol = @protocol(MyXMLSupport);

Adopting protocols?

Yep, "A class is said to adopt a formal protocol if in its declaration it lists the protocol within angle brackets after the superclass name":

@interface ClassName : ItsSuperClass <>

2 or more would be comma-separated inside angle brackets. Categories do basically the same, just use the category declaration and still add the angle brackets with the protocol list

If a class adopts a Protocol the it conforms it. This said, check how it's done.

if ( ! [receiver conformsToProtocol:@protocol(MyXMLSupport)] ) {
// Object does not conform to MyXMLSupport protocol
// If you are expecting receiver to implement methods declared in the
// MyXMLSupport protocol, this is probably an error
}

Enough adopt and conform...let's move on.

Who said Event?

Finally we are approaching to code which manages events...such as MOUSE!! (which in this case would be "finger" perhaps? )

When I first saw Protocols at the index I thought of network connections and sockets. Go no go...

"Protocols declare methods that can be implemented by any class"

bottomline

"As an outsider, all you need to know is what messages you can send (the protocol) and where to send them (the receiver)"

All this is to let the anonymous objects live. We need to call other objects but with just don't know what do they expect from us to obtain a value. Basically we do not care if it's a zebra object we are asking something too. I just want that [zebra] object to send me how many stripes he has and where to send that answer. That's all. That's why we need protocols...to know how many stripes the zebra has and where will the answer will be sent, although we don't even know that we are "talking" to a zebra object.

Definition of a protocol (formal)
@protocol devngoProtocl
method declaration
@end

There is the possibility to define between optional and required methods to the user.

(informal)
@protocol NSObject (devngoProtocol) <--- Which shows the usage of categories for this declaration.
@end

Workplace

Sharing my workplace. Thanks JackBe

Tuesday, July 22, 2008

iPhoneFirst

Hey!

Although I haven't finished the Obj-C guide I headed to the example. I just couldn't bear it anymore.

XCode basically does everything for us. I just displayed the nice Hello World!.

Simple commands so to speak:

Delegate:

MyView *view = [[MyView alloc] initWithFrame:[window frame]];
[window addSubview:view];
[view release];

View:

- (void)drawRect:(CGRect)rect {
/* Draw "Hello, World!" */
NSString *hello = @"Hello, World!";
CGPoint location = CGPointMake(30, 30);
UIFont *font = [UIFont systemFontOfSize:24];
[[UIColor whiteColor] set];
[hello drawAtPoint:location withFont:font];

}

Yes, it is an instance method. We can more or less know what the snippet tells right? We've got the casting method, declaring @"" as String and so on. Perhaps the doubt is

CGPoint location = CGPointMake(30, 30);

why? Where is the *? Perhaps it ain't a pointer and it is in fact some sort of common object assignation.

That'd be all. I'll keep reading now.

One last thing...how can I do this when everyone isn't asleep. I should be resting my 8 hours but then I feel useless since I didn't give it a try the whole day.

Sunday, July 20, 2008

Runtime Differences

"Non-fragile instance variables"? Wow....haha, 64bits is giving me headaches!!

Monday, June 30, 2008

Happy Objective-C

I love Obj-C :D

What I learnt in today's reading:

NSObject - superclass of everything except your own root class [way difficult]

Classes as the object factory since each object is an instance of a class, therefore it's a class object.

Some similarities between instanceof and isMemberOfClass:someClass method.
and isKindOfClass:someClass method which tells if the object we are evaluating inherits from someClass.


Static Typing (ohh pointers here we go!) Useful for the compiler to do type checking

Rectangle *myRect <- This specifies that myRect is a pointer to Rectangle class and Graphic *myRect is also valid since Rectangle inherits from Graphic, therefore it can be statically typed like that.

Class Objects
The body of our object, meaning the method implementations, name of the class and superclasses, instance variables, declarations of methods and their return types.

Class can be typed id or to the Class data type

id aClass = [anObject class] or Class aClass = [anObject class]

Main function: to create new instances.

id myRect;
myRect = [Rectangle alloc];

what alloc method does is to dynamically allocate memory for the new object's instance variable and initializes them all to 0. But we've got to initialize even properly, not just to 0. ( there we go!!)

What we do to initialize is to surround the alloc with init, like this:

id myRect;
myRect = [[Rectangle alloc] init];

Just then myRect would be able to start interacting (e.g. receive messages). The structure is:
alloc returns an instance of Rectangle
init is performed by that instance to set its initial state

I knew I was inside the matrix!! There is a NSMatrix object!!

Messages rock! Look at this:

[myMatrix setCellClass:[NSButtonCell class]];
so what does this mean? (you can answer, you've learnt all the way with me!)
No clue? Well here it is...
NSButtonCell class returns what? A Class or an Id type therefore that is sent to setCellClass which is a setter to myMatrix NSMatrix object (previously initialized). Clear? No? One more time:
myMatrix is an object (instance) of NSMatrix. The CellClass that will be filling that myMatrix object is being defined by the Class passed to the setter method, NSButtonCell.

Class names can only be used in two ways. As part of a message (receiver) or as a type name for a kind of object. Since I've already explained this you should know it.

One new thing would be that if you don't know the class name at compile time but you will at runtime then use NSString *className
and create this monster:

[anObject isKindOfClass:NSClassFromString(className)]
So what does the last statement means?

That's it for today and you've got homework!!

Sunday, June 29, 2008

Today is a good day

No matter what I'll be posting about Obj-C today. I'm really desperate of reading some more and I can't because of this project. Just a question that doesn't need to be answered. What happens when we've lost our creativity? What if the eagerness of developing libraries or resources that can change the circle's sharpness dies?

Today, Obj-C.

Move on!

Come on!! Move on!!

As soon as I finish this damn project I'll be able to do what I WANT to do. This instantly translates to studying obj-c. I'm not at the pace I'd like and iPhone launch is merely two weeks away. I need something by next week or I'll be in serious problems.

Saturday, June 28, 2008

Absolut

No Objective-C news...sorry, damn school's project is killing me .

The good news is that I'm coding with Absolut Pears + Ginger Ale. Excellent mix!!

I'll get back later on!

Friday, June 27, 2008

Weekend arrived

Hey finally weekend!!!

I'll get some sleep tonight and tomorrow I'll be doing some SableCC thing. Although there is no submission I'd like to go one step ahead since the earlier I submit my work the earlier I'll know if it is correct.

And now...Obj-C :D

Saturday and Sunday I'll be reading some more chapters from the guide. I really need to learn. It's a challenge I'd like to face.

iPhone beta 8 was released today but I didn't install it. I'll wait to weeks more to have the final release.

Thursday, June 26, 2008

Lack of energy

Hey! Thanks for staying tuned. Today I won't update since I' tired, too tired perhaps. I'll get some rest and start working tomorrow with what's left with the guide and school's project.

Sorry, see you back later.

id, nil, pointers, messages, dynamic binding...

I dedicated some hours to read the ObjC guide by Apple.

Extremely interesting and in fact addictive. Since I don't have that much spare time I read only the Objects part. I'm missing classes and I'll finish Chapter 1.

A glimpse of what I've read:

Every object is of type id
id anObject;

nil is a null object with an id value of 0

[anObject aMethodInside] <- this stands for a message being sent to object anObject (receiver) telling that aMethodInside(message) has to be applied.

Regarding to parameters being sent inside the message for specific behavior. Suppose it's a rectangle object called myRec and a method inside it called setWidth.

[myRect setWidth:20.0];

Do you see the colon? Well that separates the values from the method. If you are wondering how to send more than just one obligatory param, this is the answer:

[myRect setOriginX: 30.0 y: 50.0];

And if we have a method which receives optional params? Perhaps a method that returns an array?

[receiver makeGroup:group, memberOne, memberTwo, memberThree];

As you can see makeGroup implementation inside the object could be the declaration of a group array that is being filled with three elements at runtime.

Dynamic binding is pretty useful because it handles polymorphism within methods. This happens because method implementation is different among objects but the method can be named the same. Therefore at runtime the behavior is not the same and results are exclusive for each object.

Fair enough, that's it for now. I'll study some more for my tomorrow's midterm.

Thanks!

edit: blog says 1:33am and as of my writing its 3:50am. I'll take a look where to change my time zone.

mini and display

Hey !

Lots of updates as of now. Not as much as the coffee I've drunk.

mini is working with 2gb without a glimpse. Excellent piece of hardware. The failures are still at the office since the person that validates the invoices for changing the dimms was not available. We'll see what happens tomorrow (in few hours).

As I've been staring the display for more than 6 hours I've noticed that there is one dead pixel. We've lost him.

Tomorrow I have mid-term and I'm really not that prepared but I can handle it wisely.

Wednesday, June 25, 2008

Happy again

Mac Mini is working flawlessly now.

The problem was the RAM memory. Wouldn't know why since they are Supertalent. Anyways, as of now I'm working with 1gb since I had to send the failures to warranty hoping to get 'em back by today.

I've been reading and it seems that the mini can handle up to 3gb unofficially.

RAM issues perhaps?

Hey!

I couln't get back yesterday. I rendered my 'lil mini useless. It's having some problems with RAM memory I guess. A friend of mine told me today that perhaps it's the temperature the mini reaches. Today I'll be replacing RAM memory and perhaps use it without the cover.

Objective-C kickoff delayed

Tuesday, June 24, 2008

First post and main objective

Tried to insert some javascript but didn't go well. Security reasons perhaps?
Let's start with the first complain, shall we?


Themes...lack of themes. Why in earth are there so few themes? I liked this one since I didn't like any other. It was a matter of themes discarding 'till one showed up.

Next, main purpose.

Not my life nor my hobbies, my passion. I'll be posting updates of how my Objective-C learning process is going and some screencasts of my work. Perhaps not as neat as you'd like 'em to be since they'll be live recording.

That's it for now. I'll be back later tonight for my first Obj-C related post.