<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>418 I&apos;m a teapot</title>
    <link rel="alternate" type="text/html" href="http://little418.com/" />
    <link rel="self" type="application/atom+xml" href="http://little418.com/atom.xml" />
    <id>tag:little418.com,2009-05-14://4</id>
    <updated>2010-06-10T18:47:10Z</updated>
    <subtitle>The resulting entity body MAY be short and stout.</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.25</generator>

<entry>
    <title>Grails Dependency Manager Woes - This version of SLF4J requires log4j version 1.2.12 or later</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/06/grails-dependency-manager-woes---this-version-of-slf4j-requires-log4j-version-1212-or-later.html" />
    <id>tag:little418.com,2010://4.422</id>

    <published>2010-06-10T18:38:03Z</published>
    <updated>2010-06-10T18:47:10Z</updated>

    <summary>With the release of Grails 1.3.1 we decided that it was finally time to stop our &#8216;copy all the jars to lib&#8217; process and use the awesome dependency manager. As with any move from static lib directory to a smarter dependency manager we ran into some puzzling issues. One engineer set it all up and it worked great on our build system, but then about 50% of our engineers ran into some strange issues including this one which prevented any grails scripts from running: ... SLF4J: This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version SLF4J:...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
        <category term="Groovy on Grails" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="dependency" label="dependency" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="error" label="error" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="grails131" label="grails 1.3.1" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="groovy" label="groovy" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ivy" label="ivy" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>With the release of Grails 1.3.1 we decided that it was finally time to stop our &#8216;copy all the jars to lib&#8217; process and use the <a href="http://grails.org/Ivy+Integration">awesome dependency manager</a>.  </p>

<p>As with any move from static lib directory to a smarter dependency manager we ran into some puzzling issues.  One engineer set it all up and it worked great on our build system, but then about 50% of our engineers ran into some strange issues including this one which prevented any grails scripts from running:</p>

<pre class="brush: bash">
...
SLF4J: This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/john_doe/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/john_doe/.ivy2/cache/org.slf4j/nlog4j/jars/nlog4j-1.2.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
...
</pre>

<p>Hacking around randomly seemed to fix it in every case.   Here&#8217;s the crude process we ended up following to resolve these strange issues:</p>

