<?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>corprewland &#187; orm</title>
	<atom:link href="http://www.corprew.org/blog/tag/orm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.corprew.org</link>
	<description>(dis)information organization</description>
	<lastBuildDate>Thu, 04 Feb 2010 20:48:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<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; [...]]]></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" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> updateListForEntityNamed<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> entityName andSearchString<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</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<span style="color: #002200;">*</span> current <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDocumentController</span> sharedDocumentController<span style="color: #002200;">&#93;</span> currentDocument<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>current <span style="color: #002200;">&amp;&amp;</span> current <span style="color: #002200;">!=</span> self<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;CurrentDocument:%@ != self:%@&quot;</span>, current, self<span style="color: #002200;">&#41;</span>;
		<span style="color: #002200;">&#91;</span>current updateListForEntityNamed<span style="color: #002200;">:</span> entityName andSearchString<span style="color: #002200;">:</span> queryString<span style="color: #002200;">&#93;</span>;
		<span style="color: #a61390;">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>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
