<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
   <channel>
      <title>Jonathan Saggau&apos;s Blog</title>
      <link>http://www.jonathansaggau.com/blog/</link>
      <description>&quot;Jonathan&apos;s going places.&quot;  -George Carlin</description>
      <language>en</language>
      <copyright>Copyright 2013</copyright>
      <lastBuildDate>Sun, 17 Mar 2013 15:03:13 -0500</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/?v=3.2</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

            <item>
         <title>OpenCV on iOS working again</title>
         <description><![CDATA[<p style="font-family: 'Lucida Grande';">I just updated the <a href="https://github.com/jonmarimba/OpenCV-iOS">OpenCV on iOS Xcode project</a> to use the git repo as a submodule for OpenCV.  I've also fixed the SURF demo.  Take a look!</p>
<p style="font-family: 'Lucida Grande';">(The git mirror that I had created for OpenCV's svn is now gone.)</p>
<p style="font-family: 'Lucida Grande';">Note: If you've cloned a previous version, use <em>git submodule init </em>and<em> git submodule update</em> after pulling the latest rev to pull the correct version of OpenCV. If you get build errors, you probably need to do this.</p>]]></description>
         <link>http://www.jonathansaggau.com/blog/2013/03/opencv_on_ios_working_again.html</link>
         <guid>http://www.jonathansaggau.com/blog/2013/03/opencv_on_ios_working_again.html</guid>
         <category>Stupid Nerd Tricks</category>
         <pubDate>Sun, 17 Mar 2013 15:03:13 -0500</pubDate>
      </item>
            <item>
         <title>OpenCV on iOS revvvvved</title>
         <description><![CDATA[<p>I just updated the <a href="https://github.com/jonmarimba/OpenCV-iOS">OpenCV on iOS Xcode project</a> to use the latest svn trunk of openCV.  Speaking of which, the git mirror that I created for OpenCV's svn is also <a href="https://github.com/jonmarimba/OpenCVMirror">on github</a>.  It is automatically updated every day on a cron job on a server at dreamhost.  While it's automatically updated each day, the git submodule for the OpenCV on iOS is not.  I'll update that manually on an occasional basis.</p>

<p>I'm looking for someone (cough. I'm lazy.) who will take on the project of writing a step-by-step for integrating OpenCV static libs into a new iOS project.  The examples directory has a SURF example that will automatically build all of OpenCV using cross-project dependency in Xcode that can be used as a basis for this.  Any takers?  Go ahead and fork me (heh) and issue a pull request.</p>

<p>Thanks to Nathan de Vries (<a href="https://github.com/atnan">@atnan</a>) for improving the submodule checkout foo in the readme file.  </p>

<p>Note: If you've cloned a previous version, use <em>git submodule update</em> after pulling the latest rev to pull the correct version of OpenCV.  If you get build errors, you probably need to do this.  </p>]]></description>
         <link>http://www.jonathansaggau.com/blog/2011/05/opencv_on_ios_revvvvved.html</link>
         <guid>http://www.jonathansaggau.com/blog/2011/05/opencv_on_ios_revvvvved.html</guid>
         <category></category>
         <pubDate>Fri, 27 May 2011 01:35:08 -0500</pubDate>
      </item>
            <item>
         <title>Simplified building of OpenCV on iOS is here</title>
         <description><![CDATA[<a href="https://github.com/jonmarimba/OpenCV-iOS">Check this out</a>.  Instead of several steps, some ugly CMake voodoo, and some work in the shell, now all you have to do is pull down a git repo to make OpenCV work on iOS.  A couple of people have tried it out and found it functional.  Let me know at "my first name at this domain dot calm" whether it works for you.  If anyone would like to use the example project to make instructions on how to make it work in a new project or even generate some project templates, get in touch or give it a go and submit a pull request on github.]]></description>
         <link>http://www.jonathansaggau.com/blog/2011/05/simplified_building_of_opencv_1.html</link>
         <guid>http://www.jonathansaggau.com/blog/2011/05/simplified_building_of_opencv_1.html</guid>
         <category>Announcements</category>
         <pubDate>Mon, 02 May 2011 18:40:07 -0500</pubDate>
      </item>
            <item>
         <title>NyARToolkit Augmented Reality on iOS</title>
         <description><![CDATA[<p>In preparation for the Augmented Reality class that Jonathan Blocksom and I taught at the recent iPhone / iPad devcon, Using AVFoundation video capture, we modernized and completed the example found at <a href="http://www.morethantechnical.com/2009/07/01/augmented-reality-on-the-iphone-using-nyartoolkit-w-code/">morethantechnical.com</a> using NyARToolkit (GPL) on iOS.  It's a great example of the kinds of things we can do now that we have fast devices with cameras to play with.</p>

<p>You can view a shaky video of the example running on an iPad 2 <a href="http://www.youtube.com/watch?v=AbeEB_E_F5w">here</a>.<br />
You can get the code from github <a href="https://github.com/jonmarimba/NyArToolkit-iOS">here</a>.</p>

<p>Be aware that this code is GPL, which (among other things) means that you have to release any changes you make to the code under GPL and that this code cannot be used in a commercial project.  There is also some speculation that the terms of using the App Store preclude GPL licensed projects as well.  Caveat Coder.</p>]]></description>
         <link>http://www.jonathansaggau.com/blog/2011/04/nyartoolkit_augmented_reality.html</link>
         <guid>http://www.jonathansaggau.com/blog/2011/04/nyartoolkit_augmented_reality.html</guid>
         <category>OpenGL</category>
         <pubDate>Tue, 19 Apr 2011 13:54:24 -0500</pubDate>
      </item>
            <item>
         <title>Simplified building of OpenCV on iOS is coming soon</title>
         <description>During Jonathan Blocksom&apos;s iPhone/iPad Devcon Computer Vision talk, for which I was honored to play guest artist, I mentioned that I would create and release an Xcode project that makes building OpenCV on iOS a simpler affair.  I&apos;m working on it and it&apos;s coming along nicely.  Get in touch if you would like to test what I have so far at an email address that is easy to figure out using &quot;my first name at this domain dot calm&quot;.  Otherwise, stay tuned!</description>
         <link>http://www.jonathansaggau.com/blog/2011/04/simplified_building_of_opencv.html</link>
         <guid>http://www.jonathansaggau.com/blog/2011/04/simplified_building_of_opencv.html</guid>
         <category></category>
         <pubDate>Tue, 19 Apr 2011 13:04:33 -0500</pubDate>
      </item>
            <item>
         <title>Slides for the upcoming iPhone iPad Devcon Talks</title>
         <description><![CDATA[I'm talking at the upcoming iPhone <a href="http://www.iphonedevcon.com/">iPad Devcon</a> in Boston from April 4 through 6 and today is the day we all get to share our slides!  I'm honored to be talking with Noah Gift and Jonathan Blocksom again.  This time, Jonathan and I are doing a full day on Augmented Reality!  
<br />
<br />
The latest version of the slides for the Augmented Reality Full day class is <a href="http://www.jonathansaggau.com/iOSAugmentedReality2011Boston.pdf">here</a>.  (Last Mod: 20110314)
<br />
There will be a whole packet of code and other goodness given out on the day of the class.
<br />
<br />
The latest version of the Open Source UI talk is <a href="http://www.jonathansaggau.com/OpenSourceUI2011Boston.pdf">here</a>. (Last Mod: 20110314)
<br />
<br />
The latest version of the Caching and performance talk is <a href="http://www.jonathansaggau.com/Caching2011Boston.pdf">here</a>. (Last Mod: 20110314)
<br /> 
<br />
The latest version of the touchengine talk is <a href="http://www.jonathansaggau.com/TouchEngine2011Boston.pdf">here</a>. (Last Mod: 20110314)
<br />
<br />]]></description>
         <link>http://www.jonathansaggau.com/blog/2011/03/slides_for_the_upcoming_iphone.html</link>
         <guid>http://www.jonathansaggau.com/blog/2011/03/slides_for_the_upcoming_iphone.html</guid>
         <category>Announcements</category>
         <pubDate>Mon, 14 Mar 2011 23:50:01 -0500</pubDate>
      </item>
            <item>
         <title>The E46 (penultimate) BMW M3 just might be the perfect car for you, too.</title>
         <description><![CDATA[<p>I have always loved driving fast cars.  I drove a blue '71 Mustang Mach 1 through most of college and a pretty red '93 Ford Escort wagon got me to and from teaching gigs and concerts.  I have motor oil in my blood.  I needed two cars to satisfy the "carry my stuff around without breaking the bank... or the car" and the "get me someplace fast and in style" requirements.</p>

<p><br />
Fast forward (ahem... cough... already?) years and I've lately had the pleasure of driving a Silver 2003 BMW M3.  This is a machine that laps the N&uuml;burgring in 8:22, gets from "naught to sixty" in 4.6 seconds.  You wouldn't expect it, but the back seat is actually usable for two non-American-sized people and they both fold down to reveal almost station-wagon-like cargo space, passing through to the trunk.  No kidding.  I brought a 6' wire shelf home the other night.  In real - world driving, it gets just barely less than 30 miles / gallon on the highway, which is waaay better than the latest M3, which, while it has 414 HP and obviously flies, gets about 20 MPG on the highway.  That's worse than my E46 city numbers of 23 MPG or so, even though I drive with occasional (ahem) spirit.  The engine redlines at 8000 RPM and the peak horsepower and torque both live very near that (around 7000), which means you have to grow accustomed to keeping the car above about 3000 RPM if you want any kind of torque.  Oddly, that's a good thing.  When you want to drive conservatively, it's easy to do so as the car has relatively little low-end power.  If you want to throw it around a bit, keep the revs up.  Simple.  Very girlfriend friendly driving down low, grins up high.</p>

<p><br />
(Over the break for pics and more)</p>]]></description>
         <link>http://www.jonathansaggau.com/blog/2011/01/the_e46_penultimate_bmw_m3_jus.html</link>
         <guid>http://www.jonathansaggau.com/blog/2011/01/the_e46_penultimate_bmw_m3_jus.html</guid>
         <category>Introspection</category>
         <pubDate>Mon, 03 Jan 2011 19:16:50 -0500</pubDate>
      </item>
            <item>
         <title>I couldn&apos;t do it (Android)</title>
         <description>While I swear I&apos;m going to try again every month or so, I just can&apos;t use Android 2.2 as my main phone.  I tried.  I failed.  I&apos;m spoiled by iPhone.  Android is just too &quot;death by a thousand tiny cuts&quot; for me at the moment.  I simply cannot use the darn thing for email.  Email!  Fer Chrissakes.  Until Android&apos;s main mail apps (yes, plural) allow me to reply to an email inline or forward just part of a message, I&apos;m done.  I even played with the new hotness running Android 2.3 that my friend Faruk brought home from Best Buy on the day it came out.  Same problem.  I couldn&apos;t get the flaunted redesigned copy and paste to work.  No kidding, it scrolled instead of selecting.  Sorry, guys.  I really wanted to make this work, but no.  </description>
         <link>http://www.jonathansaggau.com/blog/2011/01/i_couldnt_do_it_android.html</link>
         <guid>http://www.jonathansaggau.com/blog/2011/01/i_couldnt_do_it_android.html</guid>
         <category></category>
         <pubDate>Mon, 03 Jan 2011 18:16:56 -0500</pubDate>
      </item>
            <item>
         <title>#protip: In app purchase requires ability to sell apps</title>
         <description><![CDATA[<p>If you're new to the iPhone scene or working on In App Purchase code using a client's iTunes Connect setup, be aware that you must have all of your banking and financial information set up such that you *could* sell something on the app store, even if your app is not yet released, in order to test In App Purchase.  </p>

<p>I have a client who hasn't yet released any applications.  (SOON!  Right, Randy?)  We ran into this problem together and spent a couple of hours pulling our hair out over this one.  I suggested that he go ahead and add his banking information before escalating the problem to our friends at Apple and everything started working one he got himself setup for payments.  Unless I'm missing something obvious in the docs, and since there is no error message that comes back from the Store Kit callback indicating why an item is invalid, there is really no way that one would know that other than to have stumbled upon it like we did.</p>

<p>(facepalm)</p>]]></description>
         <link>http://www.jonathansaggau.com/blog/2010/11/protip_in_app_purchase_require.html</link>
         <guid>http://www.jonathansaggau.com/blog/2010/11/protip_in_app_purchase_require.html</guid>
         <category>Stupid Nerd Tricks</category>
         <pubDate>Tue, 16 Nov 2010 18:18:57 -0500</pubDate>
      </item>
            <item>
         <title>iPhone iPad Devcon sample code and downloadable slides</title>
         <description><![CDATA[Hi everybody.  I'm hearing from the conference organizers that slideshare is requiring a login to download the slides.  I've put them up on my server along with sample code. 
<br />
<br />
The downloadable pdf version of the Augmented Reality talk is <a href="http://jonathansaggau.com/artalk.pdf">here</a>.  Sample code is <a href="http://jonathansaggau.com/AR360Samples.zip">here</a>.  Videos are <a href="http://jonathansaggau.com/AR360Vids.zip">here</a>.  The latest version of the code can always be found on Google Code <a href="http://code.google.com/p/ar360/">here</a>.
<br />
<br />
The downloadable pdf version of the Open Source UI talk is <a href="http://jonathansaggau.com/opensource.pdf">here</a>.  Sample code is <a href="http://jonathansaggau.com/OpenSourceTalkCode.zip">here</a>.  Please see the presentation for various links to the open source project it references.
<br />
<br />
The downloadable pdf version of the Caching and performance talk is <a href="http://jonathansaggau.com/cachingdeck.pdf">here</a>.  Sample code is <a href="http://jonathansaggau.com/CachingPerformanceTalk.zip
">here</a>.
<br />
<br />
The downloadable pdf version of the touchengine talk is <a href="http://jonathansaggau.com/cloud.pdf">here</a>.  Sample code is <a href="http://jonathansaggau.com/touchengine.zip">here</a>.  The latest version can always be found on Google Code <a href="http://code.google.com/p/touchengine/">here</a>.
<br />
<br />]]></description>
         <link>http://www.jonathansaggau.com/blog/2010/10/iphone_ipad_devcon_sample_code.html</link>
         <guid>http://www.jonathansaggau.com/blog/2010/10/iphone_ipad_devcon_sample_code.html</guid>
         <category>Technology Love</category>
         <pubDate>Wed, 06 Oct 2010 14:16:33 -0500</pubDate>
      </item>
            <item>
         <title><![CDATA[Mercurial as &uuml;berVCS]]></title>
         <description><![CDATA[I remember a Q&A session during the most recent 360|idev where several of us took to discussing our favorite flavors of version control.  During that discussion I asked whether anyone knew of a sort of &uuml;ber version control system that would allow me to pull code from each of the three most popular version control systems (<a href="http://git-scm.com/">git</a>, <a href="http://mercurial.selenic.com/">mercurial</a>, <a href="http://subversion.apache.org/">subversion</a>).  Given that there is a lot of fantastic code on bitbucket (mercurial), github (git), google code (subversion / mercurial), and elsewhere, we all agreed that it would likely prove very useful to be able to use some overarching version control system to pull up-to-date code from more or less anywhere in a manner similar to the way svn-externals handles pulling subversion-based subprojects into a subversion working copy.
<br /><br />
I have a number of projects using Subversion for version control, a few using Mercurial, and I even maintain a private branch of Three20 using git.  When an external project is using the same version control system as the project itself, life is generally simple.  In the gogoDocs subversion repository, for example, the svn-externals mechanism happily keeps the GData API at a specific revision for me.  Almost all of my projects use code from some other project that uses a "foreign" version control system.  In gogoDocs, where I keep my copy of the GData API close to the bleeding edge, the version of Three20 I'm using is woefully out of date.  The reason for this is pretty simple.  It's difficult to update Three20 because it requires a lot of voodoo to pull the changes from the git repository.  In order to keep Three20 up to date, I would have to keep the .git directory with the Three20 code inside of my working copy, making sure to svn-ignore that directory and never check it in to subversion (I did that once accidentally...not pretty).  If I were to try to update my copy of Three20 with the canonical version on github, I would also have to remember to commit those changes into my own subversion repository.  This always causes some problems on whichever of my other development machines is behind the bleeding edge.  In order to update to the latest Three20 on another development machine, I have to remember to git pull before I svn up or things start to get scary; this means that I have to keep the .git directory in all of my working copies up to date.  What a pain.  Like many programmers, I'm almost inexcusably lazy, so I don't bother.  I need an &uuml;berVCS.
<br /><br />
Here's what I think such an &uuml;berVCS should do:
<ul>
<li>It should be distributed, allowing me to branch and commit locally.  I have lately taken to making atomic local commits and using local branches to experiment and I really miss that workflow when I'm working in svn.  
<li>It should be ubiquitous and familiar.  I don't want to learn another version control system, okay?  I already have three version control systems competing for the mental space that used to hold one.  I really just want one version control system that deals with everything.
<li>It should be able to easily pull subprojects from git, mercurial, and subversion repositories in a manner similar to subversion's svn-externals.
<li>It should allow me to work within those subprojects through plugins or natively so as to avoid the use of "foreign" version control command sets.  In other words, I should be able to use the &uuml;berVCS's command set inside of, for example, a subversion subproject.  Ideally, I could work in one version control system and have subprojects from other version control systems just work somehow.
</ul>
<br /><br />
Using a few plugins, Mercurial can act as The &uuml;berVCS I've been looking for.  It fulfills the first two requirements out of the box.  It's distributed and familiar.  As far as I'm concerned, it acts a lot like a distributed version of Subversion, which is the old(ish) school version control system I'm most familiar with, whereas git feels like it is from someplace like Mars.  Your mileage may vary.
<br /><br />
The third requirement "to easily pull subprojects from git, mercurial, and subversion repositories" can be fulfilled by installing my fork of hgexternals from <a href="http://bitbucket.org/jonmarimba/hgexternals">bitbucket</a>.  It's just a simple merge of the fork from adri (available <a href="http://bitbucket.org/adri/hgexternals">here</a>) with the latest code from the original author of hgexternals available (<a href="http://bitbucket.org/tarek/hgexternals">here</a>).  Once my little fork of hgexternals is installed, you can place an .hgexternals file in the root of your main project and Mercurial will pull code from pretty much anywhere when you run the <em>hg externals</em> command.  If you wanted to pull the gdata objective-c client (google code / Subversion), the hgsubversion project (bit bucket / Mercurial), and mogenerator (github / git) into a contrib subdirectory of your project, you would put the following three lines into your .hgexternals file.
<pre>
./contrib/gdata http://gdata-objectivec-client.googlecode.com/svn/trunk/ svn
./contrib/hgsubversion https://jonmarimba@bitbucket.org/durin42/hgsubversion hg
./contrib/mogenerator http://github.com/rentzsch/mogenerator.git git
</pre>
If you then run <em>hg externals</em> in the project.  You'll see that the subversion, mercurial, and git repositories are checked-out much like subversion handles svn-externals.  <em>Note: Be aware that the hgexternals python scrip will actually run svn or git binaries in a subprocess, so svn and git will have to be installed for this to work properly.</em>  If you wanted to hold the external project to a given revision, which is usually a good idea, you just append the external version control system's usual revision flag.  For example, if you wanted the Gdata Objective-C code pegged at revision 533, the first line in the .hgexternals file would look like this.
<pre>  
./contrib/gdata http://gdata-objectivec-client.googlecode.com/svn/trunk/ svn --revision 533
</pre>
In order to get the hg externals command to act a little more like subversion, you'll want to add the hgexternals.extstatushook to your .hgrc to get the status of the external projects when you type <em>hg stat</em>.  To do this, you add the below to your .hgrc as suggested in the hgexternals installation instructions.
<pre>
[hooks]
post-status = python:hgexternals.extstatushook
</pre>
With a couple of extra plugins, mercurial can pull from subversion and git, in addition to the usual mercurial repositories.  If you prefer to let hgexternals shell out to git or svn (thus requiring you to use git and svn tools within the subprojects themselves), you can stop here.  If you would like to use mercurial commands within all subprojects, regardless of whether they are Mercurial repositories, read on.  Either way, we can now pull subprojects from anywhere and we can also use <em>hg stat</em> as we normally would in the working copy of the project and each subproject status will also be shown.
<br /><br />
Fulfilling the last requirement is actually pretty simple.  Mercurial has third-party plugins that do a fine job of allowing you to use mercurial inside of working copies pulled from git or subversion repositories.  For git, hg-git from <a href="http://hg-git.github.com/">here</a> does the trick.  While you can always use git commands within the mogenerator subproject from the example above, I personally find it easier to avoid switching between different version control systems on the fly. Hg-git lets you to interact with a git repository using mercurial.  In order to do that, we install hg-git and then change the third line in our .hgexternals file to the following.
<pre>
./contrib/mogenerator git://github.com/rentzsch/mogenerator.git hg
</pre>
What we're doing here is telling the mercurial hgexternals extension to pull from the git repository using mercurial itself.  When hg-git is installed, this works with a git-based subproject just as it would with a Mercurial-based project.  Make this edit to .hgexternals, remove the mogenerator directory that was checked-out with git, and rerun <em>hg external</em> command.  Mercurial will now pull mogenerator from github and we can now work within the mogenerator subproject using regular hg commands.
<br /><br />
A similar plugin called hgsubversion, available <a href="http://bitbucket.org/durin42/hgsubversion/overview/">here</a>, allows you to use Mercurial to pull from Subversion repositories.  Just like we did with hg-git, we can install hgsubversion and then change  our .hgexternals file to look like this.
<pre>
./contrib/gdata svn+http://gdata-objectivec-client.googlecode.com/svn/trunk/ hg -r 533
./contrib/hgsubversion https://jonmarimba@bitbucket.org/durin42/hgsubversion hg
./contrib/mogenerator git://github.com/rentzsch/mogenerator.git hg
</pre>
If we remove the gdata subdirectory tha wall pulled using Subversion from contrib and rerun <em>hg external</em> so that Mercurial will now pull it using its hgsubversion plugin, we now have three projects in our contrib directory that Mercurial itself pulled from git, svn, and hg repositories.  With Mercurial plus the addition of a few plugins, we now have an &uuml;ber distributed version control system that makes it much simpler to work with and to update external code from many different sources.]]></description>
         <link>http://www.jonathansaggau.com/blog/2010/10/mercurial_as_bervcs.html</link>
         <guid>http://www.jonathansaggau.com/blog/2010/10/mercurial_as_bervcs.html</guid>
         <category>Notes to self</category>
         <pubDate>Mon, 04 Oct 2010 03:05:02 -0500</pubDate>
      </item>
            <item>
         <title>iPhone / iPad Devcon talks slides</title>
         <description><![CDATA[Hi everybody.  Two talks down, two to go!  Just a quick couple of links to make sure everybody can get to the latest version of all of the slides.  Sample code to follow.  Thanks to everyone who has attended so far; it's been a great turnout.  I'm proud to note that the first talk had a large number of needed overflow chairs going out into the hallway!  You flatter me, San Diego.
<br />
<br />
The latest version of the Augmented Reality talk is <a href="http://www.slideshare.net/jonmarimba/203-is-it-real-or-is-it-virtual-augmented-reality-on-the-iphone/">here</a>.
<br />
<br />
The latest version of the Open Source UI talk is <a href="http://www.slideshare.net/jonmarimba/303-tanstaafl-using-open-source-iphone-ui-code">here</a>.
<br />
<br />
The latest version of the Caching and performance talk is <a href="http://www.slideshare.net/jonmarimba/103-optimizing-data-caching-for-iphone-app-responsiveness">here</a>.
<br />
<br />
The latest version of the touchengine talk is <a href="http://www.slideshare.net/jonmarimba/connecting-apples-iphone-to-googles-cloud">here</a>.
<br />
<br />]]></description>
         <link>http://www.jonathansaggau.com/blog/2010/09/iphone_ipad_devcon_talks_slide.html</link>
         <guid>http://www.jonathansaggau.com/blog/2010/09/iphone_ipad_devcon_talks_slide.html</guid>
         <category></category>
         <pubDate>Tue, 28 Sep 2010 16:38:28 -0500</pubDate>
      </item>
            <item>
         <title>My 2 cents in (hopefully) 5 minutes</title>
         <description><![CDATA[<a href="http://www.iphonedevcon.com"><img src="http://www.jonathansaggau.com/blog/images/saggau_speakerbadge.png" alt="saggau_speakerbadge.png" border="0" width="123" height="257" hspace="16" align="right" /></a>
<p>I'm performing a 5 minute "lightning" talk at the <a href="http://www.iphonedevcon.com">iPad/iPhone DevCon</a> tomorrow and I'm not planning to use slides.  I don't want to burn half of the 5 minutes getting keynote working, but hopefully attendees would like to have some of the links and code I'll reference.  So!  Here are my notes, links, and other such fodder.  There is a lot more than 5 minutes worth of material here as I've been making notes about my habits for the last week or so; this is all of them.  I plan to talk until I run out of air or out of time...
<br /><br />
<h1>Tiny Little Habits for the iOS Dev to Avoid Premature Baldness</h1>

<blockquote>A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines.  </blockquote>
<cite>-- R.W. Emerson  (Essays. First Series. Self-Reliance.)</cite>
<br /><br />
<h3>Here are some consistencies that I think are not foolish.  These little habits have saved me a lot of stupid, often difficult to debug, mistakes.</h3>
When you alloc and init or otherwise instantiate an object that you now own, write the balancing release or autorelease immediately; this includes any IBOutlets and properties.  If it's an IBOutlet, also write the [self setSomeIBOutletProperty:nil] in -viewDidUnload when you write the [someIBOutlet release] in -dealloc.
<h3>Similarly</h3>
When something that is a delegate of something else, in the dealloc I'll tend to perform [somethingElse setDelegate:nil], whether I expect somethingElse to live for a while longer or not, then [somethingElse release]; on the next line. When you write [somethingElse setDelegate:something], write this code right away just like the alloc+init discipline above.  This is one of the reasons I don't like to set delegates in xib files.  It's too easy to mess this up.  Also, I refactor as I work...
<h3>Speaking of delegates and protocols</h3>
When you write a delegate protocol, make absolutely every method optional so you get into the habit of testing if the delegate responds to the selector you're about to call as a matter of course.  You're a lot less likely to mess up the delegate protocol that way.
When you conform to a protocol, copy all (required and optional) methods into your class and comment them out.  Uncomment them as you need to use them.  That way, you don't have to go back and forth to the other class's header file to see if there is a delegate method for some behavior you need to know about.  You have it all at hand.
<h3>Do as little setup work as possible in xibs, they work best for simply putting together UI geometry</h3>
<ul>
<li>Avoid xib file dependencies (<a href="http://weblog.bignerdranch.com/?p=56">See this BNR blog post</a>)
Avoid making view controllers in MainWindow.xib
<ul>
<li>It's easy enough to make 'em in code.  It's easier to know where things come from when you make them in code.
</ul>
<li>Avoid setting delegates in xib files.  Do it in code.
</ul>
<em>I'm not saying not to use xibs, they're useful and they often save time; I am saying to keep the interface builder voodoo to a minimum.</em>
<br /><br />
<h3>Lines of code are (mostly) free</h3>
Self-documenting code is better than heavily commented code and Objc is verbose by tradition; I think this is a good thing.
Debugging code that isn't too nested is much easier.
<pre>[self setFloozle:[floozaWhat whatWithString:[NSString stringWithFormat:@"jeeminy %@ Christmas, %@", frickin, virginiaName]];</pre>
Where you gonna put a breakpoint in that crap?
<br /><br />
When you think you can draw something in code instead of using a static image, try to find the time to implement drawing it in code.  Also, Buy <a href="http://likethought.com/opacity/">Opacity.app</a>.
<ul>
<li>When apple comes out with yet another screen size, you'll be (somewhat more) ready for it.
<li>When you want to change the size of something for some other reason, you don't have to generate a new image.  
<li>You get to figure out how on the green Earth you designer does the crazy things they do in photoshop... only in Quartz.
</ul>
<h3>Speed</h3>
If the profiler doesn't say it's slow, it's not slow.  If the profiler says it's slow, it's slow.  Use the profiler.  
<br>
<em>Note: Shark (sniffle) is dead.  Long live Shark!  They killt it good in iOS 4.0 (no longer runs on the device).
</em><br /><br />
Others' little code bits that are very useful:
<ul>
<li>Red Sweater <a href="http://www.red-sweater.com/blog/279/hexy-little-thing">NSData thing</a> that prints the hex for you
<li><a href="http://wilshipley.com/blog/2005/10/pimp-my-code-interlude-free-code.html">IsEmpty</a> from Wil Shipley with a small addition
<pre>
static inline BOOL IsEmpty(id thing) {
    return thing == nil
    || ([thing isEqual:[NSNull null]]) //My addition for things like coredata
    || ([thing respondsToSelector:@selector(length)]
        && [(NSData *)thing length] == 0)
    || ([thing respondsToSelector:@selector(count)]
        && [(NSArray *)thing count] == 0);
}
</pre>
<li>LogMethod() from Aaron Hillegass
<pre>
//Modified from Aaron hillegass's code
#define LogMethod() NSLog(@"-[%@ %s]", self, _cmd)
</pre>
<li>CPU and Memory tools I use to see what's really going on that I know I stole from a skojillian places, but can't remember who to thank.
<li><a href="http://googlemac.blogspot.com/2010_09_01_archive.html">GTMHTTPFetcher</a> to download stuff (and Google Toolbox for Mac in general)
<li><a href="http://www.neror.com/">Nathan Eror's</a> <a href="http://github.com/neror/CA360">Core</a> <a href="http://github.com/neror/ftutils">Animation</a> Toys.  
</ul>
<h3>Subclassin' -- You stay classy, San Diego</h3>
Subclass less, compose more.
In subclasses, always call super's implementation of a method, even when you just *know* it does nothing.  (I'm thinking of UIViewControllers here).  That way, if you ever do decide to put in an intermediary class between your class and the former superclass, you don't get stuck wondering what happened when those methods no longer get called.
<br /><br />
<h3>Minimize direct access to the internals of your objects</h3>
<em>Yeah, yeah, message send blah blah.  It's not <em>that</em> slow unless you abuse it.</em>
<ul>
<li>Write or synthesize accessors for ivars you want to share.  Also, buy Accessorizer.app
<li>Remember, you can use readonly in a property when appropriate (and it is more often appropriate than you might think).
<li>Mark ivars you don't want messed with as @private.  For srsly.
<li>Make good use of class continuations:
<ul>
<li>to document the internal workings of your objects (If the header is the public documentation, the continuation is the private, implementation documentation)
<li>to suppress "may not respond to" compiler warnings
<li>to expand readonly properties to readwrite status internally
<li>to make a protected methods header file if you want subclasses, but not other users of a class, to use certain of its internal methods.  
<ul>
<li>Import that file in subclasses to suppress compiler warnings.
<li>Makes it easy to delineate private vs. protected vs. public methods
</ul>
</ul>
</ul>
<h3>Know what you're really doing when you use dot syntax</h3>
    I have a weird dot syntax habit, ymmv.  There be message sends in them thar hills.
<br /><br />
<h3>I rarely return nil from something that is expected to return a string, dictionary, an array, or a set</h3>
Instead, I return an empty object of the expected type like so:<pre>
    return @"";
    return [NSArray array];
    return [NSDictionary dictionary];
</pre>
I often use Shipley's IsEmpty() to find out if some object is empty, rather than comparing its pointer to nil.
That way, nil messaging returning nil doesn't bite you in the ass when you're expecting something that is not an NSObject and you don't get that ugly (null) string in your UI.  I <em>hate</em> that.
<br /><br />
<h3>Make a logging method you can turn off and one you really can't; both call through to NSLog</h3>
Also, see the expansion of LogMethod from Aaron Hillegass
<pre>
#define LogMethod() SBLog(@"-[%@ %s]", self, _cmd)
#define WarnMethod() SBWarn(@"-[%@ %s]", self, _cmd)
#define SBWarn NSLog

#ifdef DEBUG
#define SBLog NSLog
#else
#define SBLog    
#endif
</pre>
<h3>Run the static analyzer, but not all the time</h3>
I usually run it: 
<ul>
<li>before a commit to source control
<li>after I make a new class
<li>any time I am alloc'ing a lot of stuff
</ul>
However, I don't find it particularly useful to set the preference that will run it for every compile; For me, the time spent on that adds up quickly. I have a lot of fairly big projects,though. YMMV.
<h3>If your code won't work unless some particular condition is satisfied, NSAssert that condition!</h3>  <em>(Hi Joe P.)</em>
You can turn off asserts in shipping code, if you're a panzy.  I leave 'em on.  I would rather get a crashing bug I can reproduce than one I can't and it's probably gonna crash soon enough...
<br /><br />
NO WARNINGS (and turn on the warning set you can find on the blog the Rentzsch linked to that one time)
<br /><br />
<h3>On External, third party, projects</h3>
<ul>
<li>READ THE CODE 
<li>UNDERSTAND THE CODE
<li>DON'T USE IT UNTIL YOU KNOW HOW IT WORKS (make a little test project to learn it and drop lots of breakpoints)
<li>If it's hard to read, it's probably broken.
<li>I'm on the <a href="http://groups.google.com/group/three20/">three20</a> mailing list; you wouldn't believe some of the questions asked there...
<li>Add external files project relative outside of your project (makes updating the external project easier)
<li>Freeze external projects at a given revision number; update early on between releases:
<ul>
<li>in svn this is done with gtmOauth -r 19 http://gtm-oauth.googlecode.com/svn/trunk in an svn:external
</ul>
<li>Avoid editing external projects directly (makes it hard to merge), instead subclass or make categories to change behavior
<li>When possible, avoid static libraries
<ul>
<li>Too many places where compiler flags are set.
<li>Instead, compile in only those parts you need and their dependencies
<li>I usually add just the top level source file I need and pull in dependencies as the compiler pukes, rinse and repeat until no errors or warnings.
</ul>
</ul>
<h3>Make tiny little test projects for new features</h3>
<ul>
<li>As your codebase grows, new features can present a difficult integration, so split it into two steps
<ul>
<li>1. New Feature
<li>2. Integrate new feature into codebase
<li>3. goto 1
</ul>
</ul>
<h3>If there is any chance that you've got a delayed perform of a selector scheduled, don't forget to cancel those when appropriate</h3>
<pre>
+[NSObject cancelPreviousPerformRequestsWithTarget:]
+[NSObject cancelPreviousPerformRequestsWithTarget:selector:object:]
</pre>
Incolsolata, because menlo makes left square brackets look indented.
<br /><br />
If you have to pick just one: Read <a href="http://mikeash.com/pyblog/">Mike Ash's blog</a>.]]></description>
         <link>http://www.jonathansaggau.com/blog/2010/09/my_2_cents_in_hopefully_5_minu.html</link>
         <guid>http://www.jonathansaggau.com/blog/2010/09/my_2_cents_in_hopefully_5_minu.html</guid>
         <category>Strange habits</category>
         <pubDate>Sun, 26 Sep 2010 22:51:17 -0500</pubDate>
      </item>
            <item>
         <title>I&apos;m giving four (!) classes at iPad/iPhone DevCon</title>
         <description><![CDATA[<a href="http://www.iphonedevcon.com"><img src="http://www.jonathansaggau.com/blog/images/saggau_speakerbadge.png" alt="saggau_speakerbadge.png" border="0" width="123" height="257" hspace="16" align="right" /></a>
<p>The <a href="http://www.iphonedevcon.com">iPad/iPhone DevCon</a> will be held in San Diego from September 27 through 29 and I've been invited to give four classes!  If you put my last name, SAGGAU, in when you register, you will automatically save a hundred bucks ($ 100.00) -- and it's combinable with their other promotional discounts, like Early Bird Specials and so-on.</p>
<p>The conference program at iPhone/iPad DevCon includes more than 40 full-day workshops, half-day workshops and <a href="http://www.iphonedevcon.com/classes.html#2">technical classes</a> over three days &#8211; in addition to keynotes by <a href="http://twitter.com/bmf">Mike Lee</a> and <a href="http://twitter.com/aaronhillegass">Aaron Hillegass</a>.</p>
<h2>CLASS DATES AND TIMES</h2>
My courses are currently scheduled as follows:
<br />
<strong>103  Optimizing Data Caching for iPhone App Responsiveness</strong>
<br />
Tuesday, Sept. 28, 8:30 &mdash; 9:45 am
<br /><br />
<strong>203  Is It Real or Is It Virtual? Augmented Reality on the iPhone</strong> with Jonathan Blocksom (most recently of Google)
<br />
Tuesday, Sept. 28, 11:15 am &mdash; 12:30 pm
<br /><br />
<strong> 
303  TANSTAAFL: Using Open Source iPhone UI Code</strong>
<br />
Tuesday, Sept. 28, 2:00 &mdash; 3:15 pm
<br /><br />
<strong>403 Connecting Apple's iPhone to Google's Cloud</strong> with Noah Gift (of AT&T Interactive)
<br />
Tuesday, Sept. 28, 3:45 &mdash; 5:00 pm

]]></description>
         <link>http://www.jonathansaggau.com/blog/2010/08/im_giving_four_classes_at_ipad.html</link>
         <guid>http://www.jonathansaggau.com/blog/2010/08/im_giving_four_classes_at_ipad.html</guid>
         <category>Troublesome Noise</category>
         <pubDate>Wed, 04 Aug 2010 17:29:40 -0500</pubDate>
      </item>
            <item>
         <title>Another iPhone dev looks at the Android</title>
         <description><![CDATA[About a year ago, I used a G1 dev phone as my primary phone for a few weeks.  It was okay, had a lot of potential, but didn't do it for me like the iPhone did at the time.  I remain curious how the other half lives, so I will soon receive a Nexus One from a good friend of mine via UPS today.  Thanks, dude!  You know who you are.
<br /><br />
I have to mention that I'm apprehensive.  Playing with my neighbor's new Sprint Evo briefly was rather disappointing; Sprint bloatware aside, from a usability and UI standpoint the version of Android on the Evo (2.1, I believe) needs serious detail work to pull even with iOS 2.0.
<br /><br />
I find myself flummoxed as to how anyone manages to use email on the thing.  One can't forward just selected parts of an email (no kidding, all or nothing) and responding to an email inline is not supported.   In both of the two (!) email apps that come on the phone (one for Gmail and one for, um, other email), once received, email text is not malleable.  I love to read the comparisons of Android and iPhone, am glad that Apple has a solid competitor, and am excited to use Android again (and possibly develop software for it) on fast hardware with their latest OS, but right now I'm thinking "make email work, then we'll talk" or, as my neighbor puts it, "This is 2010, right?  Doesn't Google know how to do email?"
<br /><br />
Stay tuned for more Android / iOS comparisons in the coming weeks.  I'm excited to dig in.]]></description>
         <link>http://www.jonathansaggau.com/blog/2010/08/another_iphone_dev_looks_at_th.html</link>
         <guid>http://www.jonathansaggau.com/blog/2010/08/another_iphone_dev_looks_at_th.html</guid>
         <category>Technology Hate</category>
         <pubDate>Wed, 04 Aug 2010 16:58:56 -0500</pubDate>
      </item>
      
   </channel>
</rss>