<ol>
<li>Purge the local caches by deleting <code>~/.ivy</code> and <code>~/.grails</code></li>
<li>Reboot (Yes this fixed the problem for someone&#8230; go figure)</li>
<li>Run <code>grails upgrade</code> over and over until it started working</li>
</ol>

<p>What is the root cause?  I have no idea.  Perhaps our dependency on the public repositories is to blame: one should never trust a free third party service.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Groovy Deadlocks</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/05/groovy-deadlocks.html" />
    <id>tag:little418.com,2010://4.421</id>

    <published>2010-05-28T02:01:45Z</published>
    <updated>2010-06-18T22:30:10Z</updated>

    <summary>Today I managed to set up my grails environment in such a way that it triggered deadlocks quite easily when stressed with a simple jmeter script. While this was unintentional, it did give me an opportunity to diffuse some ticking time bombs. A few of the deadlocks were caused by some of the creative ways that my project uses the Groovy on Grails APIs for rendering pages from GSP code stored in a database, and with some tweaks most of those were resolved. Some other deadlocks, though, seem to be the fault of Groovy itself. A quick google search turned...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
        <category term="Groovy on Grails" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>Today I managed to set up my grails environment in such a way that it triggered deadlocks quite easily when stressed with a simple <a href="http://jakarta.apache.org/jmeter/">jmeter</a> script.  While this was unintentional, it did give me an opportunity to diffuse some ticking time bombs.  </p>

<p>A few of the deadlocks were caused by some of the creative ways that my project uses the Groovy on Grails APIs for rendering pages from GSP code stored in a database, and with some tweaks most of those were resolved.</p>

<p>Some other deadlocks, though, seem to be the fault of Groovy itself.  A quick google search turned up over 300 hits relating to deadlocks in the Groovy bug tracker:</p>

<p>http://www.google.com/search?hl=en&amp;q=site:jira.codehaus.org+%2Bgroovy+%2Bdeadlock</p>

<p>This is when I had a sad.</p>

<p>I know that as an open source project if a bug really bothers me, I should submit a patch, which I am likely to do, but even if I find fixes for some of the deadlocks I&#8217;m facing, I&#8217;ll either have to wait for the changes to make it into the Groovy codebase, Groovy to release, grails to pick up the changes, etc. or I&#8217;ll have to hack the patch into my application and hope for the best.</p>

<p>Hopefully I&#8217;ll find some magic work around that does not tickle these bugs :)</p>

<p><strong>Update</strong>: Someone must have seen this blog entry, or maybe they&#8217;re just cool.  Anyway, they fixed this problem wicked fast: http://jira.codehaus.org/browse/GRAILS-6398  Grails continues to rock as a result.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>iPad and OneNote</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/05/ipad-and-onenote.html" />
    <id>tag:little418.com,2010://4.420</id>

    <published>2010-05-26T19:22:39Z</published>
    <updated>2010-05-28T02:01:16Z</updated>

    <summary>Tablet computing is one technology that I&#8217;ve been attempting to early-adopt for years, but it&#8217;s never quite been there. What I&#8217;ve always dreamed of is the PADD device that everyone walked around with in Star Trek TNG: A small, light, sleek, multifunctional device that accepts pen input, accepts touch input, and is reasonable to carry around. Around 2003 I purchased a Toshiba m200. It was a hybrid Windows XP Tablet computer. It had a keyboard but could also be converted into tablet mode. The operating system was a clunky afterthought on Windows XP, but it did have one shining star...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
    <category term="ipad" label="ipad" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>Tablet computing is one technology that I&#8217;ve been attempting to early-adopt for years, but it&#8217;s never quite been there.  What I&#8217;ve always dreamed of is the <a href="http://memory-alpha.org/wiki/PADD">PADD</a> device that everyone walked around with in Star Trek TNG: A small, light, sleek, multifunctional device that accepts pen input, accepts touch input, and is reasonable to carry around.</p>

<p>Around 2003 I purchased a <a href="http://reviews.cnet.com/Toshiba_Portege_M200_tablet_PC/1707-3126_7-30596988.html">Toshiba m200</a>.  It was a hybrid Windows XP Tablet computer.  It had a keyboard but could also be converted into tablet mode.  The operating system was a clunky afterthought on Windows XP, but it did have one shining star in the product offering (and it was not stupid marble game).  It was OneNote.  At the time everything Microsoft made seemed clunky and over-complicated, but OneNote did everything that made sense, and nothing else.  It was, and still is, a great product.  </p>

<p>I stopped using it, though.  The application was great, but the operating system and hardware were just not there yet.  Also people kept asking me why I was drawing on my laptop (since tablet computers were still fringe).</p>

<p>Now its 2010.  Everyone has heard of the iPad.  Tablet computing has gone mainstream but there does not seem to be a single killer OneNote like application for the iPad.  This may have something to do with the lack of an included stylus.  This void, however, can be filled using a combination of applications.</p>

<p>First off, you&#8217;ll need a system for organizing those notes.  This is where <a href="http://itunes.apple.com/us/app/evernote/id281796108?mt=8">Evernote</a> comes in handy.  The interface is clean, it supports <a href="http://www.evernote.com/about/learn_more/">cool features</a> like automatic geotagging and you can even attach voice sound clips to your notes.  Even better than OneNote, it supports automatic synchronization between all sorts of devices.  It&#8217;s pretty mature, and has been around for awhile, but the iPad is the killer device for this service.  </p>

<p>Unfortunately, since it started as a web browser / desktop application, Evernote does not yet allow you to scribble those quick notes.  On the bright side it does allow you to email content to your primary notebook, and this is the trick.</p>

<p>For your stylus sketches and note taking, go grab a copy of <a href="http://itunes.apple.com/us/app/penultimate/id354098826?mt=8">Penultimate</a>.  Of the dozen or so drawing / sketching / scribbling apps I&#8217;ve tried, this one is by far the best.  Input is clean and precise.  It is also the only one I&#8217;ve found that works while your wrist is rested on the screen, which makes scribbling a lot more comfortable.</p>

<p>Once you&#8217;re done with that scribbled note in penultimate, use the &#8216;email this note&#8217; feature to fire it off to Evernote.  A quick synchronisation and there it will appear in your notebook.</p>

<p>It&#8217;s not perfect yet, and it&#8217;s a bit awkward, but it works well enough for me!</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Checking opensolaris physical memory inside a zone</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/05/checking-opensolaris-physical-memory-inside-a-zone.html" />
    <id>tag:little418.com,2010://4.419</id>

    <published>2010-05-04T20:55:36Z</published>
    <updated>2010-05-04T21:00:34Z</updated>

    <summary>Joyent uses OpenSolaris zones for its accelerators. At some point I needed to verify the physical memory size of one of these zones but was unable to use the webmin tool that Joyent provides. This seemingly simple operation was actually pretty tricky to figure out. Here are the steps I followed: $ sudo rcapadm -E state: enabled memory cap enforcement threshold: 0% process scan rate (sec): 15 reconfiguration rate (sec): 60 report rate (sec): 5 RSS sampling rate (sec): 5 $ rcapstat -z 1 1 id zone nproc vm rss cap at avgat pg avgpg 46 foo - 0K 0K...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
        <category term="Joyent" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Solaris 10" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="joyent" label="joyent" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="opensolaris" label="opensolaris" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>Joyent uses OpenSolaris zones for its accelerators.  At some point I needed to verify the physical memory size of one of these zones but was unable to use the webmin tool that Joyent provides.  This seemingly simple operation was actually pretty tricky to figure out.  Here are the steps I followed:</p>

<pre class="brush: bash"> 
$ sudo rcapadm -E
                                      state: enabled
           memory cap enforcement threshold: 0%
                    process scan rate (sec): 15
                 reconfiguration rate (sec): 60
                          report rate (sec): 5
                    RSS sampling rate (sec): 5
$ rcapstat -z 1 1
    id zone            nproc    vm   rss   cap    at avgat    pg avgpg
    46 foo            -    0K    0K 2048M    0K    0K    0K    0K
$ sudo rcapadm -D
                                      state: disabled
           memory cap enforcement threshold: 0%
                    process scan rate (sec): 15
                 reconfiguration rate (sec): 60
                          report rate (sec): 5
                    RSS sampling rate (sec): 5
$ 
</pre>

<p><code>rcapadm</code> seems to be a resource management tool.  I&#8217;m not sure if there&#8217;s an impact to leaving it running, but I disabled it just in case.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Grails Override Configuration with Properties File</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/04/grails-override-configuration-with-properties-file.html" />
    <id>tag:little418.com,2010://4.417</id>

    <published>2010-04-06T23:30:25Z</published>
    <updated>2010-04-07T00:32:24Z</updated>

    <summary>Sometimes you will need to switch up configuration in a hurry. For example, you may need to switch the database connection URL in order to use your warm standby database. This can be a pain in Grails because the convient-during-development Config.groovy is compiled both by grails run-app and grails war. The simplest way to change configuration without rebuilding and redeploying your Grails application is to make use of an externalized configuration file. Although would appear to be very straight forward based on the docs, you will need to jump through a couple undocumented hoops to get it working in all...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
        <category term="Groovy on Grails" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="configuration" label="configuration" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="grailsv12" label="grails v1.2" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>Sometimes you will need to switch up configuration in a hurry.  For example, you may need to switch the database connection URL in order to use your warm standby database.  This can be a pain in Grails because the convient-during-development Config.groovy is compiled both by grails run-app and grails war.</p>

<p>The simplest way to change configuration without rebuilding and redeploying your Grails application is to make use of an externalized configuration file.  Although would appear to be very straight forward based on the docs, you will need to jump through a couple undocumented hoops to get it working in all environments.</p>

<ol>
<li>Create your override configuration file in the grails-app/conf folder.  I called mine override.conf.  For now you can leave it empty.</li>
<li>Enable this external configuration file by pasting this into the top of your grails-app/conf/Config.groovy file: </li>
</ol>

<pre class="brush: groovy">grails.config.locations = [ "classpath:override.properties"  ]</pre>  This is where the docs end.  When you start up grails you&#8217;ll see the following error message:
<pre class="brush: groovy">Unable to load specified config location classpath:override.properties : class path resource [override.properties] cannot be opened because it does not exist</pre>
 1.  Grails uses different paths in run-app mode and when being run as a war.  We&#8217;re going to need to add a step post compilation to ensure our configuration file is available at all times.  We&#8217;ll do this by modifying <code>_Events.groovy</code> (or <code>Events.groovy</code> if you&#8217;ve been migrating your grails app since v1.1).  Open <code>scripts/_Events.groovy</code>, or create it if it does not exist.
 1.  Add the following to _Events.groovy (or merge it in if you already have an <code>eventCompileEnd</code> defined):
<pre class="brush: groovy">
eventCompileEnd = {
    ant.copy(todir:classesDirPath) {
      fileset(file:"${basedir}/grails-app/conf/override.properties")
    }
}
</pre>

<ol>
<li>Try setting a new property and fire up grails as usual.  For example, if you want to set the database URL, you&#8217;d add this to your grails-app/conf/override.properties file:</li>
</ol>

<pre class="brush: groovy">
dataSource.url=jdbc:postgresql://example.host/somedb:shutdown=true
</pre> 

<p>Source: <a href="http://n4.nabble.com/classpath-issue-td1356573.html#a1356573">Some Grails - user mailing list post by Ian Roberts</a></p>
]]>
        

    </content>
