<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>HappyPappy Blog &#187; Techno</title>
	<atom:link href="http://www.happypappy.net/archives/category/techno/feed" rel="self" type="application/rss+xml" />
	<link>http://www.happypappy.net</link>
	<description>Happy's rantings</description>
	<lastBuildDate>Sat, 17 Apr 2010 13:30:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The iPad, a Canadian perspective</title>
		<link>http://www.happypappy.net/archives/204</link>
		<comments>http://www.happypappy.net/archives/204#comments</comments>
		<pubDate>Sat, 17 Apr 2010 13:28:20 +0000</pubDate>
		<dc:creator>Happy</dc:creator>
				<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://www.happypappy.net/archives/204</guid>
		<description><![CDATA[As one of what I imagine is a minority of Canadians I thought I&#8217;d report my thought on this device.

I happen to have family in the US and I happened to have a visit planned there the week after the iPads launch so I took advantage of my family&#8217;s US  address and pre-ordered a [...]]]></description>
			<content:encoded><![CDATA[<p>As one of what I imagine is a minority of Canadians I thought I&#8217;d report my thought on this device.<br />
<span id="more-204"></span><br />
I happen to have family in the US and I happened to have a visit planned there the week after the iPads launch so I took advantage of my family&#8217;s US  address and pre-ordered a 64gb iPad from the Apple store. </p>
<p>The apple store let&#8217;s you have a different billing address from your shipping address otherwise this wouldn&#8217;t have worked.  </p>
<p>I placed my order and sure enough the device showed up exactly on launch day as promised by Apple. Oddly enough about 48 hours after I placed my order Apple ran out off stock and further iPad shipments were delayed until a week after launch.</p>
<p>On initial brush the device was wholly underwhelming, to quote Steve Jobs &#8220;it just works&#8221;. It had to connect to iTunes to setup but then just worked on it&#8217;s own from there.</p>
<p>No wifi issues for me, I just started using it.</p>
<p>The one difficulty however was using the iTunes App store; unlike the Apple store, it insisted that I have a US based funding source, in other words I couldn&#8217;t use a credit card with a Canadian billing address. No luck with pay pal or cross border gift cards either. The only solution was to setup an iTunes account without a funding source and go buy iTunes gift cards from the local Best Buy.</p>
<p>About a month before international launch however the computer based iTunes app store now has iPad apps while the Canadian iPad based app store still won&#8217;t connect. In the end it was a pain to get apps but not impossible.</p>
<p>Loaded with an iPad under my arm I said my goodbyes and headed home. I was a bit nervous about crossing the border with the iPad but I thought I would only have to pay GST at worst. I declared the device and the customs agent simply waved me through, go figure.</p>
<p>A week later my appreciation of the iPads capabilities and the imagination and enthusiasm of iPad developers continues to impress me. As I learn how to use the device better each day, it becomes more powerful and useful to me.</p>
<p>I&#8217;m fairly certain it will replace my laptop shortly.</p>
<p>&#8211; Post From My iPad<br /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.happypappy.net/archives/204/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using JavaScript with a Wicket LinkTree</title>
		<link>http://www.happypappy.net/archives/197</link>
		<comments>http://www.happypappy.net/archives/197#comments</comments>
		<pubDate>Tue, 01 Sep 2009 14:37:15 +0000</pubDate>
		<dc:creator>Happy</dc:creator>
				<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://www.happypappy.net/archives/197</guid>
		<description><![CDATA[I have to say that so far I really like Wicket, after years of developing J2EE Web application it&#8217;s a big relief to be able to develop Web application without having to maintain reams of URL or Action mappings in XML files.
Wicket offers a programming paradigm much closer to standard Java Swing instead which makes [...]]]></description>
			<content:encoded><![CDATA[<p>I have to say that so far I really like Wicket, after years of developing J2EE Web application it&#8217;s a big relief to be able to develop Web application without having to maintain reams of URL or Action mappings in XML files.</p>
<p>Wicket offers a programming paradigm much closer to standard Java Swing instead which makes Web development much smoother.</p>
<p>There are a few pitfalls unfortunately as nothing is perfect but so far it&#8217;s been great.</p>
<p>One problem I&#8217;ve run into is when using Wickets LinkTree component (an Ajax based explorer like tree structure) is that it assumes that I always want to do an Ajax update from the server. But what if I want to run some JavaScript or simply redirect based on the clicked node.<span id="more-197"></span>My solution is convoluted as I will admit that I am NOT a Wicket expert (yet) but to date I have not found another work around.</p>
<p>The gist of the solution is to override the newNodeComponent method which allows you to substitute your own code for the creation of tree nodes and I also overrode the onNodeClicked method as I wanted to expand and collapse tree nodes if the user clicked the nodes and not just the + and &#8211; icons.</p>
<p>Code:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;&#8230;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;_tree = <span class="kw2">new</span> LinkTree<span class="br0">&#40;</span><span class="st0">&quot;catalog&quot;</span>, treeModel<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">protected</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AComponent+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Component</span></a> newNodeComponent<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> id, IModelObject model<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Our user object stored in each node</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">final</span> CatalogItem item = <span class="br0">&#40;</span>CatalogItem<span class="br0">&#41;</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ADefaultMutableTreeNode+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">DefaultMutableTreeNode</span></a><span class="br0">&#41;</span> model.<span class="me1">getObject</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">getUserObject</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Is this a leaf node?</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Your own condition may be different</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>item.<span class="me1">getItem</span><span class="br0">&#40;</span><span class="br0">&#41;</span> != <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Override standard node creation so we can setup our own component</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// This kind of blows since if the standard LinkTree implementation changes we</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// may be hooped, pooched, or even twaddled</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">final</span> LinkIconPanel panel = <span class="kw2">new</span> LinkIconPanel<span class="br0">&#40;</span>id, model, <span class="kw2">this</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">private</span> <span class="kw2">static</span> <span class="kw2">final</span> <span class="kw4">long</span> serialVersionUID = 1L;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">protected</span> <span class="kw4">void</span> onNodeLinkClicked<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AObject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Object</span></a> node, BaseTree tree, AjaxRequestTarget target<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">super</span>.<span class="me1">onNodeLinkClicked</span><span class="br0">&#40;</span>node, tree, target<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onNodeLinkClicked<span class="br0">&#40;</span>node, tree, target<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">protected</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AComponent+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Component</span></a> newContentComponent<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> componentId, BaseTree tree, IModelObject model<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw2">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ALabel+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Label</span></a><span class="br0">&#40;</span>componentId, getNodeTextModel<span class="br0">&#40;</span>model<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">protected</span> <span class="kw4">void</span> addComponents<span class="br0">&#40;</span><span class="kw2">final</span> IModelObject model, <span class="kw2">final</span> BaseTree tree<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">final</span> BaseTree.<span class="me1">ILinkCallback</span> callback = <span class="kw2">new</span> BaseTree.<span class="me1">ILinkCallback</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">private</span> <span class="kw2">static</span> <span class="kw2">final</span> <span class="kw4">long</span> serialVersionUID = 1L;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <span class="kw4">void</span> onClick<span class="br0">&#40;</span>AjaxRequestTarget target<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onNodeLinkClicked<span class="br0">&#40;</span>model.<span class="me1">getObject</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, tree, target<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MarkupContainer link = tree.<span class="me1">newLink</span><span class="br0">&#40;</span><span class="st0">&quot;iconLink&quot;</span>, callback<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add<span class="br0">&#40;</span>link<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link.<span class="me1">add</span><span class="br0">&#40;</span>newImageComponent<span class="br0">&#40;</span><span class="st0">&quot;icon&quot;</span>, tree, model<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// link = tree.newLink(&quot;contentLink&quot;, callback);</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Which return an AjaxLink or we can setup our own component instead&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link = <span class="kw2">new</span> WebMarkupContainer<span class="br0">&#40;</span><span class="st0">&quot;contentLink&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Add our own JavaScript</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link.<span class="me1">add</span><span class="br0">&#40;</span><span class="kw2">new</span> SimpleAttributeModifier<span class="br0">&#40;</span><span class="st0">&quot;onclick&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;ezprint.setSku(&#8216;&quot;</span> + item.<span class="me1">getItem</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getPartnerCode</span><span class="br0">&#40;</span><span class="br0">&#41;</span> + <span class="st0">&quot;&#8217;);return false;&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Standard node creation resumes</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link.<span class="me1">add</span><span class="br0">&#40;</span>newContentComponent<span class="br0">&#40;</span><span class="st0">&quot;content&quot;</span>, tree, model<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add<span class="br0">&#40;</span>link<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> panel;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Standard node creation</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw2">super</span>.<span class="me1">newNodeComponent</span><span class="br0">&#40;</span>id, model<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">protected</span> <span class="kw4">void</span> onNodeLinkClicked<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AObject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Object</span></a> object, BaseTree tree, AjaxRequestTarget target<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Expand or collapse a node if the user clicks on a node &nbsp;(in addition to the +/- signs)</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ATreeNode+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">TreeNode</span></a> node = <span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ATreeNode+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">TreeNode</span></a><span class="br0">&#41;</span> object;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>!node.<span class="me1">isLeaf</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>tree.<span class="me1">getTreeState</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">isNodeExpanded</span><span class="br0">&#40;</span>node<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _tree.<span class="me1">getTreeState</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">collapseNode</span><span class="br0">&#40;</span>node<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _tree.<span class="me1">getTreeState</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">expandNode</span><span class="br0">&#40;</span>node<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// and else here would handle your leaf node</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tree.<span class="me1">updateTree</span><span class="br0">&#40;</span>target<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.happypappy.net/archives/197/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending Javascript functions using JSON and Java</title>
		<link>http://www.happypappy.net/archives/183</link>
		<comments>http://www.happypappy.net/archives/183#comments</comments>
		<pubDate>Wed, 29 Jul 2009 17:41:53 +0000</pubDate>
		<dc:creator>Happy</dc:creator>
				<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://www.happypappy.net/?p=183</guid>
		<description><![CDATA[I originally got my inspiration from this article on how to send Javascript functions over JSON and most of this work here is based on it.

By default every string attribute specified inside a JSON string is bounded by double quotes which works fine most of the time except when you are trying to pass a [...]]]></description>
			<content:encoded><![CDATA[<p style="clear: both">I originally got my inspiration from this <a href="http://solutoire.com/2008/06/12/sending-javascript-functions-over-json/" target="_blank">article</a> on how to send Javascript functions over JSON and most of this work here is based on it.</p>
<p style="clear: both">
<div>By default every string attribute specified inside a JSON string is bounded by double quotes which works fine most of the time except when you are trying to pass a Javascript function in which case you have a string but it needs to be without double quotes.</div>
<p style="clear: both">
<p><span id="more-183"></span></p>
<div>Every JSON implementations that I&#8217;ve seen (both in PHP and Java) does not allow this in that every string is returned bounded by double quotes.</div>
<p style="clear: both">
<div>So short of implementing my own JSON tools in Java my only solution was to somehow work around the results products by the various JSON implementations.</div>
<p style="clear: both">
<div>The essence of our solution is to append some unique string values to the beginning and end of our Javascript function name and then remove these and attached quotes from our resulting JSON output.</div>
<p style="clear: both">
<p style="clear: both">
<div>I wrote a simple wrapper around the <a href="http://code.google.com/p/google-gson/" target="_blank">GSON</a> implementation to do this:</div>
<p style="clear: both">
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import com.google.gson.Gson;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import com.truecool.stagetwo.utils.StringUtils;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw2">public</span> <span class="kw2">class</span> GsonUtils <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Magic strings are delimiters used to denote the start and end of a string</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// you don&#8217;t want bounded by double quotes in the resulting json string</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">static</span> <span class="kw2">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> MAGIC_STRING_START = <span class="st0">&quot;ycaBQm9T8UPT&#8212;&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">static</span> <span class="kw2">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> MAGIC_STRING_END = <span class="st0">&quot;&#8212;1IRJDEPhW&quot;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> toJson<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AObject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Object</span></a> object<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">Gson gson = <span class="kw2">new</span> Gson<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> json = gson.<span class="me1">toJson</span><span class="br0">&#40;</span>object<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">json = StringUtils.<span class="me1">searchAndReplace</span><span class="br0">&#40;</span>json, <span class="st0">&quot;<span class="es0">\&quot;</span>&quot;</span> + MAGIC_STRING_START, <span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">json = StringUtils.<span class="me1">searchAndReplace</span><span class="br0">&#40;</span>json, MAGIC_STRING_END + <span class="st0">&quot;<span class="es0">\&quot;</span>&quot;</span>, <span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>; <span class="kw2">return</span> json;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>Standard GSON/JSON up to the point where we replace our double quotes and magic strings with an empty string (&#8220;&#8221;).</p>
<p>To properly invoke the serialization method I use a map which I stuff with a value that surrounds my actual function name with the magic strings as follows:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&#8230;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw4">void</span> setReadyCallback<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> readyCallback<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="co1">// getAttributes() is a map</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; getAttributes<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">put</span><span class="br0">&#40;</span>READYCALLBACK,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; GsonUtils.<span class="me1">MAGIC_STRING_START</span> + readyCallback + GsonUtils.<span class="me1">MAGIC_STRING_END</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&#8230;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>Which in turn produces this; notice that someFunction is a string without double quotes.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span><span class="st0">&quot;elementId&quot;</span>:<span class="st0">&quot;test&quot;</span>,<span class="st0">&quot;height&quot;</span>:<span class="nu0">100</span>,<span class="st0">&quot;readyCallback&quot;</span>:someFunction,<span class="st0">&quot;width&quot;</span>:<span class="st0">&quot;80%&quot;</span>&#8230;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.happypappy.net/archives/183/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Photography Equipment Tip #1</title>
		<link>http://www.happypappy.net/archives/140</link>
		<comments>http://www.happypappy.net/archives/140#comments</comments>
		<pubDate>Fri, 24 Apr 2009 16:29:13 +0000</pubDate>
		<dc:creator>Happy</dc:creator>
				<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://www.happypappy.net/archives/140</guid>
		<description><![CDATA[Modern cameras have become very powerful and have myriads of features to help us take better and more pictures.
Unfortunately with all that power comes significant complexity which sometimes makes it hard to use these cameras and gear effectively.

Carrying books and manuals when you already have a pack full of gear is not fun either.
Enter the [...]]]></description>
			<content:encoded><![CDATA[<p style="clear: both">Modern cameras have become very powerful and have myriads of features to help us take better and more pictures.</p>
<p style="clear: both">Unfortunately with all that power comes significant complexity which sometimes makes it hard to use these cameras and gear effectively.</p>
<p><span id="more-140"></span></p>
<p style="clear: both">Carrying books and manuals when you already have a pack full of gear is not fun either.</p>
<p style="clear: both">Enter the iPhone (although there are probably similar solutions for our friends using CrackBerries) and a simple and easy to use application called Air Sharing (which you can purchase from the App Store).</p>
<p style="clear: both">Air Sharing lets you transfer a number of file formats to your iPhone and then read them when required.</p>
<p style="clear: both">In my case I was able to download Canon manuals for both my G9 and my 50D onto my iPhone and reference these as required in the field.</p>
<p style="clear: both">Hope this helps, happy shooting!!!</p>
<p style="clear: both"><img style=" display: inline; float: left; margin: 0 10px 10px 0;" src="http://www.happypappy.net/wp-content/uploads/2009/04/img-0001-thumb1.png" alt="" width="306" height="458" align="left" /></p>
<p style="clear: both"><img style=" display: inline; float: left; margin: 0 10px 10px 0;" src="http://www.happypappy.net/wp-content/uploads/2009/04/img-0002-thumb.png" alt="" width="306" height="458" align="left" /></p>
<p><br class="final-break" style="clear: both" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.happypappy.net/archives/140/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up OC4J Authentication</title>
		<link>http://www.happypappy.net/archives/110</link>
		<comments>http://www.happypappy.net/archives/110#comments</comments>
		<pubDate>Wed, 26 Nov 2008 19:52:02 +0000</pubDate>
		<dc:creator>Happy</dc:creator>
				<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://www.happypappy.net/?p=110</guid>
		<description><![CDATA[Oracle Components for Java (OC4J) is a top notch J2EE container based on the Orion J2EE Server.
OC4J provides a number of mechanisms for user authentication; the older less secure method which uses the principals.xml file and a newer method based on the Java Authentication and Authorization Service (JAAS) standard.
Oracle&#8217;s implementation of JAAS is known as [...]]]></description>
			<content:encoded><![CDATA[<p>Oracle Components for Java (OC4J) is a top notch J2EE container based on the <a href="http://www.orionserver.com/">Orion J2EE Server</a>.</p>
<p>OC4J provides a number of mechanisms for user authentication; the older less secure method which uses the principals.xml file and a newer method based on the Java Authentication and Authorization Service (JAAS) standard.</p>
<p>Oracle&#8217;s implementation of JAAS is known as JAZN (Java AuthoriZatioN).<br />
<span id="more-110"></span>The older principals.xml file method is easier to setup but not as secure since passwords are exposed in clear text within the principals.xml file.</p>
<p>JAZN is more secure and flexible (you can even set it up to authenticate against LDAP) but many elements have to line up properly for it to work. Notes on how to setup JAZN can be found <a href="http://www.oracle.com/technology/tech/java/oc4j/htdocs/how-to-security-JAAS.html">here</a>.</p>
<p>Regardless of which method you choose the steps to setup OC4J based authentication are the same:</p>
<p>1) Decided which method to use and configure OC4J properly,<br />
2) Add a user and/or group,<br />
3) Specify a role based security constraint for your application, and<br />
4) Map the security constraint role to a group specified in step 2.</p>
<h3>Step 1 &#8211; Decide which method to use</h3>
<p>This is probably the easiest step; open /config/application.xml; by default as of version 9.0.4.0 OC4J will use JAZN over principals.xml if both are configured.</p>
<p>If you want to use principals.xml you must remove (or comment out) the configuration line:</p>
<blockquote><p>&lt;jazn provider=&#8221;XML&#8221; location=&#8221;./jazn-data.xml&#8221;/&gt;</p></blockquote>
<p>If you want to use JAZN then make sure this line exists inside of your application.xml file.</p>
<h3>Step 2 &#8211; Add a user and/or group</h3>
<p>If you have setup your OC4J to run the Admin Applications you can point your browser to http://&lt;oc4j uri here&gt;/adminoc4j and use the web screens to add users and groups.</p>
<p>If your Admin application isn&#8217;t setup or you can&#8217;t login into it (user id and password should be required) then you can modify the principals.xml file by hand as follows:</p>
<p>a) Inside the &lt;groups&gt; tags you can add, remove, or modify a group; in this case we&#8217;re adding an fmanager-users group;</p>
<blockquote>
<pre>&lt;group name="fmanager-users"&gt;
  &lt;description&gt;File Manager Users&lt;/description&gt;
  &lt;permission name="fmanager"/&gt;
&lt;/group&gt;</pre>
</blockquote>
<p>b) Inside the &lt;users&gt; tags you can add, remove, or modify a user; in this case we&#8217;re adding a happypapp user and making him part of the fmanager-users group and users group;</p>
<blockquote>
<pre>&lt;user username="happypapy" password="abc1234"&gt;
  &lt;description&gt;HappyPappy&lt;/description&gt;
  &lt;group-membership group="users"/&gt;
  &lt;group-membership group="fmanager-users"/&gt;
&lt;/user&gt;</pre>
</blockquote>
<p>If you&#8217;re using JAZN you can manage users and groups using the jazn.jar (java -jar jazn.jar &#8230;) utility located in the same folder as oc4j.jar to maintain users and groups. JAZN reference can be found <a href="http://download-west.oracle.com/docs/cd/B14099_19/web.1012/b14013/admintool.htm">here</a>.</p>
<p>Note that some of the features of JAZN only work when you are using the XML provider but not if you are using the LDAP provider.</p>
<p>There are a few subtle changes to this step depending on the version of OC4J used; in later versions of OC4J there no longer appears to be a global principals.xml and you simply use jazn.jar or the management console to modify groups and users.</p>
<h3>Step 3 &#8211; Specify a role based security constraint</h3>
<p>Although OC4J supports both global (for all applications and modules) and local (specific applications and modules) we will only focus on setting up a local application.</p>
<p>For more information regarding all the OC4J configuration files please check <a href="http://download.oracle.com/docs/cd/E12524_01/web.1013/e12288/confdesc.htm#CHDDDBJH">here</a>.</p>
<p>In our case we edit the web.xml file inside your web module which typically resides in the WEB-INF folder.</p>
<p>Specifically we make the following additions:</p>
<blockquote>
<pre>&lt;!-- define a constraint for any resource (*) under this applicaction
and require an fmanager-user role (not group) to access it --&gt;
&lt;security-constraint&gt;
  &lt;display-name&gt;File Manager Access&lt;/display-name&gt;
  &lt;web-resource-collection&gt;

    &lt;web-resource-name&gt;File Manager&lt;/web-resource-name&gt;
    &lt;url-pattern&gt;*&lt;/url-pattern&gt;
  &lt;/web-resource-collection&gt;
  &lt;auth-constraint&gt;
    &lt;role-name&gt;fmanager-user&lt;/role-name&gt;
  &lt;/auth-constraint&gt;
&lt;/security-constraint&gt;
&lt;!-- specify BASIC authentication, remember OC4J supports several types --&gt;
&lt;login-config&gt;
  &lt;auth-method&gt;BASIC&lt;/auth-method&gt;
&lt;/login-config&gt;
&lt;!-- define a security role of fmanager-user --&gt;
&lt;security-role&gt;
  &lt;role-name&gt;fmanager-user&lt;/role-name&gt;
&lt;/security-role&gt;</pre>
</blockquote>
<h3>Map the security constraint role to a security group</h3>
<p>This step is performed by editing an orion-web.xml file which exists in the same folder as your web.xml file.</p>
<p>In this case we simply map the fmanager-user role in our application to the fmanager-users group defined in principals.xml;</p>
<blockquote>
<pre>&lt;?xml version = '1.0' encoding = 'windows-1250'?&gt;
&lt;!DOCTYPE orion-application PUBLIC "-//Evermind//DTD J2EE Application runtime 1.2//EN" "http://xmlns.oracle.com/ias/dtds/orion-application.dtd"&gt;

&lt;orion-web-app&gt;
 &lt;security-role-mapping name="fmanager-user"&gt;
 &lt;group name="fmanager-users" /&gt;
 &lt;/security-role-mapping&gt;
&lt;/orion-web-app&gt;</pre>
</blockquote>
<h3>Wrap Up</h3>
<p>Next time you access your application via the web (needs to be setup in application.xml and http-web-site.xml) OC4J will prompt you for a user inside the fmanager-users group defined in principals.xml.</p>
<p>A quick word of caution; I noticed that if you try binding a new Web module to the default application most of this doesn&#8217;t work, it&#8217;s just easier to install a new application whenever you want to use OC4J authentication.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.happypappy.net/archives/110/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>High Dynamic Range (HDR) Phtography</title>
		<link>http://www.happypappy.net/archives/92</link>
		<comments>http://www.happypappy.net/archives/92#comments</comments>
		<pubDate>Fri, 30 May 2008 03:51:23 +0000</pubDate>
		<dc:creator>Happy</dc:creator>
				<category><![CDATA[Fun Stuff]]></category>
		<category><![CDATA[Goodies]]></category>
		<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://www.happypappy.net/archives/92</guid>
		<description><![CDATA[I recently attended a photography workshop by Darwin Wiggett and although I&#8217;ve been shooting pictures for a while it still turns out that I knew nothing (now I only know next to nothing) about photography.
If you want to gain an insight into how to take better pictures I highly recommend Darwins seminars, check out his [...]]]></description>
			<content:encoded><![CDATA[<p>I recently attended a photography workshop by <a href="http://www.darwinwiggett.com/main.html">Darwin Wiggett</a> and although I&#8217;ve been shooting pictures for a while it still turns out that I knew nothing (now I only know next to nothing) about photography.</p>
<p>If you want to gain an insight into how to take better pictures I highly recommend Darwins seminars, check out his web site for seminar dates.</p>
<p><span id="more-92"></span><br />
One of the things I learned about however was High Dynamic Range (HDR) photography. In simple terms, have you ever tried taking a picture of a landscape or object and although your main subject was perfectly exposed either the sky or the background was too dark or too light (washed out)?</p>
<p>The primary reason is that the contrast between your main subject and the background or sky is too high and the camera or film simply cannot adjust both extremes to be properly exposed into your picture. There are a few solutions to resolve this problem; Darwin is a god of using filters to properly expose his pictures to create stunning images where all elements are properly exposed.</p>
<p>Myself not only do I not have the patience to dicker with filters but I also don&#8217;t have the skill or a camera that accepts filters easily. </p>
<p>The alternative is HDR photography where in essence one takes multiple pictures of a scene at various levels of exposure (usually one picture under exposed, one where the main subject is correctly exposed, and one over exposed) and then using software to combine these into one correctly exposed picture.</p>
<p>This technique requires a rock steady hand or tripod or monopod, a relatively quick shutter speed, and a slow moving or non moving subject.</p>
<p>Darwin had discussed <a href="http://www.hdrsoft.com/">Photomatics by HDRsoft</a> and I thought I&#8217;d give it a try, the results are below.</p>
<p>I took a picture of a wharf in Horseshoe Bay Vancouver using a picnic table in lieu of a tripod and the Auto Exposure Bracketing (AEB) feature on my<a href="http://www.naturephotographers.net/articles1207/dw1207-1.html"> Cannon G9</a>: </p>
<p><img src="http://www.duhhh.net/wp-content/uploads/2008/05/img-0456.jpg" alt="IMG_0456.jpg" border="0" width="640" height="480" /><br />
Good exposure on main subject (wharf), sky washed out (over exposed)</p>
<p><img src="http://www.duhhh.net/wp-content/uploads/2008/05/img-0457.jpg" alt="IMG_0457.jpg" border="0" width="640" height="480" /><br />
Better sky, but wharf and grass too dark (under exposed)</p>
<p><img src="http://www.duhhh.net/wp-content/uploads/2008/05/img-0458.jpg" alt="IMG_0458.jpg" border="0" width="640" height="480" /><br />
Most of the picture over exposed except for the grass</p>
<p>I then dragged these pictures into Photomatix and clicked the process button to produce the picture below:</p>
<p><img src="http://www.duhhh.net/wp-content/uploads/2008/05/img-0456-7-8-tonemapped2.jpg" alt="IMG_0456_7_8_tonemapped.jpg" border="0" width="640" height="481" /></p>
<p>About five minutes of diddling with the settings, not bad (pretty darned good I&#8217;d say).</p>
<p>I believe there are also HDR features (or methods) in Photoshop CS2 and Photomatix also has a plugin for Photoshop, but using Photomatix was quick and painless. Sign me up!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.happypappy.net/archives/92/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Task Tag Decorator Plugin for Eclipse</title>
		<link>http://www.happypappy.net/archives/79</link>
		<comments>http://www.happypappy.net/archives/79#comments</comments>
		<pubDate>Mon, 16 Apr 2007 18:02:25 +0000</pubDate>
		<dc:creator>Pavel</dc:creator>
				<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://www.happypappy.net/archives/79</guid>
		<description><![CDATA[ For all the times I was looking through a big project trying to find my TODO taks I&#8217;ve created an Eclipse plugin which helps track TODO tasks in any large Eclipse projects. 
The project might have lots of TODO tags scattered in many files and Eclipse will present them only as a plain list. This plugin [...]]]></description>
			<content:encoded><![CDATA[<p><!--noadsense--> For all the times I was looking through a big project trying to find my TODO taks I&#8217;ve created an Eclipse plugin which helps track TODO tasks in any large Eclipse projects. <span id="more-79"></span></p>
<p>The project might have lots of TODO tags scattered in many files and Eclipse will present them only as a plain list. This plugin decorates Package Explorer so you can view a hierarchy of tags as in the screen shot below:</p>
<p><img src="http://www.happypappy.net/wp-content/uploads/2007/04/screenshot_01.png" alt="Screenshot" /></p>
<p>The plugin can be found <a href="http://www.the-eventhorizon.com/eclipse-todo/desciption.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.happypappy.net/archives/79/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My life as an Apple kiddie (Part I)</title>
		<link>http://www.happypappy.net/archives/74</link>
		<comments>http://www.happypappy.net/archives/74#comments</comments>
		<pubDate>Wed, 28 Feb 2007 15:08:13 +0000</pubDate>
		<dc:creator>Happy</dc:creator>
				<category><![CDATA[Fun Stuff]]></category>
		<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://www.happypappy.net/archives/74</guid>
		<description><![CDATA[They say that as one gets older it becomes harder to learn new tricks and try new things. Accordingly I count myself lucky to be able to try new things even at my advanced age of 40 (and we&#8217;re not talking dog years here). 
I was looking for a new workstation to help me out [...]]]></description>
			<content:encoded><![CDATA[<p>They say that as one gets older it becomes harder to learn new tricks and try new things. Accordingly I count myself lucky to be able to try new things even at my advanced age of 40 (and we&#8217;re not talking dog years here). <span id="more-74"></span></p>
<p>I was looking for a new workstation to help me out at work; I&#8217;m a software developer and the building and testing of code was taking way too long on my previous workstation; I was getting frustrated on how much time I was spending idling while my workstation was running a system test or a build job.</p>
<p>I went looking for a new system (it was about three years since my last upgrade and the fans on the old workstations were getting noisy…compared to the shuttle lifting off). I was ready to shell out some serious scratch as experience has shown that investing up front will make your system last longer; i.e. you will keep and be happy with your system longer than if you spend less for cheaper components (usually just before they become dated or obsolete anyways). Some may not agree but it&#8217;s my theory and I&#8217;m sticking to it. I stacked up a number of workstations from various vendors with more or less the same specs (as close as I could make them anyways) and you&#8217;d be surprised who actually came out less expensive than the competition.</p>
<p>Back in October of 2006 Apple had just released their line of Intel powered Macs and I thought I should give them a look on the grounds that I could always run Windows via Apples <a href="http://www.apple.com/macosx/bootcamp/">Bootcamp</a> if I had to (for those who don&#8217;t know Apples computers run OS X which is quite a bit different from Windows). I had used Microsofts Windows since version 3.1 and wasn&#8217;t keen on learning a new operating system but with the potential to run Windows on the Mac Apple made the list.</p>
<p>Once I had my list and was comparing Apple to apples (pun intended) I was somewhat surprised that Apple not only provided great hardware it was actually less expensive than the competition. I wanted an outstanding machine for work but also a great unit for gaming (my weekend weakness). I ordered a Mac Pro with 2GB ram, a 250GB hard drive, an ATI X1900 XT video card (smokin&#8217;), and 2 Intel Xeon 2.66 GHZ dual-core CPUs.</p>
<p>The process of ordering online from Apple is relatively smooth but nowhere near as slick as say Dell; for one thing Apple does not offer a personal lease which in Canada at least makes it much easier to write off computer expenses for tax purposes. Nevertheless the process went smoothly and after 20 minutes on Apple&#8217;s web site my Mac Pro was on the way.</p>
<p>It took my machine just about two weeks to make it to my house and after some frantic unpacking I fired that bad boy up.</p>
<p>The first thing that&#8217;s different about a Mac over your usual PC is well pretty much everything, but more on that later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.happypappy.net/archives/74/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Trie</title>
		<link>http://www.happypappy.net/archives/5</link>
		<comments>http://www.happypappy.net/archives/5#comments</comments>
		<pubDate>Wed, 26 Jul 2006 10:21:09 +0000</pubDate>
		<dc:creator>Happy</dc:creator>
				<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://www.happypappy.net/?p=5</guid>
		<description><![CDATA[Introduction
A Trie (pronounce &#8220;try&#8221;) is a tree-based data structure in order to support fast pattern matching. The &#8220;trie&#8221; comes from the word &#8220;retrieval&#8221;.
This structure is particularly useful for any application requiring prefix based (read &#8220;starts with&#8221;) pattern matching.A good example is any kind of application where we let the user type and quickly come up [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>A Trie (pronounce &#8220;try&#8221;) is a tree-based data structure in order to support fast pattern matching. The &#8220;trie&#8221; comes from the word &#8220;retrieval&#8221;.</p>
<p>This structure is particularly useful for any application requiring prefix based (read &#8220;starts with&#8221;) pattern matching.A good example is any kind of application where we let the user type and quickly come up with a list of words starting with what the user typed in.<span id="more-5"></span></p>
<p>In our case we implement the Trie Abstract Data Type (ADT) using Java; the original work was done by <a href="http://www.koders.com/java/fid0F06E53F2CFCC6E591C38752F355A7178F92FFE5.aspx?s=trie">Koders</a>. I adapted the Koders trie classes to eliminate fixed alphabets and add case sensitivity to the searches (might be something I make optional at some point).</p>
<p>I&#8217;m including an IntelliJ IDEA project if you&#8217;d like to play with these classes (run the TrieRunner.main method after you compile) but you should be able to incorporate these with ease into your project by copying into your project source and modifying package declarations accordingly.</p>
<p><strong>Advantages</strong></p>
<p>Numerous applications today depend on a database to perform their prefix based pattern matching. This is probably adequate for finding valid data values for a given entry field but this approach has limitations which are overcome by the use of an in-memory trie data structure.</p>
<p>As an example imagine that we want to let the user enter a given value and then not only return valid data values but in fact also return &#8220;matching&#8221; objects such that these can be used right away by our application. Using a database would give us the valid data values but each &#8220;matching&#8221; object would then have to be found and then subsequently instantiated whereas all of these objects could easily be cached in memory and immediately accessed using our trie.</p>
<p><strong>Usage</strong></p>
<p>Step one is to instantiate and load our trie;</p>
<p>The trie can be instantiated simply by invoking the default constructor:</p>
<pre>Trie main = new Trie();</pre>
<p>To add entries to the trie simply use the insert method as follows:</p>
<pre>main.insert(key, object);</pre>
<p>where key is the String pattern you may wish to match against and object is the data item to retrieve when a search is performed.</p>
<p>The key and object parameters could in fact be the same if you wanted to do simple pattern matching.</p>
<p>Step two is to perform a search against our trie and use the resulting data:</p>
<pre><code>Object result = main.search(entry);
if (result == null) {
  System.out.println("Not found");
} else if (result instanceof Trie) {
  System.out.println("Multiple matches:");
  Trie trie = (Trie) result;
  List data = trie.getSortedList();
} else {
  System.out.println("Found. Value is " + result);
}
</code></pre>
<p>Additionally we also have a delete operation if we need to remove a data entry from the trie:</p>
<pre>main.remove(entry);</pre>
<p><strong>Notes</strong></p>
<p>This implementation isn&#8217;t quite finished but should work adequately where needed.</p>
<p>To do:</p>
<p>1) Make case sensitivity optional<br />
2) Separate dump type functions into separate class to have clean trie class<br />
3) Clean up the java interface and add javadocs everywhere.</p>
<p>Download code <a href="http://www.happypappy.net/wp-content/uploads/2006/08/java-trie.zip" id="p43"><strong>here</strong></a>.</p>
<p>If you have any questions or feedback feel free to drop me an email at happy[at]happypappy.net.</p>
<p>A good reference to the trie and other data structures in Java can be found here:</p>
<p><iframe scrolling="no" frameBorder="0" src="http://rcm.amazon.com/e/cm?t=crazymartyblo-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=0471738840&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;lc1=0000ff&amp;bc1=000000&amp;bg1=ffffff&amp;f=ifr" marginHeight="0" marginWidth="0" style="width: 120px; height: 240px"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.happypappy.net/archives/5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SaveThePC</title>
		<link>http://www.happypappy.net/archives/7</link>
		<comments>http://www.happypappy.net/archives/7#comments</comments>
		<pubDate>Thu, 09 Feb 2006 09:18:07 +0000</pubDate>
		<dc:creator>Happy</dc:creator>
				<category><![CDATA[Techno]]></category>

		<guid isPermaLink="false">http://www.happypappy.net/?p=7</guid>
		<description><![CDATA[I just bought myself a new budget server and was having no end of grief trying to straighten out the integrated video on the el-cheapo-grande motherboard (Asus K8S-MX). 
After hours of poking, prodding, loading and unloading and copious amounts of cussing I finally called upon a friend of mine who knows a lot more about computers [...]]]></description>
			<content:encoded><![CDATA[<p>I just bought myself a new budget server and was having no end of grief trying to straighten out the integrated video on the el-cheapo-grande motherboard (Asus K8S-MX). </p>
<p>After hours of poking, prodding, loading and unloading and copious amounts of cussing I finally called upon a friend of mine who knows a lot more about computers that I ever will.</p>
<p>He gave me a few pointers and within fifteen minutes I had all my issues resolved.</p>
<p>If you&#8217;re having PC trouble save yourself the time and aggravation and look Tom up at <a href="http://www.savethepc.com/" target="_blank">Save the PC</a>.</p>
<p>This is a true story and not a cheap promotional effort.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.happypappy.net/archives/7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
