<?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>Marc Charbonneau's Blog &#187; Cocoa</title>
	<atom:link href="http://blog.mbcharbonneau.com/category/cocoa/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mbcharbonneau.com</link>
	<description>Code. Cocoa. Technology.</description>
	<lastBuildDate>Mon, 06 Sep 2010 17:24:00 +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>Restart your Cocoa application using Sparkle</title>
		<link>http://blog.mbcharbonneau.com/2010/06/03/restart-your-cocoa-application-using-sparkle/</link>
		<comments>http://blog.mbcharbonneau.com/2010/06/03/restart-your-cocoa-application-using-sparkle/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 04:06:54 +0000</pubDate>
		<dc:creator>Marc Charbonneau</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Sparkle]]></category>

		<guid isPermaLink="false">http://blog.mbcharbonneau.com/?p=432</guid>
		<description><![CDATA[It&#8217;s not uncommon for an OS X application to need to restart itself in certain unavoidable situations, such as hiding the dock icon. Most of the solutions you&#8217;ll find on the Internet rely on a command line helper app that waits for the parent application to finish exiting before launching it again. Although this isn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not uncommon for an OS X application to need to restart itself in certain unavoidable situations, such as hiding the dock icon. Most of the solutions you&#8217;ll find on the Internet rely on a command line helper app that waits for the parent application to finish exiting before launching it again. Although this isn&#8217;t hard to implement yourself, chances are you already have everything you need, buried inside the <a href="http://sparkle.andymatuschak.org/">Sparkle</a> framework.</p>
<p>Based on the Sparkle source code, here&#8217;s a quick way to restart any application that includes the Sparkle framework.</p>
<pre><code>NSString *launcherSource = [[NSBundle bundleForClass:[SUUpdater class]]  pathForResource:@"relaunch" ofType:@""];
NSString *launcherTarget = [NSTemporaryDirectory() stringByAppendingPathComponent:[launcherSource lastPathComponent]];
NSString *appPath = [[NSBundle mainBundle] bundlePath];
NSString *processID = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]];

[[NSFileManager defaultManager] removeItemAtPath:launcherTarget error:NULL];
[[NSFileManager defaultManager] copyItemAtPath:launcherSource toPath:launcherTarget error:NULL];

