<?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>halfdecent.net</title>
	<atom:link href="http://halfdecent.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://halfdecent.net</link>
	<description>some personal argumentation</description>
	<lastBuildDate>Fri, 13 Apr 2012 13:06:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Netbeans file type integration tutorial comments</title>
		<link>http://halfdecent.net/2011/11/30/netbeans-file-type-integration-tutorial-comments/</link>
		<comments>http://halfdecent.net/2011/11/30/netbeans-file-type-integration-tutorial-comments/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 15:43:58 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://halfdecent.net/?p=228</guid>
		<description><![CDATA[Netbeans 7.1rc1 has been released. When I went through the file type tutorial (which has been updated for 7.1) I found a couple of minor niggles which needed more than a couple of lines in a comment to express, hence &#8230; <a href="http://halfdecent.net/2011/11/30/netbeans-file-type-integration-tutorial-comments/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" src="http://platform.netbeans.org/images/articles/71/netbeans-stamp.png" alt="" width="112" height="115" />Netbeans 7.1rc1 has been released. When I went through the <a href="http://platform.netbeans.org/tutorials/nbm-filetype.html">file type tutorial</a> (which has been updated for 7.1) I found a couple of minor niggles which needed more than a couple of lines in a comment to express, hence this post.  In Summary, it&#8217;s a good tutorial, but there a few rough edges that could be ironed out:</p>
<ul>
<li>A design bug in the properties window section,</li>
<li>Missing the visual library api dependency,</li>
<li>Excessive overiding the default action on file context menu,</li>
</ul>
<p>and it would really benefit from some extensions, particularly:</p>
<ul>
<li>implementing a navigation window instead of a node tree under the file node,</li>
<li>real-time synchronisation across all views.</li>
</ul>
<p><span id="more-228"></span></p>
<p>Everything up until the &#8220;Creating features for Abc files&#8221; stage in the tutorial worked smoothly for me.  This section also works if you follow the instructions carefully (pay attention though folks, I forget to set the content type in the wizard when I did it). There are some misleading statements though, probably left over from earlier versions.  In the first paragraph the introduction says &#8220;we enable the file to open into a window, instead of into an editor&#8221; but this is not what the action does &#8211; it simply raises a modal dialogue window.  The next paragraph, &#8220;Adding a context-sensitive Action&#8221; then says that the wizard will register the newly generated class in the layer file, however in this version of Netbeans this no longer happens.  Another niggle I have is with the action that&#8217;s created. The tutorial suggests we make our action the default action, the action that&#8217;s used for a double-click.  This is annoying to me as the double-click action should be &#8220;open file in editor&#8221; so in my version of this I choose a different location in step 3.</p>
<p>&#8220;Creating additional Multiview windows&#8221; works just fine.  &#8220;Parsing the file&#8221; also works but it&#8217;s not an elegant solution.  Nodes are created when the file is first opened but then if the file is changed in the editor,  those nodes are not updated. Another niggle I have with this section is that I think it would be better if we saw the tree in a navigation window but I&#8217;m not sure how much code this involves.</p>
<p>The &#8220;Extending the Properties window&#8221; section has a design error in it.  The code provided attempts to preserve the existing file properties but fails because the new default properties set has the same default name.  I would suggest the following variation in the AbcNode class:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> SHEET_ABC_PROPERTIES <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;abc properties&quot;</span><span style="color: #339933;">;</span>
&nbsp;
@Override
<span style="color: #000000; font-weight: bold;">protected</span> Sheet createSheet<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  Sheet sheet <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">createSheet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  sheet.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>Sheet.<span style="color: #006633;">PROPERTIES</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setDisplayName</span><span style="color: #009900;">&#40;</span>NbBundle.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span>AbcNode.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #0000ff;">&quot;LBL_Abc_PROPERTIES_File&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Sheet.<span style="color: #003399;">Set</span> set <span style="color: #339933;">=</span> Sheet.<span style="color: #006633;">createPropertiesSet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  set.<span style="color: #006633;">setName</span><span style="color: #009900;">&#40;</span>SHEET_ABC_PROPERTIES<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// default is Sheet.PROPERTIES</span>
  set.<span style="color: #006633;">setDisplayName</span><span style="color: #009900;">&#40;</span>NbBundle.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span>AbcNode.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #0000ff;">&quot;LBL_Abc_PROPERTIES_Abc&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  sheet.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>set<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  set.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> LineCountProperty<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">return</span> sheet<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>with the addition of two new strings in the Bundle file:</p>
<pre>LBL_Abc_PROPERTIES_File=File Properties
LBL_Abc_PROPERTIES_Abc=Abc Properties</pre>
<p>The Final &#8220;Creating Synchronised views&#8221; misses the vital information that you need to add the &#8220;Visual Library API&#8221; library in order to compile, but this wasn&#8217;t too hard to work out.  It works fine but the two views are only synchronised when the file is saved and this isn&#8217;t what&#8217;s described in the text. This lack of real-time synchronisation is further exacerbated by the lack of any synchronisation with the node tree in the project explorer.</p>
<p>To conclude, aside from fixing the niggles I would really like to see a navigation window implementation and better synchronisation between the views, however I found the tutorial as it stands very useful.  And of course it could be that the amount of code needed for my suggestions exceeds the word limit for one of these tutorials.</p>
]]></content:encoded>
			<wfw:commentRss>http://halfdecent.net/2011/11/30/netbeans-file-type-integration-tutorial-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First project on github</title>
		<link>http://halfdecent.net/2011/08/30/first-project-on-github/</link>
		<comments>http://halfdecent.net/2011/08/30/first-project-on-github/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 15:12:30 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[medicine]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://halfdecent.net/?p=206</guid>
		<description><![CDATA[Earlier this year I wrote a quick API for snomed ct which I finally got around to cleaning up and publishing today. Yay &#8211; my first github project!]]></description>
			<content:encoded><![CDATA[<p><a href="http://halfdecent.net/wp-content/uploads/2011/08/GitHub_Logo.png"><img class="alignleft  wp-image-282" title="GitHub_Logo" src="http://halfdecent.net/wp-content/uploads/2011/08/GitHub_Logo-300x132.png" alt="" width="216" height="95" /></a>Earlier this year I wrote a quick API for snomed ct which I finally got around to cleaning up and <a href="https://github.com/mattsouth/snomedapi">publishing</a> today. Yay &#8211; my first github project!</p>
]]></content:encoded>
			<wfw:commentRss>http://halfdecent.net/2011/08/30/first-project-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Locating images within jars with Bash</title>
		<link>http://halfdecent.net/2011/07/13/locating-images-within-jars/</link>
		<comments>http://halfdecent.net/2011/07/13/locating-images-within-jars/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 15:27:21 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://halfdecent.net/?p=201</guid>
		<description><![CDATA[I&#8217;ve been working with Netbeans in the last couple of days, and this post is an aide-memoir for one of the more onerous tasks I came across.  I wanted to re-use netbeans icons, but they were difficult to locate.   As &#8230; <a href="http://halfdecent.net/2011/07/13/locating-images-within-jars/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with Netbeans in the last couple of days, and this post is an aide-memoir for one of the more onerous tasks I came across.  I wanted to re-use netbeans icons, but they were difficult to locate.   As usual <a href="http://stackoverflow.com/questions/1500141/find-a-jar-file-given-the-class-name">stackoverflow had some useful information</a> and what worked for me was <span id="more-201"></span>the following bash command:<br />
<code>me@laptop:~/Applications/netbeans-6.9$ find . -name '*.jar' -type f | xargs -i bash -c "jar -tvf {}| tr / . | grep "saveAs.png" &amp;&amp; echo {}"<br />
847 Thu Jun 10 15:50:16 BST 2010 org.netbeans.modules.profiler.actions.resources.saveAs.png<br />
847 Thu Jun 10 15:50:16 BST 2010 org.netbeans.modules.profiler.resources.saveAs.png<br />
./profiler/modules/org-netbeans-modules-profiler.jar<br />
847 Thu Jun 10 15:50:16 BST 2010 org.netbeans.modules.profiler.docs.helppages.img.saveAs.png<br />
./profiler/modules/docs/org-netbeans-modules-profiler.jar</code><br />
Which you can use to locate all .png images by replacing the &#8220;saveAs.png&#8221; as simply &#8220;.png&#8221;.   The same idea can be used for locating the module of a particular class, e.g.:<br />
<code>me@laptop:~/Applications/netbeans-6.9$ find . -name '*.jar' -type f | xargs -i bash -c "jar -tvf {}| tr / . | grep "SaveCookie" &amp;&amp; echo {}"<br />
1550 Thu Jun 10 15:36:04 BST 2010 org.netbeans.modules.versioning.diff.EditorSaveCookie.class<br />
./ide/modules/org-netbeans-modules-versioning-util.jar<br />
7462 Thu Jun 10 15:34:38 BST 2010 org.netbeans.modules.settings.SaveSupport$SaveCookieImpl.class<br />
./platform/modules/org-netbeans-modules-settings.jar<br />
295 Thu Jun 10 15:34:04 BST 2010 org.openide.cookies.SaveCookie.class<br />
./platform/modules/org-openide-nodes.jar</code><br />
From which it can be seen that the save cookie class is in the Nodes module.</p>
]]></content:encoded>
			<wfw:commentRss>http://halfdecent.net/2011/07/13/locating-images-within-jars/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sinatra + Microsoft SQL server ??</title>
		<link>http://halfdecent.net/2010/09/21/sinatra-microsoft-sql-server/</link>
		<comments>http://halfdecent.net/2010/09/21/sinatra-microsoft-sql-server/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 12:45:24 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://halfdecent.net/?p=192</guid>
		<description><![CDATA[After writing the last post I realised that I&#8217;d jumped too far into the deep end with Padrino and really needed to understand the underlying Sinatra and Rack frameworks better before commenting any further.I found the opportunity today for doing &#8230; <a href="http://halfdecent.net/2010/09/21/sinatra-microsoft-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After writing the last post I realised that I&#8217;d jumped too far into the deep end with Padrino and really needed to understand the underlying <a href="http://sinatrarb.com">Sinatra</a> and <a href="http://rack.rubyforge.org/">Rack</a> frameworks better before commenting any further.<span id="more-192"></span>I found the opportunity today for doing just that.   I needed to make a demo web application that listed items from a Microsoft SQL Server and demonstrate integration with a third party service.   I had started using MS Visual Web Developer for this task but found it horribly slow to use and difficult to move beyond the boiler plate applications because the c# framework learning curve was as little too steep for a quick and dirty demo.</p>
<p>After spending a couple of days on this, I thought I&#8217;d look for an alternative and wondered if sinatra might be useful.  Instinct told me that connecting to the db might be an enormous time sink, but these two articles suggested otherwise:</p>
<ul>
<li><a href="http://techwhizbang.com/2010/03/jruby-activerecord-jdbc-sqlserver/">http://techwhizbang.com/2010/03/jruby-activerecord-jdbc-sqlserver/</a></li>
<li><a href="http://stackoverflow.com/questions/2853788/how-to-connect-to-sql-server-using-activerecord-jdbc-jtds-and-integrated-securi">http://stackoverflow.com/questions/2853788/how-to-connect-to-sql-server-using-activerecord-jdbc-jtds-and-integrated-securi</a></li>
</ul>
<p>and indeed it turned out to be just the case.  With <a href="http://jruby.org/">JRuby</a>, Sinatra and<a href="http://jtds.sourceforge.net/"> jTDS</a> I was able to get my little app up and running on Windows within a day.</p>
]]></content:encoded>
			<wfw:commentRss>http://halfdecent.net/2010/09/21/sinatra-microsoft-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Padrino on Ubuntu / Debian</title>
		<link>http://halfdecent.net/2010/08/20/installing-padrino-on-ubuntu-debian/</link>
		<comments>http://halfdecent.net/2010/08/20/installing-padrino-on-ubuntu-debian/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 21:39:31 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://halfdecent.net/?p=175</guid>
		<description><![CDATA[I&#8217;ve been tinkering with Padrino this week. Padrino is a ruby web framework built on top of the delightful sinatra microframework. I found it attractive because it appears to have a simple design, as you&#8217;d expect of something built on &#8230; <a href="http://halfdecent.net/2010/08/20/installing-padrino-on-ubuntu-debian/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="Padrino logo" src="http://www.padrinorb.com/images/padrino.jpg" alt="" width="256" height="100" /></p>
<p>I&#8217;ve been tinkering with <a href="http://www.padrinorb.com">Padrino</a> this week. Padrino is a ruby web framework built on top of the delightful <a href="http://www.sinatrarb.com">sinatra microframework</a>. I found it attractive because</p>
<ul>
<li>it appears to have a simple design, as you&#8217;d expect of something built on top of sinatra,</li>
<li>it rolls in the various elements that you&#8217;d expect for a fully fledged web framework (i.e. orm, database, mailer) but makes no commitments to the particular modules used for each *</li>
<li>it had a default Admin interface (which is a huge win for Django IMO).</li>
</ul>
<p>There&#8217;s quite a bit of supporting material on the web, but my impression after a few hours is that it&#8217;s still pretty beta and has a strong leaning towards RHEL linux. So this post details the steps I had to take to be able to work through the <a href="http://www.padrinorb.com/guides/basic-projects">basic project guide</a> with Ubuntu Lucid Lynx.<span id="more-175"></span></p>
<p>For starters I couldnt use Ubuntu&#8217;s default version of rubygems, so I uninstalled it and installed the latest. This allowed me to apparently install the framework but there were still several hidden dependencies to uncover before I could walk through the guide.</p>
<p>I was able to generate a project but found lots of errors pointing to missing gems when I tried to create the in-built admin application. I found I had to install: rake, haml, rack-flash, thin, activerecord, sqlite3-ruby and datamapper gems and for sqlite3-ruby I needed libsqlite3-ruby and libsqlite3-dev via apt-get.</p>
<p>With these installed, when I attempted to create an admin app I wasnt getting errors, but it wasnt working:</p>
<p>me@laptop:~/padrino/first_go$ padrino g admin<br />
=&gt; Located unlocked Gemfile for development<br />
Please specify generator to use (project, app, mailer, controller, model, migration)</p>
<p>Fortunately, <a href="http://groups.google.com/group/padrino/browse_thread/thread/74734c44c8a421b6">someone else had got there first.</a> Installing libssl-dev and libopenssl-ruby through apt-get allowed me to generate an admin app.  It&#8217;s cute and I&#8217;m able to do everything I&#8217;ve tried so far.  I&#8217;m still getting &#8220;=&gt; Located unlocked Gemfile for development&#8221; messages when I interact with padrino which suggests something is up, but I haven&#8217;t worked out what it is yet or whether it&#8217;s something I need to worry about.</p>
<p>* it remains to see if this approach is successful. It could be that maintaining agnosticism towards the various modules means that the API becomes too hard to use, but it&#8217;s certainly interesting to watch them give this a go.</p>
]]></content:encoded>
			<wfw:commentRss>http://halfdecent.net/2010/08/20/installing-padrino-on-ubuntu-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Potentially useful mysql bash scripts</title>
		<link>http://halfdecent.net/2010/08/02/useful-mysql-bash-scripts/</link>
		<comments>http://halfdecent.net/2010/08/02/useful-mysql-bash-scripts/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 11:20:19 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://halfdecent.net/?p=164</guid>
		<description><![CDATA[Occasionally I put an admin hat on.  These are a couple of useful scripts for your development / demo servers. A script for backing up all your MySQL databases to file Updating dates in a demo database refresh restore A &#8230; <a href="http://halfdecent.net/2010/08/02/useful-mysql-bash-scripts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Occasionally I put an admin hat on.  These are a couple of useful scripts for your development / demo servers.</p>
<ul>
<li><a href="http://halfdecent.net/2010/08/02/useful-mysql-bash-scripts/#backup">A script for backing up all your MySQL databases to file</a></li>
<li><a href="http://halfdecent.net/2010/08/02/useful-mysql-bash-scripts/#daterefresh">Updating dates in a demo database refresh restore</a></li>
</ul>
<p><span id="more-164"></span></p>
<h2><a name="backup"></a>A script for backing up your databases to file</h2>
<p>In my experience it&#8217;s remarkably difficult to restore MySQL databases from the raw database files.  On the other hand, it&#8217;s very easy to restore databases from a dump script.  This bash script creates dump scripts for all your non-system mysql databases in a directory that can then be backed up every night.  [sarcasm] It&#8217;s probably not appropriate for production servers.</p>
<pre>#!/bin/sh
#A bash script that backs up each database into a sepearate file, database_name.sql

for i in `echo "show databases" | mysql -u backup -pbackuppassword`;
do
  if [ ! "$i" = "Database" ] &amp;&amp; [ ! "$i" = "mysql" ] &amp;&amp; [ ! "$i" = "information_schema" ]
  then
    mysqldump -u backup -pbackuppassword $i &gt; /backup/mysql/$i.sql
  fi
done
</pre>
<p>Note that the success of this approach depends on you having a <em>backup</em> mysql user set up with the appropriate permissions for all databases.</p>
<h2><a name="daterefresh"></a>Nightly restores of a demo database with updated dates</h2>
<p>In one of our demos, we back our application with some demo entries and allow interested folk to play with those entries and create new ones.  In order to maintain a sense of order in the demo database, it gets refreshed every night.  Bash&#8217;s date manipulations can be useful here.  Having restored the database, i.e.:</p>
<pre># step 1. clear database and add example patients
mysql -u mydbuser -pmydbuserpassword mydb &lt; mydb.sql</pre>
<p>We can tweak the dates to make the data seem fresh&#8230;</p>
<pre># step 2. update dates
mysql -u mydbuser -pmydbpassword mydb -e "update mytable set last_seen = '`date --date='1 day ago' '+%y-%m-%d %H:%M:%S'`'"</pre>
<p>Note how the date program allows you to use natural language modifers like &#8220;2 weeks ago&#8221; to define your date.</p>
]]></content:encoded>
			<wfw:commentRss>http://halfdecent.net/2010/08/02/useful-mysql-bash-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Latex on Karmic Koala</title>
		<link>http://halfdecent.net/2010/02/01/latex-on-karmic-koala/</link>
		<comments>http://halfdecent.net/2010/02/01/latex-on-karmic-koala/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 12:10:27 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[research]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://halfdecent.net/?p=134</guid>
		<description><![CDATA[I needed latex this morning. My quick tip for installing it on Ubuntu Karmic Koala is to install Texmaker via the &#8220;Ubuntu Software Centre&#8221; (which you should be able to find at the bottom of the Applications menu) and then &#8230; <a href="http://halfdecent.net/2010/02/01/latex-on-karmic-koala/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.xm1math.net/texmaker/"><img class="size-medium wp-image-135 alignnone" title="texmakersplash" src="http://halfdecent.net/wp-content/uploads/2010/02/texmakersplash-300x138.png" alt="" width="300" height="138" /></a></p>
<p>I needed latex this morning.  My quick tip for installing it on Ubuntu Karmic Koala is to install Texmaker via the &#8220;Ubuntu Software Centre&#8221; (which you should be able to find at the bottom of the Applications menu) and then install the</p>
<ul>
<li> texlive-fonts-recommended</li>
<li> texlive-fonts-extra</li>
</ul>
<p>packages on the command line with aptitude.  This sorted me out very quickly, and the interface for the new texmaker version in karmic seems excellent &#8211; attractive and intuitive.</p>
]]></content:encoded>
			<wfw:commentRss>http://halfdecent.net/2010/02/01/latex-on-karmic-koala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse + Ubuntu + Groovy pain</title>
		<link>http://halfdecent.net/2010/01/19/eclipse-ubuntu-groovy-pain/</link>
		<comments>http://halfdecent.net/2010/01/19/eclipse-ubuntu-groovy-pain/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 15:17:06 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[eclipse ubuntu]]></category>

		<guid isPermaLink="false">http://halfdecent.net/?p=110</guid>
		<description><![CDATA[A couple of days ago the v2 Groovy Eclipse plugin was released, but sadly I&#8217;m still not able to use it on my Ubuntu desktop because of a fairly convoluted set of configuration problems. The first is that the linux &#8230; <a href="http://halfdecent.net/2010/01/19/eclipse-ubuntu-groovy-pain/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago the <a href="http://docs.codehaus.org/display/GROOVY/Groovy-Eclipse+2.0.0+New+and+Noteworthy">v2 Groovy Eclipse plugin was released</a>, but sadly I&#8217;m still not able to use it on my Ubuntu desktop because of a fairly convoluted set of configuration problems.</p>
<p>The first is that the linux download of eclipse doesnt work very well in the latest version of Ubuntu (Karmic Koala).  A <a href="http://mou.me.uk/2009/10/31/fixing-eclipse-in-ubuntu-9-10-karmic-koala/">work around is described here</a> with further links to Ubuntu&#8217;s issuelist. But actually the work around is only a partial fix because Eclipse sometimes starts a copy of itself and, when it does, it ignores the work around. This affects me as I&#8217;m currently trying to develop plugins.</p>
<p>One alternative approach that has worked for me so far is to use the version of eclipse that&#8217;s in the Ubuntu repositories.  However, this version wasn&#8217;t taken from the final release of the eclipse codebase and the groovy plugin install, which patches the JDT (Java Development Toolkit) <a href="http://jira.codehaus.org/browse/GRECLIPSE-498">just wont install in this version</a>.</p>
<p>So to use the groovy plugin it looks as though I&#8217;ll have to wait for Eclipse 3.5.2 (which is <a href="http://wiki.eclipse.org/Galileo_Simultaneous_Release#SR2">due on February 29th</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://halfdecent.net/2010/01/19/eclipse-ubuntu-groovy-pain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tectonic shifts</title>
		<link>http://halfdecent.net/2010/01/07/tectonic-shifts/</link>
		<comments>http://halfdecent.net/2010/01/07/tectonic-shifts/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 15:01:44 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://halfdecent.net/?p=107</guid>
		<description><![CDATA[I&#8217;m absolutely gobsmacked by the list of datasets that the City of London has declared it will publish today. This is a huge democratising step that I am very impressed by. I dont know the back story &#8211; in my &#8230; <a href="http://halfdecent.net/2010/01/07/tectonic-shifts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m absolutely gobsmacked by the<a href="http://data.london.gov.uk/datastore/data-packages-launch"> list of datasets</a> that the City of London has <a href="http://www.london.gov.uk/view_press_release.jsp?releaseid=24640">declared it will publish today</a>. This is a huge democratising step that I am very impressed by. I dont know the back story &#8211; in my experience this sort of thing takes years to happen &#8211; but I&#8217;m sure the City of London will be immediately rewarded with innovative visualisations of their data because there are lots of motivated and very capable people in that city. Exciting stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://halfdecent.net/2010/01/07/tectonic-shifts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scripting languages in Java &#8211; manipulating an EMF model</title>
		<link>http://halfdecent.net/2009/12/04/scripting-languages-in-java-manipulating-an-emf-model/</link>
		<comments>http://halfdecent.net/2009/12/04/scripting-languages-in-java-manipulating-an-emf-model/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 14:53:02 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://halfdecent.net/?p=72</guid>
		<description><![CDATA[I&#8217;m currently attempting to embed a scripting engine into a Java application. The Java Scripting API means this exercise should be quite straightforward (at least to get something up and running) and there is a huge choice of script languages &#8230; <a href="http://halfdecent.net/2009/12/04/scripting-languages-in-java-manipulating-an-emf-model/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="Groovy logo" src="http://media.xircles.codehaus.org/_projects/groovy/_logos/medium.png" alt="" width="203" height="100" />I&#8217;m currently attempting to embed a scripting engine into a Java application. The <a href="http://java.sun.com/javase/6/docs/technotes/guides/scripting/index.html">Java Scripting API</a> means this exercise should be quite straightforward (at least to get something up and running) and there is a huge choice of script languages to choose from so one of them ought to match my requirements, right?</p>
<p>I&#8217;m taking baby steps while I explore the space of possible options.  So far I&#8217;ve prototyped an expression evaluator that accepts data in the form of simple Java  framework objects and allows boolean expressions to be evaluated over them. In today&#8217;s baby step I thought I&#8217;d try and manipulate some non-framework Java objects built with an <a href="http://www.eclipse.org/modeling/emf/">EMF</a> model that I&#8217;m currently working on and two different scripting languages, <a href="http://groovy.codehaus.org/">Groovy</a> and <a href="http://www.mozilla.org/rhino/">Rhino</a>. Groovy is a scripting language that has grown out of the Java community in response to Python and Ruby.  Rhino is a Javascript engine implemented in Java from the Mozilla foundation that is bundled as the default scripting engine in the Java6 JDK.  I got somewhere with Groovy but got completely stumped with Rhino because I just couldn&#8217;t load my custom classes.</p>
<p><span id="more-72"></span></p>
<h2>Groovy</h2>
<p>First the success story.  I fired up the groovy shell (groovysh) in the directory that contains my classes and got started straight away:</p>
<p><code><span style="color:green">Groovy Shell</span> (, JVM: 1.6.0_15)<br />
Type 'help' or '\h' for help.<br />
-------------------------------------<br />
<strong>groovy:</strong>000&gt; dec = new argkit.decision.impl.DecisionImpl()<br />
<span style="color:red">ERROR</span> java.lang.NoClassDefFoundError: <span style="color:red">org/eclipse/emf/ecore/EObject</span><br />
<strong>at</strong> java_lang_Runnable$run.call (<strong>Unknown Source</strong>)</code></p>
<p>Oh, yeah, I needed to add the EMF classes to the classpath.  I could do that by restarting the shell with the EMF jars included in the classpath or add them in directly&#8230;</p>
<p><code><strong>groovy:</strong>000&gt; this.class.classLoader.rootLoader.addURL(new URL("file:///.../org.eclipse.emf.ecore_2.5.0.v200906151043.jar"))<br />
===&gt; null<br />
<strong>groovy:</strong>000&gt; this.class.classLoader.rootLoader.addURL(new URL("file:///.../org.eclipse.emf.common_2.5.0.v200906151043.jar"))<br />
===&gt; null<br />
<strong>groovy:</strong>000&gt; dec = new argkit.decision.impl.DecisionImpl()<br />
===&gt; argkit.decision.impl.DecisionImpl@5878d2 (name: decision0, caption: null)<br />
<strong>groovy:</strong>000&gt; cand = new argkit.decision.impl.CandidateImpl()<br />
===&gt; argkit.decision.impl.CandidateImpl@b9132a (name: candidate1, caption: null)<br />
<strong>groovy:</strong>000&gt; dec.candidates.add(cand)<br />
===&gt; true<br />
<strong>groovy:</strong>000&gt; cand.status<br />
===&gt; UNKNOWN<br />
<strong>groovy:</strong>000&gt; arg = new argkit.decision.impl.ArgumentImpl()<br />
===&gt; argkit.decision.impl.ArgumentImpl@ce796 (name: argument2, caption: null) (support: +)<br />
<strong>groovy:</strong>000&gt; cand.arguments.add(arg)<br />
===&gt; true<br />
<strong>groovy:</strong>000&gt; cand.status<br />
===&gt; RECOMMENDED<br />
<strong>groovy:</strong>:000&gt; arg.support = argkit.decision.Support.AGAINST<br />
===&gt; -<br />
<strong>groovy:</strong>:000&gt; cand.status<br />
===&gt; REJECTED<br />
<strong>groovy:</strong>:000&gt; exit<br />
</code></p>
<p>Having told Groovy about the EMF jars my code depends on, I create a decision object with one candidate and watch the recommended status of the candidate change with the addition of an argument and it&#8217;s subsequent manipulation.</p>
<h2>Rhino</h2>
<p>Then I fire up the equivalent for Rhino (jrunscript), this time remembering to include the EMF jars on the classpath, and start my shell:</p>
<p><code>js&gt; dec = argkit.decision.impl.DecisionImpl()<br />
script error: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "argkit" is not defined. (&lt;STDIN&gt;#1) in &lt;STDIN&gt; at line number 1<br />
</code><br />
Ah.  This was an unexpected issue as argkit is definitely on the classpath.  And there&#8217;s pretty much where I got to.  Some digging lead me to this <a href="http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=79c908a33f1af578ad9b9996ee1f?bug_id=6799015">bug report</a> for Java which suggests that the problem is with the non-standard top level domain name (TLDN) in my package and points the finger at Rhino.  Adjusting my model (by setting .org as the TLDN) for this perplexing issue got me a little further&#8230;</p>
<p><code>js&gt; dec = org.argkit.decision.impl.DecisionImpl()<br />
script error: sun.org.mozilla.javascript.internal.EcmaError: TypeError: [JavaPackage org.argkit.decision.impl.DecisionImpl] is not a function, it is sun.org.mozilla.javascript.internal.NativeJavaPackage. (#1) in  at line number 1</code></p>
<p>Ummm, it&#8217;s a what?</p>
<p><code>js&gt; org.argkit.decision.impl.DecisionImpl<br />
[JavaPackage org.argkit.decision.impl.DecisionImpl]</code></p>
<p>It&#8217;s certainly not a Java Package. It seems to me that Rhino was really not cut for this particular use case.</p>
<h2>Conclusions</h2>
<p>So to recap, I tried to use Groovy and Rhino to manipulate some non-framework objects, as the expressions in my scripting engine embedded app will need to range over custom state objects and Groovy beat Rhino hands down in terms of ease of integration with the custom code.  Now, if only I could get the <a href="http://groovy.codehaus.org/Eclipse+Plugin">Groovy plugin for Eclipse</a> to install, but that&#8217;s another story&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://halfdecent.net/2009/12/04/scripting-languages-in-java-manipulating-an-emf-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

