<?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"
	>

<channel>
	<title>lixo.org</title>
	<atom:link href="http://www.lixo.org/feed" rel="self" type="application/rss+xml" />
	<link>http://www.lixo.org</link>
	<description>letting the problem solve itself</description>
	<pubDate>Fri, 25 Apr 2008 09:21:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Go for a walk</title>
		<link>http://www.lixo.org/archives/2008/04/25/go-for-a-walk/</link>
		<comments>http://www.lixo.org/archives/2008/04/25/go-for-a-walk/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 09:21:15 +0000</pubDate>
		<dc:creator>Carlos Villela</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.lixo.org/archives/2008/04/25/go-for-a-walk/</guid>
		<description><![CDATA[
 

How many times have you had a conversation that started with &#8220;so while I was in the shower last night, I figured out how to&#8230;&#8221;, or something to that effect?
I naturally set out some time to think and daydream a little &#8211; about 10 minutes every two hours or so, while I have a [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
 <a href="http://www.flickr.com/photos/lapsklaus/252826612/" title="photo sharing"><img src="http://farm1.static.flickr.com/93/252826612_36a0c527b5_m.jpg" alt="" style="border: solid 2px #000000;" /></a>
</div>
<p>How many times have you had a conversation that started with &#8220;so while I was in the shower last night, I figured out how to&#8230;&#8221;, or something to that effect?</p>
<p>I naturally set out some time to think and daydream a little &#8211; about 10 minutes every two hours or so, while I have a cigarette (unfortunately, the <a href="http://en.wikipedia.org/wiki/Smoking_ban#History">nazi smoking ban</a> hasn&#8217;t been enough to force me to quit just yet): most smokers will tell you that the hardest thing to give up are the ad-hoc social interactions you get with other people who wouldn&#8217;t otherwise only chat with or even meet.</p>
<p>But you don&#8217;t need to cover your lungs in filth just so you can have an excuse to think. When faced with a problem you want to solve, or even to find out where the real problems are in the first place, try what the native americans called the <em>Medicine Walk</em>:</p>
<blockquote><p>The medicine walk is a day&#8217;s journey upon the face of the earth. It is also a mirror. In it, signs and symbols of your inward journey are reflected. The walk is a distilled form of the vision quest.</p>
</blockquote>
<p>It doesn&#8217;t need to last a day, and it doesn&#8217;t need to sound like such an epic spiritual crusade either. Just get up and walk to place that&#8217;s about 10 or 20 minutes away, and that&#8217;s it. Take no distractions with you &#8211; no iPods, no phone, just about enough change to buy a cup of coffee once you get there, and then head back. Pay attention to the sounds, other people going about their lives, cars and buses passing by, the architecture of buildings, the colours and shapes and symbols around you. Look out for patterns, coincidences, and most importantly, pay attention to the internal dialogue going on in your head: it&#8217;ll be trying to pick apart the problem at hand, and you can follow some basic retrospective techniques to work some of it out once you&#8217;re in that state of mind.</p>
<p>After doing that on purpose for a bit, I noticed that going out for a walk works even better with a pair. You might need to take a longer break &#8211; I found that 20 to 30 minutes of walk time is ideal. That&#8217;ll give you about an hour to think, talk and socialise the ideas and problems at hand. Also, notice how easy it is to work out disagreements and suggest new things to try out; promenading has very different brainwave generating patterns, and is probably one of the best tools I have to stimulate creative thinking.</p>
<p><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lixo.org/archives/2008/04/25/go-for-a-walk/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Binary Guitar</title>
		<link>http://www.lixo.org/archives/2008/04/20/binary-guitar/</link>
		<comments>http://www.lixo.org/archives/2008/04/20/binary-guitar/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 02:45:27 +0000</pubDate>
		<dc:creator>Carlos Villela</dc:creator>
		
		<category><![CDATA[Geek]]></category>

		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.lixo.org/archives/2008/04/20/binary-guitar/</guid>
		<description><![CDATA[



The Binary Guitar is a little experiment (took about a day or two to put together) I played with a couple of months ago, and I thought it was fun enough to share.
Installation is seriously clunky &#8211; I have never tried it on anything but MacOS X Leopard running on a MacBook Pro so far, [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
<object type="application/x-shockwave-flash" width="260" height="213" data="http://www.flickr.com/apps/video/stewart.swf?v=1.173" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&amp;photo_secret=1135d65517&amp;photo_id=2399863051&amp;show_info_box=true"></param><param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=1.173"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=1.173" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&amp;photo_secret=1135d65517&amp;photo_id=2399863051&amp;flickr_show_info_box=true" height="213" width="260"></embed></object><br />

</div>
<p>The Binary Guitar is a little experiment (took about a day or two to put together) I played with a couple of months ago, and I thought it was fun enough to share.</p>
<p>Installation is seriously clunky &#8211; I have never tried it on anything but MacOS X Leopard running on a MacBook Pro so far, and even then there are lots of moving parts, but if you go through the pain of setting it all up, you should have some pretty decent sounds coming out of a <span class="caps">USB</span> Guitar Hero Controller (mine&#8217;s the X-Plorer, which comes with Guitar Hero II for the Xbox 360).</p
<p><strong>You&#8217;ll need:</strong></p>
<ul>
<li><a href="http://puredata.info">PureData</a></li>
<li><a href="http://developer.apple.com/graphicsimaging/quartz/quartzcomposer.html">Quartz Composer</a></li>
<li><a href="http://www.apple.com/downloads/macosx/audio/midipipe.html">MidiPipe</a></li>
<li><a href="http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver">Xbox 360 Controller Driver</a></li>
<li><a href="http://www.apple.com/ilife/garageband/">GarageBand</a> or other software that understands <span class="caps">MIDI</span></li>
</ul>
<p><strong>Running:</strong></p>
<ol>
<li>Install everything</li>
<li>Open PD to <span class="caps">MIDI</span>.mipi in MidiPipe</li>
<li>Open Binary Guitar.pd in PureData</li>
<li>Go to Pure Data / Preferences / <span class="caps">MIDI</span> settings&#8230; and point the <span class="caps">MIDI</span> inputs and outputs to MidiPipe</li>
<li>Open Binary Guitar.qtz in Quartz Composer</li>
<li>Connect the X-Plorer Guitar. If everything&#8217;s working correctly, the Quartz Composer viewer should be black (rather <br />
than a checkered pattern)</li>
<li>Open GarageBand, select your favourite virual instrument.</li>
<li>Rock on!</li>
</ol>
<p>Grab it in <a href="http://github.com/cv/compositions/tree/master/Binary%20Guitar">my github repository</a>.</p>
<p><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lixo.org/archives/2008/04/20/binary-guitar/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JavaScript: Put everything in a namespace</title>
		<link>http://www.lixo.org/archives/2007/09/14/javascript-put-everything-in-a-namespace/</link>
		<comments>http://www.lixo.org/archives/2007/09/14/javascript-put-everything-in-a-namespace/#comments</comments>
		<pubDate>Fri, 14 Sep 2007 16:02:01 +0000</pubDate>
		<dc:creator>Carlos Villela</dc:creator>
		
		<category><![CDATA[Geek]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.lixo.org/archives/2007/09/14/javascript-put-everything-in-a-namespace/</guid>
		<description><![CDATA[
 

Yes, everything. Put it in a namespace. Everything. No exceptions and no excuses, unless yours is &#8220;I have just been thawed.&#8221; In this case, I want to be the first to warmly welcome you to the 21st century.
Here&#8217;s a simple and reasonably OK way to do it and be nice to your friends, other [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
 <a href="http://www.flickr.com/photos/86953562@N00/455843984/" title="photo sharing"><img src="http://farm1.static.flickr.com/173/455843984_a4a8fe4b52_m.jpg" alt="" style="border: solid 2px #000000;" /></a>
</div>
<p>Yes, everything. Put it in a namespace. Everything. No exceptions and no excuses, unless yours is &#8220;I have just been thawed.&#8221; In this case, I want to be the first to warmly welcome you to the 21st century.</p>
<p>Here&#8217;s a simple and reasonably OK way to do it and be nice to your friends, other libraries and the world at large:</p>
<pre>
var Article = Article ? Article : new Object();
Article.title = &#8220;Report: School Shootings Help Prepare Students For Being Shot In Real World&#8221;;
Article.save = function() {
  alert(&#8221;Saving &#8221; + this.title);
}
</pre>
<p>You could save a few keystrokes, though. Just use the object literal notation directly:</p>
<pre>
var Article = Article ? Article : {
  title: &#8220;Report: School Shootings Help Prepare Students For Being Shot In Real World&#8221;,
  save: function() {
    alert(&#8221;Saving &#8221; + this.title) 
  }
}
</pre>
<p>These two last examples are great if you&#8217;re not that concerned about exposing the &#8216;title&#8217; attribute to the rest of the world. If there is a chance that problems could arise if some other piece of code changed it directly, there is a solution:</p>
<pre>
var Article = Article ? Article : function() {
  var private = {
    title: &#8220;Report: School Shootings Help Prepare Students For Being Shot In Real World&#8221;
  };

  var public = {
    getTitle: function() {
      return private.title;
    },

    save: function() {
      alert(&#8221;Saving &#8221; + this.getTitle());
    }  
  }

  return public;
}();
</pre>
<p>I find this a bit hard to get used to, after so many years of developing in languages that explicitly allow me to set access control. It makes sense, though: by creating an anonymous function that returns the object I want to define, and then immediately calling it (note the &#8216;()&#8217; at the last line), I can hide whatever I don&#8217;t want other parts of the code to see - it&#8217;s all tucked away in the local context of that anonymous function.<br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lixo.org/archives/2007/09/14/javascript-put-everything-in-a-namespace/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Project Game</title>
		<link>http://www.lixo.org/archives/2007/06/13/the-project-game/</link>
		<comments>http://www.lixo.org/archives/2007/06/13/the-project-game/#comments</comments>
		<pubDate>Wed, 13 Jun 2007 20:33:17 +0000</pubDate>
		<dc:creator>Carlos Villela</dc:creator>
		
		<category><![CDATA[Geek]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Work]]></category>

		<category><![CDATA[Agile]]></category>

		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://www.lixo.org/archives/2007/06/13/the-project-game/</guid>
		<description><![CDATA[
 

After reading A Theory Of Fun, I started seeing projects (and many other human activities) modelled as a game. In the book, Raph Koster describes a series of game development rules, and I found that they can be mapped to the software development project domain with some interesting results:

A project, just like a game, [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
 <a href="http://www.flickr.com/photos/ahmedzahid/44627552/" title="photo sharing"><img src="http://farm1.static.flickr.com/31/44627552_7239172823_m.jpg" alt="" style="border: solid 2px #000000;" /></a>
</div>
<p>After reading <a href="http://www.theoryoffun.com">A Theory Of Fun</a>, I started seeing projects (and many other human activities) modelled as a game. In the book, <a href="http://www.raphkoster.com">Raph Koster</a> describes a series of game development rules, and I found that they can be mapped to the software development project domain with some interesting results:</p>
<ul>
<li>A project, just like a game, has roles. In projects, they&#8217;re specific to each role. These rules define the possible actions for each of them. <em>(This one isn&#8217;t described in the book, but I added it just to contextualise.)</em></li>
<li>Role-specific rules should be unambiguous, intelligible and apply to all people in that role.</li>
<li>No project can be developed without the meaningful interaction of the people in all roles.</li>
<li>The outcome of a project has to be uncertain, otherwise it loses its appeal.</li>
<li>Rules and representation of a project are not independent but interact with each other.</li>
<li>People require clear and immediate feedback to understand the relationship between action and outcome.</li>
<li>People require a clear goal so they can perform meaningful actions within the project world.</li>
<li>Conflict and competition against time, budget and scope are essential for everyone&#8217;s motivation.</li>
<li>The challenges of a project should match the skills of the people involved: neither too easy (boring) nor too difficult (frustrating).</li>
<li>Projects can be developed without the need for even skill sets among the team. Instead the people learn through interaction, and this should be allowed and encouraged to happen.</li>
<li>People perform actions within the project world and observe how these actions change the state of the project.</li>
<li>People form a hypothesis about the meaning of a deliverable or action on the basis of their studies.</li>
<li>People recognise and learn fundamental patterns within the project and can apply these to different situations (and, of course, other projects).</li>
</ul>
<p>The more I look at these, the more this matches the way I see people working in agile projects. I&#8217;m sure there&#8217;s a lesson to be learned here&#8230;</p>
<p><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lixo.org/archives/2007/06/13/the-project-game/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tip: get your TODOs out of the comments</title>
		<link>http://www.lixo.org/archives/2007/06/06/tip-get-your-todos-out-of-the-comments/</link>
		<comments>http://www.lixo.org/archives/2007/06/06/tip-get-your-todos-out-of-the-comments/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 13:16:47 +0000</pubDate>
		<dc:creator>Carlos Villela</dc:creator>
		
		<category><![CDATA[Geek]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Work]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.lixo.org/archives/2007/06/06/tip-get-your-todos-out-of-the-comments/</guid>
		<description><![CDATA[
 

Developers in most projects I have seen try to establish some sort of convention around leaving TODOs in the code. The most common seems to be &#8220;if you see something funny, try to fix it immediately, but if it&#8217;d take too long and you&#8217;ve got something else to worry about, leave a comment next [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
 <a href="http://www.flickr.com/photos/psycrow/268021578/" title="photo sharing"><img src="http://farm1.static.flickr.com/118/268021578_467c1e116a_m.jpg" alt="" style="border: solid 2px #000000;" /></a>
</div>
<p>Developers in most projects I have seen try to establish some sort of convention around leaving TODOs in the code. The most common seems to be &#8220;if you see something funny, try to fix it immediately, but if it&#8217;d take too long and you&#8217;ve got something else to worry about, leave a comment next to it starting with TODO, your initials and maybe a date&#8221;.</p>
<p>You know what? Using comments for that is not as cool in Ruby, Python or Java, which has had static imports for a while now. How about creating a TODO method that takes in the initials, date and comment text, or whatever else you might find useful?</p>
<blockquote><pre>
import static my.project.DevelopmentUtils.TODO;

&#8230;

public void doStuffThatSmellsFunny() {
   TODO(&#8221;CV, 21/jan&#8221;, &#8220;Clean this mess up after fixing #3849&#8243;);
   &#8230;
}
</pre>
</blockquote>
<p>There are some advantages to this: you can actually put some code inside that method to do, say, logging. Another good thing is that now the TODOs can be tracked using the same refactoring tools and features of modern IDEs as just any other code in the project.</p>
<p>It may seem a bit cumbersome, but I&#8217;ve been trying that for a few days now and it feels quite pleasant to use. I got my TODO method to just spit out the message to the console so when I run tests, I can quickly get an idea of what areas of the code touch stinky or incomplete ones.<br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lixo.org/archives/2007/06/06/tip-get-your-todos-out-of-the-comments/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Viral software (and in a good way)</title>
		<link>http://www.lixo.org/archives/2007/05/29/viral-software-and-in-a-good-way/</link>
		<comments>http://www.lixo.org/archives/2007/05/29/viral-software-and-in-a-good-way/#comments</comments>
		<pubDate>Tue, 29 May 2007 22:48:18 +0000</pubDate>
		<dc:creator>Carlos Villela</dc:creator>
		
		<category><![CDATA[Geek]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Web]]></category>

		<category><![CDATA[WebServices]]></category>

		<guid isPermaLink="false">http://www.lixo.org/archives/2007/05/29/viral-software-and-in-a-good-way/</guid>
		<description><![CDATA[
 

I&#8217;ve been hanging out with friends in São Paulo over the last few days, getting unreasonably drunk, eating too much and attending the Google Developer Day, not necessarily in that order, so I missed the announcements that Facebook had opened up their API.
As a software developer with a healthy affection for all things related [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
 <a href="http://www.flickr.com/photos/quiplash/61309174/" title="photo sharing"><img src="http://farm1.static.flickr.com/25/61309174_35c7397efc_m.jpg" alt="" style="border: solid 2px #000000;" /></a>
</div>
<p>I&#8217;ve been hanging out with friends in São Paulo over the last few days, getting unreasonably drunk, eating too much and attending the <a href="http://code.google.com/events/developerday/">Google Developer Day</a>, not necessarily in that order, so I missed the announcements that <a href="http://developers.facebook.com/">Facebook had opened up their API</a>.</p>
<p>As a software developer with a healthy affection for all things related to network effects and emergent behaviours, this is brilliant.</p>
<p>The applications provided get added to a central registry inside Facebook, from where you can pick and choose the ones you want added to your profile. They still have to be deployed separately (as Facebook doesn&#8217;t host them for you), but the user doesn&#8217;t see any of that - all of it is a very simple and well-designed UI, so &#8220;installing&#8221; an application to your profile is a hell of a lot easier than installing a desktop application to your machine, and gives the user instant feedback.</p>
<p>Leaving important considerations on data ownership and privacy aside, which I won&#8217;t comment on since I haven&#8217;t read the agreements in much detail, I can see this thing eating a huge chunk of what we nowadays use disconnected internet applications for. Instant, mobile and email-like messaging, discussion groups, photo sharing and some other basic kinds of applications are already there, as are little data aggregation tools, like the del.icio.us and Magnolia importers. If this API is successful (and so far, nothing suggests otherwise), other social networks could as well be dragged inside Facebook if they support any kind of external API. And, if not, there are always screen scraping tools like <a href="http://code.whytheluckystiff.net/hpricot/">Hpricot</a>.</p>
<p>Something to watch out for, definitely. Ten years ago, we were wondering what kinds of applications could be made to run on the internet. Facebook is making us wonder what kinds of applications can be made to run on top of a social network. Which ones would you try?<br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lixo.org/archives/2007/05/29/viral-software-and-in-a-good-way/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thanks, Oracle</title>
		<link>http://www.lixo.org/archives/2007/04/23/thanks-oracle/</link>
		<comments>http://www.lixo.org/archives/2007/04/23/thanks-oracle/#comments</comments>
		<pubDate>Mon, 23 Apr 2007 13:28:17 +0000</pubDate>
		<dc:creator>Carlos Villela</dc:creator>
		
		<category><![CDATA[Geek]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Work]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.lixo.org/archives/2007/04/23/thanks-oracle/</guid>
		<description><![CDATA[
 

We&#8217;re using Oracle at my current project. I wanted to run some reporting scripts on the database to do some nice graphs with Graphviz and yEd. &#8220;Well, that&#8217;s been done before, should be pretty easy to hook up ActiveRecord to Oracle&#8221;, I thought.
It turns out that&#8217;s nearly impossible to do on an Intel Mac [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
 <a href="http://www.flickr.com/photos/stuckincustoms/387019269/" title="photo sharing"><img src="http://farm1.static.flickr.com/182/387019269_068fd16670_m.jpg" alt="" style="border: solid 2px #000000;" /></a>
</div>
<p>We&#8217;re using Oracle at my current project. I wanted to run some reporting scripts on the database to do some nice graphs with Graphviz and yEd. &#8220;Well, that&#8217;s been done before, should be pretty easy to hook up ActiveRecord to Oracle&#8221;, I thought.</p>
<p>It turns out that&#8217;s nearly impossible to do on an Intel Mac running the x86 version of Ruby, since the Oracle Instant Client SDK only ships with PowerPC binaries so far (hence the title). Unless you recompile your whole Ruby install to PPC, something that to me sits somewhere between unspeakable and atrocious, you can&#8217;t link to its libraries, as far as I can tell.</p>
<p>But you can get SQLPlus to run on Rosetta. And you can get SQLPlus to spit out reasonably parseable HTML. And it&#8217;ll run slow - but for a quick-n-dirty report that you want to generate once every couple of months or so, it&#8217;s&#8230; ok.</p>
<p><code>
<pre>
def select_all(sql)
  html = `echo &#8220;#{sql};&#8221; | sqlplus -r 3 -l -s -m &#8220;html on entmap on&#8221; #{@user}/#{@password}@#{@host}`
  doc = Hpricot(html)
  (doc/&#8217;tr&#8217;).collect do |tr| 
    (tr/&#8217;td&#8217;).collect do |td|
      td.innerText.strip if td.innerText 
    end if (tr/&#8217;td&#8217;).size == (doc/&#8217;tr/th&#8217;).collect do |th|
      th.innerText.strip if th.innerText
    end.uniq.size
  end.compact
end
</pre>
<p></code></p>
<p>Look what you made me do, Oracle. You should be ashamed. As you can see, though, I&#8217;m not that easily embarrassed. Some people wouldn&#8217;t ever show this code to anyone, and deny its existence at all possible cost. I think it&#8217;s worth the shock value, though. <img src='http://www.lixo.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lixo.org/archives/2007/04/23/thanks-oracle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I love the OSA</title>
		<link>http://www.lixo.org/archives/2007/04/05/i-love-the-osa/</link>
		<comments>http://www.lixo.org/archives/2007/04/05/i-love-the-osa/#comments</comments>
		<pubDate>Thu, 05 Apr 2007 14:32:34 +0000</pubDate>
		<dc:creator>Carlos Villela</dc:creator>
		
		<category><![CDATA[Geek]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Entertainment]]></category>

		<category><![CDATA[Games]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.lixo.org/archives/2007/04/05/i-love-the-osa/</guid>
		<description><![CDATA[
 

Inspired by Nat Pryce&#8217;s recent scrapheap challenge idea for a Name That Tune style game, and given I&#8217;ve been having so much fun with the Ruby OSA lately, I decided to implement my own solution using it to drive iTunes and I had a lot of fun in the process.
I started by grabbing a [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
 <a href="http://www.flickr.com/photos/phraseling/10320340/" title="photo sharing"><img src="http://farm1.static.flickr.com/7/10320340_8d3c0ba7a2_m.jpg" alt="" style="border: solid 2px #000000;" /></a>
</div>
<p>Inspired by <a href="http://nat.truemesh.com/">Nat Pryce</a>&#8217;s recent <a href="http://nat.truemesh.com/archives/000680.html">scrapheap challenge idea</a> for a Name That Tune style game, and given I&#8217;ve been having so much fun with the <a href="http://rubyosa.rubyforge.org/">Ruby OSA</a> lately, I decided to implement my own solution using it to drive <a href="http://www.apple.com/itunes/">iTunes</a> and I had a lot of fun in the process.</p>
<p>I started by grabbing a reference to iTunes:</p>
<p><code>
<pre>
%w(rubygems rbosa).each {|lib| require lib }

itunes = OSA.app(&#8221;iTunes&#8221;)
</pre>
<p></code></p>
<p>And then playing about with it until I found the right properties to look at and methods to call. As the game requires a constant stream of random tracks, I thought using the Party Shuffle feature of iTunes to would fit just right. The Party Shuffle is a special playlist that sits inside your library:</p>
<p><code>
<pre>
library = itunes.sources.find {|s| s.kind == OSA::ITunes::ESRC::LIBRARY }
party_shuffle = library.playlists.find {|p| p.special_kind == OSA::ITunes::ESPK::PARTY_SHUFFLE }
</pre>
<p></code></p>
<p>With that <code>party_shuffle</code> (an <code>OSA::ITunes::Playlist</code> object) at hand, it&#8217;s pretty easy to do the rest: playing, changing tracks and figuring out how to score each guess.</p>
<p>If you can grab <a href="http://code.lixo.org/src/toys/name_that_tune.rb">the complete solution</a> and make it into a nice little <a href="http://www.apple.com/macosx/features/dashboard/">dashboard widget</a>, I&#8217;ll be forever in debt!<br />
<br/><br />
<strong>BONUS UPDATE:</strong> I just finished refactoring a couple of things (namely, moving the monkey patching of <code>OSA::ITunes</code> away - it&#8217;s now in <a href="http://code.lixo.org/src/toys/itunes.rb">itunes.rb</a>) and, in the process of doing so, <a href="http://code.lixo.org/src/toys/tune_fight.rb">Tune Fight</a> was born!</strong><br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lixo.org/archives/2007/04/05/i-love-the-osa/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How would you improve this page?</title>
		<link>http://www.lixo.org/archives/2007/02/08/how-would-you-improve-this-page/</link>
		<comments>http://www.lixo.org/archives/2007/02/08/how-would-you-improve-this-page/#comments</comments>
		<pubDate>Thu, 08 Feb 2007 00:24:50 +0000</pubDate>
		<dc:creator>Carlos Villela</dc:creator>
		
		<category><![CDATA[Geek]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Work]]></category>

		<category><![CDATA[Agile]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Testing]]></category>

		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.lixo.org/archives/2007/02/08/how-would-you-improve-this-page/</guid>
		<description><![CDATA[
 

On an application I&#8217;ve been working during my spare time, I had the need to ask my loyal friends and guinea pigs to give me some feedback, in order to help me fill in the gaps between what I think they want to do and what they really want to do in this application.
A [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
 <a href="http://www.flickr.com/photos/cv/383185999/" title="photo sharing"><img src="http://farm1.static.flickr.com/125/383185999_1e9f1b518b_m.jpg" alt="" style="border: solid 2px #000000;" /></a>
</div>
<p>On an application I&#8217;ve been working during my spare time, I had the need to ask my loyal friends and guinea pigs to give me some feedback, in order to help me fill in the gaps between what I think they want to do and what they really want to do in this application.</p>
<p>A quick, cheap and really useful solution I came up with was adding a feedback form right there, on every page the application renders. This can certainly be improved by people more knowledgeable in Rails than myself, as for now it doesn&#8217;t even use AJAX to post the data back (shame, shock and horror!)</p>
<p>After running <code>scaffold_resource Comment body:text uri:string created_by:integer created_at:timestamp</code>, you should be pretty much set to go. Now, on your <code>application.rhtml</code>, you can do something like:</p>
<pre>
&lt;%= render :partial =&gt; &#8220;comment&#8221;, :collection =&gt;<br/>Comment.find_all_by_uri(request.request_uri) %&gt;

&lt;% form_for :comment, Comment.new, :url =&gt; comments_path do |f| %&gt;
  &lt;%= f.hidden_field :uri, :value =&gt; request.request_uri %&gt;
  How would you improve this page?
  &lt;%= f.text_area :body, :rows =&gt; 5 %&gt;
  &lt;%= submit_tag &#8216;Add comment&#8217; %&gt;
&lt;% end %&gt;
</pre>
<p>The <code>_comment.rhtml</code> partial is something like this:</p>
<pre>
&lt;%= comment.body %&gt;
Created by &lt;%= if comment.created_by.nil?
    &#8216;unknown&#8217;
else
    link_to(comment.created_by.name,
      profile_url(comment.created_by.profile))
end %&gt;

&lt;%= time_ago_in_words comment.created_at %&gt; ago

[&lt;%= link_to &#8216;Destroy&#8217;, comment_path(comment.id), :method =&gt; :delete %&gt;]
</pre>
<p>Customize the Comment controller slightly, and that&#8217;s it &#8212; instant feedback forms everywhere! <img src='http://www.lixo.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lixo.org/archives/2007/02/08/how-would-you-improve-this-page/feed/</wfw:commentRss>
		</item>
		<item>
		<title>On Socks and Services</title>
		<link>http://www.lixo.org/archives/2007/01/11/on-socks-and-services/</link>
		<comments>http://www.lixo.org/archives/2007/01/11/on-socks-and-services/#comments</comments>
		<pubDate>Thu, 11 Jan 2007 13:50:37 +0000</pubDate>
		<dc:creator>Carlos Villela</dc:creator>
		
		<category><![CDATA[Geek]]></category>

		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.lixo.org/archives/2007/01/11/on-socks-and-services/</guid>
		<description><![CDATA[
 

Every morning, you have a shower and put some clean socks on. You might still wear the same trousers as the other day, or that t-shirt you wore last friday. Or even an inside-out pair of boxers if you just can&#8217;t be bothered. But in the name of all that&#8217;s sacred, you need a [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;">
 <a href="http://www.flickr.com/photos/eris23/103766956/" title="photo sharing"><img src="http://farm1.static.flickr.com/16/103766956_c0e79f7e92_m.jpg" alt="" style="border: solid 2px #000000;" /></a>
</div>
<p>Every morning, you have a shower and put some clean socks on. You might still wear the same trousers as the other day, or that t-shirt you wore last friday. Or even an inside-out pair of boxers if you just can&#8217;t be bothered. But in the name of all that&#8217;s sacred, you need a fresh pair of socks every morning. Don&#8217;t dispute this fact.</p>
<p>And there are millions of ways to end up with at least one pair of fresh socks in your drawer, but it&#8217;s basically down to either constantly buying new ones, washing them yourself or getting someone else to do it for you, with various degrees of automation.</p>
<p>Suppose, like me, you already tried to buy a 7-pack of socks every week for about two months and realised that was a bad economic decision (and also not a very ecological one), and that you want to dedicate your time at home to learn how to cook that stuff you see on <a href="http://www.cookingforengineers.com/">Cooking For Engineers</a>, instead of having to constantly remind yourself to do the laundry. You just don&#8217;t want to think too much about it, if at all.</p>
<p>In fact, you want to minimise your involvement in the time it takes to do it, even if the task itself takes a bit longer. The laundrette next door seems like a good idea in this case - your involvement is reduced as now you don&#8217;t have to do so many little washes because of the laughable size of the washing machine in your flat.</p>
<p>This would be the equivalent of something like a Web Service. You have to go there, in baskets as big and full as possible as to avoid doing too many trips. You&#8217;re subject to environment instability (after all, it&#8217;s annoying to walk there in the rain or if the network is playing up) but the economies of scale make it quite cheap. <a href="http://aws.amazon.com/s3">Amazon S3</a> is a great example.</p>
<p>Then there&#8217;s the other laundrette on the high street, which offers pick-up and drop-off. You have even less involvement because now even the question of how your socks get to the service is out of your mind. An equivalent would be a good runtime library - you don&#8217;t care how it does it, you just tell it to do stuff, and it works. The environment doesn&#8217;t interfere as much, but contrary to the laundrette example, libraries are a lot cheaper to use - in fact, you&#8217;ll see in this an inverse relation of cost between the examples.</p>
<p>If you really don&#8217;t want to think about the socks, though, you&#8217;ll want to hire a maid. A maid will set you back a considerable amount, but your involvement is absolutely zero and your clothes would get washed as soon as they become dirty: a considerably better service. An equivalent would be language runtime features such as a GC, which are almost invisible except when you attend to the fact you&#8217;re not doing it yourself.</p>
<p>From there, we can extrapolate:</p>
<p><i>As software developer-facing services become more elaborate, they require less involvement and cost less to use.</i></p>
<p><i>As sock-washing services become more elaborate, they require less involvement and cost more to use.</i></p>
<p>I imagine we can all quickly understand now why asking your girlfriend to do your laundry is a bad idea, but I&#8217;m not sure what&#8217;s the software development lesson from all of this.<br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lixo.org/archives/2007/01/11/on-socks-and-services/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 2.035 seconds -->
