<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Richard Hart / Hates_</title>
	
	<link>http://www.ur-ban.com/blog</link>
	<description>Programming &amp; Life - ur-ban.com</description>
	<lastBuildDate>Thu, 10 May 2012 11:03:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Hates_" /><feedburner:info uri="hates_" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Scott Adams</title>
		<link>http://feedproxy.google.com/~r/Hates_/~3/5Ot8k9fw1yg/</link>
		<comments>http://www.ur-ban.com/blog/2012/04/27/scott-adams/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 12:39:42 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[quotes]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2424</guid>
		<description><![CDATA[&#8220;Losers have goals. Winners have systems.&#8221; Scott Adams]]></description>
			<content:encoded><![CDATA[<blockquote>&#8220;Losers have goals. Winners have systems.&#8221; <span class="quotee">Scott Adams</span></blockquote>
<img src="http://feeds.feedburner.com/~r/Hates_/~4/5Ot8k9fw1yg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/04/27/scott-adams/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ur-ban.com/blog/2012/04/27/scott-adams/</feedburner:origLink></item>
		<item>
		<title>OSX Copy/Paste in tmux</title>
		<link>http://feedproxy.google.com/~r/Hates_/~3/34rInLlhriQ/</link>
		<comments>http://www.ur-ban.com/blog/2012/04/27/copypaste-in-tmux/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 23:32:32 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[tmux]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2413</guid>
		<description><![CDATA[One of the big things that took me a while to get right in tmux was copy/pasting. The gripes of trying to get it to work were enough to nearly make me forget using it all together. Here&#8217;s what you need to know. Install reattach-to-user-namespace brew install reattach-to-user-namespace and then in your .tmux.conf set-option -g [...]]]></description>
			<content:encoded><![CDATA[<p>One of the big things that took me a while to get right in tmux was copy/pasting. The gripes of trying to get it to work were enough to nearly make me forget using it all together.</p>

<p>Here&#8217;s what you need to know.</p>

<p><strong>Install reattach-to-user-namespace</strong></p>

<p>

<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">brew install reattach-to-user-namespace</div></div>

</p>

<p>and then in your .tmux.conf</p>

<p>

<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">set-option -g default-command &quot;reattach-to-user-namespace -l zsh&quot;</div></div>

</p>

<p><strong>Assign a binding to copy the current buffer</strong></p>

<p>In your .tmux.conf set a binding to copy the buffer</p>

<p>

<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">bind-key C-c run-shell &quot;tmux save-buffer - | reattach-to-user-namespace pbcopy&quot;</div></div>

</p>

<p>Now it actually took me ages to work out how to use this properly. Once you have created the buffer, either through selecting it with the mouse or by using PREFIX &#8211; [ and SPACE/ENTER, press PREFIX &#8211; C-c and it will be copied to your system clipboard.</p>

<p><strong>Use the option key</strong></p>

<p>If you hold down the option key while in the terminal, you can create a selection just as if you&#8217;re weren&#8217;t in tmux.</p>
<img src="http://feeds.feedburner.com/~r/Hates_/~4/34rInLlhriQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/04/27/copypaste-in-tmux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ur-ban.com/blog/2012/04/27/copypaste-in-tmux/</feedburner:origLink></item>
		<item>
		<title>Switching to tmux</title>
		<link>http://feedproxy.google.com/~r/Hates_/~3/ikfYhB55Yak/</link>
		<comments>http://www.ur-ban.com/blog/2012/04/22/switching-to-tmux/#comments</comments>
		<pubDate>Sun, 22 Apr 2012 21:19:01 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tmux]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2400</guid>
		<description><![CDATA[Not being one to jump on bandwagons, I just had to try tmux after hearing so many people talk about it. tmux is a terminal multiplexer allowing you to run a number of terminals within a single screen as well as allowing you to detach and reattach to the same session as you please. So [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ur-ban.com/galleryv2/main.php?g2_view=core.DownloadItem&amp;g2_itemId=16283&amp;g2_serialNumber=1"><img src="http://www.ur-ban.com/galleryv2/main.php?g2_view=core.DownloadItem&amp;g2_itemId=16283&amp;g2_serialNumber=1" alt="" /></a></p>

<p>Not being one to jump on bandwagons, I just had to try <a href="http://tmux.sourceforge.net/">tmux</a> after hearing so many people talk about it. tmux is a terminal multiplexer allowing you to run a number of terminals within a single screen as well as allowing you to detach and reattach to the same session as you please.</p>

<p><em>So what? I can just run multiple tabs and get the same effect!</em></p>

<p>Yes and no. I had been running multiple tabs, with vim in one window, a console session in another and tailing output in another, but the real revelation with tmux came when I tried out the <a href="https://github.com/aziz/tmuxinator">tmuxinator</a> gem. tmuxinator allows you to easily manage tmux sessions. With a simple yaml file you can create and start a tmux session with your editor, console and logging all setup, laid out and ready to go. This is incredibly useful with you work across multiple projects as quite frequently I would find myself in <em>tab hell</em> when having to switch from one project to another. Once you get past having more than four or five tabs open it become increasingly difficult to know which is which. tmux sessions mean I can keep everything related to a single &#8220;context&#8221; within one terminal session.</p>

<p>Getting up and running wasn&#8217;t 100% smooth sailing. Brian P. Hogan&#8217;s <a href="http://pragprog.com/book/bhtmux/tmux">tmux: Productive Mouse-Free Development</a> was invaluable. Even with less than a full days use, I&#8217;m pretty comfortable and have gotten over the initial slowdown that comes with switching to a new tool.</p>

<p>The only thing I miss is that I can no-longer use CMD-S for saving like in MacVim, but to be honest that&#8217;s a bad habit I need to break, as well as colour schemes aren&#8217;t quite as pretty in command line Vim compared to MacVim.</p>

<p>A few gotchas I encountered:</p>

<ul>
<li>When using Vim and the Command-T plugin, up/down arrows wont work for selecting a file to open, you will have to use CTRL-J/K to move up and down and CTRL-C to close the pane.</li>
<li>When adding reattach-to-user-namespace to enable copy/paste to your tmux.conf, you <em>must</em> kill your tmux session for the change to take place, it&#8217;s not enough to just quit and restart tmux.</li>
<li>If you&#8217;re using rvm, opening a new pane/window into a directory with an .rvmrc wont properly load in the selected ruby. If you&#8217;re on bash then adding &#8220;cmd .&#8221; to your .bashrc should work (I haven&#8217;t tried it), but for me I had to add &#8220;source .rvmrc&#8221; to my .zshrc for it load in properly.</li>
</ul>
<img src="http://feeds.feedburner.com/~r/Hates_/~4/ikfYhB55Yak" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/04/22/switching-to-tmux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ur-ban.com/blog/2012/04/22/switching-to-tmux/</feedburner:origLink></item>
		<item>
		<title>Quickly close database connections on the command line</title>
		<link>http://feedproxy.google.com/~r/Hates_/~3/6dG1YGksDsY/</link>
		<comments>http://www.ur-ban.com/blog/2012/04/14/quickly-close-database-connections-on-the-command-line/#comments</comments>
		<pubDate>Sat, 14 Apr 2012 22:38:57 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[postgres]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2367</guid>
		<description><![CDATA[One slightly annoying thing about Postgres over MySQL is that trying to reset a database with `rake db:migrate:reset` fails if there are connected clients and as I use Pow for development, killing the process doesn&#8217;t always free up the connections. To get around this you can quickly kill all connections with this command: ps x [...]]]></description>
			<content:encoded><![CDATA[<p>One slightly annoying thing about Postgres over MySQL is that trying to reset a database with `rake db:migrate:reset` fails if there are connected clients and as I use <a href="http://pow.cx/">Pow</a> for development, killing the process doesn&#8217;t always free up the connections. </p>
<p>To get around this you can quickly kill all connections with this command:</p>
<pre>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ps x -o pid,command | grep postgres | grep my_database | cut -f 1 -d &quot; &quot; | xargs kill</div></div>
</pre>
<img src="http://feeds.feedburner.com/~r/Hates_/~4/6dG1YGksDsY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/04/14/quickly-close-database-connections-on-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ur-ban.com/blog/2012/04/14/quickly-close-database-connections-on-the-command-line/</feedburner:origLink></item>
		<item>
		<title>SpotSnax</title>
		<link>http://feedproxy.google.com/~r/Hates_/~3/lzihsCoit1Y/</link>
		<comments>http://www.ur-ban.com/blog/2012/04/06/spotsnax/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 23:16:41 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[spotify]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2362</guid>
		<description><![CDATA[I thought I&#8217;d have a look at the SpotifyAPI to see what it&#8217;s like. Pretty nice that everything is just HTML + JS. I knocked up a small app which simply provides search links for the currently playing track. It also changes as the player&#8217;s track changes. The source is on Github.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.ur-ban.com/galleryv2/main.php?g2_view=core.DownloadItem&amp;g2_itemId=16273&amp;g2_serialNumber=1" alt="" width="550" height="319" /></p>
<p>I thought I&#8217;d have a look at the SpotifyAPI to see what it&#8217;s like. Pretty nice that everything is just HTML + JS. I knocked up a small app which simply provides search links for the currently playing track. It also changes as the player&#8217;s track changes.</p>
<p>The source is on <a href="https://github.com/Hates/spotsnax">Github</a>.</p>
<img src="http://feeds.feedburner.com/~r/Hates_/~4/lzihsCoit1Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/04/06/spotsnax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ur-ban.com/blog/2012/04/06/spotsnax/</feedburner:origLink></item>
		<item>
		<title>Logging nginx cookies with dashes</title>
		<link>http://feedproxy.google.com/~r/Hates_/~3/qQb1mJG6r3Q/</link>
		<comments>http://www.ur-ban.com/blog/2012/03/18/logging-nginx-cookies-with-dashes/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 00:20:01 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[servers]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2346</guid>
		<description><![CDATA[Strangely nginx does not support variable names with dashes or other characters other than lower/uppercase letters, digits or underscores. This means that if you are trying to log cookie values which contain dashes, as in my case, you can&#8217;t do it. Two workarounds are logging the all the cookies in one go, which can be [...]]]></description>
			<content:encoded><![CDATA[<p>Strangely nginx does not support variable names with dashes or other characters other than lower/uppercase letters, digits or underscores. This means that if you are trying to log cookie values which contain dashes, as in my case, you can&#8217;t do it.</p>

<p>Two workarounds are logging the all the cookies in one go, which can be overwhelming:</p>

<pre>

<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">log_format main '&quot;cookies=$http_cookie;&quot;';</div></div>

</pre>

<p>The other option is to map your cookie names to a variable that can be used by nginx:</p>

<pre>

<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">map $http_cookie $my_cookie {<br />
&nbsp; default '';<br />
&nbsp; ~Cookie-With-Dash=(?&lt;mc&gt;[^\;]+) $mc;<br />
}<br />
<br />
log_format main '&quot;Cookie-With-Dash=$my_cookie;&quot;';</div></div>

</pre>
<img src="http://feeds.feedburner.com/~r/Hates_/~4/qQb1mJG6r3Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/03/18/logging-nginx-cookies-with-dashes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ur-ban.com/blog/2012/03/18/logging-nginx-cookies-with-dashes/</feedburner:origLink></item>
		<item>
		<title>Successful people are successful</title>
		<link>http://feedproxy.google.com/~r/Hates_/~3/21z9hbKFkeM/</link>
		<comments>http://www.ur-ban.com/blog/2012/03/12/successful-people-are-successful/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 19:27:08 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[self-development]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2341</guid>
		<description><![CDATA[&#8230;always optimise for personal growth, for building your &#8220;success pool&#8221; that you can leverage to go from smaller successes to bigger successes. Steer away from choices that reduce this personal asset. Excellent article on what it take to be successful. When we were working on our startups, we always shot for the stars. Every bet [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p><a href="http://swombat.com/2012/3/10/successful-people">&#8230;always optimise for personal growth, for building your &#8220;success pool&#8221; that you can leverage to go from smaller successes to bigger successes. Steer away from choices that reduce this personal asset.</a></p></blockquote>
<p>Excellent article on what it take to be successful. When we were working on our startups, we always shot for the stars. Every bet was an all or nothing one, where revenue and profits were problems for the future. A lot of those decisions were out of our hands, while we always believed that first priority should always have been making enough money to keep our heads above water, rather than living on borrowed time.</p>
<img src="http://feeds.feedburner.com/~r/Hates_/~4/21z9hbKFkeM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/03/12/successful-people-are-successful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ur-ban.com/blog/2012/03/12/successful-people-are-successful/</feedburner:origLink></item>
		<item>
		<title>Neil deGrasse Tyson</title>
		<link>http://feedproxy.google.com/~r/Hates_/~3/8muCuTpqgdA/</link>
		<comments>http://www.ur-ban.com/blog/2012/03/01/2334/#comments</comments>
		<pubDate>Thu, 01 Mar 2012 09:18:09 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[quotes]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2334</guid>
		<description><![CDATA[&#8220;The problem, often not discovered until late in life, is that when you look for things in life like love, meaning, motivation, it implies they are sitting behind a tree or under a rock. The most successful people in life recognize, that in life they create their own love, they manufacture their own meaning, they [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>&#8220;The problem, often not discovered until late in life, is that when you look for things in life like love, meaning, motivation, it implies they are sitting behind a tree or under a rock. The most successful people in life recognize, that in life they create their own love, they manufacture their own meaning, they generate their own motivation.&#8221; <span class="quotee">Neil deGrasse Tyson</span></p></blockquote>
<img src="http://feeds.feedburner.com/~r/Hates_/~4/8muCuTpqgdA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/03/01/2334/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ur-ban.com/blog/2012/03/01/2334/</feedburner:origLink></item>
		<item>
		<title>Using blocks in Ruby for lazy evaluation</title>
		<link>http://feedproxy.google.com/~r/Hates_/~3/42VRPMGLyM0/</link>
		<comments>http://www.ur-ban.com/blog/2012/02/18/using-blocks-in-ruby-for-lazy-evaluation/#comments</comments>
		<pubDate>Sat, 18 Feb 2012 13:16:21 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2315</guid>
		<description><![CDATA[I&#8217;ve been working on a templating engine recently and had the need to substitute some variables on the page with the result of an slightly expensive remote API call. The first iteration was just a simple replace on the page: render_placeholder result, &#160; &#160; &#34;some_page_var&#34;, &#160; &#160; ApiWrapper.some_expensive_call def render_placeholder result, name, value &#160; result.gsub! [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a templating engine recently and had the need to substitute some variables on the page with the result of an slightly expensive remote API call. The first iteration was just a simple replace on the page:</p>

<pre>

<div class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">render_placeholder result, <br />
&nbsp; &nbsp; <span style="color:#996600;">&quot;some_page_var&quot;</span>, <br />
&nbsp; &nbsp; ApiWrapper.<span style="color:#9900CC;">some_expensive_call</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">def</span> render_placeholder result, name, value<br />
&nbsp; result.<span style="color:#CC0066; font-weight:bold;">gsub!</span> name, value<br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>

</pre>

<p>This &#8220;worked&#8221; but the problem is the call would be made even if the variable that needed replacing wasn&#8217;t on the page. The easy fix is to check it exists before making the substitution:</p>

<pre>

<div class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">render_placeholder<span style="color:#006600; font-weight:bold;">&#40;</span>result, <br />
&nbsp; <span style="color:#996600;">&quot;some_page_var&quot;</span>, <br />
&nbsp; &nbsp;ApiWrapper.<span style="color:#9900CC;">some_expensive_call</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> has_placeholder?<span style="color:#006600; font-weight:bold;">&#40;</span>result, <span style="color:#996600;">&quot;some_page_var&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">def</span> has_placeholder? result, name<br />
&nbsp; !!result<span style="color:#006600; font-weight:bold;">&#91;</span>name<span style="color:#006600; font-weight:bold;">&#93;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">def</span> render_placeholder result, name, value<br />
&nbsp; result.<span style="color:#CC0066; font-weight:bold;">gsub!</span> name, value<br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>

</pre>

<p>While this works, once you have a load of results you want to replace there ends up being a lot of duplication, and it&#8217;s easy to check the wrong variable compared to what you want to replace. One way to solve it is by passing the api call as a block to the substitution method. This way we can tidy up the code:</p>

<pre>

<div class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">render_placeholder<span style="color:#006600; font-weight:bold;">&#40;</span>result, <span style="color:#996600;">&quot;some_page_var&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> ApiWrapper.<span style="color:#9900CC;">some_expensive_call</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">def</span> has_placeholder? result, name<br />
&nbsp; !!result<span style="color:#006600; font-weight:bold;">&#91;</span>name<span style="color:#006600; font-weight:bold;">&#93;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">def</span> render_placeholder result, name<br />
&nbsp; <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#996600;">&quot;&quot;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> has_placeholder?<span style="color:#006600; font-weight:bold;">&#40;</span>result, name<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; result.<span style="color:#CC0066; font-weight:bold;">gsub!</span> name<span style="color:#996600;">&quot;, yield<br />
end</span></div></div>

</pre>
<img src="http://feeds.feedburner.com/~r/Hates_/~4/42VRPMGLyM0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/02/18/using-blocks-in-ruby-for-lazy-evaluation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ur-ban.com/blog/2012/02/18/using-blocks-in-ruby-for-lazy-evaluation/</feedburner:origLink></item>
		<item>
		<title>A day with Ubuntu Oneiric Ocelot (11.10)</title>
		<link>http://feedproxy.google.com/~r/Hates_/~3/TjWJysUSZTY/</link>
		<comments>http://www.ur-ban.com/blog/2012/02/10/a-day-with-ubuntu-oneiric-ocelot-11-10/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 23:45:24 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2307</guid>
		<description><![CDATA[I just started a short term contract doing some RoR and was given a PC to work with. While developing on RoR on Windows is possible, it&#8217;s not what I&#8217;m used to or best at. As there were no Macs I could use, I thought I would give Linux a go. Seeing as I use [...]]]></description>
			<content:encoded><![CDATA[<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://www.ur-ban.com/galleryv2/d/16264-1/omgubuntu.png" alt="Omgubuntu" title="omgubuntu.png" border="0" width="500" height="200" /></p>
<p>I just started a short term contract doing some RoR and was given a PC to work with. While developing on RoR on Windows is possible, it&#8217;s not what I&#8217;m used to or best at. As there were no Macs I could use, I thought I would give Linux a go. Seeing as I use Vim as my editor of choice, switching over should have been relatively painless.</p>
<p>I&#8217;ll just get to the point, that for many years now I&#8217;ve always said that I don&#8217;t think Linux as a desktop OS really cuts it compared to Windows or OSX, and having used it for a day and a half I still think that&#8217;s true. Off the bat the install seemed plagued with things I just wouldn&#8217;t expect from a &#8220;modern&#8221; OS.</p>
<p>The first major blunder came during the installation process. I booted off the CD and was told that a hard drive with Windows had been detected and would I like to install Ubuntu along side it. I chose yes and was shown a screen with a dropdown with HDs and a slider to allow you to resize the partition of the drive. I split it in half and set it going. Then only when half way through did I actually look at what drive had been selected by default, it had chosen an external drive as the one to get to work on. I totally accept that I should have checked it first, but I don&#8217;t understand why I was asked if I wanted to install it beside Windows for it to then choose a drive that Windows wasn&#8217;t even on as the one to set as the selected on.</p>
<p>The pain didn&#8217;t end there. Once finally up and running, my dual monitor setup was being mirrored which was easily remedied in the display settings control panel, but then it was apparent hardware acceleration wasn&#8217;t working. You couldn&#8217;t move windows without them struggling to keep up with the pointer. Trying to enable the proprietary ATI drivers didn&#8217;t work. Do I chose the normal or the post-release drivers offered? The normal drivers installed, but the displays would <em>only</em> mirror each other and the post-release ones wouldn&#8217;t even install. So I took a chance with some commands I found on a wiki which involved stripping away all the default ATI stuff and compiling my own drivers from scratch, which eventually got it running with hardware acceleration and with both screens working independently. I had no idea what the collection of commands I had run did to the system, which left me with the un-nerving feeling that the system was sort of hanging together by a thread. I was too scared to restart incase it came back with no display at all.</p>
<p>A few people advised me to ditch the Unity manager in favour of Gnome Shell, but that just made life even worse. I couldn&#8217;t even move windows without them crawling across the screen. It just felt like a total disaster and I had absolutely no faith in the install at all.</p>
<p>I remember in 1998 hearing about Linux Mandrake and traveling all the way to some dodgy warehouse in North London to buy a copy. My experience back then was actually a good one. Everything worked as it should of and using it day to day was fine. I don&#8217;t remember having <em>any</em> display or driver problems. It was only gaming that made me return to Windows back then. What has actually been achieved in 14 years? Some transparent UI elements? To me Linux still seems plagued by constant lack of driver support. Perhaps someone can explain even why just browsing the net on Linux looks bad? Why are no good fonts distributed? If you know exactly what you&#8217;re doing then you can make do. Plenty get by, perhaps I just don&#8217;t have the patience for it.</p>
<p>I just want something that works, and after some begging I convinced the place I&#8217;m at to let me use a Mac. Setting up took a fraction of the time, admittedly I&#8217;m used to it so it&#8217;ll be quicker to get up and running, but I didn&#8217;t have to worry about any drivers, display issues or whether or not my machine would survive a reboot.</p>
<img src="http://feeds.feedburner.com/~r/Hates_/~4/TjWJysUSZTY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/02/10/a-day-with-ubuntu-oneiric-ocelot-11-10/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.ur-ban.com/blog/2012/02/10/a-day-with-ubuntu-oneiric-ocelot-11-10/</feedburner:origLink></item>
	</channel>
</rss>