</entry>

<entry>
    <title>Zeus ZXTM Upgrade Cannot fork: Not enough space</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/03/zeus-zxtm-upgrade-cannot-fork-not-enough-space.html" />
    <id>tag:little418.com,2010://4.416</id>

    <published>2010-03-22T20:15:32Z</published>
    <updated>2010-03-22T21:14:20Z</updated>

    <summary>While upgrading one of my Zeus ZXTM traffic managers from v5.1r2 to v6.0r4 it crashed on startup. This pretty surprising because the upgrade process appeared to have proceeded without a hitch. Here&#8217;s the error I saw in the logs and when I attempted to fire up the zxtm program using SSH: $ ./start-zeus Initializing Zeus Application Framework. (C) 1995 - 2010 Zeus Technology Limited Zeus Administration Server already running: 235 Zeus Traffic Manager - (C) 1995 - 2010 Zeus Technology Limited Version 6.0r4, Build date: Feb 10 2010 08:32:37 Process permissions set to zeus:zeus INFO Zeus Traffic Manager starting INFO...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
        <category term="Joyent" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="upgrade" label="upgrade" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="zeus" label="zeus" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="zxtm" label="zxtm" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>While upgrading one of my Zeus ZXTM traffic managers from v5.1r2 to v6.0r4 it crashed on startup.  This pretty surprising because the upgrade process appeared to have proceeded without a hitch.  Here&#8217;s the error I saw in the logs and when I attempted to fire up the zxtm program using SSH:</p>

