Musings about technology and other neat stuff

BrT random header image

WILTAC #5: zero is a special case

December 9th, 2008 · No Comments

I spent a few minutes today trying to figure out why, when setting a value to zero in an NSTableView, the number formatter I had associated with that column (to add a percentage sign to each number) was not being applied. Eventually, I realized that zero is a special case for NSNumberFormatter, and by default [...]

[

Tags: · · ·

WILTAC #4: Undo

November 19th, 2008 · No Comments

Today I learned how to add support for undo/redo operations using NSUndoManager. This was completely new to me, and I was surprised at how cleverly done it is – essentially, for every operation that you want to undo, you provide the “inverse” operation, and NSUndoManager takes care of keeping them in appropriate stacks for undo/redo, [...]

[

Tags: · · ·

WILTAC #3: NSZombieEnabled

October 17th, 2008 · 2 Comments

I learned today about the NSZombieEnabled environment variable (this is its correct name, and not NSZombiesEnabled as stated in Hillegass’ book). If you set it to YES, whenever you try to send a message to a deallocated object you will get a message like this in the console:

message sent to deallocated instance 0xe02b790

And the debugger [...]

[

Tags: · ·

WILTAC #2: Designated initializers

October 10th, 2008 · No Comments

I learned today the term designated initializer:

When a class has multiple initializers, the designated initializer is the one that actually does the work, normally the one with the most parameters. All other initializers call the designated one, providing different amounts of default parameter values.

I was aware of the concept – many classes have [...]

[

Tags: · · · ·

WILTAC #1: invoking methods on nil in Objective-C

October 7th, 2008 · No Comments

Welcome to the first installment of “What I learned today about Cocoa” (WILTAC).
I have recently started reading Aaron Hillegass’ excellent Cocoa Programming for Mac OS X, third edition, with the intention of brushing up my very lacking Cocoa skills (all of them learned empirically by looking at other people’s code and reading the documentation). To [...]

[

Tags: · · · ·

Password Assistant | codepoetry – For some time I've thought it would be nice to be able to invoke the Password Assistant from the OSX Accounts preference pane on its own, since it is very nice to generate pronounceable passwords. Alas, it seems I was not the only one, someone did it alre (tags: cocoa cool hack macosx password security tools )

Tales from the Loonybin – Demystifying Plugins – A Tutorial – Tutorial on how to write plugins for on OSX. Maybe useful some day… (tags: cocoa howto macosx plugins programming tutorial )