<?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>The Code Dump &#187; Uncategorized</title>
	<atom:link href="http://www.codelord.net/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codelord.net</link>
	<description>A place a coder rants at...</description>
	<lastBuildDate>Sat, 04 Feb 2012 12:53:41 +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>Making Embedded GitHub Gists Show Up on RSS Readers</title>
		<link>http://www.codelord.net/2011/03/09/making-embedded-github-gists-show-up-on-rss-readers/</link>
		<comments>http://www.codelord.net/2011/03/09/making-embedded-github-gists-show-up-on-rss-readers/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 04:45:20 +0000</pubDate>
		<dc:creator>Aviv Ben-Yosef</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=358</guid>
		<description><![CDATA[Just a quick let-you-know: I found out that the gists I use to embed code in my posts don&#8217;t show up on RSS readers (e.g. Google Reader). I know how annoying it is not to be able to read a blog fully from my reader for me, and so found a nice WordPress plugin called [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick let-you-know: I found out that the gists I use to embed code in my posts don&#8217;t show up on RSS readers (e.g. Google Reader).</p>
<p>I know how annoying it is not to be able to read a blog fully from my reader for me, and so found a nice WordPress plugin called <a href="http://wordpress.org/extend/plugins/embed-github-gist/">Embed GitHub Gist</a> that handling embedding gists elegantly and also automatically makes sure the code will be displayed even on readers.</p>
<p>I&#8217;ve even updated my latest post (about Chef and EC2) to work with it, and new posts from now on will look good too <img src='http://www.codelord.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2011%2F03%2F09%2Fmaking-embedded-github-gists-show-up-on-rss-readers%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2011%2F03%2F09%2Fmaking-embedded-github-gists-show-up-on-rss-readers%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6107bfac7c92ddff62b393d1e8b7abbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2011/03/09/making-embedded-github-gists-show-up-on-rss-readers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Liskov Substitution Principle Violation Spotted in the Wild</title>
		<link>http://www.codelord.net/2010/11/24/liskov-substitution-principle-violation-spotted-in-the-wild/</link>
		<comments>http://www.codelord.net/2010/11/24/liskov-substitution-principle-violation-spotted-in-the-wild/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 20:35:30 +0000</pubDate>
		<dc:creator>Aviv Ben-Yosef</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=272</guid>
		<description><![CDATA[The Liskov Substitution Principle (LSP) states that &#8220;if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program.&#8221; This principle is actually so important it&#8217;s part of SOLID. At my work we&#8217;ve just [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://en.wikipedia.org/wiki/Liskov_substitution_principle">Liskov Substitution Principle</a> (LSP) states that &#8220;if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program.&#8221; This principle is actually so important it&#8217;s part of <a href="http://en.wikipedia.org/wiki/Solid_(object-oriented_design)">SOLID</a>.</p>
<p>At my work we&#8217;ve just wasted quite some time chasing down a bug that was due to a violation of LSP, in the JDK! Everyone knows the Set collection, which simply makes sure the collection can&#8217;t contain the same object twice (&#8220;same&#8221; as defined by Java&#8217;s &#8220;equals&#8221;). Set itself is unordered, which can be bumming, but fortunately the JDK people were nice enough to add SortedSet.</p>
<p>Given LSP, one might assume that wherever you use a Set you can simply replace it with a SortedSet in order to get the same thing but with sorted output. Well, think again! <em>(Tam, tam, tammmm)</em></p>
<p>Suppose you have this nice class:<br />
<script src="https://gist.github.com/714291.js?file=Account.java"></script> This is all very fine and dandy, but somewhere in our code we wanted to replace a Set of Accounts with a SortedSet, so the accounts will be displayed sorted by their names (only their names). So, we whipped up this simple Comparator: <script src="https://gist.github.com/714332.js?file=Comparator.java"></script><br />
This looked very cool and everything worked, until we attempted to add to the SortedSet 2 accounts with the same name but different IDs. We expected both to be inserted to it, since they are not &#8220;equal&#8221;, but were surprised by the result of this:<br />
<script src="https://gist.github.com/714338.js?file=AccountTest.java"></script><br />
The above test <strong>fails</strong>. After much digging and debugging, we realized that the TreeSet uses the Comparator to determine whether the account was in the set. Once it found an object in the set that had the same &#8220;comparison value&#8221; (&#8220;compareTo&#8221; returned zero), it decided the account was already in the set. This is stupidly stupid, since we felt the natural behavior is that returning zero means we don&#8217;t really care about these objects&#8217; order, and that equals() will be used to determine which are actual duplicates. Switching the code to use a non-SortedSet (e.g. HashSet) makes the test pass.</p>
<p>This violation of LSP has caused us much frustration and wasted efforts. Making me feel even worse, we found out after the fact this is <a href="http://bit.ly/g72jlQ">documented behavior</a>:</p>
<blockquote><p>The behavior of a sorted set <em>is </em>well-defined even if its ordering is inconsistent with equals; it just fails to obey the general contract of the Set interface.</p></blockquote>
<p><strong>Edit: </strong>So, yeah, had we read this beforehand we would have known this. The problem is we shouldn&#8217;t have to read it. Some commenters helped out and said we can simply make our Comparator look at &#8220;id&#8221;. Indeed we can, but this is a simplified case. In cases the object&#8217;s &#8220;equals&#8221; looks at all members, even private ones, how will you be able to provide just a comparator to sort them by a specific attribute that is public? The behavior of SortedSet means you simply can&#8217;t, making the whole point of having pluggable Comparators a a bit misleading, since most of them will have to re-implement &#8221;equals&#8221;. Indeed, the docs for Comparator#compare (as opposed to Comparable#compareTo) <strong>recommend</strong> an ordering that is consistent with equals(), but sometimes that&#8217;s just not possible. In those cases, it turns out, one can&#8217;t sort!</p>
<p>To that, all I&#8217;ve got to say is &#8220;shame on you!&#8221;</p>
<p>You should subscribe to my <a href="http://feeds.feedburner.com/TheCodeDump">feed</a> and follow me on <a href="http://twitter.com/avivby">twitter</a>!
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F11%2F24%2Fliskov-substitution-principle-violation-spotted-in-the-wild%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F11%2F24%2Fliskov-substitution-principle-violation-spotted-in-the-wild%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6107bfac7c92ddff62b393d1e8b7abbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2010/11/24/liskov-substitution-principle-violation-spotted-in-the-wild/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>A Week in Nowhere for Better Code?</title>
		<link>http://www.codelord.net/2010/01/14/a-week-in-nowhere-for-better-code/</link>
		<comments>http://www.codelord.net/2010/01/14/a-week-in-nowhere-for-better-code/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 17:53:04 +0000</pubDate>
		<dc:creator>Aviv Ben-Yosef</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=92</guid>
		<description><![CDATA[I finished my army service (in the Israel Defence Force) 6 months ago. Before anyone gets carried away, let me assure you my service had no Rambo-like scenes involved, but simply required me to do what I always do &#8211; code. But, it being an army and everything, everyone is required to do some &#8220;army&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>I finished my army service (in the Israel Defence Force) 6 months ago. Before anyone gets carried away, let me assure you my service had no Rambo-like scenes involved, but simply required me to do what I always do &#8211; code.</p>
<p>But, it being an army and everything, everyone is required to do some &#8220;army&#8221; stuff every once in a while. One of those is at the heart of this post. About once a year, you&#8217;d get positioned in some far, remote and tiny base/settlement. During those weeks you are required to guard different posts, or patrol around the perimiter of the area.</p>
<p>Let me paint you the picture a little clearer. How would you like having to leave your life, in order to spend a week (or two) in a place that can be only regarded as &#8216;nowhere&#8217;, and spend 10 hours a day doing nothing but looking at some desert mountains? Now, imagine you know no one of the other few that are with you, the room is a dump, and you don&#8217;t even want to hear about the showers? Oh, it gets better. At night the temprature can drop so much, that checking your weapon before going to sleep is just painful, and requires you to jiggle your fingers for 5 minutes before you get enough dexterity to actually do it?</p>
<div id="attachment_93" class="wp-caption aligncenter" style="width: 310px"><a rel="attachment wp-att-93" href="http://www.codelord.net/2010/01/14/a-week-in-nowhere-for-better-code/attachment/18022008001/"><img class="size-medium wp-image-93" title="18022008(001)" src="http://codelord.net/wp-content/uploads/2010/01/18022008001-300x225.jpg" alt="The view from nowhere" width="300" height="225" /></a><p class="wp-caption-text">The view from nowhere</p></div>
<p>The real deal, though, is that I find myself missing those weeks, a bit at least. Why would a geek think about a week with no keyboard, and actually just about zero contact with the outside world given that cell reception is scarse, and miss it? Well, that&#8217;s just the point!</p>
<p>First of all, as any good geek, I stack a lot of books on my To Read List. Those weeks were where I did my most productive reading. I averaged a book a day, which required me to get an extra bag just for those. Can a week be really bad if you go to read all of <a href="http://www.amazon.com/gp/product/0345453743?ie=UTF8&#038;tag=thcodu02-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0345453743">The Hitchhiker&#8217;s Guide to the Galaxy</a><img src="http://www.assoc-amazon.com/e/ir?t=thcodu02-20&#038;l=as2&#038;o=1&#038;a=0345453743" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> series, <a href="http://www.amazon.com/gp/product/0618574972?ie=UTF8&#038;tag=thcodu02-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0618574972">The Return of the King</a><img src="http://www.assoc-amazon.com/e/ir?t=thcodu02-20&#038;l=as2&#038;o=1&#038;a=0618574972" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> and more?</p>
<p>But that&#8217;s just a bonus, I read a lot either way. The main thing is that you just get time off that you don&#8217;t consider to be your free time / vacation. I&#8217;ll explain. When you use your few vacation days, you use them wisely. You take your spouse abroad and enjoy the world&#8217;s wonders. Any part of a day off I just lay around feels like a waste to me, which doesn&#8217;t let me just use the days off to relax.</p>
<p>The problem is, that coders need time to zoom-out sometimes, in order to get new ideas. It was said before that if you&#8217;re stuck with a problem, you might get the insight by simply leaving your desk for a few minutes. But those insights are short-sighted. As you sling code, week after week, you get coder&#8217;s myopia. Every time I was sent away, I came back with a few ideas to make things better, or do things in a more productive way. It&#8217;s just amazing how simply stepping back for a week can help you realize problems you haven&#8217;t been able to grasp for months.</p>
<p>Now, unsurprisingly, the vacation days you use never seem to have the same effect. Don&#8217;t get me wrong, I&#8217;m not suggesting you find your solitude in some desert with no cell reception (unless that&#8217;s your cup of tea). I think employers will gain by making sure they&#8217;re employees have 4 weeks of vacation a year, so that spending 2 days playing video games won&#8217;t feel like a waste. I think sending teams together on a trip for a few days won&#8217;t be as good as sending them to a conference where they will see new people and new opinions and ideas. The key here is not just the change of scenery, but also simply experiencing something different.</p>
<p>Try to find a chance to zoom out and unwind, I bet it will do good to you and your team.</p>
<p>You should follow me on <a href="http://twitter.com/avivby">twitter</a>.
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F01%2F14%2Fa-week-in-nowhere-for-better-code%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2010%2F01%2F14%2Fa-week-in-nowhere-for-better-code%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6107bfac7c92ddff62b393d1e8b7abbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2010/01/14/a-week-in-nowhere-for-better-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Becoming a Happier Hacker: Actively Strive to Work with Other Hackers</title>
		<link>http://www.codelord.net/2009/10/17/becoming-a-happier-hacker-actively-strive-to-work-with-other-hackers/</link>
		<comments>http://www.codelord.net/2009/10/17/becoming-a-happier-hacker-actively-strive-to-work-with-other-hackers/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 18:38:48 +0000</pubDate>
		<dc:creator>Aviv Ben-Yosef</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=56</guid>
		<description><![CDATA[After a few years of working in the field, I&#8217;ve come to a conclusion: one of the best ways to evolve as a hacker is to work with other hackers. Not just that, I&#8217;d rather work alone than work with non-hackers. Wait, I can almost see you reaching to close this tab, mumbling to yourself [...]]]></description>
			<content:encoded><![CDATA[<p>After a few years of working in the field, I&#8217;ve come to a conclusion: one of the best ways to evolve as a <a href="http://paulgraham.com/gba.html">hacker</a> is to work with other hackers. Not just that, I&#8217;d rather work alone than work with non-hackers. Wait, I can almost see you reaching to close this tab, mumbling to yourself this is nonsense. I&#8217;m not saying workplaces shouldn&#8217;t hire junior developers .I&#8217;m saying that working with people that don&#8217;t have Hacker Quality™ is frustrating.</p>
<p>In my previous work place, about 90% of developers were &#8216;home brewed&#8217;. That means 90% of developers are kids that performed well enough on analytical exams to be put to a 4-month course and study basic programming concepts, and just enough Java to become certified code monkeys. Some, those with hacker quality, keep learning and become real stars after a couple of years. The majority remain grunts that never grow to consider their work as a craft.</p>
<p>My experience with working with them is that the hackers make working so much more fun. You&#8217;ve got people to bounce ideas off, learn new things from, debate about tabs and spaces. The rest make work a nightmare, and made me want to get back to my high-school way of coding (all night long, alone in the dark, with some Iron Maiden).</p>
<p>Being fed up with this, when I started working in a new place recently, I made a decision to try and surround myself with fellow hackers. First of all, you should start with the actual selection of a work place. Given my case (which was that I wasn&#8217;t going to start anything up by myself), I interviewed in lots of places, and chose the place that seemed to have the best and most hackers in, judging from the people I&#8217;ve interacted with in the interview process, and knowing some people from the company.</p>
<p>Just getting to a good work place isn&#8217;t enough, because I&#8217;ve yet to hear about a place that is 100% hacker driven (other than start ups with 5 people). You should always try and work with the better guys around. Seems like interesting projects tend to gravitate towards hackers, wherever they are. Even if the better guys aren&#8217;t working with you on your current project, grab a coffee with them. Some chatting on whatever is going on with other hackers always makes you see things differently.</p>
<p>Given that you usually can&#8217;t get rid of the less-competent guys (legally), your only next chance in increasing Hacker-to-Coder ratio is bringing in more hackers. If you know of any good hackers that might be in search of a job, get them an interview. Usually, that&#8217;s all it will take to get them in. Also, try and take an active part in the interviewing process. That will allow you to influence the type of people that you&#8217;ll work with, and maybe raise the bar a little bit.</p>
<p>I really think that investing energy in the peopleware of the workplace accounts for 80% of the evolving of coders there. And, given that we coders rarely see daylight and spend most of the time at work, that&#8217;s the lion&#8217;s share of learning opportunities you&#8217;ll have. Maybe it sounds odd to put all this effort in a place that isn&#8217;t yours, but does it really matter who&#8217;s the founder? You&#8217;re there, and better make the best of the experience.</p>
<p>All that leaves in the workplace is making sure your team encourages learning, experimenting and sharing (maybe I&#8217;ll cover it in another post sometime).</p>
<p>You should follow me on twitter <a href="http://twitter.com/avivby">here</a>.
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F10%2F17%2Fbecoming-a-happier-hacker-actively-strive-to-work-with-other-hackers%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F10%2F17%2Fbecoming-a-happier-hacker-actively-strive-to-work-with-other-hackers%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6107bfac7c92ddff62b393d1e8b7abbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2009/10/17/becoming-a-happier-hacker-actively-strive-to-work-with-other-hackers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Writing a BuildBot Latent Build Slave</title>
		<link>http://www.codelord.net/2009/10/04/writing-a-buildbot-latent-build-slave/</link>
		<comments>http://www.codelord.net/2009/10/04/writing-a-buildbot-latent-build-slave/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 19:33:24 +0000</pubDate>
		<dc:creator>Aviv Ben-Yosef</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=50</guid>
		<description><![CDATA[We&#8217;ve been working on creating a scalable and stable building and testing environment for our team. After some checking, BuildBot was found to be the best (for our needs, at least). Gathering the different abilities that are needed for testing our products, and the different limitations we&#8217;ve got in our testing lab, we came to [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been working on creating a scalable and stable building and testing environment for our team.<br />
After some checking, <a href="http://buildbot.net">BuildBot</a> was found to be the best (for our needs, at least).</p>
<p>Gathering the different abilities that are needed for testing our products, and the different limitations we&#8217;ve got in our testing lab, we came to the conclusion that using some sort of distribution framework is needed. Being the code monkeys that we are, we started designing a whole solution for integrating BuildBot with our distribution framework of choice, when looking at the BuildBot manual I saw it already has support for this concept, the Latent Buildslave !</p>
<p>One small thing is, that adding support for a new one isn&#8217;t so clear. The <a href="http://djmitche.github.com/buildbot/docs/0.7.11/#Writing-New-Latent-Buildslaves">manual</a> simply states that one needs just to implement start_instance and stop_instance methods and be done with it, but, in my opinion, lacks some details, so here is what we figured:</p>
<ol>
<li>The start_instance method should return a <a href="http://twistedmatrix.com/projects/core/documentation/howto/defer.html">deferred</a> that, when called, will return once a new build slave is ready to go.</li>
<li>How do you return the new slave&#8217;s IP to BuildBot? No need! Once it will be connected, the master will figure it&#8217;s the one you just created (via AbstractLatentBuildSlave.attached).</li>
<li>The actual value returned from start_instance is pretty insignificant (will be printed to the log, as the manual states).</li>
<li>The stop_instance method is pretty much the same, and should take care of making the distribution framework aware that the allocated buildslave is free to be destroyed/reused.</li>
</ol>
<h3>Why don&#8217;t my latent slaves die?</h3>
<p>As you may have noticed, once <em>start_instance</em> is called and a slave connects to the master, BuildBot is in no hurry to call your <em>stop_instance</em> once the build is completed. Actually, as far as BuildBot is concerned, that slave is there to stay (at least, as far as we figured). In case you&#8217;d rather to generate a new slave for each build, you will need to override the <em>buildFinished</em> method of the abstract slave, and in it call the <em>unsubstantiate</em> method. A bit of a headache, but that&#8217;s the way it is.</p>
<p>Happy testing!</p>
<p>P.S. If you&#8217;re using the latest BuildBot (from the git repository), try out the Console view, it&#8217;s really awesome!</p>
<p>You should follow me on twitter <a href="http://twitter.com/avivby">here</a>.
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F10%2F04%2Fwriting-a-buildbot-latent-build-slave%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F10%2F04%2Fwriting-a-buildbot-latent-build-slave%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6107bfac7c92ddff62b393d1e8b7abbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2009/10/04/writing-a-buildbot-latent-build-slave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash Nitpicking on Redirections</title>
		<link>http://www.codelord.net/2009/08/12/bash-nitpicking-on-redirections/</link>
		<comments>http://www.codelord.net/2009/08/12/bash-nitpicking-on-redirections/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 13:13:17 +0000</pubDate>
		<dc:creator>Aviv Ben-Yosef</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=46</guid>
		<description><![CDATA[This little excerpt from the bash man page explains the reason I just wasted 2 hours: Note that the order of redirections is significant.  For example, the command ls &#62; dirlist 2&#62;&#38;1 directs both standard output and standard error to the file dirlist, while the command ls 2&#62;&#38;1 &#62; dirlist directs only the standard output [...]]]></description>
			<content:encoded><![CDATA[<p>This little excerpt from the bash man page explains the reason I just wasted 2 hours:</p>
<p style="padding-left: 30px;"><em>Note that the order of redirections is significant.  For example, the command<br />
ls &gt; dirlist 2&gt;&amp;1<br />
directs both standard output and standard error to the file dirlist, while the command<br />
ls 2&gt;&amp;1 &gt; dirlist<br />
directs only the standard output to file dirlist, because the standard error was duplicated as standard output before the standard output was redirected to dirlist.</em>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F08%2F12%2Fbash-nitpicking-on-redirections%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F08%2F12%2Fbash-nitpicking-on-redirections%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6107bfac7c92ddff62b393d1e8b7abbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2009/08/12/bash-nitpicking-on-redirections/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing Equations in Word Documents Converted from OpenOffice</title>
		<link>http://www.codelord.net/2009/06/28/fixing-equations-in-word-documents-converted-from-openoffice/</link>
		<comments>http://www.codelord.net/2009/06/28/fixing-equations-in-word-documents-converted-from-openoffice/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 19:31:26 +0000</pubDate>
		<dc:creator>Aviv Ben-Yosef</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=44</guid>
		<description><![CDATA[This is a short tip post. If you were ever frustrated with the fact that OpenOffice documents with equations don&#8217;t show up properly when converted to MS-Word documents you&#8217;re gonna love this! It&#8217;s a known problem that converted equations need to be &#8220;double clicked&#8221; in Word for it to re-render them and show up properly. [...]]]></description>
			<content:encoded><![CDATA[<p>This is a short tip post. If you were ever frustrated with the fact that OpenOffice documents with equations don&#8217;t show up properly when converted to MS-Word documents you&#8217;re gonna love this!</p>
<p>It&#8217;s a known problem that converted equations need to be &#8220;double clicked&#8221; in Word for it to re-render them and show up properly. Turns out someone has posted a great macro <a href="http://www.oooforum.org/forum/viewtopic.phtml?t=66787">here</a> that simply does that automatically for you and saves the need to go through the whole document manually (if you don&#8217;t remember how to set up a macro, like me, there are nice instructions <a href="http://www.officeletter.com/favtips/wordmacros.html">here</a>).
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F06%2F28%2Ffixing-equations-in-word-documents-converted-from-openoffice%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F06%2F28%2Ffixing-equations-in-word-documents-converted-from-openoffice%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6107bfac7c92ddff62b393d1e8b7abbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2009/06/28/fixing-equations-in-word-documents-converted-from-openoffice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>So You Got an Arduino</title>
		<link>http://www.codelord.net/2009/05/14/so-you-got-an-arduino/</link>
		<comments>http://www.codelord.net/2009/05/14/so-you-got-an-arduino/#comments</comments>
		<pubDate>Thu, 14 May 2009 21:19:47 +0000</pubDate>
		<dc:creator>Aviv Ben-Yosef</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=42</guid>
		<description><![CDATA[After playing around a bit with my new Arduino, I&#8217;ve gathered a list of a few things that I wish I knew when I started, as it would have saved some of my time. Hope it helps someone. Happy hacking! There&#8217;s a builtin LED This one I didn&#8217;t get right away. There&#8217;s a reason most [...]]]></description>
			<content:encoded><![CDATA[<p>After playing around a bit with my new Arduino, I&#8217;ve gathered a list of a few things that I wish I knew when I started, as it would have saved some of my time. Hope it helps someone. Happy hacking!</p>
<p><strong>There&#8217;s a builtin LED<br />
</strong>This one I didn&#8217;t get right away. There&#8217;s a reason most of the examples in the tutorial sections refer to LEDs on pin 13 &#8211; there&#8217;s a small LED on the Duemilanove that&#8217;s already connected to that pin. It shines in orange (just like the TX/RX LEDs) if you write to that pin, but, of course, one can connect something else to that pin to use it.</p>
<p><strong>That little button is the RESET button<br />
</strong>This one might just be me being an idiot. I thought that little push button was a general purpose one. Well it&#8217;s not. It&#8217;s a reset button &#8211; whenever it gets pressed it resets the sketch running to the start. Boy, did I spend a lot of time pressing it and trying to debug my code til I figured it out&#8230;</p>
<p><strong>There are builtin &#8220;software&#8221; pull-up resistors<br />
</strong>Once you get you should connect a push-button, you might notice that every tutorial says you should use a pull-up resistor. Well, it turns out you can simply use a software one on the Arduino, and there&#8217;s no need to conenct one. After setting up the push-button pin as input:</p>
<p style="padding-left: 30px;">pinMode(buttonPin, INPUT);</p>
<p>Simply tell the Arduino you need a pull-up resistor connected to it:</p>
<p style="padding-left: 30px;">digitalWrite(buttonPin, HIGH);</p>
<p>For more information, read <a href="http://www.arduino.cc/en/Tutorial/DigitalPins">here</a>.</p>
<p><strong>The &#8220;Serial&#8221; library doesn&#8217;t really require a serial connection<br />
</strong>Even though Duemilanoves and other new Arduino-boards only have a USB connection, it turns out that the Serial library can still be used. Whatever you write using it shows up in the Serial Monitor in the development IDE and you can send data to the Arduino using it too!</p>
<p>You should follow me on twitter <a href="http://twitter.com/avivby">here</a>.
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F05%2F14%2Fso-you-got-an-arduino%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F05%2F14%2Fso-you-got-an-arduino%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6107bfac7c92ddff62b393d1e8b7abbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2009/05/14/so-you-got-an-arduino/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My &#8220;Hello, Arduino&#8221;</title>
		<link>http://www.codelord.net/2009/05/14/my-hello-arduino/</link>
		<comments>http://www.codelord.net/2009/05/14/my-hello-arduino/#comments</comments>
		<pubDate>Wed, 13 May 2009 22:01:24 +0000</pubDate>
		<dc:creator>Aviv Ben-Yosef</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=32</guid>
		<description><![CDATA[I ordered an Arduino Duemilanove a few months ago, and other than simply testing it to see that it starts up I haven&#8217;t touched it. It&#8217;s been lying on my desk, making me feel guilty every time I saw it. Today, having a few spare hours and because I just finished reading &#8220;Programming Embedded Systems&#8221;, [...]]]></description>
			<content:encoded><![CDATA[<p>I ordered an <a href="http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove">Arduino Duemilanove</a> a few months ago, and other than simply testing it to see that it starts up I haven&#8217;t touched it. It&#8217;s been lying on my desk, making me feel guilty every time I saw it.</p>
<p>Today, having a few spare hours and because I just finished reading &#8220;Programming Embedded Systems&#8221;, I decided it was time to finally do something with it.</p>
<p>I spent ~3 hours soldering the Proto-Shield that came with it. It was the first time I ever did any soldering and I think it turned out OK, after some help from Dad.</p>
<p>Then, I made a simple &#8216;Hello, World&#8217; application that changes LEDs according to a button press. What can I say, the amount of satisfaction from such a simple thing is so big! Maybe, it has to do with the fact that as a software developer, I rarely do things that have a physical effect.</p>
<p><object width="440" height="420" data="http://v5.tinypic.com/player.swf?file=6ygxgn&amp;s=5" type="application/x-shockwave-flash"><param name="src" value="http://v5.tinypic.com/player.swf?file=6ygxgn&amp;s=5" /></object><br />
<span style="font-size: xx-small;"><a href="http://tinypic.com/player.php?v=6ygxgn&amp;s=5">Original Video</a> &#8211; More videos at <a href="http://tinypic.com">TinyPic</a></span></p>
<p>You should follow me on twitter <a href="http://twitter.com/avivby">here</a>.
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F05%2F14%2Fmy-hello-arduino%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F05%2F14%2Fmy-hello-arduino%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6107bfac7c92ddff62b393d1e8b7abbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2009/05/14/my-hello-arduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New version of JUnitConverter is out</title>
		<link>http://www.codelord.net/2009/03/27/new-version-of-junitconverter-is-out/</link>
		<comments>http://www.codelord.net/2009/03/27/new-version-of-junitconverter-is-out/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 14:27:53 +0000</pubDate>
		<dc:creator>Aviv Ben-Yosef</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codelord.net/?p=18</guid>
		<description><![CDATA[I just uploaded the latest version of JUnitConverter (yeah, I&#8217;m no big on design), and thought it would be the right chance to talk about it here. In the summer of 2007 we, at my workplace, decided to upgrade our (non-legacy) code-bases to use JUnit 4 as part of a move to make people more [...]]]></description>
			<content:encoded><![CDATA[<p>I just uploaded the latest version of <a href="http://junit-converter.sourceforge.net/">JUnitConverter</a> (yeah, I&#8217;m no big on design), and thought it would be the right chance to talk about it here.</p>
<p>In the summer of 2007 we, at my workplace, decided to upgrade our (non-legacy) code-bases to use JUnit 4 as part of a move to make people more aware of tests and like writing tests more.</p>
<p>I did some of the organizing work beforehand and saw that most of the migration work is dumb &#8211; delete that line, add an annotation there, etc. Not wanting people to get the feeling the that &#8220;testing is a dumb, routine, thing&#8221; I set out to write something to make things easier and more automated.</p>
<p>After some googling, I stumbled upon TestNG&#8217;s junit converter which converts junit tests to TestNG tests. Needing a fast solution, I hacked on its code to make it convert junit 3 tests to junit 4 tests and was done with it. The tool was used in our effort and helped (although it wasn&#8217;t perfect).</p>
<p>During the year and half that have passed since, I&#8217;ve continued working on junit-converter as a pet project. Wanting it to be smarter, and reduce the amount of needed work even more, I came to the conclusion that the smartest thing to do would be to use some Java parsing library (instead of using Doclet). I came across many different options, most of which lacking in strength or very cumbersome. Eventually, I decided using Antlr would be the best choice.</p>
<p>I developed JUC in my spare time, enjoying the different things I wanted to try out (it was done almost fully TDD with very high coverage, and I was always fascinated with antlr). Lately, I thought I&#8217;m not doing it justice by not updating the site (a large part is because sourceforge is so not welcoming in the admin mode), so I spent the last few hours tidying things up and creating a new release and uploaded it.</p>
<p>I think it&#8217;s a good tool for anyone who wants to upgrade his tests, but also can be a good place to see how working with Antlr and Java can be done. Actually, it&#8217;s one of the most interesting projects I&#8217;ve had the chance to hack with in the last few years.</p>
<p>Congratulations JUnitConverter!
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F03%2F27%2Fnew-version-of-junitconverter-is-out%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codelord.net%2F2009%2F03%2F27%2Fnew-version-of-junitconverter-is-out%2F&amp;source=avivby&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6107bfac7c92ddff62b393d1e8b7abbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://www.codelord.net/2009/03/27/new-version-of-junitconverter-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

