<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>if by whiskey &#187; simon</title>
	<atom:link href="http://ifbywhiskey.com/blog/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://ifbywhiskey.com/blog</link>
	<description>choose your poison</description>
	<lastBuildDate>Mon, 18 Jun 2007 18:32:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Installing the latest Aptana Rails plugin</title>
		<link>http://ifbywhiskey.com/blog/2007/06/16/aptana_rails_install/</link>
		<comments>http://ifbywhiskey.com/blog/2007/06/16/aptana_rails_install/#comments</comments>
		<pubDate>Sat, 16 Jun 2007 12:39:03 +0000</pubDate>
		<dc:creator>simon</dc:creator>
				<category><![CDATA[ide]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://ifbywhiskey.com/blog/2007/06/16/aptana_rails_install/</guid>
		<description><![CDATA[It turns out I&#8217;m more of an eclipse novice than I thought!  Despite using Eclipse for Java development (since version 2!) and more recently for Rails work it&#8217;s taken me a while to figure out how to install the latest beta version of the Rails plugin for Aptana.  To summarise:

1. Download the current [...]]]></description>
			<content:encoded><![CDATA[<p>It turns out I&#8217;m more of an eclipse novice than I thought!  Despite using Eclipse for Java development (since version 2!) and more recently for Rails work it&#8217;s taken me a while to figure out how to install the latest <a href="http://www.aptana.com/blog/?p=144">beta</a> version of the Rails plugin for Aptana.  To summarise:</p>

<p>1. Download the current stable version of the <a href="http://aptana.com/download_all.php">Aptana <span class="caps">IDE</span></a><br />
2. Launch the Aptana <span class="caps">IDE </span>(and choose a workspace location)<br />
3. Install the Aptana RadRails plugin from the Aptana Start Page<br />
4. Restart Aptana<br />
5. Choose Window &#8230; Preferences, then Install/Update and enter the following policy url: http://update.aptana.com/update/rails/beta/3.2/policy.xml<br />
6. Click Ok, and restart Aptana<br />
7. Choose Help .. Software Updates &#8230; Find and Install then &#8220;Search for Updates of currently installed features&#8221;. If you expand the Rails plugin option you should see the following version listed: 0.8.0.200706111240 <br />
8. Install it.<br />
9. I&#8217;m sure you could skip installing two versions of the plugin if you really knew the score &#8230;<br />
 </p>]]></content:encoded>
			<wfw:commentRss>http://ifbywhiskey.com/blog/2007/06/16/aptana_rails_install/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Escaping the flash</title>
		<link>http://ifbywhiskey.com/blog/2007/05/20/escaping-the-flash/</link>
		<comments>http://ifbywhiskey.com/blog/2007/05/20/escaping-the-flash/#comments</comments>
		<pubDate>Sun, 20 May 2007 06:14:20 +0000</pubDate>
		<dc:creator>simon</dc:creator>
				<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://ifbywhiskey.com/blog/2007/05/20/escaping-the-flash/</guid>
		<description><![CDATA[At work we&#8217;re building an online community site with the aim of promoting sustainable lifestyles &#8211; quite similar to A year of living generously

The deadline is fast approaching, and Matthew and I have been coding hard to meet it.  Last week we were discussing what seemed to be a fairly generic problem &#8211; what&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>At work we&#8217;re building an online community site with the aim of promoting sustainable lifestyles &#8211; quite similar to <a href="http://generous.org.uk/">A year of living generously</a></p>

<p>The deadline is fast approaching, and Matthew and I have been coding hard to meet it.  Last week we were discussing what seemed to be a fairly generic problem &#8211; what&#8217;s the best way to <span class="caps">HTML </span>escape content you put in the flash?</p>

<p>We turned up this <a href="http://lists.rubyonrails.org/pipermail/rails/2006-January/011097.html">answer</a> via google, which suggests escaping it when you render it in your view, i.e. </p>



<pre>
<code class=&quot;ruby&quot;>&lt;%=h(flash[:notice])%&gt;</code>
</pre>



<p>All well and good, but sometimes you want a mixture of <span class="caps">HTML </span>and user generated content in the flash, e.g. </p>

<blockquote>
Sinbad has sent you a <a href="#">message</a><br />
</blockquote>


<p>So escaping the lot is not really an option.  </p>

<p>One solution is to use render_to_string with a partial as shown below:</p>

<h3>Controller</h3>



<pre>
<code class=&quot;ruby&quot;>def index
  if current_user.messages.any?
    flash[:notice] = render_to_string :partial =&gt; 'message', 
      :object =&gt; current_user.messages.first
  end
  # rest of action ...
end
</code></pre>



<h3>Partial</h3>



<pre><code class=&quot;ruby&quot;>&lt;%= h(message.sender) %&gt; has sent you a 
&lt;%= link_to &quot;message&quot;, :controller =&gt; 'messages', 
  :action =&gt; 'show', :id =&gt; message %&gt;
</pre>

<p></code></p>

<h3>Layout</h3>



<pre><code class=&quot;html&quot;>&lt;div class=&quot;notice&quot;&gt;
	&lt;%= flash[:notice] %&gt;
&lt;/div&gt;
</pre>

<p></code></p>

<p>I imagine :inline would also work, if a partial for a flash message seems like overkill.</p>]]></content:encoded>
			<wfw:commentRss>http://ifbywhiskey.com/blog/2007/05/20/escaping-the-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CoolBook review</title>
		<link>http://ifbywhiskey.com/blog/2007/05/04/coolbook-review/</link>
		<comments>http://ifbywhiskey.com/blog/2007/05/04/coolbook-review/#comments</comments>
		<pubDate>Fri, 04 May 2007 13:40:21 +0000</pubDate>
		<dc:creator>simon</dc:creator>
				<category><![CDATA[mbp]]></category>

		<guid isPermaLink="false">http://ifbywhiskey.com/blog/2007/05/04/coolbook-review/</guid>
		<description><![CDATA[Background

I fought off buying my MacBook Pro just long enough for the hardware problems to surface, but not quite long enough for them to be addressed.  In retrospect I think I faired reasonably well:  Sure the screen is bent, and so doesn&#8217;t sit flush when closed.  OK the machine gets a bit [...]]]></description>
			<content:encoded><![CDATA[<h2>Background</h2>

<p>I fought off buying my MacBook Pro just long enough for the hardware problems to surface, but not quite long enough for them to be addressed.  In retrospect I think I faired reasonably well:  Sure the screen is bent, and so doesn&#8217;t sit flush when closed.  OK the machine gets a bit toasty under load, but that&#8217;s kind of handy on a cold winter&#8217;s night.  And yes, there is the annoying buzz when it&#8217;s idling on battery power.  Essentially all minor faults which you might have expected to be weeded out during <span class="caps">QA, </span>but it was a first generation machine and so always a bit of a gamble.</p>

<p>Over the past year, numerous solutions to these various ills have emerged, preying on the insecurities of the betrayed early adopter Apple fanboys.  Bear with me whilst I recollect this period of false hope.</p>

<h2>The whine</h2>

<p>Remember the saga of the SpeedIt kernel extension &#8211; promising an end to the processor whine, improved battery life and thereby entrance to paradise?  SpeedIt development was sporadic and poorly communicated.  Countless deadlines for the &#8220;next beta&#8221; were announced with much fanfare and then broken without a word, leading to tumultuous flame wars in the discussion forums.  Those who dared question whether the developers could pull it off were attacked in case they dissuaded them from continuing their heroic work.  There was the special license agreement, where registered users were asked to email the company boss on her birthday to say thanks for sponsoring this important work.  Then finally, in a plot seemingly lifted from Home and Away, two core staff members were injured in a motorcycle accident.  The emotional outpourings were reminiscent of another <a href="http://news.bbc.co.uk/onthisday/hi/dates/stories/august/31/newsid_2510000/2510615.stm">crash</a>, and I have to say I tuned out at this point.  Coming back to it now, I can&#8217;t find any trace of this snake oil at <a href="http://www.increw.com/">increw</a>, although the source code is still available via their <a href="http://speedit.increw.org/">trac</a>, development seems to have stalled.  </p>

<h2>The furnace</h2>

<p>The SpeedIt guys did manage to provide a method to read the temperature of the Core Duo processor, and consequently <span class="caps">MBP </span>owners become even more aware of the inferno raging beneath their finger tips.  This led the truly desperate to <a href="http://www.engadget.com/2006/05/01/macbook-pros-overheating-due-to-thermal-grease/">crack open</a> their laptop and improve the thermal efficiency of the <span class="caps">CPU</span>+GPU heat sinks by carefully reapplying the thermal paste.</p>

<p>More recently a less invasive option has emerged, whereby you can run the fans more aggressively than the profile provided by Apple.  Both <a href="http://www.lobotomo.com/products/FanControl/">Fan Control</a> and <a href="http://81.169.182.62/~eidac/software/page5/page5.html">smcFanControl</a> allow you to accomplish this, no doubt allowing some proud <span class="caps">MBP </span>owners to use their built in keyboard for day to day use for the first time.  Thankfully, although toasty, mine has never quite blackened flesh.</p>

<h2>The contender</h2>

<p>I think <a href="http://www.coolbook.se">CoolBook</a> first launched in late 2006.  It&#8217;s angle was to lower the heat generated by the <span class="caps">CPU </span>by <a href="http://www.nordichardware.com/Articles/?page=1&amp;skrivelse=465">undervolting</a> it.  The general idea is that the voltage + frequency pairs that the <span class="caps">CPU </span>are set to operate at by Apple are chosen to be stable for as wide a sample of <span class="caps">CPU</span>s as possible.  By tuning the pairs for your particular <span class="caps">CPU, </span>you may be able to run it at a lower voltage for any given frequency.  This will cause it to generate less heat, and so hopefully result in a cooler system.</p>

<p>Although CoolBook is free to download, you can only experiment with its undervolting capabilities once you have paid the $10 registration fee.  This was enough to put me off for 6 months, but I finally weakened &#8211; it&#8217;s cheaper than therapy after all, and has recently hit version 2, now boasting a new frequency throttling feature.</p>

<p>The manual recommends that you begin undervolting your machine by determining 2 base frequency/voltage pairs:  The lowest stable voltage for the highest frequency, and the highest stable frequency for the lowest voltage.  The process used to determine these  was as follows:  First set the frequency to the maximum for your machine (2GHz in my case), and then reduce the voltage to the lowest stable setting.  Too low and you&#8217;ll get a kernel panic, so it pays to notch it down one step at a time.  Once I thought I&#8217;d identified the lowest stable voltage, I ran at 10min <a href="http://www.coolbook.se/CPUTest/CPUTest.zip"><span class="caps">CPUT</span>est</a> session, which loads the <span class="caps">CPU </span>presumably by carrying out a number of processor intensive calculations with known results.  I had to edge the voltage up a few steps to get the tests to complete successfully.  My lowest stable voltage for the highest frequency result was as follows:</p>

<table class="center" style="margin-left:auto;margin-right:auto" cellspacing="0"><tr style="color:#E2B454"><th>		</th><th>Frequency(MHz)</th><th>Voltage (V)</th></tr><tr><td>Default</td><td>2004</td><td>1.2625</td></tr><tr><td>Optimised</td><td>2004</td><td>1.1375</td></tr></table>

<p class="center" style="text-align:center"> Default and lowest stable voltage for the highest frequency</p>

<p>So a reduction of 0.125V (9.9%) from the default setting.  The next step is to find the highest stable frequency for the lowest voltage.  Setting the voltage to 0.95, I edged the frequency up a step at a time, following a similar process to before:</p>

<table class="center" style="margin-left:auto;margin-right:auto" cellspacing="0"><tr style="color:#E2B454"><th>		</th><th>Frequency(MHz)</th><th>Voltage (V)</th></tr><tr><td>Default</td><td>1002</td><td>0.9500</td></tr><tr><td>Optimised</td><td>1503</td><td>0.9500</td></tr></table>

<p class="center" style="text-align:center"> Default and highest stable frequency for the lowest voltage</p>


<p>This time I&#8217;m able to run clock the <span class="caps">CPU</span> 50% faster than the Apple default at the lowest available voltage.  Seems pretty good, but what difference does it make to my every day work activities?</p>

<h2>Temperature</h2>

<p>Having identified these two pairs, I plugged them into the Mains Adapter profile setting and chose the medium throttle setting.  This would cause the machine to idle at the lower setting, but ramp up under load:  </p>

<table class="center" style="margin-left:auto;margin-right:auto" cellspacing="0"><tr style="color:#E2B454"><th>Frequency(MHz)</th><th>Voltage (V)</th></tr><tr><td>2004</td><td>1.1375</td></tr><tr><td>1503</td><td>0.9500</td></tr></table>

<p class="center" style="text-align:center"> Adapter profile used for temperature comparison</p>


<p>To see what difference this made to the operating temperature when connected to the mains, I ran some real world tasks and recorded the temperature profile and fan speed over a 5 minute period once they had stabilised.  For comparison I performed the same tasks with the &#8220;Normal&#8221; energy saving profile in system preferences with CoolBook disabled:</p>

<table class="center" style="margin-left:auto;margin-right:auto" cellspacing="0"><tr style="color:#E2B454"><th>Task</th><th colspan="2">Normal</th><th colspan="2">CoolBook</th></tr><tr><td></td><td>&deg;C</td><td><span class="caps">RPM</span></td><td>&deg;C</td><td><span class="caps">RPM</span></td></tr><tr><td>Java unit tests</td><td>78.2</td><td>~1900</td><td>76.4</td><td>~1400</td></tr><tr><td>Rails unit tests</td><td>76.8</td><td>1000</td><td>72.7</td><td>1000</td></tr><tr><td><span class="caps">WMA</span>-&gt;MP3 transcoding</td><td>77.9</td><td>~1200</td><td>73.9</td><td>1000</td></tr></table>

<p class="center" style="text-align:center"> Average temperature and <span class="caps">RPM </span>under various loads</p>


<p>These results suggest that undervolting the <span class="caps">CPU </span>does result in a cooler system.  For the Java unit test suite the temperature difference is 1.8&deg;C, but the fans are spinning ~500RPM slower.  For the Rails tests the fan speeds are similar, but the <span class="caps">CPU </span>temperature is 3.9&deg;C lower.  It&#8217;s worth remembering that when under load the machine will still be running at 2GHz so there should be little difference in performance between the two, although I didn&#8217;t try to confirm this.</p>

<h2>Battery Life</h2>

<p>The CoolBook documentation suggests that battery life might be extended by locking the <span class="caps">CPU </span>to the lowest voltage + lowest frequency pair, in my case 1002MHz/0.9500V.  To see what impact this would have on battery life, I performed my daily Rails development chores, interspersed with some web browsing and important client email digestion &#8211; bien sur. I recorded the time taken for a fully charged battery to run down with the normal energy saving setting and CoolBook managing the processor throttling.  Each setting was repeated twice, and the times averaged:</p>

<table class="center" style="margin-left:auto;margin-right:auto" cellspacing="0"><tr style="color:#E2B454"><th>Setting</th><th>Time to discharge</th></tr><tr><td>Normal	</td><td>151mins</td></tr><tr><td>CoolBook</td><td>151mins</td></tr></table>

<p class="center" style="text-align:center"> Average battery life in the salt mine</p>

<p>So no improvement in terms of battery life, which seems a little disappointing but may just be because my daily activities don&#8217;t cause enough load to step up the <span class="caps">CPU </span>for significant amounts of time.  No doubt I could load the machine up and see how quickly it ran down in each case, but for me that result is not of interest, since it doesn&#8217;t reflect my real world use.</p>

<h2>Conclusion</h2>

<p>After investing an hour or in locating the base frequency/voltage pairs for my <span class="caps">CPU,</span> I was able to reduce the temperature of my <span class="caps">MBP </span>under load by up to 4.0&deg;C.  In some circumstances the fans also ran slower, and noticeably quieter.  Sadly I had no luck in extending the battery life beyond 2.5 hours, ho-hum!</p>]]></content:encoded>
			<wfw:commentRss>http://ifbywhiskey.com/blog/2007/05/04/coolbook-review/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Rails &#8211; do you want fries with that?</title>
		<link>http://ifbywhiskey.com/blog/2007/04/20/acts_as_french_fries/</link>
		<comments>http://ifbywhiskey.com/blog/2007/04/20/acts_as_french_fries/#comments</comments>
		<pubDate>Fri, 20 Apr 2007 11:58:33 +0000</pubDate>
		<dc:creator>simon</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[whinge]]></category>

		<guid isPermaLink="false">http://ifbywhiskey.com/?p=3</guid>
		<description><![CDATA[I gave an effusive talk on Rails at work after completing my first project.  Coming from a Java background, I was impressed that it was easy to pick up, get started and get things done with  less faff than J2EE.  Convention was the new king, and I his happy servant.

Buoyed by my [...]]]></description>
			<content:encoded><![CDATA[<p>I gave an effusive talk on Rails at work after completing my first project.  Coming from a Java background, I was impressed that it was easy to pick up, get started and get things done with  less faff than <span class="caps">J2EE. </span> Convention was the new king, and I his happy servant.</p>

<p>Buoyed by my new found productivity, released from my shackles of indecision (which <span class="caps">MVC </span>framework?  What about transactions? How will this work in a cluster?)  I could just jump right it and get on with building the site.  Every line of code was going to the customer.  No need to worry about the tricky stuff, it&#8217;s a full stack framework and there&#8217;s a plugin for everything.</p>

<p>But what has working with Rails done for me, as a former Java developer?  Well the project timescales are generally tighter and the work productive yet stressful.  But these are subjective measures, what about the cold, hard cash?</p>


<table class="center" style="margin-left:auto;margin-right:auto" cellspacing="0"><tr style="color:#E2B454"><th>Technology</th><th>Salary</th><th align="right">Number of  jobs</th></tr><tr><td>Spring</td><td>&pound;51,567</td><td align="right">2944</td></tr><tr><td>Java</td><td>&pound;49,001</td><td align="right">34538</td></tr><tr><td>Hibernate</td><td>&pound;48,898</td><td align="right">3006</td></tr><tr><td>Struts</td><td>&pound;43,861</td><td align="right">2256</td></tr><tr><td>Spring <span class="caps">MVC</span></td><td>&pound;43,250</td><td align="right">40</td></tr><tr><td>Velocity</td><td>&pound;41,914</td><td align="right">99</td></tr><tr><td>.NET</td><td>&pound;40,507</td><td align="right">33598</td></tr><tr><td><span class="caps">ASP</span></td><td>&pound;34,587</td><td align="right">4217</td></tr><tr style="color:#924922"><th>Ruby on Rails</th><th>&pound;32,762</th><th align="right">146</th></tr><tr><td><span class="caps">PHP</span></td><td>&pound;32,436</td><td align="right">4328</td></tr><tr><td>Application development</td><td>&pound;42,560</td><td align="right">103178</td></tr></table>


<p class="center" style="text-align:center">Figures are 3 month averages, <a href="http://www.itjobswatch.co.uk/jobs/uk/ruby%20on%20rails.do">source</a></p>

<p>I&#8217;ve included a variety of technologies which fit within the web development domain because I&#8217;m conscious that there aren&#8217;t that many Rails jobs listed. The lower salary may just be a result of lower demand &#8211; I don&#8217;t have any numbers for the supply side of the equation. Currently Rails does seem to sit more towards the <span class="caps">PHP </span>rather <span class="caps">J2EE </span>end of the salary scale. </p>

<p class="center" style="text-align:center"><strong>Less filthy lucre == less snowflake moments</strong></p>

<p>At the moment, Rails is great if you are in the product development business and you want to get <i>Wet Dream 2.0</i> to market on a budget.  It&#8217;s great if you&#8217;re a small company aggressively bidding to win work at open tender.  It&#8217;s great if you are a lot smarter than me, on the lecture circuit with a cool blog and a bunch of plugins under your belt.</p>

<p>But if you are an average Joe Coder, choose wisely.  Perhaps ruminating over application architecture decisions and marshaling endless <span class="caps">XML </span>files was overpaid &#8211; or maybe &#8220;convention over configuration&#8221; makes web development easier, and cheaper.  Either way I&#8217;d better raise my game: If I&#8217;m going to install acts_as_french_fries I at least want to have written it.</p>]]></content:encoded>
			<wfw:commentRss>http://ifbywhiskey.com/blog/2007/04/20/acts_as_french_fries/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
