<?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>Jeff Kelley’s Blog</title>
	<atom:link href="http://blog.slaunchaman.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.slaunchaman.com</link>
	<description>Mac tips, iPhone applications, and the like</description>
	<lastBuildDate>Thu, 19 Aug 2010 21:14:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Apple Doesn’t Like “Die, You Gravy-Sucking Pig-Dog!”</title>
		<link>http://blog.slaunchaman.com/2010/08/19/apple-doesn%e2%80%99t-like-%e2%80%9cdie-you-gravy-sucking-pig-dog%e2%80%9d/</link>
		<comments>http://blog.slaunchaman.com/2010/08/19/apple-doesn%e2%80%99t-like-%e2%80%9cdie-you-gravy-sucking-pig-dog%e2%80%9d/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 21:14:12 +0000</pubDate>
		<dc:creator>Jeff Kelley</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[BSD]]></category>
		<category><![CDATA[Easter eggs]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[UNIX beard]]></category>

		<guid isPermaLink="false">http://blog.slaunchaman.com/?p=328</guid>
		<description><![CDATA[There’s a relatively well-known Easter]]></description>
			<content:encoded><![CDATA[<p>There’s a <a href="http://www.codinghorror.com/blog/2009/01/die-you-gravy-sucking-pig-dog.html">relatively well-known</a> Easter egg in BSD’s <code>shutdown.c</code>: a function named <code>die_you_gravy_sucking_pig_dog</code> (side note: I’ve got three-to-one odds that say whoever wrote that has a huge UNIX beard). It turns out that Apple doesn’t care to have such uncouth function names floating around, so <a href="http://opensource.apple.com/source/system_cmds/system_cmds-498.2/shutdown.tproj/shutdown.c">they re-defined it</a>:</p>
<blockquote><p><code>#ifdef __APPLE__<br />
void log_and_exec_reboot_or_halt(void);<br />
#else<br />
void die_you_gravy_sucking_pig_dog(void);<br />
#endif</code></p></blockquote>
<p>Sure, it does the same thing, but I don’t think <code>log_and_exec_reboot_or_halt</code> has the same panache.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.slaunchaman.com/2010/08/19/apple-doesn%e2%80%99t-like-%e2%80%9cdie-you-gravy-sucking-pig-dog%e2%80%9d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode 3.2: Using GDB as a Non-Admin User</title>
		<link>http://blog.slaunchaman.com/2010/07/20/xcode-3-2-using-gdb-as-a-non-admin-user/</link>
		<comments>http://blog.slaunchaman.com/2010/07/20/xcode-3-2-using-gdb-as-a-non-admin-user/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 18:30:35 +0000</pubDate>
		<dc:creator>Jeff Kelley</dc:creator>
				<category><![CDATA[Mac Systems Administration]]></category>
		<category><![CDATA[Programming Tips]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[dscl]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://blog.slaunchaman.com/?p=310</guid>
		<description><![CDATA[New in Xcode 3.2 is]]></description>
			<content:encoded><![CDATA[<p><a href="http://developer.apple.com/iphone/library/releasenotes/DeveloperTools/RN-Xcode/#//apple_ref/doc/uid/TP40001051-DontLinkElementID_13">New in Xcode 3.2</a> is an authorization setting that looks like this:</p>
<blockquote><pre>&lt;dict&gt;
	&lt;key&gt;allow-root&lt;/key&gt;
	&lt;false/&gt;
	&lt;key&gt;class&lt;/key&gt;
	&lt;string&gt;rule&lt;/string&gt;
	&lt;key&gt;comment&lt;/key&gt;
	&lt;string&gt;For use by Apple.  WARNING: administrators are advised not to
	        modify this right.&lt;/string&gt;
	&lt;key&gt;k-of-n&lt;/key&gt;
	&lt;integer&gt;1&lt;/integer&gt;
	&lt;key&gt;rule&lt;/key&gt;
	&lt;array&gt;
		&lt;string&gt;is-admin&lt;/string&gt;
		&lt;string&gt;is-developer&lt;/string&gt;
		&lt;string&gt;authenticate-developer&lt;/string&gt;
	&lt;/array&gt;
	&lt;key&gt;shared&lt;/key&gt;
	&lt;true/&gt;
&lt;/dict&gt;</pre>
</blockquote>
<p>The upshot of this is that if you aren’t in the <code>_developer</code> group in the local directory, you’ll have to authenticate as an administrator to use <code>gdb</code> or some of the performance tools. For the vast majority of developers on Mac OS X, who run as an administrator, this is fine, but if you’re running as a regular user, either for security reasons or because you’re in something like a lab setting, this can be a problem. To add a user to the <code>_developer</code> group, use the <code>dscl</code> command:</p>
<blockquote><p><code>dscl . -append /Groups/_developer GroupMembership <strong>UserName</strong></code></p></blockquote>
<p>Replace <code><strong>UserName</strong></code> with the short name of your user account (or <code>$(whoami)</code>) and you should be all set.</p>
<p>If you’re administering Mac OS X in a lab setting, you can either create a LaunchAgent that handles this or a login hook. See the Apple tech note <a href="http://developer.apple.com/mac/library/technotes/tn2008/tn2228.html">“Running At Login”</a> for more information on login hooks. As an added touch, my login and logout scripts to handle this also remove all users from the group, like so:</p>
<blockquote><p><code>dscl . -delete /Groups/_developer GroupMembership</code></p></blockquote>
<p>If the <code>GroupMembership</code> key doesn’t exist, <code>dscl</code> will create it—and it doesn’t exist by default—so deleting it outright shouldn’t cause any problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.slaunchaman.com/2010/07/20/xcode-3-2-using-gdb-as-a-non-admin-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing with Special Characters in iPhone 4 Graphics Filenames with Subversion</title>
		<link>http://blog.slaunchaman.com/2010/07/10/dealing-with-special-characters-in-iphone-4-graphics-filenames-with-subversion/</link>
		<comments>http://blog.slaunchaman.com/2010/07/10/dealing-with-special-characters-in-iphone-4-graphics-filenames-with-subversion/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 01:48:27 +0000</pubDate>
		<dc:creator>Jeff Kelley</dc:creator>
				<category><![CDATA[Programming Tips]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[convenience]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone 4]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://blog.slaunchaman.com/?p=304</guid>
		<description><![CDATA[With the iPhone 4’s high-resolution]]></description>
			<content:encoded><![CDATA[<p>With the iPhone 4’s high-resolution screen, designers need to create two sets of art; the guidelines are to name the files like so: <code>SomeCoolImage.png</code> and <code>SomeCoolImage@2x.png</code>. Unfortunately, if you try to add these files to an SVN repository, the <code>@</code> symbol throws them off:</p>
<blockquote><pre>$ svn add Icon\@2x~iphone.png
svn: warning: 'Icon' not found</pre>
</blockquote>
<p>The fix, thanks to the <a href="http://groups.google.com/group/subversion_users/browse_thread/thread/2b8e8e05e04fa240/">subversion_users Google Group</a>, is to add another <code>@</code> to the end of the filename, like so:</p>
<blockquote><pre>$ svn add ./Icon\@2x~iphone.png@
A  (bin)  Icon@2x~iphone.png</pre>
</blockquote>
<p>If you’d like to do this for all of your high-resolution art in a folder, here’s a tiny Bash command for the task:</p>
<blockquote><pre>for x in `ls *\@*`; do svn add $x\@; done</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.slaunchaman.com/2010/07/10/dealing-with-special-characters-in-iphone-4-graphics-filenames-with-subversion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How-To: Run a LaunchDaemon That Requires Networking</title>
		<link>http://blog.slaunchaman.com/2010/07/01/how-to-run-a-launchdaemon-that-requires-networking/</link>
		<comments>http://blog.slaunchaman.com/2010/07/01/how-to-run-a-launchdaemon-that-requires-networking/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 17:28:37 +0000</pubDate>
		<dc:creator>Jeff Kelley</dc:creator>
				<category><![CDATA[Mac Systems Administration]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[launchd]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://blog.slaunchaman.com/?p=300</guid>
		<description><![CDATA[I’m a big fan of]]></description>
			<content:encoded><![CDATA[<p>I’m a big fan of using <a href="http://launchd.macosforge.org/">launchd</a> to automate things in Mac OS X. That serves me well, as that’s how Apple wants things done moving forward. That said, one of launchd’s biggest shortcomings is a lack of a dependency system. There is currently no way, for instance, to specify in a LaunchDaemon’s property list that the daemon requires the network to be active in order to run. This is problematic for some things, such as a script I wrote to automatically set the computer’s hostname based on the DNS server (more on that later). Luckily, Apple has already defined a function, <code>CheckForNetwork</code>, in <code>/private/etc/rc.common</code>. Here it is in all its glory:</p>
<blockquote><pre>##
# Determine if the network is up by looking for any non-loopback
# internet network interfaces.
##
CheckForNetwork()
{
	local test

	if [ -z "${NETWORKUP:=}" ]; then
		test=$(ifconfig -a inet 2>/dev/null | sed -n -e '/127.0.0.1/d' -e '/0.0.0.0/d' -e '/inet/p' | wc -l)
		if [ "${test}" -gt 0 ]; then
			NETWORKUP="-YES-"
		else
			NETWORKUP="-NO-"
		fi
	fi
}</pre>
</blockquote>
<p>In your code, simply include <code>rc.common</code>, then call <code>CheckForNetwork</code> as needed. An example:</p>
<blockquote><pre>#!/bin/bash

# Example Daemon Starter
. /etc/rc.common

CheckForNetwork

while [ "${NETWORKUP}" != "-YES-" ]
do
        sleep 5
        NETWORKUP=
        CheckForNetwork
done

# Now do what you need to do.</pre>
</blockquote>
<p>Note that this will keep the script running indefinitely until <code>CheckForNetwork</code> sets <code>NETWORKUP</code> to “<code>-YES-</code>,” so if there’s a networking problem your code may never execute.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.slaunchaman.com/2010/07/01/how-to-run-a-launchdaemon-that-requires-networking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Earth Now Available Without Automatic Updates</title>
		<link>http://blog.slaunchaman.com/2010/06/30/google-earth-now-available-without-automatic-updates/</link>
		<comments>http://blog.slaunchaman.com/2010/06/30/google-earth-now-available-without-automatic-updates/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 18:13:40 +0000</pubDate>
		<dc:creator>Jeff Kelley</dc:creator>
				<category><![CDATA[Mac Systems Administration]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Systems Administration]]></category>

		<guid isPermaLink="false">http://blog.slaunchaman.com/?p=295</guid>
		<description><![CDATA[A while back I blogged]]></description>
			<content:encoded><![CDATA[<p>A while back I <a href="http://blog.slaunchaman.com/2008/12/04/google-delivers-mac-google-earth-api-plugin-but-at-what-cost/">blogged</a> about Google Earth’s stealthy, silent automatic update feature. That post continues to be pretty popular, so I wanted to share an update: Google has released a version of Google Earth, including the Web plug-in, that does not include the self-updater. On the <a href="http://earth.google.com/intl/en/download-earth.html">download page</a>, the EULA features this paragraph:</p>
<blockquote><p>(b) Automatic Updates. The Google Earth software may communicate with Google servers from time to time to check for available updates to the software, such as bug fixes, patches, enhanced functions, missing plug-ins and new versions (collectively, &#8220;Updates&#8221;). By installing the Google Earth software, you agree to automatically request and receive Updates.</p></blockquote>
<p>However, if you navigate to the <a href="http://earth.google.com/intl/en/download-earth-advanced.html">advanced setup</a> page, there&#8217;s a box you can un-check labeled “Allow Google Earth to automatically install recommended updates.” This box directs you to a separate download that does not include the updater. The EULA, however, does not change when you deselect it. I don’t think that really matters as much in the grand scheme of things, so I’ve really got to give Google some kudos here for listening to systems administrators and concerned users on this one.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.slaunchaman.com/2010/06/30/google-earth-now-available-without-automatic-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress 3.0</title>
		<link>http://blog.slaunchaman.com/2010/06/18/wordpress-3-0/</link>
		<comments>http://blog.slaunchaman.com/2010/06/18/wordpress-3-0/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 15:38:23 +0000</pubDate>
		<dc:creator>Jeff Kelley</dc:creator>
				<category><![CDATA[Miscellania]]></category>
		<category><![CDATA[meta]]></category>

		<guid isPermaLink="false">http://blog.slaunchaman.com/?p=293</guid>
		<description><![CDATA[I&#8217;ve updated the site to]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated the site to WordPress 3.0. So far all is well; I&#8217;ll likely create a new post type (excellent new feature) for software once I have more software to be creating posts about.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.slaunchaman.com/2010/06/18/wordpress-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating dyld Shared Caches with Radmind: Best Practices</title>
		<link>http://blog.slaunchaman.com/2010/06/15/updating-dyld-shared-caches-with-radmind-best-practices/</link>
		<comments>http://blog.slaunchaman.com/2010/06/15/updating-dyld-shared-caches-with-radmind-best-practices/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 15:41:56 +0000</pubDate>
		<dc:creator>Jeff Kelley</dc:creator>
				<category><![CDATA[Mac Systems Administration]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[dyld]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Radmind]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[Systems Administration]]></category>

		<guid isPermaLink="false">http://blog.slaunchaman.com/?p=280</guid>
		<description><![CDATA[Similar to my last post]]></description>
			<content:encoded><![CDATA[<p>Similar to my last post about <a href="http://blog.slaunchaman.com/2010/05/27/updating-kernel-extensions-with-radmind-best-practices/">updating kernel extensions</a>, you can run into problems with Radmind due to the dyld shared cache. You may see messages like this in your system log:</p>
<blockquote><p><code>current cache invalid because /System/Library/Frameworks/WebKit.framework/Versions/A/WebKit has changed</code></p></blockquote>
<p>Running the <code>update_dyld_shared_cache</code> command will fix this, but there&#8217;s a better way. Sure, there&#8217;s almost no overhead to that command, but where&#8217;s the fun in that? Here&#8217;s a pre-apply script that will delete any shared caches that have changed, which will then be re-built at reboot.</p>
<blockquote><p><code>
<pre>#!/bin/sh

# update_dyld_caches: Inspects the applicable transcript for something that
#                     might cause a dyld cache to become outdated. If it exists,
#                     delete the cache so it's re-created at startup.

DYLD_CACHE_FOLDER="/private/var/db/dyld"
DYLD_PREFIX="dyld_shared_cache_"
ARCHITECTURES="i386 x86_64 rosetta ppc ppc64"

for arch in ${ARCHITECTURES}; do
	cache="${DYLD_CACHE_FOLDER}/${DYLD_PREFIX}${arch}"
	map="${DYLD_CACHE_FOLDER}/${DYLD_PREFIX}${arch}.map"

	if /bin/test -f "${cache}"; then
		if /bin/test -f "${map}"; then
			/bin/cat "${map}" | grep ^/ | sort --unique --ignore-case | while read line; do
				if /bin/test -n "$(grep ${line} ${1})"; then # found a match
					/bin/rm -f "${cache}"
					/bin/rm -f "${map}"
					break;
				fi
			done
		else
			# Cache exists, but there's no map.
			/bin/rm -f "${cache}"
		fi
	fi
done</pre>
<p></code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.slaunchaman.com/2010/06/15/updating-dyld-shared-caches-with-radmind-best-practices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating Kernel Extensions with Radmind: Best Practices</title>
		<link>http://blog.slaunchaman.com/2010/05/27/updating-kernel-extensions-with-radmind-best-practices/</link>
		<comments>http://blog.slaunchaman.com/2010/05/27/updating-kernel-extensions-with-radmind-best-practices/#comments</comments>
		<pubDate>Thu, 27 May 2010 17:28:36 +0000</pubDate>
		<dc:creator>Jeff Kelley</dc:creator>
				<category><![CDATA[Mac Systems Administration]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Kernel Extensions]]></category>
		<category><![CDATA[kextd]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Radmind]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[Systems Administration]]></category>

		<guid isPermaLink="false">http://blog.slaunchaman.com/?p=272</guid>
		<description><![CDATA[One of the problems that]]></description>
			<content:encoded><![CDATA[<p>One of the problems that I&#8217;ve run into so far using <a href="http://www.radmind.org">Radmind</a> to manage Mac OS X—specifically, the Leopard to Snow Leopard transition—is that <code>kextd</code> helpfully starts recreating your kernel extension cache as soon as you modify anything in <code>/System/Library/Extensions</code>. This can be problematic when you&#8217;re updating core system files; as you update the 10.5 kernel extensions to their 10.6 counterparts, you don&#8217;t want the 10.5 version of <code>kextd</code> creating a cache of 10.6 kernel extensions, especially as the kernel extension cache has moved (from <code>/System/Library/Extensions.mkext</code> to <code>/System/Library/Caches/com.apple.kext.caches/</code>). So, should you handle this? My solution is to stop <code>kextd</code> if I know that I&#8217;m updating kernel extensions; that way, they won&#8217;t be re-created until reboot. Here&#8217;s the script:</p>
<p><code>/private/var/radmind/preapply/update_kernel_extensions</code>:</p>
<blockquote><p><code>
<pre>#!/bin/sh

# update_kernel_extensions: Manage the replacement of old kernel extensions.
#                           If there are updates, kill kextd and destroy the
#                           caches.

KEXT_CACHE="/System/Library/Caches/com.apple.kext.caches"
KEXT_FOLDER="/System/Library/Extensions"
KEXTD_LAUNCHD="com.apple.kextd"
SYSTEM_LAUNCHD_FOLDER="/System/Library/LaunchDaemons"

transcript="${1}"
result="${transcript}.$$"

/usr/bin/grep "${KEXT_FOLDER}" "${transcript}" > "${result}"

if test -n "${result}"; then #result is non-empty
    # Disable kextd to prevent it from recreating kernel extension caches, which
    # will be re-created at startup.
    if test -n "$(/bin/launchctl list | /usr/bin/grep ${KEXTD_LAUNCHD})"; then
        #kextd is running
        /bin/launchctl unload "${SYSTEM_LAUNCHD_FOLDER}/${KEXTD_LAUNCHD}.plist"
    fi

    # Remove kernel extension cache.
    /bin/rm -rf "${KEXT_CACHE}"
fi

rm -f "${result}"</pre>
<p></code></p></blockquote>
<p>In its present form, it only works on Snow Leopard, but I&#8217;ll be updating it to work on Leopard as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.slaunchaman.com/2010/05/27/updating-kernel-extensions-with-radmind-best-practices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Take Me Home Now Free</title>
		<link>http://blog.slaunchaman.com/2010/05/10/take-me-home-now-free/</link>
		<comments>http://blog.slaunchaman.com/2010/05/10/take-me-home-now-free/#comments</comments>
		<pubDate>Tue, 11 May 2010 04:12:41 +0000</pubDate>
		<dc:creator>Jeff Kelley</dc:creator>
				<category><![CDATA[My Software]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[shameless plug]]></category>
		<category><![CDATA[Take Me Home]]></category>
		<category><![CDATA[updates]]></category>

		<guid isPermaLink="false">http://blog.slaunchaman.com/?p=267</guid>
		<description><![CDATA[Take Me Home is an]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.slaunchaman.com/my-software/take-me-home/">Take Me Home</a> is an ancient, buggy iPhone app that was my &ldquo;Hello, World!&rdquo; in the App Store. Its sale rate has plummeted to only a couple of buyers a week and, with the prevalence of real, honest-to-God GPS apps in the store these days, its usefulness is questionable. So from here on out, it&#8217;s free. I can&#8217;t promise to continue supporting it&mdash;especially for new devices and APIs&mdash;so the best I can do may be to remove it from the store in the event that some update breaks it.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.slaunchaman.com/2010/05/10/take-me-home-now-free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: Don&#8217;t Do This</title>
		<link>http://blog.slaunchaman.com/2010/05/10/quick-tip-dont-do-this/</link>
		<comments>http://blog.slaunchaman.com/2010/05/10/quick-tip-dont-do-this/#comments</comments>
		<pubDate>Tue, 11 May 2010 04:01:44 +0000</pubDate>
		<dc:creator>Jeff Kelley</dc:creator>
				<category><![CDATA[Programming Tips]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[gotchas]]></category>
		<category><![CDATA[NSObject]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Objective-C Runtime]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.slaunchaman.com/?p=263</guid>
		<description><![CDATA[I could not find out]]></description>
			<content:encoded><![CDATA[<p>I could <em>not</em> find out where a bug was coming from for the life of me today. Naturally it one of those &ldquo;assignment instead of equality&rdquo; bugs that seem to crop up when trying to code too quickly. The difference here was that I had implemented a subclass of <code>NSObject</code> that reimplemented the method <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html#//apple_ref/doc/uid/20000050-SW5"><code>+resolveInstanceMethod:</code></a>. So, the code went like this:<code>
<pre>+ ( BOOL )resolveInstanceMethod:( SEL )sel
{
    if ( sel = @selector( setFoobar: )) {
        return class_addMethod([ self class ], sel, ( IMP )setFB, "v@:@" );
    } else if ( sel = @selector( foobar )) {
        return class_addMethod([ self class ], sel, ( IMP )getFB, "@@:" );
    } else {
        return [ super resolveInstanceMethod:sel ];
    }
}</pre>
<p></code><br />
For those of you keeping score at home, when the Objective-C runtime tried to resolve <em>any</em> selector, this method happily added a selector for <code>-setFoobar:</code> to <code>self</code>&rsquo;s class and returned <code>YES</code>.</p>
<p>Don&rsquo;t do this.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.slaunchaman.com/2010/05/10/quick-tip-dont-do-this/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
