Skip to: categories | main content
Macs & more
| « | February '10 | |||||
|---|---|---|---|---|---|---|
| M | T | W | T | F | S | S |
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
UIView's +beginAnimations:context: method, I decided to quickly search the web for some information on how other developers approached this problem.UIWindow to find the one containing an instance of UIKeyboard, a private class that isn't even documented in the iPhone SDK. Those hacks then proceeded to modify the dimensions of the view that contains the keyboard and adding the UIToolbar instance as a subview, so it would animate into the key window right along with the keyboard.NSOperation objects, feed them to an NSOperationQueue and get the results fed back to the caller via delegation.initWithContentsOfURL: (or similar)? The main reason here is asynchronous networking. If you're going to just fetch network data, such as strings, images or whole XML documents from remote servers, you are going to see some latency, especially if you're developing for the iPhone and running on an EDGE or 3G network.NSOperation and NSOperationQueue a while back (in Mac OS X 10.5 Leopard).NSOperation and override the -main method to do your bidding. This is where the heavy lifting should take place and all your network latency will not matter anymore. I have written a sample application that uses an NSOperation subclass to fetch an image via HTTP and return it to the controller using a delegate protocol that I have written specifically for this task. My -main method look like this:
- (void)main {
NSImage *image = nil;
NSError *error = nil;
NS_DURING
if ([self isCancelled]) {
NS_VOIDRETURN;
}
NSData *data = [NSData dataWithContentsOfURL:_url options:NSDataReadingUncached error:&error];
if (nil != error) {
[(NSObject *)_delegate performSelectorOnMainThread:@selector(errorOccurred:) withObject:error waitUntilDone:NO];
NS_VOIDRETURN;
}
image = [[NSImage alloc] initWithData:data];
NS_HANDLER
NS_ENDHANDLER
sleep(2); // for illustration purposes
[(NSObject *)_delegate performSelectorOnMainThread:@selector(didReceiveImage:) withObject:image waitUntilDone:NO];
}
_url and _delegate are instance variables that were filled during initialization). The delegate implements the selectors defined in my protocol, errorOccurred: and didReceiveImage:.NSOperationQueue, which provides a method to queue NSOperation subclasses for execution. In my application controller's -awakeFromNib method, I instantiate my NSOperation subclass and add it to the NSOperationQueue like this:
- (void)awakeFromNib {
[_progressIndicator startAnimation:self];
NSURL *url = [NSURL URLWithString:@"http://alexrepty.com/other/kiwi.jpg"];
ImageFetchOperation *operation = [[[ImageFetchOperation alloc] initWithURL:url delegate:self] autorelease];
[_queue addOperation:operation];
}
Last night, I released Lab Tick 0.9.3 which fixes a number of small bugs. The biggest change in this release is support for fast user switching. In previous versions of Lab Tick, you either had to disable or quite Lab Tick before you would switch to a different account on your notebook - otherwise, Lab Tick would continue to run and try to control the illumination. This caused erratic behaviour when another instance of Lab Tick was running under a different account.
Also, since Xcode 3.2 in Snow Leopard comes with a static analyzer built-in, I could find a number of small memory leaks, which should hopefully reduce memory usage by a bit.
However, even though Lab Tick 0.9.3 runs perfectly fine on Snow Leopard, it won't run in 64 bit. That is because some of the APIs I use to control the backlit keyboard are not fully 64-bit-capable and have been deprecated by Apple. I will look into replacing those APIs with modern ones that have 64 bit support. Since spare time is always an issue, I cannot make any promises on a release date.
Until then, I hope the lack of support for 64 bit doesn't bother you too much.
Recently, I've founded a CocoaHeads chapter for the city of Bremen. We've had a lot of initial interest in our meetings and have managed about 15 people coming to each of the meetings. For our second meeting, I organized a small challenge for which I gave away a coupon code to receive the first three NSConference 2009 videos for free (Thanks, Scotty!). This challenge was well received and got me thinking about organizing something bigger and better, much like what Ironcoder used to be, but just for our local CocoaHeads chapter.
I've started asking around on Twitter (I'm @arepty, by the way) for software vendors to donate licenses, and with the Mac developer community being as fantastic as always, I received pledges for software licenses worth over 500 € within a couple of days. To top this off, falkemedia has thrown three one-year subscriptions of their magazine Mac Life into the mix, so the winners of the upcoming competition have quite a lot of stuff to look forward to.
The competition details (theme and API) will be announced at our meeting next Thursday, August 13th 2009. Please note that this being strictly a competition for the Bremen chapter of CocoaHeads, you will only be eligible to enter if you have participated in one of our local meetings in the past or will participate on Thursday. Participants will have about three weeks to build an app (Mac or iPhone) with the theme and API that I will choose for them. After the deadline, I will judge the apps and announce winners at the September meeting of our chapter.
You're probably interested to learn what kind of software was pledged as prizes for the competition, so here's the complete list:

Code Collector Pro (1 license)

Mac Life magazine (3 one-year subscriptions)
In my opinion, that is one fantastic line-up of prizes - especially for developers. They will be distributed as follows among the best-ranking participants:
First prize: RapidWeaver, LittleSnapper, Lighthouse Keeper, Code Collector Pro, Decloner, Posterino, Versions, TimeBoxed, CoverSutra, Changes, Mental Case, Mac Life subscription
Second prize: RapidWeaver, LittleSnapper, Decloner, Posterino, Versions, TimeBoxed, CoverSutra, Changes, Mac Life subscription
Third prize: RapidWeaver, LittleSnapper, Decloner, Posterino, Versions, TimeBoxed, CoverSutra, Mac Life subscription
Fourth and fifth prize: RapidWeaver, LittleSnapper, Decloner, Posterino, TimeBoxed
Including the Mac Life subscriptions, the amount of all the prizes comes to over 1,000 €. I'd like to thank all of the sponsors for their generous offers and hope that all those who attend next week's meeting are going to enjoy the competition. I'm looking forward to seeing what you guys will come up with.
2009-01-29 13:32:56.306 Debugging[28349:20b] -[NSCFString doSomething]: unrecognized selector sent to instance 0x3030
2009-01-29 13:32:56.307 Debugging[28349:20b] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString doSomething]: unrecognized selector sent to instance 0x3030'
Latest Comments
Sun, 24.01.2010 22:05
Eric, I'm glad you enjoyed the tutorial. I've faced th e same problem you're currentl y facing before, and I s [...]
Sun, 24.01.2010 20:37
This is a great tutorial. Than ks! The trouble I have with this method is that if I have multiple text fields in [...]
Sat, 17.10.2009 07:13
Hello from Russia! Can I quot e a post in your blog with the link to you?
Thu, 15.10.2009 15:03
Tim, I haven't seen that is sue before, but I'll be sure t o check it out and if possible work on a fix for the n [...]
Thu, 15.10.2009 15:01
The latest version of LabTick seems to have an issue. I typi cally have my brightness set t o the lowest setting, bu [...]