<?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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Web Side Attractions</title>
	
	<link>http://www.websideattractions.com</link>
	<description />
	<pubDate>Thu, 26 Mar 2009 14:08:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
<image>
  <link>http://www.websideattractions.com</link>
  <url>http://www.websideattractions.com/wp-content/favicon.ico</url>
  <title>Web Side Attractions</title>
</image>
		<geo:lat>35.915083</geo:lat><geo:long>-79.029397</geo:long><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/WebSideAttractions" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Ruby AST Tools talk at Raleigh.rb</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/F7p2IfoeSSU/</link>
		<comments>http://www.websideattractions.com/2009/03/26/ruby-ast-tools-talk-at-raleighrb/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 14:08:47 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Talks]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/?p=59</guid>
		<description><![CDATA[Last week I presented at Raleigh.rb (the local Ruby Brigade) on the Ruby AST and the tools that are available to work with it. I went over briefly what the AST is and the 2 mains ways of getting it in Ruby 1.8.x, ParseTree and ruby_parser.

There&#8217;s two types of tools that are generally built on [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I presented at <a href="http://www.meetup.com/raleighrb/" title="The Raleigh-area Ruby Brigade (raleigh.rb) (Raleigh, NC)">Raleigh.rb</a> (the local Ruby Brigade) on the Ruby AST and the tools that are available to work with it. I went over briefly what the AST is and the 2 mains ways of getting it in Ruby 1.8.x, <a href="http://parsetree.rubyforge.org/ParseTree/" title="ParseTree RDoc Documentation">ParseTree</a> and <a href="http://parsetree.rubyforge.org/ruby_parser/" title="ruby_parser RDoc Documentation">ruby_parser</a>.</p>

<p>There&#8217;s two types of tools that are generally built on top of ParseTree: code analytics and custom DSLs. I covered 3 of them <a href="http://seattlerb.rubyforge.org/flog/" title="flog RDoc Documentation">flog</a>, <a href="http://github.com/martinjandrews/roodi" title="martinjandrews's roodi - GitHub">roodi</a>, and <a href="http://defunkt.github.com/ambition/" title="Ruby's Ambition">ambition</a>. The first two being code analytics libraries and the second being a custom DSL.</p>

<p><a href="http://www.slideshare.net/brianjlandau/ruby-ast-tools-1198847" title="Ruby AST Tools">My slides</a> can be found up at SlideShare:</p>

<div style="width:425px;text-align:left" id="__ss_1198847"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/brianjlandau/ruby-ast-tools-1198847?type=presentation" title="Ruby AST Tools">Ruby AST Tools</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=astpresentation-090325181227-phpapp01&#038;rel=0&#038;stripped_title=ruby-ast-tools-1198847" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=astpresentation-090325181227-phpapp01&#038;rel=0&#038;stripped_title=ruby-ast-tools-1198847" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/brianjlandau">Brian Landau</a>.</div></div>

<p>And if you attended you can rate my talk on <a href="http://SpeakerRate.com" title="SpeakerRate">SpeakerRate.com</a>: <a href="http://speakerrate.com/talks/594-ruby-ast-tools" title="Ruby AST Tools | SpeakerRate">http://speakerrate.com/talks/594-ruby-ast-tools</a></p>

<p>And here&#8217;s some more resources for those interested in learning more about the Ruby AST:</p>

<ul>
<li><a href="http://blog.openrain.com/wp-content/uploads/2008/11/hacking-with-ruby2ruby-rubyconf-2008.pdf">Mark Chung&#8217;s slides from his RubyConf2008 talk: &#8220;Hacking with Ruby2Ruby&#8221;</a></li>
<li><a href="http://www.igvita.com/2008/12/11/ruby-ast-for-fun-and-profit/">Ilya Grigorik&#8217;s blog post &#8220;Ruby AST for Fund and Profit&#8221;</a></li>
<li><a href="http://www.slideshare.net/err/goruco" title="Forbidden Fruit: A Taste of Ruby's ParseTree">Chris Wanstrath&#8217;s (aka defunkt) presentation at Goruco 2008 on ParseTree</a></li>
</ul>
<p class="tags">Tags: <a href="http://technorati.com/tag/Ruby" title="See the Technorati tag page for 'Ruby'." rel="tag">Ruby</a>, <a href="http://technorati.com/tag/AST" title="See the Technorati tag page for 'AST'." rel="tag">AST</a>, <a href="http://technorati.com/tag/ParseTree" title="See the Technorati tag page for 'ParseTree'." rel="tag">ParseTree</a>, <a href="http://technorati.com/tag/Programming" title="See the Technorati tag page for 'Programming'." rel="tag">Programming</a>, <a href="http://technorati.com/tag/slides" title="See the Technorati tag page for 'slides'." rel="tag">slides</a>, <a href="http://technorati.com/tag/talks" title="See the Technorati tag page for 'talks'." rel="tag">talks</a>, <a href="http://technorati.com/tag/Raleigh.rb" title="See the Technorati tag page for 'Raleigh.rb'." rel="tag">Raleigh.rb</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=F7p2IfoeSSU:8v_iYhtz04A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=F7p2IfoeSSU:8v_iYhtz04A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=F7p2IfoeSSU:8v_iYhtz04A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=F7p2IfoeSSU:8v_iYhtz04A:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=F7p2IfoeSSU:8v_iYhtz04A:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=F7p2IfoeSSU:8v_iYhtz04A:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/F7p2IfoeSSU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2009/03/26/ruby-ast-tools-talk-at-raleighrb/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2009/03/26/ruby-ast-tools-talk-at-raleighrb/</feedburner:origLink></item>
		<item>
		<title>Use Twimailer and keep your twitter email address.</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/rBX4YvESKxs/</link>
		<comments>http://www.websideattractions.com/2009/03/09/use-twimailer-and-keep-your-twitter-email-address/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 15:25:18 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/?p=46</guid>
		<description><![CDATA[Recently I started using Twimailer to get improved Twitter follow emails. Shortly after @eliah reminded me that people wouldn&#8217;t be able to find me via my email address anymore when using this service.
That seemed like a big Fail to me.

I quickly worked up a hack that gets me both:


Keep your Twitter email address as my [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I started using <a href="http://twimailer.com/" title="Twimailer">Twimailer</a> to get <a href="http://www.readwriteweb.com/archives/twimailer_enhances_twitter_follow_notifications.php" title="Twimailer Enhances Twitter Follow Notifications - ReadWriteWeb">improved Twitter follow emails</a>. Shortly after <a href="http://twitter.com/eliah" title="Eliah Hecht">@eliah</a> reminded me that people wouldn&#8217;t be able to find me via my email address anymore when using this service.<br />
That seemed like a big Fail to me.</p>

<p>I quickly worked up a hack that gets me both:</p>

<ol>
<li>Keep your Twitter email address as my gmail address. </li>
<li>Then add a filter in Gmail that takes all emails from &#8220;<code>twitter-follow-GMAILUSERNAME=gmail.com@postmaster.twitter.com</code>&#8221; (replacing <code>GMAILUSERNAME</code> with your username of course) and with &#8220;following&#8221; in the subject, and archives them, marks them as read, and forwards them to your Twimailer email address.</li>
</ol>

<p><a href="http://www.websideattractions.com/wp-content/uploads/2009/03/twimailer-trick.jpg"><img src="http://www.websideattractions.com/wp-content/uploads/2009/03/twimailer-trick.jpg" alt="Gmail filter to for Twimailer" title="twimailer-gmail-filter" width="750" height="167" class="size-full wp-image-47" /></a></p>

<p>This works perfectly I keep my email address associated with my twitter account and get the enhanced follow emails.</p>

<p>If you don&#8217;t use gmail you could easily adapt this to work with whatever email service you use. You just have to get the service to forward the appropriate emails to the correct email address.</p>

<p><a href="http://twimailer.com/" title="Twimailer">Twimailer</a> is a wonderful service and getting to keep your email address findability on twitter with this trick takes out any negatives from the service leaving just the good stuff.</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/twitter" title="See the Technorati tag page for 'twitter'." rel="tag">twitter</a>, <a href="http://technorati.com/tag/gmail" title="See the Technorati tag page for 'gmail'." rel="tag">gmail</a>, <a href="http://technorati.com/tag/tips" title="See the Technorati tag page for 'tips'." rel="tag">tips</a>, <a href="http://technorati.com/tag/tricks" title="See the Technorati tag page for 'tricks'." rel="tag">tricks</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=rBX4YvESKxs:LV3oIns_V1s:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=rBX4YvESKxs:LV3oIns_V1s:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=rBX4YvESKxs:LV3oIns_V1s:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=rBX4YvESKxs:LV3oIns_V1s:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=rBX4YvESKxs:LV3oIns_V1s:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=rBX4YvESKxs:LV3oIns_V1s:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/rBX4YvESKxs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2009/03/09/use-twimailer-and-keep-your-twitter-email-address/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2009/03/09/use-twimailer-and-keep-your-twitter-email-address/</feedburner:origLink></item>
		<item>
		<title>Facebox for Lowpro</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/QX7oydQGwvo/</link>
		<comments>http://www.websideattractions.com/2008/11/09/facebox-for-lowpro/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 01:28:38 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/?p=41</guid>
		<description><![CDATA[I really like both jQuery and Facebox but sometimes I do need to work with Prototype.

I found a couple of conversions of Facebox for Prototype. After finding these it didn&#8217;t take too much work to convert it to Lowpro.

The usage is simple:

Event.addBehavior({
  'a#fbox' : Facebox
});


The code can be found on GitHub.
]]></description>
			<content:encoded><![CDATA[<p>I really like both jQuery and <a href="http://github.com/defunkt/facebox/tree/master">Facebox</a> but sometimes I do need to work with Prototype.</p>

<p>I found a <a href="http://blog.philburrows.com/articles/2008/05/05/porting-facebox-from-jquery-to-prototype/" title="Porting Facebox from jQuery to Prototype">couple</a> of <a href="http://github.com/robertgaal/facebox-for-prototype/tree/master" title="robertgaal's facebox-for-prototype at master &mdash; GitHub">conversions</a> of Facebox for Prototype. After finding these it didn&#8217;t take too much work to convert it to Lowpro.</p>

<p>The usage is simple:</p>

<pre class="textmate-source _argonaut_"><span class="source source_js source_js_prototype"><span class="support support_class support_class_prototype support_class_prototype_js">Event</span><span class="meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js">.</span>addBehavior<span class="meta meta_brace meta_brace_round meta_brace_round_js">(</span><span class="meta meta_brace meta_brace_curly meta_brace_curly_js">{</span>
<span class="meta meta_leading-tabs"><span class="meta meta_odd-tab meta_odd-tab_group1 meta_odd-tab_group1_spaces">  </span></span><span class="string string_quoted string_quoted_single string_quoted_single_js"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js">'</span>a#fbox<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js">'</span></span> : Facebox
<span class="meta meta_brace meta_brace_curly meta_brace_curly_js">}</span><span class="meta meta_brace meta_brace_round meta_brace_round_js">)</span><span class="punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js">;</span>
</span></pre>

<p>The <a href="http://github.com/brianjlandau/lowpro-fbox/tree/master">code can be found on GitHub</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=QX7oydQGwvo:t-6tRYArV7M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=QX7oydQGwvo:t-6tRYArV7M:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=QX7oydQGwvo:t-6tRYArV7M:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=QX7oydQGwvo:t-6tRYArV7M:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=QX7oydQGwvo:t-6tRYArV7M:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=QX7oydQGwvo:t-6tRYArV7M:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/QX7oydQGwvo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2008/11/09/facebox-for-lowpro/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2008/11/09/facebox-for-lowpro/</feedburner:origLink></item>
		<item>
		<title>Squish the slug the Rails way</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/brN9UmQl5fg/</link>
		<comments>http://www.websideattractions.com/2008/11/06/squish-the-slug-the-rails-way/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 15:42:37 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/?p=39</guid>
		<description><![CDATA[Recently Pat wrote about writing a quick method for making URL slugs. In the spirit of sharing I thought I&#8217;d mention a strategy I use in a number of the Rails apps I work on:



Take this code put it in a file named inflectors.rb in your config/initializers directory, and you&#8217;re good to go.
Tags: ruby, slugs, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently <a href="http://sneaq.net/" title="sneaq">Pat</a> wrote about writing a <a href="http://sneaq.net/salt-on-a-slug" title="Salt on a Slug">quick method for making URL slugs</a>. In the spirit of sharing I thought I&#8217;d mention a strategy I use in a number of the Rails apps I work on:</p>

<script src="http://gist.github.com/22618.js"></script>

<p>Take this code put it in a file named <code>inflectors.rb</code> in your <code>config/initializers</code> directory, and you&#8217;re good to go.</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/ruby" title="See the Technorati tag page for 'ruby'." rel="tag">ruby</a>, <a href="http://technorati.com/tag/slugs" title="See the Technorati tag page for 'slugs'." rel="tag">slugs</a>, <a href="http://technorati.com/tag/URLs" title="See the Technorati tag page for 'URLs'." rel="tag">URLs</a>, <a href="http://technorati.com/tag/rails" title="See the Technorati tag page for 'rails'." rel="tag">rails</a>, <a href="http://technorati.com/tag/activesupport" title="See the Technorati tag page for 'activesupport'." rel="tag">activesupport</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=brN9UmQl5fg:Rw8fVC_m2s4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=brN9UmQl5fg:Rw8fVC_m2s4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=brN9UmQl5fg:Rw8fVC_m2s4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=brN9UmQl5fg:Rw8fVC_m2s4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=brN9UmQl5fg:Rw8fVC_m2s4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=brN9UmQl5fg:Rw8fVC_m2s4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/brN9UmQl5fg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2008/11/06/squish-the-slug-the-rails-way/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2008/11/06/squish-the-slug-the-rails-way/</feedburner:origLink></item>
		<item>
		<title>No Color for Git</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/ig1XYNwhLdM/</link>
		<comments>http://www.websideattractions.com/2008/10/21/no-color-for-git/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 03:52:31 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/?p=37</guid>
		<description><![CDATA[While working with Git recently and git-submodules. I found myself getting an odd error:

error: pathspec '2eed4e6a42d0a50bb6587930659f943f9fae6c44' did not match any file(s) known to git.
Unable to checkout '2eed4e6a42d0a50bb6587930659f943f9fae6c44' in submodule path 'vendor/extensions/file_system'


This normally means you&#8217;ve changed a submodule and not properly handled updating it.

In this case though the repository would check out correctly on other users [...]]]></description>
			<content:encoded><![CDATA[<p>While working with Git recently and git-submodules. I found myself getting an odd error:</p>

<pre><code>error: pathspec '2eed4e6a42d0a50bb6587930659f943f9fae6c44' did not match any file(s) known to git.
Unable to checkout '2eed4e6a42d0a50bb6587930659f943f9fae6c44' in submodule path 'vendor/extensions/file_system'
</code></pre>

<p>This <a href="http://git.or.cz/gitwiki/GitSubmoduleTutorial" title="GitSubmoduleTutorial - GitWiki">normally means</a> you&#8217;ve changed a submodule and not properly handled updating it.</p>

<p>In this case though the repository would check out correctly on other users machines just fine. Odd thing was we were all using the same OS (MacOS X 10.5), the save version of git (1.6.0.1) from the same source (MacPorts), and most of the same external libraries installed via MacPorts. There was no real discernible difference we could find between machines.</p>

<p>After beating our heads enough times and enough fiddling around with my <code>.profile</code>, we found the cause. In my <code>.profile</code> I had the following lines:</p>

<pre><code>GREP_OPTIONS="--color=always"
export GREP_OPTIONS
export GREP_COLOR='1;34;43'
</code></pre>

<p>These lines give me colored grep output which I personally find more useful than the non-colored variant. Problem is git uses grep for all sorts of functionality, and the colored output was throwing it off. The solution was to remove (or comment out) those lines from my .profile.</p>

<p>My problem here is just that if you simply run grep with the option &#8220;<code>--color=never</code>&#8221; the colored output would be disabled, resulting in no problems at all. That being said this clearly seems like a bug in git that will hopefully be fixed soon so I can go back to my colored grep output.</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/git" title="See the Technorati tag page for 'git'." rel="tag">git</a>, <a href="http://technorati.com/tag/grep" title="See the Technorati tag page for 'grep'." rel="tag">grep</a>, <a href="http://technorati.com/tag/color" title="See the Technorati tag page for 'color'." rel="tag">color</a>, <a href="http://technorati.com/tag/submodules" title="See the Technorati tag page for 'submodules'." rel="tag">submodules</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ig1XYNwhLdM:-97LjAEGfDE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ig1XYNwhLdM:-97LjAEGfDE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=ig1XYNwhLdM:-97LjAEGfDE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ig1XYNwhLdM:-97LjAEGfDE:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=ig1XYNwhLdM:-97LjAEGfDE:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ig1XYNwhLdM:-97LjAEGfDE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/ig1XYNwhLdM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2008/10/21/no-color-for-git/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2008/10/21/no-color-for-git/</feedburner:origLink></item>
		<item>
		<title>`is_blank` Function for PHP</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/ZyIxGvK-AQA/</link>
		<comments>http://www.websideattractions.com/2008/03/24/is_blank-function-for-php/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 21:53:12 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2008/03/24/is_blank-function-for-php/</guid>
		<description><![CDATA[One thing I love from Rails is the ability to do a .blank? method on any object. This is infinitely useful when you can&#8217;t be sure what type of value a variable is, or if it can potentially be different types. This is something that I always miss in PHP.  Indeed since form data [...]]]></description>
			<content:encoded><![CDATA[<p>One thing I love from Rails is the ability to do a <a href="http://api.rubyonrails.org/classes/Object.html#M000133" title="Rails API: Class: Object"><code>.blank?</code> method on any object</a>. This is infinitely useful when you can&#8217;t be sure what type of value a variable is, or if it can potentially be different types. This is something that I always miss in PHP.  Indeed since form data always comes back as strings and different ORM&#8217;s and database connectors (PDO, Propel, Doctrine, mysqli, PEAR DB, PEAR MDB2, etc) return different types, having a generic &#8220;is this value essentially blank, null, false, empty&#8221; is important.</p>

<p>A while back I set out to try and duplicate this functionality in a PHP function. Over the course of the past few months I feel it&#8217;s slowly matured and become something extremely valuable that I can&#8217;t live without.</p>

<p>It returns <strong><code>true</code></strong> when ever it is sure a value is blank, and <strong><code>false</code></strong> otherwise. It considers <strong><code>NULL</code></strong>, and <strong><code>false</code></strong> to be blank, and <strong><code>true</code></strong> to be not blank at the start. It then considers integers of <code>0</code> to be blank, and floats of <code>0.0</code> to be blank. It considers any string that is only composed of blank space characters, or &#8220;0&#8243;&#8217;s to be blank. I have considered adding a string of &#8220;false&#8221; or &#8220;null&#8221; but for now I considered this not to be generalizable enough. I feel that a string just of &#8220;0&#8243;&#8217;s almost always counts as a blank value when I&#8217;m processing data, but I could possibly see a string of &#8220;false&#8221; or &#8220;null&#8221; representing a non-blank value.</p>

<p>Then we get to the difficult part, arrays. The function of course regards an empty array as blank, but it will also recursively (this is performed by calling its self) go through all elements and if they are all blank declare the whole array blank.<br />
There is also the special case of Objects that developers wish to be considered enumerable/iterator/array-like objects. These are created by implementing the <a href="http://www.php.net/~helly/php/ext/spl/" title="SPL - Standard PHP Library">SPL iterator interfaces</a>. So the function checks to see if the necessary interfaces are implemented, and if they are treats the object, exactly like it would an array.</p>

<p>The last rule is it considers all other objects to be not blank.</p>

<p>This function can of course be expanded or refined to meet your particular needs. If, for instance, you have a self-defined Null object that you use you get set that to return true. Or if you don&#8217;t want strings with just &#8220;0&#8243; in them to return true, you can change that. The function is very simple and it should be obvious where you change things to get the result you want.</p>

<p>Here&#8217;s the code:</p>

<pre class="textmate-source _argonaut_"><span class="text text_html text_html_basic"><span class="source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html"><span class="meta meta_function meta_function_php"><span class="storage storage_type storage_type_function storage_type_function_php">function</span> <span class="entity entity_name entity_name_function entity_name_function_php">is_blank</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_php">(</span><span class="meta meta_function meta_function_arguments meta_function_arguments_php"><span class="meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php"><span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span></span></span>)</span>{
   <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>type</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="support support_function support_function_type support_function_type_php">gettype</span>(<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span>)<span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
   <span class="keyword keyword_control keyword_control_php">switch</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>type</span>) {
      <span class="keyword keyword_control keyword_control_php">case</span> <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">NULL</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>:
      <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">break</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">case</span> <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">boolean</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>:
      <span class="keyword keyword_control keyword_control_php">if</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span> <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php">===</span> <span class="constant constant_language constant_language_php">false</span>)
         <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">break</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">case</span> <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">integer</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>:
      <span class="keyword keyword_control keyword_control_php">if</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span> <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php">==</span> <span class="constant constant_numeric constant_numeric_php">0</span>)
         <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">break</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">case</span> <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">double</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>:
      <span class="keyword keyword_control keyword_control_php">if</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span> <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php">==</span> <span class="constant constant_numeric constant_numeric_php">0.0</span>)
         <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">break</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">case</span> <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">string</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>:
      <span class="keyword keyword_control keyword_control_php">if</span> (<span class="support support_function support_function_php_pcre support_function_php_pcre_php">preg_match</span>(<span class="string string_regexp string_regexp_single-quoted string_regexp_single-quoted_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'/</span><span class="keyword keyword_operator keyword_operator_regexp keyword_operator_regexp_php">^</span>\s<span class="keyword keyword_operator keyword_operator_regexp keyword_operator_regexp_php">*</span>0<span class="keyword keyword_operator keyword_operator_regexp keyword_operator_regexp_php">*</span>\s<span class="keyword keyword_operator keyword_operator_regexp keyword_operator_regexp_php">*$</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">/'</span></span>, <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span>))
         <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">break</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">case</span> <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">array</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>:
      <span class="keyword keyword_control keyword_control_php">if</span> (<span class="support support_function support_function_array support_function_array_php">count</span>(<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span>) <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php">==</span> <span class="constant constant_numeric constant_numeric_php">0</span>)
      {
         <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      }
      <span class="keyword keyword_control keyword_control_php">else</span> {
         <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>all_blank</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
         <span class="keyword keyword_control keyword_control_php">foreach</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span> <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">as</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>item</span>) {
            <span class="keyword keyword_control keyword_control_php">if</span> (<span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">!</span><span class="meta meta_function-call meta_function-call_php">is_blank</span>(<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>item</span>)){
               <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>all_blank</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="constant constant_language constant_language_php">false</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
            }
         }
         <span class="keyword keyword_control keyword_control_php">if</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>all_blank</span>){
            <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
         } <span class="keyword keyword_control keyword_control_php">else</span> {
            <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">false</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
         }
      }
      <span class="keyword keyword_control keyword_control_php">break</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">case</span> <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">object</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>:
      <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>implements</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="support support_function support_function_php_spl support_function_php_spl_php">class_implements</span>(<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span>)<span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">if</span> (
         <span class="support support_function support_function_array support_function_array_php">in_array</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">ArrayAccess</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>, <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>implements</span>) <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">&amp;&amp;</span> 
      (
         <span class="support support_function support_function_array support_function_array_php">in_array</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">IteratorAggregate</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>, <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>implements</span>)  <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">||</span> 
         <span class="support support_function support_function_array support_function_array_php">in_array</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">Iterator</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>, <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>implements</span>)           <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">||</span> 
         <span class="support support_function support_function_array support_function_array_php">in_array</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">SeekableIterator</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>, <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>implements</span>)   <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">||</span> 
         <span class="support support_function support_function_array support_function_array_php">in_array</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">RecursiveIterator</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>, <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>implements</span>)
         ) <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">&amp;&amp;</span> 
         <span class="support support_function support_function_array support_function_array_php">in_array</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">Countable</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>, <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>implements</span>)
         )
      {
         <span class="keyword keyword_control keyword_control_php">if</span> (<span class="support support_function support_function_array support_function_array_php">count</span>(<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span>) <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php">==</span> <span class="constant constant_numeric constant_numeric_php">0</span>)
         {
            <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
         }
         <span class="keyword keyword_control keyword_control_php">else</span> {
            <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>all_blank</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>

            <span class="keyword keyword_control keyword_control_php">foreach</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span> <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">as</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>item</span>) {
               <span class="keyword keyword_control keyword_control_php">if</span> (<span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">!</span><span class="meta meta_function-call meta_function-call_php">is_blank</span>(<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>item</span>)){
                  <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>all_blank</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="constant constant_language constant_language_php">false</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
               }
            }

            <span class="keyword keyword_control keyword_control_php">if</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>all_blank</span>){
               <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">true</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
            } <span class="keyword keyword_control keyword_control_php">else</span> {
               <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">false</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
            }
         }
      }
      <span class="keyword keyword_control keyword_control_php">break</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">default</span>:
      <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">false</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
      <span class="keyword keyword_control keyword_control_php">break</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
   }
   <span class="keyword keyword_control keyword_control_php">return</span> <span class="constant constant_language constant_language_php">false</span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>
}</span></span></pre>

<p><a href="http://pastie.textmate.org/169940" title="PHP is_blank function">Pastie: http://pastie.textmate.org/169940</a><br />
<a href="http://pastie.textmate.org/pastes/169940/download" title="PHP is_blank function code download">Pastie code download: http://pastie.textmate.org/pastes/169940/download</a></p>
<p class="tags">Tags: <a href="http://technorati.com/tag/PHP" title="See the Technorati tag page for 'PHP'." rel="tag">PHP</a>, <a href="http://technorati.com/tag/blank" title="See the Technorati tag page for 'blank'." rel="tag">blank</a>, <a href="http://technorati.com/tag/code" title="See the Technorati tag page for 'code'." rel="tag">code</a>, <a href="http://technorati.com/tag/programming" title="See the Technorati tag page for 'programming'." rel="tag">programming</a>, <a href="http://technorati.com/tag/null" title="See the Technorati tag page for 'null'." rel="tag">null</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ZyIxGvK-AQA:XwA-YoWdMSY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ZyIxGvK-AQA:XwA-YoWdMSY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=ZyIxGvK-AQA:XwA-YoWdMSY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ZyIxGvK-AQA:XwA-YoWdMSY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=ZyIxGvK-AQA:XwA-YoWdMSY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ZyIxGvK-AQA:XwA-YoWdMSY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/ZyIxGvK-AQA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2008/03/24/is_blank-function-for-php/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2008/03/24/is_blank-function-for-php/</feedburner:origLink></item>
		<item>
		<title>:include_blank =&gt; options</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/Q_xHkR3-B_Y/</link>
		<comments>http://www.websideattractions.com/2008/03/10/include_blank-options/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 02:58:26 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2008/03/10/include_blank-options/</guid>
		<description><![CDATA[So one minor thing I found annoying while working on Heelshousing was that, options_for_select, and options_from_collection_for_select didn&#8217;t accept an option or argument for :include_blank. So I created a little file called &#8220;include&#95;blank&#95;options.rb&#8221; that I threw in my &#8220;config/initializers&#8221; directory. Here&#8217;s the code:

module ActionView::Helpers::FormOptionsHelper
         
   def [...]]]></description>
			<content:encoded><![CDATA[<p>So one minor thing I found annoying while working on Heelshousing was that, <code>options_for_select</code>, and <code>options_from_collection_for_select</code> didn&#8217;t accept an option or argument for <strong><code>:include_blank</code></strong>. So I created a little file called &#8220;include&#95;blank&#95;options.rb&#8221; that I threw in my &#8220;config/initializers&#8221; directory. Here&#8217;s the code:</p>

<pre class="textmate-source _argonaut_"><span class="source source_ruby source_ruby_rails"><span class="meta meta_rails meta_rails_helper"><span class="meta meta_module meta_module_ruby"><span class="keyword keyword_control keyword_control_module keyword_control_module_ruby">module</span> <span class="entity entity_name entity_name_type entity_name_type_module entity_name_type_module_ruby"><span class="entity entity_other entity_other_inherited-class entity_other_inherited-class_module entity_other_inherited-class_module_first entity_other_inherited-class_module_first_ruby">ActionView<span class="punctuation punctuation_separator punctuation_separator_inheritance punctuation_separator_inheritance_ruby">::</span></span><span class="entity entity_other entity_other_inherited-class entity_other_inherited-class_module entity_other_inherited-class_module_second entity_other_inherited-class_module_second_ruby">Helpers<span class="punctuation punctuation_separator punctuation_separator_inheritance punctuation_separator_inheritance_ruby">::</span></span>FormOptionsHelper</span></span>
         
   <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">options_for_select_with_include_blank</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">container<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> selected <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="constant constant_language constant_language_ruby">nil</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> include_blank <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="constant constant_language constant_language_ruby">false</span></span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      options <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> options_for_select_without_include_blank<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>container<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> selected<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      <span class="keyword keyword_control keyword_control_ruby">if</span> include_blank
         options <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>&lt;option value=<span class="constant constant_character constant_character_escape constant_character_escape_ruby">\"\"</span>&gt;<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>include_blank <span class="keyword keyword_control keyword_control_ruby">if</span> include_blank<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>kind_of?<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="variable variable_other variable_other_constant variable_other_constant_ruby">String</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span>&lt;/option&gt;<span class="constant constant_character constant_character_escape constant_character_escape_ruby">\n</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span> <span class="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby">+</span> options
      <span class="keyword keyword_control keyword_control_ruby">end</span>
      options
   <span class="keyword keyword_control keyword_control_ruby">end</span>
   <span class="support support_function support_function_activesupport support_function_activesupport_rails">alias_method_chain</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>options_for_select</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>include_blank</span>
   
   <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">options_from_collection_for_select_with_include_blank</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">collection<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> value_method<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> text_method<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> selected <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="constant constant_language constant_language_ruby">nil</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> include_blank <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="constant constant_language constant_language_ruby">false</span></span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      options <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> options_from_collection_for_select_without_include_blank<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>collection<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> value_method<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> text_method<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> selected<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      <span class="keyword keyword_control keyword_control_ruby">if</span> include_blank
         options <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>&lt;option value=<span class="constant constant_character constant_character_escape constant_character_escape_ruby">\"\"</span>&gt;<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>include_blank <span class="keyword keyword_control keyword_control_ruby">if</span> include_blank<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>kind_of?<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="variable variable_other variable_other_constant variable_other_constant_ruby">String</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span>&lt;/option&gt;<span class="constant constant_character constant_character_escape constant_character_escape_ruby">\n</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span> <span class="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby">+</span> options
      <span class="keyword keyword_control keyword_control_ruby">end</span>
      options
   <span class="keyword keyword_control keyword_control_ruby">end</span>
   <span class="support support_function support_function_activesupport support_function_activesupport_rails">alias_method_chain</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>options_from_collection_for_select</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>include_blank</span>
   
</span><span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p class="tags">Tags: <a href="http://technorati.com/tag/ruby" title="See the Technorati tag page for 'ruby'." rel="tag">ruby</a>, <a href="http://technorati.com/tag/rails" title="See the Technorati tag page for 'rails'." rel="tag">rails</a>, <a href="http://technorati.com/tag/programming" title="See the Technorati tag page for 'programming'." rel="tag">programming</a>, <a href="http://technorati.com/tag/code" title="See the Technorati tag page for 'code'." rel="tag">code</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=Q_xHkR3-B_Y:T_m13-2W6no:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=Q_xHkR3-B_Y:T_m13-2W6no:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=Q_xHkR3-B_Y:T_m13-2W6no:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=Q_xHkR3-B_Y:T_m13-2W6no:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=Q_xHkR3-B_Y:T_m13-2W6no:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=Q_xHkR3-B_Y:T_m13-2W6no:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/Q_xHkR3-B_Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2008/03/10/include_blank-options/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2008/03/10/include_blank-options/</feedburner:origLink></item>
		<item>
		<title>New Release of UJS Date-Picker Rails Plugin</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/6Hd7CbUTs2k/</link>
		<comments>http://www.websideattractions.com/2008/03/08/new-release-of-ujs-date-picker-rails-plugin/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 03:53:10 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2008/03/08/new-release-of-ujs-date-picker-rails-plugin/</guid>
		<description><![CDATA[I&#8217;ve now updated my date-picker Rails plugin based on Brian McAllister&#8217;s Unobtrusive Date-Picker Widget. It now includes helper methods for making selects that wrap a ActiveRecord model object, or just a date/time value. It also includes many more options, mostly offering pragmatic ways of adding the options available to controlling the date-picker widget through html [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve now updated <a href="http://code.google.com/p/rails-unobtrusive-date-picker/" title="Unobtrusive Javascript Date-Picker Plugin">my date-picker Rails plugin</a> based on <a href="http://www.frequency-decoder.com/" title="frequency decoder">Brian McAllister&#8217;s</a> <a href="http://www.frequency-decoder.com/2006/10/02/unobtrusive-date-picker-widgit-update" title="frequency decoder ~ Unobtrusive Date-Picker Widget Update">Unobtrusive Date-Picker Widget</a>. It now includes helper methods for making selects that wrap a ActiveRecord model object, or just a date/time value. It also includes many more options, mostly offering pragmatic ways of adding the options available to controlling the date-picker widget through html classes.</p>

<p>I&#8217;ve also created a large number of specs (with <a href="http://rspec.info/">RSpec</a>) for testing the plugin. Amazingly, testing plugins is actually really hard task, which I&#8217;ll probablly cover in a future post.</p>

<p>I&#8217;ve created a <a href="http://code.google.com/p/rails-unobtrusive-date-picker/wiki/UsageGuideAndExample">wiki page for Documentation</a> and updated the <a href="http://www.websideattractions.com/projects/unobtrusive-date-picker/rdoc/" title="Unobtrusive Date-Picker">RDoc&#8217;s</a>.</p>

<p>If your using the plugin, and have any questions or concerns, or bug reports feel free to contact me.</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/rails" title="See the Technorati tag page for 'rails'." rel="tag">rails</a>, <a href="http://technorati.com/tag/ruby" title="See the Technorati tag page for 'ruby'." rel="tag">ruby</a>, <a href="http://technorati.com/tag/plugin" title="See the Technorati tag page for 'plugin'." rel="tag">plugin</a>, <a href="http://technorati.com/tag/datepicker" title="See the Technorati tag page for 'datepicker'." rel="tag">datepicker</a>, <a href="http://technorati.com/tag/ujs" title="See the Technorati tag page for 'ujs'." rel="tag">ujs</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=6Hd7CbUTs2k:KA4ZcMhCP-U:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=6Hd7CbUTs2k:KA4ZcMhCP-U:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=6Hd7CbUTs2k:KA4ZcMhCP-U:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=6Hd7CbUTs2k:KA4ZcMhCP-U:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=6Hd7CbUTs2k:KA4ZcMhCP-U:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=6Hd7CbUTs2k:KA4ZcMhCP-U:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/6Hd7CbUTs2k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2008/03/08/new-release-of-ujs-date-picker-rails-plugin/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2008/03/08/new-release-of-ujs-date-picker-rails-plugin/</feedburner:origLink></item>
		<item>
		<title>Converting Video to Flash in Rails</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/ca_L7d6eq5w/</link>
		<comments>http://www.websideattractions.com/2008/03/07/converting-video-to-flash-in-rails/#comments</comments>
		<pubDate>Sat, 08 Mar 2008 02:42:58 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2008/03/07/converting-video-to-flash-in-rails/</guid>
		<description><![CDATA[Video is fairly prevalent on the web these days with services like YouTube, and Joost. And indeed one the features that our client (the Daily Tar Heel) wanted for HeelsHousing was to have a video tour of properties.

I wanted to take the YouTube model and allow property owners to upload videos in any format they [...]]]></description>
			<content:encoded><![CDATA[<p>Video is fairly prevalent on the web these days with services like <a href="http://www.youtube.com/">YouTube</a>, and <a href="http://www.joost.com/" title="Joost - Free online TV - Comedy, cartoons, sports, music and more - Download today">Joost</a>. And indeed one the features that our client (<a href="http://www.dailytarheel.com/" title="Daily Tar Heel">the Daily Tar Heel</a>) wanted for <a href="http://www.heelshousing.com/">HeelsHousing</a> was to have a video tour of properties.</p>

<p>I wanted to take the YouTube model and allow property owners to upload videos in any format they had them in and for us to show them in Flash video so that as many users as possible would be able to view it. So I set out constructing the process via which this would occur.<br />
It would start out with a user uploading a video. The file would be moved to a temporary location (although a <code>Tempfile</code> object could not be used as these files get deleted automatically, i.e. before the background process would get to it). This path would have to be saved, and status value given. Then a background process would have to be passed this information to convert the movie, make a preview image, and upload both to Amazon S3, then saving the record as finished. Additionally, this background process would need to notify the property owner if either an error processing the video occurred or it had been successfully converted and uploaded.</p>

<p>The video model class I created is very similar in many ways to the functionality offered by the <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment fu plugin</a>. It handles taking the uploaded file and moving it to a temporary location, it deletes the files when the record is deleted, it keeps track of the preview image and video file paths on S3. It also has a status attribute for the different statuses a video can have: queued, processing, ready, and failed.</p>

<p>The most complicated part of the whole process is how to handle the file once it&#8217;s been uploaded and temporarily stored. This needs to be handled by a background process, for Rails the obvious choice is the <a href="http://backgroundrb.rubyforge.org/" title="Introduction BackgrounDRb">BackgrounDRb plugin</a>. The background worker I created starts by grabbing the related video record, and sets it&#8217;s status to &#8220;processing&#8221;. It then uses the <a href="http://rvideo.rubyforge.org/" title="Ruby Video Processing">RVideo library</a>, which in turn uses <a href="http://ffmpeg.mplayerhq.hu/" title="FFmpeg">ffmpeg</a> and <a href="http://www.inlet-media.de/flvtool2" title=" Flash video and meta data manipulation">flvtool2</a>, to scale the movie and convert it to flash video. Finally, it uses RVideo to make a preview jpeg image, and uploads both to S3.<br />
If anywhere along the way an error occurs the video record&#8217;s status is set to &#8220;failed&#8221; and a notification email is sent to both the property owner and the administrator using ActionMailer. On the other hand if the whole process succeeds the worker sends an email to the property owner only, and marks the video record as &#8220;ready&#8221;.</p>

<p>The last step was to display the video on a given page. To do this I used <a href="http://blog.deconcept.com/swfobject/" title="SWFObject: Javascript Flash Player detection and embed script">SWFObject</a> and the <a href="http://jeroenwijering.com/?item=JW_FLV_Player">JW FLV Media Player</a>. I created a simple helper to create the SWFObject javascript for the video.</p>

<p>All of the external libraries I can say were very easy to work with, and made creating this functionality much easier. But the one I loved the most was <a href="https://rubyforge.org/projects/rvideo/">RVideo</a>. This library is a little gem for anyone wanting to script out ffmpeg or flvtool2 commands in Ruby. I highly recommend it.</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/Flash" title="See the Technorati tag page for 'Flash'." rel="tag">Flash</a>, <a href="http://technorati.com/tag/video" title="See the Technorati tag page for 'video'." rel="tag">video</a>, <a href="http://technorati.com/tag/rails" title="See the Technorati tag page for 'rails'." rel="tag">rails</a>, <a href="http://technorati.com/tag/ruby" title="See the Technorati tag page for 'ruby'." rel="tag">ruby</a>, <a href="http://technorati.com/tag/backgroundrb" title="See the Technorati tag page for 'backgroundrb'." rel="tag">backgroundrb</a>, <a href="http://technorati.com/tag/flv" title="See the Technorati tag page for 'flv'." rel="tag">flv</a>, <a href="http://technorati.com/tag/swfobject" title="See the Technorati tag page for 'swfobject'." rel="tag">swfobject</a>, <a href="http://technorati.com/tag/rvideo" title="See the Technorati tag page for 'rvideo'." rel="tag">rvideo</a>, <a href="http://technorati.com/tag/webdeb" title="See the Technorati tag page for 'webdeb'." rel="tag">webdeb</a>, <a href="http://technorati.com/tag/ffmpeg" title="See the Technorati tag page for 'ffmpeg'." rel="tag">ffmpeg</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ca_L7d6eq5w:3v4Cv6gqbW0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ca_L7d6eq5w:3v4Cv6gqbW0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=ca_L7d6eq5w:3v4Cv6gqbW0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ca_L7d6eq5w:3v4Cv6gqbW0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=ca_L7d6eq5w:3v4Cv6gqbW0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ca_L7d6eq5w:3v4Cv6gqbW0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/ca_L7d6eq5w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2008/03/07/converting-video-to-flash-in-rails/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2008/03/07/converting-video-to-flash-in-rails/</feedburner:origLink></item>
		<item>
		<title>Customizing ActiveScaffold</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/SSchnV7oIIA/</link>
		<comments>http://www.websideattractions.com/2008/03/04/customizing-activescaffold/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 02:26:03 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2008/03/04/customizing-activescaffold/</guid>
		<description><![CDATA[At first I was a little skeptical about the ability of ActiveScaffold to really do everything I needed to do, and not involve massive amounts of hacking apart the code. It actually turned out to be fairly easy and offered a great solution for some of the administrative side of HeelsHousing.

First off while not very [...]]]></description>
			<content:encoded><![CDATA[<p>At first I was a little skeptical about the ability of <a href="http://activescaffold.com/">ActiveScaffold</a> to really do everything I needed to do, and not involve massive amounts of hacking apart the code. It actually turned out to be fairly easy and offered a great solution for some of the administrative side of <a href="http://www.heelshousing.com/">HeelsHousing</a>.</p>

<p>First off while not very well documented in my opinion is the ability of rails to have and understand sub controllers, such as the URI &#8220;/admin/users&#8221; which would be the controller in &#8220;app/controllers/admin/users_controller.rb&#8221;. To do this just requires some code like this:</p>

<p><strong>app/controllers/admin_controller.rb</strong></p>

<pre class="textmate-source _argonaut_"><span class="source source_ruby source_ruby_rails"><span class="meta meta_rails meta_rails_controller"><span class="meta meta_class meta_class_ruby"><span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">AdminController<span class="entity entity_other entity_other_inherited-class entity_other_inherited-class_ruby"> <span class="punctuation punctuation_separator punctuation_separator_inheritance punctuation_separator_inheritance_ruby">&lt;</span> ApplicationController</span></span></span>
   …
</span><span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="meta meta_module meta_module_ruby"><span class="keyword keyword_control keyword_control_module keyword_control_module_ruby">module</span> <span class="entity entity_name entity_name_type entity_name_type_module entity_name_type_module_ruby">Admin</span></span>
<span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>

<p><strong>app/controllers/admin/user_controller.rb</strong></p>

<pre class="textmate-source _argonaut_"><span class="source source_ruby source_ruby_rails"><span class="meta meta_rails meta_rails_controller"><span class="meta meta_class meta_class_ruby"><span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Admin::UsersController<span class="entity entity_other entity_other_inherited-class entity_other_inherited-class_ruby"> <span class="punctuation punctuation_separator punctuation_separator_inheritance punctuation_separator_inheritance_ruby">&lt;</span> AdminController</span></span></span>

   active_scaffold <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>user</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do </span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span><span class="variable variable_other variable_other_block variable_other_block_ruby">config</span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span>
      …
   <span class="keyword keyword_control keyword_control_ruby">end</span>

</span><span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>

<p>Of course the main thing we wanted to do was to style it to match other administrative interfaces we were using. In case you don&#8217;t know already the ActiveScaffold team really thought ahead on this one and allows customization at pretty much every level. For sweaping changes that effect style most likely you&#8217;re looking at <a href="http://activescaffold.com/docs/template-overrides" title="ActiveScaffold  :: Template Overrides">Template Overrides</a>. Since we were looking to have all administrative forms look the same we just had to provide new template in the &#8220;app/views/active&#95;scaffold&#95;overrides/&#8221; directory. The templates that I found were needed for really doing what I we needed to do to change the look of the forms were the &#8220;&#95;form.rhtml&#8221;, &#8220;&#95;form&#95;association.rhtml&#8221;, &#8220;&#95;form&#95;association&#95;record.rhtml&#8221;, and &#8220;&#95;form&#95;attribute.rhtml&#8221; templates.</p>

<p>Of course you also often want to change the specifics of how a specific form input is generated for a given column is generated. And for this there&#8217;s <a href="http://activescaffold.com/docs/form-overrides" title="ActiveScaffold  :: Form Overrides">Form Overrides</a>. These are just little helpers in the helper file for the given controller. So say you want to change the type of input used for your password column on the User form, just add a method called &#8220;<code>password\_form
\_column</code>&#8221; in the &#8220;user.helper.rb&#8221; file.<br />
But let&#8217;s say you want to change <em>all</em> columns that are <code>strings</code> to function in a specific way, like say setting the <code>size</code> and <code>maxlength</code> attributes, well here ya go:</p>

<pre class="textmate-source _argonaut_"><span class="source source_ruby source_ruby_rails"><span class="support support_class support_class_ruby">Article</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>columns<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>each <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do </span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span><span class="variable variable_other variable_other_block variable_other_block_ruby">column</span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span>
   <span class="keyword keyword_control keyword_control_ruby">if</span> column<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>type <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">==</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>string</span>
      size <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>column<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>limit <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">&gt;</span> <span class="constant constant_numeric constant_numeric_ruby">59</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">?</span> <span class="constant constant_numeric constant_numeric_ruby">60</span> <span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">:</span> column<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>limit <span class="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby">+</span> <span class="constant constant_numeric constant_numeric_ruby">1</span>
      src <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="string string_unquoted string_unquoted_heredoc string_unquoted_heredoc_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">&lt;&lt;-end_src</span>
         def <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>column<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>name<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span>_form_column(record, input_name)
            text_field(:record, '<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>column<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>name<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span>', :size =&gt; <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>size<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span>, :maxlength =&gt; <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>column<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>limit<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span>, :name =&gt; input_name)
         end
<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">      end_src</span></span>
      class_eval src<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="variable variable_language variable_language_ruby">__FILE__</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="variable variable_language variable_language_ruby">__LINE__</span>
   <span class="keyword keyword_control keyword_control_ruby">end</span>
<span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>

<p>Well there&#8217;s really lots more I could cover about active scaffold but I&#8217;ll let you sophisticats check it out for yourself. The documentation is top notch. All in all a great addition to your Rails toolbox.</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/ruby" title="See the Technorati tag page for 'ruby'." rel="tag">ruby</a>, <a href="http://technorati.com/tag/rails" title="See the Technorati tag page for 'rails'." rel="tag">rails</a>, <a href="http://technorati.com/tag/programming" title="See the Technorati tag page for 'programming'." rel="tag">programming</a>, <a href="http://technorati.com/tag/code" title="See the Technorati tag page for 'code'." rel="tag">code</a>, <a href="http://technorati.com/tag/ActiveScaffold" title="See the Technorati tag page for 'ActiveScaffold'." rel="tag">ActiveScaffold</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=SSchnV7oIIA:iLSyIJiGtGk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=SSchnV7oIIA:iLSyIJiGtGk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=SSchnV7oIIA:iLSyIJiGtGk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=SSchnV7oIIA:iLSyIJiGtGk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=SSchnV7oIIA:iLSyIJiGtGk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=SSchnV7oIIA:iLSyIJiGtGk:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/SSchnV7oIIA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2008/03/04/customizing-activescaffold/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2008/03/04/customizing-activescaffold/</feedburner:origLink></item>
		<item>
		<title>My Server, Your Server, We All Shouldn’t Share a Server</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/197Df9EVJu4/</link>
		<comments>http://www.websideattractions.com/2008/03/01/my-server-your-server-we-all-shouldnt-share-a-server/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 23:03:13 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2008/03/01/my-server-your-server-we-all-shouldnt-share-a-server/</guid>
		<description><![CDATA[When Heelshousing began, the company I work for had never deployed a Rails app before. We decided after much thought, that RailsMachine would be a good fit for us. Through out they way they&#8217;ve been a great service, especially for someone like me who didn&#8217;t have a lot of experience setting up and maintaining a [...]]]></description>
			<content:encoded><![CDATA[<p>When <a href="http://www.heelshousing.com/">Heelshousing</a> began, the company I work for had never deployed a Rails app before. We decided after much thought, that <a href="http://railsmachine.com/" title="Ruby on Rails hosting">RailsMachine</a> would be a good fit for us. Through out they way they&#8217;ve been a great service, especially for someone like me who didn&#8217;t have a lot of experience setting up and maintaining a server.</p>

<p>But of course like with anything else I decided the &#8220;basic&#8221; setup needed to be customized. I started by building and installing the <a href="http://brainspl.at/articles/2007/11/09/a-fair-proxy-balancer-for-nginx-and-mongrel" title="A Fair Proxy Balancer for Nginx and Mongrel">nginx server with the Fair Proxy Balancer module</a>, and set up appropriate logrotate and init.d scripts for it.<br />
I then decided, based on numerous <a href="http://brainspl.at/articles/2007/05/12/event-driven-mongrel-and-swiftiply-proxy" title="Event Driven Mongrel and Swiftiply Proxy">recommendations</a> and <a href="http://swiftiply.swiftcore.org/benchmarks.html" title="Swiftcore Swiftiply">benchmarks</a> <a href="http://journal.andrewloe.com/2007/5/22/mongrel-vs-evented-mongrel" title="Mongrel vs Evented Mongrel">out there</a>, to install the <a href="http://swiftiply.swiftcore.org/index.html" title="Swiftcore Swiftiply">Swiftiply gem</a> and use Evented Mongrel. The is done by installing the gem <code>sudo gem install -y swiftiply</code> and then using <code>env EVENT=1 mongrel_rails</code> instead of just <code>mongrel_rails</code>.</p>

<p>I then needed to pick an image processor for resizing uploaded images, <a href="http://rmagick.rubyforge.org/" title="RMagick Download Page">rmagick</a> is of course the obvious and almost &#8220;default&#8221; choice (particularly at RailsMachine). But I had heard reports about it eating memory and being a performance hog. So I decided to go with <a href="http://sourceforge.net/projects/freeimage" title="SourceForge.net: FreeImage">FreeImage</a> and the <a href="http://seattlerb.rubyforge.org/ImageScience.html" title="ImageScience">ImageScience Gem</a> instead.</p>

<p>Then of course there&#8217;s the almost ubiquitous <a href="http://www.danga.com/memcached/" title="memcached: a distributed memory object caching system">memcached</a>. How could I forget that! I installed that, the <code>memcache-client</code> gem, and the <code>mem_cache_fragment_store gem</code>. We use memcache for sessions, and fragment caching (partly via the <a href="http://blog.evanweaver.com/files/doc/fauna/interlock/files/README.html" title="File: README">Interlock plugin</a> and partly via the built-in Rails fragment cache).</p>

<p>Lastly, since videos can be uploaded and I didn&#8217;t want to force property owners to upload a specific format, or have to support embedding different formats I installed <a href="http://ffmpeg.mplayerhq.hu/" title="FFmpeg">ffmpeg</a>, to convert them all to flash.</p>

<p>We also decided to go with Amazon S3&#8217;s service for hosting the image and video uploads, as well as serving as an asset host for our stylesheets, and images. And besides the monumental failure they had the other week it&#8217;s been a great success. In case you don&#8217;t know it&#8217;s really easy to map a sub-domain of your site to S3 by naming the bucket that domain name (in our case &#8220;<code>assets.heelshousing.com</code>&#8220;), and then setting a <code>CNAME</code>record with your DNS that points that sub-domain to the appropriate S3 domain name (in our case &#8220;<code>assets.heelshousing.com.s3.amazonaws.com</code>&#8220;).<br />
It&#8217;s also a good idea when uploading images to S3 to set the <code>EXPIRES</code> and <code>CACHE-CONTROL</code> headers for them. Here&#8217;s a sample of the code I use to do that:</p>

<pre class="textmate-source _argonaut_"><span class="source source_ruby source_ruby_rails">   <span class="support support_class support_class_ruby">AWS</span><span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">::</span><span class="support support_class support_class_ruby">S3</span><span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">::</span><span class="support support_class support_class_ruby">S3Object</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>store<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>
      key<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>open<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>path<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="variable variable_other variable_other_constant variable_other_constant_ruby">BUCKET_NAME</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> 
      <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>content_type</span> <span class="punctuation punctuation_separator punctuation_separator_key-value">=&gt;</span> content_type<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span>
      <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>expires</span> <span class="punctuation punctuation_separator punctuation_separator_key-value">=&gt;</span> <span class="support support_class support_class_ruby">Time</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>now<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>years_since<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="constant constant_numeric constant_numeric_ruby">10</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>httpdate<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span>
      <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>cache_control</span> <span class="punctuation punctuation_separator punctuation_separator_key-value">=&gt;</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>max-age=315360000<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span>
      <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>access</span> <span class="punctuation punctuation_separator punctuation_separator_key-value">=&gt;</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>public_read</span> 
   <span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span></span></pre>

<p>I think that should be self explanatory, but if not: I set the <code>key</code> variable to the name/path I want to use on S3, I set the <code>path</code> variable to the path of the file on the local machine, I set <code>content_type</code> to the appropriate MIME type, and of course I set the BUCKET_NAME constant to the name of the bucket I&#8217;m using.</p>

<p>Overall these choices were meant to hopefully increase speed of response for the user and performance on the server while also allowing everything to scale well as the sites user base grows.</p>

<p><strong>Update:</strong><br />
The title refers to how Rails apps should not be hosted in shared environments.</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/Ruby" title="See the Technorati tag page for 'Ruby'." rel="tag">Ruby</a>, <a href="http://technorati.com/tag/Rails" title="See the Technorati tag page for 'Rails'." rel="tag">Rails</a>, <a href="http://technorati.com/tag/nginx" title="See the Technorati tag page for 'nginx'." rel="tag">nginx</a>, <a href="http://technorati.com/tag/webdev" title="See the Technorati tag page for 'webdev'." rel="tag">webdev</a>, <a href="http://technorati.com/tag/server" title="See the Technorati tag page for 'server'." rel="tag">server</a>, <a href="http://technorati.com/tag/mongrel" title="See the Technorati tag page for 'mongrel'." rel="tag">mongrel</a>, <a href="http://technorati.com/tag/Rails+Machine" title="See the Technorati tag page for 'Rails Machine'." rel="tag">Rails Machine</a>, <a href="http://technorati.com/tag/memcached" title="See the Technorati tag page for 'memcached'." rel="tag">memcached</a>, <a href="http://technorati.com/tag/Evented+Mongrel" title="See the Technorati tag page for 'Evented Mongrel'." rel="tag">Evented Mongrel</a>, <a href="http://technorati.com/tag/Amazon+S3" title="See the Technorati tag page for 'Amazon S3'." rel="tag">Amazon S3</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=197Df9EVJu4:ShHKnOrMJ6M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=197Df9EVJu4:ShHKnOrMJ6M:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=197Df9EVJu4:ShHKnOrMJ6M:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=197Df9EVJu4:ShHKnOrMJ6M:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=197Df9EVJu4:ShHKnOrMJ6M:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=197Df9EVJu4:ShHKnOrMJ6M:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/197Df9EVJu4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2008/03/01/my-server-your-server-we-all-shouldnt-share-a-server/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2008/03/01/my-server-your-server-we-all-shouldnt-share-a-server/</feedburner:origLink></item>
		<item>
		<title>My First Rails site is Live</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/v4Fgayy0KOk/</link>
		<comments>http://www.websideattractions.com/2008/02/29/my-first-rails-site-is-live/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 15:29:17 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2008/02/29/my-first-rails-site-is-live/</guid>
		<description><![CDATA[So I finally finished it after months of laboring and coding away, HeelsHousing.com is live! The site is geared towards UNC - Chapel Hill students looking for housing opportunities close to campus. It does this by auto-calculating a properties distance from &#8220;The Pit&#8221; (think of this as the center of campus for those of you [...]]]></description>
			<content:encoded><![CDATA[<p>So I finally finished it after months of laboring and coding away, <a href="http://www.heelshousing.com/" title="HeelsHousing - Home">HeelsHousing.com</a> is live! The site is geared towards UNC - Chapel Hill students looking for housing opportunities close to campus. It does this by auto-calculating a properties distance from &#8220;The Pit&#8221; (think of this as the center of campus for those of you that don&#8217;t know UNC). The calculation is done &#8220;as the crow flies&#8221; and thus can be manually overridden by administrators if they wish to use a distance based on road directions. The reason for this is that obtaining driving directions distance via Google Maps server side is essentially impossible, but calculating the distance between two points on the planet is just a few calculations away (via the Rails <a href="http://geokit.rubyforge.org/" title="GeoKit for Rails">Geokit plugin</a>). It then allows you to sort search results by Distance from the Pit.</p>

<p><a href="http://www.websideattractions.com/wp-content/uploads/2008/02/search-map.jpg" title="Search Results Map"><img src="/wp-content/uploads/2008/02/search-map.thumbnail.jpg" alt="Search Results Map" title="Search Results Map" /></a>
Another one of the sites great features is it&#8217;s overall integration with Google Maps. You&#8217;ll find on every property page a map of where the property is. Also a little javascript pop-up box (not window) with the map will be displayed if you click the &#8220;Map It!&#8221; link in the search results.
<br style="clear:both;" />
<a href="http://www.websideattractions.com/wp-content/uploads/2008/02/bus-map.jpg" title="Bus routes overlaid on Google Map"><img src="/wp-content/uploads/2008/02/bus-map.thumbnail.jpg" alt="Bus routes overlaid on Google Map" title="Bus routes overlaid on Google Map" /></a>
And just to put the proverbial whip-cream on the sundae, If a property owner or administrator specifies that a property is close to certain Chapel Hill bus routes, those routes are overlaid on top of the map.
<br style="clear:both;" /></p>

<p><a href="http://www.dailytarheel.com/" title="Daily Tar Heel">The Daily Tarheel</a>, who commissioned this site from <a href="http://www.designhammer.com/" title="DesignHammer">us</a>, run the day to day operations of it. This includes adding and updating current properties, but also selling property listings to local property owners. They can specify 2 levels of paid owner user accounts with different levels of permissions. The owners can then specify different types of units for each property, and upload unit floorplans as well as property pictures and a video.</p>

<p>In my next post I&#8217;ll go over some of the back-end features used to create and host the site.</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/webapp" title="See the Technorati tag page for 'webapp'." rel="tag">webapp</a>, <a href="http://technorati.com/tag/webdev" title="See the Technorati tag page for 'webdev'." rel="tag">webdev</a>, <a href="http://technorati.com/tag/Rails" title="See the Technorati tag page for 'Rails'." rel="tag">Rails</a>, <a href="http://technorati.com/tag/UNC" title="See the Technorati tag page for 'UNC'." rel="tag">UNC</a>, <a href="http://technorati.com/tag/Chapel+Hill" title="See the Technorati tag page for 'Chapel Hill'." rel="tag">Chapel Hill</a>, <a href="http://technorati.com/tag/Daily+Tarheel" title="See the Technorati tag page for 'Daily Tarheel'." rel="tag">Daily Tarheel</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=v4Fgayy0KOk:z8BD_kQCy5w:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=v4Fgayy0KOk:z8BD_kQCy5w:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=v4Fgayy0KOk:z8BD_kQCy5w:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=v4Fgayy0KOk:z8BD_kQCy5w:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=v4Fgayy0KOk:z8BD_kQCy5w:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=v4Fgayy0KOk:z8BD_kQCy5w:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/v4Fgayy0KOk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2008/02/29/my-first-rails-site-is-live/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2008/02/29/my-first-rails-site-is-live/</feedburner:origLink></item>
		<item>
		<title>Rails 2.0 regex to convert old Migrations</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/B7FID5SCDf0/</link>
		<comments>http://www.websideattractions.com/2007/12/07/rails-20-regex-to-convert-old-migrations/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 16:48:22 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Scripting]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2007/12/07/rails-20-regex-to-convert-old-migrations/</guid>
		<description><![CDATA[Rails 2.0 is here! I&#8217;m going to try to move the app I&#8217;ve been working on (at DesignHammer) over to take advantage of it. Doesn&#8217;t seem like it should take that long? But we&#8217;ll see  

While getting started on that I wanted to try the new method for Active Record DB migrations. So I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done" title="Riding Rails: Rails 2.0: It's done!">Rails 2.0 is here!</a> I&#8217;m going to try to move the app I&#8217;ve been working on (at <a href="http://www.designhammer.com/" title="DesignHammer Media Group, LLC : Web Design &amp; Development">DesignHammer</a>) over to take advantage of it. Doesn&#8217;t seem like it should take that long? But we&#8217;ll see <img src='http://www.websideattractions.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>While getting started on that I wanted to try the new method for Active Record DB migrations. So I decided to rewrite all my old migrations (or at least the ones adding tables). I ended up crafting this regex to allow for a quick find and replace of the old style to be like the new style:</p>

<p><em>Find</em>:</p>

<pre class="textmate-source _argonaut_"><span class="source source_regexp source_regexp_oniguruma">   <span class="constant constant_character constant_character_escape constant_character_escape_backslash constant_character_escape_backslash_regexp">\.</span>column<span class="constant constant_character constant_character_character-class constant_character_character-class_regexp">\s</span><span class="keyword keyword_operator keyword_operator_quantifier keyword_operator_quantifier_regexp">+</span><span class="meta meta_group meta_group_regexp"><span class="punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_regexp">(</span><span class="meta meta_group meta_group_regexp"><span class="punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_regexp">(</span>"<span class="constant constant_character constant_character_character-class constant_character_character-class_regexp">\w</span><span class="keyword keyword_operator keyword_operator_quantifier keyword_operator_quantifier_regexp">+</span>"<span class="punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_regexp">)</span></span><span class="keyword keyword_operator keyword_operator_or keyword_operator_or_regexp">|</span><span class="meta meta_group meta_group_regexp"><span class="punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_regexp">(</span><span class="constant constant_character constant_character_escape constant_character_escape_backslash constant_character_escape_backslash_regexp">\:</span><span class="constant constant_character constant_character_character-class constant_character_character-class_regexp">\w</span><span class="keyword keyword_operator keyword_operator_quantifier keyword_operator_quantifier_regexp">+</span><span class="punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_regexp">)</span></span><span class="punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_regexp">)</span></span><span class="constant constant_character constant_character_character-class constant_character_character-class_regexp">\s</span><span class="keyword keyword_operator keyword_operator_quantifier keyword_operator_quantifier_regexp">*</span>,<span class="constant constant_character constant_character_character-class constant_character_character-class_regexp">\s</span><span class="keyword keyword_operator keyword_operator_quantifier keyword_operator_quantifier_regexp">+</span><span class="meta meta_group meta_group_regexp"><span class="punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_regexp">(</span><span class="constant constant_character constant_character_escape constant_character_escape_backslash constant_character_escape_backslash_regexp">\:</span><span class="meta meta_group meta_group_regexp"><span class="punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_regexp">(</span><span class="constant constant_character constant_character_character-class constant_character_character-class_regexp">\w</span><span class="keyword keyword_operator keyword_operator_quantifier keyword_operator_quantifier_regexp">+</span><span class="punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_regexp">)</span></span><span class="punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_regexp">)</span></span></span></pre>

<p><em>Replace</em>:</p>

<pre class="textmate-source _argonaut_"><span class="source source_regexp source_regexp_oniguruma">   <span class="constant constant_character constant_character_character-class constant_character_character-class_regexp">.</span><span class="keyword keyword_control keyword_control_anchor keyword_control_anchor_regexp">$</span>5 <span class="keyword keyword_control keyword_control_anchor keyword_control_anchor_regexp">$</span>1</span></pre>
<p class="tags">Tags: <a href="http://technorati.com/tag/rails" title="See the Technorati tag page for 'rails'." rel="tag">rails</a>, <a href="http://technorati.com/tag/regex" title="See the Technorati tag page for 'regex'." rel="tag">regex</a>, <a href="http://technorati.com/tag/find-replace" title="See the Technorati tag page for 'find-replace'." rel="tag">find-replace</a>, <a href="http://technorati.com/tag/migrations" title="See the Technorati tag page for 'migrations'." rel="tag">migrations</a>, <a href="http://technorati.com/tag/code" title="See the Technorati tag page for 'code'." rel="tag">code</a>, <a href="http://technorati.com/tag/activerecord" title="See the Technorati tag page for 'activerecord'." rel="tag">activerecord</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=B7FID5SCDf0:ZrOG9bmbJ-g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=B7FID5SCDf0:ZrOG9bmbJ-g:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=B7FID5SCDf0:ZrOG9bmbJ-g:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=B7FID5SCDf0:ZrOG9bmbJ-g:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=B7FID5SCDf0:ZrOG9bmbJ-g:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=B7FID5SCDf0:ZrOG9bmbJ-g:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/B7FID5SCDf0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/12/07/rails-20-regex-to-convert-old-migrations/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/12/07/rails-20-regex-to-convert-old-migrations/</feedburner:origLink></item>
		<item>
		<title>Why make yet another Rails date picker plugin!</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/6TVNNjlPZOQ/</link>
		<comments>http://www.websideattractions.com/2007/12/06/why-make-yet-another-rails-date-picker-plugin/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 04:33:11 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2007/12/06/why-make-yet-another-rails-date-picker-plugin/</guid>
		<description><![CDATA[Well for starters I have always been a huge fan of the Unobtrusive Date-Picker Widgit and there was no existing plugin for it. But then since it&#8217;s so unobtrusive why not just use the built-in methods to use it? Well because it relies on a class on the year (and not the other selects) and [...]]]></description>
			<content:encoded><![CDATA[<p>Well for starters I have always been a huge fan of the <a href="http://www.frequency-decoder.com/2006/10/02/unobtrusive-date-picker-widgit-update">Unobtrusive Date-Picker Widgit</a> and there was no existing plugin for it. But then since it&#8217;s so <em>unobtrusive</em> why not just use the built-in methods to use it? Well because it relies on a class on the year (and not the other selects) and a very specific structure to the IDs for the <code>&lt;select&gt;</code> tags, and doing this with the existing helpers was not possible. And thus the plugin was born!</p>

<p>The idea from the beginning was to make very nearly identical in usage and in output to the built-in commands so as to make it as much of a drop-in replacement as possible. I also wanted to use the 12 hour time standard since most of us don&#8217;t go by a 24 hour clock. Thus similar or identical options are available, and the output will be almost identical to that made by the built-in commands, it will of course work with a form builder and take data from a passed in model object to set the selected options. In other words all the Rails goodness one expects!</p>

<ul>
<li><a href="http://rails-unobtrusive-date-picker.googlecode.com/">Unobtrusive Javascript Date-Picker Plugin</a></li>
</ul>
<p class="tags">Tags: <a href="http://technorati.com/tag/ruby" title="See the Technorati tag page for 'ruby'." rel="tag">ruby</a>, <a href="http://technorati.com/tag/rails" title="See the Technorati tag page for 'rails'." rel="tag">rails</a>, <a href="http://technorati.com/tag/programming" title="See the Technorati tag page for 'programming'." rel="tag">programming</a>, <a href="http://technorati.com/tag/datepicker" title="See the Technorati tag page for 'datepicker'." rel="tag">datepicker</a>, <a href="http://technorati.com/tag/javascript" title="See the Technorati tag page for 'javascript'." rel="tag">javascript</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=6TVNNjlPZOQ:sNe7lsZFZyg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=6TVNNjlPZOQ:sNe7lsZFZyg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=6TVNNjlPZOQ:sNe7lsZFZyg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=6TVNNjlPZOQ:sNe7lsZFZyg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=6TVNNjlPZOQ:sNe7lsZFZyg:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=6TVNNjlPZOQ:sNe7lsZFZyg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/6TVNNjlPZOQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/12/06/why-make-yet-another-rails-date-picker-plugin/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/12/06/why-make-yet-another-rails-date-picker-plugin/</feedburner:origLink></item>
		<item>
		<title>Rails Date-Picker Plugin and raleigh.rb Hack Night</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/0zTl7CnexSM/</link>
		<comments>http://www.websideattractions.com/2007/12/06/rails-date-picker-plugin-and-raleighrb-hack-night/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 04:03:08 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2007/12/06/rails-date-picker-plugin-and-raleighrb-hack-night/</guid>
		<description><![CDATA[I just put up my first Rails Plugin. It&#8217;s for creating a date and date-time pickers in forms, that use the wonderful Unobtrusive Javascript Date-Picker Widget to allow the picking of dates via a nifty pop-up calendar.
I put the finishing touches on it tonight at the Raleigh Ruby Brigade Hack Night. I &#9829; local Ruby [...]]]></description>
			<content:encoded><![CDATA[<p>I just put up <a href="http://rails-unobtrusive-date-picker.googlecode.com" title="Unobtrusive Javascript Date-Picker Rails Plugin">my first Rails Plugin</a>. It&#8217;s for creating a date and date-time pickers in forms, that use the wonderful <a href="http://www.frequency-decoder.com/2006/10/02/unobtrusive-date-picker-widgit-update">Unobtrusive Javascript Date-Picker Widget</a> to allow the picking of dates via a nifty pop-up calendar.<br />
I put the finishing touches on it tonight at the <a href="http://ruby.meetup.com/3/calendar/6747149/">Raleigh Ruby Brigade Hack Night</a>. I &hearts; local Ruby community!</p>

<p>The meetup in general was nice, it was my first one. There were some recruiters that came at the beginning to say hi and also that they had no Ruby or Rails jobs to offer. There was discussion of favorite text editors that actually didn&#8217;t become a <em>fight</em> and some brief Mac-talk.</p>

<p>Hopefully I&#8217;ll get time to go again after Lillia arrives!</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/rails" title="See the Technorati tag page for 'rails'." rel="tag">rails</a>, <a href="http://technorati.com/tag/ruby" title="See the Technorati tag page for 'ruby'." rel="tag">ruby</a>, <a href="http://technorati.com/tag/javascript" title="See the Technorati tag page for 'javascript'." rel="tag">javascript</a>, <a href="http://technorati.com/tag/webdev" title="See the Technorati tag page for 'webdev'." rel="tag">webdev</a>, <a href="http://technorati.com/tag/calendar" title="See the Technorati tag page for 'calendar'." rel="tag">calendar</a>, <a href="http://technorati.com/tag/datepicker" title="See the Technorati tag page for 'datepicker'." rel="tag">datepicker</a>, <a href="http://technorati.com/tag/raleigh.rb" title="See the Technorati tag page for 'raleigh.rb'." rel="tag">raleigh.rb</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=0zTl7CnexSM:k1lWtFR6Mgs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=0zTl7CnexSM:k1lWtFR6Mgs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=0zTl7CnexSM:k1lWtFR6Mgs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=0zTl7CnexSM:k1lWtFR6Mgs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=0zTl7CnexSM:k1lWtFR6Mgs:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=0zTl7CnexSM:k1lWtFR6Mgs:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/0zTl7CnexSM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/12/06/rails-date-picker-plugin-and-raleighrb-hack-night/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/12/06/rails-date-picker-plugin-and-raleighrb-hack-night/</feedburner:origLink></item>
		<item>
		<title>Mongrel Output Compression Handler Gem</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/pLCqwqNMBMg/</link>
		<comments>http://www.websideattractions.com/2007/12/05/mongrel-output-compression-handler-gem/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 06:50:49 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2007/12/05/mongrel-output-compression-handler-gem/</guid>
		<description><![CDATA[After a little bit of hacking I&#8217;ve got a basic Mongrel plugin together to handle gziping and deflating a HTTP response body if a client accepts it and if activated in a Mongrel config script.
It&#8217;s based closely on the plugins I mentioned in my earlier post.

It&#8217;s probably not production ready (although I haven&#8217;t found any [...]]]></description>
			<content:encoded><![CDATA[<p>After a little bit of hacking I&#8217;ve got a basic Mongrel plugin together to handle gziping and deflating a HTTP response body if a client accepts it and if activated in a Mongrel config script.<br />
It&#8217;s based closely on the plugins I mentioned in <a href="/2007/12/03/mongrel-and-http-output-compression/">my earlier post</a>.</p>

<p>It&#8217;s probably not production ready (although I haven&#8217;t found any immediate or glaring problems with it so far), and it desperately needs some tests written. But other than that it&#8217;s good to go!</p>

<p>It can be found as at <a href="http://rubyforge.org/projects/mongrel-compres/" title="RubyForge: Mongrel Output Compression Handler: Project Info">http://rubyforge.org/projects/mongrel-compres/</a>.</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/compression" title="See the Technorati tag page for 'compression'." rel="tag">compression</a>, <a href="http://technorati.com/tag/HTTP" title="See the Technorati tag page for 'HTTP'." rel="tag">HTTP</a>, <a href="http://technorati.com/tag/mongrel" title="See the Technorati tag page for 'mongrel'." rel="tag">mongrel</a>, <a href="http://technorati.com/tag/Ruby" title="See the Technorati tag page for 'Ruby'." rel="tag">Ruby</a>, <a href="http://technorati.com/tag/rubygems" title="See the Technorati tag page for 'rubygems'." rel="tag">rubygems</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=pLCqwqNMBMg:fItgSLQxY4k:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=pLCqwqNMBMg:fItgSLQxY4k:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=pLCqwqNMBMg:fItgSLQxY4k:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=pLCqwqNMBMg:fItgSLQxY4k:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=pLCqwqNMBMg:fItgSLQxY4k:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=pLCqwqNMBMg:fItgSLQxY4k:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/pLCqwqNMBMg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/12/05/mongrel-output-compression-handler-gem/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/12/05/mongrel-output-compression-handler-gem/</feedburner:origLink></item>
		<item>
		<title>Mongrel and HTTP Output Compression</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/GsJ44Bfck6k/</link>
		<comments>http://www.websideattractions.com/2007/12/03/mongrel-and-http-output-compression/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 01:43:48 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2007/12/03/mongrel-and-http-output-compression/</guid>
		<description><![CDATA[Today I started to look for a way to add HTTP compression to a Rails app I&#8217;m working on. After a quick search I found a couple of plugins that seemed adequate, each with their own advantages. I thought briefly about making my own plugin from what I like best about each, but then I [...]]]></description>
			<content:encoded><![CDATA[<p>Today I started to look for a way to add HTTP compression to a Rails app I&#8217;m working on. After a quick search I found a <a href="http://wiki.rubyonrails.com/rails/pages/Better+Output+Compression+Plugin" title="Better Output Compression Plugin in Ruby on Rails">couple</a> of <a href="http://wiki.rubyonrails.org/rails/pages/Output+Compression+Plugin" title="Output Compression Plugin in Ruby on Rails">plugins</a> that seemed adequate, each with their own advantages. I thought briefly about making my own plugin from what I like best about each, but then I realized this seemed a more appropriate for the server layer. Thus I looked into if mongrel had support for this. What I found is a <a href="http://mongrel.rubyforge.org/rdoc/classes/Mongrel/DeflateFilter.html" title="Class: Mongrel::DeflateFilter">Deflate Filter</a> provided by the mongrel gem. But this is not nearly as robust as the plugins I found.</p>

<p>So, I&#8217;ve begun work on a Mongrel plugin for offering this functionality.<br />
More to come&hellip;</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/compression" title="See the Technorati tag page for 'compression'." rel="tag">compression</a>, <a href="http://technorati.com/tag/HTTP" title="See the Technorati tag page for 'HTTP'." rel="tag">HTTP</a>, <a href="http://technorati.com/tag/mongrel" title="See the Technorati tag page for 'mongrel'." rel="tag">mongrel</a>, <a href="http://technorati.com/tag/Ruby" title="See the Technorati tag page for 'Ruby'." rel="tag">Ruby</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=GsJ44Bfck6k:1KDkFiUjlJg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=GsJ44Bfck6k:1KDkFiUjlJg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=GsJ44Bfck6k:1KDkFiUjlJg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=GsJ44Bfck6k:1KDkFiUjlJg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=GsJ44Bfck6k:1KDkFiUjlJg:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=GsJ44Bfck6k:1KDkFiUjlJg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/GsJ44Bfck6k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/12/03/mongrel-and-http-output-compression/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/12/03/mongrel-and-http-output-compression/</feedburner:origLink></item>
		<item>
		<title>First days with Chumby!</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/itHjKfU25YI/</link>
		<comments>http://www.websideattractions.com/2007/10/29/first-days-with-chumby/#comments</comments>
		<pubDate>Tue, 30 Oct 2007 00:41:58 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Chumby]]></category>

		<category><![CDATA[Play]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2007/10/29/first-days-with-chumby/</guid>
		<description><![CDATA[I got my Chumby last Thursday and boy has it been fun. It comes in this very cute canvas sack, making it very transportable. I&#8217;ve really been enjoying the Flickr photo stream widget, the twitter widget, the Rotten Tomatoes widget, and the YouTube widget. I got the one with the black leather outside, but I [...]]]></description>
			<content:encoded><![CDATA[<p>I got my <a href="http://www.chumby.com/" title="chumby">Chumby</a> last Thursday and boy has it been fun. It comes in this very <em>cute</em> canvas sack, making it very transportable. I&#8217;ve really been enjoying the <a href="http://www.chumby.com/guide/widget/Flickr%20Photo%20Viewer" title="chumby &rsaquo; flickr photo viewer">Flickr photo stream widget</a>, the <a href="http://www.chumby.com/guide/widget/Twitter%20-%20What%20are%20you%20doing%3F" title="chumby &rsaquo; twitter - what are you doing?">twitter widget</a>, the <a href="http://www.chumby.com/guide/widget/Rotten%20Tomatoes" title="chumby &rsaquo; rotten tomatoes">Rotten Tomatoes widget</a>, and the <a href="http://www.chumby.com/guide/widget/YouTube%20videos" title="chumby &rsaquo; youtube videos">YouTube widget</a>. I got the one with the black leather outside, but I really love <a href="http://www.flickr.com/photos/11410414@N06/1110174052/" title="pauric on Flickr ">this craft</a>. Overall it&#8217;s soooooo fun!</p>

<h3>Pictures:</h3>

<p><a href="http://flickr.com/photos/brianlandau/1752077737/"><img src="http://farm3.static.flickr.com/2031/1752077737_4268e5fa1d_m.jpg" alt="Chumby Sack" title="Chumby Sack Picture" /></a>
<a href="http://flickr.com/photos/brianlandau/1752926176/"><img src="http://farm3.static.flickr.com/2347/1752926176_7e61c6ea4c_m.jpg" alt="Chumby Packaging" title="Chumby Packaging Picture" /></a>
<a href="http://flickr.com/photos/brianlandau/1752926302/"><img src="http://farm3.static.flickr.com/2381/1752926302_fe3b2f1168_m.jpg" alt="Chumby Control Panel" title="Chumby Control Panel Picture" /></a>
<a href="http://flickr.com/photos/brianlandau/1752926602/"><img src="http://farm3.static.flickr.com/2139/1752926602_aeaa1b0288_m.jpg" alt="Chumby Rotten Tomatoes Widget" title="Rotten Tomatoes Widget Picture" /></a></p>

<p><br style="clear:both;" /></p>

<ul>
<li><a href="http://flickr.com/photos/brianlandau/tags/chumby/" title="Flickr: Brian Landau's photos tagged with chumby">My Chumby Flickr pictures</a></li>
</ul>
<p class="tags">Tags: <a href="http://technorati.com/tag/Chumby" title="See the Technorati tag page for 'Chumby'." rel="tag">Chumby</a>, <a href="http://technorati.com/tag/cool" title="See the Technorati tag page for 'cool'." rel="tag">cool</a>, <a href="http://technorati.com/tag/fun" title="See the Technorati tag page for 'fun'." rel="tag">fun</a>, <a href="http://technorati.com/tag/photos" title="See the Technorati tag page for 'photos'." rel="tag">photos</a>, <a href="http://technorati.com/tag/silly" title="See the Technorati tag page for 'silly'." rel="tag">silly</a>, <a href="http://technorati.com/tag/widgets" title="See the Technorati tag page for 'widgets'." rel="tag">widgets</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=itHjKfU25YI:pkWR9HTPsJ4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=itHjKfU25YI:pkWR9HTPsJ4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=itHjKfU25YI:pkWR9HTPsJ4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=itHjKfU25YI:pkWR9HTPsJ4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=itHjKfU25YI:pkWR9HTPsJ4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=itHjKfU25YI:pkWR9HTPsJ4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/itHjKfU25YI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/10/29/first-days-with-chumby/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/10/29/first-days-with-chumby/</feedburner:origLink></item>
		<item>
		<title>Ruby script to convert file(s) character encoding</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/77OiDG7MJ9Y/</link>
		<comments>http://www.websideattractions.com/2007/10/24/ruby-script-to-convert-files-character-encoding/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 02:39:34 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://www.websideattractions.com/2007/10/24/ruby-script-to-convert-files-character-encoding/</guid>
		<description><![CDATA[Today at work I had to take a whole set of directory upon directory of files and convert them from one character encoding to UTF-8. Of course, this was instantly a task I said a script should do. And along came the following script. It takes two options one required, defining the character encoding of [...]]]></description>
			<content:encoded><![CDATA[<p>Today at work I had to take a whole set of directory upon directory of files and convert them from one character encoding to UTF-8. Of course, this was instantly a task I said a script should do. And along came the following script. It takes two options one required, defining the character encoding of the files being converted, using the flag &#8220;-f&#8221;. The other optional, defining the character encoding the files are to be converted to, using the flag &#8220;-t&#8221;. The second is optional because the default is to convert to is UTF-8. Finally, it accepts an argument list of directories or file names and processes each recurcively going through each directory processing each file and/or directory in it. It ignores all invisible files (those that start with &#8220;.&#8221;). It will most likely fail for a given file if the character encoding is off. But it will continue with the other files notifing the user that there was an issue.</p>

<pre class="textmate-source _argonaut_"><span class="source source_ruby"><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>!/usr/bin/env ruby -KU
</span>
<span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>optparse<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span>
<span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>ostruct<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span>
<span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>iconv<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span>

<span class="variable variable_other variable_other_constant variable_other_constant_ruby">SCRIPT_NAME</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>File Character Encoding Converter<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
<span class="variable variable_other variable_other_constant variable_other_constant_ruby">SCRIPT_VERSION</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>0.1<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>

<span class="meta meta_class meta_class_ruby"><span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">FileEncodingConverterOptionParser</span></span>

   <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">self.parse</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">args</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      options <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">OpenStruct</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">new</span>
      options<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>to <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>UTF-8<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span>
      options<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>verbose <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="constant constant_language constant_language_ruby">false</span>

      opts <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">OptionParser</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">new</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do </span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span><span class="variable variable_other variable_other_block variable_other_block_ruby">opts</span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span>
         opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>banner <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Usage: convert_encoding.rb [options] directory|file...<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>

         opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>separator <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
         opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>separator <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Specific options:<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>

         opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>on<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>-f<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>--from ENCODING<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Character Encoding converting from<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do </span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span><span class="variable variable_other variable_other_block variable_other_block_ruby">encoding</span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span>
            options<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>from <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> encoding
         <span class="keyword keyword_control keyword_control_ruby">end</span>

         opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>on<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>-t<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>--to ENCODING<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Character Encoding converting to<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do </span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span><span class="variable variable_other variable_other_block variable_other_block_ruby">encoding</span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span>
            options<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>to <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> encoding
         <span class="keyword keyword_control keyword_control_ruby">end</span>

         opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>separator <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
         opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>separator <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Common options:<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>

         opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>on<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>-v<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>--[no-]verbose<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Run verbosely<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do </span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span><span class="variable variable_other variable_other_block variable_other_block_ruby">v</span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span>
            options<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>verbose <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> v
         <span class="keyword keyword_control keyword_control_ruby">end</span>

         opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>on_tail<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>-h<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>--help<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Show this message<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do
</span>            puts opts
            exit
         <span class="keyword keyword_control keyword_control_ruby">end</span>

         opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>on_tail<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>-V<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>--version<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Show version<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do
</span>            puts <span class="variable variable_other variable_other_constant variable_other_constant_ruby">SCRIPT_NAME</span> <span class="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby">+</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span> <span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span> <span class="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby">+</span> <span class="variable variable_other variable_other_constant variable_other_constant_ruby">SCRIPT_VERSION</span>
            exit
         <span class="keyword keyword_control keyword_control_ruby">end</span>

      <span class="keyword keyword_control keyword_control_ruby">end</span>

      opts<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>parse!<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>args<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      options
   <span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="keyword keyword_control keyword_control_ruby">end</span>

options <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">FileEncodingConverterOptionParser</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>parse<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="variable variable_other variable_other_constant variable_other_constant_ruby">ARGV</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
<span class="variable variable_other variable_other_constant variable_other_constant_ruby">VERBOSE</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> options<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>verbose <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">?</span> <span class="constant constant_language constant_language_ruby">true</span> <span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">:</span> <span class="constant constant_language constant_language_ruby">false</span>

<span class="meta meta_class meta_class_ruby"><span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">FileEncodingConverter</span></span>

   <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">initialize</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">from<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> to <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>UTF-8<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      <span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby">@</span>to</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> to
      <span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby">@</span>from</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> from
   <span class="keyword keyword_control keyword_control_ruby">end</span>

   <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">fconv</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">filename</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      <span class="keyword keyword_control keyword_control_ruby">begin</span>
         contents <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>open<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>filename<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>read
         output <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">Iconv</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>conv<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby">@</span>to</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby">@</span>from</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> contents<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
         file <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>open<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>filename<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>w<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
         file<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>write<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>output<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      <span class="keyword keyword_control keyword_control_ruby">rescue</span> <span class="support support_class support_class_ruby">Iconv</span><span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">::</span><span class="variable variable_other variable_other_constant variable_other_constant_ruby">IllegalSequence</span>
         puts <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Could not be processed: <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>filename<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
      <span class="keyword keyword_control keyword_control_ruby">else</span>
         <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="variable variable_other variable_other_constant variable_other_constant_ruby">VERBOSE</span>
            puts <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Processed successfully: <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>filename<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
         <span class="keyword keyword_control keyword_control_ruby">end</span>
      <span class="keyword keyword_control keyword_control_ruby">ensure</span>
         <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">defined?</span> file
            <span class="keyword keyword_control keyword_control_ruby">if</span> file
               file<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>close
               file <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="constant constant_language constant_language_ruby">nil</span>
            <span class="keyword keyword_control keyword_control_ruby">end</span>
         <span class="keyword keyword_control keyword_control_ruby">end</span>
      <span class="keyword keyword_control keyword_control_ruby">end</span>
   <span class="keyword keyword_control keyword_control_ruby">end</span>

   <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">process_dir</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">dir</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      <span class="support support_class support_class_ruby">Dir</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>foreach<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>dir<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span><span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby">{</span><span class="meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block"> </span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span><span class="variable variable_other variable_other_block variable_other_block_ruby">filename</span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span> 
         <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby">!</span>filename<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>match<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_regexp string_regexp_classic string_regexp_classic_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby">/</span>^<span class="constant constant_character constant_character_escape constant_character_escape_ruby">\.</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby">/</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
            absolute_path <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> dir <span class="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby">+</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>/<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span> <span class="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby">+</span> filename
            <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>file?<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>absolute_path<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
               <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>fconv<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>absolute_path<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
            <span class="keyword keyword_control keyword_control_ruby">elsif</span> <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>directory?<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>absolute_path<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
               <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>process_dir<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>absolute_path<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
            <span class="keyword keyword_control keyword_control_ruby">end</span>
         <span class="keyword keyword_control keyword_control_ruby">end</span>
      <span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby">}</span>
   <span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="keyword keyword_control keyword_control_ruby">end</span>

converter <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">FileEncodingConverter</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">new</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>options<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>from<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> options<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>to<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>

<span class="support support_class support_class_ruby">ARGV</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>each <span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby">{</span><span class="meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block"> </span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span><span class="variable variable_other variable_other_block variable_other_block_ruby">arg</span><span class="punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby">|</span> 
   wd <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">Dir</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>getwd
   entryname <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> arg<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>match<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_regexp string_regexp_classic string_regexp_classic_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby">/</span>^<span class="constant constant_character constant_character_escape constant_character_escape_ruby">\/</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby">/</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">?</span> wd <span class="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby">+</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>/<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span> <span class="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby">+</span> arg <span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">:</span> arg
   <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>directory?<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>entryname<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      converter<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>process_dir<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>entryname<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
   <span class="keyword keyword_control keyword_control_ruby">elsif</span> <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>file?<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>entryname<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      converter<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>fconv<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>entryname<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
   <span class="keyword keyword_control keyword_control_ruby">end</span>
<span class="punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby">}</span></span></pre>

<ul>
<li><a href="/wp-content/uploads/code/convert_encoding.rb" title="File Character Encoding Converter" onclick="javascript:urchinTracker ('/downloads/convert_encoding.rb');">Script file download</a></li>
</ul>
<p class="tags">Tags: <a href="http://technorati.com/tag/ruby" title="See the Technorati tag page for 'ruby'." rel="tag">ruby</a>, <a href="http://technorati.com/tag/iconv" title="See the Technorati tag page for 'iconv'." rel="tag">iconv</a>, <a href="http://technorati.com/tag/utf8" title="See the Technorati tag page for 'utf8'." rel="tag">utf8</a>, <a href="http://technorati.com/tag/encodings" title="See the Technorati tag page for 'encodings'." rel="tag">encodings</a>, <a href="http://technorati.com/tag/scripting" title="See the Technorati tag page for 'scripting'." rel="tag">scripting</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=77OiDG7MJ9Y:gtiFrE2EnZY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=77OiDG7MJ9Y:gtiFrE2EnZY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=77OiDG7MJ9Y:gtiFrE2EnZY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=77OiDG7MJ9Y:gtiFrE2EnZY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=77OiDG7MJ9Y:gtiFrE2EnZY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=77OiDG7MJ9Y:gtiFrE2EnZY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/77OiDG7MJ9Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/10/24/ruby-script-to-convert-files-character-encoding/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/10/24/ruby-script-to-convert-files-character-encoding/</feedburner:origLink></item>
		<item>
		<title>Script and Droplet for forcing an app to run with the old WebKit</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/hLcMof_kG8A/</link>
		<comments>http://www.websideattractions.com/2007/07/20/script-and-droplet-for-forcing-an-app-to-run-in-the-old-safari/#comments</comments>
		<pubDate>Sat, 21 Jul 2007 00:26:31 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Mac]]></category>

		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://blog.brianjlandau.com/2007/07/20/script-and-droplet-for-forcing-an-app-to-run-in-the-old-safari/</guid>
		<description><![CDATA[Thomas Aylott over at subtleGradient had a posting a little while ago about how to install Safari 2 on top of Safari 3 beta and open applications with the older version of WebKit. I was needing to do this a lot and his work around called for running a command from the shell every time. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://subtlegradient.com/" title="subtleGradient">Thomas Aylott over at subtleGradient</a> had a posting a little while ago about <a href="http://subtlegradient.com/articles/2007/06/12/safari-2-safari-3-adium-forcing-webkit-frameworks" title="Safari 2, Safari 3, Adium &amp; forcing WebKit Frameworks">how to install Safari 2 on top of Safari 3 beta</a> and open applications with the older version of WebKit. I was needing to do this a lot and his work around called for running a command from the shell every time. I thought wouldn&#8217;t it be nice to to have some quick way to do this from the finder. Also, some apps were spitting out some text to standard error in the terminal and while the &#8220;<code>&amp;</code>&#8221; at the end prevented standard output from going to the terminal (by making the command run in the background), standard error was stilling being displayed. So, I wrote a bash script and turned it into a droplet with <a href="http://www.sveinbjorn.org/platypus" title="Sveinbjorn Thordarson's Website - Platypus">Platapus</a>. I then created a Automator workflow that opened a selected finder item with the droplet, and saved it as Finder plug-in, which allows me to call it from a contextual menu in the Finder. Of course you can always add the app to the dock or use Quicksilver triggers or whatever you prefer at that point.</p>

<p>I&#8217;ve included the script code below and posted the app and workflow with this posting (to use them you will have to first follow the <a href="http://subtlegradient.com/articles/2007/06/12/safari-2-safari-3-adium-forcing-webkit-frameworks">instructions</a> over at subtleGradient to install Safari 2 on top of Safari 3).<br />
(*the workflow should be installed in &#8220;<code>~/Library/Workflows/Applications/Finder</code>&#8220;)</p>

<pre class="textmate-source _argonaut_"><span class="source source_shell"><span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span>!/usr/bin/env bash
</span>
IFS=<span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span> <span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span>
filename=<span class="variable variable_other variable_other_bracket variable_other_bracket_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">${</span>*##/*/<span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">}</span></span>
appname=<span class="variable variable_other variable_other_bracket variable_other_bracket_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">${</span>filename%%.*<span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">}</span></span>
binpath=<span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span><span class="variable variable_other variable_other_special variable_other_special_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>*</span>/Contents/MacOS/<span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>appname</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span>

env DYLD_FRAMEWORK_PATH=<span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>/Applications/Safari2.app/Contents/Resources<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> \
WEBKIT_UNSET_DYLD_FRAMEWORK_PATH=YES <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span><span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>binpath</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> <span class="keyword keyword_operator keyword_operator_redirect keyword_operator_redirect_shell">&gt;&amp;</span>/dev/null <span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">&amp;</span></span></pre>

<ul>
<li><a href="/wp-content/uploads/2007/07/open-with-old-webkit.zip" title="Open with old Webkit" onclick="javascript:urchinTracker ('/downloads/openwitholdwebkit');">Application and Workflow download</a></li>
</ul>
<p class="tags">Tags: <a href="http://technorati.com/tag/Safari" title="See the Technorati tag page for 'Safari'." rel="tag">Safari</a>, <a href="http://technorati.com/tag/WebKit" title="See the Technorati tag page for 'WebKit'." rel="tag">WebKit</a>, <a href="http://technorati.com/tag/MacOSX" title="See the Technorati tag page for 'MacOSX'." rel="tag">MacOSX</a>, <a href="http://technorati.com/tag/bash" title="See the Technorati tag page for 'bash'." rel="tag">bash</a>, <a href="http://technorati.com/tag/shellscripting" title="See the Technorati tag page for 'shellscripting'." rel="tag">shellscripting</a>, <a href="http://technorati.com/tag/download" title="See the Technorati tag page for 'download'." rel="tag">download</a>, <a href="http://technorati.com/tag/Automator" title="See the Technorati tag page for 'Automator'." rel="tag">Automator</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=hLcMof_kG8A:490HEvbrpOI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=hLcMof_kG8A:490HEvbrpOI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=hLcMof_kG8A:490HEvbrpOI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=hLcMof_kG8A:490HEvbrpOI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=hLcMof_kG8A:490HEvbrpOI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=hLcMof_kG8A:490HEvbrpOI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/hLcMof_kG8A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/07/20/script-and-droplet-for-forcing-an-app-to-run-in-the-old-safari/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/07/20/script-and-droplet-for-forcing-an-app-to-run-in-the-old-safari/</feedburner:origLink></item>
		<item>
		<title>My First Pipe</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/ekhCpruMcVs/</link>
		<comments>http://www.websideattractions.com/2007/06/26/my-first-pipe/#comments</comments>
		<pubDate>Tue, 26 Jun 2007 17:14:05 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://blog.brianjlandau.com/2007/06/26/my-first-pipe/</guid>
		<description><![CDATA[Finally got around to playing with Yahoo Pipes (I know, I know that was sooooooooo last quarter  )
Anyway, just created a simple one for showing ZFS blog posts, links, etc.
And this is the RSS feed for all you feed readers out there.
Tags: feeds, pipes, yahoo, ZFS]]></description>
			<content:encoded><![CDATA[<p>Finally got around to playing with Yahoo Pipes (I know, I know that was sooooooooo last quarter <img src='http://www.websideattractions.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> )<br />
Anyway, just created a <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=bvFr8vkj3BGZHYASYEsBXw" title="Pipes: ZFS">simple one</a> for showing <a href="http://en.wikipedia.org/wiki/ZFS" title="ZFS - Wikipedia">ZFS</a> blog posts, links, etc.<br />
And this is the <a href="http://pipes.yahoo.com/pipes/pipe.run?_id=bvFr8vkj3BGZHYASYEsBXw&amp;_render=rss">RSS feed</a> for all you feed readers out there.</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/feeds" title="See the Technorati tag page for 'feeds'." rel="tag">feeds</a>, <a href="http://technorati.com/tag/pipes" title="See the Technorati tag page for 'pipes'." rel="tag">pipes</a>, <a href="http://technorati.com/tag/yahoo" title="See the Technorati tag page for 'yahoo'." rel="tag">yahoo</a>, <a href="http://technorati.com/tag/ZFS" title="See the Technorati tag page for 'ZFS'." rel="tag">ZFS</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ekhCpruMcVs:dXCCItblxxI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ekhCpruMcVs:dXCCItblxxI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=ekhCpruMcVs:dXCCItblxxI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ekhCpruMcVs:dXCCItblxxI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=ekhCpruMcVs:dXCCItblxxI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=ekhCpruMcVs:dXCCItblxxI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/ekhCpruMcVs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/06/26/my-first-pipe/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/06/26/my-first-pipe/</feedburner:origLink></item>
		<item>
		<title>Amtrak Misadventures</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/kpJupceeBqM/</link>
		<comments>http://www.websideattractions.com/2007/05/12/amtrak-misadventures/#comments</comments>
		<pubDate>Sat, 12 May 2007 21:56:10 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.brianjlandau.com/2007/05/12/amtrak-misadventures/</guid>
		<description><![CDATA[So today I was scheduled to take a 5:40 AM train out of Raleigh to Washington D.C.
The train didn&#8217;t get to Raleigh till after 9AM, which wasn&#8217;t fun at all with no &#8220;soft&#8221; seating, to lay down on. But, once on the train it was mostly nice. Got to view lots of small towns in [...]]]></description>
			<content:encoded><![CDATA[<p>So today I was scheduled to take a 5:40 AM train out of Raleigh to Washington D.C.<br />
The train didn&#8217;t get to Raleigh till after 9AM, which wasn&#8217;t fun at all with no &#8220;soft&#8221; seating, to lay down on. But, once on the train it was mostly nice. Got to view lots of small towns in Virginia, and the seats are much more spacious than airplanes, giving you real ability to stretch your legs out.<br />
Now I&#8217;m in D.C. and ready for a great weekend with my parents <img src='http://www.websideattractions.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=kpJupceeBqM:VnaU5WBrL3A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=kpJupceeBqM:VnaU5WBrL3A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=kpJupceeBqM:VnaU5WBrL3A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=kpJupceeBqM:VnaU5WBrL3A:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=kpJupceeBqM:VnaU5WBrL3A:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=kpJupceeBqM:VnaU5WBrL3A:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/kpJupceeBqM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/05/12/amtrak-misadventures/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/05/12/amtrak-misadventures/</feedburner:origLink></item>
		<item>
		<title>Contactify me</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/IkyD9yGP9vE/</link>
		<comments>http://www.websideattractions.com/2007/05/04/contactify-me/#comments</comments>
		<pubDate>Fri, 04 May 2007 22:39:16 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.brianjlandau.com/2007/05/04/contactify-me/</guid>
		<description><![CDATA[Email me: http://www.contactify.com/35b40
Tags: email, web apps, web forms, contact]]></description>
			<content:encoded><![CDATA[<p><a href="www.contactify.com/35b40" title="Contactify">Email me: http://www.contactify.com/35b40</a></p>
<p class="tags">Tags: <a href="http://technorati.com/tag/email" title="See the Technorati tag page for 'email'." rel="tag">email</a>, <a href="http://technorati.com/tag/web+apps" title="See the Technorati tag page for 'web apps'." rel="tag">web apps</a>, <a href="http://technorati.com/tag/web+forms" title="See the Technorati tag page for 'web forms'." rel="tag">web forms</a>, <a href="http://technorati.com/tag/contact" title="See the Technorati tag page for 'contact'." rel="tag">contact</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=IkyD9yGP9vE:XzdjbFOAgEw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=IkyD9yGP9vE:XzdjbFOAgEw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=IkyD9yGP9vE:XzdjbFOAgEw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=IkyD9yGP9vE:XzdjbFOAgEw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=IkyD9yGP9vE:XzdjbFOAgEw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=IkyD9yGP9vE:XzdjbFOAgEw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/IkyD9yGP9vE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/05/04/contactify-me/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/05/04/contactify-me/</feedburner:origLink></item>
		<item>
		<title>Fun with Mii Editor and Photoshop</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/d7lsqo51-lQ/</link>
		<comments>http://www.websideattractions.com/2007/05/01/fun-with-mii-editor-and-photoshop/#comments</comments>
		<pubDate>Tue, 01 May 2007 20:50:03 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Play]]></category>

		<guid isPermaLink="false">http://blog.brianjlandau.com/2007/05/01/fun-with-mii-editor-and-photoshop/</guid>
		<description><![CDATA[So while surfing around the other day I read on the DownloadSquad about this Mii Editor that they had heard about. This little avatar generator  allows you to create Mii faces like those on Nintendo&#8217;s Wii system. It&#8217;s a very fun avatar editor, and I quickly whipped up a little Mii avatar. They allow [...]]]></description>
			<content:encoded><![CDATA[<p>So while surfing around the other day I read on <a href="http://www.downloadsquad.com/2007/04/25/online-mii-editor-lets-you-be-you-only-more-cartoony/" title="Mii Editor Review">the DownloadSquad about this Mii Editor</a> that they had heard about. This little <a href="http://www.miieditor.com/" title="Mii Editor Beta">avatar generator</a>  allows you to create Mii faces like those on Nintendo&#8217;s Wii system. It&#8217;s a very fun avatar editor, and I quickly whipped up a little <a href="http://www.miieditor.com/?mii=094a00460061006c006b006f007200000000000000002b2c00000001c20000014e4480604180a6c2a88ea460329030b1046a8a6d2504004d0069006900200045006400690074006f0072" title="Falkor">Mii avatar</a>. They allow to save the Mii as an JPEG image, an XML file, or a Mii binary. I downloaded the JPEG and Photoshoped it up. I made a large version and a small version, I&#8217;ve placed both below.</p>

<p><a href="http://www.brianjlandau.com/miicon.jpg"><img src="http://www.brianjlandau.com/miicon.jpg" alt="Falkor Mii" title="Falkor Mii" /></a>
<a href="http://www.brianjlandau.com/miicon-small.jpg"><img src="http://www.brianjlandau.com/miicon-small.jpg" alt="Small Falkor Mii" title="Small Falkor Mii" /></a></p>

<p><br class="clearer" /></p>
<p class="tags">Tags: <a href="http://technorati.com/tag/mii" title="See the Technorati tag page for 'mii'." rel="tag">mii</a>, <a href="http://technorati.com/tag/wii" title="See the Technorati tag page for 'wii'." rel="tag">wii</a>, <a href="http://technorati.com/tag/avatar" title="See the Technorati tag page for 'avatar'." rel="tag">avatar</a>, <a href="http://technorati.com/tag/images" title="See the Technorati tag page for 'images'." rel="tag">images</a>, <a href="http://technorati.com/tag/photoshop" title="See the Technorati tag page for 'photoshop'." rel="tag">photoshop</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=d7lsqo51-lQ:T7-IXKy-qT0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=d7lsqo51-lQ:T7-IXKy-qT0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=d7lsqo51-lQ:T7-IXKy-qT0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=d7lsqo51-lQ:T7-IXKy-qT0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=d7lsqo51-lQ:T7-IXKy-qT0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=d7lsqo51-lQ:T7-IXKy-qT0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/d7lsqo51-lQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/05/01/fun-with-mii-editor-and-photoshop/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/05/01/fun-with-mii-editor-and-photoshop/</feedburner:origLink></item>
		<item>
		<title>A Shell Script for renaming an hg project and files</title>
		<link>http://feedproxy.google.com/~r/WebSideAttractions/~3/nWJwN5U3SGc/</link>
		<comments>http://www.websideattractions.com/2007/04/25/a-shell-script-for-renaming-an-hg-project-and-files/#comments</comments>
		<pubDate>Wed, 25 Apr 2007 06:25:38 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
		
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://blog.brianjlandau.com/2007/04/25/a-shell-script-for-renaming-an-hg-project-and-files/</guid>
		<description><![CDATA[This semester I&#8217;ve been taking a &#8220;Web Databases&#8221; class, for a number of the assignments we&#8217;ve been progressively building up a simple digital library site. Each project we needed to change the name of the files from something like &#8220;blandau-p5-home.html&#8221; to &#8220;blandau-p6-home.html&#8221;.
I was using Mercurial for managing my version control, and needed a way to [...]]]></description>
			<content:encoded><![CDATA[<p>This semester I&#8217;ve been taking a &#8220;Web Databases&#8221; class, for a number of the assignments we&#8217;ve been progressively building up a <a href="http://www.brianjlandau.com/projects/webdb/" title="Digital Library Lite &raquo; Home">simple digital library site</a>. Each project we needed to change the name of the files from something like &#8220;blandau-p5-home.html&#8221; to &#8220;blandau-p6-home.html&#8221;.<br />
I was using Mercurial for managing my version control, and needed a way to quickly manage moving over the files from one name to another. In comes the shell script! I needed to clone the Mercurial repository over, then rename all the files to the new name. Here&#8217;s the code:</p>

<pre class="textmate-source _argonaut_"><span class="source source_shell"><span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span>!/usr/bin/env bash
</span>
v=<span class="string string_quoted string_quoted_single string_quoted_single_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">'</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">'</span></span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> process the option flags
</span><span class="keyword keyword_control keyword_control_shell">while</span> getopts <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>:vh<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> opt<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> <span class="keyword keyword_control keyword_control_shell">do</span>
   <span class="keyword keyword_control keyword_control_shell">case</span> <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>opt</span> <span class="keyword keyword_control keyword_control_shell">in</span>
      v  ) v=<span class="string string_quoted string_quoted_single string_quoted_single_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">'</span>-v <span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">'</span></span> <span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;;</span>
      h  ) echo <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>usage: renameproj.sh  [-v] [-h] old new<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> <span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;;</span>
      <span class="constant constant_character constant_character_escape constant_character_escape_shell">\?</span> ) echo <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>usage: renameproj.sh  [-v] [-h] old new<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> <span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;;</span>
   <span class="keyword keyword_control keyword_control_shell">esac</span>
<span class="keyword keyword_control keyword_control_shell">done</span>
shift <span class="string string_interpolated string_interpolated_dollar string_interpolated_dollar_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">$(</span><span class="meta meta_scope meta_scope_subshell meta_scope_subshell_shell"><span class="punctuation punctuation_definition punctuation_definition_subshell punctuation_definition_subshell_shell">(</span><span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>OPTIND</span> - 1<span class="punctuation punctuation_definition punctuation_definition_subshell punctuation_definition_subshell_shell">)</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">)</span></span>

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> Get the old and new project names
</span>old=<span class="variable variable_other variable_other_positional variable_other_positional_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>1</span>
new=<span class="variable variable_other variable_other_positional variable_other_positional_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>2</span>

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> Function to rename files
</span><span class="meta meta_function meta_function_shell"><span class="entity entity_name entity_name_function entity_name_function_shell">renamepfiles</span><span class="punctuation punctuation_definition punctuation_definition_arguments punctuation_definition_arguments_shell">()</span></span>{
v=<span class="string string_quoted string_quoted_single string_quoted_single_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">'</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">'</span></span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> process the option flags
</span><span class="keyword keyword_control keyword_control_shell">while</span> getopts <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>:vo:n:<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> opt<span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;</span> <span class="keyword keyword_control keyword_control_shell">do</span>
   <span class="keyword keyword_control keyword_control_shell">case</span> <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>opt</span> <span class="keyword keyword_control keyword_control_shell">in</span>
      v  ) v=<span class="string string_quoted string_quoted_single string_quoted_single_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">'</span>-v <span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">'</span></span> <span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;;</span>
      o  ) old=<span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>OPTARG</span> <span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;;</span>
      n  ) new=<span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>OPTARG</span> <span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;;</span>
      <span class="constant constant_character constant_character_escape constant_character_escape_shell">\?</span> ) echo <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>usage: renamepfiles  [-v] [-o oldproject] [-n newproject] args...<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> <span class="keyword keyword_operator keyword_operator_list keyword_operator_list_shell">;;</span>
   <span class="keyword keyword_control keyword_control_shell">esac</span>
<span class="keyword keyword_control keyword_control_shell">done</span>
shift <span class="string string_interpolated string_interpolated_dollar string_interpolated_dollar_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">$(</span><span class="meta meta_scope meta_scope_subshell meta_scope_subshell_shell"><span class="punctuation punctuation_definition punctuation_definition_subshell punctuation_definition_subshell_shell">(</span><span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>OPTIND</span> - 1<span class="punctuation punctuation_definition punctuation_definition_subshell punctuation_definition_subshell_shell">)</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">)</span></span>

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> Make the move
</span><span class="keyword keyword_control keyword_control_shell">for</span> filename <span class="keyword keyword_control keyword_control_shell">do</span>
   oldfile=<span class="variable variable_other variable_other_bracket variable_other_bracket_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">${</span>filename<span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">}</span></span>
   <span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> the next line transforms the old filename into the new one by replacing the
</span>   <span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> old porject name with the new one.
</span>   newfile=<span class="variable variable_other variable_other_bracket variable_other_bracket_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">${</span>filename/$old/$new<span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">}</span></span>
   <span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> first rename it with the move command
</span>   mv -i <span class="variable variable_other variable_other_bracket variable_other_bracket_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">${</span>v<span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">}</span></span><span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>oldfile</span> <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>newfile</span>
   <span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> then rename it with the hg command
</span>   hg <span class="variable variable_other variable_other_bracket variable_other_bracket_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">${</span>v<span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">}</span></span>rename -A <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>oldfile</span> <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>newfile</span>
<span class="keyword keyword_control keyword_control_shell">done</span>
}

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> perform an mercurial clone of the project
</span>hg <span class="variable variable_other variable_other_bracket variable_other_bracket_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">${</span>v<span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">}</span></span>clone <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>old</span> <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>new</span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> change the working directory to our new project
</span>cd <span class="variable variable_other variable_other_bracket variable_other_bracket_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">${</span>new<span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">}</span></span>

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_shell"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell">#</span> call the function over all the files with the "old" project name in their name
</span>renamepfiles <span class="variable variable_other variable_other_bracket variable_other_bracket_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">${</span>v<span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">}</span></span>-n <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>new</span> -o <span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>old</span> <span class="string string_interpolated string_interpolated_dollar string_interpolated_dollar_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">$(</span>find . -name <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>*<span class="variable variable_other variable_other_normal variable_other_normal_shell"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell">$</span>old</span>*<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span> -maxdepth 2 -print <span class="keyword keyword_operator keyword_operator_pipe keyword_operator_pipe_shell">|</span> xargs echo -n<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">)</span></span>
echo <span class="string string_quoted string_quoted_double string_quoted_double_shell"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell">"</span>- Project Moved<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell">"</span></span></span></pre>
<p class="tags">Tags: <a href="http://technorati.com/tag/shell+scripting" title="See the Technorati tag page for 'shell scripting'." rel="tag">shell scripting</a>, <a href="http://technorati.com/tag/bash" title="See the Technorati tag page for 'bash'." rel="tag">bash</a>, <a href="http://technorati.com/tag/mercurial" title="See the Technorati tag page for 'mercurial'." rel="tag">mercurial</a>, <a href="http://technorati.com/tag/webdev" title="See the Technorati tag page for 'webdev'." rel="tag">webdev</a>, <a href="http://technorati.com/tag/code" title="See the Technorati tag page for 'code'." rel="tag">code</a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=nWJwN5U3SGc:aA3btGaq5W0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=nWJwN5U3SGc:aA3btGaq5W0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=nWJwN5U3SGc:aA3btGaq5W0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=nWJwN5U3SGc:aA3btGaq5W0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?i=nWJwN5U3SGc:aA3btGaq5W0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WebSideAttractions?a=nWJwN5U3SGc:aA3btGaq5W0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WebSideAttractions?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WebSideAttractions/~4/nWJwN5U3SGc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.websideattractions.com/2007/04/25/a-shell-script-for-renaming-an-hg-project-and-files/feed/</wfw:commentRss>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://www.websideattractions.com/2007/04/25/a-shell-script-for-renaming-an-hg-project-and-files/</feedburner:origLink></item>
	</channel>
</rss>
