Pierre Bernard

My little hideout on the net

Mac OS X - Cocoa

Code snippets written during the development of Houdah Software's Mac OS X software offerings: HoudahSpot 2, HoudahGeo, HoudahGPS, ...

All code published on this page is available under the MIT license unless otherwise indicated.


HHKeyValueObserver is a wrapper around the current KVO API. It should make using KVO easier and less verbose. It provides target/action callbacks as well as cllback blocks where supported.

Download HH Key Value Observer.


HHAssociatedObjects is a category on NSObject that provides a convenient method for attaching object values to random objects. Associated objects can conveniently share the lifespan of the object they are associated with.
I settled on the same API as Andy Matuschak. On Snow Leopard the implementation is actually the same as Andy's. HHAssociatedObjects adds a Leopard compatible implementation.

Download HH Associated Objects.


HHSlidingWindow allows for docking a window at an edge of the main screen. From there it may slide in and out of visibility. Its subclass HHAutoHidingWindow provides automatic showing of the window as the mouse hits the screen edge where the window is hiding. The implementation is actually pretty straightforward. It relies solely on tracking areas. No polling is done.

Download HH Auto Hiding Window.


A NSButton subclass with support for user interface validation.It channels validation through validateButton: and validateUserInterfaceItem:.

Download HH Validated Button.


A NSButton subclass which may respond to 2 keyboard shortcuts. It also displays one of those shortcuts when the command key is held down.

Download HH Dual Shortcut Button.

HHusbObserver & HHserialObserver

List USB and serial devices. Get notifications a devices are connected or disconnected.

This code is used by the freeware GPSBabel frontend HoudahGPS.

Download HH Device Observers.

Universal Cocoa

Xcode user script: PropertyFromInstanceVariable.pl

Enhanced version of a script by Matt Gallagher. Creates @property and @synthesize statements from selected variable declaration

Download PropertyFromInstanceVariable.


ObjectiveLocr is an Objective-C framework that makes it easy for a Cocoa application to work with the Locr API.

This project is based off the objectiveflickr project by Lukhnos D. Liu. Most of the credit goes to him!

Please refer to the objectiveflickr for framework documentation and to the locr.com web site for API documentation.

ObjectiveLocr is used by HoudahGeo (Mac photo geotagging), locrUpload (locr upload client for iPhone) and locrExplorer (full-featured locr client for iPhone).

iPhone - Cocoa Touch

Houdah iPhone Properties

The controllers and views of this project may be used to easily create interfaces much like Apple's Settings applications. They make up most of the UI of the free LocrUpload application.

The HHPropertiesViewController may be used to modify attributes of any key-value-coding compliant container. Typically a container would be a NSMutableDictionary or a NSUserDefaults instance.

The controller is typically configured in a subclass by providing a set of descriptors. Descriptors are immutable objects describe the properties to expose and the UI elements (text field, switch, ...) to use. Seeing that descriptors are immutable, it should be easy to store them in a file rather than building them in code.

The HHSelectionViewController is used by the HHPropertiesViewController for multiple choice values.


Most of my public WebObjects code has been folded into the Houdah WebObjects Frameworks project.
This open source project is focussed on providing an architecture for building powerful rule based CRUD applications. Beyond what has been published here, it includes many useful additions to the WebObjects and Enterprise Objects Frameworks.

You may elect to use Houdah WebObjects Frameworks as a whole. This gives you a modern and extensible alternative to Apple's DirectToWeb (D2W) architecture with much power to spare under the hood. Alternatively you may dive in and pick out the juicy bits: