<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Summer Before the EAR - Dave Artus </title>
	<atom:link href="http://djna.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://djna.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Tue, 06 Dec 2011 09:58:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='djna.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>The Summer Before the EAR - Dave Artus </title>
		<link>http://djna.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://djna.wordpress.com/osd.xml" title="The Summer Before the EAR - Dave Artus " />
	<atom:link rel='hub' href='http://djna.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Android Device and USB installation</title>
		<link>http://djna.wordpress.com/2011/11/24/android-device-and-usb-installation/</link>
		<comments>http://djna.wordpress.com/2011/11/24/android-device-and-usb-installation/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 16:42:18 +0000</pubDate>
		<dc:creator>djna</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">https://djna.wordpress.com/?p=209</guid>
		<description><![CDATA[A brief posting describing how I got my Android device connected to my Windows 7 machine so that I could use the Android adb tool to install an application. My objective is to be able to run the Android Debug Bridge (adb) on my Windows 7 machine, connecting to an Android device. This allows me [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=209&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A brief posting describing how I got my Android device connected to my Windows 7 machine so that I could use the Android adb tool to install an application.</p>
<p>My objective is to be able to run the Android Debug Bridge (adb) on my Windows 7 machine, connecting to an Android device. This allows me to perform a number of useful administrative tasks such as deploy applications, look at application logs and start a unix shell session on the device.</p>
<p><em>We’re getting into territory here where incautious actions can damage your Android device. The instructions here can get you powerful access on your device, so “caveat lector”, don’t do any of this unless you take responsibility for unpleasant outcomes such as your device becoming as useful as a housebrick.</em></p>
<p>The starting point is that you have installed Eclipse and the Android SDK manager. References on how to do this are supplied with the IBM Mobile Technology Preview as mentioned in my <a href="http://djna.wordpress.com/2011/11/02/ibm-mobile-technology-preview-getting-started/">previous article</a>. There are a number of optional installation packages which can be seen in Eclipse if you select Window-&gt;Android SDK Manager. You need to ensure that the Google USB Driver is installed.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image18.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb18.png?w=415&#038;h=328" width="415" height="328" /></a></p>
<p>When you select this item the drivers are downloaded and placed in your ADK installation directory.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image19.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb19.png?w=410&#038;h=141" width="410" height="141" /></a></p>
<p>However, this does not conclude the installation procedure, when I plugged in my device it was not visible to adb. So there’s one more step:</p>
<h2>Installing the Driver for the Device</h2>
<p>First, ensure that the device is attached to the USB port and that the device memory is not mounted as a disk. Then in the Windows Device manager you should be able to find your device. In my case, I happen to be using a StorageOptions Scroll, which manifests as a device called TCC8900. RightClick on the device and you get the option to install a driver, and can browse to the just downloaded material. Unfortunately I got a message saying that no suitable driver could be found.</p>
<p>It transpired that the driver supplied by Google <strong>was</strong> suitable but the configuration file <strong>android_winusb.inf</strong> did not contain a matching entry. A bit of Googling (rather cyclic, no?) lead to the solution: the&#160; to the .inf file:</p>
<p>as I’m using 64 bit Windows, so I find the line</p>
<blockquote><p>[Google.NTamd64]</p>
</blockquote>
<p>on 32bit Windows it’s [Google.NTx86], and insert the lines</p>
<p>; Scroll &#8211; recovery     <br />%SingleAdbInterface% = USB_Install, USB\VID_18D1&amp;PID_DEED     <br />%CompositeAdbInterface% = USB_Install, USB\VID_18D1&amp;PID_DEED&amp;MI_01     <br />; Scroll &#8211; bootloader (fastboot)     <br />%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&amp;PID_D00D     <br />;     </p>
<p>just before the next entry</p>
<blockquote><p>; HTC Dream</p>
</blockquote>
<p>Then, retrying the installation works just fine. The device now appears under a more understandable name:</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image20.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb20.png?w=306&#038;h=68" width="306" height="68" /></a></p>
<h2>Magic Numbers</h2>
<p>If you are using a different device then your entries in the inf file will be different. You can find the values by selecting your device, viewing the property tab and selecting hardware IDs.</p>
<h2>Now what can we do?</h2>
<p>So now that the device is attached we can simply select an Android application project, rightClick-&gt;Run As –&gt; Android Application and it is deployed to the device and launched, any output appearing in the LogCat view. This is a great improvement on mounting a drive, copying an apk file and installing the app.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/djna.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/djna.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/djna.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/djna.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/djna.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/djna.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/djna.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/djna.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/djna.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/djna.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/djna.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/djna.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/djna.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/djna.wordpress.com/209/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=209&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://djna.wordpress.com/2011/11/24/android-device-and-usb-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9df488f3711680cb831c146a5aa437fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">djna</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb18.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb19.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb20.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Testing a PhoneGap Application with Chrome and Ripple</title>
		<link>http://djna.wordpress.com/2011/11/15/testing-a-phonegap-application-with-chrome-and-ripple-2/</link>
		<comments>http://djna.wordpress.com/2011/11/15/testing-a-phonegap-application-with-chrome-and-ripple-2/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 15:48:59 +0000</pubDate>
		<dc:creator>djna</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">https://djna.wordpress.com/2011/11/15/testing-a-phonegap-application-with-chrome-and-ripple-2/</guid>
		<description><![CDATA[In my previous posting I described how to get started with the freely donwloadable&#160; IBM Mobile Technology Preview. I took one of the samples provided and ran it in an Android emulation environment. That worked nicely to test some features of the samples but the speed of emulation is quite slow. This doesn’t make for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=199&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://djna.wordpress.com/2011/11/02/ibm-mobile-technology-preview-getting-started/">previous posting</a> I described how to get started with the freely donwloadable&#160; <a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/ibmmobile/entry/welcome_to_ibm_mobile_technology_preview?lang=en">IBM Mobile Technology Preview</a>. I took one of the samples provided and ran it in an Android emulation environment. That worked nicely to test some features of the samples but the speed of emulation is quite slow. This doesn’t make for a productive Code/Test cycle. In this article I want to describe an alternative approach using a Chrome Plugin known as <a href="http://rippledocs.tinyhippos.com/index.html">Ripple</a>. Ripple was created by the gloriously named <a href="http://tinyhippos.com/">Tiny Hippos</a>, who were acquired by Research in Motion this year.</p>
<h2>Hybrid Applications</h2>
<p>One key aspect of the IBM Mobile Technology Preview is the use of PhoneGap to enable building Hybrid applications. That is applications that run in a browser and yet which exploit native device capabilities such as GeoLocation and the Accelerometer. In effect PhoneGap provides an device-independent JavaScript API hooking into a device-specific native implementations on each platform. The expectation is that the bulk of a Hybrid application is implemented in JavaScript that is portable across a wide range of devices. The Dojo mobile APIs will detect the particular device and hence allow suitable style-sheets to be selected giving a visual appearance that fiits the device standards. Hence we have a vision (to use an old phrase) of&#160; “write once, run anywhere”. In my team’s experience this, with careful design, this vision can be realised.</p>
<p>When developing such Hybrid applications we can greatly accelerate the development/unit test cycle if we can simply run the JavaScript in a browser. This is where Ripple comes in: it provides an emulation of different device types and an implementation of the major PhoneGap APIs running directly in Chrome. I am going to show how to use Ripple to run the Mysurance sample, which uses GeoLocation in Ripple.</p>
<p>One note: some aspects of the Technology Preview, notably the Notification framework, depend upon Java code. We cannot test these aspects using Ripple as it currently stands. I believe that Mysurance is typical of most Hybrid applications in having very significant portions of the code in JavaScript and hence benefiting from testing in Ripple.</p>
<h2>Setup</h2>
<p>The application assets (web pages, JavaScript, css and images) are held in a assets directory. We need those to be accessible to the browser. It simplifies some of my other testing if I serve these files from a web server such as Apache or IBM HTTP Server.</p>
<p>I add these entries to my httpd.conf:</p>
<p><font size="2" face="Cordia New"><strong>Alias /mysurance &quot;C:/IBM/MobileTechPreview/samples/mysurance/eclipse-project/assets/www&quot;</strong></font></p>
<p><font size="2" face="Cordia New"><strong>&lt;Directory &quot;C:/IBM/MobileTechPreview/samples/mysurance/eclipse-project/assets/www&quot;&gt;        <br />&#160;&#160;&#160; AllowOverride None         <br />&#160;&#160;&#160; Options None         <br />&#160;&#160;&#160; Order allow,deny         <br />&#160;&#160;&#160; Allow from all         <br />&lt;/Directory&gt;</strong></font></p>
<p>and restart Apache. I can now point my browser at </p>
<p><a href="http://localhost/mysurance/apps/mysurance/step12.html">http://localhost/mysurance/apps/mysurance/step12.html</a></p>
<p>and see the Application</p>
<p>Ripple Installation</p>
<p>You can install Ripple into a running Chrome instance from this <a href="http://www.google.co.uk/url?sa=t&amp;rct=j&amp;q=ripple%20chrome%20&amp;source=web&amp;cd=1&amp;ved=0CCsQFjAA&amp;url=https%3A%2F%2Fchrome.google.com%2Fwebstore%2Fdetail%2Fgeelfhphabnejjhdalkjhgipohgpdnoc&amp;ei=LXrCTpXoBoSgOu70he8O&amp;usg=AFQjCNHeCJMx2UB25JWRxy0bKMF3omxJrg&amp;sig2=1BJlJMiIZCb3cqvBV8zadw">Ripple download</a> site. On completion the Ripple icon is visible in the toolbar</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image8.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb8.png?w=449&#038;h=52" width="449" height="52" /></a></p>
<p>The first time you access an application with Ripple installed you see this</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image9.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb9.png?w=443&#038;h=174" width="443" height="174" /></a></p>
<p>which offers a number of possible runtimes, I choose PhoneGap, and then can select the Ripple icon and choose to Enable Ripple.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image10.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb10.png?w=405&#038;h=331" width="405" height="331" /></a></p>
<p>The Mysurance application now shows in a device emulator, along with various control capabilities.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image11.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb11.png?w=412&#038;h=254" width="412" height="254" /></a></p>
<h2>GeoLocation</h2>
<p>If you explore the Ripple control capabilities you will see that you can select different devices, emulate the accelerometer and send events. Here I’m going to focus on the GeoLocation. Expanding that section I see</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image12.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb12.png?w=283&#038;h=504" width="283" height="504" /></a></p>
<p>With a default location of Waterloo Station. We can change this, if we know the latitude and longitude of our desired location. I will choose a place in Yorkshire, finding it’s coordinates from <a href="http://itouchmap.com/latlong.html">this site</a>.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image13.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb13.png?w=297&#038;h=168" width="297" height="168" /></a></p>
<p>Ripple now shows the new location</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image14.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb14.png?w=239&#038;h=449" width="239" height="449" /></a></p>
<p>Back in the application I pick Accident Toolkit and from this menu</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image15.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb15.png?w=185&#038;h=244" width="185" height="244" /></a></p>
<p>select Call the Police. This brings up a map centred on the location we specified to Ripple, with nearest police station identified.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image16.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb16.png?w=190&#038;h=306" width="190" height="306" /></a></p>
<p>Select the station gives us the contact details.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image17.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb17.png?w=193&#038;h=315" width="193" height="315" /></a></p>
<h2>Conclusion</h2>
<p>This does seem to be a very promising approach to testing some aspects of Hybrid applications.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/djna.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/djna.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/djna.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/djna.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/djna.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/djna.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/djna.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/djna.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/djna.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/djna.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/djna.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/djna.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/djna.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/djna.wordpress.com/199/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=199&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://djna.wordpress.com/2011/11/15/testing-a-phonegap-application-with-chrome-and-ripple-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9df488f3711680cb831c146a5aa437fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">djna</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb13.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb14.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb15.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb16.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb17.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>IBM Mobile Technology Preview &#8211;Getting Started</title>
		<link>http://djna.wordpress.com/2011/11/02/ibm-mobile-technology-preview-getting-started/</link>
		<comments>http://djna.wordpress.com/2011/11/02/ibm-mobile-technology-preview-getting-started/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 19:47:24 +0000</pubDate>
		<dc:creator>djna</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">https://djna.wordpress.com/2011/11/02/ibm-mobile-technology-preview-getting-started/</guid>
		<description><![CDATA[In October 2011 IBM announced the Mobile Technology Preview, which you can download here. The preview enables development of “Hybrid” mobile applications that can exploit server-push notifications.&#160; A “Hybrid”&#160; application is developed in Javscript and runs in a device’s browser environment and exploits a virtual device API (PhoneGap in this case) to access native device [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=167&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In October 2011 IBM announced the Mobile Technology Preview, which you can <a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/ibmmobile/entry/ibm_mobile_technology_preview_downloads?lang=en">download here.</a> The preview enables development of “Hybrid” mobile applications that can exploit server-push notifications.&#160; A “Hybrid”&#160; application is developed in Javscript and runs in a device’s browser environment and exploits a virtual device API (<a href="http://phonegap.com/">PhoneGap</a> in this case) to access native device capabilities such as geolocation and the accelerometer. It is interesting to see that the preview also includes an Alpha release of the 8.5 version of the WebSphere Application Server, which is used for hosting the server-side code, and in particular the notification engine.</p>
<p>The promise of&#160; the Hybrid approach is that rich applications exploiting device capabilities can be developed more cost-effectviley that developing device-specific Native applications.</p>
<p>In this article I want to describe how build and run one of the samples provided with the preview. I encountered a few minor glitches in getting this going, I hope I can save you some time.</p>
<h2>Installation</h2>
<p>The preview documentation includes an article, ProjectSetup.html,&#160; which describes how to set up your development environment.&#160; This procedure requires you to also download Eclipse, the Android SDK and the emulators – the Android Virtual Devices (AVD) that you will use for testing. </p>
<p>I did my initial testing with the Eclipse Helios release, but more recently have been using Indigo. I had occasional stability problems with the latest AVD 4.0 release and so chose to install version 2.2. </p>
<p>On completing the installation my Eclipse Window menu now has some Android-related options.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb.png?w=244&#038;h=135" width="244" height="135" /></a></p>
<p>Note that amongst the installation steps is an adjustment to your eclipse.ini file to use a Sun JRE when launching Eclipse. This is necessary because the build procedure to produce an deployment package for Android depends on a Sun-specific package: <strong>sun.security.x509</strong>. </p>
<p>At present I have not managed to find how to launch Rational Application Developer (RAD) under a Sun JRE and hence I do not use RAD as my Android development environment.</p>
<h2>Project Set Up</h2>
<p>The tech preview includes a number of sample applications delivered in the form of eclipse project directories. The application build tools make certain assumptions about project structure, that structure is most easily created by using Android-specific project creation options.</p>
<p>If you use a default Java project structure then your application will appear to build correctly but you will get an exception of this form:</p>
<p><font size="1" face="Courier New">10-31 16:28:53.982: E/AndroidRuntime(1200): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ibm.mobile.dojoshowcase/ </font><font size="1" face="Courier New">com.ibm.mobile.dojoshowcase.DojoShowcase}: java.lang.ClassNotFoundException: com.ibm.mobile.dojoshowcase.DojoShowcase</font></p>
<p>So, use the following approach.</p>
<h3>Import As An Android Project</h3>
<p>In Eclipse select File-&gt;New-&gt;Other-&gt;Android-&gt;Android Project</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image1.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb1.png?w=244&#038;h=176" width="244" height="176" /></a></p>
<p>Click Next and select Create project from existing source, and browse to the location of one the of sample projects, for example</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image2.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb2.png?w=244&#038;h=111" width="244" height="111" /></a></p>
<p>You may see an error</p>
<p>&#160;&#160;&#160; An Eclipse project already exists in this directory.   <br />&#160;&#160;&#160; Consider using File &gt; Import &gt; Existing Project instead.</p>
<p>It is important that you do not follow this advice! The File-&gt;Import option does not yield a correctly structured project.</p>
<p>Instead, in Windows Explorer, browse to that project directory and delete the <strong>.project </strong>file (do not delete the .classpath file) and retry creating the Android project, which will now succeed. </p>
<p>Click Next and select your chosen Build Target. By default the samples target Android 4, but so far I’ve been using Android 2.2</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image3.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb3.png?w=244&#038;h=135" width="244" height="135" /></a></p>
<p>Click Next again and you will see that the project’s AndroidManifest.xml has been understood.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image4.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb4.png?w=244&#038;h=97" width="244" height="97" /></a></p>
<p>Your project should now build cleanly. On some occasions I’ve seen compilation errors </p>
<p><em>&#160;&#160; Syntax error, annotations are only available if source level is 1.5 or greater&#160;&#160; </em> </p>
<p>Despite the fact that the workspace is set up to use Java 1.6. To fix this, select your project, rightClick-&gt;Properties-&gt;Java Compiler, check the “Enable Project-Specific Settings” option, choose some different compiler level and click OK. This forces rebuild. Then repeat the process reverting to having “Enable Project-Specific Settings” unchecked. I would have expected a project clean or a rebuild to be as effective, but this recipe is the one that worked for me.</p>
<h2>Running the Application</h2>
<p>To run the project in the emulator, select the Project, rightClick-&gt;Run As-&gt;Android Application</p>
<p>This will launch the appropriate emulator, package the applications, deploy it to the emulator and initiate it.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image5.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb5.png?w=244&#038;h=226" width="244" height="226" /></a></p>
<p>A couple of notes about this process</p>
<h4></h4>
<h3>Startup Time</h3>
<p>The emulator takes a considerable time to start (on my laptop over 5 minutes). It’s reassuring to watch the logs so that you can see progress. In Eclipse, Window-&gt;Show View-&gt;LogCat.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image6.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb6.png?w=398&#038;h=104" width="398" height="104" /></a></p>
<p>You should also open the Console view when you get to the stage of deploying the application.</p>
<h3>Increase Timeout</h3>
<p>You may also see an error of this form</p>
<p><em>11-02 20:30:02.950: I/System.out(391): onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL= file:///android_asset/www/demosite/demos/mobileGallery/demo.html</em></p>
<p>This is actually due to the emulator taking too long to retrieve the file. You can increase the timeout by adding a line of code to the application.</p>
<p><a href="http://djna.files.wordpress.com/2011/11/image7.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/11/image_thumb7.png?w=244&#038;h=140" width="244" height="140" /></a></p>
<p>Set the loadUrlTimeoutValue by adding the code shown below</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; super.onCreate(savedInstanceState);   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong><font size="1">this.setIntegerProperty(&quot;loadUrlTimeoutValue&quot;, 70000);       <br /></font></strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; super.loadUrl(“<a href="///android_asset&nbsp;">file:///android_asset </a>//etc</p>
<p>With that in place the sample ran correctly, if slowly.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/djna.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/djna.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/djna.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/djna.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/djna.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/djna.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/djna.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/djna.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/djna.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/djna.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/djna.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/djna.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/djna.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/djna.wordpress.com/167/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=167&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://djna.wordpress.com/2011/11/02/ibm-mobile-technology-preview-getting-started/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9df488f3711680cb831c146a5aa437fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">djna</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/11/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>The pleasant power of JPA Query Language</title>
		<link>http://djna.wordpress.com/2011/07/15/the-pleasant-power-of-jpa-query-language/</link>
		<comments>http://djna.wordpress.com/2011/07/15/the-pleasant-power-of-jpa-query-language/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 17:04:35 +0000</pubDate>
		<dc:creator>djna</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://djna.wordpress.com/2011/07/15/the-pleasant-power-of-jpa-query-language/</guid>
		<description><![CDATA[This post is a minor celebration, I used some technology and it worked nicely. There’s also a reminder of how to enable OpenJPA tracing in a WebSphere environment. This allowed me to have alook at the SQL generated by JPA. Setting the Scene This example is based on some work I was doing in a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=145&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post is a minor celebration, I used some technology and it worked nicely. There’s also a reminder of how to enable OpenJPA tracing in a WebSphere environment. This allowed me to have alook at the SQL generated by JPA.</p>
<h2>Setting the Scene</h2>
<p>This example is based on some work I was doing in a financial application but I’ve reworked the problem in terms of health checks of some pieces of electrical equipment. The idea is that our system receives records recording the latest known &quot;Health” of a piece of equipment. The records contain a time-stamp.</p>
<table border="0" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="133">Equipment ID</td>
<td valign="top" width="165">Date</td>
<td valign="top" width="101">Health %</td>
</tr>
<tr>
<td valign="top" width="133">101</td>
<td valign="top" width="165">11th July 2011</td>
<td valign="top" width="101">98</td>
</tr>
<tr>
<td valign="top" width="133">101</td>
<td valign="top" width="165">12th July 2011</td>
<td valign="top" width="101">97</td>
</tr>
<tr>
<td valign="top" width="133">101</td>
<td valign="top" width="165">13th July 2011</td>
<td valign="top" width="101">98</td>
</tr>
<tr>
<td valign="top" width="133">351</td>
<td valign="top" width="165">11th July 2011</td>
<td valign="top" width="101">71</td>
</tr>
<tr>
<td valign="top" width="133">351</td>
<td valign="top" width="165">12th July 2011</td>
<td valign="top" width="101">47</td>
</tr>
<tr>
<td valign="top" width="133">351</td>
<td valign="top" width="165">13th July 2011</td>
<td valign="top" width="101">33</td>
</tr>
</tbody>
</table>
<p>In the example table we see a piece of equipment, number 101, operating healthily,&#160; whereas equipment number 351 is less healthy and its health is falling over time.</p>
<p>Now we might also have a table with more information about the Equipment, and so our health class might look like</p>
<p>&#160;&#160; @Entity public class Health {   <br />&#160;&#160;&#160;&#160; public Date timestamp;    <br />&#160;&#160;&#160;&#160; public int healthPercent; </p>
<p>&#160;&#160;&#160;&#160; @ManyToOne   <br />&#160;&#160;&#160;&#160; @JoinColumn(name=&quot;ID&quot;)    <br />&#160;&#160;&#160;&#160; public Equipment equipment;    <br />&#160; }</p>
<h2>Simple JPA query</h2>
<p>One thing we might reasonably do is implement a service to return the recent history of those records for a piece of equipment. Our RESTful service might have a URL like this</p>
<blockquote><p><a href="http://myhost/equipment/351/history">http://myhost/equipment/351/history</a></p>
</blockquote>
<p>We would probably have some additional parameters to allow selection by date, but for the sake of simplicity let’s keep it to that.</p>
<p>In previous postings I’ve described how we can use JAX/RS to implement a service of this kind. Our JAX/RS implementation would probably call an EJB and eventually we’d end up invoking a JPA query</p>
<p>&#160;&#160;&#160;&#160;&#160; SELECT h FROM Health s    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WHERE h.equipment.id = :equipmentId</p>
<p>We could have then an EJB with and injected entity manager</p>
<p>&#160;&#160;&#160; @Stateless   <br />&#160;&#160;&#160; @LocalBean    <br />&#160;&#160;&#160;&#160; public class RigEjb { </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; @PersistenceContext   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; private EntityManager m_em;</p>
<p>Then in the EJB a method to invoke the query</p>
<p>&#160;&#160;&#160; public List&lt;History&gt; equipmentHistory(int equipmentId) {   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Query query = m_em.createNamedQuery(    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;listHistoryForEquipment&quot;);&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; query.setParameter(&quot;equipmentId&quot;, equipmentId);&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return (List&lt;History&gt;) query.getResultList();    <br />&#160;&#160;&#160; }</p>
<p>All very simple written in a few tens of minutes and we get back a list of the history records for a piece of equipment, suitable for displaying in, for example, a graph. JPQL is doing well so far.</p>
<h2>How Healthy Now?</h2>
<p>Now Historic trends of Health are interesting, and indeed I’ve worked on systems where predicting the future health of equipment from such data is of considerable business value. However there’s probably a more important question to ask of this data: What’s the latest view about the health of each piece equipment?</p>
<p>For that we need to pick just one record for each piece of equipment, the latest one we have. Now when I first hit this problem I created a naive implementation. I just returned all the records to my Java application and iterated them identifying the latest record for each piece of equipment. This is not a scalable solution, with a large number of history records performance would not be good.</p>
<p>However JPQL is actually pretty powerful. And after some thought and a question on StackOverflow I came up with</p>
<p>&#160; SELECT h FROM Health    <br />&#160; WHERE h.equipment.type like :type    <br />&#160; AND h.date = (    <br />&#160;&#160;&#160;&#160; SELECT MAX(hmax.date)     <br />&#160;&#160;&#160;&#160; FROM Health hmax WHERE    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hmax.equipment.id = h.equipment.id    <br />&#160;&#160;&#160; )</p>
<p>We’re here identify the record whose date matches the maximum date for this piece of equipment. I’m impressed that the OpenJPA iJPQL implementation delivered with WebSphere can deal with this and produced the desired answers.</p>
<p>However there’s even more we can accomplish. Let’s make the data a little more complicated, with multiple measurements on the same day, differentiated by a serial number. </p>
<p>&#160;</p>
<table border="0" cellspacing="0" cellpadding="2" width="402">
<tbody>
<tr>
<td valign="top" width="110">Equipment ID</td>
<td valign="top" width="112">Date</td>
<td valign="top" width="98">Serial</td>
<td valign="top" width="80">Health %</td>
</tr>
<tr>
<td valign="top" width="110">101</td>
<td valign="top" width="112">11th July 2011</td>
<td valign="top" width="98">1</td>
<td valign="top" width="80">98</td>
</tr>
<tr>
<td valign="top" width="110">101</td>
<td valign="top" width="112">12th July 2011</td>
<td valign="top" width="98">1</td>
<td valign="top" width="80">97</td>
</tr>
<tr>
<td valign="top" width="110">101</td>
<td valign="top" width="112">12th July 2011</td>
<td valign="top" width="98">2</td>
<td valign="top" width="80">98</td>
</tr>
<tr>
<td valign="top" width="110">351</td>
<td valign="top" width="112">11th July 2011</td>
<td valign="top" width="98">1</td>
<td valign="top" width="80">71</td>
</tr>
<tr>
<td valign="top" width="110">351</td>
<td valign="top" width="112">11th July 2011</td>
<td valign="top" width="98">2</td>
<td valign="top" width="80">47</td>
</tr>
<tr>
<td valign="top" width="110">351</td>
<td valign="top" width="116">11th July 2011</td>
<td valign="top" width="117">3</td>
<td valign="top" width="93">33</td>
</tr>
<tr>
<td valign="top" width="110">351</td>
<td valign="top" width="116">12th July 2011</td>
<td valign="top" width="117">1</td>
<td valign="top" width="93">29</td>
</tr>
</tbody>
</table>
<p>Now this may seem a little contrived, but in fact the data now matches very closely the financial data I was working with in my real project. In that project the record with the highest serial number each day was deemed to have the most significant “health” value.</p>
<p>So I need to select these records:</p>
<p>&#160;</p>
<table border="0" cellspacing="0" cellpadding="2" width="402">
<tbody>
<tr>
<td valign="top" width="110">Equipment ID</td>
<td valign="top" width="112">Date</td>
<td valign="top" width="98">Serial</td>
<td valign="top" width="80">Health %</td>
</tr>
<tr>
<td valign="top" width="110">101</td>
<td valign="top" width="112">11th July 2011</td>
<td valign="top" width="98">1</td>
<td valign="top" width="80">98</td>
</tr>
<tr>
<td valign="top" width="110">101</td>
<td valign="top" width="112">12th July 2011</td>
<td valign="top" width="98">2</td>
<td valign="top" width="80">98</td>
</tr>
<tr>
<td valign="top" width="110">351</td>
<td valign="top" width="116">11th July 2011</td>
<td valign="top" width="117">3</td>
<td valign="top" width="93">33</td>
</tr>
<tr>
<td valign="top" width="110">351</td>
<td valign="top" width="116">12th July 2011</td>
<td valign="top" width="117">1</td>
<td valign="top" width="93">29</td>
</tr>
</tbody>
</table>
<p>The query to do this is gratifyingly similar to our previous case</p>
<p>&#160; SELECT s FROM State s    <br />&#160;&#160;&#160; WHERE s.equipment.id = :equipmentId    <br />&#160;&#160;&#160;&#160; AND s.id.serial = (    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SELECT MAX(smax.id.serial)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; FROM State smax WHERE     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; smax.equipment.id&#160; = s.equipment.id    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; AND smax.id.date = s.id.date    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ) </p>
<p>And this works very nicely. Out of curiosity I wanted to see what the actual SQL would be to implement this query, that led me to look at enabling OpenJPA trace in WebSphere.</p>
<h2>OpenJPA Trace</h2>
<p> In some environments OpenJPA trace is controlled by an entry in your peristence.xml, to enable SQL trace you would add the line:</p>
<p>&lt;property name=&quot;openjpa.Log&quot; value=&quot;SQL=TRACE&quot;/&gt;</p>
<p>In a WebSphere Application Server environment tracing is controlled through the RAS (Reliability, Availability Servicability) logging infrastructure. In my own code I use the java.util.logging APIs which are also integrated with WebSphere’s logging infrastructure.</p>
<p>Controlling this logging is a two step process. First you specify a destination for your trace and second you specify the logging levels for each module. One useful feature of WebSphere is that you can adjust logging levels dynamically at runtime.</p>
<p>I’ll describe doing this via the admin console, but you can also control logging via wsadmin scripts, and this is my preferred approach if I need to do much work with logging and tracing.</p>
<h3>Logging Destinations</h3>
<p>In the admin console select Troubleshooting, Logs and Trace, select your server and then Diagnostic Trace. This brings up the screen where you can specify the logging destination</p>
<p><a href="http://djna.files.wordpress.com/2011/07/image.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/07/image_thumb.png?w=419&#038;h=279" width="419" height="279" /></a> </p>
<p>In a high performance situation the use of a memory buffer which can then be seen in a core dump is useful, but in normal usage I use a file as show here.</p>
<p>Changes made to this specification do require a server restart, before doing that you may also want to change the default module logging levels. WebSphere allows you either to modify the logging levels temporarily (on the runtime tab) or to set the levels that take effect each time the server is started. I decided to make the change to those default settings and so selected Change Log Detail Levels.</p>
<h3>Module Logging Levels</h3>
<p>You can either specify a trace string directly or use a graphical UI.</p>
<p>The trace string can be entered directly</p>
<p><a href="http://djna.files.wordpress.com/2011/07/image1.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/07/image_thumb1.png?w=433&#038;h=252" width="433" height="252" /></a> </p>
<p>Here I set all modules to info, and the specifically the JPA SQL module to “all”, which is the highest volume setting.</p>
<p>If you don’t know the trace string, then it is best to use the UI module tree. I have found that it is best to make sure all modules are initialised before changing the logging levels through the UI module tree. So first I ran my test program which exercised JPA. Then expanded the tree to show the openjpa module</p>
<p><a href="http://djna.files.wordpress.com/2011/07/image2.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/07/image_thumb2.png?w=228&#038;h=147" width="228" height="147" /></a> </p>
<p>And then clicked the SQL module to bring up the available levels</p>
<p><a href="http://djna.files.wordpress.com/2011/07/image3.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://djna.files.wordpress.com/2011/07/image_thumb3.png?w=329&#038;h=171" width="329" height="171" /></a> </p>
</p>
</p>
<p>Note that this UI is also available on the runtime tab.</p>
<p>Having saved the changes and restarted the server I reran my tests an could see the SQL in my trace file.</p>
<blockquote><p>SELECT t0.date, t0.id, t0.serial, t2.id, t2.name, t3.id, t3.description, t3.field, t3.name, t2.type, t0.health      <br />FROM OUI.State t0 LEFT OUTER JOIN OUI.Equipment t2 ON t0.id = t2.id       <br />LEFT OUTER JOIN OUI.RIGS t3 ON t2.RIG_ID = t3.id       <br />WHERE (t0.id = ?       <br />AND t0.serial = (SELECT MAX(t1.serial)       <br />FROM OUI.State t1 WHERE (t1.id = t0.id AND t1.date = t0.date) ))&#160; </p>
</blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/djna.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/djna.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/djna.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/djna.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/djna.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/djna.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/djna.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/djna.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/djna.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/djna.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/djna.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/djna.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/djna.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/djna.wordpress.com/145/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=145&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://djna.wordpress.com/2011/07/15/the-pleasant-power-of-jpa-query-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9df488f3711680cb831c146a5aa437fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">djna</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/07/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/07/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/07/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2011/07/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>JPA: Small Mysteries</title>
		<link>http://djna.wordpress.com/2011/07/13/jpa-small-mysteries/</link>
		<comments>http://djna.wordpress.com/2011/07/13/jpa-small-mysteries/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 07:04:21 +0000</pubDate>
		<dc:creator>djna</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://djna.wordpress.com/2011/07/13/jpa-small-mysteries/</guid>
		<description><![CDATA[The Java Persistance API (POJO) handles the mapping between Java objects and data in a relational database. A few quick annotations of our Java class and the instances can be persisted to the database with a couple of lines of code. A couple of lines of Java Persistence Query Language and we can retrieve some [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=141&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The Java Persistance API (POJO) handles the mapping between Java objects and data in a relational database. A few quick annotations of our Java class and the instances can be persisted to the database with a couple of lines of code. A couple of lines of Java Persistence Query Language and we can retrieve some of those instances with not a line of JDBC code in sight. All very good stuff, and there’s a great deal of cleverness down the in the various available&#160; implementation layers to make this perform well. As we might expect there are a few wrinkles to hinder the unwary. This article lists a few mysterious error messages I encountered when using the OpenJPA implementation that caused much head-scratching when first seen and the annoyingly simple resolutions of these problems.</p>
<p>My development environment is Rational Application Developer 8.0.1, using a WebSphere 8 runtime and the OpenJPA implementation delivered with these products.</p>
<p>The RAD 8.0.1 tooling allows me to create the annotated Java classes corresponding to an existing database schema with a few mouse clicks. So developing the application took about an hour and then I hit a couple of problems, the first happened when I tried to run my app: I got a a complaint about a Connection Driver.</p>
<h1>ConnectionDriverName </h1>
<p>The error says&#160; </p>
<blockquote><p>A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property</p>
</blockquote>
<p>The stack trace doesn’t give much more of a hint, we can see it’s when JPA is trying to get a connection to the database, but why is it failing?</p>
<blockquote><p><font size="1">[13/07/11 07:33:03:453 BST] 00000020 BusinessExcep E&#160;&#160; CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method &quot;findRigByPK&quot; on bean &quot;BeanId(OuiServiceApp#OuiServiceWeb.war#RigEjb, null)&quot;. Exception data: &lt;openjpa-2.1.0-SNAPSHOT-r422266:990238 fatal user error&gt; org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.       <br />&#160;&#160;&#160; at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:76)        <br />&#160;&#160;&#160; at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:840)        <br />&#160;&#160;&#160; at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:598)        <br />&#160;&#160;&#160; at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1486)</font></p>
</blockquote>
<p><font size="1">After some fruitless searching for where I might specify a JDBC Driver I thought to check my persistence.xml file. In there was the line</font></p>
<blockquote><p>&lt;jta-data-source&gt;jdbc/myapp&lt;/jta-data-source&gt;</p>
</blockquote>
<p>and I had no corresponding JDBC datasource created in my WebSphere Application Server.</p>
<p>So, one quick trip to the WebSphere console, create the Data Source with the JNDI entry jdbc/myapp and everything works.</p>
<p>Or at least for a while, then we began to see a peculiar error concerning Enhancement.</p>
<h1>My Entities Lack Enhancement</h1>
<p>The symptom was seen when testing in the WebSphere 8 test environment in RAD 8.0.1, I make some changes, my revised application would be published to WebSphere and when I try to run I see an errror on the lines of:</p>
<blockquote><pre><font size="1"><code>The type &quot;class Rig&quot; has not been enhanced at </code><code>org.apache.openjpa.meta.ClassMetaData.resolveMeta</code></font></pre>
</blockquote>
<p>The meaning of this is reasonably clear: we know that OpenJPA performs some interesting processing, or Enhancement, on the annotated Entity classes. Different JPA implementations do different things as described in this <a href="http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html">Enhancement discussion</a> but OpenJPA does some “byte weaving”. And for my classes this hasn’t happened.</p>
<p>Now it seems that there are many way to control Enhancement explicitly, see <a href="http://openjpa.apache.org/enhancement-with-eclipse.html">This article</a> for some explanation. But I’d never needed to do this before, and I really didn’t want to introduce needless complexity.</p>
<p>So being a software person (you all know the jokes about physicists, engineers and software chaps in road accidents?) my immediate reaction was “it’s broken, lets see if it happens again!”. And what do you know it didn’t!</p>
<p>So my recipe for recovering from this problem: in RAD, Server View, expand your server, select the application, and restart it. This seems to provoke enhancement. No compile or server restart needed. This recipe seems to work reliably.</p>
<p>I then proceeded to expand my database, adding a few new simple tables and did some manual mapping of those tables. All seemed pretty easy until I hit another mysterious error message:</p>
<h1>Wrong result type column</h1>
<p>The error showed up when I was trying to navigate a relationshiop between by two new tables. The error seems quite clear:</p>
<blockquote>
<p><font size="1">Error 500: &lt;openjpa-2.1.0-SNAPSHOT-r422266:990238 fatal general error&gt; org.apache.openjpa.persistence.PersistenceException: [jcc][t4][1092][11643][3.57.82] Invalid data conversion: Wrong result column type for requested conversion. ERRORCODE=-4461, SQLSTATE=42815 FailedObject: com.ibm.helios.jpa.Transaction-21 [java.lang.String] </font></p>
<p><font size="1">Caused by: com.ibm.db2.jcc.am.io: [jcc][t4][1092][11643][3.57.82] Invalid data conversion: Wrong result column type for requested conversion. ERRORCODE=-4461, SQLSTATE=42815<br />
      <br />&#160;&#160;&#160; at com.ibm.db2.jcc.am.bd.a(bd.java:676)</p>
<p>&#160;&#160;&#160; at com.ibm.db2.jcc.am.bd.a(bd.java:60)</p>
<p>&#160;&#160;&#160; at com.ibm.db2.jcc.am.bd.a(bd.java:120)</p>
<p>&#160;&#160;&#160; at com.ibm.db2.jcc.am.gc.L(gc.java:1589)</p>
<p>&#160;&#160;&#160; at com.ibm.db2.jcc.am.zl.getBlob(zl.java:1218)</p>
<p>&#160;&#160;&#160; at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getBlob(WSJdbcResultSet.java:740)</font></p>
</blockquote>
<p>And so I spent quite some time comparing my Java class attributes and the columns in the corresponding database. The actual problem transpired to be that I had forgotten to add my new classes to the persistence.xml file.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/djna.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/djna.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/djna.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/djna.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/djna.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/djna.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/djna.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/djna.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/djna.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/djna.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/djna.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/djna.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/djna.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/djna.wordpress.com/141/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=141&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://djna.wordpress.com/2011/07/13/jpa-small-mysteries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9df488f3711680cb831c146a5aa437fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">djna</media:title>
		</media:content>
	</item>
		<item>
		<title>Rational Team Concert and WebSphere Integration Developer</title>
		<link>http://djna.wordpress.com/2011/01/10/rational-team-concert-and-websphere-integration-developer/</link>
		<comments>http://djna.wordpress.com/2011/01/10/rational-team-concert-and-websphere-integration-developer/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 21:10:12 +0000</pubDate>
		<dc:creator>djna</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://djna.wordpress.com/2011/01/10/rational-team-concert-and-websphere-integration-developer/</guid>
		<description><![CDATA[This is a short post documenting a little procedure I needed to follow in enabling WebSphere Integration Developer (WID) v7.0.0.3 to work with a Rational Team Concert v7 repository. This is another “it’s obvious in hindsight” story, but maybe it will save someone else some time. WID is a development environment for WebSphere Process Server [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=140&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is a short post documenting a little procedure I needed to follow in enabling WebSphere Integration Developer (WID) v7.0.0.3 to work with a Rational Team Concert v7 repository. This is another “it’s obvious in hindsight” story, but maybe it will save someone else some time.</p>
<p>WID is a development environment for WebSphere Process Server (WPS) and WebSphere Enterprise Service Bus (WESB). Using WIDS you can develop and test BPEL processes and WESB Mediations. Until recently I was using WID v6.x and keeping my source code in CVS. Joining a new project I upgraded to WID v7.0.0.3 and discovered that the project used Rational Team Concert (RTC). Now RTC has been around since about 2008 but this is the first time I’ve had chance to use it. So before getting to my installation gotcha a brief aside about RTC.</p>
<h2>Rational Team Concert</h2>
<p>Although my initial interest in RTC is just to store my source code and and work with a couple of team members on a small project a quick survey of the material at the <a href="http://www-01.ibm.com/software/rational/products/rtc/">Rational Team Concert site</a> shows the scope is potentially much greater. Chatting to a colleague in the Rational team the things that caught my attention were:</p>
<ul>
<li>Support for agile development methods, parallel development and continuous ingtegration </li>
<li>Highly configurable and extensible stream based approach – you can write client or server-side plugins, OSGi styles </li>
<li>Support for distributed development teams </li>
</ul>
<p>I particularly like the concept of suspending a set of changes to temporarily work on something else. So, note to self “need to read more about this”.</p>
<h2>Connecting WID and RTC</h2>
<p>My version of WID came with the v1.0 RTC plugin, the repository the team are using needs v2.0. Should be easy: Installation Manager get some updates, got a RTC v2.0 client. Installation complete. Relaunch WID, attempt to connect to repository … and fails! Same error, apparently I’m still a v1.0 client. Check in Help-&gt; About … and yes, I do indeed still have a v1.0 client.</p>
<p>Very odd. Llet’s uninstall the old version of the client and then install the new one. Still no joy, I’m still on v1.0! So I get suspcious, this seems like yet another case where launching Eclipse with –clean is needed. Eclipse has a plug-in cache which on occasion needs to flushed. This <a href="http://www.eclipsezone.com/eclipse/forums/t61566.html">article</a> gives rather more detail, about –clean and a few other wrinkles.</p>
<p>And still no joy. At this point I got help from my colleague Steve, who has been a Rational chap (in all senses) for many years. He’s got a nice <a href="http://www.ibm.com/developerworks/rational/library/10/synchronize-requirements-team-concert-requisitepro/index.html">article</a> here about some RTC integration. </p>
<h2>The Answer: the right notes in the right order</h2>
<p>The answer was indeed to use –clean, but it seems that the order of actions is crucial. The steps we took were:</p>
<ol>
<li>Launch the IBM Install Manager, select Modify and choose to uninstall the v1 Rational Team Concert Clent for Eclipse.</li>
<li>Exit the Install Manager. Launch WID using the –clean option.</li>
<li>Exit WID, launch the Install Manager again, select Modify, and install the v2 Rational Team Concert Client for Eclipse.</li>
<li>Relaunch WID.</li>
</ol>
<p>The crucial point being to perform the clean immediately after the v1 uninstall.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/djna.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/djna.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/djna.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/djna.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/djna.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/djna.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/djna.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/djna.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/djna.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/djna.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/djna.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/djna.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/djna.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/djna.wordpress.com/140/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=140&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://djna.wordpress.com/2011/01/10/rational-team-concert-and-websphere-integration-developer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9df488f3711680cb831c146a5aa437fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">djna</media:title>
		</media:content>
	</item>
		<item>
		<title>Flazr and redirection with a SMIL</title>
		<link>http://djna.wordpress.com/2010/08/02/flazr-and-redirection-with-a-smil/</link>
		<comments>http://djna.wordpress.com/2010/08/02/flazr-and-redirection-with-a-smil/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 17:35:15 +0000</pubDate>
		<dc:creator>djna</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://djna.wordpress.com/2010/08/02/flazr-and-redirection-with-a-smil/</guid>
		<description><![CDATA[Introduction Previously I described my use of Flazr, and open-source streaming client, to test my media server. And I mentioned that I wanted to test the server’s capabilities to achieve better scalability by distributing requests across satellite servers. When media server receives a request for content it chooses a satellite and then emits a redirection [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=137&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>Previously I described my use of Flazr, and open-source streaming client, to test my media server. And I mentioned that I wanted to test the server’s capabilities to achieve better scalability by distributing requests across satellite servers. When media server receives a request for content it chooses a satellite and then emits a redirection response in this style:</p>
<blockquote><p>&lt;smil&gt;     <br />&#160;&#160;&#160; &lt;head&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;meta base=&quot;rtmp://hostX/app/&quot; /&gt;      <br />&#160;&#160;&#160; &lt;/head&gt;      <br />&#160;&#160;&#160; &lt;body&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;video src=&quot;djna01/someContent.mp4&quot; /&gt;      <br />&#160;&#160;&#160; &lt;/body&gt;      <br />&lt;/smil&gt;</p>
</blockquote>
<p>This is SMIL format, albeit a very small subset of what SMIL can be used for – using full SMIL capabilities you can in effect build a complete animated presentation. That’s rather like having a PowerPoint for the Web. </p>
<p>Anyway my client then needs to understand this response and open up the stream on</p>
<blockquote><p>rtmp://hostX/app/djna01/someContent.mp4</p>
</blockquote>
<p>So in this article I’ll explain how I used JAX/B to parse the SMIL XML.</p>
<h1>Why JAX/B</h1>
<p>When faced with something as simple as that SMIL example it’s very tempting to use a few regular expressions (regexp) to extract the data we need. We could probably get something working quite quickly. However in the general case XML complexity defeats regexp capability (see discussions such as <a href="http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags">this</a>) and most of the time I need to deal with non-trivial XML. So as I haven’t previously explored using the JAX/B APIs for parsing XML, now’s the chance!</p>
<p>It transpires that, using the Rational Application Developer tooling,&#160; it actually took about 20 minutes to write the JAX/B-based code. I doubt whether I could have got the regexp right as quickly.</p>
<h2>Using JAX/B</h2>
<p>My starting point was a sample XML file as shown above. I created a simple Java project and then took the following steps:</p>
<ol>
<li>Generated an XSD</li>
<li>From the XSD generated annotated Java classes</li>
<li>Wrote the few required lines of code to call the JAX/B API.</li>
</ol>
<h3>Generating the XSD</h3>
<p>I have the sample XML file in my project, I </p>
<blockquote><p><strong>rightClick-&gt;Generate-&gt;Xml Schema</strong></p>
</blockquote>
<p>and selected the defaults offered. The result was a schema</p>
<blockquote><p>&#160; &lt;xsd:element name=&quot;head&quot;&gt;     <br />&#160;&#160;&#160; &lt;xsd:complexType&gt;      <br />&#160;&#160;&#160;&#160;&#160; &lt;xsd:sequence&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;xsd:element ref=&quot;meta&quot;/&gt;      <br />&#160;&#160;&#160;&#160;&#160; &lt;/xsd:sequence&gt;      <br />&#160;&#160;&#160; &lt;/xsd:complexType&gt;      <br />&#160; &lt;/xsd:element&gt;      <br />&#160; &lt;xsd:element name=&quot;body&quot;&gt;      <br />&#160;&#160;&#160; &lt;xsd:complexType&gt;      <br />&#160;&#160;&#160;&#160;&#160; &lt;xsd:sequence&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;xsd:element ref=&quot;video&quot;/&gt;      <br />&#160;&#160;&#160;&#160;&#160; &lt;/xsd:sequence&gt;      <br />&#160;&#160;&#160; &lt;/xsd:complexType&gt;      <br />&#160; &lt;/xsd:element&gt;      <br />&#160; &lt;xsd:element name=&quot;meta&quot;&gt;      <br />&#160;&#160;&#160; &lt;xsd:complexType&gt;      <br />&#160;&#160;&#160;&#160;&#160; &lt;xsd:attribute name=&quot;base&quot; type=&quot;xsd:string&quot;/&gt;      <br />&#160;&#160;&#160; &lt;/xsd:complexType&gt;      <br />&#160; &lt;/xsd:element&gt;      <br />&#160; &lt;xsd:element name=&quot;video&quot;&gt;      <br />&#160;&#160;&#160; &lt;xsd:complexType&gt;      <br />&#160;&#160;&#160;&#160;&#160; &lt;xsd:attribute name=&quot;src&quot; type=&quot;xsd:string&quot;/&gt;      <br />&#160;&#160;&#160; &lt;/xsd:complexType&gt;      <br />&#160; &lt;/xsd:element&gt;      <br />&#160; &lt;xsd:element name=&quot;smil&quot;&gt;      <br />&#160;&#160;&#160; &lt;xsd:complexType&gt;      <br />&#160;&#160;&#160;&#160;&#160; &lt;xsd:sequence&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;xsd:element ref=&quot;head&quot;/&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;xsd:element ref=&quot;body&quot;/&gt;      <br />&#160;&#160;&#160;&#160;&#160; &lt;/xsd:sequence&gt;      <br />&#160;&#160;&#160; &lt;/xsd:complexType&gt;      <br />&#160; &lt;/xsd:element&gt;      <br />&lt;/xsd:schema&gt;</p>
</blockquote>
<p>There are various options I could have selected to get finer control over the XSD. Alternatively I could have written the XSD by hand, or in more complex cases the service provider would have already have published the XSD.</p>
<p>&#160;</p>
<h3>Generating Java Classes</h3>
<p>I then need a set of Java Classes corresponding to the XSD, these classes using JAX/B annotations to control mapping between Java and XML. Again, I could write these by hand, but a simple set of cannotated classes can be generated very easily, select the XSD and</p>
<blockquote><p><strong>rightClick-&gt;Generate-&gt;Java</strong></p>
</blockquote>
<p>This brings up the XSD to Java wizard. On the first page select</p>
<blockquote><p><strong>JAX/B Schema to Java Bean</strong></p>
</blockquote>
<p>and select Next, then on the next page specify a package name such as&#160; <strong>org.djna.smil.data </strong>and click Finish. The result is a suitable set of classes</p>
<p><a href="http://djna.files.wordpress.com/2010/08/image.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="143" alt="image" src="http://djna.files.wordpress.com/2010/08/image_thumb.png?w=186&#038;h=143" width="186" border="0" /></a>&#160;</p>
<p>Here’s part of the generated Head.java class:</p>
<blockquote><p><strong>@XmlAccessorType(XmlAccessType.FIELD)       <br />@XmlType(name = &quot;&quot;, propOrder = {        <br />&#160;&#160;&#160; &quot;meta&quot;        <br />})        <br />@XmlRootElement(name = &quot;head&quot;)        <br />public class Head { </strong></p>
<p><strong>&#160;&#160;&#160; @XmlElement(required = true)       <br />&#160;&#160;&#160; protected Meta meta;</strong></p>
</blockquote>
<p>I won’t here elaborate on the meanings of the JAX/B annotations, but it’s pretty clear that we’ve got a class which maps to this portion of the SMIL</p>
<blockquote><p>&lt;head&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;meta base=&quot;rtmp://hostX/app/&quot; /&gt;      <br />&lt;/head&gt;</p>
</blockquote>
<p>and the other classes are annotated similarly. So after a few mouse clicks we now have a set of classes which correspond to the SMIL file. All that remains is the code to use those classes.</p>
<h3>The JAX/B invocation code</h3>
<p>In my case I have the URL of the redirection service, which returns the SMIL document to be parsed. So I can write this code</p>
<blockquote><p><font size="1">public Smil exampleGet(String url)        <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; throws JAXBException, MalformedURLException{        <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; JAXBContext jc         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; = JAXBContext.newInstance(&quot;org.djna.smil.data&quot;);        <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Unmarshaller u = jc.createUnmarshaller(); </font></p>
<p><font size="1">&#160;&#160;&#160;&#160;&#160;&#160;&#160; Smil theSmil = (Smil)u.unmarshal( new URL(url) ); </font></p>
<p><font size="1">&#160;&#160;&#160;&#160;&#160;&#160;&#160; return theSmil;       <br />&#160;&#160;&#160; }</font></p>
</blockquote>
<p>So I have initialsed the JAXBContent with the name of the package where my Beans were generated.</p>
<p> <strong>&#160;&#160;&#160; JAXBContext.newInstance(&quot;org.djna.smil.data&quot;);</strong>  <br /> 
<p>and then use that context to create an Unmarshaller. The unmarshaller will accept a URL parameter and parses the response.</p>
<p>And that’s it; four lines of code and the XML is parsed.</p>
<h1></h1>
<h1>Conclusion</h1>
<p>I have to admit that when I decided to use JAX/B rather than a simple regexp I thought I might have been making things unduly complex. I was surprised when all the above “just worked”. In fact when my application ran I spent a few minutes trying to find out where it had broken before realising that in fact it had worked seamlessly.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/djna.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/djna.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/djna.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/djna.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/djna.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/djna.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/djna.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/djna.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/djna.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/djna.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/djna.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/djna.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/djna.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/djna.wordpress.com/137/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=137&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://djna.wordpress.com/2010/08/02/flazr-and-redirection-with-a-smil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9df488f3711680cb831c146a5aa437fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">djna</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/08/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Flazr &#8211; Testing a Media Server</title>
		<link>http://djna.wordpress.com/2010/07/30/flazr-testing-a-media-server/</link>
		<comments>http://djna.wordpress.com/2010/07/30/flazr-testing-a-media-server/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 11:29:21 +0000</pubDate>
		<dc:creator>djna</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://djna.wordpress.com/2010/07/30/flazr-testing-a-media-server/</guid>
		<description><![CDATA[Recently I’ve been looking at setting up a POC environment for a solution involving streaming media. I’ve got some streaming media servers that delivers content over RTMP and some degree of infrastructure cleverness that claims to give improved performance. So how do I test that? Well, I need the capability of submitting requests for content [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=129&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I’ve been looking at setting up a POC environment for a solution involving streaming media. I’ve got some streaming media servers that delivers content over <a href="http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol">RTMP</a> and some degree of infrastructure cleverness that claims to give improved performance. So how do I test that?</p>
<p>Well, I need the capability of submitting requests for content and evaluating the quality of service as I tweak the infrastructure. Features along these lines:</p>
<ul>
<li>Simulating particular access patterns, for example a large number of users all requesting some popular content.</li>
<li>Defining extended test runs, some parts of the infrastructure take a while to “warm up”, and performance measures are best taken over extended periods of time.</li>
<li>Some way of determining KPIs such as the time take to start streaming or the amount of “stutter” experienced.</li>
</ul>
<p>Also I want efficient use of test client resources. I may be simulating tens and hundreds of users, I just need to retrieve the stream of content, I don’t actually need to have it rendered, no need for video graphics.</p>
<p>Now there are quite few clients able to do these kinds of things. I chose <a href="http://flazr.com/">Flazr</a>, which is an open-source Java application. In this article I am going to </p>
<ol>
<li>Describe some simple uses of Flazr.</li>
<li>Explain a problem I hit and give the code for the fix I developed.</li>
<li>Show an extension I developed, which enables Flazr to be aware of some load-balancing capabilities in my infrastructure. This exploits a very small subset of <a href="http://en.wikipedia.org/wiki/Synchronized_Multimedia_Integration_Language">SMIL</a>.</li>
</ol>
<h1>Testing with Flazr</h1>
<p>Initially I imported the Flazr 0.7 source into&#160; my Rational Software Developer, Eclipse-based development environment.</p>
<p><a href="http://djna.files.wordpress.com/2010/07/image2.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="163" alt="image" src="http://djna.files.wordpress.com/2010/07/image_thumb2.png?w=166&#038;h=163" width="166" border="0" /></a> </p>
<p>And added the libraries delivered with Flazr to my classpath.</p>
<p>I can then run the Rtmp client</p>
<p><a href="http://djna.files.wordpress.com/2010/07/image3.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="73" alt="image" src="http://djna.files.wordpress.com/2010/07/image_thumb3.png?w=165&#038;h=73" width="165" border="0" /></a> </p>
<h2>Stream Content, Get Metrics</h2>
<p>The simplest case is just to specify the URL for the stream to be played</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; rtmp://myhost/myapp/mycontent</p>
<p>I won’t here describe my Streaming Media Server, there are many possible products you can use for that purpose.</p>
<p>This streams the content and display some useful metrics</p>
<blockquote><p><strong>first media packet for channel: [0 AUDIO c6 #1 t0 (0) s0], after 219ms</strong></p>
</blockquote>
<p>and </p>
<blockquote><p><strong>finished in 26 seconds, media duration: 11 seconds</strong></p>
</blockquote>
</p>
<p>From this&#160; have&#160; a measure of the responsiveness of my server and also we note that although the media duration was only 11s, it took 26s to stream it – lots of stutter there. And in fact if I stream this content through a conventional viewer there is indeed quite a bit of stutter.</p>
<h2>More Demanding Workloads</h2>
<p>I can ramp up the workload by asking Flazr to spawn a number of simulated clients each retrieving the stream</p>
<blockquote><p>-load 5 rtmp://myhost/myapp/mycontent</p>
</blockquote>
<p>these 5 are executed&#160; in parallel using the <a href="http://download.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Executor.html">JSE 1.5 Executor</a> capability.</p>
<p>We can adjust the degree of parallelism by controlling the thread pool size.</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; -load 5 –threads 2 rtmp://myhost/myapp/mycontent</p>
<p>We then get 5 downloads competed, but done just two at a time,in the two parallel threads. And in the limiting case we can have just one thread and hence get sequential retrieval.</p>
<p>If you try this with Flazr 0.7 you will find that in fact the parallelism is not so controlled and Flazr itself does not shutdown when the last retrieval completes. I’ll explain how I fixed that in a moment, but first I want to mention one other invocation style.</p>
<h2>Flazr Scripts</h2>
<p>The “-load” option described above allows you to stream in parallel several copies of the same content. If instead you need to emulate a more mixed workload you can instead put a list of URLs in a file and then use a command such as</p>
<p>&#160;&#160;&#160;&#160; -file myscript</p>
<p>to initiate these streams. You can again control the number of parallel streams by using the “-threads” option</p>
<p>&#160;&#160;&#160; -threads 3 –file myscript</p>
<h2>The Halting Problem</h2>
<p>As mentioned earlier, when streaming in parallel, Flazr does not exit when the last stream completes. This is very inconvenient if you want to run Flazr as part of some larger test.</p>
<p>The reason for this behaviour is that Flazr is using an Executor and this has a worker thread which waits for new workitems to appear. It is necessary to issue a shutdown request in order for Falzr to exit.</p>
<p>I modified RtmpClient.java in package com.flazr.rtmp.clent. This is the modified code, which I’lll explain in the next couple of sections.</p>
<p>&#160;&#160;&#160;&#160; if(options.getClientOptionsList() != null) {   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; logger.info(&quot;file driven load testing mode, lines: {}&quot;,     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; options.getClientOptionsList().size());    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int line = 0;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for(final ClientOptions tempOptions :     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; options.getClientOptionsList()) {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; line++;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; logger.info(&quot;running line #{}&quot;, line);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for(int i = 0; i &lt; tempOptions.getLoad(); i++) {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; final int index = i + 1;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; final int tempLine = line;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; executor.execute(new Runnable() {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @Override public void run() {&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; logger.info(&quot;line #{}, spawned connection #{}&quot;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; , tempLine, index);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; connect(tempOptions);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; logger.info(&quot;line #{}, finished connection #{}&quot;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; , tempLine, index);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // by default the executor hangs around, ask it to go away    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; logger.info(&quot;queueing shutdown request&quot;);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; executor.execute(new Runnable() {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @Override public void run() {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; logger.info(&quot;Turning out the lights &#8230; &quot;);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; executor.shutdown();    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>The most important change is to arrange for a shutdown to be requested.</p>
<h3>Queue a Shutdown</h3>
<p>The Flazr code creates an Executor request for each line in the script file. These requests are processed by the Executor&#160; in the order in which they are created. Hence if I add one last request to the list, a request to shutdown, we know that this will be the last request to be actioned.</p>
<p>There is one corner case to consider, what happens if that shutdown request is issued while other threads are still active. Fortunately this handled by the Executor framework, the executor will not allow any subsequent requests for new work to be started, but will wait for current requests to complete.</p>
<p>So we get the desired behaviour: the Flazr script completes and Flazr then stops.</p>
<h3>Which Executor?</h3>
<p>However, there is a further wrinkle. The original code had:</p>
<p>&#160;&#160; executor.execute(new Runnable() {   <br />&#160;&#160;&#160;&#160;&#160; @Override public void run() {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; final ClientBootstrap bootstrap     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; = getBootstrap(executor, tempOptions);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; bootstrap.connect(    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new InetSocketAddress(    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tempOptions.getHost(),     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tempOptions.getPort()    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ));    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160; });</p>
<p>Note that the executor is passed down to the ClientBootStrap. Under the covers the IO code will add additional executors, and this happens after the initiation of this job. This introduces a race condition with he shutdown request, we can hit the shutdown before the parallel IO execution is requested.</p>
<p>Hence I changed this code to use the</p>
<p>&#160;&#160;&#160;&#160;&#160; connect(tempOptions);</p>
<p>method, which FLazr uses elsewhere. This creates a dedicated, separate executor.</p>
<h2>SMILing</h2>
<p>My infrastructure attempts to optimise performance by using a load distribution capability. The user requests</p>
<p>&#160;&#160;&#160;&#160; <a href="http://somehost/someapp/somecontent">http://somehost/someapp/somecontent</a></p>
<p>and receives an XML file, in SMIL format, which contains the URL that this client should use to stream the content. Hence different clients will get the same content from different places.</p>
<p>I added code to interpret these redirection responses, I’ll describe how in my next posting.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/djna.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/djna.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/djna.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/djna.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/djna.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/djna.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/djna.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/djna.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/djna.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/djna.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/djna.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/djna.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/djna.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/djna.wordpress.com/129/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=129&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://djna.wordpress.com/2010/07/30/flazr-testing-a-media-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9df488f3711680cb831c146a5aa437fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">djna</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/07/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/07/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>iWidgets and Business Space</title>
		<link>http://djna.wordpress.com/2010/06/17/iwidgets-and-business-space/</link>
		<comments>http://djna.wordpress.com/2010/06/17/iwidgets-and-business-space/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 07:16:54 +0000</pubDate>
		<dc:creator>djna</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://djna.wordpress.com/2010/06/17/iwidgets-and-business-space/</guid>
		<description><![CDATA[IBM Business Process Management products, and increasingly other IBM products, present user Interfaces in an extensible Web 2.0 Framework known as Business Space. The UI allows users to create their own views from visual components (widgets) supplied for each product. So for example, in WebSphere Process Server, there are widgets for presenting lists of tasks [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=121&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>IBM Business Process Management products, and increasingly other IBM products, present user Interfaces in an extensible Web 2.0 Framework known as Business Space. The UI allows users to create their own views from visual components (widgets) supplied for each product. So for example, in WebSphere Process Server, there are widgets for presenting lists of tasks and working with the tasks. The widgets can be “wired” to each other so that actions in one widget can pass events to another.</p>
<p>The widgets are developed in JavaScript using the dojo framework, and conform to the <a href="http://www-10.lotus.com/ldd/mashupswiki.nsf/dx/iwidget-spec-v1.0.pdf/$file/iwidget-spec-v1.0.pdf">iWidget specification</a>, which predefines certain life-cycle events that the widget must support. You can develop you own widgets to be be used in conjunction with out of the box widgets.</p>
<p>I’ve been working to create a custom widget to be used in conjunction with the ECM Widgets delivered with IBM Filenet 4.5.1. This is using a version of Business Space consistent with that found in WID/WPS 6.2. This article concerns some wrinkles I came across. You should note that creating custom widgets in later versions of Business Space is rather easier than in these versions: in WID v7 there is tooling for creating iWidgets and a much simpler deployment model.</p>
<h2>Widgets and Endpoints</h2>
<p>In order to make custom widgets available for use you create an XML files containing catalogue entries. Placing these XML files in </p>
<blockquote><p>&lt;profile&gt;/BusinessSpace/registryData</p>
</blockquote>
<p>Will cause BusinessSpace to add corresponding entries to the iWidget pallette in the UI. It seems that different Business Space environments have subtly different requirements for the contents of this file. In my case, I omitted one stanza, and when deploying to the FileNet environment my widgets were not being recognised. It seems that the following file format works across my WPS and FileNet test environments.</p>
<h3>Example Registry File</h3>
<p><font size="1">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;      <br />&lt;!&#8211; START NON-TRANSLATABLE &#8211;&gt;       <br />&lt;tns:BusinessSpaceRegistry xmlns:tns=&quot;</font><a href="http://com.ibm.bspace/BusinessSpaceRegistry&quot;"><font size="1">http://com.ibm.bspace/BusinessSpaceRegistry&quot;</font></a><font size="1"> xmlns:xsi=&quot;</font><a href="http://www.w3.org/2001/XMLSchema-instance&quot;"><font size="1">http://www.w3.org/2001/XMLSchema-instance&quot;</font></a><font size="1"> xsi:schemaLocation=&quot;</font><a href="http://com.ibm.bspace/BusinessSpaceRegistry"><font size="1">http://com.ibm.bspace/BusinessSpaceRegistry</font></a><font size="1"> BusinessSpaceRegistry.xsd &quot;&gt;      <br />&lt;!&#8211; END NON-TRANSLATABLE &#8211;&gt;</font> </p>
<p>&#160; <font size="1">&lt;tns:Endpoint&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160; &lt;tns:id&gt;com.xyz.bspace.rootId&lt;/tns:id&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160; &lt;tns:type&gt;com.xyz.bspace.rootId&lt;/tns:type&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160; &lt;tns:version&gt;1.0.0.0&lt;/tns:version&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160; &lt;tns:url&gt;XyzRoleWidget&lt;/tns:url&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;tns:description&gt;&lt;/tns:description&gt;       <br />&#160; &lt;/tns:Endpoint&gt; </font></p>
<p><font size="1">&#160; &lt;!&#8211; START NON-TRANSLATABLE &#8211;&gt;      <br />&#160; &lt;tns:Category&gt;       <br />&#160;&#160;&#160; &lt;tns:id&gt;{com.xyz.bspace}Xyz&lt;/tns:id&gt;       <br />&#160;&#160;&#160; &lt;tns:name&gt;Xyz Custom&lt;/tns:name&gt;       <br />&#160;&#160;&#160; &lt;tns:description&gt;Custom Widgets for Xyz&lt;/tns:description&gt;       <br />&#160;&#160;&#160; &lt;tns:tooltip&gt;Xyz&lt;/tns:tooltip&gt;       <br />&#160;&#160;&#160; &lt;tns:localeInfo&gt;       <br />&#160;&#160;&#160; &lt;!&#8211; END NON-TRANSLATABLE &#8211;&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:locale&gt;en_US&lt;/tns:locale&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:name&gt;Xyz Custom&lt;/tns:name&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:description&gt;Custom Widgets for Xyz&lt;/tns:description&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:tooltip&gt;Xyz&lt;/tns:tooltip&gt;       <br />&#160;&#160;&#160; &lt;!&#8211; START NON-TRANSLATABLE &#8211;&gt;       <br />&#160;&#160;&#160; &lt;/tns:localeInfo&gt;       <br />&#160;&#160;&#160; &lt;tns:order&gt;5&lt;/tns:order&gt;       <br />&#160; &lt;/tns:Category&gt;       <br />&#160; &lt;!&#8211; END NON-TRANSLATABLE &#8211;&gt; </font></p>
<p><font size="1">&#160; &lt;!&#8211; START NON-TRANSLATABLE &#8211;&gt;      <br />&#160; &lt;tns:Widget&gt;       <br />&#160;&#160;&#160; &lt;tns:id&gt;{com.xyz.bspace}Role&lt;/tns:id&gt;       <br />&#160;&#160;&#160; &lt;tns:version&gt;1.0.0.0&lt;/tns:version&gt;       <br />&#160;&#160;&#160; &lt;tns:name&gt;Role Selection&lt;/tns:name&gt;       <br />&#160;&#160;&#160; &lt;tns:type&gt;{com.ibm.bspace}iWidget&lt;/tns:type&gt;       <br />&#160;&#160;&#160; &lt;tns:description&gt;Role Selection and Event Emission&lt;/tns:description&gt;       <br />&#160;&#160;&#160; &lt;tns:tooltip&gt;Role Select&lt;/tns:tooltip&gt;       <br />&#160;&#160;&#160; &lt;tns:categoryId&gt;{com.xyz.bspace}Xyz&lt;/tns:categoryId&gt;       <br />&#160;&#160;&#160; &lt;tns:widgetEndpointId&gt;com.xyz.bspace.rootId&lt;/tns:widgetEndpointId&gt;       <br />&#160;&#160;&#160; &lt;tns:url&gt;/iwidget/role.xml&lt;/tns:url&gt;       <br />&#160;&#160;&#160; &lt;tns:helpUrl&gt;&lt;/tns:helpUrl&gt;       <br />&#160;&#160;&#160; &lt;tns:iconUrl&gt;images/generic_iWidget.gif&lt;/tns:iconUrl&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160; &lt;tns:owner&gt;IBM&lt;/tns:owner&gt;       <br />&#160;&#160;&#160; &lt;tns:email&gt;TBD&lt;/tns:email&gt;       <br />&#160;&#160;&#160; &lt;tns:serviceEndpointRef required=&quot;true&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:name&gt;serviceUrlRoot&lt;/tns:name&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:refId&gt;com.xyz.bspace.rootId&lt;/tns:refId&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:refVersion&gt;1.0.0.0&lt;/tns:refVersion&gt;       <br />&#160;&#160;&#160; &lt;/tns:serviceEndpointRef&gt;       <br />&#160;&#160;&#160; &lt;tns:localeInfo&gt;       <br />&#160;&#160;&#160; &lt;!&#8211; END NON-TRANSLATABLE &#8211;&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:locale&gt;en_US&lt;/tns:locale&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:name&gt;Role Selection&lt;/tns:name&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:description&gt;Role Selection Widget&lt;/tns:description&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;tns:tooltip&gt;Role Select&lt;/tns:tooltip&gt;       <br />&#160;&#160;&#160; &lt;!&#8211; START NON-TRANSLATABLE &#8211;&gt;       <br />&#160;&#160;&#160; &lt;/tns:localeInfo&gt;       <br />&#160; &lt;/tns:Widget&gt;       <br />&#160; &lt;!&#8211; END NON-TRANSLATABLE &#8211;&gt; </font></p>
<p><font size="1">&lt;!&#8211; START NON-TRANSLATABLE &#8211;&gt;      <br />&lt;/tns:BusinessSpaceRegistry&gt;       <br />&lt;!&#8211; END NON-TRANSLATABLE &#8211;&gt;</font> </p>
<p>The key entry here is the Endpoint entry. It is possible to place this in a separate endpoints file – many examples have xxxWidgets.xml and xxxEndpoints.xml – but it seems also to be possible to combine the entries in a single file. We discovered that if the endpoint entry is missing, in a FileNet environment the Pallette entry is not displayed. Curiously, in my WPS environment, the endpoint seems to be optional.</p>
<h2>ECM Events</h2>
<p>Many online examples of event emission use code such as this:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font size="1">var payload = {&quot;name&quot;: data};      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.iContext.iEvents.fireEvent(&quot;Receive Role&quot;, null, payload);</font></p>
<p>When firing event across to an ECM Widget we discovered that it was necessary to specify that second parameter, which is the type of the payload.</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font size="1">this.iContext.iEvents.fireEvent(&quot;Receive Role&quot;, “JSON”, payload);</font></p>
<h2>ECM inBasket</h2>
<p>That got the event sent, and we wired the ECM inBasket to receive the event. Our intention was to allow the user pick a role and have that transmitted to the inBasket, but there was one more piece ta having that take effect: you also need to correctly configure the inBasket. In the configuration panel of the inBasket you can select a chosen role, if you do that then events are ignored. So instead you must select no role (an empty entry at the end of the list) in the inBasket configuration. With that done the events are delivered to the inBasket and we get the desired effect.</p>
<h2>It’s all in the … Timing</h2>
<p>Having got the payload nicely transferred there just one more problem. What happens when the page is first displayed? If the user has previously selected a role we want to make that the default. So I have used a cookie to record the current selection and so in my onLoad method I retrieve it:</p>
<p>&#160;&#160;&#160;&#160; this.currentRole = dojo.cookie(&quot;XyzItems.currentRole&quot;);</p>
<p>Clearly, we want that current value to be transmitted to the inBasket so I also explicitly fire an event across:</p>
<p>&#160;&#160;&#160;&#160; var payload = {&quot;name&quot;: &quot;&quot;+ role};   <br />&#160;&#160;&#160;&#160; this.iContext.iEvents.fireEvent(&quot;Receive Role&quot;, &quot;JSON&quot;, payload);</p>
<p>And in my test environment this works just fine. To my annoyance when deployed to a UAT environment the widget does not even load! That leads to two important learning points.</p>
<h3>Make sure Exceptions are Handled</h3>
<p>After some head-scratching I found that fireEvent() was throwing an exception and as my onLoad() method had no exception handling the exception was causing onLoad() to fail. Hence my widget didn’t complete its initialisation.</p>
<p>So Lesson Number One (obvious, so why did I forget to do it?) Don’t forget to have suitable Exception Handling.</p>
<p>But that’s not the end: why did we get an exception at all? In the test environment it was fine, why not in UAT?</p>
<h3>Don’t do too much in onLoad</h3>
<p>The exception was complaining that the receiving widget didn’t have an appropriate event handler. My inBasket doesn’t have an event handler? But there it is in the code! In my test environment it obviously does, it works!</p>
<p>Here we see a clasic little race-condition. Until the inBasket is properly initialised the implementation class may not be available. In UAT clearly I had a rather different set of performance characteristics. My code, running in the onLoad() method of my wiget was assuming that all event recipients were ready to receive events. Manifetsly, that’s not guaranteed while onLoad() is executing. </p>
<p>So what to do? Well this problem is nicely solved in the dojo/iWidget environemnt: It is possible to install a second callback to be executed when the whole page is initialised. You add this code in your onLoad() method:</p>
<p>&#160;&#160;&#160;&#160; dojo.addOnLoad(this, &quot;_onReallyLoaded&quot;);</p>
<p>and then fire the event from the _onReallyLoaded() mthod.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/djna.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/djna.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/djna.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/djna.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/djna.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/djna.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/djna.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/djna.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/djna.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/djna.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/djna.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/djna.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/djna.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/djna.wordpress.com/121/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=121&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://djna.wordpress.com/2010/06/17/iwidgets-and-business-space/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9df488f3711680cb831c146a5aa437fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">djna</media:title>
		</media:content>
	</item>
		<item>
		<title>How Many Ways &#8230; can a Dojo Grid go wrong?</title>
		<link>http://djna.wordpress.com/2010/04/19/how-many-ways-can-a-dojo-grid-go-wrong/</link>
		<comments>http://djna.wordpress.com/2010/04/19/how-many-ways-can-a-dojo-grid-go-wrong/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 13:12:49 +0000</pubDate>
		<dc:creator>djna</dc:creator>
				<category><![CDATA[Dojo]]></category>

		<guid isPermaLink="false">http://djna.wordpress.com/2010/04/19/how-many-ways-can-a-dojo-grid-go-wrong/</guid>
		<description><![CDATA[Dojo is a powerful Javascript framework, useful for building browser-based Rich User Interface Applications (RIA). I had some annoying times recently getting a simple Dojo widget to display correctly, so this article captures a few lessons learned in taming that elusive widget.&#160; In passing I’ll mention that this blog does have a few allusive elements, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=119&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Dojo is a powerful Javascript framework, useful for building browser-based Rich User Interface Applications (RIA). I had some annoying times recently getting a simple Dojo widget to display correctly, so this article captures a few lessons learned in taming that elusive widget.&#160; </p>
<p>In passing I’ll mention that this blog does have a few allusive elements, referencing fine British Acoustic music. The blog title itself refers to the Summer Before the War, a lovely Huw Williams song, and this posting refers to the chorus of&#160; <a href="http://mikesilver.viviti.com">Mike Silver’s</a> beautifiul How Many Rivers.</p>
<h1>Project contents</h1>
<p>The Javascript I’m dealing with is organised in my Web project as shown here. Dojo itself is in the folder <strong>dojoroot</strong> and my code is in <strong>djna/main.js. </strong>I’m also using one data file in the folder <strong>djna/datastores.</strong></p>
<p><a href="http://djna.files.wordpress.com/2010/04/image.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="222" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb.png?w=226&#038;h=222" width="226" border="0" /></a> </p>
<p>Additionally I have a single HTML file, in my WebContent, which references that javascript. There are three sub-sections, described next.</p>
<p>Note: This article builds from my flawed-original code to the finally working version. The first version you see of a code snippet might need a little enhancement …</p>
<h2>Loading Dojo</h2>
<p>The first sections sets up a Dojo theme and loads Dojo itself:</p>
<p>&#160; &lt;html&gt;   <br />&#160; &lt;head&gt;     <br />&#160;&#160;&#160; &lt;title&gt;A Device UI&lt;/title&gt;&#160;&#160; <br />&#160;&#160;&#160; &lt;style type=&quot;text/css&quot;&gt;    <br />&#160;&#160;&#160;&#160;&#160; @import &quot;../dojoroot/dijit/themes/tundra/tundra.css&quot;;     <br />&#160;&#160;&#160; &lt;/style&gt;&#160;&#160;&#160; <br />&#160;&#160;&#160; &lt;script type=&quot;text/javascript&quot; src=&quot;dojoroot/dojo/dojo.js&quot;&gt;    <br />&#160;&#160;&#160; &lt;/script&gt;</p>
<h2>Initialising the application</h2>
<p>Then this code loads the dojo module with my application code in it:</p>
<p>&#160;&#160; &lt;script type=&quot;text/javascript&quot; &gt;&#160; <br />&#160;&#160;&#160;&#160;&#160; dojo.registerModulePath(&quot;djna&quot;, &quot;../../djna&quot;);    <br />&#160;&#160;&#160;&#160;&#160; dojo.require(&quot;djna.main&quot;);    <br />&#160;&#160;&#160;&#160;&#160; dojo.addOnLoad(function(){    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; djna.main.startup();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160; });</p>
<h2>Splash screen</h2>
<p>As there is a little initialsation to do on applicaiton startup I display a reassuring message, in real-life this might be a nice splash screen.</p>
<p> &lt;/head&gt;   <br />&#160;&#160; &lt;body class=&quot;tundra&quot; id=&quot;mainbody&quot;&gt;     <br />&#160;&#160;&#160;&#160;&#160; &lt;div id=&quot;loading&quot;&gt;&lt;P&gt;SPLASH&lt;/P&gt;&lt;/div&gt;&#160;&#160; <br />&#160;&#160; &lt;/body&gt;    <br />&#160; &lt;/html&gt;</p>
<h1>Javascript Application</h1>
<p>My intent is to display a simple grid with some data from the javascript in my datastore. I’m using the Dojo module pattern, where an anonymous function defines the public methods of a “Class”. So my Javascript is also in three parts: the “Class” definition, a main method which sets up the overall display, and utility method that creates the grid.</p>
<h2>Class definition</h2>
<p>My module outline looks like this, begining with the declaration of the module, which matches the name djna/main.js location of the Javascript file and which was referenced by the&#160; </p>
<p>&#160;&#160;&#160;&#160; <strong>dojo.require(&quot;djna.main&quot;);</strong></p>
<p>statement in the HTML script.</p>
<p>dojo.provide(&quot;djna.main&quot;); </p>
<p>dojo.require(&quot;dojo.parser&quot;);   <br />dojo.require(&quot;dojo.data.ItemFileReadStore&quot;);    <br />dojo.require(&quot;dojox.grid.DataGrid&quot;);    <br />dojo.require(&quot;dijit.layout.BorderContainer&quot;); </p>
<p>(function(){</p>
<p>&#160;&#160;&#160;&#160; // main goes here</p>
<p>&#160;&#160;&#160;&#160; // grid creationg goes here</p>
<p>})();</p>
<p>Modules referenced by the two metho implementation are made available by the <strong>dojo.require</strong> statements.</p>
<h2>Main entry point</h2>
<p>The main function has the responsibility to create a BorderContainer and request the creation of the grid. </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; djna.main.startup= function(args) {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var grid = djna.main.makeGrid();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var appContainer = new dijit.layout.BorderContainer({    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; style: &quot;width: 230px; height: 320px;&#160; border:solid 1px&quot;,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; design: &quot;headline&quot;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dojo._destroyElement(dojo.byId(&quot;loading&quot;));&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dojo.place(appContainer.domNode, dojo.body(), &quot;first&quot;);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; appContainer.addChild(grid);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; appContainer.startup();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160; };</p>
<p>The main then positions the grid in the Border Container and replaces the Splash screen with Border Container. </p>
<h2>Grid Creation</h2>
<p>The grid creation method sets up a data store and layout and then creates the grid</p>
<p>&#160;&#160;&#160;&#160;&#160; djna.main.makeGrid = function(){   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var theStore = new dojo.data.ItemFileReadStore(    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {url:&quot;djna/datastores/dataonly001.json&quot;});    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var layout = {cels: [&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; field: 'custId', name: 'Customer Id'&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },{    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; field: 'name', name: 'Name'&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; field: 'address', name: 'Address'&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; field: 'postcode', name: 'Postcode'&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ]};    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var grid = new dojox.grid.DataGrid({    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; id:&quot;grid&quot;,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; store : theStore,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; clientSort : &quot;true&quot;,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; structure : layout,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; region: &quot;center&quot;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });    <br />&#160;&#160;&#160;&#160;&#160; };</p>
<p>&#160;</p>
<h1>Problems(1) – Drawing a Blank</h1>
<p>This all looked (to my eyes) pretty plausible. I loaded the page and got this:</p>
<p><a href="http://djna.files.wordpress.com/2010/04/image1.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="190" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb1.png?w=319&#038;h=190" width="319" border="0" /></a> </p>
<p>An empty box. And no error messages. I was running in Firefox with Firebug enabled. The console showed nothing untoward. So let’s use FireBug’s debugging capabilities. I bring up the Script tab in Firebug, and click the left margin to set breakpoints at the loading of my module:</p>
<p><a href="http://djna.files.wordpress.com/2010/04/image2.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="175" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb2.png?w=318&#038;h=175" width="318" border="0" /></a> </p>
<p>I can now step to the call to djna.main.startup and step inside. Unfortunately, what I see is less than helpful:</p>
<p><a href="http://djna.files.wordpress.com/2010/04/image3.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="63" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb3.png?w=473&#038;h=63" width="473" border="0" /></a>&#160; </p>
<p>The debugging difficuty is caused by Dojo’s implementaiton of modules, using evals. However we can enable debugging.</p>
<h2>Enabling Module Debugging</h2>
<p>We adjust the Dojo configuration like this:</p>
<p>&#160;&#160;&#160; &lt;script type=&quot;text/javascript&quot; src=&quot;dojoroot/dojo/dojo.js&quot;   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>djConfig=&quot;parseOnLoad: true, debugAtAllCosts: true&quot;&gt;</strong>    <br />&#160;&#160;&#160; &lt;/script&gt;</p>
<p>Now when we step into the module we can see our code:</p>
<p><a href="http://djna.files.wordpress.com/2010/04/image4.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="246" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb4.png?w=316&#038;h=246" width="316" border="0" /></a> </p>
</p>
<p>and as we step through the code to line</p>
<p>&#160;&#160;&#160;&#160; appContainer.addChild(grid);</p>
<p>we see this error:</p>
<p><a href="http://djna.files.wordpress.com/2010/04/image5.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="73" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb5.png?w=413&#038;h=73" width="413" border="0" /></a> </p>
</p>
<p>Which suggests that a variable has not been intialised correctly. [The rather hard to understand variable name<strong> _17c</strong>&#160; is shown because we are not using adevelopment version of Dojo.] A quick examination of the Watch tab shows that the grid variable is undefined:</p>
<p><a href="http://djna.files.wordpress.com/2010/04/image6.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="101" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb6.png?w=244&#038;h=101" width="244" border="0" /></a> </p>
<p>despite the call to </p>
<p>&#160;&#160;&#160; var grid = djna.main.makeGrid(); </p>
<p>and so, we inspect the makeGrid() method more carefully and discover that a line of code is missing:</p>
<p>&#160;&#160;&#160;&#160; var grid = new dojox.grid.DataGrid({   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; id:&quot;grid&quot;,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; store : theStore,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; clientSort : &quot;true&quot;,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; structure : layout,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; region: &quot;center&quot;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; });    <br />&#160;&#160;&#160; <strong> return grid;&#160; // &lt;==== need this     <br /></strong>&#160; };</p>
<p>Now when we re-run we don’t see the “undefined” error, but unfortunately, we still see an empty page.</p>
<h1>Problem(2) – Lay Me Low</h1>
<p>The cause of this problem is a tiny type in the layout. I don’t know how I could have solve this problem efficiently, but in the end I obtained a working example and gradually modified it to match my broken code until I spotted the mistake.</p>
<p>&#160;&#160;&#160;&#160; var layout = {cels: [&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; field: 'custId', name: 'Customer Id'&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },{</p>
<p>The one letter change to:</p>
<p>&#160;&#160;&#160;&#160; var layout = {<strong>cells:</strong> [&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {  <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; field: 'custId', name: 'Customer Id'&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },{
<p>gave some progress but yielded another problem …   </p>
<h1>Problem(3) – Just Got No Style</h1>
<p>I’ll admit that solving this one took me an unreasonable amount of time. In retrospect when you see this:</p>
<p><a href="http://djna.files.wordpress.com/2010/04/image7.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="232" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb7.png?w=244&#038;h=232" width="244" border="0" /></a> </p>
<p>it probably should be obvious that this is a style-sheet problem. However things were made a little more difficult by the fact that I had two errors.</p>
<h2>Style sheet path</h2>
<p>First, a simple path error in the html file:</p>
<p>&#160;&#160; &lt;style type=&quot;text/css&quot;&gt;   <br />&#160;&#160;&#160;&#160;&#160; @import &quot;../dojoroot/dijit/themes/tundra/tundra.css&quot;;&#160;&#160; <br />&#160;&#160;&#160; &lt;/style&gt; </p>
<p>should be </p>
<p>&#160;&#160;&#160; &lt;style type=&quot;text/css&quot;&gt;   <br />&#160;&#160;&#160;&#160;&#160; @import &quot;dojoroot/dijit/themes/tundra/tundra.css&quot;;&#160;&#160; <br />&#160;&#160;&#160; &lt;/style&gt;</p>
<p>That changes things slightly, but still we have a very similar bad screen:</p>
<p><a href="http://djna.files.wordpress.com/2010/04/image8.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="244" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb8.png?w=179&#038;h=244" width="179" border="0" /></a>&#160; </p>
<p>So there’s a further change:</p>
<h2>Extra style sheet</h2>
<p>It’s not obvious to a Dojo novice but you need a specific extra style sheet:</p>
<p>&lt;style type=&quot;text/css&quot;&gt;   <br />@import &quot;dojoroot/dijit/themes/tundra/tundra.css&quot;;    <br /><strong>@import &quot;dojoroot/dojox/grid/resources/tundraGrid.css&quot;;</strong>&#160;&#160; </p>
<p>&lt;/style&gt; </p>
<p>With that in place we can now see the grid taking shape.</p>
<p><a href="http://djna.files.wordpress.com/2010/04/image9.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="244" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb9.png?w=182&#038;h=244" width="182" border="0" /></a> </p>
<p>But strangely, loading never completes, we never see any data. The final problem was probably the most annoying of the lot …</p>
<h1>Problem(4) – Too Much Information</h1>
<p>I suppose that if I had had the Dojo development source available it might have been possible to figure out what was happening by step-wise debugging. I took the approach of downloading a working example and comparing it with mine. Eventually I saw the error in my data file:</p>
<p> {   <br />&#160;&#160;&#160; identifier: &quot;name&quot;,    <br />&#160;&#160;&#160; label: &quot;name&quot;,    <br />&#160;&#160;&#160; items: [{    <br />&#160;&#160;&#160;&#160;&#160; custId: &quot;123&quot;,&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160; name: &quot;Arnold Arkwright&quot;,    <br />&#160;&#160;&#160;&#160;&#160; address: &quot;1, A Avenue; Accrington&quot;,    <br />&#160;&#160;&#160;&#160;&#160; postcode: &quot;AA1 1AA&quot;    <br />&#160;&#160;&#160; },{    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; custId: &quot;234&quot;,&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; name: &quot;Bingley Bradford&quot;,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; address: &quot;2, B Bridge; Batley&quot;,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; postcode: &quot;BB2 2BB&quot;    <br />&#160;&#160;&#160; }]     <br />};</p>
<p>Can you see it? Yes, it’s that trailing semi-colon! Remove that and we get:</p>
<p><a href="http://djna.files.wordpress.com/2010/04/image10.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="244" alt="image" src="http://djna.files.wordpress.com/2010/04/image_thumb10.png?w=179&#038;h=244" width="179" border="0" /></a> </p>
<h1>Conclusion</h1>
</p>
</p>
<p>Well, I got there in the end and the journey taught me quite a lot. Seems like the tools such as Firebug do help quite a lot, but there are still quite a few gotchas.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/djna.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/djna.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/djna.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/djna.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/djna.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/djna.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/djna.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/djna.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/djna.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/djna.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/djna.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/djna.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/djna.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/djna.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=djna.wordpress.com&amp;blog=10775045&amp;post=119&amp;subd=djna&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://djna.wordpress.com/2010/04/19/how-many-ways-can-a-dojo-grid-go-wrong/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9df488f3711680cb831c146a5aa437fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">djna</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://djna.files.wordpress.com/2010/04/image_thumb10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
