<?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>devgrind &#187; programming</title>
	<atom:link href="http://devgrind.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://devgrind.com</link>
	<description>thinking outside the { }</description>
	<lastBuildDate>Fri, 04 Nov 2011 10:42:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Perl programmers are psychopaths</title>
		<link>http://devgrind.com/2009/02/17/perl-programmers-are-psychopaths/</link>
		<comments>http://devgrind.com/2009/02/17/perl-programmers-are-psychopaths/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 19:28:21 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[geekery]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://devgrind.com/?p=83</guid>
		<description><![CDATA[I always suspected that anyone who likes to write Perl programs can&#8217;t be a healthy human being, but I didn&#8217;t know what evil, murderous psychopaths these people really are until I read this headline: How to optionally kill a child and capture status if not killed How could killing a child ever be optional? It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I always suspected that anyone who likes to write Perl programs can&#8217;t be a healthy human being, but I didn&#8217;t know what evil, murderous psychopaths these people really are until I read this headline:</p>
<p><a href="http://www.perlmonks.org/?node_id=682903">How to optionally kill a child and capture status if not killed</a></p>
<p>How could killing a child ever be <em>optional</em>? It&#8217;s illegal! It&#8217;s disgusting!</p>
<p>We must not tolerate these criminals in our midst any longer. Now is the time to put an end to that <a href="http://www.perl.org">vicious disease</a> called <strong>Perl</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2009/02/17/perl-programmers-are-psychopaths/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t Rethrow, Please</title>
		<link>http://devgrind.com/2008/09/08/dont-rethrow-please/</link>
		<comments>http://devgrind.com/2008/09/08/dont-rethrow-please/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 13:36:26 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[wtf]]></category>

		<guid isPermaLink="false">http://devgrind.com/?p=51</guid>
		<description><![CDATA[Dear fellow Ruby developers, please kick the habit of catching  and rethrowing exceptions, thus ridding your users of the expeptions&#8217; stack traces. Recently I had to patch the source code of an ActiveRecord adapter as well as the underlying DBI implementation in order to find out where one particular exception was originating from. This makes [...]]]></description>
			<content:encoded><![CDATA[<p>Dear fellow Ruby developers, please kick the habit of catching  and rethrowing exceptions, thus ridding your users of the expeptions&#8217; stack traces. Recently I had to patch the source code of an ActiveRecord adapter as well as the underlying DBI implementation in order to find out where <em>one</em> particular exception was originating from. This makes debugging code really a hassle. I haven&#8217;t had this kind of problem in Java since nested exceptions.</p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2008/09/08/dont-rethrow-please/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scripting The Night Away</title>
		<link>http://devgrind.com/2008/08/01/scripting-the-night-away/</link>
		<comments>http://devgrind.com/2008/08/01/scripting-the-night-away/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 14:20:20 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://devgrind.com/?p=47</guid>
		<description><![CDATA[One of the very nice features of Mac OS X ist the ability of almost every reasonable application to receive AppleEvents, which makes the whole OS-app-bundle highly scriptable. Normally, Apple recommends that the scripting is done using a malevolent, programmer-unfirndly language named &#8220;AppleScript&#8221;. But there are alternatives, e.g. using Ruby together with the rb-appscript library. [...]]]></description>
			<content:encoded><![CDATA[<p>One of the very nice features of Mac OS X ist the ability of almost every reasonable application to receive AppleEvents, which makes the whole OS-app-bundle highly scriptable. Normally, Apple recommends that the scripting is done using a malevolent, programmer-unfirndly language named &#8220;AppleScript&#8221;. But there are alternatives, e.g. using Ruby together with the rb-appscript library.</p>
<p>As a first try, I wrote a small hack solving the following problem:</p>
<blockquote><p>In Aperture, I normally sort photos in folders named YYYY_MM_DD, so when I sort them by alphabet (or Aperture sorts them and I cannot change the sort order), the oldest ones show up first. Unfortunately, iPhoto imported photos from my camera in the German format DD.MM.YYYY, so the alphabetical sorting is useless.</p></blockquote>
<p>The ruby script goes like this:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw3">require</span> <span class="st0">&quot;rubygems&quot;</span><br />
<span class="kw3">require</span> <span class="st0">&quot;appscript&quot;</span><br />
<span class="kw1">include</span> Appscript</p>
<p>app = app<span class="br0">&#40;</span><span class="st0">&#8216;Aperture&#8217;</span><span class="br0">&#41;</span><br />
<span class="kw3">puts</span> app.<span class="me1">projects</span><br />
app.<span class="me1">get</span><span class="br0">&#40;</span>app.<span class="me1">projects</span><span class="br0">&#41;</span>.<span class="me1">each</span> <span class="br0">&#123;</span> |project|<br />
&nbsp; name = app.<span class="me1">get</span><span class="br0">&#40;</span>project.<span class="me1">name</span><span class="br0">&#41;</span><br />
&nbsp; <span class="kw1">if</span> name =~ /^\d\d\.\d\d.\d\d\d\d$/<br />
&nbsp; &nbsp; day = name<span class="br0">&#91;</span><span class="nu0">0</span>, <span class="nu0">2</span><span class="br0">&#93;</span><br />
&nbsp; &nbsp; month = name<span class="br0">&#91;</span><span class="nu0">3</span>, <span class="nu0">2</span><span class="br0">&#93;</span><br />
&nbsp; &nbsp; year = name<span class="br0">&#91;</span><span class="nu0">6</span>, <span class="nu0">4</span><span class="br0">&#93;</span><br />
&nbsp; &nbsp; app.<span class="me1">projects</span><span class="br0">&#91;</span>name<span class="br0">&#93;</span>.<span class="me1">name</span>.<span class="me1">set</span><span class="br0">&#40;</span>year+<span class="st0">&quot;_&quot;</span>+month+<span class="st0">&quot;_&quot;</span>+day<span class="br0">&#41;</span><br />
&nbsp; <span class="kw1">end</span><br />
<span class="br0">&#125;</span></div>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2008/08/01/scripting-the-night-away/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Documentation Note</title>
		<link>http://devgrind.com/2008/07/23/documentation-note/</link>
		<comments>http://devgrind.com/2008/07/23/documentation-note/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 15:24:45 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://devgrind.com/?p=45</guid>
		<description><![CDATA[If you are documenting Java methods, try to fit everything really important (like constraints for the method) into the first sentence of the javadoc. This sentence is displayed along wiht the overview of the class method. Everything after the first sentence vanishes in the distance where no-one will ever read it.]]></description>
			<content:encoded><![CDATA[<p>If you are documenting Java methods, try to fit everything really important (like constraints for the method) into the first sentence of the javadoc. This sentence is displayed along wiht the overview of the class method.</p>
<p>Everything after the first sentence vanishes in the distance where no-one will ever read it.</p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2008/07/23/documentation-note/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Ultimate Code Browser</title>
		<link>http://devgrind.com/2008/06/10/the-ultimate-code-browser/</link>
		<comments>http://devgrind.com/2008/06/10/the-ultimate-code-browser/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 19:55:29 +0000</pubDate>
		<dc:creator>Christopher</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[languages]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://devgrind.com/?p=43</guid>
		<description><![CDATA[I want a Firefox Plugin that recognizes that the page I&#8217;m looking at contains Java, does syntax highlighting and, most of all, inserts links to the classes and methods referenced in the code. The plugin (or a server it can ask) should know where the source code of a class like org.springframework.beans.factory.BeanFactory can be found. [...]]]></description>
			<content:encoded><![CDATA[<p>I want a Firefox Plugin that recognizes that the page I&#8217;m looking at contains Java, does syntax highlighting and, most of all, inserts links to the classes and methods referenced in the code. The plugin (or a server it can ask) should know where the source code of a class like <a href="http://springframework.cvs.sourceforge.net/springframework/spring/src/org/springframework/beans/factory/BeanFactory.java?view=co">org.springframework.beans.factory.BeanFactory</a> can be found.</p>
<p>First I thought that such a plugin would need (or could at least profit from) <em>sem***ic web</em> technologies (no dirty words on this blog, please), but it probably wouldn&#8217;t. All we need is a global registry that maps package names to the URLs of the web interfaces of the respective source repositories. (Maybe <a href="http://www.google.com/codesearch">Google Code Search</a> could be such a repository, but its results are often pretty bad.) The plugin would also have to include a reasonably good Java parser, and maybe a heuristic to distinguish betweeen Java and non-Java text.</p>
<p>Why would I want such a thing? Well, I often have to dig through the code of some open source library in order to understand a bug, or just to figure out what I can do with it, and how, because the documentation is incomplete or wrong. Usually I create an Eclipse project and import the code from the source repository, but that&#8217;s quite a lot of overhead if I just need to browse the code for ten minutes or so. On the other hand, digging through source code on web pages, without the help of links between the pages, is just a nuisance.</p>
<p>And wouldn&#8217;t it just be so cool to have one of the most important features of an IDE as a browser plugin, enhanced by the power of the world wide web?</p>
<p>P.S.: Or maybe I don&#8217;t want a browser plugin &#8211; maybe I just want Google to put some more effort into Code Search? Come on, guys, you&#8217;ve got all it takes &#8211; the global repository, the parsers, the heuristics&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2008/06/10/the-ultimate-code-browser/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Use quote_value in Rails 2</title>
		<link>http://devgrind.com/2008/04/03/use-quote_value-in-rails-2/</link>
		<comments>http://devgrind.com/2008/04/03/use-quote_value-in-rails-2/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 19:28:33 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[api]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[wtf]]></category>

		<guid isPermaLink="false">http://devgrind.com/?p=42</guid>
		<description><![CDATA[This is just a note to all who, like me, wonder why the heck ActiveRecord&#8217;s quote method in model classes doesn&#8217;t work anymore in Rails 2.x: quote seemingly has been replaced by quote_value, though this is not listed on the deprecation page. So if you get an error that says undefined method `quote&#8217; for your [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a note to all who, like me, wonder why the heck ActiveRecord&#8217;s <tt>quote</tt> method in model classes doesn&#8217;t work anymore in Rails 2.x: <tt>quote</tt> seemingly has been replaced by <tt>quote_value</tt>, though this is not listed on the deprecation page. So if you get an error that says <i>undefined method `quote&#8217;</i> for your model class, replace the calls to <tt>quote</tt> by <tt>quote_value</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2008/04/03/use-quote_value-in-rails-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ActiveRecord and Hibernate &#8211; Friends or Foes?</title>
		<link>http://devgrind.com/2008/01/25/activerecord-and-hibernate-friends-or-foes/</link>
		<comments>http://devgrind.com/2008/01/25/activerecord-and-hibernate-friends-or-foes/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 11:00:33 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://devgrind.com/2008/01/25/activerecord-and-hibernate-friends-or-foes/</guid>
		<description><![CDATA[Currently, I am in the nice situation to decide for myself with which framework I will build a demonstration portal. So, as I want to profit from the fast-paced development processes (at least the Ruby aficionados say so) and the lightweightiness of Rails, I decided to go the Rail(s)Way. Problem is, that I have to [...]]]></description>
			<content:encoded><![CDATA[<p>Currently, I am in the nice situation to decide for myself with which framework I will build a demonstration portal. So, as I want to profit from the fast-paced development processes (at least the Ruby aficionados say so) and the lightweightiness of Rails, I decided to go the Rail(s)Way.</p>
<p>Problem is, that I have to use a legacy database in PostgreSQL where I am not allowed to tinker with the structure, but I am forced to insert data into the tables. The database was created using Hibernate, which means an overall database sequence is used to generate the unique IDs. Unfortunately my new pal ActiveRecord does not know anything about global Postgres sequences, so I had to figure out a way to use the hibernate sequence in a hack to get my unique IDs.</p>
<p>What I did was to use the hook  <code>before_validation_on_create </code> in the ActiveRecord table model to create an ID. This looks like this:</p>
<p>[ruby]<br />
class Term < ActiveRecord::Base<br />
  before_validation_on_create :generate_id</p>
<p>  private<br />
    # use the hibernate sequence to generate the next id<br />
    def generate_id<br />
      self.id = Term.connection,execute(&#8220;select nextval(&#8216;hibernate_sequence&#8217;)&#8221;).result[0][0]<br />
    end<br />
end<br />
[/ruby]</p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2008/01/25/activerecord-and-hibernate-friends-or-foes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Favourite Programming Font</title>
		<link>http://devgrind.com/2007/11/02/my-favourite-programming-font/</link>
		<comments>http://devgrind.com/2007/11/02/my-favourite-programming-font/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 09:44:24 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[font]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://devgrind.com/2007/11/02/my-favourite-programming-font/</guid>
		<description><![CDATA[When it comes to editing source code, Bitstream Vera Sans Mono is the one true ghod. Consolas is too fat, Courier has disturbingly many serifs. Monaco is for brainwashed Apple disciples who think using a Comic-Sans-like monospaced font is sort of hip. More detailed reviews of programming fonts over at Coding Horror.]]></description>
			<content:encoded><![CDATA[<p>When it comes to editing source code, <a href="http://www.gnome.org/fonts/">Bitstream Vera Sans Mono</a> is the <a href="http://www.ccil.org/jargon/jargon_23.html">one true ghod</a>. Consolas is too fat, Courier has disturbingly many serifs. Monaco is for brainwashed Apple disciples who think using a Comic-Sans-like monospaced font is sort of hip.</p>
<p>More detailed reviews of programming fonts over at <a href="http://www.codinghorror.com/blog/archives/000969.html">Coding Horror</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2007/11/02/my-favourite-programming-font/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pandora&#8217;s Box</title>
		<link>http://devgrind.com/2007/09/13/pandoras-box/</link>
		<comments>http://devgrind.com/2007/09/13/pandoras-box/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 14:00:08 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://devgrind.com/2007/09/13/pandoras-box/</guid>
		<description><![CDATA[Even a simple HTML parser library today comes with hundreds of dependent archives, adding up to a nice 4 MB download. Which should be no problem, but at home I am blessed with an ISDN connection. Is there anything as a library package management system like in Python, Perl or Ruby for Java? If anyone [...]]]></description>
			<content:encoded><![CDATA[<p>Even a simple HTML parser library today comes with hundreds of dependent archives, adding up to a nice 4 MB download. Which should be no problem, but at home I am blessed with an ISDN connection. Is there anything as a library package management system like in Python, Perl or Ruby for Java? If anyone has seen this, let me know. If there is none, this would be the time to stand up and implement!</p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2007/09/13/pandoras-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning by Testing</title>
		<link>http://devgrind.com/2007/05/22/learning-by-testing/</link>
		<comments>http://devgrind.com/2007/05/22/learning-by-testing/#comments</comments>
		<pubDate>Tue, 22 May 2007 12:57:26 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[languages]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://devgrind.com/2007/05/22/learning-by-testing/</guid>
		<description><![CDATA[A while ago, Mike Clark wrote two blog postings on how to learn Ruby by writing tests (#1, #2). He explains that he wrote a test for each bit he learned about the language, over the years collecting a set of more than 200 tests which act as his personal knowledge base on the Ruby [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, Mike Clark wrote two blog postings on how to learn Ruby by writing tests (<a href="http://www.clarkware.com/cgi/blosxom/2005/03/18#RLT1">#1</a>, <a href="http://www.clarkware.com/cgi/blosxom/2005/04/08#RLT2">#2</a>). He explains that he wrote a test for each bit he learned about the language, over the years collecting a set of more than 200 tests which act as his personal knowledge base on the Ruby language:</p>
<blockquote><p>Through trial and error they taught me how Ruby and its rich set of libraries really work.  Not surprisingly, typing in code and running it makes you remember.  Indeed, writing learning tests is a fun way to poke and prod <em>any</em> new language or API. And with every test you write you&#8217;re investing in an executable knowledge base.</p></blockquote>
<p>Unfortunately I never tried this myself, but I like the idea. According to him, the benefit is twofold: The tests assist in acquiring and checking knowledge (by what he calls &#8220;asking Ruby&#8221;) and act as a knowledge base that manifests itself in code (and some documentation, where needed, I&#8217;d like to add).</p>
<p>Yet I am a little bit skeptical about &#8220;asking Ruby&#8221;. In his second posting, he suggests to &#8220;make a guess&#8221; in a particular case where he doesn&#8217;t know the result of a method invocation (<tt>"Rick".index('t')</tt>). Maybe I&#8217;m a bit hypersensitive here, but I have some reservations when it gets to <a href="http://devgrind.com/2007/04/25/how-to-not-solve-a-sudoku/">using tests to find out how things (could or should) work</a>. I&#8217;d think it would it be better to just look it up in a reference and write the test afterwards. The main reason is that using one test case (or a few) will give you one (or few) results, from which you will have to draw conclusions and generalize&#8212;the semantics of the <tt>index</tt> method in this case. What if your conclusions are wrong for some exceptional cases? Is it possible/feasible/desirable to write tests for each and every combination of parameters for a method? Why not trying a &#8220;read first&#8221; approach?</p>
<p>Nevertheless, the basic idea of using test cases for playing around with a language and collecting them as a reference is a nice idea. I&#8217;ll almost certainly try this the next time want to learn something about Ruby or a different language.</p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2007/05/22/learning-by-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

