(((1 << 3) & (~0xF | (3 >> 1) & (~0xFFED << 4))) | ~(7 + 0xDEADBEEF << 7) >> 5) >> 5 ^ (0xDE ^ (~0xF32 >> (5 | 74 >> 2)))

Time Machine: Switching Computers

Devin Lane | Leopard | Friday, September 19th, 2008

My main Mac is out of service for a few days as the screen gets replaced, so I performed a Time Machine restore onto another computer to use in the meantime. I’ll let this computer continue backing up to the same time machine volume, then do a TM restore back onto my main machine when it’s fixed.

On the temporary machine, Time Machine didn’t want to continue backing up to the same backup folder. From Time Machine’s perspective, this is a different computer and so it creates a separate folder to perform the backups in. The MAC address of the computer is set as an extended attribute (xattr) on this folder so TM knows which folder to use.

Allowing the temp machine to use the old machine’s backup folder is simple, but not as easy as it should be. The goal is to put the temp machine’s MAC address in the place of the original’s in the xattr on the backup folder. However, using xattr -w com.apple.backupd.BackupMachineAddress 00:00:00:00:00:00 doesn’t work. Instead, you need a little program that can write the address using the xattr API.

I’ve written a little program that performs the switch. It turns off acls on the backup volume, sets the new xattr, logs the old MAC address, then turns the acls back on. You’ll need to run it with root privileges.

It’s available here, or in svn at http://svn.shiftedbits.org/public/backupswitch/trunk.

Key Value Observing Improvements v1.2.2

Devin Lane | Programming | Saturday, September 13th, 2008

Quick bug fix update:

1.2.2 Fixes a crash due to a missing implementation of __KVOAdditions__dealloc__original__ on NSObject.

1.2.1 now runs on the iPhone.

The new updates are in SVN at http://svn.shiftedbits.org/public/KVOAdditions/trunk and tagged at http://svn.shiftedbits.org/public/KVOAdditions/tags/1.2.2

Key Value Observing Improvements v1.2

Devin Lane | Leopard, Programming | Wednesday, September 3rd, 2008

Hot on the heels of the 1.1 bug fix release comes version a freshly rewritten 1.2 with API cleanup, bug fixes, and a great new feature.

Lately, I’ve been using observers to allow an object to observe changes to its own properties. This means I don’t have to override the setter method (I’m using synthesized properties) and the observation is managed the same way that it would be externally. The current KVO implementation (at least, in non-GC land,) however, doesn’t allow you to remove observations from yourself in your -dealloc method. This is due to the way KVO works, by interposing a KVODeallocate function before your -dealloc method. It expects that all observers of the object have been removed at this point, and warns if they are not. This is, of course, blindingly annoying — you now have to create a method that gets called on your objects by their owner before they dealloc so that they can remove their observers.

To fix this, I’ve done a little interposing of my own, putting in another dealloc method before KVODealloc that will remove self observers and call a -KVODealloc method on the deallocating observer object before KVODeallocate is called. If you don’t want automatic removal, simply return NO from +automaticallyRemoveSelfObservations on the class of your choice.

The new updates are in SVN at http://svn.shiftedbits.org/public/KVOAdditions/trunk and tagged at http://svn.shiftedbits.org/public/KVOAdditions/tags/1.2
(more…)

Powered by WordPress | Theme by Roy Tanck, modifications by Devin