Alex headshot

AlBlue’s Blog

Macs, Modularity and More

NSConference 2010 Day 2

2010, conference, git, mac, nsconf, objectivec

Jeff LaMarche (@jeff_lamarche) kicked off NSConference Day 2 (in lieu of Matt Gemmell), talking about the features of Objective-C that make it particularly interesting (or at least different) with respect to other languages. Jeff’s talk looked at the Objective C runtime and the way in which an Objective-C class can be introspected to acquire properties (with class_copyPropertyList). He also demonstrated the use of class_addMethod as a way of extending a class dynamically at runtime, and hooking in via +resolveInstanceMethod: and +resolveClassMethod:

Andy Finnell (@macgeek02) talked a lot about OpenCL and a little of Core Image in the implementation of Watercolour. This simulates painting by watercolour, by modelling the water pressures on the canvas (which has a texture-based height map) and simulates particles of pigment moved around with the water pressure. It uses OpenCL to update the movement of water (and thus, water-based pigment) and then renders it with Core Image in order to display it as a diagram. The image and demonstration was impressive, although the physics and mathematics were quite involved (and so was the code). Rendering a layer involved calculating the proportion of reflected and absorbed light, coupled with the layers that presented the pigment and underlying canvas. The high-level overview of OpenCL (a device having one or more queues, and kernels (aka functions) being executed on queues) was useful; particularly given that it’s possible to hook up events to chain kernels together. A couple of gotchas in OpenCL – you can only use single primitives or single dimension arrays for primitives; and that if a buffer overrun occurs in OpenCL it just crashes with very little information about what has happened. Andy also has some useful information on compiling kernels with Xcode. Lastly, hooking it all together with the graphics card; Apple has some information on using OpenCL and OpenGL to punt texture data straight to the graphics card without having to go back to main memory.

Dave Dribin (@ddribin) gave a potted history of version control systems, along with some conclusions about where they are heading. What is clear is that Subversion is the king of the hill when it comes to centralised version control systems; and that Git and Mercurial are both top when it comes to distributed version control systems. As far as adoption goes, both the Apache and Eclipse foundations have standardised on Git, whilst Hg is used by code.google.com and java.net. Either way, distributed version control systems are different to centralised version control systems to be used. (Sadly, Xcode doesn’t support anything other than CVS, SVN and Perforce; though ObjectivEClipse is a work-in-progress for an Eclipse-based IDE which will support any SCM that Eclipse supports.)

Graham Lee (@iamleeg) discussed code signing. A signing identity is a unique identification to someone (or something); a requirement is an expression which must hold true (signed by com.apple, version >= 1 < 2 etc.). There’s a whole language for representing these kind of constraints. Keychain Access.app can be used to generate a code-signing identity (and of course, there are those which are available as part of a developer profile for iPhone app distribution), and the codesign tool can be used to programmatically sign executables. (Interestingly, the codesign puts the signature information into the compiled executable; so modifies the MD5 of the executable once signed. You can also check the signature at runtime.) Some interesting tidbits; any application using KeyChain access that isn’t signed is using the 10.4 codepath; and that codepath is considered legacy/unsupported. Code signatures not only show that the code hasn’t been changed since it was received, but is also used by Parental Controls and firewall support. Codesigning using codesign -s will modify in-place the binary. otool -l will show you the steps required for loading the code with the signature.

Aaron Hillegass (@AaronHillegass) discussed “The Many Faces of Data Persistence” and some history of where it all came from. NSArchiving came in 1989 with NSKeyedArchiver in 1991; then there was DBKit in 1992 before EOM in 1994 and EOM2 1995. CoreData wasn’t until 2005. He proclaimed “The File is Dead! Long Live the Cache!” The idea is that going forwards (and using the iPad as an example) all data will live on servers in the cloud; the only way to get at the data will be by sync services, at which point the local hard drive becomes a cache which gets updated periodically. SyncServices achieves this with Mac OS X but doesn’t work on an iPhone; @mzarra’s ZSync is a generic sync framework that aims to work both on iPhone and OSX for synchronisation of data across machines. CoreData is both great and limited at the same time; it can’t talk to RDBMS and has difficulty with dealing with ordered datasets without involving another join/ordered table involved. As a result, Aaron has announced BNRPersistence, made available under an MIT license, to address some of the performance issues with CoreData.

NSConference (Mac edition) finished off with the “Cocoa Rumble” which involved all Mac presenters partnered with unsuspecting members of the conference. The three topics were presenting on CoreText, CoreAudio and CoreImage. After a brief bit of preparation, a 2-minute presentation was delivered and CoreImage won.

I’ll be back tomorrow for NSConference (iPhone edition); and the ongoing twitter feed is available at #nsconf.