<?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>dasman's World &#187; java</title>
	<atom:link href="http://blogs.asman-it.com.au/dasman/index.php/category/it-stuff/java/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.asman-it.com.au/dasman</link>
	<description>The things that matter: Computing, Cycling, Java, the Environment, etc, etc (list liable to change...!)</description>
	<lastBuildDate>Sat, 15 May 2010 07:25:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Running JIRA under a multi-level context on Tomcat 6</title>
		<link>http://blogs.asman-it.com.au/dasman/index.php/20100515/running-jira-under-a-multi-level-context-on-tomcat-6</link>
		<comments>http://blogs.asman-it.com.au/dasman/index.php/20100515/running-jira-under-a-multi-level-context-on-tomcat-6#comments</comments>
		<pubDate>Sat, 15 May 2010 07:21:27 +0000</pubDate>
		<dc:creator>dasman</dc:creator>
				<category><![CDATA[IT Stuff]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.asman-it.com.au/dasman/?p=74</guid>
		<description><![CDATA[I&#8217;ve recently started trialling JIRA &#8211; the issue tracking system from Atlassian.  Fantastic looking product so far &#8211; I&#8217;ve done a lot of work with Bugzilla in the past, but it doesn&#8217;t compare when it comes to the sizzle that JIRA offers.
The installation documentation is incredibly extensive.  Alas, I work in IT which [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently started trialling <a href="http://www.atlassian.com/software/jira/">JIRA</a> &#8211; the issue tracking system from Atlassian.  Fantastic looking product so far &#8211; I&#8217;ve done a lot of work with Bugzilla in the past, but it doesn&#8217;t compare when it comes to the sizzle that JIRA offers.</p>
<p>The installation documentation is incredibly extensive.  Alas, I work in IT which means Murphy&#8217;s Law guarantees that the environment I&#8217;m given to work in will be unique, complex, and a million miles from a &#8220;Standard&#8221; setup.  Consequently, I was dealing with reverse proxies, apache front-ends, https issues and more besides! <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>One issue that I did spend a while on was this one:  <a href="http://jira.atlassian.com/browse/JRA-19051">http://jira.atlassian.com/browse/JRA-19051</a>.  Basically, JIRA has problems when installing on Tomcat 6 if you want to use a Context that is multi-level.  So, something like &#8220;/servlets/JIRA&#8221; rather than &#8220;/JIRA&#8221;.  </p>
<p>The fault is actually with Sitemesh that JIRA makes use of.  Tomcat 6 uses a naming standard based on hashes as separators to specify a multi-level context.  So, in the example above, the context XML and exploded WAR file is stored as &#8220;servlets#JIRA&#8221;.  Unfortunately, this confuses Sitemesh who tries to drill into the expected Context directory structure and complains that directory &#8220;servlets&#8221; does not exist.</p>
<p>The issue linked to above is still unresolved and was raised in September 2009, so I suspect it&#8217;s probably a pretty low priority.  I was able to work around it however by inserting the &#8220;&lt;context&gt;&#8221; stanza for JIRA in the main server.xml file rather than in a file of its own.</p>
<p>While this isn&#8217;t the preferred Tomcat way of doing things (any changes I make will require a Tomcat restart), doing the Context entry this way allows you to use the path attribute, where you specify the full Context path.  Using a standalone Context file, you can&#8217;t use this attribute &#8211; it is inferred from the (special, hash-separated) file name.</p>
<p>I also used the docBase attribute to point to the exploded WAR file.  I placed the exploded WAR file under the standard webapps directory, but nested to match the multi-level context path (so, something like &#8230;/webapps/servlets/jira, rather than the more Tomcat-6-normal /webapps/servlets#jira).</p>
<p>This was enough to get me up and running.  I suspect it might also be possible to do something using an Apache proxy, whereby Tomcat thinks it is running single level contexts (/jira) and Apache proxies the requests to those single levels (so it converts requests for /servlet/jira to simply /jira).  Unfortunately this wasn&#8217;t possible in the environment I was running in, so I haven&#8217;t pursued it any further.</p>
<p>Hopefully this run-down is helpful to anyone else who hits this issue!</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2080207984545284";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.asman-it.com.au/dasman/index.php/20100515/running-jira-under-a-multi-level-context-on-tomcat-6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing the Scala Eclipse plugin in Eclipse Europa</title>
		<link>http://blogs.asman-it.com.au/dasman/index.php/20080115/installing-the-scala-eclipse-plugin-in-eclipse-europa</link>
		<comments>http://blogs.asman-it.com.au/dasman/index.php/20080115/installing-the-scala-eclipse-plugin-in-eclipse-europa#comments</comments>
		<pubDate>Mon, 14 Jan 2008 19:06:51 +0000</pubDate>
		<dc:creator>dasman</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://blogs.asman-it.com.au/dasman/index.php/20080115/installing-the-scala-eclipse-plugin-in-eclipse-europa</guid>
		<description><![CDATA[This post falls squarely in the camp of &#8220;this was a gotcha that caught me, so I&#8217;ll blog about it so that I can Google the solution later&#8221;!  
I&#8217;m in the process of getting my head around Scala, but when installing the Scala Eclipse plugin into my standard Eclipse Europa setup, I got the [...]]]></description>
			<content:encoded><![CDATA[<p>This post falls squarely in the camp of &#8220;this was a gotcha that caught me, so I&#8217;ll blog about it so that I can Google the solution later&#8221;! <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;m in the process of getting my head around Scala, but when installing the Scala Eclipse plugin into my standard Eclipse Europa setup, I got the message that Scala Plugin couldn&#8217;t be installed because it required &#8220;org.eclipse.pde.runtime&#8221;.</p>
<p>I found a few references on Google, suggesting a full installation of Eclipse (i.e not a standard install), or reverting to Eclipse 3.2.</p>
<p>Instead I had success by:</p>
<ol>
<li>Go to search for new plugins with &#8220;Help&#8221; -> &#8220;Software Updates&#8221; -> &#8220;Find and Install&#8221;</li>
<li>Choose &#8220;Search for new features to install&#8221;</li>
<li>Select the &#8220;The Eclipse Project Updates&#8221; repository&#8221;</li>
<li>Expand the &#8220;Eclipse SDK Eclipse 3.3.1.1&#8243; category, and select the &#8220;Eclipse Plugin Development Environment&#8221;</li>
</ol>
<p>This plugin includes the required &#8220;org.eclipse.pde.runtime&#8221; package, so once installed you should be able to get the Scala plugin up and running.</p>
<p>Now all I need to do is to relearn functional programming from my Uni days&#8230; <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2080207984545284";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.asman-it.com.au/dasman/index.php/20080115/installing-the-scala-eclipse-plugin-in-eclipse-europa/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Yet another Ubuntu convert!</title>
		<link>http://blogs.asman-it.com.au/dasman/index.php/20070825/yet-another-ubuntu-convert</link>
		<comments>http://blogs.asman-it.com.au/dasman/index.php/20070825/yet-another-ubuntu-convert#comments</comments>
		<pubDate>Sat, 25 Aug 2007 07:02:28 +0000</pubDate>
		<dc:creator>dasman</dc:creator>
				<category><![CDATA[IT Stuff]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.asman-it.com.au/dasman/index.php/20070825/yet-another-ubuntu-convert</guid>
		<description><![CDATA[I can only take so many mysterious disappearances of my wireless network.  It turns out, exactly 146 disappearances!    So, when my Vista laptop decided for the 147th time that I was connected to my wireless network &#8220;kind of&#8221;, I decided enough was enough!
There was a time when I was a Linux [...]]]></description>
			<content:encoded><![CDATA[<p>I can only take so many mysterious disappearances of my wireless network.  It turns out, exactly 146 disappearances! <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   So, when my Vista laptop decided for the 147th time that I was connected to my wireless network &#8220;kind of&#8221;, I decided enough was enough!</p>
<p>There was a time when I was a Linux guy through-and-through.  I moved back to Windows on the desktop when I got a new machine (although my servers stayed Linux&#8230;of course!).  So, its fair to say I&#8217;ve been out of the scene for a while and didn&#8217;t really know where the state of the Linux art was at.</p>
<p>But thinking about it, 95% of my time on the laptop is spent surfing the web, doing email, and writing the odd document &#8211; Linux can do all those with ease.  So, with nothing to lose, I used the new Vista functionality to shrink my C: drive, and went about installing <a href="http://www.ubuntu.com">Ubuntu</a> Linux on the newly created space.</p>
<p>Wow! <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So straightforward!  I downloaded the ISO image, burnt a CD, and booted off it.  30 seconds or so later, I was looking at a Gnome desktop with a fairly full complement of available applications, and an &#8220;Install Ubuntu&#8221; icon.  Great way to do things &#8211; you can try out the OS, see if your machine has any incompatible hardware, and if not, proceed with actually installing it to your hard drive.</p>
<p>Seeing no obvious problems, I hit install, and 20 minutes or so later I had a laptop which let you choose Vista or Linux at bootup, and proceeded from there.</p>
<p>The experience has been fantastic.  From the get-go, my Dell Inspiron 6400 laptop could see all the surrounding wireless networks, handle sound (even the custom volume up/down buttons work a treat!) and had all the software installed to surf the web, read email, and write documents and spreadsheets.</p>
<p>Thats not to say it was all smooth sailing &#8211; getting the laptop to actually talk to my WPA-protected wireless LAN took a bit of work &#8211; the built in graphical client didn&#8217;t want to connect, but once I put the appropriate details in /etc/network/interfaces it was all good.  That&#8217;s pretty much been the only hiccup!</p>
<p><img src='http://blogs.asman-it.com.au/dasman/wp-content/uploads/2007/08/screenshot.png' alt='Ubuntu running Eclipse' /></p>
<p>I&#8217;ve installed a few more things now &#8211; Google Earth is up and running (way to go Google, for supporting Linux!), the latest JDK is in, and my one indispensable piece of software &#8211; <a href="http://www.eclipse.org">the Eclipse IDE</a> <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8211; is up and running (pictured).  This is one of the joys of doing Java development &#8211; the Operating System I choose to use is almost irrelevant &#8211; I don&#8217;t necessarily need to be running a system identical to my clients.</p>
<p>Since I&#8217;ve installed Ubuntu, there has yet to be a single reason to boot into Windows.  Ubuntu even lets me read my Vista NTFS-formatted partition, so I can still get to all my music and documents.  I suspect that what I may end up doing is setting up the laptop as a pure Linux system, with a VMWare image if I do come across something which absolutely requires Windows.</p>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.asman-it.com.au/dasman/index.php/20070825/yet-another-ubuntu-convert/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>3 months of news</title>
		<link>http://blogs.asman-it.com.au/dasman/index.php/20070120/3-months-of-news</link>
		<comments>http://blogs.asman-it.com.au/dasman/index.php/20070120/3-months-of-news#comments</comments>
		<pubDate>Sat, 20 Jan 2007 00:19:02 +0000</pubDate>
		<dc:creator>dasman</dc:creator>
				<category><![CDATA[IT Stuff]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[j2me]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.asman-it.com.au/dasman/index.php/20070120/3-months-of-news</guid>
		<description><![CDATA[Certain nameless colleagues have been curious as to whether some sort of terrible car accident had severed my fingers, thus preventing me from writing blog entries over the last 3 months, so this post is all about the incredible things I&#8217;ve been getting up to since then on the computer front.
Hmmmm.  Let me think&#8230;.. [...]]]></description>
			<content:encoded><![CDATA[<p>Certain nameless colleagues have been curious as to whether some sort of terrible car accident had severed my fingers, thus preventing me from writing blog entries over the last 3 months, so this post is all about the incredible things I&#8217;ve been getting up to since then on the computer front.</p>
<p>Hmmmm.  Let me think&#8230;.. *scratches head*  There must be <i>something</i>&#8230;.</p>
<ul>
<li>
I&#8217;ve continued to spend far too much time cursing at J2ME.  When it comes to UIs, you either have full, low-level control where you draw every single pixel yourself, or you have almost no control where you populate a Form with Items and wonder what on earth it will look like on the various platforms.  If only there was a happy medium&#8230; <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />   And yet, despite my complaints I can&#8217;t walk away &#8211; the lure of knowing your program can run on potentially <u>so</u> many devices is too much!
</li>
</ul>
<ul>
<li>
I gave NetBeans another shot for my J2ME development with version 5.5, and decided all is forgiven.  It feels way &#8220;snappier&#8221; than version 5, and I haven&#8217;t had it hang on me while using the Visual Designer part of the Mobility Pack (which is the killer feature for me).  Good work guys!
</li>
</ul>
<ul>
<li>
I&#8217;ve upgraded Wordpress around 50 times to cope with all the dot releases that have been coming out.  I&#8217;m actually getting a bit excited about the big 2.1 version due out soon &#8211; I have a sister working overseas who has been a blogger in the past and toys with getting back into it &#8211; perhaps a snazzy new piece of software will be the impetus she needs!
</li>
</ul>
<ul>
<li>
I finally decided to sit down and tick off something thats been on my To Do list for about 6 months now, and upgrade the <a href="http://www.asman-it.com.au/search.html">search page at www.asman-it.com.au</a> to use the new &#8220;inline&#8221; Google search results.  And, like all things you put off for ages, it took around 10 minutes (although admittedly my page won&#8217;t win any prizes for aesthetic or robust web design!).
</li>
</ul>
<p>So, we&#8217;re back up to date.  Perhaps my next post will be a little more on-time! <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.asman-it.com.au/dasman/index.php/20070120/3-months-of-news/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A BBQ Shape&#8230;with the Lot</title>
		<link>http://blogs.asman-it.com.au/dasman/index.php/20060928/a-bbq-shapewith-the-lot</link>
		<comments>http://blogs.asman-it.com.au/dasman/index.php/20060928/a-bbq-shapewith-the-lot#comments</comments>
		<pubDate>Thu, 28 Sep 2006 08:58:19 +0000</pubDate>
		<dc:creator>dasman</dc:creator>
				<category><![CDATA[IT Stuff]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[humour]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.asman-it.com.au/dasman/index.php/20060928/a-bbq-shapewith-the-lot</guid>
		<description><![CDATA[Forgive the indulgence &#8211; this posting can&#8217;t be described as informative or even useful in any way&#8230;.but I couldn&#8217;t resist!
So, as all serious programmers know, you need fuel when your churning out top-quality code.  Salty, calorie-laden fuel!  Some swear by pizza.  Others are into chips.  BBQ Shapes are my programming snack [...]]]></description>
			<content:encoded><![CDATA[<p>Forgive the indulgence &#8211; this posting can&#8217;t be described as informative or even useful in any way&#8230;.but I couldn&#8217;t resist!</p>
<p>So, as all serious programmers know, you need fuel when your churning out top-quality code.  Salty, calorie-laden fuel!  Some swear by pizza.  Others are into chips.  <a href="http://www.arnotts.com.au/varieties/ShapesBBQ.aspx">BBQ Shapes</a> are my programming snack of choice.  I love it when you get one that has a lot of the &#8220;topping&#8221; &#8211; that salty red powder that gives &#8216;em their flavour!</p>
<p>But you can have too much of a good thing.  Tonight, I reached into the box and pulled out a handful of Shapes to find, well&#8230;.this:</p>
<p><img id="image66" src="http://blogs.asman-it.com.au/dasman/wp-content/uploads/2006/09/bbqshapewiththelot.jpg" alt="BBQ Shape with the lot" /></p>
<p>(I promise, the biscuit is not a setup, thats how it came out of the box, and that spice &#8220;stuff&#8221; is packed on there like cement!)</p>
<p>Wow.  Next step is to put it up on EBay, right?  Surely there&#8217;s people who&#8217;d pay good money for that sort of &#8220;flavour explosion&#8221;! <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.asman-it.com.au/dasman/index.php/20060928/a-bbq-shapewith-the-lot/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CELLular &#8211; A J2ME implementation of Conway&#8217;s Game of Life</title>
		<link>http://blogs.asman-it.com.au/dasman/index.php/20060829/cellular-a-j2me-implementation-of-conways-game-of-life</link>
		<comments>http://blogs.asman-it.com.au/dasman/index.php/20060829/cellular-a-j2me-implementation-of-conways-game-of-life#comments</comments>
		<pubDate>Tue, 29 Aug 2006 08:19:46 +0000</pubDate>
		<dc:creator>dasman</dc:creator>
				<category><![CDATA[IT Stuff]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[j2me]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.asman-it.com.au/dasman/index.php/20060829/cellular-a-j2me-implementation-of-conways-game-of-life</guid>
		<description><![CDATA[I&#8217;ve been looking for a simple way to play around with the GameCanvas &#8211; the double-buffered general purpose canvas that comes in MIDP 2.0.  And being a geek^H^H^H^H person interested in esoteric things, an implementation of Conway&#8217;s Game of Life seemed like a good project.  
In case you&#8217;re too lazy to click on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking for a simple way to play around with the GameCanvas &#8211; the double-buffered general purpose canvas that comes in MIDP 2.0.  And being a geek^H^H^H^H person interested in esoteric things, an implementation of <a href="http://en.wikipedia.org/wiki/Conways_Life">Conway&#8217;s Game of Life</a> seemed like a good project.  </p>
<p>In case you&#8217;re too lazy to click on the above link to the Wikipedia page, this is an example of Cellular Automata &#8211; a grid of &#8220;cells&#8221; that live and die according to simple rules.  And interestingly, from very simple rules all kinds of ordered and complex behaviour emerges.  Short summary?  Its like a kind of fishtank for geeks!</p>
<p>CELLular (neat name, huh!  You get it, right?  CELLULAR automata.  CELL phone.  Huh?  Huh? <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) allows you to generate random grids, or to draw your own patterns, then set them in motion.  And, as an added bonus, it does a nifty fade-in/fade-out effect as cells are born and die! <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Here&#8217;s a picture of it &#8220;in action&#8221;:</p>
<p><img id="image63" src="http://blogs.asman-it.com.au/dasman/wp-content/uploads/2006/08/in_progress.png" alt="CELLular in Action" /></p>
<p>You can <a href="http://www.asman-it.com.au/CELLular/">download CELLular here</a>, and it should hopefully run on most MIDP2.0 devices.  Enjoy!</p>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.asman-it.com.au/dasman/index.php/20060829/cellular-a-j2me-implementation-of-conways-game-of-life/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Sudoku Solver in 6 lines</title>
		<link>http://blogs.asman-it.com.au/dasman/index.php/20060724/java-sudoku-solver-in-6-lines</link>
		<comments>http://blogs.asman-it.com.au/dasman/index.php/20060724/java-sudoku-solver-in-6-lines#comments</comments>
		<pubDate>Mon, 24 Jul 2006 11:34:32 +0000</pubDate>
		<dc:creator>dasman</dc:creator>
				<category><![CDATA[IT Stuff]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.asman-it.com.au/dasman/index.php/20060724/java-sudoku-solver-in-6-lines</guid>
		<description><![CDATA[After playing around with writing Sudoku Solvers in the past, I was interested to see this page which details a number of tiny sudoku solvers in a variety of languages such as Perl, Ruby, etc.
They have a few basic rules &#8211; no line over 80 bytes, etc, etc.  And the examples take their input [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://www.asman-it.com.au/products/sudokulet/index.html">playing around</a> with writing Sudoku Solvers in the past, I was interested to see <a href="http://markbyers.com/moinmoin/moin.cgi/ShortestSudokuSolver">this page</a> which details a number of tiny sudoku solvers in a variety of languages such as Perl, Ruby, etc.</p>
<p>They have a few basic rules &#8211; no line over 80 bytes, etc, etc.  And the examples take their input as a string of 81 digits, which represents the 9 rows of 9 digits, with &#8220;0&#8243; being a blank square.</p>
<p>As I apparently have way too much time on my hands <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> , I got up the motivation to convert one of these examples into Java.  The results?</p>
<ul>
<li>The end program is around twice as many lines as the Perl original, and</li>
<li>Yup &#8211; you can make Java programs as unreadable as anything else out there! <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
</ul>
<p>There may well be shorter possibilities out there &#8211; I didn&#8217;t put in a great deal of effort past converting the Perl original.  But, for the record:</p>
<pre>
import java.util.*;public class S{static char[] A;static void R(){int i,j;for(i=
0;i&lt;81;i++){if(A[i]!='0')continue;HashMap h=new HashMap();for(j=0;j&lt;81;j++){h.
put(j/9==i/9||j%9==i%9||(j/27==i/27)&#038;&#038;((j%9/3)==(i%9/3))?""+A[j]:"0","1");}for(j
=1;j&lt;=9;j++){if(h.get(""+j)==null){A[i]=(char)('0'+j);R();}}A[i]='0';return;}for
(i=0;i&lt;81;i++){System.out.print(A[i]);}System.out.println();System.exit(0);}
public static void main(String[] a){A=a[0].toCharArray();R();}}
</pre>
<p>Assuming you have an appropriate classpath, you can run it with a line like:</p>
<pre>
java S 006070800000000000078601520030405010400000002090302060052103690000000000003020100
</pre>
<p>This code was converted from the excellent Perl example at:</p>
<p><a href="http://www.ecclestoad.co.uk/blog/2005/06/02/sudoku_solver_in_three_lines_explained.html">http://www.ecclestoad.co.uk/blog/2005/06/02/sudoku_solver_in_three_lines_explained.html</a></p>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.asman-it.com.au/dasman/index.php/20060724/java-sudoku-solver-in-6-lines/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Javadoc-driven development</title>
		<link>http://blogs.asman-it.com.au/dasman/index.php/20060317/javadoc-driven-development</link>
		<comments>http://blogs.asman-it.com.au/dasman/index.php/20060317/javadoc-driven-development#comments</comments>
		<pubDate>Fri, 17 Mar 2006 09:21:38 +0000</pubDate>
		<dc:creator>dasman</dc:creator>
				<category><![CDATA[IT Stuff]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.asman-it.com.au/dasman/index.php/20060317/javadoc-driven-development</guid>
		<description><![CDATA[Its the new development methodology thats taking the developer-world by storm&#8230;.  
Well, not really.
Just a cute phrase that occurred to me today when chatting to a colleague.  We&#8217;d just spent 15 minutes discussing the desired behaviour of a system I was working on.  Usual stuff &#8211; at first blush it seems straightforward, [...]]]></description>
			<content:encoded><![CDATA[<p>Its the new development methodology thats taking the developer-world by storm&#8230;. <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Well, not really.</p>
<p>Just a cute phrase that occurred to me today when chatting to a colleague.  We&#8217;d just spent 15 minutes discussing the desired behaviour of a system I was working on.  Usual stuff &#8211; at first blush it seems straightforward, but plenty of edge cases, historical behaviour requirements, and other nastiness.</p>
<p>So we got it figured out, and its 11:45.  Lunch booked at 12:00.  No <u>way</u> am I even getting 10% of the code done in that time.  But its just enough time to do the Javadoc.</p>
<p>So, 15 minutes later, my code has the 2 method signatures I need and around 40 lines of Javadoc describing the code&#8217;s behaviour, exceptions, and assertions.  And after lunch, I was able to get straight into coding, all details of my discussion safely preserved.</p>
<p>And as an added bonus, when it comes time to rework it, I (or the next guy) will have some great doco to get started.</p>
<p>Not rocket science.  Certainly not worthy of its own buzzword-esque title (although it does roll off the tongue <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ).  And probably something everybody should be doing anyway as part of their actual methodology.  But its a neat little anecdote worth telling!</p>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.asman-it.com.au/dasman/index.php/20060317/javadoc-driven-development/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How did I miss this? java.util.Collections</title>
		<link>http://blogs.asman-it.com.au/dasman/index.php/20060313/how-did-i-miss-this-javautilcollections</link>
		<comments>http://blogs.asman-it.com.au/dasman/index.php/20060313/how-did-i-miss-this-javautilcollections#comments</comments>
		<pubDate>Mon, 13 Mar 2006 10:16:58 +0000</pubDate>
		<dc:creator>dasman</dc:creator>
				<category><![CDATA[IT Stuff]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.asman-it.com.au/dasman/index.php/20060313/how-did-i-miss-this-javautilcollections</guid>
		<description><![CDATA[Well, they say you learn something new everyday.  And given the size of the Java API, thats not too hard to believe  
After doing serious Java programming for at a least a few years, and having dabbled for a few years more (all the way back to the 1.0 days!), I&#8217;m pretty happy [...]]]></description>
			<content:encoded><![CDATA[<p>Well, they say you learn something new everyday.  And given the size of the Java API, thats not too hard to believe <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>After doing serious Java programming for at a least a few years, and having dabbled for a few years more (all the way back to the 1.0 days!), I&#8217;m pretty happy with my breadth of Java knowledge.  Until a co-worker today mentioned using Collections.shuffle() to randomize a list.</p>
<p>&#8220;Pffffft&#8221;, says I,  &#8220;Surely you jest&#8221;, says I.  &#8220;No such thing.&#8221;</p>
<p>Well, there is.  java.util.Collections (not <strong>Collection</strong>, note &#8211; theres an &#8220;s&#8221; on the end!).  A nice, chunky class, full of juicy, static methods just <em>waiting</em> to save you from having to re-invent the wheel when it comes to operating on Collections.  There&#8217;s the obvious stuff &#8211; shuffle() and sort() to randomize and sort, for instance.  And small, but useful stuff &#8211; min() and max(), swap().  And some real useful stuff, like synchronizedList() (which returns a thread safe version of your list).  </p>
<p>Many&#8217;s the time I&#8217;ve done my own &#8220;max()&#8221; routine.  Each time, I trawled through the Collection interface looking for one and was mildly surprised it didn&#8217;t exist.  And I never thought to look any further afield.  I&#8217;m guessing that there may be one or two Java guys out there who are in the same boat (How many library classes are there now in Java?).  Seeing as my co-worker doesn&#8217;t have his own blog&#8230;yet (come on H!  Get your act together! <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ), I&#8217;m doing this posting for the other people like me!</p>
<p>Of course, I&#8217;ve always got the excuse for my ignorance that its a relatively recent addition.  I mean, its only been around since Java 1.2&#8230;.. *grin*</p>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.asman-it.com.au/dasman/index.php/20060313/how-did-i-miss-this-javautilcollections/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Java coders have it easy &#8211; crashing constructors</title>
		<link>http://blogs.asman-it.com.au/dasman/index.php/20060210/java-coders-have-it-easy-crashing-constructors</link>
		<comments>http://blogs.asman-it.com.au/dasman/index.php/20060210/java-coders-have-it-easy-crashing-constructors#comments</comments>
		<pubDate>Thu, 09 Feb 2006 20:29:06 +0000</pubDate>
		<dc:creator>dasman</dc:creator>
				<category><![CDATA[IT Stuff]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blogs.asman-it.com.au/dasman/index.php/20060210/java-coders-have-it-easy-crashing-constructors</guid>
		<description><![CDATA[I came across this entry while scanning Java Blogs yesterday about how to handle exceptions within a constructor.  The essence of the article is how do you handle the situation where you couldn&#8217;t instantiate your object?  
So, if the user passes invalid parameters, do you throw an exception?  And, slightly more subtly, [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this entry while scanning Java Blogs yesterday about how to handle <a href="http://www.javaspecialists.co.za/archive/newsletter.do?issue=120">exceptions within a constructor</a>.  The essence of the article is how do you handle the situation where you couldn&#8217;t instantiate your object?  </p>
<p>So, if the user passes invalid parameters, do you throw an exception?  And, slightly more subtly, if your constructor <em>encounters</em> an exception during object setup, how does it handle this?</p>
<p>Interesting article and well worth the read.</p>
<p>But it struck a bit of a chord with me &#8211; I recently bought a Nokia N70 phone, and have been cruising the net looking at how you can code for these things.  The N70 is a <a href="http://www.symbian.com">Symbian</a> phone, and while it has J2ME support, the hardcore stuff seems to be done in C++.  Now, C++ is an &#8230; interesting language, but is not really known for its in-built protection against memory leaks, and when you&#8217;re running a program on a device with limited memory, where your app may well run for the order of days or months this suddenly becomes a big deal.</p>
<p>OK, so you just code, really, really carefully. <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Well, turns out that constructors are a special case in terms of memory leaks.  Symbian doesn&#8217;t use standard C++ exceptions, but it does have an analagous concept called &#8220;leaving&#8221; grafted on.  And not being a C++ guru, I couldn&#8217;t tell you what difference there is between normal C++ exceptions and the Symbian variety.  In any case, the issue when writing Symbian programs appears to be this:</p>
<ol>
<li>Constructor called</li>
<li>Constructor initialises an instance variable that points to some new object</li>
<li>On the next line, the constructor encounters an error and leaves</li>
</ol>
<p>So, we now have allocated memory for some new object (step 2 above), but the object that owns it no longer exists &#8211; it crashed during construction.  And because the object never fully formed, the destructor wasn&#8217;t run on it and so couldn&#8217;t free up the memory.  Ladies and gentlemen, we have memory leak&#8230;. <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Turns out that Symbian programs have an accepted idiom on how to handle this stuff.  Objects that can suffer this way have a static construction method (like the whole getInstance() idiom you see in Java).  This static constructor creates the object using a constructor that only performs trivial operations that won&#8217;t crash, then once the object exists, calls an instance method on the new object that performs 2nd-phase construction.  If things turn to jelly, there is at least a concrete object in existence, so the destructor will be called as normal.</p>
<p>Pretty neat.  And pretty eye-opening as to the kind of issues you can be exposed to without garbage collection.</p>
<p>(Which is not to say that Java doesn&#8217;t have its own issues with memory leaks, but thats a whole other blog post&#8230; <img src='http://blogs.asman-it.com.au/dasman/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.asman-it.com.au/dasman/index.php/20060210/java-coders-have-it-easy-crashing-constructors/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
