<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>What I Learned Today</title>
	
	<link>http://christiansons.net/mike/blog</link>
	<description>Mike Christianson's journal of Java, Ant, SVN, Jetty, cygwin and other stuff.</description>
	<lastBuildDate>Fri, 19 Feb 2010 00:28:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/wilt-blog" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="wilt-blog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Better consoles for cygwin shells</title>
		<link>http://christiansons.net/mike/blog/2010/01/better-consoles-for-cygwin-shells/</link>
		<comments>http://christiansons.net/mike/blog/2010/01/better-consoles-for-cygwin-shells/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 17:00:29 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[cygwin]]></category>
		<category><![CDATA[commandline]]></category>

		<guid isPermaLink="false">http://christiansons.net/mike/blog/?p=436</guid>
		<description><![CDATA[Let&#8217;s face it, cygwin is neat but the console it launches is lame.  I&#8217;m not referring to bash, but rather the normal &#8212; and thus lame &#8212; Windows command box.  Things just don&#8217;t feel right&#8230; some keys don&#8217;t work as expected and forget about making the window wider.  Fortunately, there is a [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s face it, cygwin is neat but the console it launches is lame.  I&#8217;m not referring to bash, but rather the normal &#8212; and thus lame &#8212; Windows command box.  Things just don&#8217;t feel right&#8230; some keys don&#8217;t work as expected and forget about making the window wider.  Fortunately, there is a better way!</p>
<p>Rather, I should say there are better way<em>s</em>: <a href="http://code.google.com/p/puttycyg/">puttycyg</a> and <a href="http://cygwin.com/cgi-bin2/package-grep.cgi?grep=mintty">mintty</a>.  </p>
<p><a href="http://www.smugmug.com/photos/770506088_uoPhz-L.png"><img alt="" src="http://www.smugmug.com/photos/770506088_uoPhz-S.png" title="mintty screenshot" class="aligncenter" width="400" height="269" /></a></p>
<p><a href="http://code.google.com/p/puttycyg/">puttycyg</a> is a patched version of <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">putty</a> with support for cygwin.  <a href="http://cygwin.com/cgi-bin2/package-grep.cgi?grep=mintty">mintty</a> is &#8230; well, yeah, it&#8217;s based on putty, too.</p>
<p>If you use cygwin, you owe it to yourself to try one or both of them immediately.  And by that I mean stop reading and start downloading.  Now.</p>
<img src="http://feeds.feedburner.com/~r/wilt-blog/~4/kbQH_oQjm1k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2010/01/better-consoles-for-cygwin-shells/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shutting down ehcache properly</title>
		<link>http://christiansons.net/mike/blog/2010/01/shutting-down-ehcache-properly/</link>
		<comments>http://christiansons.net/mike/blog/2010/01/shutting-down-ehcache-properly/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 17:37:29 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[ehcache]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[persistence]]></category>
		<category><![CDATA[shutdownhook]]></category>

		<guid isPermaLink="false">http://christiansons.net/mike/blog/?p=422</guid>
		<description><![CDATA[If you&#8217;re using ehcache&#8217;s disk persistence feature, which allows the cache to survive across JVM restarts, be sure to shut down ehcache properly.
To do so when using ehcache within a webapp, simply add its ShutdownListener as a listener in web.xml.

&#60;listener&#62;
    &#60;listener-class&#62;net.sf.ehcache.constructs.web.ShutdownListener&#60;/listener-class&#62;
&#60;/listener&#62;

Alternatively, or when not using ehcache inside a webapp, instruct ehcache to [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using ehcache&#8217;s disk persistence feature, which allows the cache to survive across JVM restarts, be sure to <a href="http://ehcache.org/documentation/shutdown.html">shut down ehcache properly</a>.</p>
<p>To do so when using ehcache within a webapp, simply add its <tt>ShutdownListener</tt> as a <tt>listener</tt> in <tt>web.xml</tt>.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>net.sf.ehcache.constructs.web.ShutdownListener<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Alternatively, or when not using ehcache inside a webapp, instruct ehcache to register its own <a href="http://java.sun.com/developer/TechTips/2000/tt0711.html">shutdown hook</a> by setting a system property.</p>
<pre>net.sf.ehcache.enableShutdownHook=true</pre>
<p>If you forget one of the above, your persisted cache may not be up-to-date, or worse, not persisted at all.</p>
<img src="http://feeds.feedburner.com/~r/wilt-blog/~4/Tb540Vo12f8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2010/01/shutting-down-ehcache-properly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jetty browser cache control</title>
		<link>http://christiansons.net/mike/blog/2009/09/jetty-browser-cache-control/</link>
		<comments>http://christiansons.net/mike/blog/2009/09/jetty-browser-cache-control/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 18:36:37 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[jetty]]></category>
		<category><![CDATA[cache]]></category>

		<guid isPermaLink="false">http://christiansons.net/mike/blog/?p=405</guid>
		<description><![CDATA[Do you use Jetty and need to change the default setting for browser cache control?  Have a look at the init-param element named cacheControl in webdefault.xml.  
Here&#8217;s the default configuration for the version of Jetty I use.  Note the element is commented.

&#60;!--
&#60;init-param&#62;
      &#60;param-name&#62;cacheControl&#60;/param-name&#62;
     [...]]]></description>
			<content:encoded><![CDATA[<p>Do you use Jetty and need to change the default setting for browser <a href="http://tools.ietf.org/html/rfc2616#section-14.9">cache control</a>?  Have a look at the <tt>init-param</tt> element named <tt>cacheControl</tt> in <tt>webdefault.xml</tt>.  </p>
<p>Here&#8217;s the default configuration for the version of Jetty I use.  Note the element is commented.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--</span>
<span style="color: #808080; font-style: italic;">&lt;init-param&gt;</span>
<span style="color: #808080; font-style: italic;">      &lt;param-name&gt;cacheControl&lt;/param-name&gt;</span>
<span style="color: #808080; font-style: italic;">      &lt;param-value&gt;max-age=3600,public&lt;/param-value&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;/init-param&gt;</span>
<span style="color: #808080; font-style: italic;">--&gt;</span></pre></div></div>

<p>To enable and configure browser cache control, uncomment and edit the <tt>param-value</tt> as appropriate.  The following example instructs the browser to disable all caching.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>cacheControl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>no-store,no-cache,must-revalidate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>For information on <tt>Cache-Control</tt>, see <a href="http://tools.ietf.org/html/rfc2616#section-14.9">RFC 2616, Section 14.9</a>.</p>
<img src="http://feeds.feedburner.com/~r/wilt-blog/~4/eIVGVr3bSgQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/09/jetty-browser-cache-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN repository moved</title>
		<link>http://christiansons.net/mike/blog/2009/09/svn-repository-moved/</link>
		<comments>http://christiansons.net/mike/blog/2009/09/svn-repository-moved/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 21:37:14 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[subversion]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[webdav]]></category>

		<guid isPermaLink="false">http://christiansons.net/mike/blog/?p=394</guid>
		<description><![CDATA[If you use Subversion via Apache/WebDAV and get a message like &#8220;Repository moved permanently&#8221; or &#8220;301 Moved Permanently&#8221; you should definitely read the Subversion FAQ on the 301 issue.
But, don&#8217;t take its advice too literally&#8230; you may indeed have a configuration issue, but not with DocumentRoot.  Be sure to check your Apache configuration for [...]]]></description>
			<content:encoded><![CDATA[<p>If you use <a href="http://subversion.tigris.org/webdav-usage.html">Subversion via Apache/WebDAV</a> and get a message like &#8220;<tt>Repository moved permanently</tt>&#8221; or &#8220;<tt>301 Moved Permanently</tt>&#8221; you should definitely read the <a href="http://subversion.tigris.org/faq.html#301-error">Subversion FAQ on the <tt>301</tt> issue</a>.</p>
<p>But, don&#8217;t take its advice too literally&#8230; you may indeed have a configuration issue, but not with <tt>DocumentRoot</tt>.  Be sure to check your Apache configuration for any overlapping/conflicting <tt>SVNParentPath</tt> and <tt>Alias</tt> entries!</p>
<img src="http://feeds.feedburner.com/~r/wilt-blog/~4/MTqH7lVCCTc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/09/svn-repository-moved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mount NTFS partitions at startup with fstab</title>
		<link>http://christiansons.net/mike/blog/2009/07/mount-ntfs-partitions-at-startup-with-fstab/</link>
		<comments>http://christiansons.net/mike/blog/2009/07/mount-ntfs-partitions-at-startup-with-fstab/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 01:41:13 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[fstab]]></category>
		<category><![CDATA[ntfs]]></category>

		<guid isPermaLink="false">http://christiansons.net/mike/blog/?p=380</guid>
		<description><![CDATA[Yesterday I helped a coworker figure out the best way to have Linux mount an NTFS partition at startup.  It was an interesting little problem because there are multiple solutions but only a single &#8220;correct&#8221; solution.
At first I questioned the need to do anything at all &#8212; my computer apparently mounts my NTFS drive [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I helped a <a href="http://dollopofdesi.blogspot.com">coworker</a> figure out the best way to <a href="http://dollopofdesi.blogspot.com/2009/07/loading-windows-partition-at-bootup-in.html">have Linux mount an NTFS partition at startup</a>.  It was an interesting little problem because there are multiple solutions but only a single &#8220;correct&#8221; solution.</p>
<p>At first I questioned the need to do anything at all &#8212; my computer apparently mounts my NTFS drive on its own but I couldn&#8217;t remember how.  </p>
<p>Before I found the ultimate solution, one approach my coworker attemped was to have gnome execute a script at login which used the <tt>mount</tt> command.  This didn&#8217;t work; he forgot to use <tt>gksudo</tt> and anyway the script never seemed to run.</p>
<p>Then I remembered <tt><a href="https://help.ubuntu.com/community/Fstab">fstab</a></tt> and the rest is history.  If you need to accomplish the same thing, be sure to read his <a href="http://dollopofdesi.blogspot.com/2009/07/loading-windows-partition-at-bootup-in.html"><tt>fstab</tt> blog post</a>.</p>
<img src="http://feeds.feedburner.com/~r/wilt-blog/~4/zmQ8QGyVPf4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/07/mount-ntfs-partitions-at-startup-with-fstab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing: Case-Shiller Home Price Index</title>
		<link>http://christiansons.net/mike/blog/2009/05/processing-case-shiller-home-price-index/</link>
		<comments>http://christiansons.net/mike/blog/2009/05/processing-case-shiller-home-price-index/#comments</comments>
		<pubDate>Wed, 27 May 2009 04:06:30 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[processing]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[case-shiller]]></category>
		<category><![CDATA[graph]]></category>

		<guid isPermaLink="false">http://christiansons.net/mike/blog/?p=365</guid>
		<description><![CDATA[I&#8217;ve updated my Processing app to use the latest Case-Shiller Home Price Index data as of May 26, 2009.  (For the uninitiated, see my previous post.)
Moving the mouse over the graph will highlight and display the index for a given point in time.  Clicking the mouse will advance to another city.  
Posting [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.christiansons.net/wp-content/uploads/2009/04/screenshot-sketch_apr04a.png"><img src="http://blog.christiansons.net/wp-content/uploads/2009/04/screenshot-sketch_apr04a-150x100.png" alt="screenshot-sketch_apr04a" title="screenshot-sketch_apr04a" width="150" height="100" class="alignleft size-thumbnail wp-image-319" /></a>I&#8217;ve updated my Processing app to use the latest <a href="http://www2.standardandpoors.com/portal/site/sp/en/us/page.topic/indices_csmahp/2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0.html">Case-Shiller Home Price Index</a> data as of May 26, 2009.  (For the uninitiated, see my <a href="/mike/blog/2009/04/processing-week-4-case-shiller-home-price-indices/">previous post</a>.)<span id="more-365"></span></p>
<p>Moving the mouse over the graph will highlight and display the index for a given point in time.  Clicking the mouse will advance to another city.  </p>
<p>Posting this update reminds me I need to get back to reading <a href="http://www.amazon.com/Visualizing-Data-Ben-Fry/dp/0596514557/?tag=wiltblog-20">Visualizing Data</a>!</p>
<p><applet code="sketch_may26a.class" archive="/mike/blog/wp-content/uploads/2009/05/sketch_may26a.jar" width="600" height="400">Oops, your browser does not have a Java Plug-in. <a title="Download Java Plug-in" href="http://java.sun.com/products/plugin/downloads/index.html">Get the latest Java Plug-in here.</a> Or, if you have Java but can&#8217;t use the Plug-in, feel free to download the <a href="/mike/blog/wp-content/uploads/2009/05/sketch_may26a.jar">program as an executable jar</a>.  Here&#8217;s a screen shot of what you&#8217;re missing.<br />
<a href="http://blog.christiansons.net/wp-content/uploads/2009/05/sketch_may26a.jar"><img class="aligncenter size-full wp-image-319" title="screenshot-sketch_apr04a" src="http://blog.christiansons.net/wp-content/uploads/2009/04/screenshot-sketch_apr04a.png" alt="screenshot-sketch_apr04a" width="600" height="400" /></a></applet></p>
<img src="http://feeds.feedburner.com/~r/wilt-blog/~4/6lk2uD0cWRo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/05/processing-case-shiller-home-price-index/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing, week 4: Case-Shiller Home Price Indices</title>
		<link>http://christiansons.net/mike/blog/2009/04/processing-week-4-case-shiller-home-price-indices/</link>
		<comments>http://christiansons.net/mike/blog/2009/04/processing-week-4-case-shiller-home-price-indices/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 21:44:01 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[career]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[case-shiller]]></category>
		<category><![CDATA[graph]]></category>

		<guid isPermaLink="false">http://blog.christiansons.net/?p=320</guid>
		<description><![CDATA[Earlier this week I skimmed a WSJ blog and article on the Case-Shiller Home Price Index and thought to myself "time for a graph!"

For the uninitiated, Case-Shiller tracks home prices in 20 metro areas. As WSJ states, "[the index has] a base value of 100 in January 2000. So a current index value of 150 translates to a 50% appreciation rate since January 2000 for a typical home located within the metro market."

This program graphs the history of each city's home price index.]]></description>
			<content:encoded><![CDATA[<p style="border: thin dashed;">See <a href="/mike/blog/2009/05/processing-case-shiller-home-price-index/">my post of May 26, 2009</a> for a more up-to-date Case-Shiller Home Price Index</a> graph.</p>
<p><a href="http://blog.christiansons.net/wp-content/uploads/2009/04/screenshot-sketch_apr04a.png"><img src="http://blog.christiansons.net/wp-content/uploads/2009/04/screenshot-sketch_apr04a-150x100.png" alt="screenshot-sketch_apr04a" title="screenshot-sketch_apr04a" width="150" height="100" class="alignright size-thumbnail wp-image-319" /></a>I must admit, I&#8217;ve been extremely lazy about reading <a href="http://www.amazon.com/Visualizing-Data-Ben-Fry/dp/0596514557/?tag=wiltblog-20">Visualizing Data</a> or even updating this blog&#8230; but, this post should make up for it.</p>
<p>Earlier this week I skimmed a WSJ <a href="http://blogs.wsj.com/economics/2009/03/31/a-look-at-case-shiller-numbers-by-metro-area-7/">blog</a> and <a href="http://online.wsj.com/article/SB123850357559373519.html">article</a> on the Case-Shiller Home Price Index and thought to myself &#8220;time for a graph!&#8221;</p>
<p>For the uninitiated, <a href="http://www2.standardandpoors.com/portal/site/sp/en/us/page.topic/indices_csmahp/2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0.html">Case-Shiller tracks home prices</a> in 20 metro areas.  As WSJ states, &#8220;[the index has] a base value of 100 in January 2000.  So a current index value of 150 translates to a 50% appreciation rate since January 2000 for a typical home located within the metro market.&#8221;</p>
<p>This program graphs the history of each city&#8217;s home price index.  <span id="more-320"></span>Not satisfied with just a plain-old graph, I added some aesthetic and functional features.  The 20-city composite is shown for reference.  Moving the mouse over the graph will highlight and display the index for a given point in time.  Clicking the mouse will advance to another city.  </p>
<p><applet code="sketch_apr04a.class" archive="/mike/blog/wp-content/uploads/2009/04/sketch_apr04a.jar" width="600" height="400">Oops, your browser does not have a Java Plug-in. <a title="Download Java Plug-in" href="http://java.sun.com/products/plugin/downloads/index.html">Get the latest Java Plug-in here.</a> Or, if you have Java but can&#8217;t use the Plug-in, feel free to download the <a href="/mike/blog/wp-content/uploads/2009/04/sketch_apr04a.jar">program as an executable jar</a>.  Here&#8217;s a screen shot of what you&#8217;re missing.<br />
<a href="http://blog.christiansons.net/wp-content/uploads/2009/04/sketch_apr04a.jar"><img class="aligncenter size-full wp-image-319" title="screenshot-sketch_apr04a" src="http://blog.christiansons.net/wp-content/uploads/2009/04/screenshot-sketch_apr04a.png" alt="screenshot-sketch_apr04a" width="600" height="400" /></a></applet></p>
<p>The graph&#8217;s data comes from a static CSV which I slightly hand-modified from <a href="http://www2.standardandpoors.com/portal/site/sp/en/us/page.topic/indices_csmahp/2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0.html">the original XLS spreadsheet</a>.</p>
<p>It&#8217;s interesting the number of little things I find missing or bothersome.  For example, I&#8217;d like to use <tt><a href="http://processing.org/reference/curveVertex_.html">curveVertex()</a></tt> instead of <tt><a href="http://processing.org/reference/vertex_.html">vertex()</a></tt> for a smoother line curve, but by nature it doesn&#8217;t display the first and last data points.  Fortunately there are enough data points and few large jumps/drops so the graph does not appear jagged.  I could go on&#8230;</p>
<p>Taking a break from the book and making something useful has been fun.</p>
<img src="http://feeds.feedburner.com/~r/wilt-blog/~4/mbedAuzBHQg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/04/processing-week-4-case-shiller-home-price-indices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing, week 3</title>
		<link>http://christiansons.net/mike/blog/2009/03/processing-week-3/</link>
		<comments>http://christiansons.net/mike/blog/2009/03/processing-week-3/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 16:09:16 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[processing]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.christiansons.net/?p=298</guid>
		<description><![CDATA[It&#8217;s been a week and a half since my Processing, week 2 post and I&#8217;m still not done with chapter four, &#8220;Time Series.&#8221;  Oh, well.
I&#8217;ve been noticing that my Processing programs use a lot of CPU &#8212; about 35% on my dual-core, 2 GHz machine.  And that&#8217;s for a program which just displays [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a week and a half since my <a href="/2009/02/processing-week-2/">Processing, week 2 post</a> and I&#8217;m still not done with chapter four, &#8220;Time Series.&#8221;  Oh, well.</p>
<p>I&#8217;ve been noticing that my Processing programs use a lot of CPU &#8212; about 35% on my dual-core, 2 GHz machine.  And that&#8217;s for a program which just displays static data, like the one below.<span id="more-298"></span></p>
<p style="border: thin dashed;">Update: thanks to a helpful suggestion, I was able to decrease CPU usage significantly.  To find out how, read the <a href="#comments">comments section</a>.</p>
<p><applet code="sketch_mar09a.class" archive="/mike/blog/wp-content/uploads/2009/03/sketch_mar09a.jar" width="600" height="400"><br />
Oops, your browser does not have a Java Plug-in. <a href="http://java.sun.com/products/plugin/downloads/index.html" title="Download Java Plug-in">Get the latest Java Plug-in here.</a> Or, if you have Java but can&#8217;t use the Plug-in, feel free to download the <a href="/mike/blog/wp-content/uploads/2009/03/sketch_mar09a.jar">program as an executable jar</a>.<br />
</applet></p>
<p>This program, from <a href="http://www.amazon.com/Visualizing-Data-Ben-Fry/dp/0596514557/?tag=wiltblog-20">Visualizing Data</a>, plots some US beverage consumption stats over a period of time.  Clicking anywhere within the app switches the subject beverage.</p>
<p>Unless I&#8217;m missing something, the excessive CPU usage is due to constant re-draw.  The book puts all drawing code within the <tt><a href="http://processing.org/reference/draw_.html">draw()</a></tt> method which is called repeatedly, up to 60 times per second (by default).  Setting the <tt><a href="http://processing.org/reference/frameRate_.html">frameRate()</a></tt> to 30 fps improves the matter, but only marginally.    </p>
<p>As I was putting in the reference link for <tt>draw()</tt>, I noticed the documentation indicates its continuous execution can be disabled with <tt><a href="http://processing.org/reference/noLoop_.html">noLoop()</a></tt>.  That&#8217;s great, but has the side effect of disabling key or mouse events.</p>
<p>For now I&#8217;m willing to overlook this CPU usage &#8220;problem&#8221; but I hope the book addresses it soon.  </p>
<img src="http://feeds.feedburner.com/~r/wilt-blog/~4/Z1UW7O61bPI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/03/processing-week-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Processing, week 2</title>
		<link>http://christiansons.net/mike/blog/2009/02/processing-week-2/</link>
		<comments>http://christiansons.net/mike/blog/2009/02/processing-week-2/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 04:26:33 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[processing]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.christiansons.net/?p=265</guid>
		<description><![CDATA[
Today marks the second week I have been learning Processing, a Java-based language for &#8220;program[ming] images, animation, and interactions.&#8221;  In other words, I want to learn how to make useful, pretty graphics.   
Over the past year I had seen Processing mentioned here-and-there in various articles, but what piqued my interest was a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/Visualizing-Data-Ben-Fry/dp/0596514557/?tag=wiltblog-20"><img alt="" src="http://processing.org/img/cover/cover_fry.jpg" title="Visualizing Data by Ben Fry" class="alignright" width="110" height="138" /></a>
<p>Today marks the second week I have been learning <a href="http://processing.org/">Processing</a>, a Java-based language for &#8220;program[ming] images, animation, and interactions.&#8221;  In other words, I want to learn how to make useful, pretty graphics.  <img src='http://christiansons.net/mike/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Over the past year I had seen Processing mentioned here-and-there in various articles, but what piqued my interest was a <a href="http://benfry.com/zipdecode/">visualization of US zipcodes</a>.  Check it out; it&#8217;s awesome.</p>
<p>My guide, at least for now, is <a href="http://www.amazon.com/Visualizing-Data-Ben-Fry/dp/0596514557/?tag=wiltblog-20">Visualizing Data by Ben Fry</a>.  I just completed reading the third chapter and thought I&#8217;d share an example program.<span id="more-265"></span></p>
<div id="sketch_feb28a_container">
<p>
<applet code="sketch_feb28a.class" archive="/mike/blog/wp-content/uploads/2009/02/sketch_feb28a.jar" width="600" height="400"><br />
Oops, your browser does not have a Java Plug-in. <a href="http://java.sun.com/products/plugin/downloads/index.html" title="Download Java Plug-in">Get the latest Java Plug-in here.</a> Or, if you have Java but can&#8217;t use the Plug-in, feel free to download the <a href="/mike/blog/wp-content/uploads/2009/02/sketch_feb28a.jar">program as an executable jar</a>.<br />
</applet>
</p>
</div>
<p>The above Processing program plots data on a US map.  The data are random numbers, associated with each state, which are displayed as colored circles of varying sizes.  Colors are based on sign; size based on magnitude.  Moving the mouse cursor over a circle displays the state name and the random value.</p>
<p>Obviously, this is a very simple visualization but it&#8217;s not hard to see the potential for powerful visualizations.  I&#8217;m already coming up with other data to visualize with this&#8230; such as displaying the difference between the current and average daily temperature for a state.</p>
<p>Oh, before you get to comfortable with that static graphic, click anywhere on the map.  Neat, huh?  A new random number is generated and the graphic is animated from the old value.</p>
<p>Over the course of this coming week I will read the fourth chapter, &#8220;Time Series,&#8221; about displaying data which changes over time.  I can&#8217;t wait to see what program the book will have me work on.</p>
<img src="http://feeds.feedburner.com/~r/wilt-blog/~4/6W38MJh5WJU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/02/processing-week-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Use Advanced Installer licensing within a Java application</title>
		<link>http://christiansons.net/mike/blog/2009/02/use-advanced-installer-licensing-within-a-java-application/</link>
		<comments>http://christiansons.net/mike/blog/2009/02/use-advanced-installer-licensing-within-a-java-application/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 03:31:34 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[advancedinstaller]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blog.christiansons.net/?p=108</guid>
		<description><![CDATA[Advanced Installer 6.7 has a new licensing and registration feature which allows for time-limited demos/trials and registration of installed software.
Caphyon, the maker of Advanced Installer, provides code samples and documentation on licensing integration for C++ and C# applications.  To use this feature, the application must make a call into an Advanced Installer library and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.advancedinstaller.com/"><img alt="" src="http://www.caphyon.com/img/index/biglogo_ai.gif" title="Advanced Installer" class="alignleft" width="77" height="85" /></a>Advanced Installer 6.7 has a <a href="http://www.advancedinstaller.com/user-guide/licensing.html">new licensing and registration feature</a> which allows for time-limited demos/trials and registration of installed software.</p>
<p>Caphyon, the maker of Advanced Installer, provides code samples and <a href="http://www.advancedinstaller.com/user-guide/qat-trial.html">documentation on licensing integration</a> for C++ and C# applications.  To use this feature, the application must make a call into an Advanced Installer library and handle its return code.  </p>
<p>The library is a gatekeeper to the rest of the application, effectively deciding whether or not the application is allowed to run.  It determines the software&#8217;s trial status and displays a registration dialog, terminates the application, or returns a code, accordingly.  The Java implementation of this feature works a little differently.</p>
<p>For those using the <a href="http://www.advancedinstaller.com/user-guide/native-java-launcher.html">Java Launcher</a>, integrating the licensing feature is easy: simply add the Java Product on the <a href="http://www.advancedinstaller.com/user-guide/licensing-settings.html">Licensing Options</a> tab.  But, what about those who don&#8217;t use Java Launcher?  Or those that wish to enable users to register from within the application?</p>
<p>There is no official documentation which answers these questions, but based on a discussion following a <a href="http://www.advancedinstaller.com/forums/viewtopic.php?f=2&#038;t=8538">request for help I posted on the Advanced Installer forums</a>, I was able integrate AI&#8217;s licensing feature into my Java application without using the Java Launcher.<span id="more-108"></span></p>
<p>My solution mirrors the C++ implementation and is remarkably simple.  Thanks to Cosmin, a member of the Advanced Installer support team, for sending me in the right direction.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LicenseChecker <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> LIBRARY_KEY <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Replace this String with the Trialware/Registration Library Key&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> args<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> TrialLibrary.<span style="color: #006633;">INSTANCE</span>.<span style="color: #006633;">ReadSettingsStr</span><span style="color: #009900;">&#40;</span>LIBRARY_KEY, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//http://www.advancedinstaller.com/user-guide/qa-trial-using.html</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">:</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Thank you for registering this program.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">:</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Thank you for trying this program.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">exit</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Program will continue.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// ...</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">interface</span> TrialLibrary <span style="color: #000000; font-weight: bold;">extends</span> Library <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">final</span> TrialLibrary INSTANCE <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TrialLibrary<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">Native</span>.<span style="color: #006633;">loadLibrary</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Trial&quot;</span>, TrialLibrary.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// loads Trial.dll</span>
        <span style="color: #000066; font-weight: bold;">int</span> ReadSettingsStr<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> keyCode, HWND hwnd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">int</span> DisplayRegistrationStr<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> keyCode, HWND hwnd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Note: The above uses <a href="https://jna.dev.java.net/">Java Native Access (JNA)</a> to invoke the Advanced Installer library.</p>
<img src="http://feeds.feedburner.com/~r/wilt-blog/~4/or029Maj3MY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/02/use-advanced-installer-licensing-within-a-java-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