<pre class="brush: bash">
$ ./start-zeus
Initializing Zeus Application Framework. (C) 1995 - 2010 Zeus Technology Limited
Zeus Administration Server already running: 235
Zeus Traffic Manager - (C) 1995 - 2010 Zeus Technology Limited
Version 6.0r4, Build date: Feb 10 2010 08:32:37
Process permissions set to zeus:zeus
 INFO   Zeus Traffic Manager starting
 INFO   Version 6.0r4, Build date: Feb 10 2010 08:32:37
 FATAL Parent 1234 hit FATAL at Cannot fork:Not enough space
[0x6ac417] function __1cOcommkeyChanged6FpknNConfigSection_rknKStringBase_pknKConfigFile_p6_nIRetValue__ + 0x417
[0x8d4376] function __1cFFATAL6Fpkc1i_v_ + 0x66
[0x6ad2b3] function __1cUreally_nice_shutdown6F_v_ + 0x883
[0x6b3a3b] function __1cKParentBoot6Fpkc_v_ + 0xa8b
[0x5e83c1] function main + 0x571
[0x5c532c] function _start + 0x6c
[0x0] function ?? + 0xffffffffffa3ad40
$
</pre>

<p>Not enough space?  Something was seriously amiss.  The solution turned out to be pretty simple, but was not something I could find in the manual.</p>

<p>In v6.0, a new configuration parameter was added: <code>shared<em>pool</em>size</code>.  This was not set since I was upgrading from v5.1.  The ZXTM made its best guess, it guessed wrong on my virtualized environment and picked a value that exceeded the memory available to my zone.  The fix was simple: set <code>shared<em>pool</em>size</code> in <code>$ZEUSHOME/zxtm-6.0r4/conf/settings.cfg</code> to a size small enough to fit into my available memory.  Since this configuration did not exist, I mad to add it at the bottom of the file.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>GoDaddy SSL Certificate in Zeus ZXTM Traffic Managers</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/03/godaddy-ssl-certificate-in-zeus-zxtm-traffic-managers.html" />
    <id>tag:little418.com,2010://4.415</id>

    <published>2010-03-04T22:58:45Z</published>
    <updated>2010-03-04T23:13:21Z</updated>

    <summary>Almost a year ago I purchased a wildcard SSL certificate from GoDaddy. When it was first issued I simply loaded it into into my Zeus ZXTM load balancer with the import button. Everything seemed fine for quite awhile. I visited my web site in Firefox and in all of the flavors of IE. It seemed to work great. That is, until, someone called me to let me know that Safari was not accepting the certificate! I thought I was in trouble until I googled around and found many blog entries about the root cause. It turns out that my server,...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
    <category term="godaddy" label="GoDaddy" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ssl" label="SSL" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="zeus" label="Zeus" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>Almost a year ago I purchased a wildcard SSL certificate from GoDaddy.  When it was first issued I simply loaded it into into my Zeus ZXTM load balancer with the import button.  </p>

