onsdag 1 december 2010

Jeff LaMarche praise + UIButtons


Jeff LaMarche just might rule. Seems like a lot of his postings are quite interesting for the maybe-not-so-newbie-anymore ObjC/iPhone programmer.



Nice intro UIView transform

Jeff LaMarche seems to have written quite a nice intro the transform property of UIViews, and how it (the transform prop) can be used to do various things to a view - scale, rotate, translate, etc. Like the tutorial on release/retain I posted below, this is the sort of thing I would have liked to read as a first introduction to animations/transform. Apple definitely has something to learn about pedagogy and/or meeting reader expectations from Jeff and Release/retain-guy/gal.

And oh yeah, here's the link:

http://www.iphone4gnew.com/demystifying-cgaffinetransform.html

Please note: The link leads to some sort of... well, compilation, I guess you could say and still be kind of right, of various sources. Jeff's original blog can be found at http://iphonedevelopment.blogspot.com .

Very good tutorial on release/retain in ObjC

Getters, setters, release, retain...

http://www.iphonedevsdk.com/forum/iphone-sdk-tutorials/7295-getters-setters-properties-newbie.html

lördag 13 november 2010

Dates! Pah!

The following does not compile and several lines are mutually exclusive/contradictive.

Have a nice day.

NSArray* array = [NSLocale availableLocaleIdentifiers];
NSUInteger i = [array count];
NSUInteger j = 0;
for (j = 0; j
NSLog((NSString*)[array objectAtIndex:j]);
}


NSDate *today = [NSDate date];
//unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns
NSDateFormatter *frm = [[NSDateFormatter alloc] init];
[frm setDateFormat:@"EEE MMM dd 'huhu' HH:mm:ss ZZZ yyyy"];
[frm setTimeStyle:NSDateFormatterFullStyle];
[frm setDateStyle:NSDateFormatterFullStyle];

NSLocale *en_US = [[NSLocale alloc] initWithLocaleIdentifier:@"es"];
[frm setLocale:en_US];

NSString *currentTime = [frm stringFromDate:today];
NSLog(@"Time: :%@",currentTime);

fredag 11 juni 2010

Friends from the past...

Okay, little did I know that Java had introduced "generics" when I wrote my previous post. I must admit that my rosy picture of Java stems from around 2000, 2001 or so.

Thus, I shall have to withdraw from my previous standing on the Java language as the best language.

I do not have a clear choice for replacement, but I think Google Go looks sweet.

lördag 15 maj 2010

Java. It's just the way it is. Java.

Having reflected on the pros and cons of various programming languages, I have reached the conclusion that maybe I like Java most. It is really just so great.

For example:

- Everything is references to begin with. Having forgotten for the hundredth time to add the star to an argument to a method in Objective C makes you appreciate this. No need for * or & or ->. Great.

- It's object oriented. The first time you do a collection/aggregation of data and logic and wrap it in a .c and .h file in C it brings a certain nostalgia to life. "This must be where the need of classes first arose" you say to yourself and feel the kinship with thousands of previous programmers, toiling in their sweat in the pre-C++/Ada eras. But the 2nd+ time you do it, it's really more of a nuisance than the joy of following a great tradition. Especially, lacking a compiler-supplied call to a constructor, having to provide an "init" function to set the data to the preferred state.

- It's garbage collected. I love garbage collection. Yes. There it is. I said it. It's out in the open. Or, what I love is not having to keep track an eye out for memory leaks, of course. On the flip side I also love having everything statically allocated at compile time, and never getting anything from the heap. Just to provide some dualism here.

- Dot notation. YES: myObect.setThing(a). NO: [myObject setThing:a].

- Name mangling and function overloading. initWithInt, initWithBool, initWithDouble, initWithAdAbsurdum... yeah right.

- Not as many slightly implicit ways in which objects can happen to get instantiated as in C++.

- No templates.

- No operator overloading.

- Especially no "new" overloading.

Yes, That sums it up good, I think.

fredag 14 maj 2010

iPhone good. Apple maybe not so loveable.

I'd like to know whether an application using Lua would be accepted or not in the App store. Using Lua would save me QUITE a lot of trouble. I'd like to use Objective C and the frameworks as a means of presenting a digestible interface, whereas the logic of the involved entities would be controlled by Lua scripts.

I started doing the internal logic of an application in Lua, as a proof of concept. And after only a couple of days of "coding" Lua, I find it hard to go back to something as cumbersome as... something other than Lua.