<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>corprewland &#187; ogm</title>
	<link>http://www.corprew.org</link>
	<description>(dis)information organization</description>
	<pubDate>Wed, 19 Nov 2008 04:39:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>writing code on the macintosh and its derivatives</title>
		<link>http://www.corprew.org/blog/2008/03/12/writing-code-on-the-macintosh-and-its-derivatives/</link>
		<comments>http://www.corprew.org/blog/2008/03/12/writing-code-on-the-macintosh-and-its-derivatives/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 02:10:20 +0000</pubDate>
		<dc:creator>corprew</dc:creator>
		
		<category><![CDATA[computer programming]]></category>

		<category><![CDATA[CoreData]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[iphone process model]]></category>

		<category><![CDATA[macosx]]></category>

		<category><![CDATA[ManagedObjectContext]]></category>

		<category><![CDATA[objc]]></category>

		<category><![CDATA[objective c]]></category>

		<category><![CDATA[ogm]]></category>

		<category><![CDATA[orm]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.corprew.org/blog/2008/03/12/writing-code-on-the-macintosh-and-its-derivatives/</guid>
		<description><![CDATA[note that the latest revision of this blog&#8217;s theme seems to have introduced a weird bug with the code layout plugin (wp-syntax) on some browsers.  i&#8217;m looking into it.
I think the single most useful thing I&#8217;ve figured out recently in programming for MacOSX and the iPhone is this little snippet right here.

- &#40;void&#41; updateListForEntityNamed:&#40;NSString*&#41; [...]]]></description>
			<content:encoded><![CDATA[<p><b>note that the latest revision of this blog&#8217;s theme seems to have introduced a weird bug with the code layout plugin (wp-syntax) on some browsers.  i&#8217;m looking into it.</b></p>
<p>I think the single most useful thing I&#8217;ve figured out recently in programming for MacOSX and the iPhone is this little snippet right here.</p>

<div class="wp_syntax"><div class="code"><pre class="objc">- <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #002200;">&#41;</span> updateListForEntityNamed:<span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSString</span>*<span style="color: #002200;">&#41;</span> entityName andSearchString:<span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSString</span>*<span style="color: #002200;">&#41;</span> queryString
<span style="color: #002200;">&#123;</span>
<span style="color: #002200;">&#91;</span>...<span style="color: #002200;">&#93;</span>
&nbsp;
	MyDocument* current = <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSDocumentController</span> sharedDocumentController<span style="color: #002200;">&#93;</span> currentDocument<span style="color: #002200;">&#93;</span>;
	<span style="color: #0000ff;">if</span><span style="color: #002200;">&#40;</span>current &amp;&amp; current != self<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;CurrentDocument:%@ != self:%@&quot;</span>, current, self<span style="color: #002200;">&#41;</span>;
		<span style="color: #002200;">&#91;</span>current updateListForEntityNamed: entityName andSearchString: queryString<span style="color: #002200;">&#93;</span>;
		<span style="color: #0000ff;">return</span>;
	<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#91;</span>...<span style="color: #002200;">&#93;</span>
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>What this does is intercept incoming messages that are supposed to go to the current window, and redirect them to that instance.  I&#8217;ve run into issues in Leopard (MacOSX 10.5) where this is an issue.  To some extent, this is probably a misconfiguration in interface builder somewhere, but it also an issue when using CoreData, because the <code>ManagedObjectContext</code>s are particular to instances of <code>NSManagedDocument</code>, and there are issues that arise if you end up using the wrong context.</p>
<p>I am slowly becoming a great fan of CoreData, it&#8217;s a great <a href="http://developer.apple.com/macosx/coredata.html">persistence/object-graph-management layer</a>.  More on this later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.corprew.org/blog/2008/03/12/writing-code-on-the-macintosh-and-its-derivatives/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

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