<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://little418.com/assets_c/2010/03/cert1-23.html" onclick="window.open('http://little418.com/assets_c/2010/03/cert1-23.html','popup','width=728,height=514,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://little418.com/assets_c/2010/03/cert1-thumb-400x282-23.jpg" width="400" height="282" alt="cert1.jpg" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></a></span></p>

<p>Everything seemed fine for quite awhile.  I visited my web site in Firefox and in all of the flavors of IE.  It seemed to work great.  That is, until, someone called me to let me know that Safari was not accepting the certificate!  I thought I was in trouble until I googled around and found <a href="http://www.symphonious.net/2008/06/04/tomcat-os-x-safari-and-godaddy-ssl-certificates/">many</a> <a href="http://blog.boxedice.com/2009/05/11/godaddy-ssl-certificates-and-cannot-verify-identity-on-macsafari/">blog entries</a> about the root cause.  It turns out that my server, or in this case my Zeus ZXTM load balancer, was not configured to display the whole certificate chain back to the root authority.  </p>

<p>This makes me wonder how this worked at all in every other web browser.  Perhaps this is such a common problem that the other browsers hack around it? </p>

<p>Anyway, the fix was easy enough but the terminology was different.  Rather than an SSLCertificateChainFile, my ZXTM called it an &#8216;Intermediate Certificate&#8217;.  One click of a button, browsing to <code>gd_bundle.crt</code> (provided with my original certificate), and it was loaded up and the issue was fixed.</p>

<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://little418.com/assets_c/2010/03/cert2-26.html" onclick="window.open('http://little418.com/assets_c/2010/03/cert2-26.html','popup','width=564,height=405,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://little418.com/assets_c/2010/03/cert2-thumb-500x359-26.jpg" width="500" height="359" alt="cert2.jpg" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></a></span></p>
]]>
        

    </content>
</entry>

<entry>
    <title>channel 2: open failed: administratively prohibited: open failed</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/03/channel-2-open-failed-administratively-prohibited-open-failed.html" />
    <id>tag:little418.com,2010://4.414</id>

    <published>2010-03-02T23:16:57Z</published>
    <updated>2010-03-02T23:22:28Z</updated>

    <summary>I attempted to set up an SSH tunnel today to access a web application that was only bound to a private IP. I tunneled to my opensolaris box, which worked fine, and then attempted to establish a connection with telnet. Telnet reported that the connection was refused and I saw this on my command line for the tunnel: $ ssh johndoe@foo.bar.com -L 8080:foo.bar.com:8080 -N channel 2: open failed: administratively prohibited: open failed I made a pretty silly mistake, but I figure it may save someone&#8217;s time to post it here. Of course the connection was refused. My ssh tunnel attempts...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
    <category term="opensolaris" label="opensolaris" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="solaris" label="solaris" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="sshtunnel" label="ssh tunnel" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>I attempted to set up an SSH tunnel today to access a web application that was only bound to a private IP.  I tunneled to my opensolaris box, which worked fine, and then attempted to establish a connection with telnet.  Telnet reported that the connection was refused and I saw this on my command line for the tunnel:</p>

<pre class="brush: bash">
$ ssh johndoe@foo.bar.com -L 8080:foo.bar.com:8080 -N
channel 2: open failed: administratively prohibited: open failed
</pre>

<p>I made a pretty silly mistake, but I figure it may save someone&#8217;s time to post it here.  Of course the connection was refused.  My ssh tunnel attempts to establish the connection to the public domain name, which uses the public IP (the same one I&#8217;m SSHing into).  The web server I&#8217;m trying to reach is not bound to that adapter!</p>

<p>Here&#8217;s a correct command:</p>

<pre class="brush: bash">
$ ssh johndoe@foo.bar.com -L 8080:localhost:8080 -N
</pre>
]]>
        

    </content>
</entry>

<entry>
    <title>Java Mime Type Content Type</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/02/java-mime-type-content-type-1.html" />
    <id>tag:little418.com,2010://4.413</id>

    <published>2010-02-25T22:55:37Z</published>
    <updated>2010-02-25T23:03:59Z</updated>

    <summary>I&#8217;ve been working on a Java servlet these days which for many reasons needs to determine the mime type of files so that files being rendered are correctly used by my clients. For example, I&#8217;m generating a crossdomian.xml, which if not matched with the text/xml content type, really confuses flash players. Anyway, I fumbled around for a bit in Google and found one great solution: mime-util. It&#8217;s Apache License and works great. The documentation is even very good. Since I can trust my file names I opted for the simple file name extension detection method. It&#8217;s a perfect fit except...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>I&#8217;ve been working on a Java servlet these days which for many reasons needs to determine the mime type of files so that files being rendered are correctly used by my clients.  For example, I&#8217;m generating a crossdomian.xml, which if not matched with the text/xml content type, really confuses flash players.</p>

