<?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>Francis Shanahan[.com] &#187; Web Development</title>
	<atom:link href="http://francisshanahan.com/index.php/category/computing/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://francisshanahan.com</link>
	<description>Thoughts on technology from a citizen scientist</description>
	<lastBuildDate>Sun, 25 Jul 2010 00:23:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Create CSS Rules from an HTML5 Canvas</title>
		<link>http://francisshanahan.com/index.php/2010/create-css-rules-from-an-html5-canvas/</link>
		<comments>http://francisshanahan.com/index.php/2010/create-css-rules-from-an-html5-canvas/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 00:23:32 +0000</pubDate>
		<dc:creator>Francis</dc:creator>
				<category><![CDATA[Cool & Future Tech]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://francisshanahan.com/?p=2687</guid>
		<description><![CDATA[Here I show how you can re-use your Canvas images as CSS backgrounds using another interesting feature coming in HTML5. You'll need a browser supporting CSS3 and Canvas, Chrome, Opera, Safari or Firefox will do. ]]></description>
			<content:encoded><![CDATA[<p>This thing caught me off guard but then I tried it, it worked so here it is: You&#8217;ll need a browser supporting CSS3 and Canvas for this post to make any sense. I tested with Chrome &amp; Firefox.</p>
<p>What&#8217;s the difference between the two blocks below?<br />
Answer: One&#8217;s a canvas and the other are div tags.<br />
<canvas id="canvas" width="120" height="120"></canvas></p>
<div id="box">
<div style="-webkit-transform: rotate(-10deg); -moz-transform: rotate(-10deg); transform: rotate(-10deg);">Hello</div>
<div style="-webkit-transform: rotate(15deg); -moz-transform: rotate(15deg); transform: rotate(15deg);">Canvas</div>
<div style="-webkit-transform: rotate(-4deg); -moz-transform: rotate(-4deg); transform: rotate(-4deg);">World</div>
<div style="-webkit-transform: rotate(8deg); -moz-transform: rotate(8deg); transform: rotate(8deg);">Que pasa?</div>
</div>
<p><script src="/js/dynamiccss.js" type="text/javascript">
</script><br />
<br/><br/><br/><br/><br/><br />
This might not seem that interesting at first so here&#8217;s the interesting bit: The Div&#8217;s background is actually taken from the Canvas. There&#8217;s only one Canvas on the page so how&#8217;s that working?<br />
Answer: A CSS class is dynamically created with its background set to the base64 output of the Canvas!</p>
<p>Yes, you can get the base64 encoding of any canvas element using canvas.toDataURL().</p>
<pre class="brush: javascript">
var base64 = canvas.toDataURL(&quot;image/png&quot;);
</pre>
<p>This was news to me but the connection was that the base64 data can then be used in a new CSS rule to with the data being the background, just like you&#8217;d do with a tiny image.</p>
<p>* Side note: It&#8217;s common to base64 encode images and directly embed them into the CSS file provided they are small enough. Base64 encoding is typically 33% larger than the binary data but you save the HTTP request. If you Sprite your images into one big file it&#8217;s less of a savings. Again, all things in engineering are a balance/compromise so do what makes sense for your situation. </p>
<pre class="brush: javascript">
var newClass = &quot;.newClass{  background:url(&quot;+base64+&quot;);} &quot;;
$(&quot;&lt;style type=&#039;text/css&#039;&gt;&quot;+size + newClass + &quot;&lt;/style&gt;&quot;).appendTo(&quot;head&quot;);
</pre>
<p>I then rotated the divs with CSS3 just for kicks. </p>
<pre class="brush: javascript">
&lt;div style=&quot;-webkit-transform: rotate(-10deg); -moz-transform: rotate(-10deg); transform: rotate(-10deg);&quot;&gt;Hello&lt;/div&gt;
</pre>
<p>Here&#8217;s the relevant code all in one piece: </p>
<pre class="brush: javascript">

// grab the data
var base64 = canvas.toDataURL(&quot;image/png&quot;);

var newClass = &quot;.newClass{  background:url(&quot;+base64+&quot;);} &quot;;

$(&quot;&lt;style type=&#039;text/css&#039;&gt;&quot; + newClass +&quot;&lt;/style&gt;&quot;).appendTo(&quot;head&quot;);

$(&#039;#box div&#039;).addClass(&quot;newClass&quot;);
</pre>
<p>So why would you ever do this? I suppose you might do this to avoid creating a lot of smaller canvas tags. I haven&#8217;t checked but I&#8217;d wager the overhead for a canvas is higher than that of a CSS rule. You can create one canvas image and then use it all over the place with CSS. </p>
<p>You could implement rounded corners with this but it&#8217;s probably the most complex way of doing rounded corners ever so wouldn&#8217;t recommend it there either. </p>
<p>One possible use of this is to take a copy of an image as it&#8217;s being built. E.g. Canvas images are bitmaps and there&#8217;s no &#8220;undo&#8221;. Unlike SVG, they don&#8217;t modify the DOM so you can&#8217;t add and remove elements of the image. Imagine a graph built using Canvas, if the user modifies the graph it might be useful to take a copy of it before the modification. You could do this by dumping the base64 data and displaying as a CSS image, rather than creating a 2nd canvas element. I&#8217;m reaching here but you get the idea. </p>
<p>I&#8217;m not sure this will ever have a practical application. For now it&#8217;s just an interesting tech experiment and another example of the cool stuff possible with HTML5. </p>
]]></content:encoded>
			<wfw:commentRss>http://francisshanahan.com/index.php/2010/create-css-rules-from-an-html5-canvas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Identicon5 &#8211; Identicons using HTML5 Canvas &amp; JQuery</title>
		<link>http://francisshanahan.com/index.php/2010/html5-identicons-using-canvas-jquery-plugin/</link>
		<comments>http://francisshanahan.com/index.php/2010/html5-identicons-using-canvas-jquery-plugin/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 22:30:31 +0000</pubDate>
		<dc:creator>Francis</dc:creator>
				<category><![CDATA[Cool & Future Tech]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://francisshanahan.com/?p=2656</guid>
		<description><![CDATA[What do you get when you combine Digital Identity, MD5 Hashes, the Canvas element, JQuery and Quilting? Answer: My first JQuery plugin &#8211; &#8220;Identicon5&#8243; for want of a better name.
Identicon5 is a JQuery plugin that takes an MD5 hash and  converts it to a unique image. It&#8217;s called Identicon5 since it works  through the HTML5 Canvas element.
Working Demo is here: http://francisshanahan.com/identicon5/test.html
Project page is here: http://francisshanahan.com/index.php/identicon5
JQuery Plugin page is here: http://plugins.jquery.com/project/identicon5
Identicons provide a nice visual representation of a user&#8217;s identity,  that&#8217;s unique to that user, without divulging any ...]]></description>
			<content:encoded><![CDATA[<p>What do you get when you combine Digital Identity, MD5 Hashes, the Canvas element, JQuery and Quilting? Answer: My first JQuery plugin &#8211; &#8220;Identicon5&#8243; for want of a better name.</p>
<p><strong>Identicon5</strong> is a JQuery plugin that takes an MD5 hash and  converts it to a unique image. It&#8217;s called Identicon5 since it works  through the HTML5 Canvas element.</p>
<p><strong>Working Demo is here: </strong><a href="http://francisshanahan.com/identicon5/test.html" target="_blank">http://francisshanahan.com/identicon5/test.html</a></p>
<p>Project page is here: <a href="http://francisshanahan.com/index.php/identicon5" target="_blank">http://francisshanahan.com/index.php/identicon5</a></p>
<p>JQuery Plugin page is here: <a href="http://plugins.jquery.com/project/identicon5" target="_blank">http://plugins.jquery.com/project/identicon5</a></p>
<p>Identicons provide a nice visual representation of a user&#8217;s identity,  that&#8217;s unique to that user, without divulging any private information. You&#8217;ve probably seen them in use on many social websites e.g. <a href="http://stackoverflow.com/" target="_blank">http://stackoverflow.com</a></p>
<p>Identicons are the little geometrical profile images for certain users. Normally Gravatar.com serves up an image based off the MD5 hash of your email address. If you&#8217;ve defined a profile image it&#8217;ll serve that but if not it&#8217;ll show your Identicon, this blog itself is Gravatar enabled as are most WordPress installations.</p>
<p>EXCERPT from Wikipedia</p>
<blockquote><p>An Identicon is a visual representation of a hash value, usually of the IP address, serving to identify a user of a computer system. The original Identicon is a 9-block graphic, which has been extended to other graphic forms by third parties some of whom have used MD5 instead of the IP address as the identifier. In summary, an Identicon is a privacy protecting derivative of each user&#8217;s IP address built into a 9-block image and displayed next the user&#8217;s name.</p>
<p>A visual representation is thought to be easier to compare than one which uses only numbers and more importantly, it maintains the person&#8217;s privacy.</p>
<p>The Identicon graphic is unique since it&#8217;s based on the users IP, but it is not possible to recover the IP by looking at the Identicon.</p></blockquote>
<p>If you have page with a lot of Users listed, either because there are a lot of contributors on the thread, you might end up with a lot of Identicon image links. Each image is small, about 1kb and carries an HTTP connection as additional overhead. This isn&#8217;t really a big problem given today&#8217;s bandwidth on the Desktop but on my Droid it becomes an issue. Besides, with HTML5 we can do better.</p>
<p>Identicon5 takes the same MD5 hash value and draws the image dynamically using a Canvas element within the browser. This eliminates the HTTP call and saves you 1kb per profile image. If Canvas is not supported it&#8217;ll degrade into a standard img tag linking to Gravatar.</p>
<p>How does Quilting enter into it? Don Parks came up with the notion of using small tiles, arranged in a 3&#215;3 grid per Identicon. The process uses a selection of smaller shapes in each 3&#215;3 grid square and either rotates it or colors it depending on the input value. This is essentially how quilts have been made for hundreds of years.</p>
<p>I&#8217;m sure this won&#8217;t be the most popular jQuery plugin ever but the idea of applying newer technologies such as HTML5 Canvas to solve a problem that would traditionally have been fixed with a network call was very interesting to me so just had to hack it together.</p>
<p>This is a very tangible example of how HTML5 will make the web more scalable.</p>
]]></content:encoded>
			<wfw:commentRss>http://francisshanahan.com/index.php/2010/html5-identicons-using-canvas-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Input Types in HTML5</title>
		<link>http://francisshanahan.com/index.php/2010/html5-form-input-type/</link>
		<comments>http://francisshanahan.com/index.php/2010/html5-form-input-type/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 15:28:32 +0000</pubDate>
		<dc:creator>Francis</dc:creator>
				<category><![CDATA[Cool & Future Tech]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://francisshanahan.com/?p=2642</guid>
		<description><![CDATA[I&#8217;ve recently been doing a lot of digging into quote/unquote &#8220;newer&#8221; browser capabilities, some of which are very cool. I will share what I&#8217;ve discovered as I go.
As always I&#8217;m using a little &#8220;test project&#8221; as my sandbox, this is a real-world website that&#8217;ll use all these features and I&#8217;ll share that when it&#8217;s done.  So far I&#8217;m using oAuth/Twitter integration, ASP.NET MVC/JQuery as a basic stack and am adding in HTML5 and CSS3 features. The resulting site will not be pretty but the point for me is always to ...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been doing a lot of digging into quote/unquote &#8220;newer&#8221; browser capabilities, some of which are very cool. I will share what I&#8217;ve discovered as I go.</p>
<p>As always I&#8217;m using a little &#8220;test project&#8221; as my sandbox, this is a real-world website that&#8217;ll use all these features and I&#8217;ll share that when it&#8217;s done.  So far I&#8217;m using oAuth/Twitter integration, ASP.NET MVC/JQuery as a basic stack and am adding in HTML5 and CSS3 features. The resulting site will not be pretty but the point for me is always to get more exposure than having just read the brochure.</p>
<p>This time around the topic is form controls.</p>
<p>I hate forms, they are so boring and my luddite brain can never seem to figure out how to lay them out properly. There is nothing interesting about forms, what could HTML5 possibly bring to the equation?</p>
<p>I was pleasantly surprised; HTML5 under &#8220;Web Forms 2.0&#8243; adds a bunch of new form input types. In HTML4 you have</p>
<pre class="brush: javascript">

&lt;input type=&quot;text&quot; id=&quot;someText&quot; /&gt;
</pre>
<p>In HTML5 you can actually specify the type with a bit more semantics, e.g. &#8220;tel&#8221; for telephone or &#8220;number&#8221; for integers and the browser will apply some basic masking to the field.</p>
<p>Number and Date types are fairly typical but I was surprised how specific these get, e.g. &#8220;type=color&#8221;, &#8220;type=url&#8221; and &#8220;type=search&#8221;.</p>
<p>Another interesting one is &#8220;type=range&#8221; which allows a text field to be accessed via a little slider control. Before I would&#8217;ve had to implement something like a JQueryUI Slider, now the browser will handle this for me natively. Here&#8217;s an example:</p>
<div id="_mcePaste">
<pre class="brush: javascript">&lt;/div&gt;
&lt;div&gt;&lt;input type=&quot;range&quot; min=&quot;10&quot; max=&quot;90&quot; /&gt;&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;</pre>
</div>
<input type="range" />
<p>In addition to new input types there are also new attributes which will further reduce the amount of client-side javascript needed for forms. E.g. the  &#8220;required&#8221; and &#8220;autofocus&#8221; attributes do as their names imply. This is where CSS3 comes in with its pseudo-classes. E.g. input fields now have a pseudoclass called &#8220;valid&#8221; and &#8220;invalid&#8221;.  I can style these like this:</p>
<pre class="brush: javascript">

input:valid {
background-color: red;
}

input:invalid {
background-color: red;
}
</pre>
<p>When a field tagged with &#8220;required&#8221; but it&#8217;s empty, the browser *should* assign this pseudo-class and render it accordingly. Hey, that&#8217;s saving me some more boiler-plate Javascript.</p>
<p>Some interesting ones though are &#8220;min&#8221; and &#8220;max&#8221;, e.g. when applied to a &#8220;type=number&#8221; or &#8220;range&#8221; will determine the limiting values for the control. Excellent.</p>
<p>I&#8217;ve looked at the spec ( <a href="http://www.whatwg.org/specs/web-apps/current-work/">http://www.whatwg.org/specs/web-apps/current-work/</a> ) and do have some questions still such as how to localize things like the telephone field masks? I&#8217;m sure we&#8217;ll see some more on this in the future.</p>
<p>Besides simpler coding, these new semantics should also improve accessibility. Things like JAWS can now distinguish required fields from the DOM and determine that field A is an email vs field B being a search box.</p>
<p>This is all fairly new so the specifics of what each browser does will likely flex a bit until fully bedded down, most of these don&#8217;t do anything (yet). At least the markup is there now and I&#8217;m liking where this is headed.</p>
<p>Here&#8217;s a simple test page I came across for reference: <a href="http://miketaylr.com/code/input-type-attr.html" target="_blank">http://miketaylr.com/code/input-type-attr.html</a></p>
<p>As always you can check with <a href="http://caniuse.com" target="_blank">http://caniuse.com</a> for a detailed rundown of who&#8217;s supporting what.  (Opera&#8217;s had this stuff for quite a while now).</p>
]]></content:encoded>
			<wfw:commentRss>http://francisshanahan.com/index.php/2010/html5-form-input-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 Canvas vs SVG</title>
		<link>http://francisshanahan.com/index.php/2010/html5-canvas-vs-svg/</link>
		<comments>http://francisshanahan.com/index.php/2010/html5-canvas-vs-svg/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 16:18:52 +0000</pubDate>
		<dc:creator>Francis</dc:creator>
				<category><![CDATA[Cool & Future Tech]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://francisshanahan.com/?p=2637</guid>
		<description><![CDATA[What is the new Canvas tag in HTML5 all about? And why would I use it over SVG (scalable vector graphics)? I took a look and here's what I found out...]]></description>
			<content:encoded><![CDATA[<p>What is the new Canvas tag in HTML5 all about? And why would I use it over SVG (scalable vector graphics)? I took a look and here&#8217;s what I found out:</p>
<p>SVG as we know has been around a few years although has not really found a firm foothold in the world of web development. I  didn&#8217;t realize but even IE6 supports SVG.  So why the slow adoption?</p>
<p>It seems the standard for SVG took a long time to get settled and performance is not great.  SVG is based on vectors so they zoom/scale really well without any pixelation. On the downside they manipulate the DOM so the browser&#8217;s memory and CPU requirements can become quite large.  What&#8217;s nice is you can save to SVG path format from a lot of drawing applications such as Illustrator.</p>
<p>The &lt;canvas&gt; tag is new in HTML5 and essentially is a bitmap that&#8217;s procedurally manipulated using javascript. It doesn&#8217;t create new elements in the DOM and is relatively faster than SVG as a result.  Graphics don&#8217;t zoom or scale as in SVG but I suppose you could simulate this behaviour since the image is procedural (built from instructions).</p>
<p>Boris Smus has a nice post comparing the performance of each : <a href="http://www.borismus.com/canvas-vs-svg-performance/" target="_blank">http://www.borismus.com/canvas-vs-svg-performance/</a></p>
<p>There are libraries to help you with each implementation, here&#8217;s a couple I found whilst researching graphs:</p>
<ul>
<li>RaphaelJS for SVG (recently acquired by Sencha (<a href="http://www.sencha.com" target="_blank">www.sencha.com</a>) formerly ExtJS.com) and</li>
<li>RGraph.net for &lt;canvas&gt; (<a href="http://www.rgraph.net" target="_blank">www.rgraph.net</a>)</li>
</ul>
<p>So, which one to use? As always it depends on the need. I&#8217;m looking to replace OpenFlashChart currently with rGraph.net and give it a whirl. Flash is too heavy and slow for my simple graphing needs and I want to be buzzword compatible. SVG paths are a little funky, especially if I&#8217;m going to be manipulating them dynamically so I&#8217;ll go the HTML5 route.</p>
<p>Check with <a href="http://caniuse.com" target="_blank">http://caniuse.com</a> for browser compatibility and degrade with <a href="http://www.modernizr.com/" target="_blank">http://modernizr.com</a> to tick the least number of users off.</p>
]]></content:encoded>
			<wfw:commentRss>http://francisshanahan.com/index.php/2010/html5-canvas-vs-svg/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Converting the WordPress Arthemia Theme to HTML5</title>
		<link>http://francisshanahan.com/index.php/2010/wordpress-arthemia-theme-html5/</link>
		<comments>http://francisshanahan.com/index.php/2010/wordpress-arthemia-theme-html5/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 02:49:10 +0000</pubDate>
		<dc:creator>Francis</dc:creator>
				<category><![CDATA[Cool & Future Tech]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://francisshanahan.com/?p=2618</guid>
		<description><![CDATA[The other day I converted the current WordPress theme of this site from XHTML Transitional 1.0 to HTML5. It was fairly easy so here&#8217;s what I did.
An XHTML 1.0 transitional website was a great place to start. I used the trusty w3c validator located at http://validator.w3.com.
First thing was to get the Doctype fixed up: I changed
&#60;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&#62;
to
&#60;!DOCTYPE html&#62;
and bingo, we&#8217;re recognized as HTML5 instead of XHTML. Not compliant yet though. I removed the profile attribute from my head tag as so:
&#60;head profile=&#8221;http://gmpg.org/xfn/11&#8243;&#62; which wasn&#8217;t ...]]></description>
			<content:encoded><![CDATA[<p>The other day I converted the current WordPress theme of this site from XHTML Transitional 1.0 to HTML5. It was fairly easy so here&#8217;s what I did.</p>
<p>An XHTML 1.0 transitional website was a great place to start. I used the trusty w3c validator located at <a href="http://validator.w3.com" target="_blank">http://validator.w3.com</a>.</p>
<p>First thing was to get the Doctype fixed up: I changed</p>
<p>&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;</p>
<p>to</p>
<p>&lt;!DOCTYPE html&gt;</p>
<p>and bingo, we&#8217;re recognized as HTML5 instead of XHTML. Not compliant yet though. I removed the profile attribute from my head tag as so:</p>
<p>&lt;head profile=&#8221;http://gmpg.org/xfn/11&#8243;&gt; which wasn&#8217;t serving any purpose anyway so it became</p>
<p>&lt;head&gt;</p>
<p>Removed a stray &lt;/link&gt; tag from the header, added an alt tag where there was one missing, removed px from all width and height attributes and removed a frameborder tag (obsolete).</p>
<p>That completed the HTML5 cleanup. At this point the site validated but was not actually using any tags.</p>
<p>Next up adding some HTML5 semantic tags: I added the &lt;header&gt; and &lt;nav&gt; tags in the appropriate places, defined a &lt;section role=&#8221;main&#8221;&gt; tag for the main area of the page. Slapped in some &lt;article&gt; and &lt;header&gt; tags. The only one worth mentioned was the &lt;time&gt; tag which took a different format from the datetime I was using so it&#8217;s:</p>
<p>&lt;time datetime=&#8221;&lt;?php the_time(&#8216;Y-m-d&#8217;) ?&gt;&#8221;&gt;&lt;/time&gt;</p>
<p>And lastly added a &lt;footer&gt; tag. In terms of the theme I touched header.php, footer.php, index.php and single.php. Easy stuff and now I&#8217;m fully geeked out on HTML5.</p>
]]></content:encoded>
			<wfw:commentRss>http://francisshanahan.com/index.php/2010/wordpress-arthemia-theme-html5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Arvixe &gt; Webhost4life</title>
		<link>http://francisshanahan.com/index.php/2010/arvixe-webhost4life/</link>
		<comments>http://francisshanahan.com/index.php/2010/arvixe-webhost4life/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 01:18:51 +0000</pubDate>
		<dc:creator>Francis</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://francisshanahan.com/?p=2625</guid>
		<description><![CDATA[By the time you read this the site will have moved to a new hosting provider (Arvixe.com).
Webhost4life was a good host for many years but something changed recently. The site was moved to a new platform without warning.
It was ported to new servers, which I&#8217;m guessing are virtual. My SSL certificate disappeared in the process. My site worked slower&#8230;MUCH slower and was out of service numerous times. Not only that but the configuration changed. The new platform doesn&#8217;t support .NET 4.0 or the .NET Wildcard mapping in IIS. Support switched ...]]></description>
			<content:encoded><![CDATA[<p>By the time you read this the site will have moved to a new hosting provider (Arvixe.com).</p>
<p>Webhost4life was a good host for many years but something changed recently. The site was moved to a new platform without warning.</p>
<p>It was ported to new servers, which I&#8217;m guessing are virtual. My SSL certificate disappeared in the process. My site worked slower&#8230;MUCH slower and was out of service numerous times. Not only that but the configuration changed. The new platform doesn&#8217;t support .NET 4.0 or the .NET Wildcard mapping in IIS. Support switched to a &#8220;premium&#8221; service which had to be paid for. All tickets I opened were answered only after 1-2 hours and even then only with a stock response of &#8220;we apologize and your issue has been routed to a specialist&#8221;. With service like that I don&#8217;t need &#8216;em.</p>
<p>Here&#8217;s hoping Arvixe is better and so far so good.</p>
]]></content:encoded>
			<wfw:commentRss>http://francisshanahan.com/index.php/2010/arvixe-webhost4life/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rich Clients, Smartphones and a Roadmap for HTML5</title>
		<link>http://francisshanahan.com/index.php/2010/a-roadmap-for-html5/</link>
		<comments>http://francisshanahan.com/index.php/2010/a-roadmap-for-html5/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 21:26:51 +0000</pubDate>
		<dc:creator>Francis</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[General Computing]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://francisshanahan.com/?p=2597</guid>
		<description><![CDATA[As technology rambles on, we see an ever increase in the richness of client-side web-hosted applications. Web applications need to move beyond RIA and into fully fledged applications which are downloaded like a web page but have more and more thick-client-like behaviour such as client-side storage. 
Yeah, yeah, we&#8217;ve heard this all before but the big question is when is it going to happen and how? 
The technology that&#8217;ll power this is undoubtedly HTML5. 
Looking at the desktop market-share we see that

Firefox &#8211; 31.26%
Internet Explorer 8 &#8211; 25.23%
Internet Explorer 6 ...]]></description>
			<content:encoded><![CDATA[<p>As technology rambles on, we see an ever increase in the richness of client-side web-hosted applications. Web applications need to move beyond RIA and into fully fledged applications which are downloaded like a web page but have more and more thick-client-like behaviour such as client-side storage. </p>
<p>Yeah, yeah, we&#8217;ve heard this all before but the big question is when is it going to happen and how? </p>
<p>The technology that&#8217;ll power this is undoubtedly HTML5. </p>
<p>Looking at the desktop market-share we see that</p>
<ol>
<li>Firefox &#8211; 31.26%</li>
<li>Internet Explorer 8 &#8211; 25.23%</li>
<li>Internet Explorer 6 &#8211; 18.11%</li>
<li>Internet Explorer 7 &#8211; 12.59%</li>
<li>Chrome &#8211; 7.72%</li>
<li>Safari &#8211; 5.15%</li>
<li>Opera &#8211; 1.98%</li>
</ol>
<p>Reference &#8211; http://en.wikipedia.org/wiki/Usage_share_of_web_browsers</p>
<p>If you want to know the HTML5 story you must look at the rendering engine used by these browsers. </p>
<p>All browsers render web pages through the use of a &#8220;rendering engine&#8221;, this is what how the HTML, CSS is interpreted and turned into a visualization of the page. Current rendering engines are WebKit (Safari, Chrome), Gecko(Seamonkey, Firefox) and Trident (Internet Explorer) with some other outliers.</p>
<p>Wikipedia details how well the rendering engines compare in terms of HTML5 support [<a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(HTML5)">LINK</a>] and we find that WebKit is leading the pack. </p>
<p>Webkit-powered browsers have the least market share on the desktop (right now) but the highest market share on mobile devices. In fact in February RIM made indications that it was planning to move the Blackberry to a WebKit powered device. </p>
<p>According to NPD [<a href="http://www.businesswire.com/portal/site/home/permalink/?ndmViewId=news_view&#038;newsId=20100510005773&#038;newsLang=en">link</a>]:</p>
<blockquote><p>&#8220;Currently, BlackBerry leads the pack with 36% of market share of smartphones with Android following closely with 28% and iPhone chugging along at 21% for the 2010 sales&#8221;</p></blockquote>
<p>Add that the recent introduction of the iPad which no doubt uses Webkit in some form for its browser and you have the perfect storm of WebKit support on smartphones (excluding other mobile devices such as traditional cell phones which don&#8217;t really factor into this discussion). </p>
<p>Consequently It seems Smartphones/Pads will be among some of the first devices to really support HTML5. Smartphone user base grew at somewhere between 10-20% in 2009 and by 2011 50% of all phones sold are expected to be smartphones. Clearly there is huge demand for this technology. Even today, my Dolphin Browser running on android is scoring a &#8220;144 out of a possible 300&#8243; for HTML5 support whereas IE8 on Windows 7 scores a pitiful &#8220;27&#8243;. </p>
<p>What does this mean in terms of IT? Well HTML5 fills a lot of gaps. Better browser APIs, more advanced media playback, offline storage, vector graphics support, intra-browser communication and better markup. </p>
<p>If you&#8217;re looking at making a presentation-tier investment then JavaScript, CSS and HTML 5 remain your best choices. I expect Flash to continue to hold court in certain areas but with an ever-greater spotlight being shone on security I&#8217;d expect a drop off of some kind. I really don&#8217;t see the point of AIR anymore and any future needs for vector graphics can be directed to the HTML5 standard. Silverlight? JavaFX? Well who&#8217;s to say but right now I could not justify an investment in these technologies by any stretch of the imagination. </p>
<p>It&#8217;s a good time to be a developer; Javascript, CSS and HTML skills will be ever more in demand, dev tools in the area will become first-class citizens and who knows, we may even see some decent code-coverage tools for the client-side. </p>
<p>You can check your browser&#8217;s support at <a href="http://html5test.com/">http://html5test.com/</a>.</p>
<p>The image on this post is a capture of the SVG Tiger, typically used as a test case for vector graphics support (similar to the OpenGL Mandril). You can find an actual vector-rendering of same using an HTML5 capable browser and Raphael here [<a href="http://raphaeljs.com/tiger.html">LINK</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://francisshanahan.com/index.php/2010/a-roadmap-for-html5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Simple Example of Deferred Binding in GWT</title>
		<link>http://francisshanahan.com/index.php/2010/a-simple-example-of-deferred-binding-in-gwt/</link>
		<comments>http://francisshanahan.com/index.php/2010/a-simple-example-of-deferred-binding-in-gwt/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 04:51:23 +0000</pubDate>
		<dc:creator>Francis</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[deferred binding]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://francisshanahan.com/?p=2486</guid>
		<description><![CDATA[Deferred Binding in GWT lets you swap classes at compile time and have GWT generate the result into JavaScript as if you&#8217;d coded it that way from the start. Sort of like reflection but at compile time instead of runtime. It&#8217;s a bit of nonsense to allow extension of GWT beyond what the native compiler can do. 
As a side-note, GWT&#8217;s big value add is that it generates JavaScript off of Java. It also does some things during compilation which will speed up the JavaScript it produces de-virtualizing methods and ...]]></description>
			<content:encoded><![CDATA[<p>Deferred Binding in GWT lets you swap classes at compile time and have GWT generate the result into JavaScript as if you&#8217;d coded it that way from the start. Sort of like reflection but at compile time instead of runtime. It&#8217;s a bit of nonsense to allow extension of GWT beyond what the native compiler can do. </p>
<p>As a side-note, GWT&#8217;s big value add is that it generates JavaScript off of Java. It also does some things during compilation which will speed up the JavaScript it produces de-virtualizing methods and so forth. We used to do this back in the day with C, unwinding loops, in-lining assembly code and so on. GWT does similar stuff to shave milliseconds off processing time. However, it&#8217;s questionable since GWT&#8217;s flagship application: Google Wave has a resource profile that weighs in at a whopping 3MB and looks like this: </p>
<p><a href="http://francisshanahan.com/wp-content/uploads/2010/04/wave.PNG"><img src="http://francisshanahan.com/wp-content/uploads/2010/04/wave.PNG" width="550"/></a></p>
<p>The first thing you need is an interface, this has to go in your client package from what I can tell: </p>
<p>Human.java: </p>
<pre class="brush: java">
package com.crap.crapGWT.client;

public interface Human {
   void WhatAmI();
}
</pre>
<p>Then you need a couple of classes that implement this interface: </p>
<p>Woman.java: </p>
<pre class="brush: java">
package com.crap.crapGWT.client;

import com.google.gwt.user.client.Window;

public class Woman implements Human {
	public void WhatAmI() {
		Window.alert(&quot;I&#039;m a lady&quot;);
 	}
}
</pre>
<p>and </p>
<p>Man.java: </p>
<pre class="brush: java">
package com.crap.crapGWT.client;

import com.google.gwt.user.client.Window;

public class Man implements Human {
	public void WhatAmI() {
		Window.alert(&quot;I&#039;m a dude&quot;);
 	}
}
</pre>
<p>In onModuleLoad() add the following: </p>
<pre class="brush: java">
Human myHuman = (Human)GWT.create(Human.class);
myHuman.WhatAmI();
</pre>
<p>Then you define some properties, you can put the following in your main module XML file OR you can put it in its own file. If you do the latter you must inherit that XML file in the main module. </p>
<pre class="brush: xml">
&lt;define-property name=&quot;human&quot; values=&quot;man,woman&quot; /&gt;
	&lt;property-provider name=&quot;human&quot;&gt;
&lt;![CDATA[
     return __gwt_getMetaProperty(&quot;human&quot;);
]]&gt;
&lt;/property-provider&gt;
</pre>
<p>Believe it or not the above is actually JavaScript! (wasn&#8217;t this what we wanted to avoid by adopting GWT?) </p>
<p>Then in your main XML module put the rules by which the classes are swapped out. E.g. below, if you find a human property set to &#8220;man&#8221; replace this with the Man class. </p>
<pre class="brush: xml">
&lt;replace-with class=&quot;com.crap.crapGWT.client.Man&quot;&gt;
	&lt;when-type-is class=&quot;com.crap.crapGWT.client.Human&quot; /&gt;
	&lt;when-property-is name=&quot;human&quot; value=&quot;man&quot; /&gt;
&lt;/replace-with&gt;

&lt;replace-with class=&quot;com.crap.crapGWT.client.Woman&quot;&gt;
	&lt;when-type-is class=&quot;com.crap.crapGWT.client.Human&quot; /&gt;
	&lt;when-property-is name=&quot;human&quot; value=&quot;woman&quot; /&gt;
&lt;/replace-with&gt;
</pre>
<p>And finally add in the actual property itself in the HTML file in your WAR. </p>
<pre class="brush: xml">
&lt;meta name=&#039;gwt:module&#039; content=&#039;js/gwt=com.crap.crapGWT.client.Human&#039;/&gt;
&lt;meta name=&#039;gwt:property&#039; content=&#039;human=woman&#039;/&gt;
</pre>
<p>If everything goes well you should get a popup saying &#8220;I&#8217;m a lady&#8221;. </p>
<p>If you have trouble, go back and check everything, particularly the class namespaces. If all looks well yet you still can&#8217;t get it to work, restart Eclipse (*yes* I&#8217;m not kidding). </p>
<p>Then finally change the property to a &#8220;man&#8221; and you&#8217;ll get a different message. </p>
<pre class="brush: xml">
&lt;meta name=&#039;gwt:property&#039; content=&#039;human=man&#039;/&gt;
</pre>
<p>You can try this also: </p>
<pre class="brush: java">
if (myHuman instanceof Human) Window.alert(&quot;myHuman is a Human&quot;);
if (myHuman instanceof Man) Window.alert(&quot;myHuman is a Man&quot;);
if (myHuman instanceof Woman) Window.alert(&quot;myHuman is a Woman&quot;);
</pre>
<p>So that&#8217;s Deferred Binding. </p>
]]></content:encoded>
			<wfw:commentRss>http://francisshanahan.com/index.php/2010/a-simple-example-of-deferred-binding-in-gwt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Simple GWT Generator Example</title>
		<link>http://francisshanahan.com/index.php/2010/a-simple-gwt-generator-example/</link>
		<comments>http://francisshanahan.com/index.php/2010/a-simple-gwt-generator-example/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 21:02:58 +0000</pubDate>
		<dc:creator>Francis</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Web 2.0 Experiments]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[deferred binding]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Generators]]></category>
		<category><![CDATA[GWT]]></category>

		<guid isPermaLink="false">http://francisshanahan.com/?p=2493</guid>
		<description><![CDATA[Generators allow the GWT coder to generate Java code at compile time and have it then be compiled along with the rest of the project into JavaScript. They are a sort of similar to T4 Templates in the .NET world. I don&#8217;t recommend Generators because you end up writing a lot of code in printLn()s which is sort of the opposite of &#8220;maintainability&#8221;. However, there were so few examples available I decided to post a simple one here just for the sake of it. 
My Use Case is I want ...]]></description>
			<content:encoded><![CDATA[<p>Generators allow the GWT coder to generate Java code at compile time and have it then be compiled along with the rest of the project into JavaScript. They are a sort of similar to T4 Templates in the .NET world. I don&#8217;t recommend Generators because you end up writing a lot of code in printLn()s which is sort of the opposite of &#8220;maintainability&#8221;. However, there were so few examples available I decided to post a simple one here just for the sake of it. </p>
<p>My Use Case is I want to generate a screen off of metadata and have it hooked to events written in Java code. </p>
<p>First you&#8217;ll need an interface that will be used to trigger the Generator. Anytime compiler sees this interface it&#8217;ll swap in a generated class. </p>
<pre class="brush: java">
package com.crap.crapGWT.client;

import com.google.gwt.user.client.ui.RootPanel;

public interface ScreenObject {
	void PaintScreen(RootPanel rp);
}
</pre>
<p>Next you need an implementor of that interface</p>
<pre class="brush: java">
package com.crap.crapGWT.client;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;

public class ExampleScreen implements ScreenObject {

	@Override
	public void PaintScreen(RootPanel rp) {
             // Leave this empty
	}
}
</pre>
<p>Next you need a flag in the main GWT XML module file: </p>
<pre class="brush: xml">
&lt;generate-with class=&quot;com.crap.crapGWT.server.WidgetGenerator&quot;&gt;
	&lt;when-type-assignable class=&quot;com.crap.crapGWT.client.ScreenObject&quot; /&gt;
&lt;/generate-with&gt;
</pre>
<p>The above tells the compiler to trigger the generator (WidgetGenerator). This needs to go in your server code, not the client or shared. </p>
<pre class="brush: java">
package com.crap.crapGWT.server;

import java.io.PrintWriter;

import com.google.gwt.core.ext.Generator;
import com.google.gwt.core.ext.GeneratorContext;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JClassType;
import com.google.gwt.core.ext.typeinfo.NotFoundException;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;

public class WidgetGenerator extends Generator {

	@Override
	public String generate(TreeLogger logger, GeneratorContext context,
			String typeName) throws UnableToCompleteException {
		// Build a new class, that implements a &quot;paintScreen&quot; method
		JClassType classType;

		try {
			classType = context.getTypeOracle().getType(typeName);

			// Here you would retrieve the metadata based on typeName for this Screen
			SourceWriter src = getSourceWriter(classType, context, logger);
			src.println(&quot;public void PaintScreen(RootPanel rp) {&quot;);		

			// Here you would iterate through the metadata adding elements to the code
			src.println(&quot;Button myButton = new Button(\&quot;Click Me\&quot;);&quot;);

			// Now hook up the events, in this case the naming convention is &lt;Class&gt;Events so
			// &quot;ExampleScreen&quot; becomes &quot;ExampleScreenEvents&quot;
			src.println(&quot;myButton.addClickHandler(new &quot; + typeName + &quot;Events());&quot;);
			src.println(&quot;rp.get().add(myButton);&quot;);

			src.println(&quot;}&quot;);
			src.commit(logger);

			System.out.println(&quot;Generating for: &quot; + typeName);
			return typeName + &quot;Generated&quot;;

		} catch (NotFoundException e) {
			e.printStackTrace();
		}
		return null;
	}

	public SourceWriter getSourceWriter(JClassType classType,
			GeneratorContext context, TreeLogger logger) {
		String packageName = classType.getPackage().getName();
		String simpleName = classType.getSimpleSourceName() + &quot;Generated&quot;;
		ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(
				packageName, simpleName);
		composer.setSuperclass(classType.getName());
		composer.addImplementedInterface(&quot;com.crap.crapGWT.client.ScreenObject&quot;);

		// Need to add whatever imports your generated class needs.
		composer.addImport(&quot;com.crap.crapGWT.client.ScreenObject&quot;);
		composer.addImport(&quot;com.google.gwt.user.client.Window&quot;);
		composer.addImport(&quot;com.google.gwt.user.client.rpc.AsyncCallback&quot;);
		composer.addImport(&quot;com.google.gwt.user.client.ui.Button&quot;);
		composer.addImport(&quot;com.google.gwt.user.client.ui.RootPanel&quot;);

		PrintWriter printWriter = context.tryCreate(logger, packageName,
				simpleName);
		if (printWriter == null) {
			return null;
		} else {
			SourceWriter sw = composer.createSourceWriter(context, printWriter);
			return sw;
		}
	}
}
</pre>
<p>This is the meat and potatoes of the business. You&#8217;ll see the code is doing a println to print out the actual Java that&#8217;ll then be coupled with the rest of the project. Very messy stuff. </p>
<p>You&#8217;ll also notice I&#8217;ve tied the button above to an event Handler implemented in &#8220;<className>&#8221; + &#8220;Events&#8221; so in this case ExampleScreenEvents.java: </p>
<pre class="brush: java">

package com.crap.crapGWT.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;

public class ExampleScreenEvents implements ClickHandler {

	@Override
	public void onClick(ClickEvent event) {
		Window.alert(&quot;Hello from onClick of MyExampleScreenEvent Handler&quot;);
	}
}
</pre>
<p>Finally you need to create the screen, in onModuleLoad just add the following: </p>
<pre class="brush: java">
ScreenObject s = GWT.create(ExampleScreen.class);
s.PaintScreen(RootPanel.get());
</pre>
<p>Presto, it works. Run the sample, you&#8217;ll see a button added to the form, click it and you&#8217;ll get the hello world message. </p>
<p>There are a lot of issues with this. If you make a mistake, your code will break at compile time which is good, but since it&#8217;s breaking on a generated file, you&#8217;ll need to go digging in the TEMP folder to find the actual Java code that&#8217;s broken. For me this was located in C:\Documents and Settings\fs11782\Local Settings\Temp\ExampleScreenWrapper4091248644661218253.java<br />
Exactly like T4 templates. Very messy. </p>
<p>The code is written out using strings, that makes it tough to maintain. It was very often necessary to import the generated file into the project to see what the issue was, then adjust the generator and then run it again. </p>
<p>Every time I did this Eclipse failed to recognize the changes and would only pick them up after a shutdown/restart of the IDE. </p>
<p>Generators in GWT: not recommended but there you are. </p>
<p>Let&#8217;s take a step back; GWT is supposed to solve the &#8220;problem&#8221; (false premise) of writing JavaScript. JavaScript is &#8220;bad&#8221; because it&#8217;s a dynamic language, loosely typed, interpreted and so on. Yet those are also advantages. Thinking back a few years I seem to recall a similar discussion between Lisp programmers and C++.  By introducing Generators, I&#8217;ve actually lost all the perceived benefits of GWT, writing code out as a println() for example. I do get to write my code in Java but at a fairly high cost and high level of complexity with multiple layers of abstraction introduced into the solution. </p>
]]></content:encoded>
			<wfw:commentRss>http://francisshanahan.com/index.php/2010/a-simple-gwt-generator-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ExtJS, Metadata and GWT</title>
		<link>http://francisshanahan.com/index.php/2010/extjs-metadata-gwt/</link>
		<comments>http://francisshanahan.com/index.php/2010/extjs-metadata-gwt/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 01:37:51 +0000</pubDate>
		<dc:creator>Francis</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://francisshanahan.com/?p=2478</guid>
		<description><![CDATA[Back around New Years I was looking for a way to simplify creation of cross-browser, DDA accessible HTML. Screens basically. They had to be very rich with lots of bells and whistles and they had to perform. Ideally this system had to be so simple to use that a non-technical person could create XBrowser, DDA compliant screens.  I decided to take a second look at ExtJS and it has come a long way since I&#8217;d seen it last. 
Using ExtJS you can create a screen programmatic-ally using classes and ...]]></description>
			<content:encoded><![CDATA[<p>Back around New Years I was looking for a way to simplify creation of cross-browser, DDA accessible HTML. Screens basically. They had to be very rich with lots of bells and whistles and they had to perform. Ideally this system had to be so simple to use that a non-technical person could create XBrowser, DDA compliant screens.  I decided to take a second look at ExtJS and it has come a long way since I&#8217;d seen it last. </p>
<p>Using ExtJS you can create a screen programmatic-ally using classes and method calls but one of the neat features is that a screen can be entirely described declaratively in JSON notation.  Declarative UI is nice, but a meta-data driven UI is nicer. I&#8217;ve created such systems in the past but always had to spend so much time maintaining the thing that interpreted the metadata (Sapient Powerbuilder Framework anyone???). </p>
<p>With ExtJS this could be avoided by just serializing the JSON into a database and back again. Eureka! I had a pretty nice metadata driven declarative UI with MINIMAL investment in  &#8220;framework&#8221; code. Minimal investment in this type of &#8220;framework wrapper stuff&#8221; corresponds to a good upgrade path, quick time to market and very low likelihood that my &#8220;metadata wrapper&#8221; would break anything in the underlying ExtJS library. </p>
<p>Intrigued and not wanting to practice &#8220;architecture space exploration&#8221; [<a href="http://www.joelonsoftware.com/articles/fog0000000018.html">LINK</a>] I wrote a proof of concept and built some screens out of metadata. </p>
<p>There was just one snag; ExtJS could paint the screen but in order to wire it to data it needed a bit of Javascript code to be written. With a complex screen this JS might grow to as much as 200-300 lines. Debugging JS with Firebug, Dynatrace etc. doesn&#8217;t scare me but it doesn&#8217;t sound good to an architecture review board either.</p>
<p>No good deed goes unpunished. It was mentioned that GWT could be used to write the same thing except instead of Javascript, developers could wire up their screens with Java code. The promise of Eclipse, PMD, FindBug and all that java-y goodness was just too much to argue against so I&#8217;ve spent the last few weeks in GWT hell and finally come full circle. </p>
<p>&lt;rant&gt;Just a second, hey, why did I do this? Well I like to know what I&#8217;m talking about. If I&#8217;m going to be responsible for something I want to know it&#8217;s going to work BEFORE we start. I don&#8217;t want to be an architecture astronaut who just reads the brochure. Everyone can read the brochure. I wouldn&#8217;t follow someone like that and I don&#8217;t expect my team to. &lt;/rant&gt;</p>
<p>GWT (Google Web Toolkit) is essentially a compiler that takes your Java code and instead of byte code produces JavaScript. It does a nice job, traversing code paths so that only the bare minimum Javascript is sent down to the browser. It looks like a dogs dinner though. </p>
<p>Enter Ext GWT, Smart GWT (formerly GWT Ext) and MyGWT. Seems everyone has a GWT library, never a good sign imho. </p>
<p>GWT needs to know every execution path at compile time and hence it doesn&#8217;t support reflection. First problem was how to paint the screens from metadata. This can be achieved with GWT.create() but wiring the widgets to Java code with string literals is not possible. </p>
<p>In my use case, the developer should configure the metadata, the framework should paint the screen, the developer should write some Java code for screen logic, then wire the two together. There&#8217;ll be 300+ developers worldwide of varying experience levels so it&#8217;s gotta be simple to use. </p>
<p>I looked at Deferred Binding; &#8220;Deferred Binding is Google Web Toolkit&#8217;s answer to Java reflection.&#8221; BINGO!!! that&#8217;s got to be exactly what I&#8217;m looking for, it even says &#8220;reflection&#8221; on the box. </p>
<p>From http://code.google.com/webtoolkit/doc/1.6/FAQ_Client.html</p>
<blockquote><p>One way to think of this is as &#8220;dynamic class-loading that occurs at compile time instead of execution time.&#8221; When the GWT Compiler compiles your Java application, it determines all the different &#8220;idiosyncrasies&#8221; that it must support, and generates a separate, tightly streamlined version of the application for that specific configuration. For example, it generates a different version of the application file for Firefox than it does for Opera.</p></blockquote>
<p>reading on&#8230;</p>
<blockquote><p>It&#8217;s probably pretty clear by now that Deferred Binding works a little differently than standard dynamic binding. Conceptually, though, the two concepts are fairly similar, and in practice all you usually need to do is just substitute a GWT method for a Java Reflection method. Instead of Class.forName(&#8220;MyClass&#8221;) you use GWT.create(MyClass).</p></blockquote>
<p>So although Deferred Binding is the GWT&#8217;s answer to reflection, you cannot invoke a method using a string literal, you cannot create a class unless it&#8217;s known at compile time and you cannot hook up to an event without compile-time knowledge of the handler. </p>
<p>This makes metadata a pretty tough proposition. To add to the frustration, examples for Deferred Binding were so thin on the ground that it took me 2 evenings to get something working. I&#8217;ll post an example in the coming days to &#8220;pay it forward&#8221;. </p>
<p>Not to be outdone I looked at Generators. Again, no examples to be found anywhere, I&#8217;ll post one in a day or two. Generators basically let you generate java code at compile time, this code you never see but is then turned into Javascript. Honestly the GWT compiler must make 10 passes. </p>
<p>Generators could work. Using Generators would possibly allow the creation of a metadata UI framework however, it would take an enormous amount of fairly skilled coding to make this happen. They&#8217;d also be very brittle and tough to build; e.g. you have to write out java code using the GWT equivalent of a printf. You&#8217;ve no way of knowing if the code will run or not until it&#8217;s too late. Certainly very little chance of testing it. Rocket [<a href="http://code.google.com/p/rocket-gwt/">LINK</a>] claims to fix this problem but frankly this project is far too immature to be of any use. </p>
<p>Gwittir [<a href="http://code.google.com/p/gwittir/">LINK</a>] is another option that claims to support Reflection. That&#8217;s dependent on GWTx and Google Gears. One of my pet-peeves about the open source world is all the dependencies. Don&#8217;t make me download 10 other things/frameworks just to draw HelloWorld. GGears is not an option for me so Gwittir is out. </p>
<p>Lastly, all these frameworks claim to optimize the Javascript, and they are true to that claim, HOWEVER, the third party libraries like SmartGWT, ExtGWT, etc. don&#8217;t optimize the widget Javascript. If you&#8217;re using SmartGWT&#8217;s grid, guess what, you&#8217;re downloading 500KB of widget JS. </p>
<p>So I&#8217;ve come full circle. For me, ExtJS seems like a good fit, easy to use, easy to drive off metadata and sure I have to write some Javascript but I&#8217;ll take a few lines of Javascript/Firebug over the mess that is Deferred Binding and Printf-style Code Generation anyday. Don&#8217;t knock it OR recommend it until you&#8217;ve tried it and fly safe.</p>
]]></content:encoded>
			<wfw:commentRss>http://francisshanahan.com/index.php/2010/extjs-metadata-gwt/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
