<?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>Bendy Tree</title>
	<atom:link href="http://www.bendytree.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bendytree.com</link>
	<description>Flexible, Reliable Software</description>
	<lastBuildDate>Fri, 20 Jan 2012 14:32:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Buzzam Website Goes Live!!!</title>
		<link>http://www.bendytree.com/368/buzzam-website-goes-live</link>
		<comments>http://www.bendytree.com/368/buzzam-website-goes-live#comments</comments>
		<pubDate>Wed, 18 Jan 2012 15:41:15 +0000</pubDate>
		<dc:creator>Josh Wright</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.bendytree.com/?p=368</guid>
		<description><![CDATA[<a href="http://www.bendytree.com/368/buzzam-website-goes-live"><img align="left" hspace="5" width="150" height="150" src="http://www.bendytree.com/wp-content/plugins/thumbnail-for-excerpts/tfe_no_thumb.png" class="alignleft wp-post-image tfe" alt="" title="" /></a>Today we launched our new website for Buzzam. Please sign up for our mailing list! http://buzz.am &#160; If you don&#8217;t already know what Buzzam is, that page has a great explanation and some great demo videos. Also today, Greg Starling (a co-founder of Buzzam), wrote a great post on 10 Books Every Entrepreneur Should Read and [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Today we launched our new website for Buzzam. <strong>Please sign up for our mailing list!</strong></p>
<p><a href="http://buzz.am">http://buzz.am</a></p>
<p>&nbsp;</p>
<p>If you don&#8217;t already know what Buzzam is, that page has a great explanation and some great demo videos.</p>
<p>Also today, Greg Starling (a co-founder of Buzzam), wrote a great post on <a href="http://buzz.am/blog/the-10-books-every-entrepreneur-should-read/">10 Books Every Entrepreneur Should Read</a> and it includes some of my personal favorites like &#8216;Customer Satisfaction is Worthless&#8217; and &#8216;Don&#8217;t Make Me Think&#8217;.</p>
<p>&nbsp;</p>
<div class="shr-publisher-368"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.bendytree.com/368/buzzam-website-goes-live/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert text to flow chart &#8211; Flo Mo Jo</title>
		<link>http://www.bendytree.com/364/convert-text-to-flow-chart-flo-mo-jo</link>
		<comments>http://www.bendytree.com/364/convert-text-to-flow-chart-flo-mo-jo#comments</comments>
		<pubDate>Sat, 03 Dec 2011 18:21:15 +0000</pubDate>
		<dc:creator>Josh Wright</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.bendytree.com/?p=364</guid>
		<description><![CDATA[<a href="http://www.bendytree.com/364/convert-text-to-flow-chart-flo-mo-jo"><img align="left" hspace="5" width="150" height="150" src="http://www.bendytree.com/wp-content/uploads/2011/12/flochart-150x150.jpg" class="alignleft wp-post-image tfe" alt="" title="Flo Mo Jo - Flo Chart" /></a>Overview: Yesterday I created a proof of concept site that converts text to a flow chart. See it at http://flomojo.com Going Postal Yesterday I went at the post office because I needed one stamp.  20 minutes later I walked out with $10 worth of stamps. Their machine was out.  Over a dozen people were in [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Overview: Yesterday I created a proof of concept site that converts text to a flow chart. See it at <a href="http://flomojo.com">http://flomojo.com</a></p>
<h2>Going Postal</h2>
<p>Yesterday I went at the post office because I needed one stamp.  20 minutes later I walked out with $10 worth of stamps. Their machine was out.  Over a dozen people were in line while 1 clerk helped us &amp; two other clerks literally stood there doing nothing.</p>
<p>All that to say, I thought it&#8217;d be funny to make a flow chart sharing my continuous frustration with the Postal Service.</p>
<p>Spoiler alert, <a href="http://bit.ly/thKCn6">here&#8217;s the flow chart I ended up making about the postal service</a>.</p>
<p>&nbsp;</p>
<h2>Flow Charts Are Helpful</h2>
<p>I guess I&#8217;m a flowchart guy. When I&#8217;m designing apps &amp; websites, I like to use flow charts.  Who doesn&#8217;t like a <a href="http://www.uniquescoop.com/2009/11/funny-flowcharts.html">good flowchart</a>?</p>
<p>I&#8217;ve used <a href="http://www.omnigroup.com/products/omnigraffle/">omnigraffle</a> but I don&#8217;t like <strong><em>designing</em></strong> flow charts &#8211; it&#8217;s too much drag this, resize that, move these over here.  Not enough focusing on my process.</p>
<p>So lots of times I&#8217;ll write the flowchart out in plain text using line indention for hierarchies, etc.  This even lets me design flow charts on my iPhone or iPad (<a href="http://nebulousapps.net/">I use Nebulous Notes</a>). I literally have 13 text files right now that are basically flow charts for app ideas.</p>
<p>&nbsp;</p>
<h2>A Little jQuery Magic</h2>
<p>So yesterday I spent a few hours making a proof of concept website called Flo Mo Jo. I used <a href="http://jquery.com">jQuery</a> &amp; <a href="http://jsplumb.org">jsPlumb</a>.  You write in plain text following some simple rules and the flowchart is generated automatically.  Here&#8217;s an example:</p>
<h4>The Script</h4>
<pre>Rate Your Day
   Did you go to the Post Office?

Did you go to the Post Office?
   Yes: Did someone offer to go for you?
      Yes: Perfect!!!
      No: Horrible!!!
   No: Do you need to go soon?
      No: Perfect!!!
      Yes: Horrible!!!</pre>
<h4>The Result</h4>
<p><a href="http://www.bendytree.com/wp-content/uploads/2011/12/flochart.jpg"><img class="aligncenter size-full wp-image-365" title="Flo Mo Jo - Flo Chart" src="http://www.bendytree.com/wp-content/uploads/2011/12/flochart.jpg" alt="" width="280" height="313" /></a></p>
<h2>Wrap It Up</h2>
<p>The proof of concept works better than I expected, but it doesn&#8217;t handle large graphs very well.  The hardest part is placing each node close to related nodes but also in the familiar top to bottom style.  I guess I need to read up on <a href="http://en.wikipedia.org/wiki/Layered_graph_drawing">layered graph drawing</a> but that seemed fruitless &amp; boring.</p>
<div class="shr-publisher-364"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.bendytree.com/364/convert-text-to-flow-chart-flo-mo-jo/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Migrating an LLBLGen Project from 2.X to 3.X</title>
		<link>http://www.bendytree.com/355/the-real-guide-to-migrating-an-llblgen-2-x-project-to-3-x</link>
		<comments>http://www.bendytree.com/355/the-real-guide-to-migrating-an-llblgen-2-x-project-to-3-x#comments</comments>
		<pubDate>Wed, 26 Oct 2011 15:50:03 +0000</pubDate>
		<dc:creator>Josh Wright</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.bendytree.com/?p=355</guid>
		<description><![CDATA[<a href="http://www.bendytree.com/355/the-real-guide-to-migrating-an-llblgen-2-x-project-to-3-x"><img align="left" hspace="5" width="150" src="http://themecraft.net/wwwdata/thumbs/l/llblgen.com.jpg" class="alignleft wp-post-image tfe" alt="" title="llblgen" /></a>Migrating a project from V2 to V3 LLBLGen project was a huge pain. Since I work in 30+ projects that use V2, I decided to write out all the not-so-obvious steps required. The Real Guide Half the battle is just finding these links below, so consider yourself a leprechaun.  They are a good reference if [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Migrating a project from V2 to V3 LLBLGen project was a huge pain. Since I work in 30+ projects that use V2, I decided to write out all the not-so-obvious steps required.</p>
<h2>The Real Guide</h2>
<p>Half the battle is just finding these links below, so consider yourself a leprechaun.  They are a good reference if you&#8217;re having issues.</p>
<p><strong>Converting the Project File: </strong><a href="http://www.llblgen.com/documentation/3.0/Designer/Migratingv2xProjectTov3.htm">http://www.llblgen.com/documentation/3.0/Designer/Migratingv2xProjectTov3.htm</a></p>
<p><strong>Download Migration Templates: </strong><a href="http://www.llblgen.com/Pages/ListAdditionalDownloads.aspx">http://www.llblgen.com/Pages/ListAdditionalDownloads.aspx</a></p>
<p><strong>Migrating Your Code: </strong><a href="http://www.llblgen.com/documentation/3.0/LLBLGen%20Pro%20RTF/hh_start.htm#migratingcode.htm">http://www.llblgen.com/documentation/3.0/LLBLGen%20Pro%20RTF/hh_start.htm#migratingcode.htm</a></p>
<p><strong>Demo of LLBLGen V3:</strong> <a href="http://www.llblgen.com/Pages/trial.aspx">http://www.llblgen.com/Pages/trial.aspx</a></p>
<p>You could also check out the <a href="http://www.llblgen.com/TinyForum/Default.aspx">LLBLGen Forums</a>. He may not be able to pick a good ORM name <img src='http://www.bendytree.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  but you will never find a faster, more helpful support guy than LLBLGen&#8217;s creator Frans.  People seem to endlessly paste huge blobs of untrimmed code into the support forums &amp; he always takes a look &amp; helps people out. He&#8217;s like the Zappos of ORMS.</p>
<h2>Step 1) Back Everything Up</h2>
<p>Use git or just copy your files into another directory.  You&#8217;ll be making some fierce changes to references, code, &amp; your project file.</p>
<h2>Step 2) Convert Your Project</h2>
<p>In LLBLGen V2 the project file is a binary *.lgp file.  In V3 it becomes an XML *.llblgenproj so you need to convert your project file.</p>
<p>I wish you could just open your old project in the new program and it would automatically convert it for you, but it is WAAAAY more complicated.</p>
<p>A) Download &amp; extract the <a href="http://www.llblgen.com/Pages/ListAdditionalDownloads.aspx">v2.x to v3.x migration templates</a> (it&#8217;s the top link)</p>
<p>B) Copy everything in that folder into the root  folder of your LLBLGen 2.6 program directory</p>
<p>For me that means: copy <strong>C:\V2xMigrationTemplates_20110207</strong> to <strong>C:\Program Files\Solutions Design\LLBLGen Pro v2.6</strong></p>
<p>C) Open your original project file (*.lgp) in LLBLGen 2.6 (or reopen if it was already open)</p>
<p>D) Press F7 to generate code</p>
<p>E) In the Template group drop down, choose &#8220;LLBLGen Pro V3&#8243; &amp; press Generate.  Your project file *.llblgenproj is now in the &#8220;Destination Root Folder&#8221;.</p>
<p>F) Close LLBLGen, delete your old *.lgp project, and place your *.llblgenproj wherever you want it.</p>
<p>At this point, you can open the .llblgenproj with V3 &amp; generate code just like normal.</p>
<h2>Step 3) New DLLs</h2>
<p>Now your *.dll references are messed up so your project doesn&#8217;t build anymore.  For SqlServer, projects have 3 dependencies: <strong>SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll</strong>, <strong>SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll</strong>, and <strong>SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll</strong></p>
<p>You need to delete these out of your lib (in your project), delete them from your project references, &amp; clean your solution.</p>
<p>Now re-add them in Visual Studio by clicking &#8220;Add Reference&#8221; then selecting them from your GAC.  You need to add version 3.1.0.0 of each assembly:</p>
<p>LLBLGen Pro Dynamic Query Engine for SqlServer</p>
<p>LLBLGen Pro Linq Support Classes library</p>
<p>LLBLGen Pro ORM Support Classes Library</p>
<p>In my opinion you should set these as &#8216;copy local&#8217;, then build, then copy them out of the bin into a lib, then reference the ones in your lib (instead of the GAC).  This makes your project build on a computer that doesn&#8217;t have LLBLGen3 installed.</p>
<h2>Step 4) Build Errors</h2>
<p>You&#8217;re not done, but you&#8217;re close. SelfServicing V3 got rid of both DbUtils classes so you need to delete them. They are:</p>
<p>/HelperClasses/DbUtils.cs</p>
<p>/HelperClasses/DbUtilsComPlus.com</p>
<p><img class="aligncenter" title="llblgen" src="http://themecraft.net/wwwdata/thumbs/l/llblgen.com.jpg" alt="" width="320" height="240" /></p>
<div class="shr-publisher-355"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.bendytree.com/355/the-real-guide-to-migrating-an-llblgen-2-x-project-to-3-x/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Native Regex vs. UIWebView Regex</title>
		<link>http://www.bendytree.com/351/native-regex-vs-uiwebview-regex</link>
		<comments>http://www.bendytree.com/351/native-regex-vs-uiwebview-regex#comments</comments>
		<pubDate>Mon, 03 Oct 2011 23:43:03 +0000</pubDate>
		<dc:creator>Josh Wright</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.bendytree.com/?p=351</guid>
		<description><![CDATA[<a href="http://www.bendytree.com/351/native-regex-vs-uiwebview-regex"><img align="left" hspace="5" width="150" src="http://i302.photobucket.com/albums/nn118/webloglearner/timer-icon.png" class="alignleft wp-post-image tfe" alt="" title="RegexKitLite vs. UIWebView" /></a>Quick post just to jot down some numbers&#8230; My latest project has me doing A LOT of string manipulation which is a huge pain in objective-c.  To top it off, I&#8217;d really like this part of my code to be dynamic so the logic could be updated without a full-on new version through the 5-7 [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Quick post just to jot down some numbers&#8230;</p>
<p>My latest project has me doing A LOT of string manipulation which is a huge pain in objective-c.  To top it off, I&#8217;d really like this part of my code to be dynamic so the logic could be updated without a full-on new version through the 5-7 day Apple approval process.</p>
<p>Normally I&#8217;d use <a href="http://regexkit.sourceforge.net/RegexKitLite/">RegexKitLite</a>, but I started to wonder about the possibility of using a hidden UIWebView &amp; just running JavaScript.  This would let me dynamically load and run JavaScript.  The code looks like this:</p>
<pre>NSString* text = [JavaScript run:@"'Hello <strong>World</strong>!'.replace(/&lt;[^&gt;]*&gt;/g, '')"];</pre>
<p>You can see more of my automatic JavaScript runner at my <a href="https://github.com/bendytree/iOS/blob/master/Code/BT-JavaScript.m">iOS library on GitHub</a>. Basically, it creates a hidden singleton UIWebView and runs the JavaScript against it.</p>
<p>So the question is, how fast is it?  How much memory is that UIWebView taking up?</p>
<p>The answer is that it takes about 10x&#8217;s as long and the web view takes about 90kb.  You can see from my numbers below that that vast majority of the time increase is due to the overhead of running JavaScript &#8211; not due to the slowness of JavaScript.</p>
<p>Running each test 100,000 times resulted in the following:</p>
<p>//native 2+3:           0.000243 seconds</p>
<p>//native regex replace: 0.167785 seconds</p>
<p>//javascript 2+3:       2.693516 seconds</p>
<p>//javascript regex:     2.599044 seconds</p>
<p>//UIWebView:            80kb</p>
<p><img class="aligncenter" title="RegexKitLite vs. UIWebView" src="http://i302.photobucket.com/albums/nn118/webloglearner/timer-icon.png" alt="" width="512" height="512" /></p>
<div class="shr-publisher-351"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.bendytree.com/351/native-regex-vs-uiwebview-regex/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Core Data Migrations and Cave Monsters</title>
		<link>http://www.bendytree.com/349/core-data-migrations-and-cave-monsters</link>
		<comments>http://www.bendytree.com/349/core-data-migrations-and-cave-monsters#comments</comments>
		<pubDate>Tue, 13 Sep 2011 17:59:56 +0000</pubDate>
		<dc:creator>Josh Wright</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://www.bendytree.com/?p=349</guid>
		<description><![CDATA[<a href="http://www.bendytree.com/349/core-data-migrations-and-cave-monsters"><img align="left" hspace="5" width="150" src="http://manilabulletinfunpage.files.wordpress.com/2009/02/cave-monster.jpg?w=500&amp;h=510" class="alignleft wp-post-image tfe" alt="" title="Core Data Migrations and Cave Monsters" /></a>Migrating the core data schema on an iOS app is like a monster in a cave.  When I walk by, the monster growls and I back off. Well not today.  Today I learned to do a simple migration in an existing core data app and I confirmed what so many others had said. It&#8217;s strangely [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div>
<p>Migrating the core data schema on an iOS app is like a monster in a cave.  When I walk by, the monster growls and I back off.</p>
<p>Well not today.  Today I learned to do a simple migration in an existing core data app and I confirmed what so many others had said.</p>
<blockquote><p>It&#8217;s strangely easy to do migrations&#8230; once you know how.</p></blockquote>
<p>Unfortunately I never found anyone that would explain it, so that&#8217;s what I&#8217;m doing here.</p>
<h2>The Docs</h2>
<p>Here are the Apple docs for <a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreDataVersioning/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004403-SW1">running a core data migration</a>.</p>
<p>Somehow I, along with some others, have found these docs both too complicated and short on information.</p>
<h2>How it Really Works</h2>
<p>First off, I&#8217;ll assume that you have a working Core Data app that has a &#8220;Model.xcdatamodeld&#8221; defining the schema and some data in the database.</p>
<p><strong>Step 1) Create Version 2 of the Model</strong></p>
<p>You don&#8217;t have to start from scratch, and you don&#8217;t mess with the existing model.  Basically you will add a new version (described below) which starts out looking just like the original model.</p>
<p>a. Click the &#8220;Model.xcdatamodeld&#8221; file in your XCode project.</p>
<p>b. Then, in the Editor menu at the top of the screen, choose &#8220;Add Model Version&#8230;&#8221;</p>
<p>c. Click through the wizard &amp; call the new model whatever you want.  I left it as &#8220;Model 2&#8243;</p>
<h3>Step 2) Update the New Model</h3>
<p>Now you can change this &#8220;Version 2&#8243; model however you want.</p>
<p>NOTE: There are some limitations on what is allowed if you want to keep the migration simple - <a href="http://stackoverflow.com/questions/4307362/coredata-lightweight-migration-which-exactly-are-simple-changes-to-your-model/4307538#4307538">more info here</a>.  If you have to do something complicated that requires special processing (like splitting a field) then <a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmCustomizingTheProcess.html#//apple_ref/doc/uid/TP40005510-SW1">checkout the apple docs on custom migrations</a>.</p>
<h3>Step 3) Choose the Version</h3>
<p>This step is critical, and I never found anyone mention it.</p>
<p>When you create &#8220;Model 2&#8243; it isn&#8217;t automatically set as the active version.  So at this point, if you installed the app on a new device it would still use the old Model.  To tell the application you actually want to use &#8220;Model 2&#8243;, you need to set it as the &#8220;Current&#8221;:</p>
<p>a) Click on &#8220;Model.xcdatamodeld&#8221;</p>
<p>b) Show the &#8220;Utilities Column&#8221; (the right side of the screen)</p>
<p>c) Show the &#8220;File Inspector&#8221; (the left tab of the Utilities Column&#8221;)</p>
<p>d) Choose &#8220;Model 2&#8243; under &#8220;Versioned Core Data Model&#8221; &gt; &#8220;Current&#8221;</p>
<h3>Step 4) Apply the Migration</h3>
<p>You&#8217;re almost there, but you still need to tell the code that it&#8217;s OK to run the migration.</p>
<p>Find your code that looks like this:</p>
<blockquote><p>[self.coordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&amp;error]</p></blockquote>
<p>Right now you don&#8217;t have any options, but this is where you tell Core Data to run the migrations automatically if needed.  Change it to:</p>
<blockquote>
<div id="_mcePaste">NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:</div>
<div id="_mcePaste">[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,</div>
<div id="_mcePaste">[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];</div>
<div id="_mcePaste">[self.coordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&amp;error];</div>
</blockquote>
<h3>And That&#8217;s It</h3>
<p>Next time you run the app, it should automatically add/remove fields/entities to match your new model.</p>
<p><img class="aligncenter" title="Core Data Migrations and Cave Monsters" src="http://manilabulletinfunpage.files.wordpress.com/2009/02/cave-monster.jpg?w=500&amp;h=510" alt="" width="500" height="510" /></p>
</div>
<div class="shr-publisher-349"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.bendytree.com/349/core-data-migrations-and-cave-monsters/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Photoshop Scripting &#8211; User Interface</title>
		<link>http://www.bendytree.com/331/photoshop-scripting-user-interface</link>
		<comments>http://www.bendytree.com/331/photoshop-scripting-user-interface#comments</comments>
		<pubDate>Thu, 08 Sep 2011 12:18:45 +0000</pubDate>
		<dc:creator>Josh Wright</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.bendytree.com/?p=331</guid>
		<description><![CDATA[<a href="http://www.bendytree.com/331/photoshop-scripting-user-interface"><img align="left" hspace="5" width="150" height="150" src="http://www.bendytree.com/wp-content/uploads/2011/07/PhotoshopScriptingUI-150x150.jpg" class="alignleft wp-post-image tfe" alt="" title="Photoshop Scripting User Interface" /></a>I&#8217;ve been really digging into using JavaScript with Photoshop in the last few months.  Today I made a wonderful, mysterious discovery. Discovering the Photoshop Scripting UI Until now, the only user interaction I&#8217;ve been able to add to my scripts is popping up a JavaScript alert, confirm, or prompt or showing a &#8216;select a file&#8217; [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I&#8217;ve been really digging into using JavaScript with Photoshop in the last few months.  Today I made a wonderful, mysterious discovery.</p>
<h2>Discovering the Photoshop Scripting UI</h2>
<p>Until now, the only user interaction I&#8217;ve been able to add to my scripts is popping up a JavaScript alert, confirm, or prompt or showing a &#8216;select a file&#8217; dialog.  These were better than nothing, but I really wanted a panel with buttons or a big textarea.</p>
<p>Begin theme music for page 187 of the <a href="http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/photoshop/pdfs/JavaScriptReferenceGuide.pdf">2005 Photoshop CS2 JavaScript Reference Guide</a> (PDF, 3.4MB).  This guide discusses ScriptUI, which is mysteriously never mentioned in the <a href="http://www.adobe.com/devnet/photoshop/scripting.html">CS3, CS4, or CS5 guides</a>.  It goes into great depth demonstrating how you can build complex user interfaces complete with sliders, textareas, checkboxes, dropdowns, and more!  And guess what&#8230; it all works in CS5!</p>
<p>Here&#8217;s a simple example of popping up a blank window:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> dlg <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Window<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'dialog'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'Alert Box Builder'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">100</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">400</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">300</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
dlg.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h2>What You See Is What You Get</h2>
<p>Building a complex interface isn&#8217;t for the faint of heart (it reminds me of my flash developing days), but it is possible and reasonable.  I was super excited to discover <a href="http://www.ps-scripts.com/bb/viewtopic.php?t=67">this CSUIB thread</a> discussing a WYSIWYG for ScriptUI by <a href="www.jkozniewski.com">Jakub Kozniewski</a> where you drag/resize panels &amp; inputs and it generates the code for your UI.  Pretty sweet, huh?  Here&#8217;s a UI I built in a few seconds (code then screenshot):</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> dlg <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Window<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;dialog{text:'Script Interface',bounds:[100,100,561,269],<span style="color: #000099; font-weight: bold;">\</span><br />
iwtfkhamhc:EditText{bounds:[16,16,444.95,94] , text:'Your text goes here' ,properties:{multiline:false,noecho:false,readonly:false}},<span style="color: #000099; font-weight: bold;">\</span><br />
button0:Button{bounds:[17,102,117,122] , text:'Save' },<span style="color: #000099; font-weight: bold;">\</span><br />
button1:Button{bounds:[236,101,336,121] , text:'Cancel' },<span style="color: #000099; font-weight: bold;">\</span><br />
button2:Button{bounds:[345,101,445,121] , text:'Whatever' },<span style="color: #000099; font-weight: bold;">\</span><br />
slider0:Slider{bounds:[18,138,173,148] , minvalue:0,maxvalue:100,value:0},<span style="color: #000099; font-weight: bold;">\</span><br />
checkbox0:Checkbox{bounds:[190,133,261,154] , text:'Checkbox Text' },<span style="color: #000099; font-weight: bold;">\</span><br />
dropdown0:DropDownList{bounds:[299,134,443,149],properties:{items:['Select One']}}<span style="color: #000099; font-weight: bold;">\</span><br />
};&quot;</span><span style="color: #339933;">;</span><br />
dlg.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p><a href="http://www.bendytree.com/wp-content/uploads/2011/07/PhotoshopScriptingUI.jpg"><img class="aligncenter size-full wp-image-332" title="Photoshop Scripting User Interface" src="http://www.bendytree.com/wp-content/uploads/2011/07/PhotoshopScriptingUI.jpg" alt="" width="466" height="174" /></a></p>
<div class="shr-publisher-331"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.bendytree.com/331/photoshop-scripting-user-interface/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading and Writing Text Files from Photoshop Scripts</title>
		<link>http://www.bendytree.com/337/reading-and-writing-text-files-from-photoshop-scripts</link>
		<comments>http://www.bendytree.com/337/reading-and-writing-text-files-from-photoshop-scripts#comments</comments>
		<pubDate>Tue, 06 Sep 2011 03:20:22 +0000</pubDate>
		<dc:creator>Josh Wright</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.bendytree.com/?p=337</guid>
		<description><![CDATA[<a href="http://www.bendytree.com/337/reading-and-writing-text-files-from-photoshop-scripts"><img align="left" hspace="5" width="150" src="http://sendyoursmiles.com/wp-content/uploads/2011/03/032511_1246_DelimitedRe39.png" class="alignleft wp-post-image tfe" alt="" title="Reading and Writing Text in Photoshop Scripts" /></a>My latest posted discussed showing a UI that had textareas, buttons, and more so users could interact with your Photoshop script. But now I discovered another fun trick &#8211; reading and writing text files from JavaScript Photoshop scripts. Reading is Fun Not much to it &#8211; you read line by line: 1234567var b = new [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p style="text-align: center;"><img class="aligncenter" title="Reading and Writing Text in Photoshop Scripts" src="http://sendyoursmiles.com/wp-content/uploads/2011/03/032511_1246_DelimitedRe39.png" alt="" width="360" height="198" /></p>
<p style="text-align: left;">My latest posted discussed showing a UI that had textareas, buttons, and more so users could interact with your Photoshop script.  But now I discovered another fun trick &#8211; reading and writing text files from JavaScript Photoshop scripts.</p>
<h2>Reading is Fun</h2>
<p>Not much to it &#8211; you read line by line:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> File<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;c:<span style="color: #000099; font-weight: bold;">\\</span>test.txt&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
b.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'r'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #003366; font-weight: bold;">var</span> str <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>b.<span style="color: #660066;">eof</span><span style="color: #009900;">&#41;</span><br />
str <span style="color: #339933;">+=</span> b.<span style="color: #660066;">readln</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
b.<span style="color: #000066;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>So we give it a file path and it reads line-by-line until it&#8217;s done.  The &#8216;r&#8217; in open(&#8216;r&#8217;) means we&#8217;re opening the file read-only.  But we can also write to that text file&#8230;</p>
<h2>Writing is Funner</h2>
<p>Nice title, huh?  Like I said, you can write to a text file from a JavaScript Photoshop script. Just open the file with the &#8216;w&#8217; flag.  When you call file.write(&#8230;) it clears the file and writes your text.  If you call it again, it appends your text.  Here&#8217;s an example:</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> File<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;c:<span style="color: #000099; font-weight: bold;">\\</span>test.txt&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
a.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
a.<span style="color: #660066;">writeln</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hello&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
a.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;world&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
a.<span style="color: #000066;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>The beautiful part is that now you can store data &#8211; maybe even a simple database.  Or maybe you can import some comma separated goodness and <a href="http://www.kirupa.com/motiongraphics/scripting4.htm">throw down on some business cards</a>.  Whatever it is, Enjoy!</p>
<div class="shr-publisher-337"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.bendytree.com/337/reading-and-writing-text-files-from-photoshop-scripts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cocoa Bird Cocoa to Twitter API</title>
		<link>http://www.bendytree.com/328/presenting-cocoa-bird</link>
		<comments>http://www.bendytree.com/328/presenting-cocoa-bird#comments</comments>
		<pubDate>Mon, 27 Jun 2011 22:21:46 +0000</pubDate>
		<dc:creator>Josh Wright</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.bendytree.com/?p=328</guid>
		<description><![CDATA[<a href="http://www.bendytree.com/328/presenting-cocoa-bird"><img align="left" hspace="5" width="150" src="http://www.bendytree.com/wp-content/uploads/2011/06/cocoa-bird-300x300.png" class="alignleft wp-post-image tfe" alt="" title="Cocoa Bird" /></a>Spoiler alert: I just released a new Objective-c/Cocoa to Twitter open-source library called CocoaBird. Here&#8217;s the story&#8230; I&#8217;ve got a new project and one of the requirements is strong integration with social media such as Twitter.  After bouncing around a few objective-c to twitter APIs, I just wasn&#8217;t satisfied.  Some of the older ones never [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://www.cocoabird.com"><img class="alignleft size-medium wp-image-329" title="Cocoa Bird" src="http://www.bendytree.com/wp-content/uploads/2011/06/cocoa-bird-300x300.png" alt="" width="300" height="300" /></a>Spoiler alert: I just released a new Objective-c/Cocoa to Twitter open-source library called <a href="http://www.cocoabird.com">CocoaBird</a>.</p>
<p>Here&#8217;s the story&#8230; I&#8217;ve got a new project and one of the requirements is strong integration with social media such as Twitter.  After bouncing around a few objective-c to twitter APIs, I just wasn&#8217;t satisfied.  Some of the older ones never seemed to make <a href="http://dev.twitter.com/pages/basic_to_oauth">the transition from XAuth to OAuth</a> and required modifications or hacks to get going.  A lot of it is mostly a preference, but I wanted strongly typed modes for the ins &amp; outs, full/clear coverage of the API, web intents, and the ability to do calls synchronously (in case I already started my thread).</p>
<p>The result was a few weeks of work and an open source library called Cocoa Bird.  It&#8217;s designed for objective-c/cocoa developers developing for iOS 3+.</p>
<p>Read more about CocoaBird (including docs, source, &amp; help) at <a href="http://www.cocoabird.com">http://www.cocoabird.com</a></p>
<p>It&#8217;s definitely my first full-on attempt at an open source project, so wish me luck!</p>
<div class="shr-publisher-328"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.bendytree.com/328/presenting-cocoa-bird/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Core Data &#8211; Simplified</title>
		<link>http://www.bendytree.com/309/core-data-simplified</link>
		<comments>http://www.bendytree.com/309/core-data-simplified#comments</comments>
		<pubDate>Thu, 26 May 2011 02:58:08 +0000</pubDate>
		<dc:creator>Josh Wright</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.bendytree.com/?p=309</guid>
		<description><![CDATA[<a href="http://www.bendytree.com/309/core-data-simplified"><img align="left" hspace="5" width="150" height="150" src="http://www.bendytree.com/wp-content/uploads/2011/05/apple-core-150x150.jpg" class="alignleft wp-post-image tfe" alt="" title="Core Data - Simplified" /></a>Every time I make an iOS app, I shy away from Core Data and end up storing data in a plist or sqlite.  It&#8217;s a senseless fear, but here&#8217;s why I avoid it. CoreData barfs all over your AppDelegate It&#8217;s somewhat difficult to add CoreData to an existing app The code for data access is [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Every time I make an iOS app, I shy away from Core Data and end up storing data in a <a href="http://stackoverflow.com/questions/5354623/how-do-i-load-a-plist-file-from-disk-as-a-nsdictionary-on-ios">plist</a> or <a href="http://www.techotopia.com/index.php/An_Example_SQLite_based_iOS_4_iPhone_Application">sqlite</a>.  It&#8217;s a senseless fear, but here&#8217;s why I avoid it.</p>
<ol>
<li><a href="http://www.techotopia.com/index.php/An_iPhone_OS_Core_Data_Tutorial#Adding_a_View_Controller">CoreData barfs all over your AppDelegate</a></li>
<li><a href="http://stackoverflow.com/questions/2032818/adding-core-data-to-existing-iphone-project/2032862#2032862">It&#8217;s somewhat difficult to add CoreData to an existing app</a></li>
<li><a href="http://www.techotopia.com/index.php/An_iPhone_OS_Core_Data_Tutorial#Retrieving_Data_from_the_Persistent_Store_using_Core_Data">The code for data access is a bit bloated</a></li>
</ol>
<p>Tonight I took the plunge and found a great way to clean up your AppDelegate A LOT and simplify access to the data.  All of the confusing context and coordinator stuff is completely abstracted away. You don&#8217;t have to worry about initializing or accessing the manager because it&#8217;s now static access to a singleton instance.  Here&#8217;s what my interface to Core Data looks like:</p>
<p>Here&#8217;s what my interface looks like:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@interface CD : NSObject {</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">}<br />
<br />
+ (void) save;<br />
+ (NSMutableArray*) find:(Class)modelClass;<br />
+ (NSMutableArray*) find:(Class)modelClass where:(NSPredicate*)filter;<br />
+ (id) new:(Class)modelClass;</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@end</div></td></tr></tbody></table></div>
<p>Now I know CD is a strange class name, but my goal is painless access to data.  So here are some code samples for using this interface:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">// Create a product<br />
Product* product = [CD new:[Product class]];<br />
product.Name = @&quot;Fake Plastic Tree&quot;;<br />
product.Price = 9.99;</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">// Save it<br />
[CD save];</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;//Fetch all products<br />
NSArray* products = [CD find:[Product class]];<br />
...do something with the products...</div></td></tr></tbody></table></div>
<p>What about the app delegate?  Simple&#8230; now you just need ONE LINE in your AppDelegate (instead of literally hundreds).</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">- (void)applicationWillTerminate:(UIApplication *)application<br />
{<br />
// Do your normal stuff here</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;[CD save]; &nbsp;//this is the line you need to add<br />
}</div></td></tr></tbody></table></div>
<p>So having used this for all of 10 minutes, I&#8217;m pretty happy with it.  I don&#8217;t know much about core data, so I might be missing something huge that blows this abstraction to pieces.  I can tell you that it definitely works for a very simple &#8216;Notes&#8217; app I just made.</p>
<p>I definitely need to add some more actions like &#8216;delete&#8217; or &#8216;count&#8217;, but those should be trivial.</p>
<p>If you want the code, grab it from my <a href="https://github.com/bendytree/iOS/tree/master/Code">Bendy Tree iOS Library on GitHub</a>.  To use it, just follow two steps:</p>
<ol>
<li> Add CD.h and CD.m to your project</li>
<li>Change the path to your database inside CD.m (it currently says &#8216;TestCoreData4&#8242;)</li>
</ol>
<p>I&#8217;m thinking of writing a tutorial on adding core data to a project, but for now <a href="http://www.techotopia.com/index.php/An_iOS_4_iPhone_Core_Data_Tutorial">Techotopia has a good tutorial on getting started</a>.</p>
<p><a href="http://www.bendytree.com/wp-content/uploads/2011/05/apple-core.jpg"><img class="aligncenter size-full wp-image-318" title="Core Data - Simplified" src="http://www.bendytree.com/wp-content/uploads/2011/05/apple-core.jpg" alt="" width="400" height="381" /></a></p>
<div class="shr-publisher-309"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.bendytree.com/309/core-data-simplified/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Giving Facebook a Spin</title>
		<link>http://www.bendytree.com/322/giving-facebook-a-spin</link>
		<comments>http://www.bendytree.com/322/giving-facebook-a-spin#comments</comments>
		<pubDate>Sat, 23 Apr 2011 03:13:34 +0000</pubDate>
		<dc:creator>Josh Wright</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.bendytree.com/?p=322</guid>
		<description><![CDATA[<a href="http://www.bendytree.com/322/giving-facebook-a-spin"><img align="left" hspace="5" width="150" height="150" src="http://www.bendytree.com/wp-content/uploads/2011/05/Facebook-Logo-150x150.png" class="alignleft wp-post-image tfe" alt="" title="Facebook" /></a>FYI: I&#8217;ve decided to list my projects/apps on Facebook under BendyTree instead of this blog. I&#8217;m giving it a shot, anyways. I still plan on blogging here since there doesn&#8217;t seem to be a great way to blog through Facebook. I&#8217;m sure this is a life changing event for everyone!]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>FYI: I&#8217;ve decided to list my <a href="https://www.facebook.com/pages/Bendy-Tree/138585038503">projects/apps on Facebook under BendyTree</a> instead of this blog.  I&#8217;m giving it a shot, anyways.</p>
<p>I still plan on blogging here since there doesn&#8217;t seem to be a great way to blog through Facebook.</p>
<p>I&#8217;m sure this is a life changing event for everyone! <img src='http://www.bendytree.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.bendytree.com/wp-content/uploads/2011/05/Facebook-Logo.png"><img src="http://www.bendytree.com/wp-content/uploads/2011/05/Facebook-Logo.png" alt="" title="Facebook" width="512" height="512" class="aligncenter size-full wp-image-324" /></a></p>
<div class="shr-publisher-322"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.bendytree.com/322/giving-facebook-a-spin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

