<?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>Software Warlock &#187; Cocoa</title>
	<atom:link href="http://softwareblog.morlok.net/category/cocoa/feed/" rel="self" type="application/rss+xml" />
	<link>http://softwareblog.morlok.net</link>
	<description></description>
	<lastBuildDate>Sat, 24 Dec 2011 16:06:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>TTStyledText problems with ampersand (&#8216;&amp;&#8217;)</title>
		<link>http://softwareblog.morlok.net/2010/04/25/ttstyledtext-problems-with-ampersand/</link>
		<comments>http://softwareblog.morlok.net/2010/04/25/ttstyledtext-problems-with-ampersand/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 18:50:34 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=338</guid>
		<description><![CDATA[I ran across an interesting problem today where I was trying to use TTStyledText from the Three20 project to create a TTStyledTextLabel that had text with links nested within it. I was trying to Map here. I was doing this &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2010/04/25/ttstyledtext-problems-with-ampersand/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I ran across an interesting problem today where I was trying to use TTStyledText from the <a href="http://github.com/facebook/three20">Three20</a> project to create a TTStyledTextLabel that had text with links nested within it.  I was trying to</p>
<p>Map <a href="http://maps.google.com/maps?f=q&#038;hl=en&#038;geocode=&#038;time=&#038;date=&#038;ttype=&#038;q=1850+N.+White+Bear+Ave+Maplewood+MN+55109&#038;sll=37.0625,-95.677068&#038;sspn=44.60973,72.509766&#038;ie=UTF8&#038;ll=44.996854,-93.025103&#038;spn=0.039087,0.07081&#038;z=14&#038;om=1">here</a>.</p>
<p>I was doing this with the following (simplified code):</p>
<pre name="code" class="objc">
[TTStyledText textFromXHTML:@"Map &lt;a href=\"http://www.google.com/maps?f=q&#038;hl=en\">here&lt;/a>." lineBreaks:YES URLs:YES];
</pre>
<p>As soon as I tried to put a URL in that had multiple URL parameters (and thus an &amp;) things would disappear.</p>
<p>From briefly looking at the Three20 source code, I believe this because the parsing of the XHTML text is being done with an XML parser.  As soon as I replaced the &amp;s with &amp;amp;s things started to work.  This can be done using the following code:</p>
<pre name="code" class="objc">
[@"Map &lt;a href=\"http://www.google.com/maps?f=q&#038;hl=en\">here&lt;/a>." stringByReplacingOccurrencesOfString:@"&#038;" withString:@"&amp;amp;"];
</pre>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2010/04/25/ttstyledtext-problems-with-ampersand/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cocoa/UIKit BulbView</title>
		<link>http://softwareblog.morlok.net/2009/06/18/cocoauikit-bulbview/</link>
		<comments>http://softwareblog.morlok.net/2009/06/18/cocoauikit-bulbview/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 05:35:56 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[CoreGraphics]]></category>
		<category><![CDATA[Quartz 2D]]></category>
		<category><![CDATA[scoreboard]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=281</guid>
		<description><![CDATA[In my continuing saga to bring old-school displays to new-school (word?) devices, I&#8217;ve created a &#8220;bulb view&#8221; that displays characters in a grid of &#8220;lights&#8221;. The best way to describe it is probably just to see it: Like previous LCD &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/06/18/cocoauikit-bulbview/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://softwareblog.morlok.net/2009/05/25/cocoa-lcd-screen-view/">continuing saga</a> to bring old-school displays to new-school (word?) devices, I&#8217;ve created a &#8220;bulb view&#8221; that displays characters in a grid of &#8220;lights&#8221;.  The best way to describe it is probably just to see it:</p>
<div id="attachment_284" class="wp-caption aligncenter" style="width: 310px"><a href="http://softwareblog.morlok.net/wp-content/uploads/2009/06/picture-3.png"><img src="http://softwareblog.morlok.net/wp-content/uploads/2009/06/picture-3-300x64.png" alt="BulbView from Mac" title="BulbView from Mac" width="300" height="64" class="size-medium wp-image-284" /></a><p class="wp-caption-text">BulbView from Mac</p></div>
<div id="attachment_283" class="wp-caption aligncenter" style="width: 310px"><a href="http://softwareblog.morlok.net/wp-content/uploads/2009/06/picture-4.png"><img src="http://softwareblog.morlok.net/wp-content/uploads/2009/06/picture-4-300x161.png" alt="BulbView on iPhone" title="BulbView on iPhone" width="300" height="161" class="size-medium wp-image-283" /></a><p class="wp-caption-text">BulbView on iPhone</p></div>
<p>Like previous <a href="http://softwareblog.morlok.net/2009/05/25/cocoa-lcd-screen-view/">LCD view</a> you can set the colors for the lit &amp; dim bulbs, but improved from the LCD view, you can use letters, numbers, and most punctuation/special characters.  Again the rendering is done in pure Quartz2D.</p>
<p>The source, including demo apps for both the Mac and iPhone, can be found <a href="http://github.com/rmorlok/BulbView/tree">here</a>. With this view I was smart and made it conditionally compile various parts so that it can be used on either the iPhone or the Mac, without needing separate files.</p>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/06/18/cocoauikit-bulbview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Conditional Compilation for iPhone</title>
		<link>http://softwareblog.morlok.net/2009/06/17/conditional-compilation-for-iphone/</link>
		<comments>http://softwareblog.morlok.net/2009/06/17/conditional-compilation-for-iphone/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 04:31:52 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[conditional compilation]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=278</guid>
		<description><![CDATA[I&#8217;m working on a view right now that I want to be able to cross compile as either an NSView for the Mac, or a UIVIew for the iPhone. I originally wrote it for Leopard, but now I&#8217;m trying to &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/06/17/conditional-compilation-for-iphone/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a view right now that I want to be able to cross compile as either an NSView for the Mac, or a UIVIew for the iPhone.  I originally wrote it for Leopard, but now I&#8217;m trying to add the precompiler directives to let it cross compile between the two platforms.  A quick Google search didn&#8217;t reveal anything, here are the possible definitions you can use:</p>
<pre name="code" class="c">
#define __MAC_10_0      1000
#define __MAC_10_1      1010
#define __MAC_10_2      1020
#define __MAC_10_3      1030
#define __MAC_10_4      1040
#define __MAC_10_5      1050
#define __MAC_10_6      1060
#define __MAC_NA        9999   /* not available */

#define __IPHONE_2_0     20000
#define __IPHONE_2_1     20100
#define __IPHONE_2_2     20200
#define __IPHONE_3_0     30000
#define __IPHONE_NA      99999  /* not available */
</pre>
<p>This definition comes from Availability.h located at <tt>/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/Availability.h</tt> (for the iPhone 3.0 SDK).</p>
<p>Obviously, the <tt>__MAC_10_x</tt> is actually for the version of OSX, and the <tt>__IPHONE_x_x</tt> is for iPhone.</p>
<p>So, if you wanted to have code conditionally compile for the iPhone (assuming 3.0 SDK) you would do something like the following:</p>
<pre name="code" class="c">
#ifdef __IPHONE_3_0
    // iPhone
    #import &lt;UIKit/UIKit.h&gt;
#else
    // Mac
    #import &lt;Cocoa/Cocoa.h&gt;
#endif
</pre>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/06/17/conditional-compilation-for-iphone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CGColorCreateGenericRGB Error on iPhone SDK 3.0</title>
		<link>http://softwareblog.morlok.net/2009/05/26/cgcolorcreategenericrgb-error-on-iphone-sdk-30/</link>
		<comments>http://softwareblog.morlok.net/2009/05/26/cgcolorcreategenericrgb-error-on-iphone-sdk-30/#comments</comments>
		<pubDate>Wed, 27 May 2009 04:21:28 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Core Graphics]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Quartz 2D]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=248</guid>
		<description><![CDATA[While porting some Core Graphics/Quartz 2D code from the Mac to the iPhone, I ran across the following error: error: 'CGColorCreateGenericRGB' is unavailable (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColor.h:31) Looking in the header file in question (CGColor.h), I found the following: /* Create &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/05/26/cgcolorcreategenericrgb-error-on-iphone-sdk-30/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>While porting some Core Graphics/Quartz 2D code from the Mac to the iPhone, I ran across the following error:</p>
<p><tt style="color: red;">error: 'CGColorCreateGenericRGB' is unavailable (declared at<br /> <br />
<span style="font-size: 50%">/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColor.h:31)</tt></p>
<p>Looking in the header file in question (<tt>CGColor.h</tt>), I found the following:</p>
<p><tt>/* Create a color in the "Generic" RGB color space. */</p>
<p>CG_EXTERN CGColorRef CGColorCreateGenericRGB(CGFloat red, CGFloat green,<br />
&nbsp;&nbsp;&nbsp;&nbsp;CGFloat blue, CGFloat alpha)<br />
&nbsp;&nbsp;&nbsp;&nbsp;CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);<br /></tt></p>
<p>So the header file pretty much confirms what the error says; the function is not available on the iPhone.</tt></p>
<p>After a little bit of looking through documentation, you just have to specify the color space manually and then give the components to the color.  So the this:</p>
<p style="color: red"><tt>CGColorCreateGenericRGB(0.90625, 0.80, 0.80, 1.0)</tt></p>
<p>would become</p>
<p style="color: green"><tt><br />
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();<br />
const CGFloat myColor[] = {0.90625, 0.80, 0.80, 1.0};<br />
CGColorCreate(rgb, myColor);<br />
CGColorSpaceRelease(rgb);<br />
</tt></p>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/05/26/cgcolorcreategenericrgb-error-on-iphone-sdk-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cocoa LCD Screen View</title>
		<link>http://softwareblog.morlok.net/2009/05/25/cocoa-lcd-screen-view/</link>
		<comments>http://softwareblog.morlok.net/2009/05/25/cocoa-lcd-screen-view/#comments</comments>
		<pubDate>Tue, 26 May 2009 00:57:14 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Core Graphics]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Quartz 2D]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=242</guid>
		<description><![CDATA[As part of an iPhone application I&#8217;m developing, I need a view that will display numbers/times in a way that will look like an old liquid crystal display calculator. I looked around at using various fonts to cover the same &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/05/25/cocoa-lcd-screen-view/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>
As part of an iPhone application I&#8217;m developing, I need a view that will display numbers/times in a way that will look like an old liquid crystal display calculator.  I looked around at using various fonts to cover the same effect, but I wanted the look where you could slightly see the non-lit components of the display.  As such, I delved into the mystical world of Quartz 2D.
</p>
<div id="attachment_243" class="wp-caption aligncenter" style="width: 310px"><a href="http://softwareblog.morlok.net/wp-content/uploads/2009/05/picture-3.png"><img src="http://softwareblog.morlok.net/wp-content/uploads/2009/05/picture-3-300x105.png" alt="Example of the LCD view showing the current time." title="Screenshot of LCD View" width="300" height="105" class="size-medium wp-image-243" /></a><p class="wp-caption-text">Example of the LCD view showing the current time.</p></div>
<p><tt>MTILcdView</tt> allows you to set three parameters: the color for the &#8220;lit&#8221; crystals, the color for the &#8220;dim&#8221; crystals, and the text to be displayed.   The view currently only supports displaying numbers plus the colon (&#8220;:&#8221;) per my needs, but it could easily be extended to display letters as well.  The view decides the size of the digits to be displayed based on the height of the view, so for a given height you must adjust the width of the view to allow the needed number of characters to be displayed.</p>
<p>The source code for the Mac is available here: <a href="http://softwareblog.morlok.net/wp-content/uploads/2009/05/mtilcdview.h">MTILcdView.h</a>, <a href="http://softwareblog.morlok.net/wp-content/uploads/2009/05/mtilcdview.m">MTILcdView.m</a>.  A complete demo application using the view can be retrieved from GitHub <a href="https://github.com/rmorlok/LcdScreen/tree">here</a>.</p>
<div id="attachment_259" class="wp-caption aligncenter" style="width: 310px"><a href="http://softwareblog.morlok.net/wp-content/uploads/2009/05/picture-1.png"><img src="http://softwareblog.morlok.net/wp-content/uploads/2009/05/picture-1-300x161.png" alt="MTILcdView running on iPhone" title="iPhone LCD View" width="300" height="161" class="size-medium wp-image-259" /></a><p class="wp-caption-text">MTILcdView running on iPhone</p></div>
<p>The source code for the iPhone 3.0 SDK is available here: <a href="http://softwareblog.morlok.net/wp-content/uploads/2009/05/mtilcdview1.h">MTILcdView.h</a>, <a href="http://softwareblog.morlok.net/wp-content/uploads/2009/05/mtilcdview1.m">MTILcdView.m</a> (note that you must manually rename the files from MTILcdView1.{h|m} to MTILcdView.{h|m}).  A complete demo application using the view can be retrieved from GitHub <a href="https://github.com/rmorlok/LcdiPhone/tree">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/05/25/cocoa-lcd-screen-view/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>UIButton Title Text Does Not Display</title>
		<link>http://softwareblog.morlok.net/2009/05/14/uibutton-title-text-does-not-display/</link>
		<comments>http://softwareblog.morlok.net/2009/05/14/uibutton-title-text-does-not-display/#comments</comments>
		<pubDate>Thu, 14 May 2009 05:45:50 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[UIButton]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=214</guid>
		<description><![CDATA[Ran into a minor problem today when I was attempting to manually create a UIButton in my iPhone app. I attempted to create/configure the button through code similar to the following: CGRect frame = CGRectMake(0, 0, 200, 52); UIButton b &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/05/14/uibutton-title-text-does-not-display/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>
Ran into a minor problem today when I was attempting to manually create a <tt>UIButton</tt> in my iPhone app.  I attempted to create/configure the button through code similar to the following:
</p>
<p><tt><br />
CGRect frame = CGRectMake(0, 0, 200, 52);<br />
UIButton b = [[UIButton alloc] initWithFrame:frame];<br />
<span style="color: red">b.titleLabel.text = @"My Button";<br />
b.titleLabel.textColor = [UIColor whiteColor];</span><br />
b.backgroundColor = [UIColor clearColor];<br />
</tt></p>
<p>
The key mistake is highlighted in red.  I attempted to manually set the text an color of the <tt>UIButton</tt>&#8216;s label, when in fact the <tt>UIButton</tt> would automatically reconfigure the label (including it&#8217;s text) in response to state changes.
</p>
<p>
The correct approach is to use send the <tt>setXXX:forState:</tt> messages to the <tt>UIButton</tt> object itself.  For example, the following code sets the text/color for the <tt>UIControlStateNormal</tt> state.
</p>
<p><tt style="color: green;"><br />
[b setTitle:@"Test" forState:UIControlStateNormal];<br />
[b setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];<br />
</tt></p>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/05/14/uibutton-title-text-does-not-display/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>CoreData Development Techniques</title>
		<link>http://softwareblog.morlok.net/2009/04/01/coredata-development-techniques/</link>
		<comments>http://softwareblog.morlok.net/2009/04/01/coredata-development-techniques/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 03:58:08 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Software Development Tools]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[CoreData]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=145</guid>
		<description><![CDATA[I&#8217;m just getting started with CoreData, and I&#8217;ve been excited about about its nice graphical environment to define your model. CoreData&#8217;s approach to ORM is somewhat different than other tools, such as Hibernate, because it takes advantage of Objective-C&#8217;s dynamic &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/04/01/coredata-development-techniques/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;m just getting started with CoreData, and I&#8217;ve been excited about about its nice graphical environment to define your model.
</p>
<p><a href="http://softwareblog.morlok.net/wp-content/uploads/2009/04/coredata-model.png"><img src="http://softwareblog.morlok.net/wp-content/uploads/2009/04/coredata-model-300x225.png" alt="" title="CoreData model" width="300" height="225" class="aligncenter size-medium wp-image-147" /></a></p>
<p>
CoreData&#8217;s approach to ORM is somewhat different than other tools, such as <a href="http://www.hibernate.org/">Hibernate</a>, because it takes advantage of Objective-C&#8217;s dynamic nature, and avoids some of the clutter problems you experience with more statically typed languages.  Instead of providing mapping information for classes that are defined elsewhere, all modeled objects are instances of <a href="http://developer.apple.com/documentation/Cocoa/Reference/CoreDataFramework/Classes/NSManagedObject_Class/index.html">NSManagedObject</a> and the system customizes the accessors on the created objects based on the schema.
</p>
<p>
This is very nice when you are defining your model, and when you can use things like Cocoa Bindings to provide much of the system&#8217;s behavior based on state of the model, but when you need to start writing custom controller logic, it isn&#8217;t very readable to have everything going around as an NSManagedObject.  You can use the dynamically generated properties on these objects, but you will get compiler warnings.  Annoying.
</p>
<p>
You can certainly subclass NSManagedObject and tell the model to use your implementation.  This is necessarily if you are going to provide custom behavior on the model objects above the simple data oriented behavior CoreData provides for you.  Xcode will even <a href="http://developer.apple.com/DOCUMENTATION/DeveloperTools/Conceptual/XcodeCoreDataTools/Articles/xcdCodeGeneration.html#//apple_ref/doc/uid/TP40006872-SW1">generate source code</a> for you from your data model.
</p>
<p>While in the data model editor, do <em>File</em>, <em>New File&#8230;</em> and select <em>Managed Object Class</em> from the <em>Cocoa</em> category.</p>
<p><a href="http://softwareblog.morlok.net/wp-content/uploads/2009/04/picture-1.png"><img src="http://softwareblog.morlok.net/wp-content/uploads/2009/04/picture-1-300x283.png" alt="" title="select Managed Object Class" width="300" height="283" class="aligncenter size-medium wp-image-159" /></a></p>
<p>Choose the location where your files will be generated.</p>
<p>Select the model entities for which classes will be generated and click <em>Finish</em>.</p>
<p><a href="http://softwareblog.morlok.net/wp-content/uploads/2009/04/picture-2.png"><img src="http://softwareblog.morlok.net/wp-content/uploads/2009/04/picture-2-300x283.png" alt="" title="Select entities to generate" width="300" height="283" class="aligncenter size-medium wp-image-160" /></a></p>
<p>
The problem with this approach is that you are stuck manually keeping the model and the custom classes in sync.  You can certainly regenerate, but if you have made any changes to the files, they will be overwritten.
</p>
<p>One alternative to this manual update process is a tool, <a href="http://rentzsch.com/code/mogenerator">mogenerator</a>, that will automatically generate custom classes for you.  It even goes so far as two generate two classes for each model object:<br /> NSManagedObject&nbsp;<&mdash;&nbsp;GenClassA&nbsp;<&mdash;&nbsp;GenClassB (where <&mdash; represents inherits from).  This allows you to modify the code in GenClassB and leave GenClassA alone, which stores the core information from the model.  This way you can regenerate GenClassA as needed, without overwriting your custom behavior in GenClassB.  <a href="http://www.pyrusmalus.com/index.html">PyrusMalus</a> has an <a href="http://www.pyrusmalus.com/blog/archives/2006/11/06/getting_started_with_mogenerator.html">introduction</a> on how to get started with mogenerator, <a href="http://importantshock.wordpress.com/">Important Shock</a> has a discussion about the <a href="http://importantshock.wordpress.com/2006/12/19/mogenerator-or-how-i-nearly-abandoned-core-data/">approach used</a> by the tool, and <a href="http://guelich.net/blog/">Cocoa &amp; Medicine</a> has a <a href="http://guelich.net/blog/2007/01/01/running-mogenerator-from-xcode">description</a> of how to run mogerator from within Xcode using Apple Script.
</p>
<p>
There is some dissension about if the method of generating custom classes is a good thing.  On <a href="http://www.cocoabuilder.com/archive/message/cocoa/2008/10/5/219503">this thread</a> on <a href="http://www.cocoabuilder.com/">CocoaBuilder</a> Ben (who appears to be from Apple according to <a href="http://www.linkedin.com/profile?viewProfile=&#038;key=852945&#038;authToken=EW78&#038;authType=NAME_SEARCH&#038;pvs=ps">LinkedIn</a>) seems to be against the idea, though I his main objection is to the idea that the custom accessors generated by NSManagedObject are slower than those statically generated by mogenerator.
</p>
<p>
One of Apples <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdAccessorMethods.html#//apple_ref/doc/uid/TP40002154">recommended approaches</a> to avoid compiler warnings is to created categories for NSManagedObject so that the compiler accepts that the accessors you are using are actually there.  Xcode provides the ability to copy the attribute declarations for use in these categories (or in custom classes), but to cover everything, you need to copy two separate sets of declarations and paste them into the code.  You could use the Xcode custom class generation to get the signatures you need, but there is a still a bit of manual work in the process.
</p>
<p>
In my opinion, Apple needs to work more to help developers with this problem.  I like the approach taken by mogenerator, and I would like to see that same regenerative ability in the built-in Xcode tools, using the 2-class generation-gap design pattern to allow you to make changes to the generated classes without having the changes overwritten next time you re-generate.</p>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/04/01/coredata-development-techniques/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twin Cities User Groups</title>
		<link>http://softwareblog.morlok.net/2009/03/12/twin-cities-user-groups/</link>
		<comments>http://softwareblog.morlok.net/2009/03/12/twin-cities-user-groups/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 03:50:51 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Programming User Groups]]></category>
		<category><![CDATA[Twin Cities]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=89</guid>
		<description><![CDATA[#UserGroupTable { border-spacing: 0; } #UserGroupTable thead { font-weight: bold; background-color: #787878; color: white; text-align: center; } #UserGroupTable tr.Alternate { background-color: #ccc; } #UserGroupTable td { padding: 2px; } This post is going to serve as a bookmark page for &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/03/12/twin-cities-user-groups/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#UserGroupTable {
  border-spacing: 0;
}
#UserGroupTable thead {
  font-weight: bold;
  background-color: #787878;
  color: white;
  text-align: center;
}
#UserGroupTable tr.Alternate {
  background-color: #ccc;
}
#UserGroupTable td {
  padding: 2px;
}
</style>
<p>
This post is going to serve as a bookmark page for me for all the software development user groups in the Twin Cities area.  Please feel free to post links to other groups in the comments and I&#8217;ll try to keep this list up-to-date.
</p>
<table id="UserGroupTable">
<thead>
<tr>
<td>Group/Link</td>
<td>Topics</td>
<td>Meet Schedule</td>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://www.cocoaheadsmn.org/">Cocoaheads</a></td>
<td>Objective-C/Cocoa/Mac</td>
<td>2nd&nbsp;Thursday&nbsp;per&nbsp;Month<br />6 p.m.</td>
</tr>
<tr class="Alternate">
<td><a href="http://www.twincitiesdevelopersguild.com/">Developers Guild</a></td>
<td>.NET</td>
<td><em>irregular</em></td>
</tr>
<tr>
<td><a href="http://www.twincitieslanguagesusergroup.com/TCLUG/Default.aspx">Languages Group</a></td>
<td>Languages/Compilers/Lexing/Parsing</td>
<td>2nd&nbsp;Thursday&nbsp;per&nbsp;Month<br />5:30 p.m.</td>
</tr>
<tr class="Alternate">
<td><a href="http://www.ilmservice.com/silverlight/">Silverlight Users Group</a></td>
<td>.NET/Silverlight/WPF</td>
<td><em>irregular</em></td>
</tr>
<tr>
<td><a href="http://www.ilmservice.com/twincitiesnet/">.NET Users Group</a></td>
<td>.NET</td>
<td><em>irregular</em></td>
</tr>
<tr class="Alternate">
<td><a href="http://www.intertech.com/UserGroups/JavaUserGroup.aspx">Java Users Group</a></td>
<td>Java</td>
<td><em>irregular</em></td>
</tr>
<tr>
<td><a href="http://tczpug.org/">Zope/Python Users Group</a></td>
<td>Python</td>
<td><em>inactive</em></td>
</tr>
<tr class="Alternate">
<td><a href="http://www.twincitiesxnausergroup.com/">XNA User Group</a></td>
<td>XNA</td>
<td>3rd Thursday per Month<br />6 p.m.</td>
</tr>
<tr>
<td><a href="http://ruby.mn/">Ruby Users of Minnesota</a></td>
<td>Ruby</td>
<td>Last Monday per Month<br/>7 p.m.</td>
</tr>
<tr>
<td><a href="http://tclispers.org/">TC Lispers</a></td>
<td>Lisp</td>
<td>irregular</td>
</tr>
</tbody>
</table>
<p><em>Note to site owners: RSS is nice so it&#8217;s easy to receive updates about upcoming events.</em></p>
<p><b>UPDATE:</b> <a href="http://centralstandardtech.com/">Central Standard Tech</a> is the definitive reference for technical user groups in the Twin Cities metro area. Thanks @<a href="http://twitter.com/HamletDRC">HamletDRC</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/03/12/twin-cities-user-groups/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Xcode Keyboard Shortcuts</title>
		<link>http://softwareblog.morlok.net/2009/01/28/xcode-keyboard-shortcuts/</link>
		<comments>http://softwareblog.morlok.net/2009/01/28/xcode-keyboard-shortcuts/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 04:19:11 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=72</guid>
		<description><![CDATA[Right now I&#8217;m working on becoming efficient at using Xcode. I&#8217;m sure it will take me a while to get really fast in it, but for now I figured I&#8217;d better start collecting useful resources. Here is a good list &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/01/28/xcode-keyboard-shortcuts/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Right now I&#8217;m working on becoming efficient at using Xcode.  I&#8217;m sure it will take me a while to get really fast in it, but for now I figured I&#8217;d better start collecting useful resources.</p>
<p><a href="http://www.1729.us/xcode/Xcode%20Shortcuts.png">Here</a> is a good list of keyboard shortcuts for Xcode via <a href="http://cocoasamurai.blogspot.com/2008/02/complete-xcode-keyboard-shortcut-list.html">this</a> site. <b>Update:</b> the Pages file from which the PNG was generated is available <a href="http://cocoasamurai.blogspot.com/2008/08/xcode-shortcuts-original-documents-now.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/01/28/xcode-keyboard-shortcuts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cocoa Date Formats</title>
		<link>http://softwareblog.morlok.net/2009/01/01/cocoa-date-formats/</link>
		<comments>http://softwareblog.morlok.net/2009/01/01/cocoa-date-formats/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 18:28:55 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[date formatting]]></category>
		<category><![CDATA[NSCalendarDate]]></category>
		<category><![CDATA[NSDate]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=56</guid>
		<description><![CDATA[.graybox { border-top: 1px solid #919699; border-left: 1px solid #919699; } .graybox th { padding: 4px 8px 4px 8px; background: #E2E2E2; font-size: 12px; border-bottom: 1px solid #919699; border-right: 1px solid #919699; } .graybox th p { font-weight: bold; margin-bottom: 0px; &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/01/01/cocoa-date-formats/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
.graybox {
	border-top: 1px solid #919699;
	border-left: 1px solid #919699;
	}</p>
<p>.graybox th {
	padding: 4px 8px 4px 8px;
	background: #E2E2E2;
	font-size: 12px;
	border-bottom: 1px solid #919699;
	border-right: 1px solid #919699;
	}
.graybox th p {
	font-weight: bold;
	margin-bottom: 0px; 
	}</p>
<p>.graybox td {
	padding: 8px;
	font-size: 12px;
	vertical-align: top;
	border-bottom: 1px solid #919699;
	border-right: 1px solid #919699;
	}
.graybox td p {
	margin-bottom: 0px; 
	}
.graybox td p + p  {
	margin-top: 5px; 
	}
.graybox td p + p + p {
	margin-top: 5px; 
	}
</style>
<p>I&#8217;m posting this here mostly for quick personal reference.  Below is the date format strings used by <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendarDate_Class/Reference/Reference.html">NSCalendarDate</a> this information was taken from <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/DatesAndTimes/Articles/dtDatesToStrings.html#//apple_ref/doc/uid/20000187-BBCIECEH">here</a>.</p>
<table class="graybox" border = "0" cellspacing="0" cellpadding="5">
<tr>
<th scope="col" align="left" style="font-weight: bold" bgcolor="#CCCCCC">
<p>Conversion Specifier</p>
</th>
<th scope="col" align="left" style="font-weight: bold" bgcolor="#CCCCCC">
<p>Description</p>
</th>
</tr>
<tr>
<td  scope="row">
<p>%%</p>
</td>
<td >
<p>a &#8216;%&#8217; character</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%a</p>
</td>
<td >
<p>abbreviated weekday name</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%A</p>
</td>
<td >
<p>full weekday name</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%b</p>
</td>
<td >
<p>abbreviated month name</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%B</p>
</td>
<td >
<p>full month name</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%c</p>
</td>
<td >
<p>shorthand for %X %x, the locale format for date and time</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%d</p>
</td>
<td >
<p>day of the month as a decimal number (01-31) </p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%e</p>
</td>
<td >
<p>same as %d but does not print the leading 0 for days 1 through 9</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%F</p>
</td>
<td >
<p>milliseconds as a decimal number (000-999)</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%H</p>
</td>
<td >
<p>hour based on a 24-hour clock as a decimal number (00-23) </p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%I</p>
</td>
<td >
<p>hour based on a 12-hour clock as a decimal number (01-12)</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%j</p>
</td>
<td >
<p>day of the year as a decimal number (001-366) </p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%m</p>
</td>
<td >
<p>month as a decimal number (01-12) </p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%M</p>
</td>
<td >
<p>minute as a decimal number (00-59) </p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%p</p>
</td>
<td >
<p>AM/PM designation for the locale</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%S</p>
</td>
<td >
<p>second as a decimal number (00-59) </p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%w</p>
</td>
<td >
<p>weekday as a decimal number (0-6), where Sunday is 0</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%x</p>
</td>
<td >
<p>date using the date representation for the locale</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%X</p>
</td>
<td >
<p>time using the time representation for the locale</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%y</p>
</td>
<td >
<p>year without century (00-99) </p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%Y</p>
</td>
<td >
<p>year with century (such as 1990)</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%Z</p>
</td>
<td >
<p>time zone name (such as Pacific Daylight Time)</p>
</td>
</tr>
<tr>
<td  scope="row">
<p>%z</p>
</td>
<td >
<p>time zone offset in hours and minutes from GMT (HHMM)</p>
</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/01/01/cocoa-date-formats/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

