<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Andrew E. Bruno</title>
	<atom:link href="http://left.subtree.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://left.subtree.org</link>
	<description>A sourceful of secrets</description>
	<lastBuildDate>Mon, 10 May 2010 03:56:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='left.subtree.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/e14c799c6e8030a8abefcb495c0b0e17?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Andrew E. Bruno</title>
		<link>http://left.subtree.org</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://left.subtree.org/osd.xml" title="Andrew E. Bruno" />
	<atom:link rel='hub' href='http://left.subtree.org/?pushpress=hub'/>
		<item>
		<title>Freerunner First Boot</title>
		<link>http://left.subtree.org/2008/08/13/freerunner-first-boot/</link>
		<comments>http://left.subtree.org/2008/08/13/freerunner-first-boot/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 03:42:31 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[FreeRunner]]></category>
		<category><![CDATA[Neo]]></category>

		<guid isPermaLink="false">http://left.subtree.org/?p=39</guid>
		<description><![CDATA[Here&#8217;s some notes on my initial experience setting up the Neo Freerunner. I&#8217;ve been meaning to write this post for a while now and most of this is already old stuff but I&#8217;m posting it anyhow for reference. I purchased the Neo Freerunner fully aware that it was a developer phone but my hope was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=39&subd=qnot&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s some notes on my initial experience setting up the <a href="http://wiki.openmoko.org/wiki/FreeRunner_Overview">Neo Freerunner</a>. I&#8217;ve been meaning to write this post for a while now and most of this is already old stuff but I&#8217;m posting it anyhow for reference. I purchased the Neo Freerunner fully aware that it was a developer phone but my hope was that I could at least ssh into the device and make/receive a few phone calls. I&#8217;m happy to report that after first booting I was able to get most things functioning within a few hours.</p>
<p><strong>First Boot</strong></p>
<p>There&#8217;s several <a href="http://wiki.openmoko.org/wiki/Distributions">distributions</a> for the Freerunner which can get quite confusing but the one that comes stock with the Freerunner is referred to as <a href="http://wiki.openmoko.org/wiki/Om_2007.2">2007.2</a>. First time booting up the Freerunner you&#8217;re presented the home screen for 2007.2. You can also <a href="http://wiki.openmoko.org/wiki/Boot">boot</a> into NAND and NOR flash which allows you to update the kernel, root filesystem and the boot loader (U-Boot).</p>
<p>My first mission was to ssh into the device. Followed the instructions on the wiki for setting up <a href="http://wiki.openmoko.org/wiki/USB_Networking">USB networking</a>.  By default the IP address of the Freerunner is 192.168.0.202. On the desktop side you first have to ifconfig the usb0 interface and setup the correct routes. Here&#8217;s the script I run on my desktop after connecting the Freerunner:</p>
<pre class="brush: bash;">
#!/bin/bash

/sbin/ifconfig usb0 192.168.0.200 netmask 255.255.255.0
/sbin/route add -host 192.168.0.202/32 dev usb0
</pre>
<p>One extra step I had to do was configure my firewall to allow connections to/from usb0. I&#8217;m running Ubuntu hardy 8.04 and using Firestarter. Open up Firestarter:</p>
<ul>
<li>Preferences -&gt; Firewall -&gt; Network Settings</li>
<li>Set &#8216;Local network connected device&#8217; to:  Unknown device (usb0)</li>
<li>Check &#8216;Enable internet connection sharing&#8217;</li>
</ul>
<p>Verified usb0 network connections:</p>
<pre class="brush: plain;">
$ ping -I usb0 192.168.0.202
$ ssh root@192.168.0.202
</pre>
<p>Once connected to the Freerunner next step was to get the date to display on the home screen. To do this I just followed the <a href="http://wiki.openmoko.org/wiki/Today/2007.2#Adjust_UI_components_at_runtime">instructions on the wiki</a> for customizing the today page (run these commands on the Neo):</p>
<pre class="brush: plain;">
# dbus-launch gconftool-2 -t boolean -s /desktop/poky/interface/reduced false
# /etc/init.d/xserver-nodm restart
</pre>
<p>Here&#8217;s a screenshot of the home screen:</p>
<p style="text-align:center;"><img class="size-full wp-image-124 aligncenter" title="neo-clock" src="http://qnot.files.wordpress.com/2008/08/neo-clock.png?w=225&#038;h=300" alt="" width="225" height="300" /></p>
<p><strong>Upgrade Software</strong></p>
<p>Once I was able to successfully ssh into the Neo and verifed that I could also connect to the internet from the Neo I wanted to upgrade to the latest software release. To do this you use <a href="http://wiki.openmoko.org/wiki/Opkg">opgk</a> (package management system based on Ipkg). The first time you upgrade from the software release shipped with the Neo you have to first upgrade dropbear (ssh server) from the terminal on the Neo, then you can ssh back into the Neo and upgrade the rest of the software:</p>
<pre class="brush: plain;">
# opkg update
On the Neo, open Terminal and run: # opkg install dropbear
Then ssh to neo and run: # opkg upgrade
</pre>
<p>At this point I rebooted and inserted my T-Mobile sim card and microSD card. Once back at the home screen it showed I was registered to the T-Mobile network and I opened up the dialer app and placed my first call!</p>
<p><strong>Set up Timezone and correct date/time</strong></p>
<p>To fix the timezone run this from the Neo:</p>
<pre class="brush: plain;">
# opkg install tzdata tzdata-americas
# ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
# /etc/init.d/xserver-nodm restart
</pre>
<p>To set the correct time using ntp run:</p>
<pre class="brush: plain;">
# opkg install ntpclient
# ntpclient -s -h pool.ntp.org
# hwclock --systohc
</pre>
<p><strong>WLAN</strong></p>
<p>Next up was connecting the Neo to my wireless LAN. The wireless interface on the Neo is eth0. First have to make sure WLAN device is turned on which it seemed to be by default when you first boot. You can check this by holding down the power button for a few seconds which should pop up a menu showing the state of the various devices. Here&#8217;s the script I use to connect the Neo to my WLAN:</p>
<pre class="brush: bash;">
#!/bin/sh

/sbin/ifconfig eth0 down
/sbin/ifconfig eth0 up
/sbin/iwconfig eth0 key restricted 'xxxxx'
/sbin/iwconfig eth0 essid 'xxxx'
/sbin/udhcpc eth0
</pre>
<p><strong>GPS</strong></p>
<p><a href="http://www.tangogps.org/">tangoGPS</a> rocks. This app is amazing and it worked right out of the box. Followed the <a href="http://wiki.openmoko.org/wiki/Getting_Started_with_your_Neo_FreeRunner#Use_the_GPS">directions on the wiki</a> to get it up and running. There was an <a href="http://wiki.openmoko.org/wiki/GPS_Problems">issue</a> getting a fix with the SD card installed but by the time I tried this out they already had a kernel update which fixed the issue. I had no problem getting a fix and my TTFF was 35s with the SD card in. Here&#8217;s some screenshots of tangoGPS in action:</p>
<table style="border:none;">
<tbody>
<tr>
<td style="border:none;"><img style="border:1px solid #ccc;" src="http://qnot.files.wordpress.com/2008/08/screenshot-1.png?w=225&#038;h=300" alt="" title="Screenshot-1" width="225" height="300" class="alignnone size-full wp-image-125" /></td>
<td style="border:none;"><img style="border:1px solid #ccc;" src="http://qnot.files.wordpress.com/2008/08/screenshot-2.png?w=225&#038;h=300" alt="" title="Screenshot-2" width="225" height="300" class="alignnone size-full wp-image-126" /></td>
</tr>
</tbody>
</table>
<p>I also installed and ran <a href="http://wiki.openmoko.org/wiki/Howto_Test_Your_GPS_with_agpsui">AGPS Test</a> which is a program for testing out GPS on the Neo. It shows some nice graphs of the various satellites you&#8217;re currently connected to and their signal strengths:</p>
<table style="border:none;">
<tbody>
<tr>
<td style="border:none;"><img style="border:1px solid #ccc;" src="http://qnot.files.wordpress.com/2008/08/screenshot-4.png?w=225&#038;h=300" alt="" title="Screenshot-4" width="225" height="300" class="alignnone size-full wp-image-127" /></td>
<td style="border:none;"><img style="border:1px solid #ccc;" src="http://qnot.files.wordpress.com/2008/08/screenshot-5.png?w=225&#038;h=300" alt="" title="Screenshot-5" width="225" height="300" class="alignnone size-full wp-image-128" /></td>
</tr>
</tbody>
</table>
<p><strong>Bugs/Issues</strong></p>
<p>Overall I was impressed by how much I was able to get working the first time around however there&#8217;s definitely a few issues I came across. The most concerning was the <a href="http://wiki.openmoko.org/wiki/Freerunner_Hardware_Issues#Poor_Audio_Quality">GSM buzzing</a> during phone calls. On the Neo side everything sounds fine but the person on the other end hears a very loud buzzing noise. Here&#8217;s the <a href="http://lists.openmoko.org/pipermail/hardware/2008-August/000288.html">latest update</a> from the hardware list regarding the issue. I tried tweaking the various alsa settings in <code>/usr/share/openmoko/scenarios/gsmhandset.state</code> with some luck but still wasn&#8217;t able to find the right balance to completely eliminate the buzzing. Still trying to wrap my head around which alsa settings do what but I found playing with alsamixer during a live call to be helpful. The basic procedure goes something like this:</p>
<ol>
<li>ssh to FreeRunner</li>
<li>Make a phone call</li>
<li>While call is in progress run alsamixer</li>
<li>Tweak settings to minimize buzzing/echo</li>
<li>While call is still in progress run: <code>$ alsactl store -f gsmhandset-test1.txt</code></li>
</ol>
<p>Now you can diff this new file against the original (/usr/share/openmoko/scenarios/gsmhandset.state) and see which settings were changed. This is really the only thing holding me back from using the Neo as my primary phone so I look forward to a possible fix.</p>
<p>I found using the Terminal on the Neo rather clunky due to the lack of characters available on the keyboard. For example there&#8217;s no &lt;TAB&gt; or &#8216;/&#8217;. I&#8217;m sure there&#8217;s ways to customize the keyboard. Looks like only vi is available by default on the Neo so I plan on seeing if I can find a vim package (.ipk) or figuring out how to compile vim for the Neo.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/qnot.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/qnot.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qnot.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qnot.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qnot.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qnot.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qnot.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qnot.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qnot.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qnot.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qnot.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qnot.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=39&subd=qnot&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://left.subtree.org/2008/08/13/freerunner-first-boot/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">sigma110</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2008/08/neo-clock.png" medium="image">
			<media:title type="html">neo-clock</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2008/08/screenshot-1.png" medium="image">
			<media:title type="html">Screenshot-1</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2008/08/screenshot-2.png" medium="image">
			<media:title type="html">Screenshot-2</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2008/08/screenshot-4.png" medium="image">
			<media:title type="html">Screenshot-4</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2008/08/screenshot-5.png" medium="image">
			<media:title type="html">Screenshot-5</media:title>
		</media:content>
	</item>
		<item>
		<title>Neo FreeRunner = Freedom</title>
		<link>http://left.subtree.org/2008/07/22/neo-freerunner-freedom/</link>
		<comments>http://left.subtree.org/2008/07/22/neo-freerunner-freedom/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 03:22:40 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[FreeRunner]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Neo]]></category>
		<category><![CDATA[OpenMoko]]></category>

		<guid isPermaLink="false">http://left.subtree.org/?p=23</guid>
		<description><![CDATA[Open. Mobile. Free. That was the tag line printed on the side of the box which housed my shiny new Neo FreeRunner. I finally had some time to sit down and play with this new device and so far it&#8217;s blown me away. If you&#8217;re a Linux geek and haven&#8217;t checked this out yet I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=23&subd=qnot&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Open. Mobile. Free.</strong> That was the tag line printed on the side of the box which housed my shiny new <a href="http://wiki.openmoko.org/wiki/FreeRunner_Overview">Neo FreeRunner</a>. I finally had some time to sit down and play with this new device and so far it&#8217;s blown me away. If you&#8217;re a Linux geek and haven&#8217;t checked this out yet I highly recommend <a href="http://www.openmoko.com/product.html">getting one</a>. It&#8217;s a truly open platform with a thriving community and is supported by a company which has basically open sourced their internal development. Where else could you get the complete <a href="http://wiki.openmoko.org/wiki/CAD_models">CAD files</a> for your phone? There&#8217;s a good post about why you might <a href="http://www.fsf.org/blogs/community/5-reasons-to-avoid-iphone-3g">think twice before buying an iPhone</a> and picking up a FreeRunner instead.</p>
<p>Here&#8217;s a few pics of what the Neo looks like all boxed up..</p>
<table style="width:100%;border:none;">
<tr>
<td style="border:none;"><img style="border:1px solid #ccc;" src="http://qnot.files.wordpress.com/2008/07/neo-box.jpg?w=237&#038;h=300" alt="" title="neo-box" width="237" height="300" class="alignnone size-medium wp-image-137" /></td>
<td style="border:none;"><img style="border:1px solid #ccc;" src="http://qnot.files.wordpress.com/2008/07/neo-box2.jpg?w=300&#038;h=225" alt="" title="neo-box2" width="300" height="225" class="alignnone size-medium wp-image-138" /></td>
</tr>
</table>
<p>
The Neo came bundled with a USB cable, a nifty stylus + laser pen, AC adapter, battery, and a 512mb microSD card.</p>
<div style="text-align:center;">
<img style="border:1px solid #ccc;" src="http://qnot.files.wordpress.com/2008/07/neo-accessories.jpg?w=300&#038;h=225" alt="" title="neo-accessories" width="300" height="225" class="aligncenter size-medium wp-image-139" />
</div>
<p>
The <a href="http://wiki.openmoko.org/wiki/Neo_FreeRunner_GTA02_Hardware">hardware specs</a> for the Neo (GTA02) are impressive, GSM, WiFi, Bluetooth, GPS. All that packed into a full blown Linux distro that fits in the palm of your hand.</p>
<div style="text-align:center;">
<img style="border:1px solid #ccc;" src="http://qnot.files.wordpress.com/2008/07/neo-hand.jpg?w=400&#038;h=300" alt="" title="neo-hand" width="400" height="300" class="aligncenter size-full wp-image-140" />
</div>
<div style="text-align:center;">
<img style="border:1px solid #ccc;" src="http://qnot.files.wordpress.com/2008/07/neo-back.jpg?w=400&#038;h=300" alt="" title="neo-back" width="400" height="300" class="aligncenter size-full wp-image-141" />
</div>
<p>I&#8217;ll be posting more about my experiences using the Neo as my daily phone. More to come..</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/qnot.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/qnot.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qnot.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qnot.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qnot.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qnot.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qnot.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qnot.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qnot.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qnot.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qnot.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qnot.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=23&subd=qnot&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://left.subtree.org/2008/07/22/neo-freerunner-freedom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">sigma110</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2008/07/neo-box.jpg?w=237" medium="image">
			<media:title type="html">neo-box</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2008/07/neo-box2.jpg?w=300" medium="image">
			<media:title type="html">neo-box2</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2008/07/neo-accessories.jpg?w=300" medium="image">
			<media:title type="html">neo-accessories</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2008/07/neo-hand.jpg" medium="image">
			<media:title type="html">neo-hand</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2008/07/neo-back.jpg" medium="image">
			<media:title type="html">neo-back</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating executable jars with Maven</title>
		<link>http://left.subtree.org/2008/01/24/creating-executable-jars-with-maven/</link>
		<comments>http://left.subtree.org/2008/01/24/creating-executable-jars-with-maven/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 04:53:16 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://left.subtree.org/2008/01/24/creating-executable-jars-with-maven/</guid>
		<description><![CDATA[After wrestling with Maven assemblies for while I finally figured out how to build executable jars. The Maven assembly plugin allows you to define ways to package up your project for distribution by creating various assembly descriptor files. Here&#8217;s a quick example of a Maven assembly for building an executable jar (uberjar). For this example [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=18&subd=qnot&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>After wrestling with <a href="http://maven.apache.org/plugins/maven-assembly-plugin/">Maven assemblies</a> for while I finally figured out how to build executable jars. The Maven assembly plugin allows you to define ways to package up your project for distribution by creating various assembly descriptor files. Here&#8217;s a quick example of a Maven assembly for building an executable jar (uberjar). For this example we&#8217;ll create a brand new project from scratch but it should be easy to see how to integrate into an existing project.</p>
<p>First step lets create a test project:</p>
<pre class="brush: plain;">
$ mvn archetype:create -DgroupId=org.qnot.example -DartifactId=hello-world
$ cd hello-world
</pre>
<p>Next add a few dependencies to the project. In this example we&#8217;ll add a few libraries from jakarta commons. The &lt;dependencies/&gt; section in the pom.xml should now look like this:</p>
<pre class="brush: xml;">
  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;3.8.1&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;commons-cli&lt;/groupId&gt;
      &lt;artifactId&gt;commons-cli&lt;/artifactId&gt;
      &lt;version&gt;1.1&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;commons-lang&lt;/groupId&gt;
      &lt;artifactId&gt;commons-lang&lt;/artifactId&gt;
      &lt;version&gt;2.3&lt;/version&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;
</pre>
<p>Create a META-INF/ directory to store the MANIFEST.MF file which defines the main class in the executable jar.</p>
<pre class="brush: plain;">
$ mkdir -p src/main/resources/META-INF/
$ echo 'Main-Class: org.qnot.example.App' &gt; MANIFEST.MF
</pre>
<p>Create a src/assemble directory to store the assembly descriptor files</p>
<pre class="brush: plain;">
$ mkdir src/assemble
</pre>
<p>Next we&#8217;ll create the actual assembly descriptor file which defines how to package up the jar. Create the file src/assemble/exe.xml with the following xml:</p>
<pre class="brush: xml;">
&lt;assembly&gt;
  &lt;id&gt;exe&lt;/id&gt;
  &lt;formats&gt;
    &lt;format&gt;jar&lt;/format&gt;
  &lt;/formats&gt;
  &lt;includeBaseDirectory&gt;false&lt;/includeBaseDirectory&gt;
  &lt;dependencySets&gt;
    &lt;dependencySet&gt;
      &lt;outputDirectory&gt;&lt;/outputDirectory&gt;
      &lt;outputFileNameMapping&gt;&lt;/outputFileNameMapping&gt;
      &lt;unpack&gt;true&lt;/unpack&gt;
      &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;includes&gt;
        &lt;include&gt;commons-lang:commons-lang&lt;/include&gt;
        &lt;include&gt;commons-cli:commons-cli&lt;/include&gt;
      &lt;/includes&gt;
    &lt;/dependencySet&gt;
  &lt;/dependencySets&gt;
  &lt;fileSets&gt;
    &lt;fileSet&gt;
      &lt;directory&gt;target/classes&lt;/directory&gt;
      &lt;outputDirectory&gt;&lt;/outputDirectory&gt;
    &lt;/fileSet&gt;
  &lt;/fileSets&gt;
&lt;/assembly&gt;
</pre>
<p>Inside the <code>&lt;dependecySets/&gt;</code> is where you can add all the libraries you&#8217;d like to include in the uberjar. These must also be defined in your pom.</p>
<p>Finally, add the maven-assembly-plugin to the pom:</p>
<pre class="brush: xml;">
  &lt;build&gt;
    &lt;finalName&gt;hello-world&lt;/finalName&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
        &lt;configuration&gt;
          &lt;descriptors&gt;
            &lt;descriptor&gt;src/assemble/exe.xml&lt;/descriptor&gt;
          &lt;/descriptors&gt;
          &lt;archive&gt;
            &lt;manifestFile&gt;src/main/resources/META-INF/MANIFEST.MF&lt;/manifestFile&gt;
          &lt;/archive&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
</pre>
<p>To run the assembly and build the executable jar:</p>
<pre class="brush: plain;">
$ mvn assembly:assembly
$ java -jar target/hello-world-exe.jar
Hello World!
</pre>
<p>I tested the hello-world example using the latest Maven release (2.0.8) and maven-assembly-plugin-2.2-beta-1. If you run into any issues try and update your Maven plugins by running:</p>
<pre class="brush: plain;">
$ mvn -U compile
</pre>
<p>You can download the example hello-world project <a href="http://www.qnot.org/code/hello-world.tar.gz">here</a>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/qnot.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/qnot.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qnot.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qnot.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qnot.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qnot.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qnot.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qnot.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qnot.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qnot.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qnot.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qnot.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=18&subd=qnot&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://left.subtree.org/2008/01/24/creating-executable-jars-with-maven/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">sigma110</media:title>
		</media:content>
	</item>
		<item>
		<title>Database Design with Dia</title>
		<link>http://left.subtree.org/2007/12/05/database-design-with-dia/</link>
		<comments>http://left.subtree.org/2007/12/05/database-design-with-dia/#comments</comments>
		<pubDate>Thu, 06 Dec 2007 05:23:48 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://left.subtree.org/2007/12/05/database-design-with-dia/</guid>
		<description><![CDATA[In this post I&#8217;m going to give a quick how-to on creating database schemas with a wonderful tool called Dia. I&#8217;ve often found having a nice visual representation of a database to be quite helpful but can&#8217;t stand keeping it up to date. As soon as you add a new column or change the design [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=14&subd=qnot&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>In this post I&#8217;m going to give a quick how-to on creating database schemas with a wonderful tool called <a href="http://live.gnome.org/Dia">Dia</a>. I&#8217;ve often found having a nice visual representation of a database to be quite helpful but can&#8217;t stand keeping it up to date. As soon as you add a new column or change the design around you end up having to sync your visual diagram with your SQL files. It&#8217;s tedious having to  manage the various SQL for building the database and this can be a larger pain when trying to support different database platforms each with their own SQL syntax. So before you create your next database read on and see how Dia can make your life a bit easier.</p>
<p><a href="http://live.gnome.org/Dia">Dia</a> is a program for creating diagrams and for this exercise we&#8217;ll be creating UML diagrams from within Dia. We&#8217;re also going to use a perl script called <a href="http://tedia2sql.tigris.org/">tedia2sql</a> which will transform our Dia files directly to SQL for our target database. What&#8217;s also nice about creating database schemas this way is that you can generate SQL for multiple target databases without the maintenance overhead.</p>
<p>First off, install a copy of Dia as well as tedia2sql. You can download tedia2sql <a href="http://tedia2sql.tigris.org/servlets/ProjectDocumentList">here</a> and download Dia <a href="http://live.gnome.org/Dia/Download">here</a>. I&#8217;m not going to cover the install in this post but there should be packages available for most Linux distro&#8217;s and if your not running Linux now is a great time to start!</p>
<p>Fire up Dia, create a new diagram and save it as &#8220;employee.dia&#8221;. Select the UML sheet from the drop down list. We&#8217;ll be using various UML objects to represent tables and definitions that make up our database. Here&#8217;s a quick overview of the main UML objects and their usage:</p>
<table style="width:100%;border:none;">
<tr>
<td style="border:none;"><img style="border:1px solid #ccc;" src="http://qnot.files.wordpress.com/2007/12/dia_menu.jpg?w=175&#038;h=242" alt="" title="dia_menu" width="175" height="242" class="aligncenter size-full wp-image-154" /></td>
<td style="border:none;">
<div style="margin-bottom:20px;">
   <img src="http://qnot.files.wordpress.com/2007/12/dia_class.png?w=35&#038;h=33" alt="" title="dia_class" width="35" height="33" class="size-full wp-image-155" style="float:left;padding:4px;" /> <span style="font-weight:bold;">Class</span> represents a table in the database. A Class has a name which corresponds to the name of the table and attributes which map to the columns of the table. Attributes in classes can have visibility (public, private, protected). Protected attributes are primary keys. More on classes later.
</div>
<div style="margin-bottom:20px;">
   <img src="http://qnot.files.wordpress.com/2007/12/dia_component.png?w=33&#038;h=33" alt="" title="dia_component" width="33" height="33" class="alignnone size-full wp-image-158" style="float:left;padding:4px;" /> <span style="font-weight:bold;">Component</span> is a special object that lets you define a list of default values to be inserted into a table. These are equivalent to hard coding &#8220;insert into ..&#8221; statements in your SQL files.
</div>
<div>
   <img src="http://qnot.files.wordpress.com/2007/12/dia_small_package.png?w=33&#038;h=33" alt="" title="dia_small_package" width="33" height="33" class="alignnone size-full wp-image-159" style="float:left;padding:4px;" /> <span style="font-weight:bold;">Small Package</span> represents a typemap. Typemaps are used for adding custom SQL types such as MySQL tinyint.
</div>
</td>
</tr>
</table>
<p>Now lets create our first table. Select the &#8220;Class&#8221; object icon from the UML sheet and click inside the diagram editor window. This will add the class to your diagram. Now right click on the new class and select &#8220;Show Properties&#8221;. This will bring up a rather large and complex property window for the UML class you&#8217;ve just created. We&#8217;re only going to customize a few properties outlined below.</p>
<p>First, under the &#8220;Class&#8221; tab enter the name of the table (employee) in the &#8220;Class Name: &#8221; field. Next click on the &#8220;Attributes&#8221; tab and enter in the columns of the table as attributes. In the &#8220;Name: &#8221; field enter in the column name. In the &#8220;Type: &#8221; field enter in the SQL type for the column. If you want to support multiple database platforms try to be generic here and only use ANSI SQL 1992 or else use a typemap. More on typemaps later. In the &#8220;Value: &#8221; field enter any default values for the column. For example, this is where you could add in &#8220;not null&#8221;. If the column your adding is a primary key then don&#8217;t put &#8220;not null&#8221; here and instead select &#8220;Protected&#8221; for the &#8220;Visibility: &#8221; field. Not null will automatically get added to all primary keys on output generation. The screen shot below is an example of the Class property editor window.</p>
<p><img src="http://qnot.files.wordpress.com/2007/12/dia_attributes.jpg?w=400&#038;h=494" alt="" title="dia_attributes" width="400" height="494" class="aligncenter size-full wp-image-161" style="border:1px solid #ccc;" /></p>
<p>Next, repeat the process for as many tables as you need in your database. For this example, create two tables &#8220;employee&#8221; and &#8220;department&#8221; with the columns as shown in the screenshot below (note the &#8216;#&#8217; in front of an attribute indicates that it&#8217;s visibility is &#8220;Protected&#8221; thus making it a Primary Key):</p>
<p><img src="http://qnot.files.wordpress.com/2007/12/dia_employee.jpg?w=600&#038;h=201" alt="" title="dia_employee" width="600" height="201" class="aligncenter size-full wp-image-162" style="border:1px solid #ccc;" /></p>
<p>This is a simple example of a database which stores employee data along with the department they belong to. Now suppose we have a default list of departments that we&#8217;d like to load into the department table when our database is created. To do this we&#8217;ll use the &#8220;Component&#8221; object from the UML sheet. Select the &#8220;Component&#8221; object and add it to your diagram editor window. Right click and select &#8220;Properties&#8221;.</p>
<p><img src="http://qnot.files.wordpress.com/2007/12/dia_comp_prop.jpg?w=316&#038;h=230" alt="" title="dia_comp_prop" width="316" height="230" class="aligncenter size-full wp-image-163" style="border:1px solid #ccc;" /></p>
<p>In the &#8220;Stereotype: &#8221; field you basically enter in the first part of an &#8220;insert into ..&#8221; SQL statement. For this example, to insert a default list of departments we&#8217;d normally write the following SQL:</p>
<pre class="brush: sql;">
insert into department (department_id, name) values (1, 'Marketing');
insert into department (department_id, name) values (2, 'Production');
insert into department (department_id, name) values (3, 'Design');
</pre>
<p>So in this case, for the &#8220;Stereotype: &#8221; field we&#8217;d enter in &#8220;department (department_id, name)&#8221;. Click OK to close the properties dialog. Now in the Component object box enter in the values you&#8217;d like to insert, one per line. Here&#8217;s what our diagram should look like now:</p>
<p><img src="http://qnot.files.wordpress.com/2007/12/dia_employee2.jpg?w=600&#038;h=226" alt="" title="dia_employee2" width="600" height="226" class="aligncenter size-full wp-image-164" style="border:1px solid #ccc;" /></p>
<p>Now lets add in a typemap. Typemaps are used for when you&#8217;d like to configure custom types which are specific to a database platform. A good example of this is MySQL auto_increment. This is a feature specific to MySQL and not supported in all databases. Lets suppose we&#8217;d like to have a primary key column which gets auto incremented upon each insert. But we also want to support both MySQL and Apache Derby without having to maintain separate SQL files. To achieve this we&#8217;ll create a custom typemap and define the specific SQL for each target db.</p>
<p>Typemaps are created using a Small Package so select the &#8220;Small Package&#8221; object and add it to your diagram editor window. Right click and select &#8220;Properties&#8221;.</p>
<p><img src="http://qnot.files.wordpress.com/2007/12/dia_type_prop.jpg?w=286&#038;h=230" alt="" title="dia_type_prop" width="286" height="230" class="aligncenter size-full wp-image-165" style="border:1px solid #ccc;" /></p>
<p>In the &#8220;Stereotype: &#8221; field you enter in the target database. So for example &#8220;mysql: typemap&#8221;.  For a list of supported target databases see tedia2sql &#8211;help. Some common ones are: postgres, mysql, sybase, oracle, db2, and innodb. Click OK to close the properties dialog. Now inside the Small package box you can enter custom types one per line. For this example we&#8217;ll create a custom type with a name of &#8220;identity&#8221;. This means that when we generate our SQL files, tedia2sql will replace the column type with our custom type. Here&#8217;s a few examples:</p>
<table style="width:100%;border:none;">
<tr>
<td style="border:none;">
MySQL typemaps</p>
<pre class="brush: plain; light: true; wrap-lines: false;">
identity: int unsigned auto_increment
bigid: bigint unsigned auto_increment
</pre>
</td>
<td style="border:none;">Apache Derby typemaps</p>
<pre class="brush: plain; light: true; wrap-lines: false;">
identity: int generated by default as identity
bigid: long generated by default as identity
</pre>
</td>
</tr>
</table>
<p>Repeat the process for Apache Derby using &#8220;db2: typemap&#8221;.  Now that we&#8217;ve defined our custom identity typemap we can change the employee_id column from type &#8220;int&#8221; to type &#8220;identity&#8221;. We can also do the same for our department table. Now these columns will be auto incrementing columns and depending on which target database we select on output the correct SQL will be generated. Our diagram should now look like this:</p>
<p><img src="http://qnot.files.wordpress.com/2007/12/dia_employee3.jpg?w=600&#038;h=276" alt="" title="dia_employee3" width="600" height="276" class="aligncenter size-full wp-image-166" style="border:1px solid #ccc;" /></p>
<p>At this point we have created our database schema and defined a default list of departments to be inserted. We also created a typemap called &#8220;identity&#8221; which defines auto incrementing columns for both MySQL and Apache derby. Now lets generate the SQL files to create the database using tedia2sql. Before we run tedia2sql we need to apply a small patch to the tedia2sql script. This fixes a very small formatting issue in tedia2sql related to the typemaps we created. Edit the tedia2sql script (/usr/bin/tedia2sql) and comment out the line inside the parseTypeMap(..) subroutine that looks like this:</p>
<pre class="brush: perl; highlight: [3]; light: true;">
$defStr =~ s/s//g; # ignore spaces
     -- change to --
#   $defStr =~ s/s//g; # ignore spaces
</pre>
<p>or just apply the patch I created <a href="http://www.qnot.org/code/tedia2sql-typemap-1.2.12.patch">here</a> (works for version 1.2.12):</p>
<pre class="brush: plain; light: true;">
$ patch /usr/bin/tedia2sql &amp;lt; tedia2sql-typemap-1.2.12.patch
</pre>
<p>Now we can generate the SQL files for our target databases:</p>
<pre class="brush: plain; light: true;">
$ tedia2sql -i employee.dia -o employee-mysql.sql -t mysql -d
$ tedia2sql -i employee.dia -o employee-derby.sql -t db2 -d
</pre>
<p>This will generate two SQL files for building the database in both MySQL and Apache derby. If you view these files you can see how tedia2sql handled our typemaps for the auto incrementing columns in each target database:</p>
<p>MySQL</p>
<pre class="brush: sql;">
-- employee
create table employee (
  employee_id                int unsigned auto_increment not null,
  department_id             int not null,
  first_name                varchar(255) not null,
  last_name                 varchar(255),
  start_date                date,
  constraint pk_Employee primary key (employee_id)
) ;
</pre>
<p>Apache Derby</p>
<pre class="brush: sql;">
-- employee
create table employee (
  employee_id                int generated by default as identity  not null,
  department_id             int not null,
  first_name                varchar(255) not null,
  last_name                 varchar(255),
  start_date                date,
  constraint pk_Employee primary key (employee_id)
) ;
</pre>
<p>You can download the files generated as well as the employee.dia file I used in this tutorial here:</p>
<ul>
<li><a href="http://www.qnot.org/code/employee.dia">employee.dia</a></li>
<li><a href="http://www.qnot.org/code/employee-mysql.sql">employee-mysql.sql</a></li>
<li><a href="http://www.qnot.org/code/employee-derby.sql">employee-derby.sql</a></li>
</ul>
<p>You can test the SQL files generated by tedia2sql and create the employee database as follows:</p>
<p>MySQL</p>
<pre class="brush: plain; light: true;">
$ mysql -u user -p dbname &amp;lt; employee-mysql.sql
</pre>
<p>Apache Derby</p>
<pre class="brush: plain; light: true;">
$ java -cp derby.jar:derbytools.jar \
       -Dderby.system.home=/path/to/dbroot \
       -Dij.protocol=jdbc:derby: \
       -Dij.database='employee;create=true'
    org.apache.derby.tools.ij employee-derby.sql
</pre>
<p>A quick Makefile will help out a lot in testing out your database schema:</p>
<pre class="brush: plain; light: true;">
all:
      tedia2sql -i employee.dia -o employee-mysql.sql -t mysql -d
      tedia2sql -i employee.dia -o employee-derby.sql -t db2 -d
clean:
      rm -f *.sql
</pre>
<p>I&#8217;ve found that for small to moderate size projects creating database schemas in Dia and using tedia2sql for SQL generation to be a lifesaver. You can also make use of Dia&#8217;s export feature to export your database schema to a number of different formats such as jpg, png, eps, tiff, etc. I really only scratched the surface of what can be done using these great tools. tedia2sql has support for lots of cool features like indexes, foreign key constraints, views and much more. For more information check out <a href="http://tedia2sql.tigris.org/usingtedia2sql.html">using tedia2sql</a>  and <a href="http://dia-installer.de/doc/en/index.html">Dia&#8217;s manual</a>.</p>
<p>Happy <span style="font-weight:bold;">Dia</span>gramming!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/qnot.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/qnot.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qnot.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qnot.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qnot.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qnot.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qnot.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qnot.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qnot.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qnot.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qnot.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qnot.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=14&subd=qnot&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://left.subtree.org/2007/12/05/database-design-with-dia/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">sigma110</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/12/dia_menu.jpg" medium="image">
			<media:title type="html">dia_menu</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/12/dia_class.png" medium="image">
			<media:title type="html">dia_class</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/12/dia_component.png" medium="image">
			<media:title type="html">dia_component</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/12/dia_small_package.png" medium="image">
			<media:title type="html">dia_small_package</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/12/dia_attributes.jpg" medium="image">
			<media:title type="html">dia_attributes</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/12/dia_employee.jpg" medium="image">
			<media:title type="html">dia_employee</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/12/dia_comp_prop.jpg" medium="image">
			<media:title type="html">dia_comp_prop</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/12/dia_employee2.jpg" medium="image">
			<media:title type="html">dia_employee2</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/12/dia_type_prop.jpg" medium="image">
			<media:title type="html">dia_type_prop</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/12/dia_employee3.jpg" medium="image">
			<media:title type="html">dia_employee3</media:title>
		</media:content>
	</item>
		<item>
		<title>Xplanet view of Hurricane Dean</title>
		<link>http://left.subtree.org/2007/08/20/xplanet-view-of-hurricane-dean/</link>
		<comments>http://left.subtree.org/2007/08/20/xplanet-view-of-hurricane-dean/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 02:16:30 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://left.subtree.org/2007/08/20/xplanet-view-of-hurricane-dean/</guid>
		<description><![CDATA[I&#8217;m a big fan of Xplanet and every year during the hurricane season there&#8217;s no better way to liven up your desktop than to download the latest cloud maps and watch the path of the storm. Here&#8217;s a screenshot of my desktop showing hurricane dean (larger view): I cron a script to download the latest [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=21&subd=qnot&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a big fan of <a href="http://xplanet.sourceforge.net/">Xplanet</a> and every year during the hurricane season there&#8217;s no better way to liven up your desktop than to download the latest <a href="http://xplanet.sourceforge.net/clouds.php">cloud maps</a> and watch the path of the storm. Here&#8217;s a screenshot of my desktop showing <a href="http://en.wikipedia.org/wiki/Hurricane_Dean_(2007)">hurricane dean</a> (<a href="http://qnot.files.wordpress.com/2007/08/dean_xplanet_large.jpg">larger view</a>):</p>
<p><a href="http://qnot.files.wordpress.com/2007/08/dean_xplanet_large.jpg"><img src="http://qnot.files.wordpress.com/2007/08/dean_xplanet_large.jpg?w=300&#038;h=196" alt="" title="dean_xplanet_large" width="300" height="196" class="aligncenter size-medium wp-image-168" /></a></p>
<p>I cron a script to download the latest cloud maps every 4 hours or so. The xplanet command I run is as follows:</p>
<pre class="brush: plain;">
xplanet -origin sun -north orbit \
        -config xplanet.conf -label \
        -marker_file brightStars \
        -target earth \
        -latitude 22 \
        -longitude -78 \
        -radius 30 \
        -labelpos +30+30
</pre>
<p>Here&#8217;s my xplanet.conf:</p>
<pre class="brush: plain;">
[earth]
cloud_map=clouds_2048.jpg
magnify=20

[moon]
magnify=20
</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/qnot.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/qnot.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qnot.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qnot.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qnot.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qnot.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qnot.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qnot.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qnot.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qnot.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qnot.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qnot.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=21&subd=qnot&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://left.subtree.org/2007/08/20/xplanet-view-of-hurricane-dean/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">sigma110</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/08/dean_xplanet_large.jpg?w=300" medium="image">
			<media:title type="html">dean_xplanet_large</media:title>
		</media:content>
	</item>
		<item>
		<title>Rotate Labels JFreeChart</title>
		<link>http://left.subtree.org/2007/08/14/rotate-labels-jfreechart/</link>
		<comments>http://left.subtree.org/2007/08/14/rotate-labels-jfreechart/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 03:06:55 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://left.subtree.org/2007/08/14/rotate-labels-jfreechart/</guid>
		<description><![CDATA[When creating a chart that has rather long labels for the x-axis it is sometimes desirable to rotate them a bit so they fit on the plot. The method to use is setCategoryLabelPositions(..) on the CategoryAxis class. Here&#8217;s a quick example: And the code.. import java.io.File; import java.io.IOException; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartUtilities; import org.jfree.chart.ChartColor; import [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=17&subd=qnot&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>When creating a chart that has rather long labels for the x-axis it is sometimes desirable to rotate them a bit so they fit on the plot. The method to use is <code>setCategoryLabelPositions(..)</code> on the <code>CategoryAxis</code> class. Here&#8217;s a quick example:</p>
<p><img src="http://qnot.files.wordpress.com/2007/08/rotate_labels.png?w=400&#038;h=300" alt="" title="rotate_labels" width="400" height="300" class="aligncenter size-full wp-image-172" /></p>
<p>And the code..</p>
<pre class="brush: java; highlight: [38];">
import java.io.File;
import java.io.IOException;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.ChartColor;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.data.category.DefaultCategoryDataset;

public class RotateLabels {
    public static void main(String[] args) {
        DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
        dataSet.addValue(51, &quot;series&quot;, &quot;Colonel Forbin&quot;);
        dataSet.addValue(92, &quot;series&quot;, &quot;The Lizards&quot;);
        dataSet.addValue(33, &quot;series&quot;, &quot;Wilson&quot;);
        dataSet.addValue(77, &quot;series&quot;, &quot;Rutherford the Brave&quot;);
        dataSet.addValue(37, &quot;series&quot;, &quot;The Unit Monster&quot;);
        dataSet.addValue(97, &quot;series&quot;, &quot;The Famous Mockingbird&quot;);
        dataSet.addValue(67, &quot;series&quot;, &quot;Poster Nutbag&quot;);

        JFreeChart chart = ChartFactory.createBarChart(
            &quot;Gamehendge&quot;,
            null,
            null,
            dataSet,
            PlotOrientation.VERTICAL,
            false,
            false,
            false
        );

        CategoryPlot plot = (CategoryPlot)chart.getPlot();
        CategoryAxis xAxis = (CategoryAxis)plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBackgroundPaint(ChartColor.WHITE);
        try {
            ChartUtilities.saveChartAsPNG(new File(&quot;chart.png&quot;), chart, 400, 300);
        } catch(IOException e) {
            e.printStackTrace();
        }
    }
}
</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/qnot.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/qnot.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qnot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qnot.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qnot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qnot.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qnot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qnot.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qnot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qnot.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qnot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qnot.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=17&subd=qnot&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://left.subtree.org/2007/08/14/rotate-labels-jfreechart/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">sigma110</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/08/rotate_labels.png" medium="image">
			<media:title type="html">rotate_labels</media:title>
		</media:content>
	</item>
		<item>
		<title>MySQL bigint types and iBATIS</title>
		<link>http://left.subtree.org/2007/07/16/mysql-bigint-types-and-ibatis/</link>
		<comments>http://left.subtree.org/2007/07/16/mysql-bigint-types-and-ibatis/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 21:22:37 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://left.subtree.org/2007/07/16/mysql-bigint-types-and-ibatis/</guid>
		<description><![CDATA[One nuance I recently ran into while using iBATIS was inserting data into MySQL bigint unsigned columns. iBATIS doesn&#8217;t seem to have a way to handle BigInteger data types and throws an exception when attempting to do an insert. Fetching data out seemed to work OK because if iBATIS doesn&#8217;t know how to handle a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=15&subd=qnot&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>One nuance I recently ran into while using <a href="http://ibatis.apache.org/">iBATIS</a> was inserting data into <a href="http://www.mysql.com/">MySQL</a> bigint unsigned columns. iBATIS doesn&#8217;t seem to have a way to handle BigInteger data types and throws an exception when attempting to do an insert. Fetching data out seemed to work OK because if iBATIS doesn&#8217;t know how to handle a certain type it just returns a java.lang.Object. The way to go about inserting BigInteger types is to set up a type handler. Here&#8217;s an example type handler for BigInteger types:</p>
<pre class="brush: java;">
package org.qnot.util;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.SQLException;
import java.sql.Types;

import com.ibatis.sqlmap.client.extensions.ParameterSetter;
import com.ibatis.sqlmap.client.extensions.ResultGetter;
import com.ibatis.sqlmap.client.extensions.TypeHandlerCallback;

public class BigIntegerTypeHandler implements TypeHandlerCallback {

    public Object getResult(ResultGetter getter) throws SQLException {
        if(getter.wasNull()) {
            return null;
        }

        Object o = getter.getObject();
        if(o instanceof BigDecimal) {
            BigDecimal bd = (BigDecimal)o;
            return bd.toBigInteger();
        } else if(o instanceof BigInteger) {
            return (BigInteger)o;
        } else {
            return o;
        }
    }

    public void setParameter(ParameterSetter setter, Object parameter)
            throws SQLException {
        if (parameter == null) {
            setter.setNull(Types.BIGINT);
        } else {
            BigInteger i = (BigInteger) parameter;
            setter.setBigDecimal(new BigDecimal(i));
        }
    }

    public Object valueOf(String s) {
        return s;
    }
}
</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/qnot.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/qnot.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qnot.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qnot.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qnot.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qnot.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qnot.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qnot.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qnot.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qnot.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qnot.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qnot.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=15&subd=qnot&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://left.subtree.org/2007/07/16/mysql-bigint-types-and-ibatis/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">sigma110</media:title>
		</media:content>
	</item>
		<item>
		<title>Buffalo Going Green</title>
		<link>http://left.subtree.org/2007/07/13/buffalo-going-green/</link>
		<comments>http://left.subtree.org/2007/07/13/buffalo-going-green/#comments</comments>
		<pubDate>Sat, 14 Jul 2007 04:12:02 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://left.subtree.org/2007/07/13/buffalo-going-green/</guid>
		<description><![CDATA[Eight windmills now line up the shore of Lake Erie at the site which was once home to the old Bethlehem Steel plant. It&#8217;s exciting to see Buffalo on the forefront of renewable energy and this new wind farm dubbed &#8220;Steel Winds&#8221; is the first urban wind farm in the country. It&#8217;s also the world&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=20&subd=qnot&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Eight windmills now line up the shore of Lake Erie at the site which was once home to the old <a href="http://en.wikipedia.org/wiki/Bethlehem_Steel">Bethlehem Steel</a> plant. It&#8217;s exciting to see Buffalo on the forefront of renewable energy and this new wind farm dubbed &#8220;Steel Winds&#8221; is the first urban wind farm in the country.  It&#8217;s also the world&#8217;s first commercial project to use Clipper Windpower&#8217;s <a href="http://www.clipperwind.com/techspecs.php">Liberty series turbines</a>.</p>
<p>Here&#8217;s some quick stats about the turbines:</p>
<ul>
<li>Stand approximately 255 feet tall (410 feet with blades extended)</li>
<li>Can potentially produce 20 megawatts of pollution-free electric power</li>
<li>Could provide the annual electrical needs of more than 6,000 homes</li>
<li>Total project cost around $40 million</li>
</ul>
<p>There&#8217;s also talk about expanding the project to include as many as 19 additional windmills.</p>
<p><img src="http://qnot.files.wordpress.com/2007/07/windmills.jpg?w=450&#038;h=338" alt="" title="windmills" width="450" height="338" class="aligncenter size-full wp-image-176" style="border:1px solid #ccc;" /></p>
<div style="font-size:x-small;margin-top:25px;">
Sources:<br />
1. <a href="http://www.buffaloniagara.org/Home/LatestNews/WindmillPoweraReality">http://www.buffaloniagara.org/Home/LatestNews/WindmillPoweraReality</a><br />
2. <a href="http://buffalo.bizjournals.com/buffalo/stories/2007/06/04/daily21.html">http://buffalo.bizjournals.com/buffalo/stories/2007/06/04/daily21.html</a><br />
3. <a href="http://buffalo.bizjournals.com/buffalo/stories/2007/04/16/story9.html">http://buffalo.bizjournals.com/buffalo/stories/2007/04/16/story9.html</a>
</div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/qnot.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/qnot.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qnot.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qnot.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qnot.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qnot.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qnot.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qnot.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qnot.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qnot.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qnot.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qnot.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=20&subd=qnot&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://left.subtree.org/2007/07/13/buffalo-going-green/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">sigma110</media:title>
		</media:content>

		<media:content url="http://qnot.files.wordpress.com/2007/07/windmills.jpg" medium="image">
			<media:title type="html">windmills</media:title>
		</media:content>
	</item>
		<item>
		<title>Customizing Pidgin Chat Windows</title>
		<link>http://left.subtree.org/2007/07/06/customizing-pidgin-chat-windows/</link>
		<comments>http://left.subtree.org/2007/07/06/customizing-pidgin-chat-windows/#comments</comments>
		<pubDate>Sat, 07 Jul 2007 05:53:55 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://left.subtree.org/2007/07/06/customizing-pidgin-chat-windows/</guid>
		<description><![CDATA[In my previous post I discussed customizing Gaim chat windows. Since then Gaim has formally changed it&#8217;s name to Pidgin due to legal issues with AOL. I finally upgraded to Pidgin and had to do a few minor tweaks to get the same chat window customizations as before. I updated ~/.purple/gtkrc-2.0 which previously resided in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=19&subd=qnot&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>In my <a href="/2007/01/14/customizing-gaim-chat-windows/">previous post</a> I discussed customizing Gaim chat windows. Since then Gaim has formally changed it&#8217;s name to <a href="http://pidgin.im/pidgin/home/">Pidgin</a> due to <a href="http://pidgin.im/~elb/cgi-bin/pyblosxom.cgi/going_public.html">legal issues with AOL</a>. I finally upgraded to Pidgin and had to do a few minor tweaks to get the same chat window customizations as before. I updated <code>~/.purple/gtkrc-2.0</code> which previously resided in <code>~/.gaim</code> and changed the widget names from <code>gaim_gtkconv_*</code> to <code>pidgin_conv_*</code>. Here&#8217;s my updated <code>~/.purple/gtkrc-2.0</code> file:</p>
<pre class="brush: plain;">
style &quot;pidgin-dark&quot; {
    base[NORMAL]=&quot;#000000&quot;
    text[NORMAL]=&quot;#00FF00&quot;
    GtkIMHtml::hyperlink-color=&quot;#007FFF&quot;
    GtkWidget::cursor-color=&quot;#60AFFE&quot;
    GtkWidget::secondary-cursor-color=&quot;#A4D3EE&quot;
}
widget &quot;*pidgin_conv_imhtml&quot; style &quot;pidgin-dark&quot;
widget &quot;*pidgin_conv_entry&quot; style &quot;pidgin-dark&quot;
</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/qnot.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/qnot.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qnot.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qnot.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qnot.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qnot.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qnot.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qnot.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qnot.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qnot.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qnot.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qnot.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=19&subd=qnot&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://left.subtree.org/2007/07/06/customizing-pidgin-chat-windows/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">sigma110</media:title>
		</media:content>
	</item>
		<item>
		<title>phpLDAPadmin and Kerberos</title>
		<link>http://left.subtree.org/2007/06/26/phpldapadmin-and-kerberos/</link>
		<comments>http://left.subtree.org/2007/06/26/phpldapadmin-and-kerberos/#comments</comments>
		<pubDate>Wed, 27 Jun 2007 02:56:55 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://left.subtree.org/2007/06/26/phpldapadmin-and-kerberos/</guid>
		<description><![CDATA[I&#8217;ve been experimenting with phpLDAPadmin for browsing/searching LDAP directories over the web and found it to be a wonderful tool. I&#8217;m currently working with LDAP in a central authentication system together with Kerberos and wanted to have a nice web interface for managing user information within the LDAP directory. phpLDAPadmin provides a very nice interface [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=16&subd=qnot&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been experimenting with <a href="http://phpldapadmin.sourceforge.net/">phpLDAPadmin</a> for browsing/searching LDAP directories over the web and found it to be a wonderful tool. I&#8217;m currently working with LDAP in a central authentication system together with Kerberos and wanted to have a nice web interface for managing user information within the LDAP directory. phpLDAPadmin provides a very nice interface for browsing, searching, and updating entries which makes it a bit easier than working with the ldap* command line tools. Here&#8217;s my basic setup of phpLDAPadmin using Kerberos for authentication. This assumes you already have an LDAP/Kerberos setup working and are using Apache as your web server.</p>
<p>First step is to make sure you have <a href="http://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer">SASL</a> support compiled into the LDAP PHP extension <code>--with-ldap-sasl</code>. Check out phpinfo() and make sure you see <code>SASL Support   Enabled</code> under the LDAP extension. If not re-compile PHP.<br />
<span id="more-16"></span><br />
Grab a copy of phpLDAPadmin <a href="http://phpldapadmin.sourceforge.net/download.php">here</a> and untar into a directory of your choice (/usr/local). Copy the config.php.example to config.php:</p>
<pre class="brush: plain; light: true;">
$ tar -xvxf phpldapadmin-x.x.x.tar.gz
$ ln -s phpldapadmin-x.x.x phpldapadmin
$ cd phpldapadmin
$ cp config/config.php.example config/config.php
</pre>
<p>Edit config/config.php. A few options to define are as follows:</p>
<pre class="brush: php;">
$ldapservers-&gt;SetValue($i,'server','name','My LDAP Server');
$ldapservers-&gt;SetValue($i,'server','host','ldap.host.com');
$ldapservers-&gt;SetValue($i,'server','port','389');
$ldapservers-&gt;SetValue($i,'server','auth_type','config');
$ldapservers-&gt;SetValue($i,'login','dn','');
$ldapservers-&gt;SetValue($i,'login','pass','');
$ldapservers-&gt;SetValue($i,'server','tls',false);
$ldapservers-&gt;SetValue($i,'server','sasl_auth',true);
$ldapservers-&gt;SetValue($i,'server','sasl_mech','GSSAPI');
$ldapservers-&gt;SetValue($i,'server','sasl_authz_id_regex','/^uid=([^,]+)(.+)/i');
$ldapservers-&gt;SetValue($i,'server','sasl_authz_id_replacement','$1');
$ldapservers-&gt;SetValue($i,'login','anon_bind',false);
</pre>
<p>Basically, we&#8217;re configuring phpLDAPadmin with <code>auth_type = config</code> which means that the user/pass used to bind to the LDAP server is hard coded in the config.php file. We leave the user/pass blank because each user will first be authenticating through Kerberos and using their tickets to bind to the LDAP server. Internally phpLDAPadmin calls the <code><a href="http://us.php.net/manual/en/function.ldap-sasl-bind.php">ldap_sasl_bind(..)</a></code> function with an <code>auth_mech of <a href="http://en.wikipedia.org/wiki/Generic_Security_Services_Application_Program_Interface">GSSAPI</a></code> which does the work of binding using Kerberos tickets.</p>
<p>Next, we&#8217;ll configure apache to point to the location where we installed phpLDAPadmin. Edit your httpd.conf file or equivalent. If your running redhat usually create a file in /etc/httpd/conf.d or on Debian /etc/apache2/site-available/. You will probably want to add this to an SSL vhost to ensure your username/passwords are transmitted over a secure connection.</p>
<pre class="brush: plain;">
Alias /ldapadmin /usr/local/phpldapadmin/htdocs/
&lt;Location /ldapadmin&gt;
    AuthType Kerberos
    AuthName &quot;LDAP Admin&quot;
    KrbAuthRealms kerb.yourhost.com
    KrbVerifyKDC off
    KrbServiceName HTTP
    Krb5KeyTab /path/to/your/httpd.keytab
    KrbSaveCredentials on
    require valid-user
&lt;/Location&gt;
</pre>
<p>In order to authenticate users against Kerberos and obtain the necessary Kerberos tickets we use the apache module <a href="http://modauthkerb.sourceforge.net/">mod_auth_kerb</a>. The apache config above defines our location for phpLDAPadmin and adds in the necessary config for mod_auth_kerb. More info can be found <a href="http://modauthkerb.sourceforge.net/configure.html">here</a>. Make sure to add in the <code>KrbSaveCredentails on</code> directive so that mod_auth_kerb will save the Kerberos tickets for use throughout the request.</p>
<p>Next we need to expose the location of the Kerberos tickets to phpLDAPadmin. mod_auth_kerb sets an environment variable <code>KRB5CCNAME</code> to the location of the credential cache. To expose this environment variable to the phpLDAPadmin code edit the file <code>[phpLDAPadmin_install]/lib/common.php</code> and add this line to the very top:</p>
<pre class="brush: php; light: true;">
putenv(&quot;KRB5CCNAME={$_SERVER['KRB5CCNAME']}&quot;);
</pre>
<p>That should do it. Now when you access http://yourserver.com/ldapadmin you should be challenged with HTTP basic auth, which authenticates against Kerberos and uses the Kerberos credentials to bind to your LDAP server. There might be an easier way to go about doing this but I wasn&#8217;t able to turn much up on google so I thought I&#8217;d share one way I was able to get things working.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/qnot.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/qnot.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qnot.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qnot.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qnot.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qnot.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qnot.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qnot.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qnot.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qnot.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qnot.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qnot.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=left.subtree.org&blog=13566420&post=16&subd=qnot&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://left.subtree.org/2007/06/26/phpldapadmin-and-kerberos/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">sigma110</media:title>
		</media:content>
	</item>
	</channel>
</rss>