<?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>Light Year Blog &#187; Coding</title>
	<atom:link href="http://lightyearsoftware.com/blog/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://lightyearsoftware.com/blog</link>
	<description>Thoughts on Rails, iPhone and software consulting from a Columbus indie developer.</description>
	<lastBuildDate>Fri, 10 Sep 2010 14:53:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>vendor/rails in the Age of Bundler</title>
		<link>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F09%2Fvendorrails-in-the-age-of-bundler%2F&amp;seed_title=vendor%2Frails+in+the+Age+of+Bundler</link>
		<comments>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F09%2Fvendorrails-in-the-age-of-bundler%2F&amp;seed_title=vendor%2Frails+in+the+Age+of+Bundler#comments</comments>
		<pubDate>Thu, 09 Sep 2010 02:46:01 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Ruby & Rails]]></category>

		<guid isPermaLink="false">http://lightyearsoftware.com/blog/?p=298</guid>
		<description><![CDATA[I&#8217;ve only followed the development of Rails 3.0 from a distance, mainly taking note of the major features and goals for the project and mostly ignoring all the little details that go into it. Once the 3.0 release candidate arrived, I started my next internal project with it and have been slowly coming up to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve only followed the development of Rails 3.0 from a distance, mainly taking note of the major features and goals for the project and mostly ignoring all the little details that go into it. Once the 3.0 release candidate arrived, I started my next internal project with it and have been slowly coming up to speed on those little details. One that&#8217;s stymied me for a while is Bundler.</p>
<p>I&#8217;ve been using <tt>vendor/rails</tt> and <tt>vendor/gems</tt> for a while to fix my dependencies to known versions of third-party code. It was easy to do, and the two main drawbacks didn&#8217;t bother me much:</p>
<ol>
<li>Duplication of code in my project&#8217;s repository, making it bigger</li>
<li>Gems with native extensions don&#8217;t work (at least, I never bothered trying to make them work)</li>
</ol>
<p>There is one huge advantage to duplicating this code, though: when the day comes that you hit a bug, you can modify the files in your project, commit them, and move on. With Bundler, it is not obvious how to accomplish this.</p>
<p>Thankfully, what had been missing for me when trying to understand day-to-day use of Bundler now exists: <a href="http://gembundler.com/rationale.html">a rationale for why Bundler works the way it does and how to use it as intended</a>. This answered almost all of my questions about how to use Bundler, and led me to a solution for the last one (how to make a local fix).</p>
<p>To make a local fix (for example, in Rails), what I&#8217;m now doing is pointing my <tt>Gemfile</tt> at a fork of the official repository:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">gem <span style="color:#996600;">'rails'</span>, <span style="color:#ff3333; font-weight:bold;">:git</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'http://git.lightyearsoftware.com/rails.git'</span>, <span style="color:#ff3333; font-weight:bold;">:tag</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'3.0-lys'</span></pre></div></div>

<p>This repository contains a branch, <tt>3.0-lys</tt>, in which I make my local modifications. It also contains a remote, &#8220;upstream&#8221;, which tracks the official Rails repository:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">$ git remote add upstream git://github.com/rails/rails.git</pre></div></div>

<p><tt>3.0-lys</tt> was branched from <tt>v3.0.0</tt>, the tag for the official 3.0 release. Note that I didn&#8217;t branch it from <tt>upstream/3-0-stable</tt> because there are changes on this branch that will eventually be part of 3.0.1. When a new release is made of 3.0.x, I&#8217;ll merge from the tag into <tt>3.0-lys</tt>, keeping it current. Bundler is smart about this, appending a tag to the version number of the &#8220;gem&#8221; it installs:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">$ bundle show
...
  * rails (3.0.0 8b5ee93)
...</pre></div></div>

<p>Bundler shows a lot of promise, and I&#8217;m happy to see the one area that was lacking (documentation) rapidly improving.</p>
]]></content:encoded>
			<wfw:commentRss>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F09%2Fvendorrails-in-the-age-of-bundler%2F&amp;seed_title=vendor%2Frails+in+the+Age+of+Bundler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding &#8220;contrib&#8221; Extensions to MacPorts PostgreSQL</title>
		<link>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F08%2Fadding-contrib-extensions-to-macports-postgresql%2F&amp;seed_title=Adding+%26%238220%3Bcontrib%26%238221%3B+Extensions+to+MacPorts+PostgreSQL</link>
		<comments>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F08%2Fadding-contrib-extensions-to-macports-postgresql%2F&amp;seed_title=Adding+%26%238220%3Bcontrib%26%238221%3B+Extensions+to+MacPorts+PostgreSQL#comments</comments>
		<pubDate>Fri, 06 Aug 2010 02:41:19 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://lightyearsoftware.com/blog/?p=286</guid>
		<description><![CDATA[PostgreSQL is my database of choice. The main reason is that a standard distribution comes with just about everything one could ask for in a free RDBMS, and if what you want isn&#8217;t already installed, it&#8217;s often in the &#8220;contrib&#8221; directory. In particular, now that I&#8217;m doing a lot of iOS development, and location awareness [...]]]></description>
			<content:encoded><![CDATA[<p>PostgreSQL is my database of choice. The main reason is that a standard distribution comes with just about everything one could ask for in a free RDBMS, and if what you want isn&#8217;t already installed, it&#8217;s often in the &#8220;contrib&#8221; directory. In particular, now that I&#8217;m doing a lot of iOS development, and location awareness is a big part of mobile apps, it&#8217;s useful to be able to work with coordinates. PostgreSQL does this using the cube data type and earthdistance functions, both in &#8220;contrib&#8221;.</p>
<p>MacPorts, however, doesn&#8217;t include much of the contents of &#8220;contrib&#8221; in a standard install, including both of these extensions. This makes it a lot harder to develop code using them unless I want to set up a development database on my production server, something I am not eager to do.</p>
<p>Thankfully, there is a solution: disable auto-clean, and after installing the <tt>postgresql83</tt> (or <tt>84</tt>, depending on the version you want), you can install the extra &#8220;contrib&#8221; extensions by hand.</p>
<ol>
<li>Edit <tt>/opt/local/etc/macports/macports.conf</tt> and set <tt>portautoclean</tt> to <tt>no</tt>.</li>
<li>Install PostgreSQL (<tt>sudo port install postgresql83</tt>) or, if you&#8217;ve already installed it, re-install it (<tt>sudo port upgrade --force postgresql83</tt>).</li>
<li>Change into MacPorts working directory: <tt>cd `port work postgresql83`/postgresql-8.3.11/contrib</tt>. Your specific version will differ from mine if you&#8217;re reading this more than a few months after I wrote it.</li>
<li>For each extension you want installed, <tt>cd</tt> into the directory, <tt>make all</tt>, then <tt>sudo make install</tt>. This compiles C code, if any, into a shared library, then copies the library and supporting SQL files (to create types, functions, etc., and also to drop them) to <tt>/opt/local/share/postgresql83/contrib</tt>.</li>
<li>Change into <tt>/opt/local/share/postgresql83/contrib</tt> and run the SQL files associated with the extensions you want. This probably needs to be done as the PostgreSQL super-user. For example, <tt>psql -U postgres dbname &lt;cube.sql</tt>.</li>
<li>Enable auto-clean again by editing <tt>/opt/local/etc/macports/macports.conf</tt> and setting <tt>portautoclean</tt> back to <tt>yes</tt>.</li>
<li>Clean the postgresql83 port: <tt>sudo port clean postgresql83</tt>.
</ol>
]]></content:encoded>
			<wfw:commentRss>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F08%2Fadding-contrib-extensions-to-macports-postgresql%2F&amp;seed_title=Adding+%26%238220%3Bcontrib%26%238221%3B+Extensions+to+MacPorts+PostgreSQL/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic Subversion Revision Stamping for iPhone Projects</title>
		<link>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fautomatic-subversion-revision-stamping-for-iphone-projects%2F&amp;seed_title=Automatic+Subversion+Revision+Stamping+for+iPhone+Projects</link>
		<comments>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fautomatic-subversion-revision-stamping-for-iphone-projects%2F&amp;seed_title=Automatic+Subversion+Revision+Stamping+for+iPhone+Projects#comments</comments>
		<pubDate>Wed, 26 May 2010 14:56:59 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://lightyearsoftware.com/blog/?p=260</guid>
		<description><![CDATA[Early during development of a new iPhone OS application, I discovered that App Store submissions must use a strict format for the CFBundleVersion key in the Info.plist file. It can only be numbers and dots. This left me a little frustrated with how to version pre-1.0 releases to testers. I didn&#8217;t want to use an [...]]]></description>
			<content:encoded><![CDATA[<p>Early during development of a new iPhone OS application, I discovered that App Store submissions must use a strict format for the <tt>CFBundleVersion</tt> key in the <tt>Info.plist</tt> file. It can only be numbers and dots. This left me a little frustrated with how to version pre-1.0 releases to testers. I didn&#8217;t want to use an open-source style &#8220;0.9&#8243; and yet it wasn&#8217;t 1.0. What I really wanted was &#8220;1.0 b1&#8243; or similar.</p>
<p>I stumbled on Daniel Jalkut&#8217;s post about <a href="http://www.red-sweater.com/blog/23/automatic-build-sub-versioning-in-xcode">automatically stamping the Subversion revision into <tt>Info.plist</tt></a> and thought that might be a good way to go. I also created a new key in <tt>Info.plist</tt>, <tt>LYSApplicationDisplayVersion</tt>, that I use as a human-friendly version string, which is where I get my preferred &#8220;1.0 b1&#8243; form. <tt>CFBundleVersion</tt> now takes the form of <em>major.minor.revision</em>, where <em>major</em> and <em>minor</em> are the important parts of the human-friendly version (&#8220;1.0&#8243;) and <em>revision</em> is the Subversion revision number that produced the binary.</p>
<p>I like this method because it solves one problem raised by commenters on Daniel&#8217;s post. Because the Subversion revision is the third component, it doesn&#8217;t matter than r3999 is a mature 1.2 point release and r4000 is a risky pre-2.0 alpha for testers. Those versions end up 1.2.3999 and 2.0.4000 and it&#8217;s clear that they are from two different branches of development. For iPhone Ad Hoc distribution, iTunes also parses the version properly and knows that 1.0.100 is newer than 1.0.95.</p>
<p>Here is the script to paste into your custom script build phase:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Xcode auto-versioning script for Subversion</span>
<span style="color: #666666; font-style: italic;"># by Axel Andersson, modified by Daniel Jalkut to add</span>
<span style="color: #666666; font-style: italic;"># &quot;--revision HEAD&quot; to the svn info line, which allows</span>
<span style="color: #666666; font-style: italic;"># the latest revision to always be used.</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">die</span> <span style="color: #ff0000;">&quot;$0: Must be run from Xcode&quot;</span> <span style="color: #b1b100;">unless</span> <span style="color: #0000ff;">$ENV</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">&quot;BUILT_PRODUCTS_DIR&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Get the current subversion revision number and use it to set the CFBundleVersion value</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$REV</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`/usr/bin/svnversion -n ./`</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$INFO</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;$ENV{BUILT_PRODUCTS_DIR}/$ENV{WRAPPER_NAME}/Info.plist&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$version</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$REV</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># (Match the last group of digits and optional letter M/S/P):</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># ugly yet functional (barely) regex by Daniel Jalkut:</span>
<span style="color: #666666; font-style: italic;">#$version =~ s/([\d]*:)(\d+[M|S]*).*/$2/;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># better yet still functional regex via Kevin &quot;Regex Nerd&quot; Ballard</span>
<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$version</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/(\d+)([MSP]*)$/</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$version</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">die</span> <span style="color: #ff0000;">&quot;$0: No Subversion revision found&quot;</span> <span style="color: #b1b100;">unless</span> <span style="color: #0000ff;">$version</span><span style="color: #339933;">;</span>
<span style="color: #000066;">die</span> <span style="color: #ff0000;">&quot;$0: Modified, switched or partial working copy, you sure about that?&quot;</span> <span style="color: #b1b100;">if</span> <span style="color: #0000ff;">$2</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$ENV</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">&quot;BUILD_STYLE&quot;</span><span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">&quot;Ad Hoc&quot;</span> <span style="color: #339933;">||</span> <span style="color: #0000ff;">$ENV</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">&quot;BUILD_STYLE&quot;</span><span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">&quot;App Store&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span>FH<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;plutil -convert xml1 <span style="color: #000099; font-weight: bold;">\&quot;</span>$INFO<span style="color: #000099; font-weight: bold;">\&quot;</span> -o - |&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">or</span> <span style="color: #000066;">die</span> <span style="color: #ff0000;">&quot;$0: $INFO: $!&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$info</span> <span style="color: #339933;">=</span> <span style="color: #000066;">join</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #009999;">&lt;FH&gt;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">close</span><span style="color: #009900;">&#40;</span>FH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #0000ff;">$info</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/([\t ]+&lt;key&gt;CFBundleVersion&lt;\/key&gt;\n[\t ]+&lt;string&gt;\d+\.\d+).*?(&lt;\/string&gt;)/$1.$version$2/</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span>FH<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;| plutil -convert binary1 - -o <span style="color: #000099; font-weight: bold;">\&quot;</span>$INFO<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">or</span> <span style="color: #000066;">die</span> <span style="color: #ff0000;">&quot;$0: $INFO: $!&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> FH <span style="color: #0000ff;">$info</span><span style="color: #339933;">;</span>
<span style="color: #000066;">close</span><span style="color: #009900;">&#40;</span>FH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>There are a couple of other changes to this script for Subversion 1.5 and later, and for iPhone OS targets.</p>
<p>The first is that the regular expression allows for a trailing P in the Subversion revision. This signals a working copy from a sparse checkout, which I never use and therefore may be a problem. I have the script fail if any letter is appended to the revision when the <tt>BUILD_STYLE</tt> is &#8220;Ad Hoc&#8221; or &#8220;App Store&#8221;, which are two new configurations, cloned from Release, that I use for Ad Hoc and App Store distribution, respectively. Especially for modified working copies: I <em>never</em> want to accidentally hand out a build made from a modified working copy. Should the day come that I really do, I can comment this line out, make the build, and uncomment it again.</p>
<p>The second is that iPhone projects convert <tt>Info.plist</tt> to the binary plist format in the application bundle. In order to extract the existing <tt>CFBundleVersion</tt> key, it must be converted back to XML. When writing the plist back out, it is again converted to binary. Both of these steps use <tt>plutil</tt>, which is part of the Developer Tools.</p>
]]></content:encoded>
			<wfw:commentRss>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fautomatic-subversion-revision-stamping-for-iphone-projects%2F&amp;seed_title=Automatic+Subversion+Revision+Stamping+for+iPhone+Projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby, Threads and RubyCocoa</title>
		<link>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fruby-threads-and-rubycocoa%2F&amp;seed_title=Ruby%2C+Threads+and+RubyCocoa</link>
		<comments>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fruby-threads-and-rubycocoa%2F&amp;seed_title=Ruby%2C+Threads+and+RubyCocoa#comments</comments>
		<pubDate>Mon, 24 May 2010 19:43:50 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Ruby & Rails]]></category>

		<guid isPermaLink="false">http://lightyearsoftware.com/blog/?p=255</guid>
		<description><![CDATA[If you&#8217;re a Rails developer working on Mac OS X 10.6, you may have seen this message: Ruby threads cannot be used in RubyCocoa without patches to the Ruby interpreter It is caused by a plug-in or gem requiring osx/cocoa, frequently attachment_fu. AttachmentFu can use CoreImage as an image processor instead of calling out to [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re a Rails developer working on Mac OS X 10.6, you may have seen this message:</p>
<pre>
Ruby threads cannot be used in RubyCocoa without patches to the Ruby interpreter
</pre>
<p>It is caused by a plug-in or gem requiring <tt>osx/cocoa</tt>, frequently <a href="http://github.com/technoweenie/attachment_fu">attachment_fu</a>. AttachmentFu can use CoreImage as an image processor instead of calling out to an image manipulation library such as ImageMagick or GD2.</p>
<p>The warning is harmless, but it can be very noisy. To disable it, you can simply remove CoreImage from AttachmentFu&#8217;s list of image processors by creating a new file in <tt>config/initializers</tt>. Its contents should be this one line:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">Technoweenie::AttachmentFu</span>.<span style="color:#9900CC;">default_processors</span>.<span style="color:#5A0A0A; font-weight:bold;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'CoreImage'</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Image resize operations will now use one of the other image processors, which you can install from <a href="http://www.macports.org/">MacPorts</a>. I never deploy to a Mac OS X server for production, and I prefer to run as much of the same code as possible in development, so this isn&#8217;t a problem for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fruby-threads-and-rubycocoa%2F&amp;seed_title=Ruby%2C+Threads+and+RubyCocoa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remember HTTP Password in Mobile Safari</title>
		<link>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fremember-http-password-in-mobile-safari%2F&amp;seed_title=Remember+HTTP+Password+in+Mobile+Safari</link>
		<comments>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fremember-http-password-in-mobile-safari%2F&amp;seed_title=Remember+HTTP+Password+in+Mobile+Safari#comments</comments>
		<pubDate>Mon, 03 May 2010 15:39:01 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Ruby & Rails]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://lightyearsoftware.com/blog/?p=250</guid>
		<description><![CDATA[In iPhone OS 3.0, Apple allowed Mobile Safari to save usernames and passwords in web forms. Unfortunately, Safari does not offer to do the same thing for HTTP Basic and Digest authentication. I&#8217;ve become fond of using HTTP authentication because it is very easy to set up, either in your Apache virtual host configuration or [...]]]></description>
			<content:encoded><![CDATA[<p>In iPhone OS 3.0, Apple allowed Mobile Safari to save usernames and passwords in web forms. Unfortunately, Safari does not offer to do the same thing for HTTP Basic and Digest authentication. I&#8217;ve become fond of using HTTP authentication because it is very easy to set up, either in your Apache virtual host configuration or within a Rails application. There are many times that a full-fledged user database is unnecessary for a simple administration back-end.</p>
<p>There is a work-around, though it does mean storing your user and password in plaintext in your device&#8217;s bookmarks. HTTP allows you to supply authentication credentials as part of the URL, in the form <tt>http://username:password@example.com/</tt>.</p>
<p>In the last few days, I&#8217;ve considered building a form-based login for one of my sites, just so I can do basic management from my iPad. I&#8217;m comfortable that since the device rarely leaves the house, and the data on this site is not sensitive, that leaving the password in plaintext in the bookmark is an acceptable trade-off.</p>
]]></content:encoded>
			<wfw:commentRss>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fremember-http-password-in-mobile-safari%2F&amp;seed_title=Remember+HTTP+Password+in+Mobile+Safari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use content_for to Put Markup In Its Place</title>
		<link>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fuse-content_for-to-put-markup%2F&amp;seed_title=Use+content_for+to+Put+Markup+In+Its+Place</link>
		<comments>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fuse-content_for-to-put-markup%2F&amp;seed_title=Use+content_for+to+Put+Markup+In+Its+Place#comments</comments>
		<pubDate>Mon, 03 May 2010 13:00:56 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Ruby & Rails]]></category>

		<guid isPermaLink="false">http://lightyearsoftware.com/blog/?p=244</guid>
		<description><![CDATA[Here is a useful trick for ensuring that you keep your partial templates well organized without sacrificing page-load times or duplicating your layouts unnecessarily. You can use content_for to capture some markup, but have it emitted into the page from somewhere else. Two places this is immediately useful: adding additional tags inside &#60;head&#62; and placing [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a useful trick for ensuring that you keep your partial templates well organized without sacrificing page-load times or duplicating your layouts unnecessarily.</p>
<p>You can use <tt>content_for</tt> to capture some markup, but have it emitted into the page from somewhere else.</p>
<p>Two places this is immediately useful: adding additional tags inside <tt>&lt;head&gt;</tt> and placing in-line Javascript near <tt>&lt;/body&gt;</tt>, while keeping the code itself right next to the DOM elements it works upon.</p>
<p><tt>content_for</tt> works by capturing whatever appears inside the block and storing it for later use. You emit whatever is stored using <tt>yield</tt>. What&#8217;s more, <tt>content_for</tt> doesn&#8217;t clobber the previous captured text if you use it more than once with the same key. </p>
<p>Say you have a fancy Javascript control that replaces a standard <tt>&lt;select&gt;</tt> element in forms. You can do this in your partials:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">&lt;select ...&gt;
  &lt;option&gt;...&lt;/option&gt;
  &lt;option&gt;...&lt;/option&gt;
  ...
&lt;/select&gt;
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#5A0A0A; font-weight:bold;">content_for</span> <span style="color:#ff3333; font-weight:bold;">:body_close</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  &lt;script type=&quot;text/javascript&quot;&gt;
    // code that does something with that &lt;select&gt;
  &lt;/script&gt;
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">&gt;</span></pre></div></div>

<p>And then in your layout, just before the <tt>&lt;/body&gt;</tt>:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#9966CC; font-weight:bold;">yield</span> <span style="color:#ff3333; font-weight:bold;">:body_close</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>Because most browsers will run in-line Javascript upon encountering it, this would delay the execution of the code until all of the page content was loaded, making your page appear to load faster.</p>
<p>What&#8217;s more, if that fancy Javascript control also requires a CSS file, but you don&#8217;t want to require the browser to fetch it on all of the other pages that don&#8217;t need it, you can conditionally add it to <tt>&lt;head&gt;</tt> by defining another <tt>content_for</tt> key that accumulates additional markup to go there:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#5A0A0A; font-weight:bold;">content_for</span> <span style="color:#ff3333; font-weight:bold;">:head</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">stylesheet_link_tag</span> <span style="color:#996600;">'fancy_control'</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>And in your layout:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">&lt;head&gt;
  ...
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#9966CC; font-weight:bold;">yield</span> <span style="color:#ff3333; font-weight:bold;">:head</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
&lt;/head&gt;</pre></div></div>

<p>This is also useful for keeping per-page markup like <tt>&lt;title&gt;</tt> and <tt>meta</tt> tags in the template and out of your controller.</p>
]]></content:encoded>
			<wfw:commentRss>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F05%2Fuse-content_for-to-put-markup%2F&amp;seed_title=Use+content_for+to+Put+Markup+In+Its+Place/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE + Rails Javascript Caching Gotcha</title>
		<link>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F04%2Fie-rails-javascript-caching-gotcha%2F&amp;seed_title=IE+%2B+Rails+Javascript+Caching+Gotcha</link>
		<comments>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F04%2Fie-rails-javascript-caching-gotcha%2F&amp;seed_title=IE+%2B+Rails+Javascript+Caching+Gotcha#comments</comments>
		<pubDate>Fri, 30 Apr 2010 20:02:46 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Ruby & Rails]]></category>

		<guid isPermaLink="false">http://lightyearsoftware.com/blog/?p=240</guid>
		<description><![CDATA[Rails supports a simple method of asset bundling with javascript_include_tag by way of the :cache option: &#60;%= javascript_include_tag 'first', 'second', 'third', :cache =&#62; true %&#62; There&#8217;s a gotcha hiding here that you may not find until you deploy to production and visit your site in IE. Admittedly, this is a bug, but if you happen [...]]]></description>
			<content:encoded><![CDATA[<p>Rails supports a simple method of asset bundling with <tt>javascript_include_tag</tt> by way of the <tt>:cache</tt> option:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">javascript_include_tag</span> <span style="color:#996600;">'first'</span>, <span style="color:#996600;">'second'</span>, <span style="color:#996600;">'third'</span>, <span style="color:#ff3333; font-weight:bold;">:cache</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>There&#8217;s a gotcha hiding here that you may not find until you deploy to production and visit your site in IE.</p>
<p>Admittedly, this is a bug, but if you happen to have a <em>second</em> <tt>javascript_include_tag</tt> with the <tt>:cache</tt> argument in the same page, IE will choke on lots of the script, telling you &#8220;object doesn&#8217;t support this property or method,&#8221; among other things.</p>
<p>The problem is that Rails can&#8217;t resolve multiple tags using the same value for <tt>:cache</tt>, and it emits two <tt>&lt;script&gt;</tt> tags referencing the same Javascript file. IE gets confused by the second one (perhaps loading it twice?). Every other browser I&#8217;ve used handles it fine.</p>
<p>The solution: either don&#8217;t use <tt>:cache</tt> more than once or make sure you use explicit, unique bundle names instead of just <tt>true</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F04%2Fie-rails-javascript-caching-gotcha%2F&amp;seed_title=IE+%2B+Rails+Javascript+Caching+Gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode User Defaults</title>
		<link>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F04%2Fxcode-user-defaults%2F&amp;seed_title=Xcode+User+Defaults</link>
		<comments>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F04%2Fxcode-user-defaults%2F&amp;seed_title=Xcode+User+Defaults#comments</comments>
		<pubDate>Thu, 29 Apr 2010 20:27:22 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://lightyearsoftware.com/blog/?p=237</guid>
		<description><![CDATA[Xcode as a development environment matches my working style fairly well, but there are two things about it that have bothered me. The first is a warning when I try to undo edits across a file save event. Since I have Xcode set up to save all files before a build, this happens often when [...]]]></description>
			<content:encoded><![CDATA[<p>Xcode as a development environment matches my working style fairly well, but there are two things about it that have bothered me. The first is a warning when I try to undo edits across a file save event. Since I have Xcode set up to save all files before a build, this happens often when I try an experiment and don&#8217;t like it.</p>
<p>The second is code completion for language constructs such as <tt>if</tt> statements. Xcode wants to do this:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>condition<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>While I used this style a long time ago, today I want the opening brace on its own line:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>condition<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>No amount of digging in the preferences will provide a way to change these behaviors, however there is a lot of customizability hidden in the <a href="http://developer.apple.com/mac/library/documentation/DeveloperTools/Reference/XcodeUserDefaultRef/100-Xcode%5FUser%5FDefaults/UserDefaultRef.html">Xcode User Defaults</a>. My two issues are solved quite easily:</p>
<pre>
$ defaults write com.apple.Xcode XCShowUndoPastSaveWarning NO
$ defaults write com.apple.Xcode XCCodeSenseFormattingOptions -dict BlockSeparator "\n"
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F04%2Fxcode-user-defaults%2F&amp;seed_title=Xcode+User+Defaults/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Happened to Programming</title>
		<link>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F03%2Fwhat-happened-to-programming%2F&amp;seed_title=What+Happened+to+Programming</link>
		<comments>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F03%2Fwhat-happened-to-programming%2F&amp;seed_title=What+Happened+to+Programming#comments</comments>
		<pubDate>Thu, 11 Mar 2010 02:12:15 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://lightyearsoftware.com/blog/?p=230</guid>
		<description><![CDATA[Last week, Mike Taylor posed the question &#8220;whatever happened to programming?&#8221; (also see his followup). I think part of the answer is simply &#8220;it&#8217;s grown up.&#8221; Programming, either as a hobby or a career, has only been around for a little less than 70 years. (The first was the Colossus, built and used by the [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, Mike Taylor posed the question <a href="http://reprog.wordpress.com/2010/03/03/whatever-happened-to-programming/">&#8220;whatever happened to programming?&#8221;</a> (also see <a href="http://reprog.wordpress.com/2010/03/04/whatever-happened-to-programming-redux-it-may-not-be-as-bad-as-all-that/">his followup</a>). I think part of the answer is simply &#8220;it&#8217;s grown up.&#8221;</p>
<p>Programming, either as a hobby or a career, has only been around for a little less than 70 years. (The first was the <a href="http://en.wikipedia.org/wiki/Colossus_computer">Colossus</a>, built and used by the British during World War II to read encrypted German messages.) This is very young when compared to other scientific fields: agriculture, construction, various engineering disciplines, etc.</p>
<p>I won&#8217;t disagree that building the very fundamental parts of a new application from scratch can be very enjoyable. Perhaps not <tt>printf(3)</tt>, but certainly other parts. The problem is bug rates, though: any seasoned software developer knows that writing less code means less bugs. If high-quality libraries are available that provide 80% of the functionality of your new application, you will likely end up with a better product, in less time, than if you chose to write the entire thing yourself.</p>
<p>Consider the sorry state we&#8217;d be in if:</p>
<p>All farmers experimented with their own methods of weed and pest control (organic or not), instead of using techniques proven to work in the past. Our agriculture industry probably couldn&#8217;t meet the population&#8217;s demand for food.</p>
<p>Architects and builders &#8220;winged it&#8221; when building new homes and office buildings. Bugs in that industry would likely mean structural failure. Who would want to live in those houses?</p>
<p>How about automakers? It&#8217;s one thing to build a kit car as a hobby, it&#8217;s quite another to tinker with your designs when you&#8217;re producing cars on a massive scale for general use (just ask Toyota).</p>
<p>It may not be as glamorous, but if our collective bug count goes down and the software industry ships better products that don&#8217;t require constant patching, I can&#8217;t help but consider this a very good thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F03%2Fwhat-happened-to-programming%2F&amp;seed_title=What+Happened+to+Programming/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>malloc Debugging</title>
		<link>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F01%2Fmalloc-debugging%2F&amp;seed_title=malloc+Debugging</link>
		<comments>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F01%2Fmalloc-debugging%2F&amp;seed_title=malloc+Debugging#comments</comments>
		<pubDate>Tue, 12 Jan 2010 21:39:04 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://lightyearsoftware.com/blog/?p=218</guid>
		<description><![CDATA[Bill Bumgarner posted a nice tutorial on using malloc to debug memory misuse in Cocoa. I&#8217;ve run across these before when reading the malloc(1) man page, but it&#8217;s nice to have a tutorial that shows how to use them in practice.]]></description>
			<content:encoded><![CDATA[<p>Bill Bumgarner posted a nice tutorial on <a href="http://www.friday.com/bbum/2010/01/10/using-malloc-to-debug-memory-misuse-in-cocoa/">using malloc to debug memory misuse in Cocoa</a>. I&#8217;ve run across these before when reading the <tt>malloc(1)</tt> man page, but it&#8217;s nice to have a tutorial that shows how to use them in practice.</p>
]]></content:encoded>
			<wfw:commentRss>http://lightyearsoftware.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Flightyearsoftware.com%2Fblog%2F2010%2F01%2Fmalloc-debugging%2F&amp;seed_title=malloc+Debugging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