<p>Anyway, I fumbled around for a bit in Google and found one great solution: <a href="http://www.medsea.eu/mime-util/">mime-util</a>.  It&#8217;s <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License</a> and works great.  The <a href="http://www.medsea.eu/mime-util/documentation.html">documentation</a> is even very good.  </p>

<p>Since I can trust my file names I opted for the simple file name extension detection method.  It&#8217;s a perfect fit except for one thing: I need to detect the application/json content type which is not part of the default property bundle.</p>

<p>It took me a few minutes of digging trough the JavaDocs to find the answer, so to save you some time, here&#8217;s my solution:</p>

<ol>
<li>Create a file named <code>mime-types.properties</code> and put it somewhere in your class path.  </li>
<li>Add the types you need as extension=type pairs like <code>json=application/json</code></li>
</ol>
]]>
        

    </content>
</entry>

<entry>
    <title>Java Mime Type Content Type</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/02/java-mime-type-content-type.html" />
    <id>tag:little418.com,2010://4.412</id>

    <published>2010-02-25T22:55:37Z</published>
    <updated>2010-02-25T23:03:11Z</updated>

    <summary>I&#8217;ve been working on a Java servlet these days which for many reasons needs to determine the mime type of files so that files being rendered are correctly used by my clients. For example, I&#8217;m generating a crossdomian.xml, which if not matched with the text/xml content type, really confuses flash players. Anyway, I fumbled around for a bit in Google and found one great solution: mime-util. It&#8217;s Apache License and works great. The documentation is even very good. Since I can trust my file names I opted for the simple file name extension detection method. It&#8217;s a perfect fit except...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
        <category term="Java" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="java" label="java" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="json" label="json" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="library" label="library" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>I&#8217;ve been working on a Java servlet these days which for many reasons needs to determine the mime type of files so that files being rendered are correctly used by my clients.  For example, I&#8217;m generating a crossdomian.xml, which if not matched with the text/xml content type, really confuses flash players.</p>

<p>Anyway, I fumbled around for a bit in Google and found one great solution: <a href="http://www.medsea.eu/mime-util/">mime-util</a>.  It&#8217;s <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License</a> and works great.  The <a href="http://www.medsea.eu/mime-util/documentation.html">documentation</a> is even very good.  </p>

<p>Since I can trust my file names I opted for the simple file name extension detection method.  It&#8217;s a perfect fit except for one thing: I need to detect the application/json content type which is not part of the default property bundle.</p>

<p>It took me a few minutes of digging trough the JavaDocs to find the answer, so to save you some time, here&#8217;s my solution:</p>

<ol>
<li>Create a file named <code>mime-types.properties</code> and put it somewhere in your class path.  </li>
<li>Add the types you need as extension=type pairs like <code>json=application/json</code></li>
</ol>
]]>
        

    </content>
</entry>

<entry>
    <title>E575: viminfo: Illegal starting char in line:</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/02/e575-viminfo-illegal-starting-char-in-line.html" />
    <id>tag:little418.com,2010://4.410</id>

    <published>2010-02-18T20:19:56Z</published>
    <updated>2010-02-18T20:27:27Z</updated>

    <summary>Once upon a time I tried to open a file for editing with MacVim and saw this message: $ vi foo.xml E575: viminfo: Illegal starting char in line: ion.properties $ I assumed there was something wrong with the file that I was editing, so I tried a different file. I observed the same result. **The Problem Your .viminfo file is corrupt. This file does not contain settings or anything, mostly temporary and working data. **The Fix Delete your ~/.viminfo file...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
    <category term="editor" label="editor" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="error" label="error" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="vi" label="vi" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="vim" label="vim" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>Once upon a time I tried to open a file for editing with <a href="http://macvim.org/">MacVim</a> and saw this message:</p>

<pre class="brush: bash">
$  vi foo.xml 
E575: viminfo: Illegal starting char in line: ion.properties
$
</pre>

<p>I assumed there was something wrong with the file that I was editing, so I tried a different file.  I observed the same result.</p>

<p><em>*</em>*The Problem
Your .viminfo file is corrupt.  This file does not contain settings or anything, mostly temporary and working data.</p>

