<?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>Outside the Box() &#187; extjs</title>
	<atom:link href="http://www.sporcic.org/tag/extjs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sporcic.org</link>
	<description>Blog of Tim Sporcic</description>
	<lastBuildDate>Sat, 28 Aug 2010 23:21: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>Tuning Your ExtJS Theme</title>
		<link>http://www.sporcic.org/2010/07/tuning-extjs-theme/</link>
		<comments>http://www.sporcic.org/2010/07/tuning-extjs-theme/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 18:49:05 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[extjs]]></category>

		<guid isPermaLink="false">http://www.sporcic.org/?p=540</guid>
		<description><![CDATA[ExtJS is my favorite JavaScript favorite. The guys at Sencha have done an excellent job at building the best JavaScript framework for building intranet RIAs. The only flaw of ExtJS is the lack of themes. Although the provided blue and gray themes are very nice, after looking at them for two years you start to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sencha.com/products/js/">ExtJS</a> is my favorite JavaScript favorite. The guys at <a href="http://www.sencha.com">Sencha</a> have done an excellent job at building the best JavaScript framework for building intranet RIAs. The only flaw of ExtJS is the lack of themes. Although the provided blue and gray themes are very nice, after looking at them for two years you start to long for more variety.</p>
<p>There have been some attempts to theme ExtJS.  <a href="http://extthemes.com">Extthemes</a> has built a pretty nice collection of commercial themes, but sometimes all I need is a little bling without the need to completely re-theme the framework. For example, on a recent project, I&#8217;m starting to introduce ExtJS and am making use of the <code>Ext.Panel</code> widget for laying out div elements. </p>
<p>Here&#8217;s what a basic Panel looks like in ExtJS:</p>
<p><img src="http://www.sporcic.org/images/extjs/basic-panel.png" alt="ExtJS default panel" /></p>
<p>And here&#8217;s the code I used to create the panel:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> panel <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">Panel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
      width<span style="color: #339933;">:</span> <span style="color: #CC0000;">200</span><span style="color: #339933;">,</span>
      height<span style="color: #339933;">:</span> <span style="color: #CC0000;">200</span><span style="color: #339933;">,</span>
      title<span style="color: #339933;">:</span> <span style="color: #3366CC;">'Test Panel'</span><span style="color: #339933;">,</span>
      renderTo<span style="color: #339933;">:</span> <span style="color: #3366CC;">'box'</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I&#8217;ve got a div specified in the HTML like this <code>&lt;div id="box"&gt;&lt;/div&gt;</code> which is where the Panel is being rendered to. This is very nice if your site&#8217;s look-and-feel is baby blue, but this won&#8217;t cut it if you need a different color scheme. Fortunately, Panels are extremely easy to stylize through some simple CSS overrides.</p>
<p>The first step is to decide what color you need for the Panel&#8217;s header. The default theme uses a gradient image, which looks better than just specifying a background color. Gradients are pretty easy to created in Photoshop, but you can get a very nice gradient that exactly matches your needs by taking advantage of the <a href="http://jqueryui.com/themeroller/">Themeroller</a> tool for <a href="http://jqueryui.com">JQuery UI</a>. Use the Header/Toolbar customization and choose the color and gradient effect you want for the header.</p>
<p>After you have the header just the way you want it, download the whole theme bundle, extract it someplace and copy the image file for the header into your project directory.</p>
<p>There are three CSS selectors you need to override to apply your customization to the Panel. They are <code>.x-panel-header</code>, <code>.xpanel-header-text</code> and <code>.x-panel-body</code>. For my example, I just borrowed the header image for the Eggplant theme and configured these selectors to produce the following:</p>
<p><img src="http://www.sporcic.org/images/extjs/styled-panel.png" alt="ExtJS styled panel" /></p>
<p>Here is what I specified in my CSS file to override the default style:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.x-panel-header</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">resources/images/eggplant.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">center</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #993333;">repeat-x</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.x-panel-body</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fafad2</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.x-panel-header-text</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span> <span style="color: #933;">14px</span> Consolas<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> san-<span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#eee</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>In the <code>.x-panel-header</code> selector, I specified the background to be the header image I got out of the Themeroller theme. For a little added bling, I changed the text alignment to center the text and set the border color to black. Note, I renamed the gradient image from the cryptic name Themeroller created to eggplant.png.</p>
<p>For the <code>.x-panel-body</code> selector, I set the border color to match the one I specified in the selector above. If you don&#8217;t do this, you&#8217;ll still have the default border around the center. I also specify a light-yellow background color for the contents of the Panel.</p>
<p>Finally, for the <code>.x-panel-header-text</code> section, I change the appearance of the font from the default blue text to a white text in a different font.</p>
<p>Now you have a panel which can perfectly match any color scheme you need to support and it gives you a simple way to introduce ExtJS without it standing out from what you are already doing. For example, on my project, I&#8217;m going to use a pair of <code>Ext.Panel</code> widgets on the sidebar for navigation and a most-recently-used files list, which looks something like this:</p>
<p><img src="http://www.sporcic.org/images/extjs/custom-panel.png" alt="ExtJS custom panels" /></p>
<p>In this example, the theme is still blue, but I changed the header gradient, the shade of blue for the lines, and applied a light-gray background. </p>
<h3>Some Tips</h3>
<ol>
<li>Firebug or Webkit (Chrome/Safari) are your friends. Use the element inspectors to look at what classes are applied to the various ExtJS widgets. Theming ExtJS is all about overriding the existing styles.</li>
<li>Panels are about the easiest thing to style, and it gets harder from there. If you really want to get a custom theme, I suggest start by working with the <code>x-theme-gray.css</code> and then overriding from there. The gray theme will give you widgets that blend pretty easily with any theme, and then you can selectively add some bling to the elements you care about.</li>
<li>Remember that your overridden styles must come <i>after</i> the stylesheet link for ExtJS. For example, if your stylesheet with the overridden styles is called <code>custom.css</code>, ensure your header section contains this:

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;extjs/resources/css/ext-all.css&quot;/&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;extjs/resources/css/xtheme-gray.css&quot;/&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;stylesheets/custom.css&quot;/&gt;</pre></div></div>

</li>
]]></content:encoded>
			<wfw:commentRss>http://www.sporcic.org/2010/07/tuning-extjs-theme/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>(Ext.)Direct Miss</title>
		<link>http://www.sporcic.org/2009/05/extdirect-miss/</link>
		<comments>http://www.sporcic.org/2009/05/extdirect-miss/#comments</comments>
		<pubDate>Sun, 17 May 2009 16:19:40 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[extjs]]></category>

		<guid isPermaLink="false">http://www.sporcic.org/?p=375</guid>
		<description><![CDATA[One of the biggest announcements from last month&#8217;s ExtJS Conference was the new Ext.Direct functionality in ExtJS 3.0. My criticism at the time was that there was a lot of smoke, but no fire. Almost every session mentioned it in some way or another, but they weren&#8217;t producing any enterprise-worthy server code showing how it [...]]]></description>
			<content:encoded><![CDATA[<p>One of the biggest announcements from last month&#8217;s <a href="http://www.extjs.com/conference/">ExtJS Conference</a> was the new Ext.Direct functionality in ExtJS 3.0. My criticism at the time was that there was a lot of smoke, but no fire. Almost every session mentioned it in some way or another, but they weren&#8217;t producing any enterprise-worthy server code showing how it is implemented.</p>
<p>Now, a month later, more details are starting to emerge, including implementations for various technologies. I sat down yesterday morning intending to take a look at the server side code in the <a href="http://extjs.com/forum/showthread.php?t=67992">Ext.Direct Pack</a>; in particular the .NET and Java implementations. I was pretty disappointed with what I saw.</p>
<p>To understand my disappointment, you need to understand a bit of history around what Ext.Direct is attempting to do. Ext.Direct is going to be an RPC layer that exposes stub objects on the client JavaScript side that remotes the method calls to the server using JSON (or POST parameters). The protocol definition is designed to be technology-agnostic and easy to implement. In implementation, it would be the near-equivalent of <a href="http://directwebremoting.org/">DWR</a>, except it would also run on PHP, C#, Ruby, etc&#8230;</p>
<p>Since I&#8217;m familiar with CORBA, RMI, SOAP and WCF, I approached Ext.Direct with a more critical eye. The biggest glaring hole in Ext.Direct is the parameter passing. Let&#8217;s take a look at a couple examples to demonstrate the problem. All the examples will assume a Java backend, and the service we&#8217;ll expose is the PersonService. I&#8217;ll work from the interface, since we don&#8217;t care about the implementation details:</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> PersonService <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Easy</h3>
<p>We&#8217;ll add a method to PersonService to demonstrate the simplest scenario:</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">int</span> getPersonCount<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The payload from Ext.Direct would look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span> <span style="color: #3366CC;">&quot;action&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;PersonService&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;method&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;getPersonCount&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;data&quot;</span><span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;type&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;rpc&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;tid&quot;</span><span style="color: #339933;">:</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>This is the absolute easiest method to deal with. The operation takes no parameters, and the return value is a primitive. Ext.Direct can deal with this easily, but so could any AJAX library, so no secret sauce here.</p>
<h3>Object</h3>
<p>One of the key advantages to an RPC protocol is the ability to pass Objects. Well complicate things a bit by adding the following method to the PersonService:</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> Person getPerson<span style="color: #009900;">&#40;</span><span style="color: #006600; font-weight: bold;">int</span> id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>For our example, we&#8217;ll assume the Person class looks like this. I&#8217;m not including setters/getters to try and keep it short:</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Person <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #006600; font-weight: bold;">int</span> id<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399; font-weight: bold;">String</span> name<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #006600; font-weight: bold;">int</span> age<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399; font-weight: bold;">Date</span> birthDate<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In the method I added above, the JSON payload from Ext.Direct stays pretty simple:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span> <span style="color: #3366CC;">&quot;action&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;PersonService&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;method&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;getPerson&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;data&quot;</span><span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;type&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;rpc&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;tid&quot;</span><span style="color: #339933;">:</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>This should return the Person with the ID of 1, and depends on the server code to correctly serialize the Person object to JSON.</p>
<h3>Harder</h3>
<p>Now let&#8217;s make things painful. I&#8217;m going to include a method to add a Person.</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> addPerson<span style="color: #009900;">&#40;</span>Person person<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is where the wheels fly off of Ext.Direct. Since the protocol specifies the data element as an array, I&#8217;m not clear on how Ext.Direct would deal with this from the client side. Every example so far works with primitives as parameters, so I haven&#8217;t determined what it would do with a Person. </p>
<p>Ext.Direct would be much happier if I defined the addPerson method like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> addPerson<span style="color: #009900;">&#40;</span><span style="color: #006600; font-weight: bold;">int</span> id, <span style="color: #003399; font-weight: bold;">String</span> name,<span style="color: #006600; font-weight: bold;">int</span> age, <span style="color: #003399; font-weight: bold;">Date</span> birthdate<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Then, the JSON payload would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span> <span style="color: #3366CC;">&quot;action&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;PersonService&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;method&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;addPerson&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;data&quot;</span><span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;John Doe&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">25</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Sun May 01 1985 00:00:00 GMT-0500 (Central Daylight Time)&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;type&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;rpc&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;tid&quot;</span><span style="color: #339933;">:</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>Even in this &#8220;happy path&#8221; scenario for dealing with an object, your server-side implementation would need to be able to correctly deserialize the stringified javascript date object, which is not anything the current implementations handle.</p>
<p>The <a href="http://extjs.com/products/extjs/direct.php">protocol specification</a> states that the data element can also be a JSON object with named parameters, but it is not supported in the first implementation. This is going to be absolutely critical if Ext.Direct is going to evolve into a real RPC protocol. For example, using a JSON object for the data element in the above example would result in a JSON payload like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span> <span style="color: #3366CC;">&quot;action&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;PersonService&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;method&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;addPerson&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;data&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>
           <span style="color: #000066;">name</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;John Doe&quot;</span><span style="color: #339933;">,</span> 
           age<span style="color: #339933;">:</span> <span style="color: #CC0000;">25</span><span style="color: #339933;">,</span> 
           birthdate<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Sun May 01 1985 00:00:00 GMT-0500 (Central Daylight Time)&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;type&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;rpc&quot;</span><span style="color: #339933;">,</span>
   <span style="color: #3366CC;">&quot;tid&quot;</span><span style="color: #339933;">:</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>This would at least allow the server code a means to try and instantiate an instance of the Person object, as long as the server code is implemented in a language that allows for reflection of the Object.</p>
<p>My grief with Ext.Direct is that correctly implementing the server-side code to support the specification is a non-trivial endeavor. One big piece missing is the metadata. In other RPC mechanisms, there is strongly-typed metadata which can be used to create the stubs. For example, CORBA has IDL and SOAP has WSDL. </p>
<p>Ext.Direct is missing a metadata layer to facilitate the passing of Object values. It is going to be difficult to implement a complete server-side stack to handle the permutations that will arise. Developers will either need to dumb-down the exposed services to handle the limitations of Ext.Direct, or else they will end up doing a lot of custom work on top of the server side implementation to handle the type coercion.</p>
<p>I&#8217;m still not convinced Ext.Direct is the right path for ExtJS to be barking down. There are already established, tested protocols for handling RPC via JavaScript (DRW, WCF), and ExtJS already works quite well with basic AJAX over the HTTP protocol. Ext.Direct is adding a level of complexity to ExtJS which could easily turn into a rabbit hole that sucks up all their time. I would prefer they focus their precious development hours on the client library and leave the communication layers decisions to us. RPC is a complicated problem with a lot of history around it, and there is no reason for them to try and invent a new wheel in this space.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sporcic.org/2009/05/extdirect-miss/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ext Conference, Day 3</title>
		<link>http://www.sporcic.org/2009/04/ext-conference-day-3/</link>
		<comments>http://www.sporcic.org/2009/04/ext-conference-day-3/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 17:09:41 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ExtConf]]></category>
		<category><![CDATA[extjs]]></category>

		<guid isPermaLink="false">http://www.sporcic.org/?p=302</guid>
		<description><![CDATA[The third day of Ext Conference 2009 was only a half-day, which turned out to be a good thing given the trainwreck start. They were an inexcusable 20 minutes late in opening the door for what should have been 15 minutes of closing remarks. Instead, it turned into a 30+ minute demo of the new [...]]]></description>
			<content:encoded><![CDATA[<p>The third day of Ext Conference 2009 was only a half-day, which turned out to be a good thing given the trainwreck start. They were an inexcusable 20 minutes late in opening the door for what should have been 15 minutes of closing remarks. Instead, it turned into a 30+ minute demo of the new UI designer. Yes, the designer is awesome and will rock the ext world, but it is beyond me why they would improvise a demo on the morning of the last day. This should have been either on day one or possibly part of Jack&#8217;s keynote on day two. </p>
<p>With events now running 45 minutes late, the final two sessions ended up being pretty disorganized. I went to the &#8220;Mainframe to Web&#8221; presentation by Rich. I had just done a similar project and was interested in what he had to say. Turns out their showcase pretty much faked an integration with the backend by using a screen scraper on the server side which translated terminal session screens to ExtJS metadata. They didn&#8217;t change any of the backend code at all. I&#8217;ll give them credit for finding a clever solution, but I&#8217;m not convinced it is the best one. When we confronted a similar problem, we ended up wrapping backend functionality in AS/400 stored procedures we called from the middle-tier.</p>
<p>The positive side effect of the wheels-off schedule was that Rich rushed his presentation to try and wrap up on time. The other presentation, ExtJS deployment, was only halfway done, so I jumped in to catch the last half of it. In this case, it seemed like the heart of the presentation was in the last half, so I basically got the best of both presentations.</p>
<p>The deployment presentation covered a lot of the useful tools for bundling up your JavaScript. I had heard of <a href="http://code.google.com/p/js-builder/">JS Builder</a> before, but plan on taking a deeper look now. It can create a single JavaScript file from many smaller files.<a href="http://developer.yahoo.com/yui/compressor/"> YUI Compressor</a> is the recommended tool for really putting the squeeze on your JavaScript files, but even then, Jamie still recommended ensuring you use GZip/Deflate on the web server for JavaScript files. He also talked about a tool for creating a multi-image sprite file of several small images that can also have a big impact. I came away with a lot of things to research and this should be a top presentation to check out when they put them online.</p>
<p>The final session for the day was Scott covering the Ext.Writer. This has got to be one of the coolest features of ExtJS 3.0 and they really should have moved this earlier rather than waiting for the last minute. The Writer addresses the problem of handling CRUD operations for Stores. It can use  REST-like URLs like <code>/app/update/1</code> or <code>/app/delete/1</code> with the record ID as the final parameter. It pushes a JSON object back to the server containing the information that needs to be acted on. It even addresses passing a primary key back to the Store on a create operation.  This is looking a whole lot cooler than Ext.Direct and I want to give it a try for my application.</p>
<p>I didn&#8217;t sit through the final Q&#038;A session as I needed to bugout for the airport. Based on the tweets so far, it doesn&#8217;t look like much was discussed. Overall, the conference was excellent and I can chalk up the final day to growing pains. What will be interesting to see is what happens in the coming weeks. Ext.Direct was talked up in about every session, but there is an incredible lack of detail for how it will be implemented with mainstream enterprise technologies (Java/C#). Abe talked about the Marketplace, which sounds like the equivalent of RubyForge for ExtJS. If they can get it up, it will be cool. Finally, the UI Designer is what everyone really wants but it is slated for v3.1, and no one would talk timelines for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sporcic.org/2009/04/ext-conference-day-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ext Conference, Day 2</title>
		<link>http://www.sporcic.org/2009/04/ext-conference-day-2/</link>
		<comments>http://www.sporcic.org/2009/04/ext-conference-day-2/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 11:40:59 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ExtConf]]></category>
		<category><![CDATA[extjs]]></category>

		<guid isPermaLink="false">http://www.sporcic.org/?p=297</guid>
		<description><![CDATA[After the 100mph pace yesterday, day two of the conference settled in to a comfortable 55mph. The big news of the day was during the keynote, when they released RC1 of ExtJS 3.0. Jack was the scheduled keynote speaker, but I get the impression he doesn&#8217;t like speaking in front of large groups. His keynote [...]]]></description>
			<content:encoded><![CDATA[<p>After the 100mph pace yesterday, day two of the conference settled in to a comfortable 55mph. The big news of the day was during the keynote, when they released RC1 of ExtJS 3.0. Jack was the scheduled keynote speaker, but I get the impression he doesn&#8217;t like speaking in front of large groups. His keynote lasted all of five minutes. He covered the history of ExtJS in two minutes and said ExtJS 3.0 is here. And that was it. Abe was left scrambling to fill a rather large hole in the schedule, and he called up Darrell of the GXT (Ext GWT) team to talk about their v2.0 release.</p>
<p>Darrell is a nice guy, but I was ready to pull my hair out listening to him. I had lunch with him yesterday and to say he is excited about GWT is a major understatement. In spite of being a Java guy, I don&#8217;t like the idea of writing my web UI in Java. It&#8217;s like the Hibernate mafia who think you can write a database application without knowing SQL. Each of the tiers has a best-in-breed language for addressing that tier&#8217;s problems. An enterprise developer better know SQL for talking to databases, Java/C# for the middle tier and HTML, CSS and JavaScript for the front end.</p>
<p>After the keynote, we had another smoothie break. The smoothies were good, but the general consensus would have preferred coffee in the morning and smoothies in the afternoon. </p>
<p>Aaron kicked off the regular sessions with a breakdown of the signature demo in ExtJS 3.0 &#8212; Image Organizer. This is the meatiest demo so far, and was interesting to see how they structured the code and where they subclassed. The application uses Ext.Direct, but the backend was only PHP. One of the first questions Aaron got asked was when they would release other backends. He really danced around the question without giving a true answer, saying that maybe there would be something released in the next week or so. Ext.Direct is starting to sound like a lot of vaporware. They talk a good game of how it will be able to use annotations/attributes server side for exporting objects and other cool stuff, but no one is producing any code. Ext.Direct is the new Duke Nukem Forever.</p>
<p>The next session I attended was one of the funniest. <a href="http://commadot.com">Glen Liptka</a> talked about user experience design with  ExtJS. He is at Marketo, which has done the most incredible theming of ExtJS I have ever seen. He started the talk covering general usability and then demonstrated their application. The point he made that stuck with me is that your UI should have low WTF/min. Everyone got a kick out of that.</p>
<p>Next up was JC Bize talking about theming ExtJS. JC is the author of the Slate theme, one of the most popular third-party themes used in ExtJS. He is now an employee of Ext, LLC, so hopefully we&#8217;ll see some more cool themes in the pipeline. He showed off a couple cool themes and then got in to a basic example of how to change the theme of a panel. When playing with themes, Firebug is your friend. Unfortunately, he got sidetracked trying to answer an audience question and the presentation fizzled out.</p>
<p>I couldn&#8217;t catch the last session, as I had to make a phone call, but came back for the day-ending Ask the Ext Team. Nothing major came up. I tried to ask the question of why they didn&#8217;t use Sizzle for Ext Core, but my question didn&#8217;t get voted up and they ended the session before they got to it.</p>
<p>The day wrapped up with a social down by the pool with a cash bar. I really started to hate the Ritz after paying $8 for a beer. They definitely need to move the conference to someplace that understands Happy Hour. I managed to corner Aaron at the social and got my Sizzle question answered. He said they didn&#8217;t use Sizzle because it was too big and too slow. He did say the DOJO guys were working on a very cool new engine called Acme that looks promising. DOJO makes me nauseous just looking at it, so I won&#8217;t be investigating it.</p>
<p>The day ended for me again at the bar. I had dinner with another attendee who works at the DIA. Since I have a similar background, we had a lot to talk about. $35 for two margaritas and a plate of chicken quesadillas &#8212; ouch!</p>
<p>Day three is only a half day, but there are still two sessions I&#8217;m interested in, so it should be fruitful. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sporcic.org/2009/04/ext-conference-day-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ext Conference, Day 1</title>
		<link>http://www.sporcic.org/2009/04/ext-conference-day-1/</link>
		<comments>http://www.sporcic.org/2009/04/ext-conference-day-1/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 01:08:32 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ExtConf]]></category>
		<category><![CDATA[extjs]]></category>

		<guid isPermaLink="false">http://www.sporcic.org/?p=283</guid>
		<description><![CDATA[The first day of the first-ever Ext Conference wrapped up today. The day actually started last night when I got to the hotel. Jay Garcia and Shea Frederick both got in at about the same time as me. We had an impromptu meet-up at the hotel bar, where we hooked up with a few more [...]]]></description>
			<content:encoded><![CDATA[<p>The first day of the first-ever Ext Conference wrapped up today. The day actually started last night when I got to the hotel. Jay Garcia and Shea Frederick both got in at about the same time as me. We had an impromptu meet-up at the hotel bar, where we hooked up with a few more conference attendees who were drawn to the geek conversation like moths to a flame. </p>
<p>One of the guys (Jerry), mentioned that Abe (Elias) was still in the big conference room preparing for the keynote. Since it was 12:30am, and tipsy geeks don&#8217;t have anything better to do, we paid him a visit. He was extremely cool, and ended up giving us the tour. He took us down to one of the other meeting rooms where a Rick, Aaron, Evan, Tommy and Chris were getting ready for their presentations too. After about a half-hour of the geekfest with them, I went to bed to be ready for the early start today. As a footnote to the evening, be sure to ask Jay how sissy drinks at the Ritz went over with him.</p>
<p>The conference started up at 8:30am this morning. Abe introduced the Ext development team, which was a lot larger than I expected – over a dozen people. He kept the introductions short so that we could get to Douglas Crockford, our keynote speaker. As he is a legend in the JavaScript community, it was exciting to see him talk in person. He covered a little bit of the history of JavaScript, then dived in to the future, including ECMAScript 5 (ES5). ES5 is going to be pretty impressive, but it will be years before we can really count on it being on all the desktops (thanks, Microsoft). </p>
<p>Most all the sessions throughout the day were at a good technical level. No fluff, just stuff. Aaron presented the new features of ExtJS 3.0, which drew almost everyone. They had to move the session back to the keynote ballroom. ExtJS 3.0 is super cool, with one exception, which I&#8217;ll discuss below.</p>
<p>Evan was up next, talking about Ext.data. Since there wasn&#8217;t a lot new in this space, this was more a rehash of the Ext.data classes. Evan definitely knows his stuff, and had some educational examples.</p>
<p>Chris then talked about Ext.direct. This is the one area of ExtJS 3.0 that I&#8217;m still skeptical on. One of the key parts of Ext.direct is the server-side component, yet everyone so far has been light on details for this piece. Chris is a Merb guy, so it didn&#8217;t help when he was showing Ruby code trying to explain it. Even listening to Jack discuss it in the hall left me feeling there were still a lot of smoke and mirrors around Ext.direct. In theory, Ext.direct should provide a server-technology agnostic RPC mechanism for talking to objects. I&#8217;m not convinced we actually needed this, and since I haven&#8217;t seen any real code behind it, I&#8217;m not sure what kind of state it is in. Hopefully, when Jack announces the release of ExtJS 3.0 tomorrow morning, I&#8217;ll get a chance to look at some code.</p>
<p>My final session for the day was watching Tommy discuss Ext Core. I&#8217;ve already covered Ext Core in some prior posts, but still managed to learn some things. Ext Core is going to really shake some things up when folks start to get familiar with it. I plan on wrapping up a post on the cool OO features of Ext Core this weekend.</p>
<p>That was it for the structured presentations. Here are a few other random thoughts and observations on the day:</p>
<ul>
<li>Swag so far has been an Ext spiral notepad, a pen and a nice travel mug. There will probably be a riot if T-shirts don&#8217;t appear.</li>
<li>The next fool who gets up and asks about testing ExtJS websites with selenium is going to receive my travel mug upside their head. Asking the same question five times is not going to get you a different answer.</li>
<li>The meal was excellent. The hotel is nice, but a bit too ostentatious. It&#8217;s the Ritz, so you have to expect it, but it would have been more fun to have the conference in a more festive environment. Hint for Abe: Vegas, Baby!</li>
<li>Overheard a Salesforce architect talking about them moving to ExtJS. That would really rock if they did it.</li>
<li>The average age of the Ext dev team appears to be about 17 <img src='http://www.sporcic.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  . They have a lot of bright, young talent on their hands. It will be fun to watch what they do with it.</li>
<li>Someone actually asked, in the group Q&#038;A, if there were any books on ExtJS. Paying over a thousand dollars for a conference and not doing your homework is just plain dumb. Never ask something in front of a large group that 15 seconds on Google or Amazon could answer for you.</li>
<li>All the sessions were taped and Abe said they would be put up on the Ext site. Presentations should show up too.</li>
</ul>
<p>I&#8217;m hoping tomorrow rocks too. We went non-stop from 8:30am to 6:30pm today, and it was a lot of fun. If they can keep up the momentum, this will turn out to be one of the best technology conferences I have ever attended.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sporcic.org/2009/04/ext-conference-day-1/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Feedback</title>
		<link>http://www.sporcic.org/2009/04/feedback/</link>
		<comments>http://www.sporcic.org/2009/04/feedback/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 21:19:29 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.sporcic.org/?p=237</guid>
		<description><![CDATA[It has been fun watching the comments on my write-up yesterday about Ext Core on some of the sites it got posted to. It is clear, for some people, discussing JavaScript libraries has drifted into the same hazard zone as discussing religion and politics. While I appreciate all the feedback, and probably should have signed [...]]]></description>
			<content:encoded><![CDATA[<p>It has been fun watching the comments on my write-up yesterday about Ext Core on some of the <a href="http://news.ycombinator.com/item?id=547256">sites</a> it got <a href="http://www.reddit.com/r/programming/comments/8a56l/ext_core_vs_jquery/">posted</a> to. It is clear, for some people, discussing JavaScript libraries has drifted into the same hazard zone as discussing religion and politics. While I appreciate all the feedback, and probably should have signed up for adwords before posting, I do want to clarify a few things:</p>
<ul>
<li><b>GPL</b> &#8211; I hate it, deal with it. There are two reasons a <em>library</em> author would use GPL. First, to prevent someone else from monetizing their effort (ala ExtJS), or second, because open source is an agenda and not a license. An altruistic developer who is interested in helping other developers without expectations of a return will use a reuse-friendly open source license for their <em>libraries</em> like Apache or MIT. If you&#8217;re trying to change the world, please, go ahead and use GPL. If you just want to help out your fellow developers, use something with no strings attached.</li>
<li><b>ExtJS Haters</b> &#8211; still a surprising number of geeks out there who are bitter about the change from LGPL to GPL. I was a <a href="http://www.sporcic.org/2008/04/the-gpl-is-cancer/">vocal critic</a> of the change too. I got over it &#8212; I bought a license and no longer care. Best $289 I&#8217;ve ever spent. If you&#8217;re looking for a free ride, look elsewhere. Ext LLC is for-profit entity and I agree with them. People should be able to put food on the table writing cool code, and I won&#8217;t deny the talented developers at Ext LLC that right.</li>
<li><b>Fluff</b> &#8211; I especially got a kick out of this. It was the longest blog post I have ever written (1800+ words) and tried to touch on as many areas as I could. I plan on following up with some more detailed posts. Guess you can&#8217;t make everyone happy.</li>
<li><b>The Conclusion</b> &#8211; JQuery is an awesome library. I&#8217;ve used it for years. I&#8217;ve also used ExtJS and will now use Ext Core more. Why? For the same reason some developers gravitate to Perl and others to Java &#8212; Style. I come from a OO Java background, and thus the coding style of the whole ExtJS/Ext Core duo is more in line with my preferred comfort zone. Both JQuery and Ext Core are awesome libraries. Pick the one that suits your personal style and objectives.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sporcic.org/2009/04/feedback/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Kid on the Block</title>
		<link>http://www.sporcic.org/2009/04/ext-core/</link>
		<comments>http://www.sporcic.org/2009/04/ext-core/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 22:02:08 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.sporcic.org/?p=208</guid>
		<description><![CDATA[On this cloudy Dallas Saturday morning, the ExtJS team announced the availability of Ext Core (beta). Ext Core is the core DOM selection, manipulation and events library of ExtJS which has been extracted out into a separate library released under a more liberal license. They smartly released this under the very permissive MIT license, in [...]]]></description>
			<content:encoded><![CDATA[<p>On this cloudy Dallas Saturday morning, the <a href="http://extjs.com">ExtJS</a> team announced the availability of <a href="http://extjs.com/blog/2009/04/04/ext-core-30-beta-released/">Ext Core (beta)</a>. Ext Core is the core DOM selection, manipulation and events library of ExtJS which has been extracted out into a separate library released under a more liberal license. They smartly released this under the very permissive MIT license, in contrast to the cancerous GPL used for the full ExtJS. </p>
<p>What makes this interesting is it positions Ext Core as a direct competitor to the popular <a href="http://www.jquery.com">JQuery</a> library. I really like both ExtJS and JQuery, so I decided to run a quick comparison of the two libraries to see if Ext Core is up to the task of replacing JQuery in my developer toolbox. Since there is so much overlap between the two, it makes no sense to use both.</p>
<h3>Round 1 &#8211; Size</h3>
<p>Library size of the two is pretty close. The minified version of JQuery runs about 56K, while the minified version of Ext Core weighs in at 75K. The 19K difference might matter for an iPhone application, but even then, I would consider it negligible. Both are pretty small libraries, so we&#8217;ll call Round 1 a tie and move on to feature comparison.</p>
<h3>Round 2 &#8211; Load Event</h3>
<p>How each of these libraries works the document ready event is more a matter of style. The JQuery convention is to use the dollar sign ($) for for operations, although you can fall back to using the full name (jQuery). Setting up a ready event in JQuery looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// do cool stuff</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Ext Core uses the static Ext class for the same functionality. Like the jQuery object, the Ext object is the heart of Ext Core. Setting up the ready listener in Ext Core looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">onReady</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// do cool stuff</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>One big difference is the onReady method can take an additional parameter specifying the scope in which the onReady method should execute. This is not a big deal in most cases, but shows Ext Core&#8217;s attention to support object oriented JavaScript. Since I&#8217;ve never actually needed to specify the scope, I&#8217;ll call this round a tie too.</p>
<h3> Round 3 &#8211; Selectors</h3>
<p>This is the heart of both libraries, and a full comparison could fill a dozen pages. The short story is they both support basically the same set of CSS3 selectors along with some custom enhancements. From looking at the documentation, I couldn&#8217;t find any typical use cases that either couldn&#8217;t handle. Like the document ready example above, it just comes down to a matter of convention. For example, here is the code from each to add a class to a set of nodes:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// JQuery</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'td.age'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'someclass'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Ext Core</span>
Ext.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'td.age'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'someclass'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>One major style difference between the two is that Ext Core has a tighter focus in handing elements with ids, since that is critical to the full ExtJS library. For example, Ext Core has the get() method to directly grab an element by ID, along with a memory-friendly fly() method. The fly() method does not create a new element wrapper in memory, and instead reuses a single global element object. This can save a lot of memory when you just need to do quick manipulations of single objects.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Add a class to the element with ID of 'header'</span>
Ext.<span style="color: #660066;">fly</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'header'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'someclass'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>For the memory saving fly operation, I&#8217;ll give the advantage to Ext Core, although they are essentially equal in their DOM selection abilities.</p>
<h3>Round 4 &#8211; Events</h3>
<p>Like the selectors above, there are basically style differences between the two libraries in how they handle basic event use cases. JQuery adds some methods to the jQuery object for registering common events. For example, here is the code to add a click event to a button for each, including the JQuery shortcut:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// JQuery with bind()</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#myButton'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Clicked'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// JQuery with shortcut</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#myButton'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Clicked'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// Ext Core</span>
Ext.<span style="color: #660066;">fly</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'myButton'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">on</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Clicked'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>JQuery brings some some additional enhancements to the game in the form of <a href="http://docs.jquery.com/Events/live">&#8220;live&#8221; events</a>. This provides a way of attaching an event to all current, and <em>future</em>, instances of the selector. JQuery also supports <a href="http://docs.jquery.com/Namespaced_Events">event namespaces</a>, where events can be fired in a hierarchy. Both are powerful concepts, but I&#8217;ve never had to use either.</p>
<p>The secret sauce for Ext Core is in extended configuration. With Ext Core events, you can also configure the scope (a common Ext Core theme), along with configuring the event propagation, extra parameters, and a delay. Here is a sample of a click event configured with &#8216;this&#8217; scoped to the onClick event itself, to only fire once (single), with a delay of 100ms and an additional parameter (forumId) to be passed to the event handler:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">el.<span style="color: #660066;">on</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onClick</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    single<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
    delay<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">,</span>
    forumId<span style="color: #339933;">:</span> <span style="color: #CC0000;">4</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>So again, I&#8217;m going to call this round a tie. Both libraries handle simple event binding very easily. If you need the live events, the nod goes to JQuery. If you need the extra configuration options, Ext Core is your best bet.</p>
<h3>Round 5 &#8211; DOM Manipulation</h3>
<p>Once again, the two libraries provide a near complete overlap of basic DOM manipulation functionality. Each can easily create, move, add and insert DOM elements.</p>
<p>JQuery aims for convenience. For example, one feature of JQuery I really appreciate are simple methods to clear the content of a DOM element and set the text. For example, given:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id='message'&gt;First Message&lt;/div&gt;</pre></div></div>

<p>With JQuery, it is simple to update the text:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#message'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'New Message'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The text() method removes all the child nodes of the matching elements and appends a text node containing the specified text. The text() method without a parameter will retrieve the text for a matching element. For Ext Core, you have to drop down to the DOM to set the new text value:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">fly</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'secret'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">dom</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'New Message'</span><span style="color: #339933;">;</span></pre></div></div>

<p>The Ext.Element class does not provide simple methods for setting the text or removing all the children of an element, which I find to be an annoying inconsistency.</p>
<p>On the plus side, Ext Core provides a lot more methods for manipulating the DOM. One of the cool ones is the radioClass() method. This method will add a class or classes to an element and remove that same class (or classes) from all the siblings. For example, here is a simple table with a row having the &#8217;selected&#8217; class:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;table class=&quot;data&quot;&gt;
    &lt;thead&gt;
        &lt;tr&gt;&lt;th&gt;Name&lt;/th&gt;&lt;th&gt;Age&lt;/th&gt;&lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tr&gt;
        &lt;td&gt;Bill&lt;/td&gt;&lt;td class=&quot;age&quot;&gt;20&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr class=&quot;selected&quot;&gt;
        &lt;td&gt;Alice&lt;/td&gt;&lt;td class=&quot;age&quot;&gt;21&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Jeff&lt;/td&gt;&lt;td class=&quot;age&quot;&gt;22&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Susan&lt;/td&gt;&lt;td class=&quot;age&quot;&gt;23&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;</pre></div></div>

<p>This one line of Ext Core code will remove the &#8217;selected&#8217; class from the current TR element and add it to the first row in the table:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'table tr:first'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">radioClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'selected'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>So for this round, I&#8217;ll give the advantage to JQuery for the more consistent API, especially around manipulating the text nodes of an element. This is something pretty simple for Ext Core to address, which they really should. Ext Core does, however, offer more powerful DOM manipulation options.</p>
<h3>Round 6 &#8211; Effects</h3>
<p>I&#8217;m not a big effects junkie, so I won&#8217;t have a lot to say about this. Both Ext Core and JQuery provide a very similar set of effects for elements (hide/show, fade, slideIn/Out, etc&#8230;). Ext Core provide a more powerful API for creating custom effects, while JQuery addresses this with its rather extensive set of plug-ins. I&#8217;m calling this one a tie.</p>
<h3>Round 7 &#8211; AJAX</h3>
<p>Ext Core and JQuery both make AJAX simple, but again, we&#8217;ll see that JQuery adds more simplified methods while Ext Core offers more powerful configuration. Here is a sample of an AJAX call that returns JSON data:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// URL returns a JSON object like this: {name: 'Tim'}</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// JQuery </span>
$.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'http://myurl'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>data.<span style="color: #000066;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// Ext Core</span>
Ext.<span style="color: #660066;">AJAX</span>.<span style="color: #660066;">request</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'http://myurl'</span><span style="color: #339933;">,</span> 
    success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">decode</span><span style="color: #009900;">&#40;</span>response.<span style="color: #660066;">responseText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>data.<span style="color: #000066;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>JQuery provides the simplified getJSON() method where the parameter to the callback has already been decoded into a JSON object. For Ext Core, the callback receives the XHR response object and you have to decode the text to JSON.</p>
<p>The Ext Core request() method demonstrates a typical ExtJS convention of using a JavaScript configuration object as a parameter instead of using multiple parameters.</p>
<p>Both libraries provide strong AJAX support, so we&#8217;ll go with a tie for this round too.</p>
<h3>Round 8 &#8211; Documentation</h3>
<p>There is no contest in the documentation department. While the JQuery <a href="http://docs.jquery.com/Main_Page">documentation</a> has improved, the Ext Core documentation blows it away. From the excellent <a href="http://extjs.com/products/extcore/manual/">manual</a> to the high-quality <a href="http://extjs.com/products/extcore/docs/">API documentation</a>, Ext Core sets the standard for what all documentation should look like.</p>
<h3>Round 9 &#8211; Intangibles</h3>
<p>For JQuery, the biggest intangibles are its plugins and support from Microsoft. JQuery is intentionally designed to provide a simple core set of functionality and to be easy to extend. There are hundreds of plugins people have written for JQuery in the <a href="http://plugins.jquery.com">Plugin Repository</a>. As with all things open source, some are very good and some are kinda crappy, but you can be pretty certain to find a plugin that covers about anything you might be trying to do that is not covered by the core JQuery API. </p>
<p>Microsoft support is also a biggie. They have decided to include JQuery as a base JavaScript library in their web tools going forward. This means you won&#8217;t need to get special blessings to use JQuery in large corporate environments &#8212; it will be part of the core Microsoft bundle, with support and all.</p>
<p>Ext Core, being brand new, is lacking in both community and support. Ext LLC, the company behind ExtJS and Ext Core is a small software shop trying to get by in a tough economy. While their products are cutting edge, I&#8217;m expecting them to be bought out by a larger company before too long. I keep trying to talk my Spring Source contacts into buying them, but I have a feeling they&#8217;ll be bought by Adobe.</p>
<p>So from an intangibles perspective, JQuery is the winner. It is guaranteed to have longer legs under it, at least until we see where Ext LLC ends up.</p>
<h3>Conclusion</h3>
<p>Both Ext Core and JQuery are solid, complete base JavaScript libraries. JQuery leans towards simplicity while Ext Core offers enhanced configuration. The choice of which to use will come down to where you are now.</p>
<ul>
<li>If you use JQuery, and don&#8217;t anticipate using ExtJS, stay where you are. You&#8217;ve got a winner.</li>
<li>If you use ExtJS and have used JQuery as a light weight option for when you didn&#8217;t need the widget library, Ext Core is now your library of choice.</li>
<li>If you are in search of a JavaScript library, the choice is tougher. Unless there is a particular JQuery plugin you want to use, I recommend going with Ext Core. It starts laying the groundwork for using ExtJS, which you&#8217;ll want to do as you get in to building RIAs.</li>
<li>If you&#8217;re a corporate Microsoft shop, you probably don&#8217;t have a choice. JQuery is now something you can slip by the infosec police without making waves.</li>
</ul>
<p>Ext Core is definitely a winner. In the past, I have used JQuery for projects that need simple DOM manipulation and ExtJS for when I need the widgets, layouts, etc&#8230; Now that I have Ext Core, I don&#8217;t see using JQuery anymore for the simple cases. I can standardize on using the same API paradigm between Ext Core and ExtJS. </p>
<p>Follow-up #1: <a href="http://www.sporcic.org/2009/04/beyond-the-core/">Beyond the Core</a><br />
Follow-up #2: <a href="http://www.sporcic.org/2009/04/slick-speed/">Slick Speed</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sporcic.org/2009/04/ext-core/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Springing Around with ExtJS</title>
		<link>http://www.sporcic.org/2009/01/springing-around-with-extjs/</link>
		<comments>http://www.sporcic.org/2009/01/springing-around-with-extjs/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 03:40:37 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.sporcic.org/?p=106</guid>
		<description><![CDATA[While playing around more with ExtJS and Spring, I ran in to one of my favorite annoyances &#8212; setting up a new project. I can create a new webapp in IDEA (or Eclipse) and add some dependencies, but it is still pretty empty. Maven can go a bit farther, but I don&#8217;t like how it [...]]]></description>
			<content:encoded><![CDATA[<p>While playing around more with ExtJS and Spring, I ran in to one of my favorite annoyances &#8212; setting up a new project. I can create a new webapp in IDEA (or Eclipse) and add some dependencies, but it is still pretty empty. Maven can go a bit farther, but I don&#8217;t like how it handles transitive dependencies. None of these will really give me a good starting point out of the box without either copying a bunch of stuff over from other projects or writing a lot from scratch.</p>
<p>To finally scratch that itch, and move further along the Spring &amp; ExtJS path, I turned my demo project into a basic template. The zip archive that you can grab at the bottom is a fully-configured Spring web application, including Tiles, Spring Security, Spring MVC, custom JSON view, Transactions and a Datasource.</p>
<p>To get started, grab the file, extract it to some directory. Open a shell, navigate to the Template directory and run the ant command <code>ant dist</code>. This will compile the whole project and create a Template.war file in the dist directory. Note, I use Java 6 for all development, so if you&#8217;re not at least at Java 5, you won&#8217;t be able to use this.</p>
<p>Before you drop the war file into Tomcat&#8217;s webapp directory, you&#8217;ll need to setup the database. First, copy the jar files in <code>lib/tomcat</code> into Tomcat&#8217;s <code>lib</code> directory. This is the MySQL JDBC driver and the JTA files for transactions. You&#8217;ll then need to create a new database on your local MySQL instance called <code>tomcat</code>. For simplicity in development, create a user with all rights to the tomcat database. Here&#8217;s the code to run from a MySQL shell:</p>
<p><code>create database tomcat;<br />
use tomcat;<br />
grant all on tomcat.* to tomcat@localhost identified by 'apache';<br />
</code><br />
Your other option is to just put in your MySQL root username and password. To do that, or change the connection string completely, edit <code>context.xml</code> under <code>web/META-INF</code>. If you don&#8217;t use MySQL, you will have to edit this file and also put the correct driver in Tomcat&#8217;s <code>lib</code> directory.</p>
<p>Once you have the database setup, drop the Template.war file into your Tomcat <code>webapps</code> directory and startup Tomcat. Assuming Tomcat is configured to listen on port 8080, you can open the sample by browsing to <code>http://localhost:8080/Template</code></p>
<p>The application only has a couple pages. First, the login page:</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2009/01/sample-login.png"><img class="size-medium wp-image-107 alignnone" title="sample-login" src="http://www.sporcic.org/wp-content/uploads/2009/01/sample-login-300x255.png" alt="Login Page" width="300" height="255" /></a></p>
<p>Spring Security is configured to route unauthenticated requests through this page for login. You can take a look at the applicationContext-security.xml file in WEB-INF to see how this was done. There are two users configured for now. User <code>scott</code> with a password of <code>tiger</code> and user <code>bob</code> with a password of <code>password</code>. Yes, not very clever, but it works. Scott is in both the ROLE_ADMIN and ROLE_USER roles, while Bob is only in ROLE_USER.</p>
<p>If you login with scott, you&#8217;ll be taken to the index page, which looks like this:</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2009/01/sample-echo.png"><img class="size-medium wp-image-108 alignnone" title="sample-echo" src="http://www.sporcic.org/wp-content/uploads/2009/01/sample-echo-300x257.png" alt="Home Page" width="300" height="257" /></a></p>
<p>The index page simply contains a text box with a button. Entering a message and pressing the button results in an Ajax call to the server which echos the message back to the page. An HTML element in the middle of the page is updated with the result via JavaScript.</p>
<p>You&#8217;ll notice in the footer of the page you can see the currently logged in user on the left, and a link to log out on the right. Clicking the log out link takes you to the logout page, which looks like this:</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2009/01/sample-logout.png"><img class="size-medium wp-image-109 alignnone" title="sample-logout" src="http://www.sporcic.org/wp-content/uploads/2009/01/sample-logout-300x255.png" alt="Logout Page" width="300" height="255" /></a></p>
<p>Again, nothing fancy. Just a message saying you have logged out and a link to login again. Use the login link to login as bob and try the echo functionality again. This time you get a different result:</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2009/01/sample-badauth.png"><img class="size-medium wp-image-110 alignnone" title="sample-badauth" src="http://www.sporcic.org/wp-content/uploads/2009/01/sample-badauth-300x255.png" alt="Not an Admin" width="300" height="255" /></a></p>
<p>This demonstrates what happens with Spring Security via annotations. Here&#8217;s the echo method in the service layer:</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2009/01/echo-service.png"><img class="alignnone size-full wp-image-111" title="echo-service" src="http://www.sporcic.org/wp-content/uploads/2009/01/echo-service.png" alt="" width="306" height="147" /></a></p>
<p>As you can see, the method is secured with an annotation indicating the user must be in the ROLE_ADMIN role to use the method. Bob is only in the ROLE_USER role, so the call to this service fails.</p>
<p>The application makes use of a ResourceBundleMessageSource for the pages mapped through the htmlDispatch servlet. The login.jsp and logout.jsp don&#8217;t go through the dispatch servlet, so they can&#8217;t use the message bundle for the window and page title.</p>
<p>There is way too much to this simple application to cover completely now, but I&#8217;ll give the highlights of what to go look at in the major configuration files. Paths are relative to the project root:</p>
<ol>
<li><code>web/WEB-INF/web.xml </code>- notice that I configure two dispatch servlets. One catching *.htm and one *.json. This sets things up to treat Ajax requests differently. Spring Security is also configured here.</li>
<li><code>web/WEB-INF/applicationContext.xml</code> &#8211; typical application context for a Spring application. I turn on annotation handling with package scanning under the sample.core package. Apache Tiles is configured in this file, and I have also configured a Transaction Manager around the JDBC DataSource. You should tweak this based on your underlying persistence preferences. I&#8217;m a RowMapper fan, but you can plug in Hibernate or JPA.</li>
<li><code>web/WEB-INF/htmlDispatch-servlet.xml </code>- the context for web (*.htm) requests. This sets up the ResourceBundle for messages and a typical ViewResolver mapping the *.htm requests to jsp files under web/WEB-INF/jsp. Also configures component scanning for the sample.web package.</li>
<li><code>web/WEB-INF/jsonDispatch-servlet.xml</code> &#8211; the context for Ajax (*.json) requests. Configures component scanning for the sample.json package and specifies a custom Ajax ViewResolver. This will automagically serialize all ModelMaps returned out of the Controller responded to *.json requests to JSON.</li>
<li><code>web/WEB-INF/applicationContext-security.xml</code> &#8211; so simple to look at, yet so painful to figure out. This is the Spring Security configuration file. Although it looks deceptively simple, it was a beating to figure it all out. It enables annotation-driven security, which you saw on the EchoService above. It also sets up the form login and locks down all the pages. Note I leave the /resource directory open. This is where I put all my javascript, stylesheets and images. If you want to secure those resources, you&#8217;ll need to get more specific on the intercept-urls.<br />
Users are declared at the bottom. Passwords are clear text, which is fine for a trivial demo, but you would want to replace this with something more industrial-strength in a real application.</li>
<li><code>web/WEB-INF/tiles-config.xml</code> &#8211; the Apache Tiles configuration. I only setup one definition here to keep it simple.</li>
<li><code>web/WEB-INF/jsp/layouts/baseLayout.jsp</code> &#8211; the base layout used for tiles. I&#8217;m only inserting content at two locations in the template. In the HTML head section, I allow for an optional insert of headerContent. I use this to include JavaScripts specific to a page. The other content is within the center div called mainContent.<br />
Note that the body is pretty empty and that the divs all have the x-hidden class. This means they are not normally visible. I use an ExtJS Viewport for layout, which uses the contents of these divs.</li>
<li><code>web/resources/javascripts/layout.js</code> &#8211; this JavaScript file was included in the baseLayout.jsp above. It creates the Viewport using a border layout.</li>
<li><code>web/resources/javascripts/index.js</code> &#8211; the JavaScript file included for the index.jsp page. It decorates the plain HTML inputs on the page to do the cool Ajax stuff. Note towards the bottom how I use ExtJS to set focus on a form field and to bind the ENTER key to the submit button.</li>
<li><code>web/resources/javascripts/login.js</code> &#8211; the JavaScript file use for the login.jsp page. If you look at login.jsp, you&#8217;ll notice there is no form. Everything is created by ExtJS from the login.js file, including the cool box effect. One trick is that Spring Security wants a normal form POST for the login form. I override the form to do a standard submit instead of an Ajax submit and set the form action explicitly.</li>
</ol>
<p>This covers the major features. I&#8217;ll be using this as a base for other projects and will be expanding out my ExtJS demo. Since there are pretty much zero examples out there of tying together this stack, I hope this can be of use to some folks.</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2009/01/template.zip">Project Template</a></p>
<ul>
<li>2/28/2009 &#8211; upgrade to ExtJS 2.2.1, fixed compile issue on Linux, added in iBatis for ORM</li>
<li>3/26/2009 &#8211; I&#8217;ve setup a dev server with the latest version of the template at <a href="http://www.codezombie.com/template">CodeZombie.com</a> so you can check it out without having to install. User scott/tiger for credentials. I&#8217;ll be updating this install with a more feature-rich demo application shortly</li>
<li>3/28/2009 &#8211; changed around the project structure and build.xml to use Ivy for dependency management. Check the README.txt file in the root directory for the details.</li>
<li>4/28/2009 &#8211; updated the included JSON encoder to be able to return JSON arrays by using the key <code>_root</code> in the model map. If this key is found, its content will be used as the root element of the return JSON instead of encoding the whole map. Also removed the unicode characters from StringScrubber to make the compiler on Linux happy.</li>
</ul>
<p>p.s. this pulls together a lot of jars and pieces from different folks to build the demo. If you use this for more than playing around, you need to make sure you respect whatever licenses the authors have in place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sporcic.org/2009/01/springing-around-with-extjs/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Silver(very)light</title>
		<link>http://www.sporcic.org/2009/01/silververylight/</link>
		<comments>http://www.sporcic.org/2009/01/silververylight/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 14:21:31 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[improving enterprises]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.sporcic.org/?p=92</guid>
		<description><![CDATA[My friend Caleb Jenkins of Improving Enteprises spoke at the North Dallas .NET Users Group last night about Silverlight 2.0 databindings, styles and templates. Caleb is a fun, energetic speaker, the kind of guy you want to have on your team or have a beer with. He&#8217;s definitely gungho over Silverlight, but I&#8217;m still not [...]]]></description>
			<content:encoded><![CDATA[<p>My friend <a title="DevelopingUX" href="http://developingux.com/">Caleb Jenkins</a> of <a title="Improving Enterprises" href="http://www.improvingenterprises.com/">Improving Enteprises</a> spoke at the <a title="NDDNUG" href="http://nddnug.net">North Dallas .NET Users Group</a> last night about Silverlight 2.0 databindings, styles and templates. Caleb is a fun, energetic speaker, the kind of guy you want to have on your team or have a beer with. He&#8217;s definitely gungho over Silverlight, but I&#8217;m still not getting very warm to it.</p>
<p>Part of my grief with Silverlight is the same I have with Flex. We don&#8217;t need browser plugins to build feature-rich RIAs. I will concede the vector graphics space to these two technologies, but that is a space I could care less about. All the applications I work on involve web-based <a title="Wikipedia: CRUD" href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete">CRUD</a> of business data. HTML and JavaScript are just fine at doing those, and I actually think <a title="ExtJS" href="http://www.extjs.com">ExtJS</a> still does a better job than either with the widgets on the page. And since ExtJS is simple JavaScript, CSS and HTML, it will work with all browsers, including the iPhone, today.</p>
<p>To set the record straight, I&#8217;m going to expand my .NET demo project into a full demo site so you can see what I&#8217;m talking about. I&#8217;ll publish the URL when I&#8217;ve pushed some code.</p>
<p>I toss out my congratulations to Caleb on his diet. He&#8217;s lost 16lbs in only three weeks and it has motivated him to <a title="Calebs Diet" href="http://getlessofme.com">blog about it</a>. He&#8217;s even going to have a contest to give away an MSDN subscription tied to weight-loss, although I think he should just give it to me for mentioning him in my blog <img src='http://www.sporcic.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Also, I haven&#8217;t mentioned <a title="Improving Enterprises" href="http://www.improvingenterprises.com">Improving Enterprises</a> before, but I should. They merit a blog post of their own, but for now I can simply say they are the best small technology consulting company in the DFW area. I do not know of any other organization with such a concentration of A-list talent and would highly recommend them to any organization that actually needs to get something done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sporcic.org/2009/01/silververylight/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Missing Linq</title>
		<link>http://www.sporcic.org/2008/10/the-missing-linq/</link>
		<comments>http://www.sporcic.org/2008/10/the-missing-linq/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 03:26:28 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[extjs]]></category>

		<guid isPermaLink="false">http://www.sporcic.org/?p=27</guid>
		<description><![CDATA[I&#8217;ve almost wrapped up porting my ExtJS demo application to ASP.NET. It has been pretty simple so far once I realized I was trying to make it too complex. After getting a handle on ASP.NET MVC, I realized I didn&#8217;t need to use WCF for the JSON calls. ASP.NET MVC is pretty slick and has [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve almost wrapped up porting my ExtJS demo application to ASP.NET. It has been pretty simple so far once I realized I was trying to make it too complex. After getting a handle on <a title="ASP.NET MVC Beta Download" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=A24D1E00-CD35-4F66-BAA0-2362BDDE0766&amp;displaylang=en">ASP.NET MVC</a>, I realized I didn&#8217;t need to use WCF for the JSON calls. ASP.NET MVC is pretty slick and has excellent built-in support for returning JSON data via the JsonResult class and Json method.</p>
<p>For the data, I&#8217;m using a very simple database I called Demo which contains two tables, City and Country. They look like this:</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2008/10/tables.png"><img class="alignnone size-medium wp-image-28" title="SQL Tables" src="http://www.sporcic.org/wp-content/uploads/2008/10/tables-300x248.png" alt="" width="300" height="248" /></a></p>
<p>I&#8217;m using Linq to SQL for data access, and everything was moving along quite nicely until I ran into a small problem. In the Java version of my demo application, I used server-side sorting for the grid. How this works is that when you click a column header on the ExtJS Grid, the data store makes an AJAX call to the server controller with the POST data containing two parameters. The sort parameter contains the name of the column in the data store that the sort should be based on. The dir parameter has either the world ASC or DESC, indicating the direction of the sort.</p>
<p>The method signature in my controller which catches this request looks like this:</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2008/10/json-signature3.png"><img class="alignnone size-medium wp-image-37" title="Method Signature" src="http://www.sporcic.org/wp-content/uploads/2008/10/json-signature3-300x15.png" alt="" width="400" height="15" /></a></p>
<p>ASP.NET MVC will automatically map the two POST parameters to the two parameters in the method, since they have the same names. Where I hit a wall though was with Linq.</p>
<p>One of the big design features of Linq is to provide a strongly typed interface for the query language. Since I wanted the orderby statement to be based on the POST parameter, I thought I could do something like this:</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2008/10/sample-11.png"><img class="alignnone size-medium wp-image-41" title="No Worky" src="http://www.sporcic.org/wp-content/uploads/2008/10/sample-11-300x75.png" alt="" width="500" height="100" /></a></p>
<p>Noticing no red squiggles, I assumed this would work. But it doesn&#8217;t. The problem is Linq is strongly typed, so it won&#8217;t accept a string after orderby. Linq wants something like this:</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2008/10/sample-22.png"><img class="alignnone size-medium wp-image-43" title="Static Linq" src="http://www.sporcic.org/wp-content/uploads/2008/10/sample-22-300x71.png" alt="" width="500" height="100" /></a></p>
<p>This would be cool in normal circumstances, but since I need to vary the orderby based on the sort parameter, I would have to do a large if-then block with multiple Linq queries, executing the required one based on the incoming parameter. Since that sounded like a pretty stupid idea, I dug a big deeper.</p>
<p>After much searching, I determined that Linq, as implemented, can&#8217;t handle the dynamic queries. But fortunately some other very smart people created a work around in the form of an extension to Linq called the <a title="Dynamic Query Tutorial" href="http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx">Dynamic Query Library</a>. Scott&#8217;s article provides a pretty good introduction. All you need to do is include the Dynamic.cs file in the solution and add the namespace to the imports.</p>
<p>Using the Dynamic Query extension methods, I can now do something like this:</p>
<p><a href="http://www.sporcic.org/wp-content/uploads/2008/10/sample-31.png"><img class="alignnone size-medium wp-image-39" title="Dynamic Linq" src="http://www.sporcic.org/wp-content/uploads/2008/10/sample-31-300x83.png" alt="" width="500" height="100" /></a></p>
<p>The Dynamic.cs adds a new version of the OrderBy method which takes a string parameter containing the name of the field to sort on and an optional sort parameter. No if-then loops from hell and no more hair pulling trying to find the simplest solution that works.</p>
<p>I would bet the Dynamic.cs stuff ends up in core Linq, as it is simply too valuable for situations requiring dynamic data access, like my ExtJS demo. It also provides similar support for strings to the other Linq commands.</p>
<p>Now that I&#8217;ve gotten past the ugliness, I&#8217;ll be able to wrap up my ExtJS demo application. I&#8217;m adding some additional features to it which demonstrate some of the coolness of ASP.NET MVC, so stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sporcic.org/2008/10/the-missing-linq/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
