<?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; projects</title>
	<atom:link href="http://hcoder.org/tag/projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://hcoder.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 15 Apr 2012 21:43:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Unit testing advice for seasoned hackers (2/2)</title>
		<link>http://hcoder.org/2012/02/15/unit-testing-advice-for-seasoned-hackers-22/</link>
		<comments>http://hcoder.org/2012/02/15/unit-testing-advice-for-seasoned-hackers-22/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 22:24:42 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[automated tests]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tor]]></category>
		<category><![CDATA[unit]]></category>

		<guid isPermaLink="false">http://hcoder.org/?p=1322</guid>
		<description><![CDATA[This is the second part of my unit testing advice. See the first part on this blog. If you need any introduction you should really read the first part. I&#8217;ll just present the other three ideas I wanted to cover. Focusing on common cases This consists of testing only/mostly common cases. These tests rarely fail [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is the second part of my unit testing advice. See the <a href="http://hcoder.org/2012/02/13/unit-testing-advice-for-seasoned-hackers-12/">first part</a> on this blog.</em></p>
<p>If you need any introduction you should really read the first part. I&#8217;ll just present the other three ideas I wanted to cover.</p>
<h2>Focusing on common cases</h2>
<p>This consists of testing only/mostly common cases. These tests rarely fail and give a false sense of security. Thus, tests are better when they also include less common cases, as they&#8217;re much more likely to break inadvertently. Common cases not only break far less often, but will probably be caught reasonably fast once someone tries to use the buggy code, so testing them has comparatively <em>less value</em> than testing less common cases.</p>
<p>The best example I found was in the <a href="https://github.com/emanchado/tor/commit/46bbf6c015fac412b47ca56279002129a1c2b278#L0L720"><code class="syntax c">wrap_string</code> tests</a>. The relevant example was adding the string &#8220;A test of string wrapping&#8230;&#8221;, which wraps not to two lines, but three (the wrapping is done only on spaces, so &#8220;wrapping&#8230;&#8221; is taken as a single unit; in this sense, my test case could have been clearer and use a very long word, instead of a word followed by ellipsis). Most of the cases we&#8217;ll deal with will simply wrap a given word in two lines, but wrapping in three must work, too, and it&#8217;s much more likely to break if we decide to refactor or rewrite the code in that function, with the intention to keep the functionality intact.</p>
<p>See other examples of this in <a href="https://github.com/emanchado/tor/commit/aa20bce8006c9dccd8213db789855b59aee33ef4#L0L2084">aa20bce</a> (no tests with more than one consecutive newline, no tests with lines of only non-printable characters), <a href="https://github.com/emanchado/tor/commit/b248b3f#L0L1665">b248b3f</a> (no tests with just dots, no valid cases with more than one consecutive slash, no invalid cases with content other than slashes), <a href="https://github.com/emanchado/tor/commit/5e771ab4f3b3f91f1aaff8db0284d4a1700954a7#L0L1606">5e771ab</a> (no directories or hidden files), <a href="https://github.com/emanchado/tor/commit/f8ecac5#L0L303">f8ecac5</a> (invalid hex characters don&#8217;t fail, but produce strange behaviour instead; this test actually discovered a bug), <a href="https://github.com/emanchado/tor/commit/7856643#L0R321">7856643</a> (broken escaped content) and <a href="https://github.com/emanchado/tor/commit/87e9f89#L0R256">87e9f89</a> (trailing garbage).</p>
<h2>Not trying to make the tests fail</h2>
<p>This is related to the previous one, but the emphasis is on trying to choose tests that we think will fail (either now or in the future). My impression is that people often fail to do this because they are trying to prove that the code <em>works</em>, which misses the point of testing. The point is trying to prove the code <em>doesn&#8217;t</em> work. And <em>hope</em> that you fail at it, if you will.</p>
<p>The only example I could find was in the <a href="https://github.com/emanchado/tor/commit/03876f0a721ced6ffebb0c61134d5b8396d7600e#L0L616"><code class="syntax c">strcasecmpend</code> tests</a>. Note how there&#8217;s a test that checks that the last three characters of string &#8220;abcDEf&#8221; (ie. &#8220;DEf&#8221;) is less than &#8220;deg&#8221; when compared case-insensitively. That&#8217;s almost pointless, because if we made that same comparison case-sensitively (in other words, if the &#8220;case&#8221; part of the function breaks) the test still passes! Thus it&#8217;s much better to compare the strings &#8221;abcdef&#8221; and &#8220;Deg&#8221;.</p>
<h2>Addendum: trying to cover all cases in the tests</h2>
<p>There&#8217;s another problem I wanted to mention. I have seen several times before, although not in the Tor tests. The problem is making complicated tests that try to cover many/all cases. This seems to stem from the idea that having more test cases is good <em>by itself</em>, when actually more tests are only useful when they <em>increase the chances</em> to catch bugs. For example, if you write tests for a &#8220;sum&#8221; function and you&#8217;re <em>already</em> testing <code class="syntax python">[5, 6, 3, 7]</code>, it&#8217;s probably pointless to add a test for <code class="syntax python">[1, 4, 6, 5]</code>. A test that would increase the chances of catching bugs would probably look more like <code class="syntax python">[-4, 0, 4, 5.6]</code> or <code class="syntax python">[]</code>.</p>
<p>So what&#8217;s wrong with having more tests than necessary? The problem is they make the test suite slower, harder to understand at a glance and harder to review. If they don&#8217;t contribute anything to the chance of catching bugs anyway, why pay that price? But the biggest problem is when we try to cover so many test cases than the code <em>produces</em> the test data. In this cases, we have all the above problems, <em>plus</em> that the test suite becomes almost as complex as production code. Such tests become much easier to introduce bugs in, harder to follow the flow of, etc. The tests are our safety net, so we should be fairly sure that they work as expected.</p>
<p>And that&#8217;s the end of the tips. I hope they were useful :-)</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=1322&amp;md5=9727c1870ad1435396033a337cef555b" 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/2012/02/15/unit-testing-advice-for-seasoned-hackers-22/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=30124&amp;popout=1&amp;url=http%3A%2F%2Fhcoder.org%2F2012%2F02%2F15%2Funit-testing-advice-for-seasoned-hackers-22%2F&amp;language=en_GB&amp;category=text&amp;title=Unit+testing+advice+for+seasoned+hackers+%282%2F2%29&amp;description=This+is+the+second+part+of+my+unit+testing+advice.+See+the+first+part+on+this+blog.+If+you+need+any+introduction+you+should+really+read+the+first+part.+I%26%238217%3Bll...&amp;tags=automated+tests%2Cfree+software%2Copen+source%2Cprojects%2Csoftware%2Ctesting%2Ctests%2Ctips%2Ctor%2Cunit%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Unit testing advice for seasoned hackers (1/2)</title>
		<link>http://hcoder.org/2012/02/13/unit-testing-advice-for-seasoned-hackers-12/</link>
		<comments>http://hcoder.org/2012/02/13/unit-testing-advice-for-seasoned-hackers-12/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 23:48:23 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[automated tests]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tor]]></category>
		<category><![CDATA[unit]]></category>

		<guid isPermaLink="false">http://hcoder.org/?p=1301</guid>
		<description><![CDATA[When reviewing tests written by other people I see patterns in the improvements I would make. As I realise that these &#8220;mistakes&#8221; are also made by experienced hackers, I thought it would be useful to write about them. The extra push to write about this now was having concrete examples from my recent involvement in Tor, [...]]]></description>
			<content:encoded><![CDATA[<p>When reviewing tests written by other people I see patterns in the improvements I would make. As I realise that these &#8220;mistakes&#8221; are also made by experienced hackers, I thought it would be useful to write about them. The extra push to write about this <em>now</em> was having concrete examples from my recent involvement in <a href="http://torproject.org/">Tor</a>, that will hopefully illustrate these ideas.</p>
<p>These ideas are presented in no particular order. Each of them has a brief explanation, a concrete example from the Tor tests, and, if applicable, pointers to other commits that illustrate the same idea. Before you read on, let me explicitly acknowledge that (1) I know that many people know these principles, but writing about them is a nice reminder; and (2) I&#8217;m fully aware that sometimes <em>I</em> need that reminder, too.</p>
<p><strong>Edit:</strong>  see the <a href="http://hcoder.org/2012/02/15/unit-testing-advice-for-seasoned-hackers-22/">second part</a> of this blog.</p>
<h2>Tests as spec</h2>
<p>Tests are more useful if they can show how the code is supposed to behave, including safeguarding against future misunderstandings. Thus, it doesn&#8217;t matter if you <em>know</em> the current implementation will pass those tests or that those test cases won&#8217;t add more or different &#8220;edge&#8221; cases. If those test cases show better how the code behaves (and/or could catch errors if you rewrite the code from scratch with a different design), they&#8217;re good to have around.</p>
<p>I think the clearest example were the <a href="https://github.com/emanchado/tor/commit/8db0f914bfa1aeebed463dc2aa438ca8c87f73a0#L0L2279">tests for the <code class="syntax c">eat_whitespace*</code> functions</a>. Two of those functions end in <code class="syntax c">_no_nl</code>, and they only eat initial whitespace (except newlines). The other two functions eat initial whitespace, including newlines&#8230; but also eat comments. The tests from line 2280 on are clearly targeted at the second group, as they don&#8217;t really represent an interesting use case for the first. However, without those tests, a future maintainer could have thought that the <code class="syntax c">_no_nl</code> functions were supposed to eat whitespace too, and break the code. That produces confusing errors and bugs, which in turn make people fear touching the code.</p>
<p>See other examples in commits <a href="https://github.com/emanchado/tor/commit/b7b3b99acbeb29258e071b8f6c2a7d257a94ad99#L0L1552">b7b3b99</a> (escaped &#8216;%&#8217;, negative numbers, %i format string), <a href="https://github.com/emanchado/tor/commit/618836b3bb643db4af457a32cd8f2338153b5e88#L0L1516">618836b</a> (should an empty string be found at the beginning, or not found at all? does &#8220;\n&#8221; count as beginning of a line? can &#8220;\n&#8221; be found by itself? what about a string that expands more than one line? what about a line including the &#8220;\n&#8221;, with and without the haystack having the &#8220;\n&#8221; at the end?), <a href="https://github.com/emanchado/tor/commit/63b018eecea37ea5a09381157624a507a4a9187a">63b018ee</a> (how are errors handled? what happens when a %s gets part of a number?), <a href="https://github.com/emanchado/tor/commit/2210f18cee86cf17817b386aeca1af2cd0b1f249#L0L1131">2210f18</a> (is a newline only \r\n or \n, or any combination or \r and \n?) and <a href="https://github.com/emanchado/tor/commit/46bbf6c015fac412b47ca56279002129a1c2b278#L0L654">46bbf6c</a> (check that all non-printable characters are escaped in octal, even if they were originally in hex; check that characters in octal/hex, when they&#8217;re printable, appear directly and not in octal).</p>
<h2>Testing boundaries</h2>
<p>Boundaries of different kinds are a typical source of bugs, and thus are among the best points of testing we have. It&#8217;s also good to test <em>both</em> sides of the boundaries, both as an example and because bugs can appear on both sides (and not necessarily at once!).</p>
<p>The best example are the <a href="https://github.com/emanchado/tor/commit/770fd9f#L0R1484">tor_strtok_r_impl tests</a> (a function that is supposed to be compatible with <code class="syntax c">strtok_r</code>, that is, it chops a given string into &#8220;tokens&#8221;, separated by one of the given separator characters). In fact, these extra tests discovered an actual bug in the implementation (ie. an incompatibility with <code class="syntax c">strtok_r</code>). Those extra tests asked a couple of interesting questions, including &#8220;when a string <em>ends</em> in the token separator, is there an empty token in the end?&#8221; in the &#8220;howdy!&#8221; example. This test can also be considered valuable as in &#8220;tests as spec&#8221;, if you consider that the answer to be above question is not obvious and both answers could be considered correct.</p>
<p>See other examples in commits <a href="https://github.com/emanchado/tor/commit/5740e0fc1f00fa91be107ee6c4315d114c5ffdc4#L0L598">5740e0f</a> (checking if <code class="syntax c">tor_snprintf</code> correctly counts the number of bytes, as opposed the characters, when calculating if something can fit in a string; also note my embarrassing mistake of testing <code class="syntax c">snprintf</code>, and not <code class="syntax c">tor_snprintf</code>, later in the same commit), <a href="https://github.com/emanchado/tor/commit/46bbf6c015fac412b47ca56279002129a1c2b278#L0L637">46bbf6c</a> (check that character 21 doesn&#8217;t make a difference, but 20 does) and <a href="https://github.com/emanchado/tor/commit/725d6ef37909080a3d2c5bc25245ea0e951882f2#L0L2217">725d6ef</a> (testing 129 is very good, but even better with 128—or, in this case, 7 and 8).</p>
<h2>Testing implementation details</h2>
<p>Testing implementation details tends to be a bad idea. You can usually argue you&#8217;re testing implementation details if you&#8217;re not getting the test information from the APIs provided by whatever you&#8217;re testing. For example, if you test some API that inserts data in a database by checking the database directly, or if you test the result of a method call was correct by checking the object&#8217;s internals or calling protected/private methods. There are two reasons why this is a bad idea: first, the more implementation details you tests depend on, the less implementation details you can change without breaking your tests; second, your tests are typically less readable because they&#8217;re cluttered with details, instead of <em>meaningful</em> code.</p>
<p>The only example I encountered of this in Tor were the <a href="https://github.com/emanchado/tor/commit/c4c1d56d96623a45775ec2544c0c6951fbfa2d9f#L0L968">compression tests</a>. In this case it wasn&#8217;t a big deal, really, but I have seen this before in much worse situations and I feel this illustrates the point well enough. The problem with that deleted line is that it&#8217;s not clear what&#8217;s it&#8217;s purpose (it needs a comment), plus it uses a magic number, meaning if someone ever changes that number by mistake, it&#8217;s not obvious if the problem is the code or the test. Besides, <em>we are already checking that the magic number is correct</em>, by calling the <code class="syntax c">detect_compression_method</code>. Thus, the deleted <code class="syntax c">memcmp</code> doesn&#8217;t add any value, and makes our tests harder to read. Verdict: delete!</p>
<p><em>I hope you liked the examples so far. My next post will contain the second half of the tips.</em></p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=1301&amp;md5=f51edc2b2e4df2bc4e424b096b2bbe01" 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/2012/02/13/unit-testing-advice-for-seasoned-hackers-12/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=30124&amp;popout=1&amp;url=http%3A%2F%2Fhcoder.org%2F2012%2F02%2F13%2Funit-testing-advice-for-seasoned-hackers-12%2F&amp;language=en_GB&amp;category=text&amp;title=Unit+testing+advice+for+seasoned+hackers+%281%2F2%29&amp;description=When+reviewing+tests+written+by+other+people+I+see+patterns+in+the+improvements+I+would+make.+As+I+realise+that+these+%26%238220%3Bmistakes%26%238221%3B+are+also+made+by+experienced+hackers%2C+I+thought...&amp;tags=automated+tests%2Cfree+software%2Copen+source%2Cprojects%2Csoftware%2Ctesting%2Ctests%2Ctips%2Ctor%2Cunit%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Pragmatic Thinking &amp; Learning, Wikis and Javascript</title>
		<link>http://hcoder.org/2011/10/24/pragmatic-thinking-learning-wikis-and-javascript/</link>
		<comments>http://hcoder.org/2011/10/24/pragmatic-thinking-learning-wikis-and-javascript/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 21:36:25 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[pet]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[wikis]]></category>

		<guid isPermaLink="false">http://hcoder.org/?p=1207</guid>
		<description><![CDATA[After so much &#8220;slacking&#8221; (just posting book summaries) I&#8217;m trying to go back to regular blogging. Remember my summary of Pragmatic Thinking &#38; Learning? There are many exercises and pieces of advice in that book that I have been trying to practice. One of the things I decided to go for was having a personal [...]]]></description>
			<content:encoded><![CDATA[<p>After so much &#8220;slacking&#8221; (just posting book summaries) I&#8217;m trying to go back to regular blogging. Remember <a href="http://hcoder.org/2011/10/10/book-summary-pragmatic-thinking-learning/">my summary of Pragmatic Thinking &amp; Learning</a>? There are many exercises and pieces of advice in that book that I have been trying to practice. One of the things I decided to go for was having a <a href="http://en.wikipedia.org/wiki/Personal_wiki">personal wiki</a>. One of the reasons being, in all honesty, that I had always wanted to have one. Another reason being that my pet TODO application, <a href="https://bitbucket.org/emanchado/bubug/wiki/Home">Bubug</a>, had finally died after some Debian update (some retarded Ruby module broke compatibility with the version I was using, or something; couldn&#8217;t care to investigate). And yet another reason, well, to have a new small pet project and follow my obsession with learning Javascript, and especially <a href="http://nodejs.org/">Node</a>. And that I wanted to give <a href="https://no.de/">Joyent&#8217;s free Node service</a> a try!</p>
<p>But enough with the reasons. It&#8217;s starting to look like it was a pretty useful mini-project. Not just because I learned a bit more Javascript, the excellent <a href="http://expressjs.com/">express</a> web development framework and other things, but also because the result itself, even though it didn&#8217;t take long to develop (and it was pretty fun, even!), feels useful. It feels like a nice place to put all my notes, TODOs, random ideas for projects, etc. A similar feeling of freedom as when I started using my first <a href="http://en.wikipedia.org/wiki/Moleskine">Moleskine</a>. Not that I would ditch paper for computer-<em>anything</em>, but it&#8217;s useful and freeing in its own way, for specific purposes.</p>
<p>About the technology, I used the <a href="http://en.wikipedia.org/wiki/Markdown">Markdown</a> format for the pages thanks to the <a href="https://github.com/evilstreak/markdown-js">markdown-js library</a> (it&#8217;s really nice that the module has an intermediate tree format that you can parse to add your own stuff before converting to HTML, like e.g. wikipage links!), <a href="http://expressjs.com/">express</a> for the whole application structure and <a href="http://code.google.com/p/js-test-driver/">js-test-driver</a> + <a href="http://cjohansen.no/en/javascript/jstdutil_a_ruby_wrapper_over_jstestdriver">jsautotest</a> + a bit of syntax sugar from <a href="http://sinonjs.org/">Sinon.js</a> for the tests (but looking forward to trying out <a href="http://busterjs.org/">Buster.js</a> when it&#8217;s released!). The deployment to Joyent&#8217;s Node.js SmartMachine was reasonably easy. Actually, it was pretty easy once I figured the following:</p>
<ul>
<li>You must not forget to listen in the correct port, with <code class="syntax javascript">server.listen(process.env.PORT || 8001)</code></li>
<li>There are a couple of pretty useful <a href="http://wiki.joyent.com/display/node/Getting+Started+with+a+Node.js+SmartMachine#GettingStartedwithaNode.jsSmartMachine-SSHaccess">Node.js-related command-line utilities</a> to check logs, restart applications and so on</li>
<li>The configuration of the application can be done via <code class="syntax">npm config</code>, see <a href="http://wiki.joyent.com/display/node/npm+Integration">npm integration on Joyent&#8217;s Wiki</a></li>
</ul>
<p>If you&#8217;re curious to see the code, play with it or use it yourself, take a peek to the <a href="https://github.com/emanchado/Wiki-toki">Wiki-Toki repository</a> on GitHub. Happy hacking!</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=1207&amp;md5=666f11f6b9488a0fae815494decab83b" 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/2011/10/24/pragmatic-thinking-learning-wikis-and-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=30124&amp;popout=1&amp;url=http%3A%2F%2Fhcoder.org%2F2011%2F10%2F24%2Fpragmatic-thinking-learning-wikis-and-javascript%2F&amp;language=en_GB&amp;category=text&amp;title=Pragmatic+Thinking+%26%23038%3B+Learning%2C+Wikis+and+Javascript&amp;description=After+so+much+%26%238220%3Bslacking%26%238221%3B+%28just+posting+book+summaries%29+I%26%238217%3Bm+trying+to+go+back+to+regular+blogging.+Remember+my+summary+of+Pragmatic+Thinking+%26amp%3B+Learning%3F+There+are+many+exercises+and+pieces...&amp;tags=books%2Cdevelopment%2Cgithub%2Cjavascript%2Cmarkdown%2Cpet%2Cprogramming%2Cprojects%2Cwikis%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Arepa &#8211; Apt REPository Assistant</title>
		<link>http://hcoder.org/2010/03/22/arepa-apt-repository-assistant/</link>
		<comments>http://hcoder.org/2010/03/22/arepa-apt-repository-assistant/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 19:04:14 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[arepa]]></category>
		<category><![CDATA[auto builders]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[packages]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://hcoder.org/?p=310</guid>
		<description><![CDATA[For some time now I had been frustrated by the tools to manage APT repositories. The only ones I knew of either covered too little (only adding/removing packages from a repository and such, like reprepro) or were way too complex (like the official tools used by Debian itself). Maybe/probably I&#8217;m a moron and I just [...]]]></description>
			<content:encoded><![CDATA[<p>For some time now I had been frustrated by the tools to manage APT repositories. The only ones I knew of either covered too little (only adding/removing packages from a repository and such, like reprepro) or were way too complex (like the official tools used by <a href="http://debian.org/">Debian</a> itself). Maybe/probably I&#8217;m a moron and I just didn&#8217;t know of some tool that would solve all my problems, but now it&#8217;s kind of late ;-) And before you say it, no, Launchpad is <em>not</em> what I was looking for as far as I understand it.</p>
<p>So I started to work on my own suite of tools for it, and recently I decided to release what I&#8217;ve done so far. It&#8217;s by no means complete, but it&#8217;s very useful for me and I thought it would be useful for others. And, with a bit of luck, someone will help me improving it.</p>
<p>So what is it? <a href="http://search.cpan.org/~opera/Arepa-0.74/lib/Arepa.pm">Arepa</a> (it stands for &#8220;Apt REPository Assistant&#8221;, but obviously I called it like that after the <a href="http://en.wikipedia.org/wiki/Arepa">yummy Venezuelan sandwiches</a>) is a suite of tools that allow you to manage an APT repository. It contains two command-line tools and a web interface, and its main features are:</p>
<ul>
<li>Manages the whole process after a package arrives to the upload queue: from approving it to re-building from source to signing the final repository.</li>
<li>It allows you to &#8220;approve&#8221; source packages uploaded to some &#8220;incoming&#8221; directory, via a web interface.</li>
<li>It only accepts source packages, and those are re-compiled automatically in the configured autobuilders. It can even &#8220;cross-compile&#8221; for other distributions (treated like <a href="http://wiki.debian.org/binNMU">binNMUs</a>).</li>
<li>Far from reinventing (many) wheels, it integrates tools like <a href="http://mirrorer.alioth.debian.org/">reprepro</a>, <a href="http://www.gnupg.org/">GPG</a>, <a href="http://samba.anu.edu.au/rsync/">Rsync</a>, <a href="http://code.erisian.com.au/Wiki/debootstrap">debootstrap</a> and <a href="http://alioth.debian.org/projects/buildd-tools/">sbuild</a> so you don&#8217;t have to learn all about them.</li>
</ul>
<p>The approval via some web interface was actually sort of the driving force for the project. One of my pet peeves was that there wasn&#8217;t an easy way to have an upload queue and easily approve/reject packages with the tools I knew. From what I had seen, the tools were either for &#8220;single person&#8221; repositories (no approval needed because the package author is the owner of the repository) or full-blown distribution-size tools like dak and such. My use-case, however, is the following:</p>
<ul>
<li>You have an installation of Arepa for an entire organisation (say, a whole company or a big department).</li>
<li>People inside that organisation upload packages to the upload queue (possibly using dput; the point is, the end up in some directory in the machine hosting Arepa).</li>
<li>Someone (or a small group of people) are the &#8220;masters&#8221; of the repository, and they&#8217;ll have access to the web interface. From time to time they check the web UI, and they&#8217;ll approve (or not) the incoming source packages.</li>
<li>If they&#8217;re approved, the source will be added to the repository and it&#8217;ll be scheduled for compilation in the appropriate combination(s) of architectures and distributions.</li>
<li>A cronjob compiles pending packages every hour; when the compilation is successful, they&#8217;re added to the repository.</li>
<li>At this point, the repository hosted by the Arepa installation has the new packages, but you probably want to serve the repository from a different machine. If that&#8217;s the case, Arepa can sync the repository to your production machine with a simple command (&#8220;arepa sync&#8221;).</li>
</ul>
<p>I imagine that a lot of people have the same need, so I uploaded all the code to CPAN (you can see it with the rest of the <a href="http://search.cpan.org/~opera/">contributions by Opera Software</a>). Sadly there&#8217;s a <a href="https://rt.cpan.org/Public/Bug/Display.html?id=55706">silly bug</a> in the released code (I wanted to release ASAP to be able to focus on other things, and I ended up rushing the release), but it has both a workaround and a patch. So, please give it a try if you&#8217;re interested and tell me if you would like to contribute. I haven&#8217;t released the code in GitHub or similar yet, but I&#8217;ll probably do if there&#8217;s interest.</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=310&amp;md5=2a8059512990e49a9fbd069b6316c1ea" 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/03/22/arepa-apt-repository-assistant/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=30124&amp;popout=1&amp;url=http%3A%2F%2Fhcoder.org%2F2010%2F03%2F22%2Farepa-apt-repository-assistant%2F&amp;language=en_GB&amp;category=text&amp;title=Arepa+%26%238211%3B+Apt+REPository+Assistant&amp;description=For+some+time+now+I+had+been+frustrated+by+the+tools+to+manage+APT+repositories.+The+only+ones+I+knew+of+either+covered+too+little+%28only+adding%2Fremoving+packages+from+a...&amp;tags=arepa%2Cauto+builders%2Ccpan%2Cpackages%2Cperl%2Cprojects%2Cblog" type="text/html" />
	</item>
		<item>
		<title>More work on widgets</title>
		<link>http://hcoder.org/2009/06/30/more-work-on-widgets/</link>
		<comments>http://hcoder.org/2009/06/30/more-work-on-widgets/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 22:11:00 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[continuous]]></category>
		<category><![CDATA[cruisecontrol.rb]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[kiva]]></category>
		<category><![CDATA[loanmeter]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[As I had mentioned, I had been working on Opera widgets. Some time ago I had seen a great Javascript plotting library for jQuery called flot, and I really wanted to try it out in some &#8220;real world&#8221; project. As I was working on the World Loanmeter widget, which incidentally uses jQuery too, it was [...]]]></description>
			<content:encoded><![CDATA[<p>As I had mentioned, I had been working on Opera widgets. Some time ago I had seen a great Javascript plotting library for jQuery called <a href="http://code.google.com/p/flot/">flot</a>, and I really wanted to try it out in some &#8220;real world&#8221; project. As I was working on the <a href="http://widgets.opera.com/widget/12102/">World Loanmeter widget</a>, which incidentally uses jQuery too, it was very easy to figure out some way to use flot for something useful: I decided to add some simple graphs to the widget.</p>
<p>The initial idea of the loanmeter widget was to show where in the world Kiva was offering loans. However, as I used the widget myself, I realised that the location in the world was less important for me, and I was more interested in knowing <em>what</em> the person was going to use the money for. So, I added some options to filter by &#8220;sector&#8221; and I figured that having some graphs comparing how much money was requested and already funded, for each sector, would be a very quick and visual way to get the information I wanted. I started playing with flot, and I have to say that except for a couple of relatively minor problems, it was quite easy to use. I don&#8217;t have screenshots showing the graphs, but feel free to <a href="http://widgets.opera.com/widget/12102/">try the widget itself</a> and have a look (hint: you have two buttons at the bottom right corner to switch between &#8220;map view&#8221; and &#8220;graph view&#8221;).</p>
<p>The other widget I have been working on is a monitor widget for projects in <a href="http://cruisecontrolrb.thoughtworks.com/">CruiseControl.rb</a> (a really simple and neat continuous integration server we use at Opera). More than one year ago, my colleague <a href="http://my.opera.com/nicomen">Nico</a> had written a very quick &amp; dirty widget for monitoring the result of the test runs of the <a href="http://my.opera.com">My Opera</a> <a href="http://my.opera.com/operaqa/blog/2008/09/19/testing-my-opera">functional testsuite</a>. There were a couple of things I wanted to change, and I also wanted to monitor other projects, so I figured that I&#8217;d rewrite the widget to have a more maintainable codebase and then make it generic, so you could configure which CC.rb installation and which project to monitor. I&#8217;m moderately happy with the result of the refactoring, and happy enough with the final result. I know it has several issues, and I expect that once anyone outside our team starts using it, there will be things to improve and fix :-) If you use CruiseControl.rb, give it a try!</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=72&amp;md5=14e58995e6499306150cc4c1458375d3" 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/06/30/more-work-on-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=30124&amp;popout=1&amp;url=http%3A%2F%2Fhcoder.org%2F2009%2F06%2F30%2Fmore-work-on-widgets%2F&amp;language=en_GB&amp;category=text&amp;title=More+work+on+widgets&amp;description=As+I+had+mentioned%2C+I+had+been+working+on+Opera+widgets.+Some+time+ago+I+had+seen+a+great+Javascript+plotting+library+for+jQuery+called+flot%2C+and+I+really+wanted...&amp;tags=continuous%2Ccruisecontrol.rb%2Cintegration%2Ckiva%2Cloanmeter%2Copera%2Cprojects%2Cwidgets%2Cblog" type="text/html" />
	</item>
		<item>
		<title>The ultimate TODO app redux</title>
		<link>http://hcoder.org/2009/06/29/the-ultimate-todo-app-redux/</link>
		<comments>http://hcoder.org/2009/06/29/the-ultimate-todo-app-redux/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 19:59:00 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Freedom]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[bitbucket]]></category>
		<category><![CDATA[bubug]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[merb]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[todo]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[When writing yesterday about the Perl modules, I realised that I hadn&#8217;t written anything about the TODO application since &#8220;The ultimate TODO app&#8221;. Well, a lot has happened to it actually. I&#8217;m glad to announce that: It does have a (lame) name now: Bubug (supposedly stands for &#8220;Barely Unconventional Bug Untracking Gizmo&#8221;. Whatever). It has [...]]]></description>
			<content:encoded><![CDATA[<p>When writing yesterday about the Perl modules, I realised that I hadn&#8217;t written anything about the <span class="caps">TODO</span> application since &#8220;<a href="http://hcoder.org/2009/02/09/the-ultimate-todo-app">The ultimate <span class="caps">TODO</span> app</a>&#8221;. Well, a <em>lot</em> has happened to it actually. I&#8217;m glad to announce that:</p>
<ul>
<li>It does have a (lame) name now: <a href="http://bitbucket.org/emanchado/bubug/wiki/Home">Bubug</a> (supposedly stands for &#8220;Barely Unconventional Bug Untracking Gizmo&#8221;. Whatever).</li>
<li>It has improved a lot here and there, and it now has authentication and multi-user support, not to mention a lot of UI bling bling and goodies.</li>
<li>The development has moved to <a href="http://bitbucket.org/">BitBucket</a>, an excellent free service built by ex-Opera&#8217;s <a href="http://noehr.org/">Jesper Noehr</a>, where you can follow it more easily, comment on, check the Wiki, fork, or whatever you want. You even have a screenshot there ;-)</li>
</ul>
<p>As you can guess from the last point, for this project I&#8217;ve been using Mercurial instead of Git. Although I certainly don&#8217;t have sophisticated needs, so <span class="caps">YMMV</span> (heavily), I find Git more pleasant to use. Which is kind of surprising, because I always thought that Git&#8217;s UI was a pain in the ass. Oh, well. That doesn&#8217;t mean that Mercurial is hard to use, though. I think it&#8217;s more that I&#8217;m used to Git now, and there are a couple of things that I find more convenient: the coloured diff (possible in Hg, but you have to install some extension for it, and only thinking about installing some Python extension that is not even packaged for Debian makes me want to switch to Git) and the staging area are the most important ones I can think of.</p>
<p>So, if you thought I had abandoned the <span class="caps">TODO</span> application thing, you were wrong ;-) If you&#8217;re interested, have a look at the <a href="http://bitbucket.org/emanchado/bubug/wiki/Home">Bubug BitBucket project page</a>, download it, play with it, and tell me what you think.</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=71&amp;md5=14fbafa3aa6d871e89681cc8b0ba5c25" 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/06/29/the-ultimate-todo-app-redux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=30124&amp;popout=1&amp;url=http%3A%2F%2Fhcoder.org%2F2009%2F06%2F29%2Fthe-ultimate-todo-app-redux%2F&amp;language=en_GB&amp;category=text&amp;title=The+ultimate+TODO+app+redux&amp;description=When+writing+yesterday+about+the+Perl+modules%2C+I+realised+that+I+hadn%26%238217%3Bt+written+anything+about+the+TODO+application+since+%26%238220%3BThe+ultimate+TODO+app%26%238221%3B.+Well%2C+a+lot+has+happened+to+it...&amp;tags=bitbucket%2Cbubug%2Chg%2Cmerb%2Cmercurial%2Cprojects%2Ctodo%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Free software rocks!</title>
		<link>http://hcoder.org/2009/05/10/free-software-rocks-2/</link>
		<comments>http://hcoder.org/2009/05/10/free-software-rocks-2/#comments</comments>
		<pubDate>Sun, 10 May 2009 17:18:00 +0000</pubDate>
		<dc:creator>emanchado</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[apt]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[cpan]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I&#8217;ve been working on something lately that I hope I will publish sometime next month: it&#8217;s a set of tools to manage an APT package repository. The idea is that, given an upload queue (you can set it up as an anonymous FTP, or some directory accessible via SSH/SCP, or whatever floats your boat in [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on something lately that I hope I will publish sometime next month: it&#8217;s a set of tools to manage an <span class="caps">APT</span> package repository. The idea is that, given an upload queue (you can set it up as an anonymous <span class="caps">FTP</span>, or some directory accessible via <span class="caps">SSH</span>/<span class="caps">SCP</span>, or whatever floats your boat in your setup and team), you&#8217;ll have a web interface to approve those packages, a set of integrated autobuilders building the approved packages in whatever combination of architectures and distributions you want, and all that integrated with <a href="http://mirrorer.alioth.debian.org/">reprepro</a> to keep your repository updated. I&#8217;ll write more about it when I have released something.</p>
<p>The point now is that, while working on it, I needed some module to parse command-line options and &#8220;subcommands&#8221; (like <code>git commit</code>, <code>svn update</code>, etc.). As it&#8217;s written in Perl, I had a look at <span class="caps">CPAN</span> to see if I could see anything. The most promising module was <a href="http://search.cpan.org/~garu/App-Rad-1.04/lib/App/Rad.pm">App::Rad</a>, but it lacked a couple of things that were very important for me: my idea was &#8220;declaring&#8221; all the possible commands and options and have the module do all the work for me (generating the help pages and the default <code>--help</code> implementation, generate the <code>program help subcommand</code> and so on). <code>App::Rad</code> didn&#8217;t have that, and it didn&#8217;t seem to me like that was the direction they wanted to go to with the module. But I figured I&#8217;d drop the author an e-mail anyway and see if he liked the idea so I could start adding support for all that&#8230;</p>
<p>And boy was that a good idea. He replied a couple of days later, and said that they had liked the idea so much that they had implemented it already (that&#8217;s why he took a couple of days to reply), and he sent me an example of the new syntax they had introduced and asked if that was what I was thinking. And not only that, but they added me to the list of contributors just for giving the idea! That completely made my day, free software rocks!</p>
 <p><a href="http://hcoder.org/?flattrss_redirect&amp;id=67&amp;md5=09105bb993941bce2a37855f1e18b32b" 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/05/10/free-software-rocks-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=30124&amp;popout=1&amp;url=http%3A%2F%2Fhcoder.org%2F2009%2F05%2F10%2Ffree-software-rocks-2%2F&amp;language=en_GB&amp;category=text&amp;title=Free+software+rocks%21&amp;description=I%26%238217%3Bve+been+working+on+something+lately+that+I+hope+I+will+publish+sometime+next+month%3A+it%26%238217%3Bs+a+set+of+tools+to+manage+an+APT+package+repository.+The+idea+is+that%2C...&amp;tags=apt%2Ccommand%2Ccpan%2CDebian%2Cfree%2Cline%2Cperl%2Cprojects%2Csoftware%2Cblog" 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="https://flattr.com/submit/auto?user_id=30124&amp;popout=1&amp;url=http%3A%2F%2Fhcoder.org%2F2009%2F02%2F09%2Fthe-ultimate-todo-app%2F&amp;language=en_GB&amp;category=text&amp;title=The+ultimate+TODO+app&amp;description=I+have+been+quite+frustrated+by+TODO+applications+for+some+months+now.+They%26%238217%3Bre+usually+either+too+simple%2C+or+almost+too+complex+and+without+features+that+I+think+are+really+valuable....&amp;tags=merb%2Cprojects%2CRuby%2Ctodo%2Cwebapp%2Cblog" type="text/html" />
	</item>
	</channel>
</rss>