<p><em>*</em>*The Fix
Delete your ~/.viminfo file</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Grails restart loop</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/01/grails-restart-loop.html" />
    <id>tag:little418.com,2010://4.409</id>

    <published>2010-01-27T23:35:55Z</published>
    <updated>2010-01-27T23:47:11Z</updated>

    <summary>The Problem The other day I was doing some bulk file operations on a grails project. I was moving some classes in bulk from a plug-in into an application. After I made the move I ran into a puzzling issue: grails kept restarting in a loop. Each time the plugin scanner ran (every 5 seconds after startup), grails would complain that it needed to compile 1 file. This went on for a few minutes until my app ran out of PermGen and crashed. To make matters worse, grails would not tell me which file it was recompiling even with logging...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
        <category term="Groovy on Grails" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="grailsv12" label="grails v1.2" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<h3>The Problem</h3>

<p>The other day I was doing some bulk file operations on a grails project.  I was moving some classes in bulk from a plug-in into an application.  After I made the move I ran into a puzzling issue: grails kept restarting in a loop.  Each time the plugin scanner ran (every 5 seconds after startup), grails would complain that it needed to compile 1 file.  This went on for a few minutes until my app ran out of PermGen and crashed.  To make matters worse, grails would not tell me which file it was recompiling even with logging set to trace!</p>

<p>This seems to be a <a href="http://old.nabble.com/Endless-restart-loop---how-to-find-broken-class--to18482221.html">classic grails issue</a> that is rare, but frustrating. </p>

<h3>The Cause</h3>

<p>The likely cause is a groovy file outside the correct package or with a file name that does not match the case name.  The latter can happen when tinkering around between case sensitive and case insensitive file systems as is common when developing with OS X.</p>

<h3>The Fix</h3>

<p>To fix it you need to find the messed up class and fix it.  The below method is crude, but works.</p>

<ol>
<li>If your app crashes quickly due to PermGen issues, provide more PermGen space.  You&#8217;ll need at least 2 or 3 minutes of run time for this to work.  Use the JVM argument -XX:MaxPermSize=1024m if you have to.</li>
<li>Let your app run for a few minutes.  Let it recompile that file a few times.</li>
<li>If your app has not already crashed, stop it</li>
<li>Now to find the compiled class file.  Go to the directory where grails claims to be compiling the file.  In my case it was in <code>~/.grails/1.2.0/projects/fooApp/classes</code></li>
<li>Run this shell command to see when most of the files were updated: <code>find ./  | xargs ls -al</code>  The vast majority of the listed files should all have an updated time within the same minute.  In my case it was 15:17  Lets fileter those out and see what&#8217;s left behind.</li>
<li>Run another find command and see the newer files: <code>find ./  | xargs ls -al | grep -v 15:17</code>.  I saw a few files and headers that had to be ignored, but in the middle I found the class name which was compiled from a .groovy file of a different name.</li>
<li>Go back to your app code and resolve the conflicted state of your groovy file(s)</li>
<li>Quit cursing under your breath and go have a beer if you need one</li>
</ol>
]]>
        

    </content>
</entry>

