<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>&#60;&#60; shiftedbits &#187; Leopard</title>
	<atom:link href="http://shiftedbits.org/category/leopard/feed/" rel="self" type="application/rss+xml" />
	<link>http://shiftedbits.org</link>
	<description>Shift those bits. C'mon, shift em!</description>
	<lastBuildDate>Sun, 19 Apr 2009 19:42:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Time Machine: Switching Computers</title>
		<link>http://shiftedbits.org/2008/09/19/time-machine-switching-computers/</link>
		<comments>http://shiftedbits.org/2008/09/19/time-machine-switching-computers/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 17:58:37 +0000</pubDate>
		<dc:creator>Devin Lane</dc:creator>
				<category><![CDATA[Leopard]]></category>

		<guid isPermaLink="false">http://shiftedbits.org/?p=52</guid>
		<description><![CDATA[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&#8217;ll let this computer continue backing up to the same time machine volume, then do a TM restore back onto my main machine when [...]]]></description>
			<content:encoded><![CDATA[<p>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&#8217;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&#8217;s fixed. </p>
<p>On the temporary machine, Time Machine didn&#8217;t want to continue backing up to the same backup folder. From Time Machine&#8217;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.</p>
<p>Allowing the temp machine to use the old machine&#8217;s backup folder is simple, but not as easy as it should be. The goal is to put the temp machine&#8217;s MAC address in the place of the original&#8217;s in the xattr on the backup folder. However, using xattr -w com.apple.backupd.BackupMachineAddress 00:00:00:00:00:00 doesn&#8217;t work. Instead, you need a little program that can write the address using the xattr API.</p>
<p>I&#8217;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&#8217;ll need to run it with root privileges.</p>
<p>It&#8217;s available <a href="/static/backupswitch_1.0.zip">here</a>, or in svn at http://svn.shiftedbits.org/public/backupswitch/trunk.</p>
]]></content:encoded>
			<wfw:commentRss>http://shiftedbits.org/2008/09/19/time-machine-switching-computers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Key Value Observing Improvements v1.2</title>
		<link>http://shiftedbits.org/2008/09/03/key-value-observing-improvements-v12/</link>
		<comments>http://shiftedbits.org/2008/09/03/key-value-observing-improvements-v12/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 05:35:57 +0000</pubDate>
		<dc:creator>Devin Lane</dc:creator>
				<category><![CDATA[Leopard]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://shiftedbits.org/?p=46</guid>
		<description><![CDATA[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&#8217;ve been using observers to allow an object to observe changes to its own properties. This means I don&#8217;t have to override the setter method (I&#8217;m using synthesized properties) [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>Lately, I&#8217;ve been using observers to allow an object to observe changes to its own properties. This means I don&#8217;t have to override the setter method (I&#8217;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&#8217;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 &#8212; 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.</p>
<p>To fix this, I&#8217;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&#8217;t want automatic removal, simply return NO from +automaticallyRemoveSelfObservations on the class of your choice.</p>
<p>The new updates are in SVN at <code>http://svn.shiftedbits.org/public/KVOAdditions/trunk</code> and tagged at <code>http://svn.shiftedbits.org/public/KVOAdditions/tags/1.2</code><br />
<span id="more-46"></span><br />
Version 1.2 also adds new methods for removing an observer that include a selector parameter.</p>
<p><code>NSObject:</code></p>
<pre>- (void)removeObserver:(NSObject *)observer
            forKeyPath:(NSString *)keyPath
              selector:(SEL)selector;
</pre>
<p><code>NSArray:</code></p>
<pre>- (void)removeObserver:(NSObject *)observer
  fromObjectsAtIndexes:(NSIndexSet *)indexes
            forKeyPath:(NSString *)keyPath
              selector:(SEL)selector;
</pre>
<p>The selector is now considered a unique part of the observation, and so a class can observe a single property on a single object using multiple selectors. This allows a class and its subclass to avoid collisions when observing a single object.</p>
<p>The <code>-removeObserver:forKeyPath:</code> method now no longer removes selector-based observers.</p>
]]></content:encoded>
			<wfw:commentRss>http://shiftedbits.org/2008/09/03/key-value-observing-improvements-v12/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Leopard CGWindowList* APIs</title>
		<link>http://shiftedbits.org/2007/11/08/leopard-cgwindowlist-apis/</link>
		<comments>http://shiftedbits.org/2007/11/08/leopard-cgwindowlist-apis/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 05:07:39 +0000</pubDate>
		<dc:creator>Devin Lane</dc:creator>
				<category><![CDATA[Leopard]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://shiftedbits.org/2007/11/08/leopard-cgwindowlist-apis/</guid>
		<description><![CDATA[Leopard brings new APIs at the CoreGraphics layer to gather information about windows on the system. These functions let you find windows relative to a known window, find all windows on the system, including those offscreen, and obtain images of one or more windows as composited by the Window Server.
However, these API&#8217;s have an interesting [...]]]></description>
			<content:encoded><![CDATA[<p>Leopard brings new APIs at the CoreGraphics layer to gather information about windows on the system. These functions let you find windows relative to a known window, find all windows on the system, including those offscreen, and obtain images of one or more windows as composited by the Window Server.</p>
<p>However, these API&#8217;s have an interesting peculiarity: when the documentation says &#8220;a CFArray of CGWindowID values&#8221; they mean a CFArray of uint32s, not CFNumbers as programmers familiar with CoreFoundation might expect. This holds true for the <code>CGWindowListCreate()</code>, <code>CGWindowListCreateDescriptionFromArray()</code>, and <code>CGWindowListCreateImageFromArray</code> functions, but the two functions that return window information (<code>CGWindowListCopyWindowInfo()</code> and <code>CGWindowListCreateDescriptionFromArray()</code>) wrap all numeric values in CFNumbers.</p>
<p>To create such an array, you&#8217;ll have to create it with CFArrayCreateMutable(), such as the following:</p>
<pre>/* Make an array with no callbacks */
CFMutableArrayRef windows = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);

/* myWindow is a NSWindow */
CFArrayAppendValue(windows, (void *)[myWindow windowNumber]);
</pre>
<p>To get the <code>CGWindowID</code> of a <code>NSWindow</code>, you&#8217;ll want to use <code>-[NSWindow windowNumber]</code>. Even though the documentation specifies that this isn&#8217;t the same number as assigned by the WindowServer, it turns out that it works fine with the CGWindow* APIs.</p>
]]></content:encoded>
			<wfw:commentRss>http://shiftedbits.org/2007/11/08/leopard-cgwindowlist-apis/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Time Machine Menu</title>
		<link>http://shiftedbits.org/2007/11/01/time-machine-menu/</link>
		<comments>http://shiftedbits.org/2007/11/01/time-machine-menu/#comments</comments>
		<pubDate>Thu, 01 Nov 2007 02:36:51 +0000</pubDate>
		<dc:creator>Devin Lane</dc:creator>
				<category><![CDATA[Leopard]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://shiftedbits.org/2007/11/01/time-machine-menu/</guid>
		<description><![CDATA[The Time Machine application, when in the dock, enables access to functions for showing Time Machine, backing up now, stopping an existing backup, browsing other Time Machine disks and showing Time Machine preferences. If you&#8217;re like me, you&#8217;d like access to these features without the app in the dock; unfortunately, you can&#8217;t &#8212; by default.
I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>The Time Machine application, when in the dock, enables access to functions for showing Time Machine, backing up now, stopping an existing backup, browsing other Time Machine disks and showing Time Machine preferences. If you&#8217;re like me, you&#8217;d like access to these features without the app in the dock; unfortunately, you can&#8217;t &#8212; by default.</p>
<p>I&#8217;ve done a bit of digging and was able to implement all but one of these features in a menu extra. Download it and the source <a href="/static/Time%20Machine%20Menu.zip">here</a>.</p>
<p>And yes, the menu icon doesn&#8217;t scale nicely :)</p>
]]></content:encoded>
			<wfw:commentRss>http://shiftedbits.org/2007/11/01/time-machine-menu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Time Machine Exclusions</title>
		<link>http://shiftedbits.org/2007/10/31/time-machine-exclusions/</link>
		<comments>http://shiftedbits.org/2007/10/31/time-machine-exclusions/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 07:08:12 +0000</pubDate>
		<dc:creator>Devin Lane</dc:creator>
				<category><![CDATA[Leopard]]></category>

		<guid isPermaLink="false">http://shiftedbits.org/2007/10/31/time-machine-exclusions/</guid>
		<description><![CDATA[So Time Machine is a pretty convenient way to backup your machine, and I use it to backup my laptop to an external FireWire drive. Although Time Machine backs up the &#8220;whole system,&#8221; I assumed there had to be some exclusions, such as cache files or /dev, for example. After a short bit of digging, [...]]]></description>
			<content:encoded><![CDATA[<p>So Time Machine is a pretty convenient way to backup your machine, and I use it to backup my laptop to an external FireWire drive. Although Time Machine backs up the &#8220;whole system,&#8221; I assumed there had to be some exclusions, such as cache files or /dev, for example. After a short bit of digging, I discovered that these paths are specified in a standard property list at <code>/System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist</code></p>
<p>The full list is some 57 items, and is available below. Besides the expected cache items, the list includes some items I thought interesting:</p>
<pre>
/home
*/Library/Logs
/Users/Guest
/Library/Safari/Icons.db
/.Spotlight-V100
</pre>
<p>Of these, the only one I find odd is the exclusion of logs. If your system goes haywire such that you restore it completely from a backup, it might be nice to see what went wrong.</p>
<p>[Update] Fixed the path to the StdExclusions.plist file.</p>
<p><span id="more-11"></span>Here&#8217;s the full list of the excluded paths:</p>
<h4>Contents Excluded</h4>
<p>The contents of these paths are excluded, but the directories themselves are preserved as they are required for a successful restore.</p>
<pre>
/Volumes
/Network
/automount
/.vol
/tmp
/cores
/private/tmp
/private/Network
/private/tftpboot
/private/var/automount
/private/var/log
/private/var/folders
/private/var/log/apache2
/private/var/log/cups
/private/var/log/fax
/private/var/log/ppp
/private/var/log/sa
/private/var/log/samba
/private/var/log/uucp
/private/var/run
/private/var/spool
/private/var/tmp
/private/var/vm
/private/var/db/dhcpclient
/private/var/db/fseventsd
/Library/Caches
/Library/Logs
/System/Library/Caches
/System/Library/Extensions/Caches
</pre>
<h4>Paths Excluded</h4>
<p>These directories and their contents are excluded completely.</p>
<pre>
/.Spotlight-V100
/.Trashes
/.fseventsd
/.hotfiles.btree
/Backups.backupdb
/Desktop DB
/Desktop DF
/Network/Servers
/Previous Systems
/Users/Shared/SC Info
/Users/Guest
/dev
/home
/net
/private/var/db/Spotlight
/private/var/db/Spotlight-V100
</pre>
<h4>User Paths Excluded</h4>
<p>These directories are and their contents are excluded per-user. The path is relative to the user&#8217;s home folder.</p>
<pre>Library/Application Support/MobileSync
Library/Application Support/SyncServices
Library/Caches
Library/Logs
Library/Mail/Envelope Index
Library/Mail/AvailableFeeds
Library/Mirrors
Library/PubSub/Database
Library/PubSub/Downloads
Library/PubSub/Feeds
Library/Safari/Icons.db
Library/Safari/HistoryIndex.sk
</pre>
]]></content:encoded>
			<wfw:commentRss>http://shiftedbits.org/2007/10/31/time-machine-exclusions/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.307 seconds -->
