<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Sheldon Conaty</title>
	
	<link>http://sheldonconaty.com</link>
	<description>Pursuing the Sublime Web Experience</description>
	<lastBuildDate>Thu, 07 Jan 2010 12:34:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SheldonConaty" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="sheldonconaty" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">SheldonConaty</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Forcing IE to Redraw List Items</title>
		<link>http://sheldonconaty.com/?p=89</link>
		<comments>http://sheldonconaty.com/?p=89#comments</comments>
		<pubDate>Thu, 07 Jan 2010 12:34:20 +0000</pubDate>
		<dc:creator>Sheldon Conaty</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://sheldonconaty.com/?p=89</guid>
		<description><![CDATA[Javascript is essential in allowing developers to tailor an intuitive and accessible experience for users. Web sites are becoming a lot more dynamic and javascript is key to this progression (side note: I&#8217;m not a fan of Flash, it makes my Mac work too hard). However, as usual developers encounter lots of browser interop issues [...]]]></description>
			<content:encoded><![CDATA[<p>Javascript is essential in allowing developers to tailor an intuitive and accessible experience for users. Web sites are becoming a lot more dynamic and javascript is key to this progression (side note: I&#8217;m not a fan of Flash, it makes my Mac work too hard). However, as usual developers encounter lots of browser interop issues &#8211; most of them with Internet Explorer.</p>
<p>Recently I was using javascript to dynamically add extra data to an unordered list item. This worked fine in FireFox and Safari. However, it turns out Internet Explorer 6 &amp; 7 are very intolerant of content being added, or removed, from &lt;li&gt; elements. The problem is they don&#8217;t recognize the list item has resized and therefore don&#8217;t redraw it.</p>
<p>Luckily it is possible to give IE a nudge, so that it redraws the list. To do this you need to dynamically add a new child element to the list&#8230; and then remove it again. Here is an example javascript function, based on Prototype, which does exactly this. This function is now part of my toolbox and I call it after I add extra content to a list item.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/* IE 6 &amp; 7 are very intolerant of extra content being
 * added/removed to &lt;li&gt; elements so a redraw needs to be
 * forced.
 */</span>
<span style="color: #003366; font-weight: bold;">function</span> forceListRedraw<span style="color: #009900;">&#40;</span>listItem<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>Prototype.<span style="color: #660066;">Browser</span>.<span style="color: #660066;">IE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> n <span style="color: #339933;">=</span> document.<span style="color: #660066;">createTextNode</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">' '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      listItem.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      listItem.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      list <span style="color: #339933;">=</span> listItem.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      list.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      list.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://sheldonconaty.com/?feed=rss2&amp;p=89</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Alpha Transparent Favicons on a Mac</title>
		<link>http://sheldonconaty.com/?p=96</link>
		<comments>http://sheldonconaty.com/?p=96#comments</comments>
		<pubDate>Wed, 08 Jul 2009 20:58:31 +0000</pubDate>
		<dc:creator>Sheldon Conaty</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[favicon]]></category>
		<category><![CDATA[gimp]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[transparency]]></category>

		<guid isPermaLink="false">http://sheldonconaty.com/?p=96</guid>
		<description><![CDATA[Normally I use a very old Mac program called IcoMaker to create favicons. The problem with IcoMaker is it can&#8217;t generate alpha transparent ico files. I recently had to design a favicon for StatusHub which was round, so the standard gif level of transparency wasn&#8217;t going to cut it. Time to roll up my sleeves and [...]]]></description>
			<content:encoded><![CDATA[<p>Normally I use a very old Mac program called <a href="http://homepage.mac.com/t_ogihara/software/OSX/icom-eng.html">IcoMaker</a> to create <a href="http://en.wikipedia.org/wiki/Favicon">favicons</a>. The problem with IcoMaker is it can&#8217;t generate alpha transparent ico files. I recently had to design a favicon for <a href="http://statushub.com">StatusHub</a> which was round, so the standard gif level of transparency wasn&#8217;t going to cut it. Time to roll up my sleeves and find some new, hopefully free, software&#8230;</p>
<p>Given that favicons are based on the Windows ico format there aren&#8217;t a huge number of options available to create them on the humble Mac. Most programs claiming to support the ico format don&#8217;t support alpha transparency. For completeness, here are the set of options which don&#8217;t work:</p>
<ul>
<li><a href="http://www.adobe.com/products/fireworks/">Fireworks CS4</a> (my standard tool of choice): it doesn&#8217;t support ico files at all.</li>
<li><a href="http://opensword.org/Pixen/">Pixen</a>: can read/write ico files but can&#8217;t save them with alpha transparency.</li>
<li><a href="http://www.pixelmator.com/">Pixelmator</a>: can open but not save ico files.</li>
<li><a href="http://www.winterdrache.de/freeware/png2ico/">png2ico</a>: unix command line tool which unfortunately doesn&#8217;t compile on Mac OS X.</li>
</ul>
<p>I also tried several online tools like <a href="http://tools.dynamicdrive.com/favicon/">Dynamic Drives Generator</a> and the <a href="http://www.favicon.cc/">favicon.cc generator</a> but they all had problems.</p>
<p>Eventually <a href="http://www.gimp.org/">Gimp</a> came to the rescue. Normally I steer clear of Gimp since I don&#8217;t like the interface but in this area it excelled. If you already have your alpha transparent png file all you need to is open it in Gimp then:</p>
<ul>
<li>Select File &gt; Save As&#8230;</li>
<li>Click on &#8220;Select File Type (By Extension)&#8221;</li>
<li>And select &#8220;Microsoft Windows Icon&#8221; &#8211; ico, its about half way down the list</li>
</ul>
<p>If you are looking for more complete instructions on building a multi-resolution favicon, from scratch in Gimp, then check <a href="http://egressive.com/creating-a-multi-resolution-favicon-microsoft-windows-icon-file-including-transparency-with-the-gimp">David Lane&#8217;s article</a>.</p>
<p>When testing your favicons in Firefox don&#8217;t forget to <a href="http://www.electrictoolbox.com/clear-firefox-cache-clear-favicons/">clear the cache</a> to see your new designs. Note, Firefox is also the best browser to confirm your ico file&#8217;s alpha transparency is working correctly. Safari displays them on a white background while Firefox uses a faded grey background.</p>
]]></content:encoded>
			<wfw:commentRss>http://sheldonconaty.com/?feed=rss2&amp;p=96</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>HTML Editor Control of Choice</title>
		<link>http://sheldonconaty.com/?p=72</link>
		<comments>http://sheldonconaty.com/?p=72#comments</comments>
		<pubDate>Tue, 26 May 2009 20:30:43 +0000</pubDate>
		<dc:creator>Sheldon Conaty</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[wysiwyg]]></category>

		<guid isPermaLink="false">http://sheldonconaty.com/?p=72</guid>
		<description><![CDATA[Surprisingly there are very few decent, open source HTML WYSIWYG editor controls. There are a whole collection of them but most are out of date or way too feature rich and heavy.
I recently required a HTML WYSIWYG editor control for a project I was working on and so spent a couple of hours reviewing and testing [...]]]></description>
			<content:encoded><![CDATA[<p>Surprisingly there are very few decent, open source HTML WYSIWYG editor controls. There are a <a href="http://geniisoft.com/showcase.nsf/WebEditors">whole collection</a> of them but most are out of date or way too feature rich and heavy.</p>
<p>I recently required a HTML WYSIWYG editor control for a project I was working on and so spent a couple of hours reviewing and testing the available options. Here are the few which are actually worth considering.</p>
<h2>1) tinymce, version 3.2.4.1 <small>(<a href="http://tinymce.moxiecode.com/">website</a>)</small></h2>
<p style="padding-left: 30px; ">&#8220;Tiny&#8221;mce weights in at a hefty 176K compressed. It is one of the most popular HTML editor controls around and is quite flexible with plenty of themes and plugins. It also quite active with a new release out every 2-4 months. It was easy enough to get up and running but I found the plug-ins fairly limited and styling it was just too much work. </p>
<h2>2) FCKEditor, version 2.6.4 <small>(<a href="http://www.fckeditor.net/">website</a>)</small></h2>
<p style="padding-left: 30px;">The file size of FCKEditor depends on the browser used to render it. In my tests it came in at about 72K compressed. This is one of the granddaddy HTML editors. It has lots of features and a large web following. Unfortunately I found it just too heavy to work with. The docs weren&#8217;t great and the download, all 1.5MB of it, was so cluttered with features, plugins and skins that it was too difficult to just get something simple going. It has gathered too many features in its life to suit my needs. The team are hard at work on a total rewrite (version 3.0) which may address this.</p>
<h2>3) NicEdit, version 0.9 r23 <small>(<a href="http://nicedit.com/">website</a>)</small></h2>
<p style="padding-left: 30px;">A nice fairly light framework. Depending on which features you want to use it weights in between 25 &#8211; 32K. It uses the <a href="http://www.famfamfam.com/lab/icons/silk/">famfam icon set </a>for its tool bar buttons (I&#8217;m a huge fan of famfam) and so has a nice clean look. As with the FCKEditor and tinymce editors, NicEdit has problems generating semantically clean XHTML. There is an experimental nicXHTML plugin which addresses this. It has known problems but so far it seems to be working fine for my needs.</p>
<p style="padding-left: 30px;">It has some lovely behavior built right in such as auto-expanding the text area to ensure all the content is displayed. No more grippies! Overall I thought NicEdit was well put together.</p>
<h2>4) wysihat, version 0.2 <small>(<a href="http://josh.github.com/wysihat/">website</a>)</small></h2>
<p style="padding-left: 30px;">Built on <a href="http://www.prototypejs.org/">Prototype</a> this library weighs in at 53K (before compression). At the time of writing wysihat is at version 0.2. I had previously worked with 0.1 and the new version does fix a lot of problems. However, it still isn&#8217;t ready for prime time. On Firefox and Safari it works well but IE support lets it down. Having said this wysihat is, in my opinion, the future. It is small, lite and easy to extend. A project I&#8217;m rooting for and definitely one to keep an eye on.</p>
<h2>And the winner is&#8230;</h2>
<p>In the end I went with NicEdit. Its just so much better than the existing heavy weights and wysihat needs some more love before its ready for production. I&#8217;m sure there will be some problems with NicEdit but I feel I&#8217;m starting from a good base. I&#8217;ll keep you updated on how NicEdit holds up as development continues.</p>
]]></content:encoded>
			<wfw:commentRss>http://sheldonconaty.com/?feed=rss2&amp;p=72</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Installing Phusion Passenger on Mac OSX</title>
		<link>http://sheldonconaty.com/?p=58</link>
		<comments>http://sheldonconaty.com/?p=58#comments</comments>
		<pubDate>Fri, 10 Apr 2009 21:09:05 +0000</pubDate>
		<dc:creator>Sheldon Conaty</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[phusion]]></category>
		<category><![CDATA[setup]]></category>

		<guid isPermaLink="false">http://sheldonconaty.com/?p=58</guid>
		<description><![CDATA[Actually this is incredibly easy, assuming you have the gem manager installed (see here if you want instructions).
The phusion installer is excellent. All you need do is open a terminal and enter&#8230;
sudo gem install passenger
sudo passenger-install-apache2-module
Then just follow the on-screen instructions with the following caveats&#8230;
Caveat 1: Adding Phusion to Apache
The install suggests you add the [...]]]></description>
			<content:encoded><![CDATA[<p>Actually this is incredibly easy, assuming you have the gem manager installed (see <a href="http://sheldonconaty.com/?p=7">here</a> if you want instructions).</p>
<p>The phusion installer is excellent. All you need do is open a terminal and enter&#8230;</p>
<pre>sudo gem install passenger</pre>
<pre>sudo passenger-install-apache2-module</pre>
<p>Then just follow the on-screen instructions with the following caveats&#8230;</p>
<h2>Caveat 1: Adding Phusion to Apache</h2>
<p>The install suggests you add the following lines to you apache config (which can be found in /etc/apache2/httpd.conf )</p>
<pre>LoadModule passenger_module /opt/local/lib/ruby/gems/1.8/gems/passenger-2.1.3/ext/apache2/mod_passenger.so
PassengerRoot /opt/local/lib/ruby/gems/1.8/gems/passenger-2.1.3
PassengerRuby /opt/local/bin/ruby</pre>
<p>However, I suggest you add these to a new file in a separate conf file. Create a file with the following name and apache will load it automatically on startup.</p>
<pre>/private/etc/apache2/other/phusion.conf</pre>
<h3>Tip: Restarting Apache</h3>
<p>The phusion install asks that you restart Apache. This can be done using:</p>
<pre>sudo apachectl -k restart</pre>
<h2>Caveat 2: Deploying your Application</h2>
<p>Again the install program is very clear. It says you should add the following to your Apache config</p>
<pre>&lt;VirtualHost *:80&gt;
  ServerName www.yourhost.com
  DocumentRoot /somewhere/public    # &lt;-- be sure to point to 'public'!
&lt;/VirtualHost&gt;</pre>
<p>But remember to remove the comment &#8220;# &lt;&#8211; be sure to point to &#8216;public&#8217;!&#8221; or Apache will display the following error on restarted:</p>
<blockquote><p>DocumentRoot takes one argument, Root directory of the document tree</p></blockquote>
<p>Also, you should add the following after the virtualhost definition.</p>
<pre>&lt;Directory "/somewhere/public"&gt;
  Options ExecCGI FollowSymLinks
  AllowOverride all
  Allow from all
&lt;/Directory&gt;</pre>
<p>This gives Apache access to your Rail app&#8217;s directory, getting rid of any annoying 403 &#8216;access denied&#8217; errors.</p>
<p>That&#8217;s pretty much it. Remember, by default phusion will run your application in production mode. So ensure your database.yml file has a production database configured.</p>
]]></content:encoded>
			<wfw:commentRss>http://sheldonconaty.com/?feed=rss2&amp;p=58</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Migration Helpers</title>
		<link>http://sheldonconaty.com/?p=40</link>
		<comments>http://sheldonconaty.com/?p=40#comments</comments>
		<pubDate>Mon, 30 Mar 2009 21:52:20 +0000</pubDate>
		<dc:creator>Sheldon Conaty</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[migration]]></category>

		<guid isPermaLink="false">http://sheldonconaty.com/?p=40</guid>
		<description><![CDATA[Working on a migration recently I noticed the same set of operations being done repeatedly. My first reaction was to DRY up the code by creating a utility method, within the migration. But I was sure I&#8217;d end up needing this method in future migrations. But the question was, where should I put it?
The answer was [...]]]></description>
			<content:encoded><![CDATA[<p>Working on a migration recently I noticed the same set of operations being done repeatedly. My first reaction was to <a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">DRY</a> up the code by creating a utility method, within the migration. But I was sure I&#8217;d end up needing this method in future migrations. But the question was, where should I put it?</p>
<p>The answer was to create a migration helper!</p>
<p>First, I created lib/migration_help.rb containing the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">module</span> MigrationHelper
  <span style="color:#9966CC; font-weight:bold;">def</span> do_good_stuff<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    say <span style="color:#996600;">&quot;boy, this method will be useful...&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> undo_good_stuff<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    say <span style="color:#996600;">&quot;actually on second thoughts it was stupid...&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Then in my migration I added &#8216;require&#8217; and &#8216;extend&#8217; to import the MigrationHelper module.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;migration_helper&quot;</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> AddNewFeatureColumns <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migration</span>
  extend MigrationHelper
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">up</span>
    do_good_stuff
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span>
    undo_good_stuff
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>And that was it! The helper method names have been changed, to protect the innocent, but you get the idea. Not exactly rocket science but usefully if you need to condense your migrations.</p>
<p>For more information I suggest you check out the excellent discussion on <a href="http://guides.rubyonrails.org/migrations.html">migrations, in the RailsGuides</a>; after reading it I changed all my migration helper &#8216;puts&#8217; statements to &#8217;say&#8217; statements. It nice to get those little details right.</p>
]]></content:encoded>
			<wfw:commentRss>http://sheldonconaty.com/?feed=rss2&amp;p=40</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Git Stash for Quick Patches</title>
		<link>http://sheldonconaty.com/?p=31</link>
		<comments>http://sheldonconaty.com/?p=31#comments</comments>
		<pubDate>Thu, 26 Mar 2009 00:44:26 +0000</pubDate>
		<dc:creator>Sheldon Conaty</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[stash]]></category>

		<guid isPermaLink="false">http://sheldonconaty.com/?p=31</guid>
		<description><![CDATA[For source control management I&#8217;m currently using git, actually my repository is hosted on GitHub (a fantastic service and highly recommended). Git can take a little getting used to but it has several great features that subversion just doesn&#8217;t have. My current favorite is the ability to &#8217;stash&#8217; work-in-progress.
We&#8217;ve all been there; you&#8217;re happily working [...]]]></description>
			<content:encoded><![CDATA[<p>For source control management I&#8217;m currently using <a href="http://git-scm.com/">git</a>, actually my repository is hosted on <a href="https://github.com/">GitHub</a> (a fantastic service and highly recommended). Git can take a little getting used to but it has several great features that <a href="https://subversion.tigris.org">subversion</a> just doesn&#8217;t have. My current favorite is the ability to &#8217;stash&#8217; work-in-progress.</p>
<p>We&#8217;ve all been there; you&#8217;re happily working on the code, halfway through a big change, when someone asks you to quickly fix a bug. Traditionally your only option was to checkout the repository head into another directory so you could make your change there &#8211; without being forced to commit or revert the current changes you were working on. But no longer, &#8216;git stash&#8217; to the rescue!</p>
<p>Now, you can quickly park the work you are doing using&#8230;</p>
<pre style="padding-left: 30px;">git stash</pre>
<p>This will record the current state of the working directory, saving your modifications and reverting the working directory so that it matches the head of the repository. Now you can make the small tweak to fix the bug without losing your changes. The &#8216;git commit&#8217; and &#8216;git push&#8217; the fix as normal. When you are happy the patch is complete type&#8230;</p>
<pre style="padding-left: 30px;">git stash apply</pre>
<p>Now your saved modifications are restored and you can continue adding that great feature you were working on.</p>
<p>Of course if losing your changes wasn&#8217;t a concern you could have used&#8230;</p>
<pre style="padding-left: 30px;">git reset --hard HEAD</pre>
<p>And all your local changes would have been lost, reverting your working copy to the latest repository head.</p>
<h2>Useful Git Resources</h2>
<ul>
<li>Authur Koziel has some great <a href="http://arthurkoziel.com/2008/05/02/git-configuration/">git configuration hints</a>. I love the bash shortcuts, color coding and textmate integration.</li>
<li>GitHub have a handy <a href="http://github.com/guides/git-cheat-sheet">git cheatsheet</a> and if you want to dig deeper there&#8217;s alway the <a href="http://www.kernel.org/pub/software/scm/git/docs/user-manual.html">git user&#8217;s manual</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sheldonconaty.com/?feed=rss2&amp;p=31</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TextMate Trimming &amp; Shortcuts</title>
		<link>http://sheldonconaty.com/?p=17</link>
		<comments>http://sheldonconaty.com/?p=17#comments</comments>
		<pubDate>Tue, 17 Mar 2009 21:54:36 +0000</pubDate>
		<dc:creator>Sheldon Conaty</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[shortcuts]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://sheldonconaty.com/?p=17</guid>
		<description><![CDATA[TextMate is my development environment of choice these days. It supports the concept of bundles as an extension mechanism. Several great bundles are shipped with TextMate and I find they cover most of my needs.
Additional ones can be installed and there are several ones which aid Rails development. For a while I ran RubyAMP but I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://macromates.com/">TextMate</a> is my development environment of choice these days. It supports the concept of bundles as an extension mechanism. Several great bundles are shipped with TextMate and I find they cover most of my needs.</p>
<p>Additional ones can be installed and there are several ones which aid Rails development. For a while I ran <a href="http://code.leadmediapartners.com/">RubyAMP</a> but I found TextMate&#8217;s memory usage went through the roof. So currently I just run the vanilla set.</p>
<h2>Hiding Unwanted Bundles</h2>
<p>I stripped down the bundles which are available in TextMate. It ships with a wide range of bundles which just get in the way when you just want to work with HTML, CSS and Ruby/Rails.</p>
<p>If you want to do the same go to the bundle editor, via the &#8216;Show Bundles&#8217; option in the &#8216;Bundles&#8217; menu and press the &#8216;filter&#8217; button. For full details refer to the <a href="http://manual.macromates.com/en/bundles">bundles manual</a>.</p>
<h2>Useful Keyboard Shortcuts</h2>
<p><strong>Key Modifer Legend:</strong><span>⌘</span> = Command, <span>⌥</span><span> = Option,</span> ^ = Ctrl, <span>⇧</span> = Shift, <span>⎋</span> = Esc, <span>␣</span> = Space, <span>↩</span> = Return/Enter, <span>⇥</span> = Tab</p>
<h3><strong>Global Shortcuts (work on most types of files)</strong></h3>
<ul>
<li>^h    Brings up help on the current word. For example W3C reference help for HTML or Rails Doc for rb files.</li>
<li><span>⌥</span> <span>⎋</span>    Auto complete. Suggests possible attributes, etc. For example type <span>&lt;img </span><span>⌥</span><span> </span><span>⎋</span><span> and a popup with possible attributes appears.</span></li>
<li><span>⇥</span>    Expand snippet. For example in an ruby file, type : and then press tab. This expands to :label =&gt; value.</li>
</ul>
<p><strong>HTML Specific Shortcuts</strong></p>
<ul>
<li><span>⌘</span>&amp;    Pop-up entity/escaping commands menu.</li>
<li><span>⌥⌘</span>.    Insert close tag.</li>
<li><span>⌃</span>&lt;    Make closing/opening tags for word to left of cursor.</li>
<li>^<span>␣</span>    Non breaking space.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sheldonconaty.com/?feed=rss2&amp;p=17</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting up a Mac OS X Rails Dev Environment</title>
		<link>http://sheldonconaty.com/?p=7</link>
		<comments>http://sheldonconaty.com/?p=7#comments</comments>
		<pubDate>Thu, 12 Mar 2009 00:17:22 +0000</pubDate>
		<dc:creator>Sheldon Conaty</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[setup]]></category>

		<guid isPermaLink="false">http://sheldonconaty.com/?p=7</guid>
		<description><![CDATA[These are the general steps I use when setting up a new, clean development environment. This assumes you are using Mac OS X 10.5. If you are on Windows then I&#8217;m very, very sorry (windows isn&#8217;t covered here). Follow all the steps below and you should end up wth:

MacPorts, version 1.600
Ruby, version 1.8.6
Ruby Gems, version [...]]]></description>
			<content:encoded><![CDATA[<p>These are the general steps I use when setting up a new, clean development environment. This assumes you are using Mac OS X 10.5. If you are on Windows then I&#8217;m very, very sorry (windows isn&#8217;t covered here). Follow all the steps below and you should end up wth:</p>
<ul>
<li>MacPorts, version 1.600</li>
<li>Ruby, version 1.8.6</li>
<li>Ruby Gems, version 1.2.0</li>
<li>Rails Gem, version 2.2.2</li>
<li>mySQL, version 5</li>
<li>rspec and rcov for testing&#8230; you are doing <a href="http://en.wikipedia.org/wiki/Test-driven_development">TDD</a> right?</li>
</ul>
<p>Rails moves <em>fast</em>. <span style="text-decoration: line-through;">Version 2.3 is due out very shortly so this post is going to get out of date quick</span>. <em>Update</em>: 2.3.2 is out now, these instructions are still good.</p>
<h2>Installing Ruby</h2>
<p>What do you know! Nothing is required here. Version 1.8.6 is installed by default on Mac OSX 10.5.</p>
<h2>Installing MacPorts &amp; mySQL</h2>
<p>Follow the instructions on <a href="http://www.hennessynet.com/blog/?p=40">Denis&#8217;s blog</a>. You definitely need to install MacPorts. MySQL is only required if that&#8217;s what you will be using. Personally the biggest pain in the neck I have with mySQL is logging in after it has been installed. As a result I change it so that no password is required for root, not matter which localhost alias the login is from. To do this open a terminal window and type the following:</p>
<pre style="padding-left: 30px; ">mysql -u root
use mysql;
update user set password=PASSWORD("") where user='root';
flush privileges;
quit;</pre>
<p>This will set localhost, YourMachine.local and 127.0.0.1 to all require no password.</p>
<h2>Installing FreeImage Port</h2>
<p>Almost all the web applications I&#8217;ve worked on have required some form of image manipulation. Generally to resize images, to do this we need access to the OS level freeimage port. This can be installed using the following:</p>
<pre style="padding-left: 30px; ">sudo port install freeimage</pre>
<h2>Installing Ruby Gems Port</h2>
<p>Using <a href="http://www.rubygems.org/">MacPorts</a> you can install the ruby gems package manager:</p>
<pre style="padding-left: 30px; ">sudo port install rb-rubygems</pre>
<p>If you encounter problems, such as:</p>
<blockquote><p>Error: Target org.macports.activate returned: Image error: /opt/local/bin/gem already exists and does not belong to a registered port.  Unable to activate port rb-rubygems.</p></blockquote>
<p>Then you can force the install:</p>
<pre style="padding-left: 30px; ">sudo port -f install rb-rubygems</pre>
<h2>Patching rspec</h2>
<p>For automated tests I prefer using <a href="http://rspec.info/">rspec</a> instead of the standard unit test framework built into rails. I also like <a href="http://eigenclass.org/hiki.rb?rcov">rcov</a> to give me an idea of how good my code coverage is. There is a known problem with rspec on Ruby 1.8.6 when run in rcov mode. This results in an ugly rb_gc_mark() error. The solution is to install a patched version of rpec</p>
<pre style="padding-left: 30px; ">sudo gem sources -a <a href="http://gems.github.com/">http://gems.github.com
</a>sudo gem install mergulhao-rcov</pre>
<h2>Rails</h2>
<p>Now that the gem system has been installed you can use it to install the rails gem:</p>
<pre style="padding-left: 30px; ">sudo gem install rails
sudo gem install memcache-client
sudo gem install rcov
sudo gem install ruby-debug</pre>
<p>You will then need to install a gem to access the database server. </p>
<h3>For SQLite&#8230;.</h3>
<pre style="padding-left: 30px; ">sudo gem install sqlite3-ruby</pre>
<h3>For MySQL&#8230;.</h3>
<pre style="padding-left: 30px; ">sudo gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5</pre>
<p>Now your machine is all setup for rails development!</p>
<h2>Okay But I have a Project Already</h2>
<p>If you have an existing project you can check it out from <a href="http://github.com/">github</a> (you are using github right?). Now you should have enough system gems installed to let rails install the remaining gems required by the project (see the project&#8217;s environment.rb file for the list). To install the gems automatically:</p>
<pre style="padding-left: 30px;">sudo rake gems:install</pre>
<h2>Create Project&#8217;s Databases</h2>
<p>If you are using mySQL you will need to create production, test and development databases. In the terminal type:</p>
<pre style="padding-left: 30px;">export RAILS_ENV=test
rake db:drop db:create db:migrate
export RAILS_ENV=development
rake db:drop db:create db:migrate
export RAILS_ENV=</pre>
<h2>Testing Your Installation</h2>
<p>Once all the above has been completed you should be at a stage where you can run the development webrick server and the rspec tests. Try the following:</p>
<pre style="padding-left: 30px;">rake db:create:all        # Creates the mysql databases for development, production &amp; test envs
rake db:migrate:reset     # Destroys any existing data and recreates the database structure
rake spec                 # Runs the tests
./script/server           # Starts the web server on port 3000</pre>
<p>The spec command should run the tests and return zero failures. When the server is running you should be able to access the site at <a href="http://localhost:3000">http://localhost:3000/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sheldonconaty.com/?feed=rss2&amp;p=7</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Yet Another Web Design Blog</title>
		<link>http://sheldonconaty.com/?p=3</link>
		<comments>http://sheldonconaty.com/?p=3#comments</comments>
		<pubDate>Wed, 11 Mar 2009 23:28:55 +0000</pubDate>
		<dc:creator>Sheldon Conaty</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://sheldonconaty.com/?p=3</guid>
		<description><![CDATA[So, why am I creating yet another blog? In truth this is more for myself than anyone else. Think of it as a nice handy clipboard of code snippets and thoughts, which I can access from anywhere. If they aid others then all the better.
By profession I&#8217;m a web designer. Web design is very important [...]]]></description>
			<content:encoded><![CDATA[<p>So, why am I creating yet another blog? In truth this is more for myself than anyone else. Think of it as a nice handy clipboard of code snippets and thoughts, which I can access from anywhere. If they aid others then all the better.</p>
<p>By profession I&#8217;m a web designer. Web design is very important to me. I&#8217;m always trying to look at the web experience I create from the user&#8217;s perspective. As web designers we now have a great collection of tools, which we can use to make the user&#8217;s experience even better. My current tools of choice are <a href="http://rubyonrails.org/">Ruby on Rails</a>, <a href="http://www.prototypejs.org/">Prototype</a> &amp; <a href="http://script.aculo.us">Script.aculo.us</a>. In the past they&#8217;ve been Java, ASP.net and C++ but the goal has always been the same, to create a sublime user experience.</p>
<p>In this blog I&#8217;ll be pointing out where sites can benefit from a nip &amp; tuck, laying down some code and giving my opinion on web design generally. I hope you enjoy the ride&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://sheldonconaty.com/?feed=rss2&amp;p=3</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