<entry>
    <title>Simple Basic Authentication from Java Servlet Example</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2010/01/simple-basic-authentication-from-java-servlet-example.html" />
    <id>tag:little418.com,2010://4.408</id>

    <published>2010-01-04T19:13:17Z</published>
    <updated>2010-01-04T19:24:56Z</updated>

    <summary><![CDATA[Basic Auth is a very simple way to secure your web application. When combined with a secure transport technology like SSL, it&#8217;s also good enough in most cases. Here is a dirt simple example of how to access the basic authentication information from the HTTP header in your servlet. protected void doGet(HttpServletRequest request, HttpServletResponse response) { String pathInfo = request.getPathInfo(); //will contain "Basic Ym9iOnNlY3JldA==" String header = request.getHeader(&quot;Authorization&quot;); //always wise to assert your assumptions assert header.substring(0, 6).equals(&quot;Basic &quot;); //will contain "Ym9iOnNlY3JldA==" String basicAuthEncoded = header.substring(6); //will contain "bob:secret" String basicAuthAsString = new String( new Base64().decode(basicAuthEncoded.getBytes())); ... } You can test...]]></summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
        <category term="Java" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="example" label="example" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="java" label="java" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="security" label="security" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p><a href="http://en.wikipedia.org/wiki/Basic_access_authentication">Basic Auth</a> is a very simple way to secure your web application.  When combined with a secure transport technology like SSL, it&#8217;s also good enough in most cases.</p>

<p>Here is a dirt simple example of how to access the basic authentication information from the HTTP header in your servlet.</p>

<pre class="brush: java">
protected void doGet(HttpServletRequest request, HttpServletResponse response) {
    String pathInfo = request.getPathInfo();
    //will contain "Basic Ym9iOnNlY3JldA=="
    String header = request.getHeader(&quot;Authorization&quot;); 
    //always wise to assert your assumptions
    assert header.substring(0, 6).equals(&quot;Basic &quot;); 
    //will contain "Ym9iOnNlY3JldA=="
    String basicAuthEncoded = header.substring(6);
    //will contain "bob:secret"
    String basicAuthAsString = new String(
        new Base64().decode(basicAuthEncoded.getBytes()));
    ...
}
</pre>

<p>You can test it with this curl command:</p>

<pre class="brush: bash">
$  curl -vv http://bob:secret@localhost:8090/blah
* About to connect() to localhost port 8090 (#0)
*   Trying ::1... connected
* Connected to localhost (::1) port 8090 (#0)
* Server auth using Basic with user 'bob'
 GET /blah HTTP/1.1
 Authorization: Basic Ym9iOnNlY3JldA==
 User-Agent: curl/7.19.4 (universal-apple-darwin10.0) libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3
 Host: localhost:8090
 Accept: */*
...
</pre>
]]>
        

    </content>
</entry>

<entry>
    <title>grails Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: org/codehaus/groovy/grails/cli/support/GrailsStarter</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2009/12/grails-exception-in-thread-main-javalangnoclassdeffounderror-orgcodehausgroovygrailsclisupportgrails.html" />
    <id>tag:little418.com,2009://4.407</id>

    <published>2009-12-31T21:35:57Z</published>
    <updated>2009-12-31T21:50:45Z</updated>

    <summary>Maybe you just upgraded Groovy on Grails, or maybe you&#8217;re doing a fresh install. Either way you may be confronted with this curious error message: $ grails test Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: org/codehaus/groovy/grails/cli/support/GrailsStarter What&#8217;s wrong? You have a grails mismatch. Your GRAILS_HOME environment variable is not pointing to the same place as the grails in your PATH. Make them agree and try your grails command again....</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
        <category term="Groovy on Grails" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="configuration" label="configuration" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="error" label="error" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="grails" label="grails" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>Maybe you just upgraded Groovy on Grails, or maybe you&#8217;re doing a fresh install.  Either way you may be confronted with this curious error message:</p>

<pre class="brush: bash">
$ grails test
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/grails/cli/support/GrailsStarter
</pre>

<p>What&#8217;s wrong?  You have a grails mismatch.  Your GRAILS_HOME environment variable is not pointing to the same place as the grails in your PATH.   Make them agree and try your grails command again.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>System call sent warnings to stderr: pst3: This program can only be run  by the root user!</title>
    <link rel="alternate" type="text/html" href="http://little418.com/2009/12/system-call-sent-warnings-to-stderr-pst3-this-program-can-only-be-run-by-the-root-user.html" />
    <id>tag:little418.com,2009://4.406</id>

    <published>2009-12-08T02:49:59Z</published>
    <updated>2009-12-08T02:55:30Z</updated>

    <summary>I ran into this very cryptic one while setting up Nagios at Joyent. I copied my plugins from one nrpe client to a new server. Three of my checks used check_procs which all failed with a message like this: check_procs System call sent warnings to stderr: pst3: This program can only be run by the root user! To make this even more annoying, sudo did not fix it. The same error message was displayed. What was the problem? File permissions! The error message should say &#8220;This program must be owned by the root user!&#8221; The fix: sudo chmod root:root pst3...</summary>
    <author>
        <name>Author</name>
        <uri>http://little418.com/cms/mt-cp.cgi?__mode=view&amp;blog_id=4&amp;id=1</uri>
    </author>
    
        <category term="Joyent" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Nagios" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Solaris 10" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="error" label="error" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="joyent" label="joyent" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="nagios" label="nagios" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://little418.com/">
        <![CDATA[<p>I ran into this very cryptic one while setting up Nagios at Joyent.  I copied my plugins from one nrpe client to a new server.  Three of my checks used <code>check_procs</code> which all failed with a message like this:</p>

<pre class="brush: bash">
check_procs
System call sent warnings to stderr: pst3: This program can only be run by the root user!
</pre>

<p>To make this even more annoying, <code>sudo</code> did not fix it.  The same error message was displayed.  What was the problem?  File permissions!  The error message should say &#8220;<code>This program must be owned by the root user!</code>&#8221;  The fix:</p>

<pre class="brush: bash">
sudo chmod root:root pst3
</pre>
]]>
        

    </content>
</entry>

</feed>