[NSTask launchedTaskWithLaunchPath:launcherTarget arguments:[NSArray arrayWithObjects:appPath, processID, nil]];
[NSApp terminate:sender];</code></pre>
<p>If you&#8217;re not using Sparkle, here&#8217;s a <a href="http://snipplr.com/view/3923/relaunch-an-application/">complete implementation</a> of this idea you may find helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbcharbonneau.com/2010/06/03/restart-your-cocoa-application-using-sparkle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Brent Simmons on Core Data</title>
		<link>http://blog.mbcharbonneau.com/2010/02/27/brent-simmons-on-core-data/</link>
		<comments>http://blog.mbcharbonneau.com/2010/02/27/brent-simmons-on-core-data/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 14:03:53 +0000</pubDate>
		<dc:creator>Marc Charbonneau</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[persistance]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Storage]]></category>

		<guid isPermaLink="false">http://blog.mbcharbonneau.com/?p=420</guid>
		<description><![CDATA[Brent Simmons has an interesting write-up on his experience with Core Data on NetNewsWire for the iPhone: At that point, having done everything else, the remaining issue was clearly Core Data. So I tried more things, re-read everything I could about Core Data performance (for the nth time), ran experiments, spent tons more time in [...]]]></description>
			<content:encoded><![CDATA[<p>Brent Simmons has an <a href="http://inessential.com/2010/02/26/on_switching_away_from_core_data">interesting write-up</a> on his experience with Core Data on NetNewsWire for the iPhone:</p>
<blockquote><p>At that point, having done everything else, the remaining issue was clearly Core Data. So I tried more things, re-read everything I could about Core Data performance (for the nth time), ran experiments, spent tons more time in Shark. Trying to get it good. No go.</p>
<p>Finally I realized I had to switch away from Core Data and use SQLite more directly. Not completely directly — I use FMDB, a lightweight Objective-C interface that works on Macs and iPhones. Gus wrote it. It’s good.</p></blockquote>
<p>A good introductory read on the differences between Core Data and SQL storage is <a href="http://cocoawithlove.com/2010/02/differences-between-core-data-and.html">Matt Gallagher&#8217;s article</a>, which Brent also mentioned.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbcharbonneau.com/2010/02/27/brent-simmons-on-core-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snow Leopard for developers</title>
		<link>http://blog.mbcharbonneau.com/2009/08/28/snow-leopard-for-developers/</link>
		<comments>http://blog.mbcharbonneau.com/2009/08/28/snow-leopard-for-developers/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 17:33:32 +0000</pubDate>
		<dc:creator>Marc Charbonneau</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[10.6]]></category>
		<category><![CDATA[Snow Leopard]]></category>

		<guid isPermaLink="false">http://blog.mbcharbonneau.com/?p=387</guid>
		<description><![CDATA[Today is Snow Leopard day, and unlike many other developers I&#8217;ve waited to buy it in stores instead of installing an ADC development seed. This means I&#8217;ve been mostly in the dark about any API changes or new developer tools in 10.6, aside from what I&#8217;ve managed to coax out of the guys at the [...]]]></description>
			<content:encoded><![CDATA[<p>Today is Snow Leopard day, and unlike many other developers I&#8217;ve waited to buy it in stores instead of installing an ADC development seed. This means I&#8217;ve been mostly in the dark about any API changes or new developer tools in 10.6, aside from what I&#8217;ve managed to coax out of the guys at the local Syracuse CocoaHeads meetings.</p>
<p>To give myself something to do while waiting for my pre-install backup to finish, I&#8217;m going to update this post on any good articles or write-ups on what&#8217;s new in Snow Leopard for developers. If you&#8217;ve written or seen anything that I should include here, please leave a comment!</p>
<ul>
<li>Tim Wood gives <a href="http://www.cocoatoa.com/posts/2009/08/28/snow_leopard_a_bargain_at_twice_the_price/">a great roundup</a> of the major (and not so major) new developer features in Snow Leopard.</li>
<li>Andy Matuschak talks about <a href="http://blog.andymatuschak.org/post/173646741/your-new-friends-obj-c-associated-objects">associated objects</a>, which allow you to add instance variables to any class which descends from NSObject.</li>
<li>Twitter has plenty of 10.6 tips from developers today. In particular, you probably want to follow <a href="http://twitter.com/cocoadevcentral">Cocoa Dev Central</a>.</li>
<li>Mike Ash has <a href="http://www.mikeash.com/?page=pyblog/friday-qa-2009-08-28-intro-to-grand-central-dispatch-part-i-basics-and-dispatch-queues.html">a great write-up</a> on the basics of Grand Central Dispatch, one of the most exciting new features in 10.6.</li>
<li>Jesper lists some <a href="http://waffle.wootest.net/2009/08/28/hidden-developer-gems-in-snow-leopard/">hidden gems</a> in Snow Leopard.
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbcharbonneau.com/2009/08/28/snow-leopard-for-developers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Voices That Matter: iPhone Developers Conference</title>
		<link>http://blog.mbcharbonneau.com/2009/07/31/voices-that-matter-iphone-developers-conference/</link>
		<comments>http://blog.mbcharbonneau.com/2009/07/31/voices-that-matter-iphone-developers-conference/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 14:58:49 +0000</pubDate>
		<dc:creator>Marc Charbonneau</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Boston]]></category>
		<category><![CDATA[Conference]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://blog.mbcharbonneau.com/?p=369</guid>
		<description><![CDATA[I&#8217;ve recently been invited to the 2009 Voices That Matter: iPhone Developers Conference, taking place in October in Boston, MA. This conference is designed for Mac developers looking for a succinct, easy way to get up to speed on the specific skills needed to build, test and distribute successful applications for the iPhone and iPod [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been invited to the 2009 <a href="http://www.voicesthatmatter.com/">Voices That Matter: iPhone Developers Conference</a>, taking place in October in Boston, MA.</p>
<blockquote><p>
This conference is designed for Mac developers looking for a succinct, easy way to get up to speed on the specific skills needed to build, test and distribute successful applications for the iPhone and iPod touch. Erica Sadun, author of The iPhone Developer’s Cookbook and our event’s technical chair, will lead an <a href="http://iphone2009.crowdvine.com/calendar">epic group of speakers</a> at the conference including Aaron Hillegass, Andy Ihnatko, Jon Rentzsch, Steve Kochan, Fraser Speirs, Lee Barney and lots of others.</p></blockquote>
<p>Having missed out on yet another year of WWDC, I&#8217;m excited about this conference. Many of the presenters are developers I know well through Twitter and blogs, and I have a great amount of respect for their work. I&#8217;m pretty confident I&#8217;ll pick up plenty of great tips that will help in the iPhone development work I&#8217;ve been doing lately.</p>
<p>The event organizers sent me a $100 discount to post here for readers. If you&#8217;re planning on attending, register <a href="http://www.voicesthatmatter.com/iphone2009/register.aspx">here</a> and be sure to use the priority code <strong>PHBLOG</strong>. There&#8217;s an additional $200 early bird discount available before September 12th. Also, <a href="mailto:m.charbonneau@downtownsoftwarehouse.com">send me an email</a> beforehand if you&#8217;re coming and I&#8217;ll try to say hello!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbcharbonneau.com/2009/07/31/voices-that-matter-iphone-developers-conference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SearchKit Example Project</title>
		<link>http://blog.mbcharbonneau.com/2009/02/26/searchkit-example-project/</link>
		<comments>http://blog.mbcharbonneau.com/2009/02/26/searchkit-example-project/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 21:37:59 +0000</pubDate>
		<dc:creator>Marc Charbonneau</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[SearchKit]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.mbcharbonneau.com/?p=258</guid>
		<description><![CDATA[From the presentation I’m giving tonight at CocoaHeads Syracuse, here’s an example project on using the SearchKit API in your Cocoa application. Click here to download.]]></description>
			<content:encoded><![CDATA[<p>From the presentation I’m giving tonight at <a href="http://www.fruitstandsoftware.com/CocoaHeads/Welcome.html">CocoaHeads Syracuse</a>, here’s an example project on using the SearchKit API in your Cocoa application. <a href="http://www.mbcharbonneau.com/files/SearchKit.dmg">Click here</a> to download.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbcharbonneau.com/2009/02/26/searchkit-example-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BWToolkit</title>
		<link>http://blog.mbcharbonneau.com/2008/11/13/bwtoolkit/</link>
		<comments>http://blog.mbcharbonneau.com/2008/11/13/bwtoolkit/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 16:45:05 +0000</pubDate>
		<dc:creator>Marc Charbonneau</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[HUD]]></category>
		<category><![CDATA[Interface Builder]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://blog.mbcharbonneau.com/?p=293</guid>
		<description><![CDATA[BWToolkit is a new Interface Builder 3 plugin that includes some common UI widgets that are missing from AppKit, such as preference windows and styled controls for the new Leopard HUD panel. If you haven’t made your own controls for these situations yet, this is sure to save you some time. I’m looking forward to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.brandonwalkin.com/blog/2008/11/13/introducing-bwtoolkit/">BWToolkit</a> is a new Interface Builder 3 plugin that includes some common UI widgets that are missing from AppKit, such as preference windows and styled controls for the new Leopard HUD panel. If you haven’t made your own controls for these situations yet, this is sure to save you some time. I’m looking forward to seeing if this can replace some of my own custom code in <a href="http://www.downtownsoftwarehouse.com/software/RunnersLog/">Runner’s Log</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbcharbonneau.com/2008/11/13/bwtoolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better logging in Objective-C</title>
		<link>http://blog.mbcharbonneau.com/2008/10/27/better-logging-in-objective-c/</link>
		<comments>http://blog.mbcharbonneau.com/2008/10/27/better-logging-in-objective-c/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 21:19:33 +0000</pubDate>
		<dc:creator>Marc Charbonneau</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Logging]]></category>

		<guid isPermaLink="false">http://blog.mbcharbonneau.com/?p=245</guid>
		<description><![CDATA[If you’re an experienced Objective-C developer, chances are you’ve at least heard of spicing up your log statements with __FILE__ and __LINE__. Here’s one method I wrote last night that includes variable arguments similar to NSLog(). To use it, just stick this line in your prefix header file: #define DebugLog( s, ... ) NSLog( @"&#60;%p [...]]]></description>
			<content:encoded><![CDATA[<p>If you’re an experienced Objective-C developer, chances are you’ve at least heard of spicing up your log statements with __FILE__ and __LINE__. Here’s one method I wrote last night that includes variable arguments similar to NSLog(). To use it, just stick this line in your prefix header file:</p>
<pre><code> #define DebugLog( s, ... ) NSLog( @"&lt;%p %@:(%d)&gt; %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )</code></pre>
<p>The great thing about the preprocessor #define is that you can build all sorts of things into the DebugLog() function. For example, you could set it up so that the code is only included when you define a variable like BETA_VERSION in your code, or you could send the message to a custom logging class that writes to your own log file or database.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbcharbonneau.com/2008/10/27/better-logging-in-objective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>self = [super init]</title>
		<link>http://blog.mbcharbonneau.com/2008/10/27/self-super-init/</link>
		<comments>http://blog.mbcharbonneau.com/2008/10/27/self-super-init/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 20:41:34 +0000</pubDate>
		<dc:creator>Marc Charbonneau</dc:creator>
				<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://blog.mbcharbonneau.com/?p=239</guid>
		<description><![CDATA[Mike Ash on Cocoa Initializers. Great explanation of why you should use the debated self = [super init] in your Objective-C initializers. For the other side of the argument, read Wil Shipley’s take.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mikeash.com/?page=pyblog/the-how-and-why-of-cocoa-initializers.html">Mike Ash on Cocoa Initializers</a>. Great explanation of why you should use the debated <code>self = [super init]</code> in your Objective-C initializers. For the other side of the argument, read <a href="http://www.wilshipley.com/blog/2005/07/self-stupid-init.html">Wil Shipley’s take</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbcharbonneau.com/2008/10/27/self-super-init/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cocoa KVO tricks: binding to an array of arrays</title>
		<link>http://blog.mbcharbonneau.com/2008/05/13/cocoa-kvo-tricks-binding-to-an-array-of-arrays/</link>
		<comments>http://blog.mbcharbonneau.com/2008/05/13/cocoa-kvo-tricks-binding-to-an-array-of-arrays/#comments</comments>
		<pubDate>Tue, 13 May 2008 14:36:33 +0000</pubDate>
		<dc:creator>Marc Charbonneau</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Bindings]]></category>
		<category><![CDATA[KVO]]></category>

		<guid isPermaLink="false">http://blog.downtownsoftwarehouse.com/?p=208</guid>
		<description><![CDATA[Earlier this week I was working on a project where I wanted to filter a table view based on tags. The data model I was working with was very simple. My table view was bound to an array of objects through an NSArrayController, and each object had it&#8217;s own array of NSStrings which represented tags. [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this week I was working on a project where I wanted to filter a table view based on tags. The data model I was working with was very simple. My table view was bound to an array of objects through an NSArrayController, and each object had it&#8217;s own array of NSStrings which represented tags. My goal was to create a filter bar control, which I could bind to the array controller in order to popular the list of tags. The filter bar would display each unique tag once, and update itself when objects were added or removed, or an object&#8217;s tag array changed.</p>
<p>At first this seemed somewhat complicated. Implementing key value observing is easy, but I would have to observe both the array of objects and also each object&#8217;s individual tag array. Handling insertions, removals, and replacements adds to the complexity of the code I needed to write, all in order to solve what should be a simple problem. When I stopped to think about it, I went back to the documentation and found there was a much, much easier way of dealing with this situation:</p>
<pre><code>[filterBar bind:@"tags"
	toObject:arrayController
	withKeyPath:@"arrangedObjects.@distinctUnionOfArrays.tags"
	options:nil];
</code></pre>
<p>One last thing; in my case I actually had to use two array controllers, one for the filter bar, and another for the table view. Since I was using the filter bar to create an NSPredicate for the table view&#8217;s array controller, if I bound both UI objects to that same array controller I would be removing tags from the filter bar after I applied the predicate! To avoid this, just create two array controllers and bind them both to the same NSMutableArray (just setting the content outlet won&#8217;t work).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbcharbonneau.com/2008/05/13/cocoa-kvo-tricks-binding-to-an-array-of-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bit fields and BOOL</title>
		<link>http://blog.mbcharbonneau.com/2007/10/02/bit-fields-and-bool/</link>
		<comments>http://blog.mbcharbonneau.com/2007/10/02/bit-fields-and-bool/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 15:41:00 +0000</pubDate>
		<dc:creator>Marc Charbonneau</dc:creator>
				<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://blog.downtownsoftwarehouse.com/2007/10/02/bit-fields-and-bool/</guid>
		<description><![CDATA[From Lap Cat Software Blog: A char type &#8211; e.g., char, signed char, unsigned char &#8211; is always one byte, i.e., sizeof(signed char) == 1, whereas in most implementations an int type is more than one byte. A byte standardly consists of 8 bits, or 12 nibbles. What happens to the extra bits if you [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://lapcatsoftware.com/blog/2007/09/30/booling-for-dollars/">Lap Cat Software Blog</a>:</p>
<blockquote><p>A char type &#8211; e.g., char, signed char, unsigned char &#8211; is always one byte, i.e., sizeof(signed char) == 1, whereas in most implementations an int type is more than one byte. A byte standardly consists of 8 bits, or 12 nibbles. What happens to the extra bits if you convert an int into a BOOL? According to the wacky rules of C type conversion, the result is implementation-dependent. Many implementations simply throw away the highest bits. (Other implementations recycle them into information superhighway speed bumps.) As a consequence, it’s possible that myIntVar != 0 &#038;&#038; (BOOL)myIntVar == NO.</p>
<p>Usually we don’t have to worry about this, because ‘boolean’ operators in C, such as == and !, always return 1 or 0. When we use bitwise operators, on the other hand, the problem does come into play. Suppose, for example, that we’re testing whether the option key is down. The method -[NSEvent modifierFlags] returns a bit field indicating the modifier keys that are pressed, and bit masks can be used to test for specific keys.</p></blockquote>
<p>This is good stuff to know when you&#8217;re working with keyboard input in Cocoa.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mbcharbonneau.com/2007/10/02/bit-fields-and-bool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
