<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Coderholic</title>
	
	<link>http://www.coderholic.com</link>
	<description>Addicted to Development</description>
	<lastBuildDate>Sat, 27 Feb 2010 16:54:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/coderholic" /><feedburner:info uri="coderholic" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>coderholic</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>PostgreSQL for MySQL users</title>
		<link>http://feedproxy.google.com/~r/coderholic/~3/bwkKVS5f4bc/</link>
		<comments>http://www.coderholic.com/postgresql-for-mysql-users/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 16:54:17 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[geomium]]></category>
		<category><![CDATA[postgresql]]></category>

		<guid isPermaLink="false">http://www.coderholic.com/?p=567</guid>
		<description><![CDATA[I&#8217;ve been a long time user of MySQL, and despite having had some frustrations I&#8217;ve been pretty happy with MySQL. I&#8217;m comfortable with it, I know where its weaknesses lie and where it&#8217;s strong. I&#8217;ve never really had to look at alternatives.
This all changed for a project that has been taking up all of my [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a long time user of MySQL, and despite having had <a href="http://forums.mysql.com/read.php?24,288330,288330#msg-288330">some frustrations</a> I&#8217;ve been pretty happy with MySQL. I&#8217;m comfortable with it, I know where its weaknesses lie and where it&#8217;s strong. I&#8217;ve never really had to look at alternatives.</p>
<p>This all changed for a project that has been taking up all of my spare time lately, <a href="http://www.geomium.com">Geomium</a>, a location-based communication tool. MySQL&#8217;s geospacial support is almost completely non-existant. PostgreSQL, on the other had, when combined with the <a href="http://postgis.refractions.net/">PostGIS</a> extension, has fantastic support. So PostgreSQL was what the project needed. I thought it&#8217;d be fairly easy to transition from MySQL to PostgresSQL but the command line clients of these two RDBMSes are very different. Here are some of the things I&#8217;ve learnt.</p>
<table width=100% border=1>
<tr>
<th>MySQL</th>
<th>PostgreSQL</th>
<th>Description</th>
</tr>
<tr>
<td>mysql -u&lt;user&gt; -p&lt;password &lt;database&gt;</td>
<td>psql -U&lt;user&gt; -P&lt;password&gt; &lt;database&gt;</td>
<td>Start command line client, and connect to &lt;database&gt;</td>
</tr>
<tr>
<td>SHOW DATABASES;</td>
<td>\l</td>
<td>Show available databases</td>
</tr>
<tr>
<td>SHOW TABLES;</td>
<td>\dt</td>
<td>Show available tables</td>
</tr>
<tr>
<td>USE &lt;database&gt;;</td>
<td>\c &lt;database&gt;</td>
<td>Connect to &lt;database&gt;</td>
</tr>
<tr>
<td>DESCRIBE &lt;table&gt;;</td>
<td>\dt &lt;table&gt;</td>
<td>Describe &lt;table&gt; structure</td>
</tr>
<tr>
<td>SHOW FULL PROCESSLIST;</td>
<td>SELECT * FROM pg_stat_activity;</td>
<td>Show all running queries</td>
</tr>
<tr>
<td>exit (or quit or \q)</td>
<td>\q</td>
<td>Quit the client</td>
</tr>
</table>
<p>A few other things to note: PostgreSQL only supports single quotes in queries not double quotes, so
<pre>SELECT * FROM table WHERE column = "value"</pre>
<p> would need to be rewritten as
<pre>SELECT * FROM table WHERE column = 'value'</pre>
<p>PostgreSQL also defaults to being case-sensitive, whereas MySQL defaults to case-insensitive, so you might want to modify your queries to something like
<pre>SELECT * FROM table WHERE lower(column) = 'value'</pre>
<p> although this can prevent an index on &#8220;column&#8221; from being used.</p>
<p>At first I thought PostgreSQL didn&#8217;t support some of the handy MySQL date functions (such as NOW() &#8211; INTERVAL 1 DAYS), but it turns out that it does support them, and more. It&#8217;s just fussier about the format. For details see the <a href="http://developer.postgresql.org/pgdocs/postgres/functions-datetime.html">datetime documentation</a>. </p>
<img src="http://feeds.feedburner.com/~r/coderholic/~4/bwkKVS5f4bc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.coderholic.com/postgresql-for-mysql-users/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.coderholic.com/postgresql-for-mysql-users/</feedburner:origLink></item>
		<item>
		<title>Recommended reading from Coders at Work</title>
		<link>http://feedproxy.google.com/~r/coderholic/~3/JaEwYbU7Jgk/</link>
		<comments>http://www.coderholic.com/recommended-reading-from-coders-at-work/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 21:53:22 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[books]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.coderholic.com/?p=529</guid>
		<description><![CDATA[I really enjoyed reading Peter Siebel&#8217;s Coders at Work, in which he interviews many prominent developers including Donald Knuth, Ken Thompson and Peter Norvig. A question that gets asked to the majority of the developers is what programming books do they recommend. I&#8217;ve complied some of their suggestions into the following list:
The Art of Computer [...]]]></description>
			<content:encoded><![CDATA[<p>I really enjoyed reading Peter Siebel&#8217;s <a href="http://www.amazon.co.uk/gp/product/1430219483?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1430219483">Coders at Work</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=1430219483" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />, in which he interviews many prominent developers including Donald Knuth, Ken Thompson and Peter Norvig. A question that gets asked to the majority of the developers is what programming books do they recommend. I&#8217;ve complied some of their suggestions into the following list:</p>
<p><a href="http://www.amazon.co.uk/gp/product/0201485419?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0201485419"><img style="float: left; margin-right:10px; margin-bottom: 10px;" border="0" src="http://ecx.images-amazon.com/images/I/41c-uUIgtyL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=dowlingmeuk-21&#038;l=as2&#038;o=2&#038;a=0201485419" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><b><a href="http://www.amazon.co.uk/gp/product/0201485419?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0201485419">The Art of Computer Programming</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0201485419" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</b>TAOCP is mentioned throughout Coders at Work. Some of the developers had read it all the way through, and really got stuck into the maths. Others, such as Doug Crockford had only used the book as a reference. Almost everybody agreed that this book should be on your shelf though.<br />
<br style="clear: left;"/></p>
<p><a href="http://www.amazon.co.uk/gp/product/0201657880?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0201657880"><img style="float: left; margin-right:10px; margin-bottom: 10px;" border="0" src="http://ecx.images-amazon.com/images/I/41ETT7KQRRL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0201657880" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><b><a href="http://www.amazon.co.uk/gp/product/0201657880?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0201657880">Programming Pearls</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0201657880" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</b>A book about good programming practice with examples in C, this classic has stood the test of time.<br />
<br style="clear: left;"/></p>
<p><a href="http://www.amazon.co.uk/gp/product/0596510047?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0596510047"><img style="float: left; margin-right:10px; margin-bottom: 10px;" border="0" src="http://ecx.images-amazon.com/images/I/41A3tFaEK-L._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0596510047" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><b><a href="http://www.amazon.co.uk/gp/product/0596510047?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0596510047">Beautiful Code</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0596510047" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</b>The tagline for this book is &#8220;Leading Programmers Explain How They Think&#8221;. The book contains lots of example code, and descriptions and commentary from the code&#8217;s author. While this book is only recommended once in Coders at Work, almost all of the interviewees stress the importance of reading code, and this book can help with that.<br />
<br style="clear: left;"/></p>
<p><a href="http://www.amazon.co.uk/gp/product/0262510871?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0262510871"><img style="float: left; margin-right:10px; margin-bottom: 10px;" border="0" src="http://ecx.images-amazon.com/images/I/41VPCK8QCXL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0262510871" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><b><a href="http://www.amazon.co.uk/gp/product/0262510871?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0262510871">Structure and Interpretation of Computer Programs</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0262510871" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</b>SICP is recommended several times in the book. It&#8217;s supposed to be a very in depth book, it looks at programming from a functional perspective, using Scheme. Zawinski says despite being &#8220;Lispy&#8221;, it provides a great introduction to programming without teaching a language.<br />
<br style="clear: left;"/></p>
<p><a href="http://www.amazon.co.uk/gp/product/0521663504?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0521663504"><img style="float: left; margin-right:10px; margin-bottom: 10px;" border="0" src="http://ecx.images-amazon.com/images/I/410CKVZM2EL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0521663504" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><b><a href="http://www.amazon.co.uk/gp/product/0521663504?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0521663504">Purely Functional Data Structures</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0521663504" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</b>Describes data structures from a functional programming point of view, rather than the more common imperative perspective (such as Java and C++ data structure books).<br />
<br style="clear: left;"/></p>
<p><a href="http://www.amazon.co.uk/gp/product/1558607013?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1558607013"><img style="float: left; margin-right:10px; margin-bottom: 10px;" border="0" src="http://ecx.images-amazon.com/images/I/41D4RKA43XL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=1558607013" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><b><a href="http://www.amazon.co.uk/gp/product/1558607013?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1558607013">Higher Order Perl</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=1558607013" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</b>Brad Fitzpatrick recommends this book, which is about functional programming techniques in Perl. The reviews on Amazon seem to suggest this this is an excellent programming book, and should even be interesting for non-Perl developers.<br />
<br style="clear: left;"/></p>
<p><a href="http://www.amazon.co.uk/gp/product/0735619670?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0735619670"><img style="float: left; margin-right:10px; margin-bottom: 10px;" border="0" src="http://ecx.images-amazon.com/images/I/51hDvTy1LlL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0735619670" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><b><a href="http://www.amazon.co.uk/gp/product/0735619670?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0735619670">Code Complete</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0735619670" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</b>Jamie Zawinski describes this as &#8220;the book you wish your idiot coworker had read&#8221;. It goes through the whole development lifecyle, including design, desbugging, testing and refactoring.<br />
<br style="clear: left;"/></p>
<p><a href="http://www.amazon.co.uk/gp/product/020161586X?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=020161586X"><img style="float: left; margin-right:10px; margin-bottom: 10px;" border="0" src="http://ecx.images-amazon.com/images/I/41DGMPF6FJL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=020161586X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><b><a href="http://www.amazon.co.uk/gp/product/020161586X?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=020161586X">The Practice of Programming</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=020161586X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</b>Co-authored by one of the creators of the C programming language, this book aims to teach you good programming practices to help you write faster and more maintainable code.<br />
<br style="clear: left;"/></p>
<p>The list above is just a sample of some of the books recommended in Coders at Work. The Joshua Block interview also mentions lots of interesting Computer Science papers. </p>
<p>The interviews are really great. Most aren&#8217;t particularly technical, but it is interesting to read about how these well-known programmers work, and to get some insight into some of the projects they&#8217;ve worked on. <a href="http://www.amazon.co.uk/gp/product/1430219483?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1430219483">Coders at Work</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=1430219483" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> is well worth a read.</p>
<img src="http://feeds.feedburner.com/~r/coderholic/~4/JaEwYbU7Jgk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.coderholic.com/recommended-reading-from-coders-at-work/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.coderholic.com/recommended-reading-from-coders-at-work/</feedburner:origLink></item>
		<item>
		<title>12 New Programming Languages in 12 Months</title>
		<link>http://feedproxy.google.com/~r/coderholic/~3/gm4Nwz5zbdI/</link>
		<comments>http://www.coderholic.com/12-new-programming-languages-in-12-months/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 00:37:07 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.coderholic.com/?p=519</guid>
		<description><![CDATA[I&#8217;ve decided to set myself the challenge of learning a new programming language every month in 2010. That&#8217;s 12 languages in total. With only a month on each new language I&#8217;m not going to be able to go into much depth, but I&#8217;m hoping to at least pick up some interesting techniques and new ways [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to set myself the challenge of learning a new programming language every month in 2010. That&#8217;s 12 languages in total. With only a month on each new language I&#8217;m not going to be able to go into much depth, but I&#8217;m hoping to at least pick up some interesting techniques and new ways of thinking that I might be able to apply to my every day programming with my usual languages (which happen to be Java, Python, PHP and JavaScript). Who knows, I might even become a convert of one of these languages and wonder how I&#8217;ve been able to use anything else all these years! Here are the languages I&#8217;m hoping to tackle:</p>
<p><strong>Clojure</strong></p>
<p><a href="http://clojure.org/">Clojure</a> is a Lisp dialect for the JVM. I&#8217;ve done some reading on Clojure and had a play with the REPL, so this year I&#8217;m finally going to get round to writing some code with it. From what I&#8217;ve seen so far it looks quite powerful, and the integration with the Java libraries seems to work nicely.</p>
<p><strong>Factor</strong></p>
<p><a href="http://www.factorcode.org/">Factor</a> is a concatenative programming language, meaning it uses a stack instead of named variables to pass data around. Seems like a strange concept to me. This will definitely be an interesting one!</p>
<p><strong>Go</strong></p>
<p>Google announed their <a href="http://golang.org/">Go language</a> in late 2009, describing it as a cross between C++ and Python. It was co-created by by Ken Thompson, who also co-created Unix and worked on the C programming language.</p>
<p><strong>Haskell</strong></p>
<p><a href="http://haskell.org/">Haskell</a> is a purely functional strongly typed language. It also uses lazy evaluation. It&#8217;s got a bit of a reputation for being difficult, but I&#8217;m hoping I&#8217;ll at least be able to pick up some of the main concepts and put a few small programs together.</p>
<p><strong>Erlang</strong></p>
<p><a href="http://ftp.sunet.se/pub/lang/erlang/">Erlang</a> is a concurrent programming language designed for fault tolerant real time applications. I&#8217;m looking forward to learning how Erlang deals with concurrency.</p>
<p><strong>Scheme</strong></p>
<p>I did some <a href="http://en.wikipedia.org/wiki/Scheme_%28programming_language%29">Scheme</a>, a Lisp dialect, while at university. I haven&#8217;t really touched it since though, so I&#8217;m planning to revisit it and maybe dig a little deeper. I&#8217;m thinking about trying <a href="http://www.amazon.co.uk/gp/product/0262560992?ie=UTF8&#038;tag=coderholic-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0262560992">The Little Schemer</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=coderholic-21&#038;l=as2&#038;o=2&#038;a=0262560992" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> book, or perhaps the online <a href="http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html">fixnum days</a> tutorial.</p>
<p><strong>Fantom</strong></p>
<p>Previously called Fan, <a href="http://fantom.org/">Fantom</a> claims to be portable across the JVM, .NET CLR, and JavaScript in the browser! It&#8217;s on object oriented language with C like syntax, so there shouldn&#8217;t be a huge learning curve here. It seems to have some very interesting features though, so I&#8217;m looking forward to trying it out.</p>
<p><strong>Scala</strong></p>
<p>Another JVM language,<a href="http://www.scala-lang.org/"> Scala</a> is a strongly typed language that &#8220;smoothly integrates features of object-oriented and functional languages&#8221;.</p>
<p><strong>OCaml</strong></p>
<p><a href="http://caml.inria.fr/ocaml/">Objective Caml</a> is a statically typed, object-oriented and functional. I&#8217;m sure I&#8217;ll pick up some new techniques and ideas from this language.</p>
<p><strong>Ruby</strong></p>
<p><a href="http://www.ruby-lang.org/en/">Ruby</a> is a scripting language similar in many ways to Python. I&#8217;ve never looked at it in any detail before because I always thought it was too similar to Python. I&#8217;d like to learn it mainly to give the <a href="http://rubyonrails.org/">Rails</a> web framework a try and to see how it compares to <a href="http://www.coderholic.com/8-reasons-why-you-should-try-django/">Django</a>.</p>
<p><strong>Lua</strong></p>
<p>A small and portable scripting language, <a href="http://www.lua.org/">Lua</a> is very popular in the game programming world where it is often used for the scripting of complex 3D engines.</p>
<p><strong>Prolog</strong></p>
<p>I did a little bit of <a href="http://en.wikipedia.org/wiki/Prolog">Prolog</a> at University and I remember being blown away by it. It&#8217;s a declarative logic programming language, often used in the field of AI.</p>
<p>It&#8217;s going to be a tough challenge, learning 12 new languages in 12 months. But hopefully this time next year I&#8217;ll have picked up some interesting techniques, and have a few extra tools in my programmer&#8217;s toolbox. I&#8217;ll be blogging about my progress throughout the year, posting my thoughts on these languages along with any code that I come up with. If you&#8217;re interested in the updates then you can <a href="http://feeds.feedburner.com/coderholic">subscribe</a> to get them automatically. If you&#8217;ve got any comments about any of the languages or about the challenge in general then I&#8217;d love to hear them!</p>
<img src="http://feeds.feedburner.com/~r/coderholic/~4/gm4Nwz5zbdI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.coderholic.com/12-new-programming-languages-in-12-months/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		<feedburner:origLink>http://www.coderholic.com/12-new-programming-languages-in-12-months/</feedburner:origLink></item>
		<item>
		<title>8 Reasons Why You Should Try Django</title>
		<link>http://feedproxy.google.com/~r/coderholic/~3/NGBGJsxxLcs/</link>
		<comments>http://www.coderholic.com/8-reasons-why-you-should-try-django/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 22:14:36 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[web dev]]></category>

		<guid isPermaLink="false">http://www.coderholic.com/?p=336</guid>
		<description><![CDATA[
I have been using Python for quite a few years, but mostly for writing one off sysadmin scripts, command line utilities, and of course PyRadio. Most of my web development work has been done with PHP. The language gets a lot of bad press, some deserved and some not so much. I&#8217;ve had my own [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-505 aligncenter" title="django" src="http://www.coderholic.com/wp-content/uploads/django1.png" alt="django" width="500" height="228" /></p>
<p>I have been using Python for quite a few years, but mostly for writing one off sysadmin scripts, command line utilities, and of course <a href="http://www.coderholic.com/pyradio">PyRadio</a>. Most of my web development work has been done with PHP. The language gets a lot of bad press, some deserved and some not so much. I&#8217;ve had my own <a href="http://www.coderholic.com/beware-phps-split/">gripes</a>, but all-in-all I&#8217;ve been fairly happy with PHP.</p>
<p>Several months ago, though, I thought I&#8217;d give <a href="http://www.djangoproject.com/">Django</a> a try, a python based web framework. I was completely blown away!  Compared to the PHP frameworks I&#8217;d worked with, such as <a href="http://cakephp.org/">Cake</a>, it was just so much more of a pleasure to work with. So here are 8 reasons why you should give Django a try yourself if you haven&#8217;t already. You won&#8217;t be disappointed!</p>
<p><strong>1. Great Documentation</strong></p>
<p>The Django documentation is well written, extremely comprehensive, and up to date. The <a href="http://docs.djangoproject.com/en/">official documentation</a> contains details API references, loads of relevant examples, and tutorials for those getting started. If that isn&#8217;t enough there&#8217;s also a whole <a href="http://www.djangobook.com/">book</a> that&#8217;s available for free online.</p>
<p><strong>2. It&#8217;s Python</strong></p>
<p>The fact that it&#8217;s Python is a huge plus point for me. It&#8217;s a great language that doesn&#8217;t suffer from many of the well documented inconsistencies that PHP does, and includes some nice features such as decorators and first-class functions. Going back to PHP you soon start to miss the little things, such as the ability to assign <a href="http://diveintopython.org/native_data_types/declaring_variables.html#odbchelper.multiassign">multiple values at once</a>, and the simplicity of <a href="http://diveintopython.org/native_data_types/lists.html#odbchelper.list.slice">slicing lists</a>.</p>
<p><strong>3. The ORM</strong></p>
<p>Django&#8217;s object relational mapper completely abstracts away the database, meaning you don&#8217;t need to worry about your database schema or constructing SQL queries. If you&#8217;re using to writing SQL queries then the <a href="http://docs.djangoproject.com/en/dev/ref/models/querysets/">QuerySet</a> API takes a little getting used to, but it&#8217;s really worth the effort. Projects like <a href="http://south.aeracode.org/">South</a> make the ORM even more powerful, allowing you to make schema changes and data migrations automatically.</p>
<p><strong>4. Built in Development Server</strong></p>
<p>Where PHP really shines is on its ease of deployment. Setting up a local development server can be a bit of a pain though, especially if you&#8217;re working on several different sites. Django comes with a built in development server though, so you can be up and running within minutes! From your project&#8217;s root directory you just do</p>
<pre>./manage.py runserver</pre>
<p>and access your django website from http://localhost:8000 &#8211; awesome!</p>
<p><strong>5. The Admin Interface</strong></p>
<p>Django&#8217;s built-in admin interface is practically a full blown CMS, allowing you to add, delete or update your data. It&#8217;s pretty much all automatic, but it&#8217;s also fairly configuration. See the <a href="http://docs.djangoproject.com/en/dev/intro/tutorial02/">documentation</a> to see what it can do!</p>
<p><strong>6. Reusable Applications</strong></p>
<p>Django projects are broken up into &#8220;applications&#8221;, and there are lots of existing reusable applications that you can use for your own projects, such as those for <a href="http://code.google.com/p/django-registration/">user registration</a>, <a href="http://github.com/flashingpumpkin/django-socialregistration">facebook integration</a>, <a href="http://github.com/nathanborror/django-basic-apps">blogging</a>, and <a href="http://github.com/search?langOverride=&amp;language=&amp;q=django&amp;repo=&amp;start_value=2&amp;type=Repositories&amp;x=13&amp;y=19">many many more</a>.</p>
<p>Existing applications are great, but the whole project/application distinction also forces you to think about your own project structure and therefore more likely to make reusable components that you can use in more of your own projects, or even share for others to use.</p>
<p><strong>7</strong><strong>. Templates</strong></p>
<p>I&#8217;ve always been a bit dubious about the merits of PHP template engines such as Smarty. The Django template layer is great though. The inheritance model works well, and the restrictive language really forces you to have a very clean separation of presentation and logic.</p>
<p><strong>8</strong><strong>. Forms</strong></p>
<p>I usually find dealing with user input one of the most boring parts of web development. It takes time to get it right, and its repetitive. The Django Form API really simplifies things. You can define your form class, include and validation rules, and simply add a few lines to your template and few lines to your view and you&#8217;re done!</p>
<hr/>
<p>So those are my 8 reasons why you should give django a go. If you&#8217;re already a django user let me know if you have any points to add!</p>
<img src="http://feeds.feedburner.com/~r/coderholic/~4/NGBGJsxxLcs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.coderholic.com/8-reasons-why-you-should-try-django/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://www.coderholic.com/8-reasons-why-you-should-try-django/</feedburner:origLink></item>
		<item>
		<title>Recursively Drawing Trees with JavaScript and Canvas</title>
		<link>http://feedproxy.google.com/~r/coderholic/~3/hir6ysLLEtA/</link>
		<comments>http://www.coderholic.com/recursively-drawing-trees-with-javascript-and-canvas/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 21:27:25 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.coderholic.com/?p=448</guid>
		<description><![CDATA[I have written an article titled Graphics Programming with Canvas for the upcoming December 2009 edition of JSMag. One of the examples I came up with for the article was a recursive tree drawing algorithm. I had quite a bit of fun tweaking different values and seeing what sort of tree would be produced. After [...]]]></description>
			<content:encoded><![CDATA[<p>I have written an article titled <em>Graphics Programming with Canvas</em> for the upcoming December 2009 edition of <a href="http://www.jsmag.com">JSMag</a>. One of the examples I came up with for the article was a recursive tree drawing algorithm. I had quite a bit of fun tweaking different values and seeing what sort of tree would be produced. After a while it got a bit boring changing a value, saving the JavaScript and then refreshing the page, so with the help of jQuery UI I came up with an <a href="http://www.coderholic.com/demo/tree/">interactive version</a>. Below are a couple of tree images I&#8217;ve generated with the tool:</p>
<p><img src="http://www.coderholic.com/wp-content/uploads/tree4.png" alt="tree" title="tree" width="300" height="350" class="alignnone size-full wp-image-452" style="border: 1px solid grey; float: left; margin-right: 5px;" /></p>
<p><img src="http://www.coderholic.com/wp-content/uploads/tree1.png" alt="tree" title="tree" width="300" height="350" class="alignnone size-full wp-image-452" style="border: 1px solid grey; float: left;"/></p>
<p><br style="clear: left;"/></p>
<p>You can view the page source to see what&#8217;s going on behind the scenes, but for full details check out the December edition of JSMag. Give it a try for yourself, <a href="http://www.coderholic.com/demo/tree/">generate your own tree</a>!</p>
<img src="http://feeds.feedburner.com/~r/coderholic/~4/hir6ysLLEtA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.coderholic.com/recursively-drawing-trees-with-javascript-and-canvas/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.coderholic.com/recursively-drawing-trees-with-javascript-and-canvas/</feedburner:origLink></item>
		<item>
		<title>Faking late static binding in PHP</title>
		<link>http://feedproxy.google.com/~r/coderholic/~3/u8iBJGVxa_k/</link>
		<comments>http://www.coderholic.com/faking-late-static-binding-in-php/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 21:41:25 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.coderholic.com/?p=328</guid>
		<description><![CDATA[PHP 5.3 brings lots of long awaited features to the language, including closures, late static binding and namespaces. Unfortunately 5.3 still isn&#8217;t widely available, so some of us are stuck with older version of the language that lack these great new features.
One feature I miss all the time is late static binding, or LSB. The [...]]]></description>
			<content:encoded><![CDATA[<p>PHP 5.3 brings lots of long awaited features to the language, including closures, <a href="http://php.net/manual/en/language.oop5.late-static-bindings.php">late static binding</a> and namespaces. Unfortunately 5.3 still isn&#8217;t widely available, so some of us are stuck with older version of the language that lack these great new features.</p>
<p>One feature I miss all the time is late static binding, or LSB. The lack of LSB means that you can&#8217;t tell tell which class in your class hierarchy was invoked when calling a static method. Here&#8217;s a simple example:</p>
<pre name="code" class="php">
class class0 {
  public static function getName() {
      echo __CLASS__ . "\n";
  }
}

class class1 extends class0 {}

class class2 extends class1 {}

class0::getName(); // -> "class0"
class1::getName(); // -> "class0"
class2::getName(); // -> "class0"
</pre>
<p>Notice that all three method calls output &#8220;class0&#8243;, the name of the base class. There is no way to tell which class the static method was called on, and in some situations that is information we need to know. </p>
<p>So what can we do? One obvious solution is to re-implement the method in every subclass. This doesn&#8217;t pose much of a problem for a method as simple as the one in our example, but in reality our method is likely to be much more complex, and implementing it in every subclass will lead to lots of duplication. If we ever need to make changes to the method then changes will need to be made to every subclass too. Not fun!</p>
<p>And alternative solution is to have every subclass invoke the parent method, passing in the class name (or whatever variable we&#8217;re interested in). It requires only a couple of extra lines per subclass, rather than repeating the whole method. Any changes now only need to be made in one place. Here&#8217;s the code:</p>
<pre name="code" class="php">
class class0 {
  public static function getName($class = __CLASS__) {
      echo "$class\n";
  }
}

class class1 extends class0 {
  public static function getName($class = __CLASS__) {
      return parent::getName($class);
  }
}

class class2 extends class1 {
  public static function getName($class = __CLASS__) {
      return parent::getName($class);
  }
}

class0::getName(); // -> "class0"
class1::getName(); // -> "class1"
class2::getName(); // -> "class2"
</pre>
<p>In PHP5.3 we can use the new <a href="http://php.net/manual/en/function.get-called-class.php">get_called_class()</a>, so the code becomes much cleaner:</p>
<pre name="code" class="php">
class class0 {
  public static function getName() {
      echo get_called_class() . "\n";
  }
}

class class1 extends class0 {}

class class2 extends class1 {}

class0::getName(); // -> "class0"
class1::getName(); // -> "class1"
class2::getName(); // -> "class2"
</pre>
<img src="http://feeds.feedburner.com/~r/coderholic/~4/u8iBJGVxa_k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.coderholic.com/faking-late-static-binding-in-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.coderholic.com/faking-late-static-binding-in-php/</feedburner:origLink></item>
		<item>
		<title>Munin Popularity Plugins</title>
		<link>http://feedproxy.google.com/~r/coderholic/~3/P_EXXO0f2Ec/</link>
		<comments>http://www.coderholic.com/munin-popularity-plugins/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 19:45:24 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.coderholic.com/?p=405</guid>
		<description><![CDATA[
After writing about Munin last week and mentioning some of its uses outside of system performance tracking I decided to write a collection of plugins for tracking website popularity. The full code is available on GitHub.
The plugins include:

Alexa traffic rank
Number of pages in the Google index
Technorati authority
Feedburner RSS subscribers
Twitter followers

Munin will automatically handle the generation [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-408" title="google-index" src="http://www.coderholic.com/wp-content/uploads/google-index.png" alt="google-index" width="504" height="304" /></p>
<p>After writing about <a href="http://www.coderholic.com/server-monitoring-with-munin/">Munin</a> last week and mentioning some of its uses outside of system performance tracking I decided to write a collection of plugins for tracking website popularity. The full code is available on <a href="http://github.com/coderholic/munin-popularity-plugins">GitHub</a>.</p>
<p>The plugins include:</p>
<ul>
<li>Alexa traffic rank</li>
<li>Number of pages in the Google index</li>
<li>Technorati authority</li>
<li>Feedburner RSS subscribers</li>
<li>Twitter followers</li>
</ul>
<p>Munin will automatically handle the generation of daily, weekly, monthly and yearly graphs. All of the plugins support graphing of multiple sites/accounts, so you can show several sites on the same graph, as is the case with the Google index graph above, or you can decide to show a single site/account per graph. Some example graphs are shown below:</p>
<p><img class="alignnone size-full wp-image-410" title="twitter" src="http://www.coderholic.com/wp-content/uploads/twitter.png" alt="twitter" width="503" height="280" /></p>
<p><img class="alignnone size-full wp-image-409" title="technorati" src="http://www.coderholic.com/wp-content/uploads/technorati.png" alt="technorati" width="505" height="281" /></p>
<p><img class="alignnone size-full wp-image-407" title="feedburner" src="http://www.coderholic.com/wp-content/uploads/feedburner.png" alt="feedburner" width="503" height="280" /></p>
<p><img class="alignnone size-full wp-image-406" title="alexa" src="http://www.coderholic.com/wp-content/uploads/alexa.png" alt="alexa" width="504" height="304" /></p>
<img src="http://feeds.feedburner.com/~r/coderholic/~4/P_EXXO0f2Ec" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.coderholic.com/munin-popularity-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.coderholic.com/munin-popularity-plugins/</feedburner:origLink></item>
		<item>
		<title>Server Monitoring with Munin</title>
		<link>http://feedproxy.google.com/~r/coderholic/~3/6PWxu6NLToc/</link>
		<comments>http://www.coderholic.com/server-monitoring-with-munin/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 21:53:56 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[munin server opensource monitoring sysadmin]]></category>

		<guid isPermaLink="false">http://www.coderholic.com/?p=378</guid>
		<description><![CDATA[Munin is an excellent open source tool for monitoring and graphing server performance metrics. It can be configured to send out alert emails when something goes wrong with your server, and the graphs make it easy to view trends over time: You could see that your site gets much less traffic on a Sunday, for [...]]]></description>
			<content:encoded><![CDATA[<p>Munin is an excellent open source tool for monitoring and graphing server performance metrics. It can be configured to send out alert emails when something goes wrong with your server, and the graphs make it easy to view trends over time: You could see that your site gets much less traffic on a Sunday, for example, or that the number of database queries performed per day has doubled in the last 2 months.</p>
<p><img style="border: 1px solid gray;" src="/wp-content/uploads/munin-graphs1.png" alt="" /></p>
<p>On a Debian-based system installing Munin is as simple as running the following command, and then going to http://your-server/munin/ in your browser:</p>
<pre>sudo aptitude install munin</pre>
<p>Munin comes with lots of monitoring plugins by default, including those for MySQL, PostgresSQL, Apache, Tomcat, Squid, and for things such a CPU and memory usage, load average, network traffic, and many more. You can also find lots of user submitted plugins on sites like <a href="http://muninexchange.projects.linpro.no/">Munin Exchange</a>.</p>
<p>Munin doesn&#8217;t have to be used solely for monitoring server performance though. Being so easy to extend Munin is  also a great tool for tracking non-server performance related trends over time. In just a few lines of code you could write plugins to track the following stats about your website:</p>
<ul>
<li>Number of User signups</li>
<li>Google PageRank</li>
<li>Pages in Google&#8217;s index</li>
<li>Number of backlinks</li>
<li>Number of twitter mentions</li>
<li>Alexa traffic rank</li>
</ul>
<p>The <em>number of pages in Google&#8217;s index</em> is actually a plugin I&#8217;ve written. Simple put the following code in your /etc/munin/plugins directory to see it in action:</p>
<pre name="code" class="python">
#!/bin/sh
# Munin Plugin to display the number of pages in the
# google index for all of the given websites
# Ben Dowling - www.coderholic.com

# Change this to whatever sites you're interested in
websites="www.yahoo.com www.google.com www.twitter.com"

if [ "$1" = "autoconf" ]; then
        echo yes
        exit 0
fi

if [ "$1" = "config" ]; then

        echo 'graph_title Number of Pages in Google Index'
        echo 'graph_args --base 1000 -l 0 '
        echo 'graph_vlabel number of pages'
        echo 'graph_category google'
        echo 'graph_info This graph shows the number of pages in the Google index for a given website.'

        i=0
        for site in $websites
        do
                name="site_${i}"
                echo "${name}.label ${site}"
                echo "${name}.draw LINE2"
                echo "${name}.info The number of pages in the google index."
                i=$((i+1))
        done
        exit 0
fi

i=0
for site in $websites
do
        name="site_${i}"
		value=$(wget -q --user-agent=Firefox -O - "http://www.google.com/search?q=site:${site}" | grep -E "of about <b>[0-9,]+</b>" -o | grep -E "[0-9,]+" -o | sed "s/,//g")
        echo "${name}.value ${value}"

        i=$((i+1))
done
</pre>
<p>For more details about Munin see their <a href="http://munin.projects.linpro.no/">homepage</a>, which also includes detailed documentation on writing your own plugins. </p>
<p>Let me know if you can think of any more Munin plugins that could be interesting, or if you&#8217;ve used any yourself!</p>
<img src="http://feeds.feedburner.com/~r/coderholic/~4/6PWxu6NLToc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.coderholic.com/server-monitoring-with-munin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.coderholic.com/server-monitoring-with-munin/</feedburner:origLink></item>
		<item>
		<title>10 More Puzzle Websites to Sharpen Your Programming Skills</title>
		<link>http://feedproxy.google.com/~r/coderholic/~3/_GqSN6wCnIc/</link>
		<comments>http://www.coderholic.com/10-more-puzzle-websites-to-sharpen-your-programming-skills/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 17:08:13 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.coderholic.com/?p=338</guid>
		<description><![CDATA[My recently published Six Revision guest post, 10 Puzzle Websites to Sharpen Your Programming Skills, got a great response, hitting the front page of Hacker News, Reddit, and doing fairly well on Digg too. 
Lots of comments were left pointing out some sites which weren&#8217;t included in my list, so I&#8217;m following up here with [...]]]></description>
			<content:encoded><![CDATA[<p>My recently published Six Revision guest post, <a href="http://sixrevisions.com/resources/10-puzzle-websites-to-sharpen-your-programming-skills/">10 Puzzle Websites to Sharpen Your Programming Skills</a>, got a great response, hitting the front page of <a href="http://news.ycombinator.com/item?id=885481">Hacker News</a>, <a href="http://www.reddit.com/r/programming/comments/9uotv/10_puzzle_websites_to_sharpen_your_programming/">Reddit</a>, and doing fairly well on <a href="http://digg.com/programming/10_Puzzle_Websites_to_Sharpen_Your_Programming_Skills">Digg</a> too. </p>
<p>Lots of comments were left pointing out some sites which weren&#8217;t included in my list, so I&#8217;m following up here with a list of 10 more top programming puzzle websites:</p>
<h3>1. <a href="http://www.codechef.com/">Code Chef</a></h3>
<p><img style="border:1px solid grey;" src="/wp-content/uploads/wwwcodechefcom-screen-capture-2009-10-17-15-14-50_thumb.png"/></p>
<p>Code Chef has lots of practice puzzles, and monthly competitions with cash prizes. The site officially supports over 35 programming languages!</p>
<h3>2. <a href="http://www.spoj.pl/">SPOJ</a></h3>
<p><img style="border:1px solid grey;" src="/wp-content/uploads/wwwspojpl-screen-capture-2009-10-17-15-14-36_thumb.png"/></p>
<p>The Sphere Online Judge contains 1871 different programming problems. More points are awarded for better performing solutions, which can be submitted in a range of languages.</p>
<h3>3. <a href="http://codegolf.com/">Code Golf</a></h3>
<p><img style="border:1px solid grey;" src="/wp-content/uploads/codegolfcom-screen-capture-2009-10-17-15-14-40_thumb.png"/></p>
<p>The aim with code golf is to submit a solution using the fewest characters possible.Solutions can be submitted in Perl, Python PHP or Ruby.</p>
<h3>4. <a href="http://uva.onlinejudge.org/">Uva Online Judge</a></h3>
<p><img style="border:1px solid grey;" src="/wp-content/uploads/uvaonlinejudgeorg-screen-capture-2009-10-17-15-14-41_thumb.png"/></p>
<p>Over 2600 great programming puzzles, and also regular contests. Submissions in C, C++, Java or Pascal are automatically checked for you.</p>
<h3>5. <a href="http://acm.timus.ru/">Timus Online Judge</a></h3>
<p><img style="border:1px solid grey;" src="/wp-content/uploads/acmtimusru-screen-capture-2009-10-17-15-14-43_thumb.png"/></p>
<p>An online competition site that automatically checks your submissions. Supports Java, C#, Pascal, C and C++.</p>
<h3>6. <a href="http://code.google.com/codejam/">Google Code Jam</a></h3>
<p><img style="border:1px solid grey;" src="/wp-content/uploads/codegooglecom-screen-capture-2009-10-17-15-14-46_thumb.png"/></p>
<p>The code jam is a programming contest from Google. The top 25 contestants get to travel to Google&#8217;s HQ in California. Entries are accepting in any programming language.</p>
<h3>7. <a href="http://train.usaco.org/usacogate">USA Computing Olympiad</a></h3>
<p><img style="border:1px solid grey;" src="/wp-content/uploads/trainusacoorg-screen-capture-2009-10-17-15-14-48_thumb.png"/></p>
<p>Programming puzzles designed to provide &#8220;pre-college students with opportunities to sharpen their computer programming skills&#8221;. The puzzles are still interesting and fun even if you&#8217;ve got a CS degree!</p>
<h3>8. <a href="http://www.olympiad.org.uk/">Informatics Olympiad</a></h3>
<p><img style="border:1px solid grey;" src="/wp-content/uploads/wwwolympiadorguk-screen-capture-2009-10-17-15-14-52_thumb.png"/></p>
<p>A British version of the computing olympiad. Again aimed at school and college students, but fun and interesting for everyone.</p>
<h3>9. <a href="http://cplus.about.com/od/programmingchallenges/Programming_Challenges.htm">Programming Challenges in C, C++ and C#</a></h3>
<p><img style="border:1px solid grey;" src="/wp-content/uploads/aboutcom-screen-capture-2009-10-17-15-14-54_thumb.png"/></p>
<p>About.com&#8217;s C/C++/C# section regularly posts interesting programming puzzles. Successful solutions get acknowledged on the site once the deadline has passed.</p>
<h3>10. <a href="http://www.javabat.com/">Java Bat</a></h3>
<p><img style="border:1px solid grey;" src="/wp-content/uploads/wwwjavabatcom-screen-capture-2009-10-17-15-14-57_thumb.png"/></p>
<p>A site dedicated to practical Java programming problems. You can type your code directly into the website, and it&#8217;ll tell you if you&#8217;ve solve the problem correctly or not.</p>
<img src="http://feeds.feedburner.com/~r/coderholic/~4/_GqSN6wCnIc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.coderholic.com/10-more-puzzle-websites-to-sharpen-your-programming-skills/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://www.coderholic.com/10-more-puzzle-websites-to-sharpen-your-programming-skills/</feedburner:origLink></item>
		<item>
		<title>MySQL table size reporting script</title>
		<link>http://feedproxy.google.com/~r/coderholic/~3/7_sQgAb11Yo/</link>
		<comments>http://www.coderholic.com/mysql-table-size-reporting-script/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 07:40:04 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.coderholic.com/?p=330</guid>
		<description><![CDATA[I&#8217;ve written a small shell script to report how much disk space each table in a given MySQL database is using. For example, below is the output of the script when run against this site&#8217;s database:

bmd /~: ./dbSize.sh coderholic root ********
wp_comments Data: 6.60MB Indexes: .15MB Total: 6.75MB
wp_links Data: 0MB Indexes: 0MB Total: 0MB
wp_options Data: 1.57MB [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a small shell script to report how much disk space each table in a given MySQL database is using. For example, below is the output of the script when run against this site&#8217;s database:</p>
<pre>
bmd /~: ./dbSize.sh coderholic root ********
wp_comments Data: 6.60MB Indexes: .15MB Total: 6.75MB
wp_links Data: 0MB Indexes: 0MB Total: 0MB
wp_options Data: 1.57MB Indexes: .01MB Total: 1.58MB
wp_postmeta Data: .01MB Indexes: .01MB Total: .02MB
wp_posts Data: .57MB Indexes: .02MB Total: .60MB
wp_term_relationships Data: 0MB Indexes: .01MB Total: .02MB
wp_term_taxonomy Data: 0MB Indexes: 0MB Total: 0MB
wp_terms Data: 0MB Indexes: 0MB Total: 0MB
wp_tla_data Data: 0MB Indexes: 0MB Total: 0MB
wp_tla_rss_map Data: 0MB Indexes: 0MB Total: 0MB
wp_usermeta Data: 0MB Indexes: 0MB Total: 0MB
wp_users Data: 0MB Indexes: 0MB Total: 0MB
*** 12 Tables | Data: 8.78MB Indexes: .25MB Total: 9.03MB ***
</pre>
<p>With a few small modifications I&#8217;m sure it&#8217;d be possible to get the script working PostgreSQL or other RDBMSes. The full code is below:</p>
<pre name="code" class="python">
#!/bin/bash
# Calculate the storage space used up by all tables in a given MySQL database
# Ben Dowling - www.coderholic.com
database=$1
username=$2
password=$3

if [ ${#database} -eq 0 ]
then
	echo "Usage: $0 &lt;database&gt; [username [password]]"
	exit
fi

if [ "$password" ]
then
   password="-p$password"
fi

mysql="mysql -u $username $password $database"

$mysql -se "USE $database";

tables=$($mysql -se "SHOW TABLES")

totalData=0
totalIndex=0
totalTables=0

for table in $tables
do
   output=$($mysql -se "SHOW TABLE STATUS LIKE \"$table\"\G")
   data=$(echo "$output" | grep Data_length | awk -F': ' '{print $2}')
   dataMegs=$(echo "scale=2;$data/1048576" | bc)
   index=$(echo "$output" | grep Index_length | awk -F': ' '{print $2}')
   indexMegs=$(echo "scale=2;$index/1048576" | bc)
   total=$(($index+$data))
   totalMegs=$(echo "scale=2;$total/1048576" | bc)

   echo "$table Data: ${dataMegs}MB Indexes: ${indexMegs}MB Total: ${totalMegs}MB"

   totalData=$(($totalData+$data))
   totalIndex=$(($totalIndex+$index))
   totalTables=$(($totalTables+1))
done

dataMegs=$(echo "scale=2;$totalData/1048576" | bc)
indexMegs=$(echo "scale=2;$totalIndex/1048576" | bc)
total=$(($totalIndex+$totalData))
totalMegs=$(echo "scale=2;$total/1048576" | bc)

echo "*** $totalTables Tables | Data: ${dataMegs}MB Indexes: ${indexMegs}MB Total: ${totalMegs}MB ***"
</pre>
<img src="http://feeds.feedburner.com/~r/coderholic/~4/7_sQgAb11Yo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.coderholic.com/mysql-table-size-reporting-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.coderholic.com/mysql-table-size-reporting-script/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.178 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-03-07 05:48:23 -->
