The megahertz race is over, and instead we get more execution cores. This means that we as developers must make our applications parallel, in order to take advantage of the new performance. The easiest way to be parallel is to execute tasks in new threads, something that is useful also for lengthy but not resource [...]
Queued Background Tasks for Cocoa
May 9th, 2009 by Fredrik Olsson — Architecture, Java
Tags: concurrency, design patterns, frameworks, iphone, mac, mobile, network, objective-c, open source, performance, programming
Regular Expressions and Cocoa
May 6th, 2009 by Fredrik Olsson — Cocoa, Embedded, Tips & Tricks
Regular expressions is a powerful tool for solving many problems related to text. It can be misused as any good tool, but there are moments when they are the best solution for a given problem. At those moments the lack of regular expressions for Cocoa on Mac OS X and Cocoa Touch on iPhone OS [...]
Tags: apple, frameworks, iphone, mac, mobile, objective-c, open source, performance, programming, regex
Adding Sorted Inserts to Cocoa Arrays
March 28th, 2009 by Fredrik Olsson — Architecture, Cocoa, Embedded, Tips & Tricks
NSArray and NSMutableArray have methods for sorting arrays, NSArray returns new sorted arrays and NSMutableArray can be sorted in place. The sort methods comes in three flavours; using a function, using a selector, or using an array of NSSortDescriptor objects. NSArray admits to sorts being a slow operation, and adds a method pair for comultive [...]
Tags: frameworks, iphone, mobile, objective-c, open source, performance, programming
Bridging the Gap Between Java and Cocoa
March 24th, 2009 by Fredrik Olsson — Architecture, Embedded, Java, Tips & Tricks
Many Java developers are looking at new dynamic languages, such as Groovy and JRuby, mostly because of the freedom and rapid development that a dynamic language allows. Some of my colleagues are also looking at Cocoa and feel daunted at the sight of Objective-C. Here I will use a small example that is easy and [...]
Tags: design patterns, frameworks, iphone, mobile, objective-c, programming, ruby
UIToolbars in iPhone OS 2.x
March 22nd, 2009 by Fredrik Olsson — Cocoa, Embedded, Tips & Tricks
The new release of iPhone OS 3.0 adds some nice API:s for managing a contextual toolbar. This is well needed as toolbars in the current iteration of iPhone OS is not only poorly documented, it is also quite hard to do right. So I will go over how to do toolbars the right way, for [...]
Tags: apple, design patterns, frameworks, iphone, mobile, objective-c, open source, programming, tutorial
iPhone OS and the Lowest Common Denominator
March 18th, 2009 by Fredrik Olsson — Architecture, Embedded, Java
Nishant wrote a good piece on why Apple continue to outdo it’s rivals, he used a variant of a quote by Canadian hockey player Wayne Gretzky to make his point: A good hockey player plays where the puck is. A great hockey player plays where the puck is going to be. This is true as [...]
Tags: apple, innovation, iphone, sdk
Hidden methods in Sony Ericsson Java Platform
March 9th, 2009 by Fredrik Olsson — Embedded, Java, Tips & Tricks
It is no secret that the published interfaces for MIDP classes in any JavaME Platform is only a subset of what in reality is there. Most of the native calls needed to interact with the underlying native platform, and other helper methods, are hidden from us. Mostly for good, and sometimes for bad… The Anecdotal [...]
Tags: frameworks, mobile
Proxy Based AOP for Cocoa Touch
March 6th, 2009 by Fredrik Olsson — Embedded, Tips & Tricks
UITabBarController is generally used as is, no subclassing required. It creates a UITabBar and manages a list of UIViewControllers, keeping track of the tab in focus, UI creation and everything nice. UITabBarController has a delegate, the UITabBarControllerDelegate protocol. Unfortunately this is not a superset of the UITabBarDelegate protocol, and UITabBarController already implements the UITabBarDelegate protocol [...]
Tags: aop, frameworks, iphone, objective-c, programming, proxy, reflection
Finding Subview of a Particular Class in Cocoa
February 24th, 2009 by Fredrik Olsson — Embedded, Tips & Tricks
Many of the UIView subclasses in Cocoa, and especially Cocoa Touch are created by combining many different simple views into a more complex view. UITableViewCell is a good example, concisting of almost a dozen subviews, UIImageView for the image, UILabel for the text, etc. It is often nice to be able to reuse existing functionality [...]
Tags: frameworks, iphone, mobile, objective-c, programming
Fixing Image#getRGB()
January 17th, 2009 by Fredrik Olsson — Embedded, Java, Tips & Tricks
I have encountered a problem when implementing a nine-patch painter for MIDP 2.0, most of my graphics where left transparent for no-reason. A nine-patch is an image with a flexible center row, and a flexible center column. Most useful when doing themed UI, as a single image can be used to draw buttons, and boxes [...]
Tags: midp, mobile, programming
UIButton troubles, a better solution
December 17th, 2008 by Fredrik Olsson — Architecture, Embedded, Java, Tips & Tricks
I described in my previous post how you can change the class of a live object instance. The use-case was a workaround for bug in Cocoa Touch’s UIKit. What if I could fix the bug, instead of applying a work around in my sub-class? Update: Buttons created with UIButtonTypeRoundedRect is a special case returning a [...]
Tags: design patterns, frameworks, iphone, objective-c, programming
UIButton troubles, and Obj-C magic
December 12th, 2008 by Fredrik Olsson — Tips & Tricks
When developing SC68 Player for the iPhone I came upon a quite peculiar problem regarding the UIButton. First the preface I wanted to add a star button to the right side of each row, subclassing UIButton that can manage selected states, images and all I needed, and use it as the accessory view of the [...]
Tags: frameworks, iphone, objective-c, open source, programming
iPhone Tech Talks – Stockholm
December 9th, 2008 by Fredrik Olsson — Embedded, Events, Tips & Tricks, User Experience
Apple has arranged a world tour of iPhone Tech Talks, and in cold december it was Scandinavia’s turn and a crew of software evangelists from Apple turned up at KTH in Stockholm for a full day of sessions. The sessions are confidential so I will keep this post vague on the technical parts, not revealing [...]
Tags: apple, design, frameworks, iphone, mobile, programming, sdk
Accelerometer and Vibration on the iPhone
November 25th, 2008 by Fredrik Olsson — Android, Embedded
Last friday I attended an excellent session at Øredev 2008, on Android by Mike Jennings from Google. At the end of the presentation Mike show the code for a simple application with a bouncing blue ball, controlled by the accelerometer. What stroke me was that the git of the application was 85 lines of code, [...]
Tags: accelerometer, frameworks, iphone, objective-c, oredev, programming, tutorial
HessianKit Released
July 10th, 2008 by Fredrik Olsson — Embedded, Java
HessianKit, an implementation of the Hessian binary web service protocol for Objective-C 2.0 have now been released under Apache License 2. It is available on sourceforge at: http://sourceforge.net/projects/hessiankit HessianKit is available for Mac OS X 10.5 and later, and iPhone OS 2.0. The three main goals are: * To be as compliant and forgiving as [...]
Tags: frameworks, hessian, iphone, objective-c, open source, webservice
