<?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>HCoder.org &#187; Ruby</title>
	<atom:link href="http://hcoder.org/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://hcoder.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 09 Feb 2012 22:15:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Typo upgrade</title>
		<link>http://hcoder.org/2010/01/03/typo-upgrade-2/</link>
		<comments>http://hcoder.org/2010/01/03/typo-upgrade-2/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 20:29:00 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[rants]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have upgraded to Typo 5.4.1. Partly because of security issues, partly because of new features and improvements. It took me a while, mostly because of stupid Ruby deployment nonsense that makes me even more tired of Ruby as a language for production usage, than I already was. Oh well. One of the most important [...]]]></description>
			<content:encoded><![CDATA[<p>
	I have upgraded to Typo 5.4.1. Partly because of security issues, partly because of new features and improvements.</p>
<p>
	It took me a while, mostly because of stupid Ruby deployment nonsense that makes me even more tired of Ruby as a language for production usage, than I already was. Oh well.</p>
<p>
	One of the most important new features for me in this release was the article preview, which doesn&#39;t seem to work. Or maybe it does, but then support for writing blog posts in Textile seems like it was dropped. Suggestions for other blogging platforms that aren&#39;t a pain to upgrade because of the language dependencies, supports writing in some wiki-like syntax (e.g. Textile or Markdown) and generally works well are <em>very</em> welcome.</p>
<p>
	It seems that everything is in place and working now, but if you see anything misbehaving, please give me a shout and I&#39;ll try to fix.</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=82&amp;md5=8273c1f4c688163cc8faace0e614b85c" title="Flattr" target="_blank"><img src="http://hcoder.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://hcoder.org/2010/01/03/typo-upgrade-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://hcoder.org/?flattrss_redirect&amp;id=82&amp;md5=8273c1f4c688163cc8faace0e614b85c" type="text/html" />
	</item>
		<item>
		<title>Recent pet projects + Git + Github</title>
		<link>http://hcoder.org/2009/04/06/recent-pet-projects-git-github/</link>
		<comments>http://hcoder.org/2009/04/06/recent-pet-projects-git-github/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 22:21:00 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[darcs]]></category>
		<category><![CDATA[demisus]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[kiva]]></category>
		<category><![CDATA[loanmeter]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[sudoku]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I had mentioned that I was learning Javascript to write a Kiva Opera widget. Some time ago I released the first version of my World Loanmeter widget, and I have uploaded two more since. Not much has happened between the first and the third release from the user POV, but a couple of things were [...]]]></description>
			<content:encoded><![CDATA[<p>I had mentioned that I was <a href="http://hcoder.org/2009/02/26/kiva-api-javascript-git-and-my-first-widget-oh-my">learning Javascript to write a Kiva Opera widget</a>. Some time ago I released the first version of my <a href="http://widgets.opera.com/widget/12102/">World Loanmeter</a> widget, and I have uploaded two more since. Not much has happened between the first and the third release from the user <span class="caps">POV</span>, but a couple of things were interesting when developing it:</p>
<ul>
<li>I learned <a href="http://docs.jquery.com/QUnit">QUnit</a>, which I used to write <a href="http://github.com/emanchado/world-loanmeter/blob/31d34707728a1f7d5813a57de4d3b8caf10750ce/test/unittest.html">some really useful unit tests</a>. It&#8217;s quite nice to be able to write Javascript unit tests easily.</li>
<li>I made some <a href="http://github.com/emanchado/world-loanmeter/commit/425a4a854bc074c825b6f15546235958977da1d5">heavy refactoring</a> (see above) which made me learn some more Javascript <em>and</em> made the code much more flexible, so now the widget is not limited to a single Kiva <span class="caps">API</span> page of results, but to as many pages as needed to fetch whatever number of loans the user wants. Not to mention that the data source need not be a <span class="caps">URL</span>.</li>
<li>Now the widget actually has some configuration. Namely, the number of loans to show in the map. It also stores it persistently using the <a href="http://dev.opera.com/articles/view/opera-widgets-preference-store/">preference store</a>, which is quite nice.</li>
</ul>
<p>As I said, I used Git for it. I don&#8217;t &#8220;hate&#8221; it anymore, but I still find some things annoying, like the horrible, confusing names some options have (I&#8217;m thinking about &#8220;git checkout <file>&#8221; to revert the local changes, or &#8220;git diff &#8212;cached&#8221; to see the contents of the index/staging area; seriously guys, W-T-F?). I used to be skeptical about the &#8220;git add&#8221; for changes and then &#8220;git commit&#8221;, but I actually find it quite nice: it&#8217;s easier to plan a commit that way, and if you don&#8217;t want to plan it, you can always just &#8220;git commit <file>&#8221; directly. Also &#8220;git add -p&#8221; is really nice to commit just <em>parts</em> of a file (at last, someone copies some of the good stuff <a href="http://darcs.net/">Darcs</a> had had for ages!). Apart from Git itself, it&#8217;s cool that there is <a href="http://github.com">GitHub</a>, so it&#8217;s easy to share your repositories without having to <code>rsync</code> to some web server or similar&#8230; not to mention that your project is much more visible that way.</p>
<p>But the World Loanmeter wasn&#8217;t the only pet project I was working on these past weeks: I also wrote a simple sudoku solver, <a href="http://wiki.github.com/emanchado/demisus">demisus</a>, in Ruby. The reason? Writing a prototype of a sudoku solver in a language I&#8217;m fluent with, to play with the design and get something interesting and easy to maintain&#8230; to rewrite it in Haskell. I have been trying to learn some functional language for some years now, but I never find a &#8220;project&#8221; that is interesting enough to write some &#8220;real world program&#8221; in the language and I end up not learning anything. After starting reading <a href="http://book.realworldhaskell.org/">Real World Haskell</a>, I really felt like trying to learn the language once and for all, and I figured that a sudoku solver was easy enough to write, something I know enough about, and something math-y enough to be reasonably easy to implement in Haskell.</p>
<p>So, if you&#8217;re interested in any of them, you can have a look in Github and even contribute ;-)</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=65&amp;md5=e6722f7dfe9cd27244931593fc4215ed" title="Flattr" target="_blank"><img src="http://hcoder.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://hcoder.org/2009/04/06/recent-pet-projects-git-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://hcoder.org/?flattrss_redirect&amp;id=65&amp;md5=e6722f7dfe9cd27244931593fc4215ed" type="text/html" />
	</item>
		<item>
		<title>The ultimate TODO app</title>
		<link>http://hcoder.org/2009/02/09/the-ultimate-todo-app/</link>
		<comments>http://hcoder.org/2009/02/09/the-ultimate-todo-app/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 20:05:00 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[merb]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[todo]]></category>
		<category><![CDATA[webapp]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have been quite frustrated by TODO applications for some months now. They&#8217;re usually either too simple, or almost too complex and without features that I think are really valuable. In particular, there are two things that I don&#8217;t remember having seen in any TODO application: Possibility to &#8220;postpone&#8221; a task, so it doesn&#8217;t appear [...]]]></description>
			<content:encoded><![CDATA[<p>I have been quite frustrated by <span class="caps">TODO</span> applications for some months now. They&#8217;re usually either too simple, or almost too complex <em>and</em> without features that I think are really valuable. In particular, there are two things that I don&#8217;t remember having seen in any <span class="caps">TODO</span> application:</p>
<ol>
<li>Possibility to &#8220;postpone&#8221; a task, so it doesn&#8217;t appear in the main view for a defined time.</li>
<li>Possibility to associate a task to a &#8220;person to nag&#8221;.</li>
</ol>
<p>When you have a lot of small tasks to do, and they are not the kind of things you put in a <span class="caps">BTS</span> (say, stuff that you have to do that is not really connected to some project&#8217;s code) I think these two features are really useful, and I was surprised that no applications I saw seemed to have those. I mean, don&#8217;t people have the same problems as me?</p>
<p>That&#8217;s why, as I <a href="http://hcoder.org/2008/12/14/playing-around-with-jquery">had mentioned</a>, I started writing my own <span class="caps">TODO</span> application: I&#8217;d have what I wanted, and I&#8217;d learn a thing or two about <a href="http://www.merbivore.com/">Merb</a>, <a href="http://datamapper.org/">DataMapper</a> and <a href="http://jquery.com/">jQuery</a>. The application has several design limitations that I used to simplify things, like not having any notion of users (single user app without authentication) or supporting only a &#8220;title&#8221; for the tasks, without any longer description. It isn&#8217;t something I really plan to publish for other people to use (I mean, <a href="http://www.demiurgo.org/darcs/bubug/">the code</a> is in my <a href="http://www.demiurgo.org/darcs/">Darcs repo</a>, I&#8217;m just not going to make a project page for it or anything like that), so I don&#8217;t really care how much it fits other people&#8217;s needs :-)</p>
<p>As it is a pet project and I didn&#8217;t really mind how long it would take to finish it, I started by making some mockup of the application in <span class="caps">HTML</span> (+ a bit of Javascript with jQuery), and once I was happy, I started with the actual design and code. I think some parts of the code are nice, and it has some Ajax sweetness, but I admit I haven&#8217;t used it yet for myself: only as a kind of underpowered <span class="caps">BTS</span> for the application. Maybe I&#8217;ll upload some screenshot some day. In the meantime, feel free to download and try it out ;-)</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=57&amp;md5=8e78854115609b979b2b70f2688a08b2" title="Flattr" target="_blank"><img src="http://hcoder.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://hcoder.org/2009/02/09/the-ultimate-todo-app/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<atom:link rel="payment" href="http://hcoder.org/?flattrss_redirect&amp;id=57&amp;md5=8e78854115609b979b2b70f2688a08b2" type="text/html" />
	</item>
		<item>
		<title>Why I hate Rubygems</title>
		<link>http://hcoder.org/2008/11/23/why-i-hate-rubygems/</link>
		<comments>http://hcoder.org/2008/11/23/why-i-hate-rubygems/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 20:10:00 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[packaging]]></category>
		<category><![CDATA[rants]]></category>
		<category><![CDATA[rubygems]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have always thought that systems should be something integrated. Each &#8220;system&#8221; has its own conventions, cultural values, etc. and I think you have to respect that. I believe in the Debian way (adapting programs to an integrated system, not just creating a large collection of packages that are identical to the upstream versions), I [...]]]></description>
			<content:encoded><![CDATA[<p>I have always thought that systems should be something integrated. Each &#8220;system&#8221; has its own conventions, cultural values, etc. and I think you have to respect that. I believe in the Debian way (adapting programs to an integrated system, not just creating a large collection of packages that are identical to the upstream versions), I like to adapt my style of programming to the language (indentation conventions, identifiers, tools for building and testing, etc.), I prefer cross-platform applications that look and feel like each platform they run on, etc.</p>
<p>In the same way, I feel that the mere idea of having a programming-language-dependent packaging system is a broken idea. I <strong>know</strong> it has advantages, and I know that being specific to the language, some things work better or are more flexible, but I just don&#8217;t believe in that idea. Why should I use a different packaging system for certain things just because they&#8217;re written in Ruby? Why do I, as a user of those programs/modules, even have to know that there&#8217;s some Ruby-specific packaging system, that doesn&#8217;t integrate at all with my system&#8217;s packaging system, and mixing both leads to a mess?</p>
<p>Not only that, but Rubygems in particular is quite hostile to repackaging into a <em>platform</em>-specific packaging system. A lot of people <em>only</em> provide the gems for their software, which are harder to work with than &#8220;normal&#8221; tarballs. They also use their own conventions for directories, that break the <span class="caps">FHS</span> (for example) and basically only make sense in the context of Rubygems. In that sense, <a href="http://search.cpan.org/"><span class="caps">CPAN</span></a> is much better (although I think using it for application deployment is a <em>very</em> bad idea, but that&#8217;s a different matter), because at least it installs everything in sane directories, it doesn&#8217;t change Perl in any way, and it&#8217;s not a special <em>format</em>, just a repository of easy-to-install, easy-to-work-with, easy-to-hack, easy-to-repackage &#8220;distributions&#8221;.</p>
<p>Why, oh, why?</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=48&amp;md5=9dc1a4817603aa1ba663d5435f92cdfc" title="Flattr" target="_blank"><img src="http://hcoder.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://hcoder.org/2008/11/23/why-i-hate-rubygems/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<atom:link rel="payment" href="http://hcoder.org/?flattrss_redirect&amp;id=48&amp;md5=9dc1a4817603aa1ba663d5435f92cdfc" type="text/html" />
	</item>
		<item>
		<title>Typo upgrade</title>
		<link>http://hcoder.org/2008/08/07/typo-upgrade/</link>
		<comments>http://hcoder.org/2008/08/07/typo-upgrade/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 21:05:00 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Meta]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[problems]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[typo]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Hey there! I have just upgraded Typo. It was slightly traumatic, because at first the blog broke horribly and I couldn&#8217;t see anything other than errors 500. To be fair, the change was quite big, because it included also an upgrade to Rails 2 (I was using some older Typo that used Rails 1.2.x), so [...]]]></description>
			<content:encoded><![CDATA[<p>Hey there!</p>
<p>I have just upgraded Typo. It was slightly traumatic, because at first the blog broke horribly and I couldn&#8217;t see anything other than errors 500. To be fair, the change was quite big, because it included also an upgrade to Rails 2 (I was using some older Typo that used Rails 1.2.x), so everything worked better than expected.</p>
<p>I could login as admin, and change preferences and whatnot, and the only thing that was broken was the public view of the blog. I had a look at the logs, and it complained about not being able to find some template for the sidebars. I was very confused, and didn&#8217;t know where to starting looking for this. So, obviously, I asked &#8220;Señor Google&#8221;. He didn&#8217;t tell me that much, but someone left me the following hint: if you comment out the call to the helper `render_sidebars` (in the active theme code) solved the problem&#8230;. at the price of not having sidebars of course.</p>
<p>So I decided to connect a Ruby/Rails console to the production database, and have a look at the Sidebar model. The summary of what I did is this:</p>
<p>&gt;&gt; Sidebar.find(:all, :order =&gt; &#8216;active_position <span class="caps">ASC</span>&#8217;).<br />
map {|s| s.active_position}<br />
=&gt; [0, 0, 1, 1, 2, 2, 3, 4]<br />
&gt;&gt; Sidebar.find(:all, :order =&gt; &#8216;active_position <span class="caps">ASC</span>&#8217;).<br />
map {|s| s.type}<br />
=&gt; [nil, &#8220;CategorySidebar&#8221;, nil, &#8220;ArchivesSidebar&#8221;, nil,<br />
&#8220;TagSidebar&#8221;, &#8220;StaticSidebar&#8221;, &#8220;XmlSidebar&#8221;]<br />
&gt;&gt; Sidebar.find(:all, :order =&gt; &#8216;active_position <span class="caps">ASC</span>&#8217;).<br />
find_all {|s| s.type.nil?}.size<br />
=&gt; 3<br />
&gt;&gt; Sidebar.find(:all, :order =&gt; &#8216;active_position <span class="caps">ASC</span>&#8217;).<br />
find_all {|s| s.type.nil?}.each {|s| s.destroy}<br />
=&gt; [#&lt;Sidebar id: 1, active_position: 0, config: {&quot;empty&quot;=&gt;false, &#8220;count&#8221;=&gt;true}, staged_position: nil, type: nil&gt;,<br />
#&lt;Sidebar id: 2, active_position: 1, config: {&quot;title&quot;=&gt;&quot;Links&quot;, &#8220;body&#8221;=&gt;&quot;&#8230;&quot;}, staged_position: nil, type: nil&gt;,<br />
#&lt;Sidebar id: 3, active_position: 2, config: {&quot;format&quot;=&gt;&quot;rss20&quot;, &#8220;trackbacks&#8221;=&gt;true, &#8220;comments&#8221;=&gt;true, &#8220;articles&#8221;=&gt;true}, staged_position: nil, type: nil&gt;]<br />
&gt;&gt; Sidebar.find(:all, :order =&gt; &#8216;active_position <span class="caps">ASC</span>&#8217;).find_all {|s| s.type.nil?}.size<br />
=&gt; 0</p>
<p>So, the problem is that there were some (severely broken) leftovers of the upgrade. I just removed them, and everything started working again. Phew!</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=35&amp;md5=8273c1f4c688163cc8faace0e614b85c" title="Flattr" target="_blank"><img src="http://hcoder.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://hcoder.org/2008/08/07/typo-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://hcoder.org/?flattrss_redirect&amp;id=35&amp;md5=8273c1f4c688163cc8faace0e614b85c" type="text/html" />
	</item>
	</channel>
</rss>

