<?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>Lemming Technology Blog</title>
	<atom:link href="http://lemnik.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://lemnik.wordpress.com</link>
	<description>it's all rather confusing really...</description>
	<lastBuildDate>Tue, 17 Jan 2012 06:12:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='lemnik.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/dcc1047428fbb7966f06959965a50ee4?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Lemming Technology Blog</title>
		<link>http://lemnik.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://lemnik.wordpress.com/osd.xml" title="Lemming Technology Blog" />
	<atom:link rel='hub' href='http://lemnik.wordpress.com/?pushpress=hub'/>
		<item>
		<title>BigDecimal and your Money</title>
		<link>http://lemnik.wordpress.com/2011/03/25/bigdecimal-and-your-money/</link>
		<comments>http://lemnik.wordpress.com/2011/03/25/bigdecimal-and-your-money/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 07:42:23 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=363</guid>
		<description><![CDATA[I often see Java developers attempting to use the BigDecimal class to store monetary values for financial applications. This often seems like a great idea when you start out, but almost always comes back as a flesh-eating zombie intent on devouring your entire time some time later on. The BigDecimal class is designed around accuracy and has an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=363&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I often see Java developers attempting to use the BigDecimal class to store monetary values for financial applications. This often seems like a great idea when you start out, but almost always comes back as a flesh-eating zombie intent on devouring your entire time some time later on. The BigDecimal class is designed around accuracy and has an almost infinite size. However: this choice will almost always come back to bite you, or someone else attempting to find a minor bug later on. It&#8217;s an especially bad idea when it comes to banking applications. So why is BigDecimal not well suited to storing monetary values then? For one thing: it doesn&#8217;t behave in a manner that is practical for financial systems. While this statement flies in the face of everything you&#8217;ve probably been taught about this class, it&#8217;s true. Read-on and I&#8217;ll tell you why.</p>
<h3>Theres more numbers in there than you think!</h3>
<p>A BigDecimal is <strong>not</strong> a standard floating point number. Instead: it&#8217;s a binary representation of a number. This means: 0.0 != 0.00. While this doesn&#8217;t seem like a problem at first: I&#8217;ve seen it cause no-end of strange little bugs. The only way to accurately determine whether two BigDecimal objects have an equal value is by using the compareTo method. Try these two little unit tests:</p>
<p><pre class="brush: java;">
@Test
public void testScaleFactor() {
    final BigDecimal zero = new BigDecimal(&quot;0.0&quot;);
    final BigDecimal zerozero = new BigDecimal(&quot;0.00&quot;);

    assertEquals(zero, zerozero);
}

@Test
public void testScaleFactorCompare() {
    final BigDecimal zero = new BigDecimal(&quot;0.0&quot;);
    final BigDecimal zerozero = new BigDecimal(&quot;0.00&quot;);

    assertTrue(zero.compareTo(zerozero) == 0);
}
</pre></p>
<p>This technique works when you&#8217;re in control of the data and the comparison, but it breaks when you want to put a BigDecimal object into most other Java data-structures. I&#8217;ve actually seen someone use a BigDecimal as a key to a HashMap, which of course didn&#8217;t work. The solution in this case was simple: change the HashMap for a TreeMap and things were happy. However it won&#8217;t always be this simple.</p>
<h3>They&#8217;re true high precision structures.</h3>
<p>This doesn&#8217;t just mean that they are precise, it also means that they won&#8217;t run any calculation that wouldn&#8217;t result in a representable answer. Take the following code snippet as an example:</p>
<p><pre class="brush: java;">
@Test
public void testArithmatic() {
    BigDecimal value = new BigDecimal(1);
    value = value.divide(new BigDecimal(3));
}
</pre></p>
<p>Primitive numeric types would just swallow this and represent the 0.3* as best they could, while a BigDecimal throws an ArithmeticException instead of attempting to represent a recurring number. In some cases getting an error will be desirable, but I&#8217;ve actually seen someone resolve the ArithmaticException like this:</p>
<p><pre class="brush: java;">
try {
    return decimal1.divide(decimal2);
} catch(ArithmaticException ae) {
    return new BigDecimal(decimal1.doubleValue() / decimal2.doubleValue());
}
</pre></p>
<p>Yes folks, unfortunately I&#8217;m quite serious here. This is the sort of bug introduced by an error occurring, computations stop running, and someone adds a &#8220;hack&#8221; to just &#8220;<em>make it work quickly and we&#8217;ll fix it later</em>&#8220;. It&#8217;s a total disaster, but I see it far to often.</p>
<h3>They don&#8217;t play nice with Databases.</h3>
<p>According to the JDBC spec database drivers implement a getBigDecimal, setBigDecimal and updateBigDecimal functions. They seem like a great idea, until you ponder that your database may not have a suitable storage type for these values. When storing a BigDecimal in a database, it&#8217;s common to type the column as a DECIMAL or REAL SQL type. These are both standard floating-point types, with all the rounding errors that implies. They are also limited in capacity and will often overflow or cause a SQLException when attempting to store very large BigDecimal values.</p>
<p>The only practical solution which will keep all the BigDecimal functionality and accuracy in a database is to type the amounts a BLOB columns. Try to imagine the following table structure if you will:</p>
<p><pre class="brush: sql;">
CREATE TABLE transactions (
    initial_date DATETIME NOT NULL,
    effective_date DATETIME NOT NULL,
    description VARCHAR(30) NOT NULL,
    source_id BIGINT NOT NULL,
    destination_id BIGINT NOT NULL,
    in_amount BLOB NOT NULL,
    in_amount_currency CHAR(3) NOT NULL,
    effective_amount BLOB NOT NULL,
    effective_amount_currency CHAR(3) NOT NULL,
    charge_amount BLOB NOT NULL,
    tax_amount BLOB NOT NULL
);
</pre></p>
<p>That required four different BLOB columns, each one of which will be stored outside of table space. BLOB objects are very expensive both to store, and to work with. Each one often uses it&#8217;s own database resources (much like an internal cursor) to read or write the value. This translates to much more time and network usage between your application and it&#8217;s database. To add to the misery a BLOB is generally not readable by a SQL tool, one of the major reasons for sticking with a SQL database is that it can be managed from outside of your application.</p>
<h3>Performance.</h3>
<p>This is often raised as an issue, but ignored in favor of &#8220;accuracy&#8221;. The performance of BigDecimal is often considered &#8220;good enough&#8221; for general computing, and it&#8217;s fine if you want to add tax to an item every once in a while, but consider the number of interest calculations per month a moderate sized bank do. This may seem like an extreme case, but if your application ran a simple shipping and tax calculation for items on an online store in a JSP you&#8217;ve got effectively the same problem. In a very simple multiplication test BigDecimal performed over <strong>2300 times slower</strong> than a simple long value. While this may only be milliseconds per mutation, a performance-factor of this size very quickly adds up to more computational time than is actually available to the system.</p>
<p>Also remember that BigDecimal (like most Number subclasses) are immutable. That means every calculation requires a copy of the existing BigDecimal. These copies are generally cleaned away by the eden-space collector (and G1 is very good at handling them), but when you put such a system into production it leads to a massive change in your heap requirements. Your BigDecimal objects must be allocated in such a way that a minimum number of them survive a garbage collection, the memory requirement of such a space quickly spirals out of control.</p>
<p>To add to the performance argument: the compareTo method is quite a bit slower than the equals method, and gets significantly slower as the size of the BigDecimal increases.</p>
<h3>A Cure to BigDecimal Woes:</h3>
<p>A standard long value can store the current value of the Unites States national debt (as cents, not dollars) 6477 times without any overflow. Whats more: it&#8217;s an integer type, not a floating point. This makes it easier and accurate to work with, and a guaranteed behavior. You&#8217;ll notice that several different behaviors in BigDecimal are either not well defined, or have multiple implementations. That said: depending on your application you may need to store the values as hundredths or even thousandths of cents. However this is highly dependent on your application, and theres almost always someone who can tell you exactly what unit the business works in. Bare in mind also that there are often de-facto (or even mandated) standards which exist between businesses about what unit of money they deal in, using more or less precision can lead to some serious problems when interfacing with suppliers or clients.</p>
<p>The mechanism I generally try to use is a custom-built MoneyAmount class (each application has different requirements) to store both the actual value, and it&#8217;s Currency. Building your own implementation opens the opportunity to use factory methods instead of a constructor. This will allow you to decide on the actual data-type at runtime, even during arithmetic operations. 99% of the time, an int or long value will suffice &#8211; when they don&#8217;t the implementation can change to using a BigInteger. The MoneyAmount class also enables you to define your own rounding schemes, and how you wish to handle recursive decimal places. I&#8217;ve seen systems that required several different rounding mechanisms depending on the context of the operation (currency pairs, country of operation and even time of day). For an example of this kind of factory discussion: take a look at the source-code for the <a href="http://www.google.com/codesearch/p?hl=en#ih5hvYJNSIA/src/share/classes/java/util/EnumSet.java&amp;q=EnumSet&amp;l=107" target="_blank">java.util.EnumSet</a> class. Two different implementations exist: the <a href="http://www.google.com/codesearch/p?hl=en#ih5hvYJNSIA/src/share/classes/java/util/RegularEnumSet.java&amp;q=EnumSet&amp;d=5&amp;l=36" target="_blank">RegularEnumSet</a> class uses a long to store a bit-set of all the selected constants. Given that very few enum values have more than 64 constants this implementation will cover most cases, just like a long will cover most requirements in a financial system.</p>
<h3>Summary</h3>
<p>This post is to warn people who are busy (or about to start) writing a system that will run financial calculations and are tempted to use BigDecimal. While it&#8217;s probably the most common type used for this purpose in the &#8220;enterprise&#8221; world, I&#8217;ve seen it backfire more times than I care to recount. My advise here is really to consider your options carefully. <strong>Taking shortcuts in implementation almost always leads to pain</strong> in the long-run (just look at the java.util.Properties class as an example of this).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lemnik.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lemnik.wordpress.com/363/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lemnik.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lemnik.wordpress.com/363/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lemnik.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lemnik.wordpress.com/363/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lemnik.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lemnik.wordpress.com/363/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lemnik.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lemnik.wordpress.com/363/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lemnik.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lemnik.wordpress.com/363/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lemnik.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lemnik.wordpress.com/363/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=363&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lemnik.wordpress.com/2011/03/25/bigdecimal-and-your-money/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c7af948b9fdf02628f82c3c11dd5b55?s=96&#38;d=wavatar" medium="image">
			<media:title type="html">lemnik</media:title>
		</media:content>
	</item>
		<item>
		<title>6 Reasons to Develop Software on a MacBook Pro</title>
		<link>http://lemnik.wordpress.com/2011/02/22/6-reasons-to-develop-on-a-mac/</link>
		<comments>http://lemnik.wordpress.com/2011/02/22/6-reasons-to-develop-on-a-mac/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 08:13:34 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=349</guid>
		<description><![CDATA[Most of my life I&#8217;ve worked on either Windows or Linux (in various flavors). Most of my software development experience has been on a Linux machine, and they&#8217;re amazingly productive when compared to Windows. The main reason for the increased productivity is that Linux machines require significantly less configuration for developers. Most of the toolchain you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=349&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Most of my life I&#8217;ve worked on either Windows or Linux (in various flavors). Most of my software development experience has been on a Linux machine, and they&#8217;re amazingly productive when compared to Windows. The main reason for the increased productivity is that Linux machines require significantly less configuration for developers. Most of the toolchain you use in development is already there, or can be installed and configured into place in under 10 clicks of your mouse.</p>
<p>Recently however I&#8217;ve been using a MacBook Pro, and I&#8217;ve gone from a fanatical devotion to my Linux machine to a fondness for the Apple. I decided to write out a list of the things I&#8217;ve noticed about these machines that makes them so ideal for software development.</p>
<p><strong>Note:</strong> this is really just my opinion on the subject, don&#8217;t take it to seriously <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>Spotlight is Productivity Defined</h3>
<p>There are several desktop based search tools for both windows and linux, but they don&#8217;t even come close to how powerful Apple Spotlight is. If you&#8217;re used to a keyboard driven environment you&#8217;ll absolutely love it. Not only for just starting your software, but for amazingly quickly finding that document you were reading the other day&#8230; the one that said something about &#8220;too much fresh fruit&#8221;.</p>
<h3>It&#8217;s BSD Based Underneath</h3>
<p>Thus a flavor of Unix. Whatever Unix derivative I&#8217;ve developed on over the years, they have always been (for me) more productive than Windows. I&#8217;ve found that the single most important reason for this actually appears to be the implementation of the file system layer. Unix implementations tend to have a more robust and flexible file system implementation, while Windows seems to be of the opinion that it&#8217;s always going to be a desktop machine, and if something goes wrong you can shut it down and do a scandisk (and yes I have used Windows 7, it&#8217;s still broken).</p>
<p>The better file system layer plays directly into software development. Source control tools such as Subversion, databases and web servers all tend to have less problems on a Unix file system than on Windows. Yes the tools could probably be modified to better handle the Windows filesystem, but should that really be necessary?</p>
<h3>Gesture Recognizing Touch Pad</h3>
<p><a href="http://lemnik.files.wordpress.com/2011/02/touchpad.jpg"><img class="size-full wp-image-353 alignright" title="MacBook Pro Touchpad" src="http://lemnik.files.wordpress.com/2011/02/touchpad.jpg?w=780" alt=""   /></a>Spend in hour or two using the touch pad on a Mac and you may find it difficult using any other touch pad. The ability to switch from scrolling to clicking to navigating without actually moving to different areas of the pad makes a huge difference.</p>
<p>The other thing everyone comments on, and I&#8217;ll definitely add my voice to is the size of the touchpad. It&#8217;s so huge I don&#8217;t miss a mouse in the slightest. In fact quite the opposite, I would far rather develop software with a MacBook Pro touchpad than with a mouse. Main reason: it&#8217;s much closer to the keyboard, I don&#8217;t need to move my hand over to the mouse to scroll or navigate code or documentation.</p>
<p>Finally (and a bit unusual maybe), the ability to smoothly scroll horizontally as well as scale (with the pinch gesture) makes viewing diagrams much easier than previously. Most touchpads emulate a mouse-wheel when they scroll, and most diagram software tends to interpret this as very slow scrolling, or scrolls in &#8220;lines&#8221;. Both of these behaviors are very annoying and effectively wrong.</p>
<h3>The Keyboard is Incredible</h3>
<p>It&#8217;s not just the fact that it&#8217;s a clicklit keyboard, it&#8217;s the size and spacing of the keys. The arrangement of the keyboard is similar to a desktop keyboard, but since it&#8217;s a laptop the keys don&#8217;t sink as far, they tap away with a very satisfying &#8221;click&#8221; sound. The backlight is also brilliantly useful for late-night coding, but you can find that on many different laptops today.</p>
<p>The default keyboard shortcuts also make abundant sense when you&#8217;re using these keyboards. Some of the characters are not quite where you expect to find them at first, after a short time of using them I&#8217;m wondering why all QWERTY keyboards aren&#8217;t arranged like this. Finally: many of the symbols that you&#8217;d normally open a character map application for are accessible directly from the keyboard. It&#8217;ll take you a bit of time to get used to the fact that you can type a ± or Ω with just 2 keys, but it&#8217;s a brilliantly useful ability.</p>
<h3>It&#8217;s Just Built Better</h3>
<p><a href="http://lemnik.files.wordpress.com/2011/02/macbook_open.jpg"><img class="alignright" title="MacBook Pro Insides" src="http://lemnik.files.wordpress.com/2011/02/macbook_open.jpg?w=414&#038;h=311" alt="" width="414" height="311" /></a></p>
<p>Having looked at a large number of laptops, both off-the-shelf and customized builds I&#8217;ve found that the MacBook Pro is actually surprisingly good value for money: if you know whats inside. It&#8217;s small details such as one laptop using a Core2-Duo while the same priced MacBook is an i5 CPU. Theres also the size of the battery, which for some is less important than others. If you take a look at the image on the right you&#8217;ll see just how much physical space the battery takes up in the 15&#8243; variation of the MacBook Pro: it&#8217;s huge! It&#8217;s actual capacity is 77.5 watt-hours, compared to a similarly priced Lenovo laptop which has just 48 watt-hours.</p>
<p>Another &#8220;feature&#8221; is the fact that the MacBooks all have DDR3 memory in them where most of the competition is still using DDR2 (and often really cheap DDR2 at that). The MacBooks also generally have more memory by default than similarly priced machines.</p>
<p>Other tiny features that make a huge difference are the amazing lack of cooling vents on the case, the mag-safe power connector that simply falls away when someone kicks your cable, the battery meter on the outside of the laptop.</p>
<p>Add to all of this that the MacBook is generally thinner than it&#8217;s competitors and has an aluminium case instead of the normal plastic nonsense and you&#8217;ll find that the MacBook will not just out-perform it&#8217;s competition but also just feels more solid when you carry it around.</p>
<h3>It Just Works</h3>
<p>This sounds really corny, and it&#8217;s generally a bit of a Mac idiom, <strong>but it&#8217;s true</strong>. When I plugged my Android phone in to do some on-the-device debugging work, all I had installed with the stock Android SDK. With no special device drivers or funny setup work, the device just worked. I set breakpoints, hit them, edited variables, simply put: I controlled the phone from my MacBook with no special setup or configuration. All things considered, this is quite amazing.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lemnik.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lemnik.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lemnik.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lemnik.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lemnik.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lemnik.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lemnik.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lemnik.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lemnik.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lemnik.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lemnik.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lemnik.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lemnik.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lemnik.wordpress.com/349/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=349&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lemnik.wordpress.com/2011/02/22/6-reasons-to-develop-on-a-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c7af948b9fdf02628f82c3c11dd5b55?s=96&#38;d=wavatar" medium="image">
			<media:title type="html">lemnik</media:title>
		</media:content>

		<media:content url="http://lemnik.files.wordpress.com/2011/02/touchpad.jpg" medium="image">
			<media:title type="html">MacBook Pro Touchpad</media:title>
		</media:content>

		<media:content url="http://lemnik.files.wordpress.com/2011/02/macbook_open.jpg" medium="image">
			<media:title type="html">MacBook Pro Insides</media:title>
		</media:content>
	</item>
		<item>
		<title>Android User Interface Development</title>
		<link>http://lemnik.wordpress.com/2010/12/28/android-user-interface-development/</link>
		<comments>http://lemnik.wordpress.com/2010/12/28/android-user-interface-development/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 09:23:31 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=340</guid>
		<description><![CDATA[Android User Interface Development: A Beginners Guide is the title of the book that I&#8217;ve been writing. The main reason I haven&#8217;t recently had a chance to update this blog. The book is not just about the basics of good user interface design, but also how exactly these principals can be applied on an Android [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=340&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://link.packtpub.com/Uczf1u">Android User Interface Development: A Beginners Guide</a> is the title of the book that I&#8217;ve been writing. The main reason I haven&#8217;t recently had a chance to update this blog. The book is not just about the basics of good user interface design, but also how exactly these principals can be applied on an Android device. The book takes the concepts and in a practical manor applies them directly to various parts of the Android developers stack.</p>
<p><strong>In broad terms, the book covers the following aspects:</strong></p>
<ul>
<li>Designing user-friendly interfaces that support quick and easy access to information</li>
<li>Exploring and implement multiple layouts in Android to design user interfaces for the different screen sizes and densities</li>
<li>Ensuring a consistent user-interface experience and improve your application performance by reusing your application components</li>
<li>Designing easy-on-the-eye themes for your Android applications</li>
<li>Displaying and select complex data structures from applications such as an address-book or calendar application by using Android widgets</li>
<li>Animating visual queues of what the application is currently doing, and what effect their actions are having</li>
<li>Customizing the built-in classes in Android to enhance the user interface by creating tabs and galleries</li>
<li>Learning to Leverage Android&#8217;s resource loading system</li>
<li>Learning how best to present your user with information; or capture information from them</li>
</ul>
<p>You can find more information about the book, and also pre-order yourself a copy from the <a title="Android User Interface Development: Beginner's Guide" href="http://link.packtpub.com/Uczf1u">Packt Publishing web-site</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lemnik.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lemnik.wordpress.com/340/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lemnik.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lemnik.wordpress.com/340/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lemnik.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lemnik.wordpress.com/340/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lemnik.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lemnik.wordpress.com/340/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lemnik.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lemnik.wordpress.com/340/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lemnik.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lemnik.wordpress.com/340/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lemnik.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lemnik.wordpress.com/340/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=340&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lemnik.wordpress.com/2010/12/28/android-user-interface-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c7af948b9fdf02628f82c3c11dd5b55?s=96&#38;d=wavatar" medium="image">
			<media:title type="html">lemnik</media:title>
		</media:content>
	</item>
		<item>
		<title>Dear Google: Please Fork Java</title>
		<link>http://lemnik.wordpress.com/2010/10/06/dear-google-please-fork-java/</link>
		<comments>http://lemnik.wordpress.com/2010/10/06/dear-google-please-fork-java/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 07:37:44 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Sun]]></category>

		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=327</guid>
		<description><![CDATA[This is an open-letter to anyone at Google with a vested-interest in the long-term survival of Java as a language; and as a viable platform. Since the early days of Java 7; I&#8217;ve been a concerned Java-citizen. Java feels like it&#8217;s loosing what made it a great language in the first place. It was the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=327&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is an open-letter to anyone at Google with a vested-interest in the long-term survival of Java as a language; and as a viable platform.</p>
<p>Since the early days of Java 7; I&#8217;ve been a concerned Java-citizen. Java feels like it&#8217;s loosing what made it a great language in the first place. It was the first programming language I ever learned. I more-or-less self taught myself with the aid of a (now very tattered) copy of &#8220;Core Java&#8221; (first edition). Java was great because it was simple to learn, but an inherently powerful environment to work in. The language (pre 5) was kept extremely simple, with little in the way of syntactic candy. For an analogy: it was Othello; while C++ was (and is) Civilisation. Java&#8217;s true power lay in the fact that the language was extremely simple to pick-up and work with, while the platform carried you forward as you built more and more complex software systems.</p>
<p>With Oracle now at the helm of Java; and the community drowning while trying the hold onto the rudder: I finally think that a fork of the code-base; and more importantly the <strong>specification</strong> is in order. The idea of forking Java makes me very sad; it&#8217;s got a special place in my heart (much the way Sun did as a company). However: sometimes you need to settle for the lesser of two evils, and in this case: leaving Java in the hands of Oracle is the greater evil.</p>
<p>Having seen the way Google manages projects such as GWT and Android; I believe (strongly) that Google engineers are in a much better position to steer the way-forward for Java. The fork wouldn&#8217;t necessarily be called &#8220;Java&#8221; any-more; a branding overhaul would be needed to avoid further litigation from a wrathful Oracle. I also don&#8217;t believe that in individual or small community forking the code-base and specification would work; simply because they would be unable to attract the required attention.</p>
<p>Google already has many resources invested in Java; some of those resources in areas of Java that few people understand. I strongly feel that a Google guided fork of Java as both a language and platform would not just be in the best interests of Google; but also the best interests of anyone in the Java community.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lemnik.wordpress.com/327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lemnik.wordpress.com/327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lemnik.wordpress.com/327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lemnik.wordpress.com/327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lemnik.wordpress.com/327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lemnik.wordpress.com/327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lemnik.wordpress.com/327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lemnik.wordpress.com/327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lemnik.wordpress.com/327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lemnik.wordpress.com/327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lemnik.wordpress.com/327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lemnik.wordpress.com/327/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lemnik.wordpress.com/327/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lemnik.wordpress.com/327/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=327&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lemnik.wordpress.com/2010/10/06/dear-google-please-fork-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c7af948b9fdf02628f82c3c11dd5b55?s=96&#38;d=wavatar" medium="image">
			<media:title type="html">lemnik</media:title>
		</media:content>
	</item>
		<item>
		<title>Unit Testing with Mock Objects and EoD SQL</title>
		<link>http://lemnik.wordpress.com/2010/04/14/unit-testing-with-mock-objects-and-eod-sql/</link>
		<comments>http://lemnik.wordpress.com/2010/04/14/unit-testing-with-mock-objects-and-eod-sql/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 19:21:59 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[eodsql]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=317</guid>
		<description><![CDATA[Introduction Unit Testing has become one of the corner-stones of good software development (it has been such for quite a long time actually). However writing a Unit Test that interacts with database code (at any level) can be very challenging. The main problem being: your data should be in a &#8220;known&#8221; state when the Unit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=317&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Unit Testing has become one of the corner-stones of good software development (it has been such for quite a long time actually). However writing a Unit Test that interacts with database code (at any level) can be very challenging. The main problem being: your data should be in a &#8220;known&#8221; state when the Unit Test starts running. In the past many approaches to this problem have been taken, such as: using an in-memory database; or <a href="http://www.dbunit.org/" target="_blank">DbUnit</a>. Each approach has it&#8217;s up-sides and it&#8217;s down-sides (I won&#8217;t be going into them here).</p>
<p>To help your unit testing along <a title="EoD SQL Homepage" href="https://eodsql.dev.java.net/" target="_blank">EoD SQL</a> is growing it&#8217;s own <a href="http://en.wikipedia.org/wiki/Mock_object" target="_blank">mocking</a> extension (currently only in Subversion however). The EoD-Mock project allows you to build mock implementations of your database connection code without any external configuration. Thats right: <strong>no dependency injection; no JNDI; no factories; nothing</strong><strong>!</strong></p>
<h2>How does it work?</h2>
<p>If the EoD-Mock JAR file is on the class-path, EoD SQL will automatically look for mock implementations of your Query interfaces instead of generating a real implementation. For example, take a simple UserQuery interface:</p>
<p><pre class="brush: java;">
public interface UserQuery extends BaseQuery {
    @Select(&quot;SELECT * FROM users WHERE email = ?1&quot;)
    User selectByEmail(String email);

    @Update(sql = &quot;INSERT INTO users (email, username, birth_date) &quot;
    + &quot;VALUES(?{1.email}, ?{1.username}, ?{1.birthDate})&quot;,
    keys = GeneratedKeys.RETURNED_KEYS_FIRST_COLUMN)
    User insert(User user);

    @Select(&quot;SELECT * FROM users&quot;)
    DataSet&lt;User&gt; selectUsers();
}</pre></p>
<p>To create a Mock of this interface using EoD-Mock all you need to do is write an implementation in the same package:</p>
<p><pre class="brush: java;">
public class UserQueryMock extends AbstractMockQuery implements UserQuery {

    private final List&lt;User&gt; users = new ArrayList&lt;User&gt;();

    public UserQueryMock() {
        insert(new User(&quot;joe.bloggs@nowhere.com&quot;, &quot;Joe Bloggs&quot;, new Date(83, 3, 6)));
        insert(new User(&quot;jeff@jeffswebsite.com&quot;, &quot;Jeff Site&quot;, new Date(76, 8, 23)));
        insert(new User(&quot;logan@murkmurk.com&quot;, &quot;Logan Sleep&quot;, new Date(90, 4, 1)));
    }

    public User selectByEmail(final String email) {
        for(final User user : users) {
            if(user.getEmail().equals(email)) {
                return user;
            }
        }

        return null;
    }

    public User insert(final User user) {
        final long id = users.size();

        final User clonedUser = new User(
                user.getEmail(),
                user.getUsername(),
                user.getBirthDate());

        clonedUser.setId(id);

        users.add(clonedUser);

        final User idUser = new User(null, null, null);
        idUser.setId(id);

        return idUser;
    }

    public DataSet&lt;User&gt; selectUsers() {
        return new MockDataSet&lt;User&gt;(users, false, true);
    }

}</pre></p>
<p>Yup, it&#8217;s really as simple as that. Now if you ask EoD-SQL for an instance of UserQuery (ie: QueryTool.getQuery(UserQuery.class)): instead of generating an implementation, it will create an instance of UserQueryMock and return that.</p>
<h2>How much does eod-mock take care of?</h2>
<ul>
<li>EoD-Mock will self-register as a QueryFactory with EoDSQL (but only under Java 6 and higher) if it&#8217;s on the classpath</li>
<li>A &#8220;default&#8221; DataSource is provided automatically. The provided implementation throws exceptions instead of providing database access</li>
<li>An AbstractMockQuery class is provided to take care of the methods declared in BaseQuery</li>
<li>A MockDataSet is provided, and will attempt to behave like a real DataSet object</li>
<li>QueryTool.getQuery will automatically return mocked query objects, meaning: <strong>no changes to your data-access layer</strong></li>
</ul>
<h2>Current State</h2>
<p>EoD-Mock is currently only available in the <a href="https://eodsql.dev.java.net/source/browse/eodsql/" target="_blank">Subversion repository</a>, but will be included in the next release of EoD SQL. There is no support currently for the DataIterator class, but that will no-doubt come very soon.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lemnik.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lemnik.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lemnik.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lemnik.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lemnik.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lemnik.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lemnik.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lemnik.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lemnik.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lemnik.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lemnik.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lemnik.wordpress.com/317/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lemnik.wordpress.com/317/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lemnik.wordpress.com/317/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=317&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lemnik.wordpress.com/2010/04/14/unit-testing-with-mock-objects-and-eod-sql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c7af948b9fdf02628f82c3c11dd5b55?s=96&#38;d=wavatar" medium="image">
			<media:title type="html">lemnik</media:title>
		</media:content>
	</item>
		<item>
		<title>EoD SQL 2.1 Released</title>
		<link>http://lemnik.wordpress.com/2010/02/02/eod-sql-2-1-released/</link>
		<comments>http://lemnik.wordpress.com/2010/02/02/eod-sql-2-1-released/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 18:06:28 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[eodsql]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=307</guid>
		<description><![CDATA[So I finally found some time to make a 2.1 release for EoD SQL. For those who don&#8217;t already know: EoD SQL Allows for fast, simple binding between a Relation Database Query and Java objects. Think of it as your friend that gets Hibernate or JPA out-of-your-face and lets you get on with actually writing some code. The 2.1 release [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=307&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So I finally found some time to make a 2.1 release for <a title="EoD SQL Home Page" href="https://eodsql.dev.java.net/" target="_blank">EoD SQL</a>. For those who don&#8217;t already know:</p>
<blockquote><p>EoD SQL Allows for fast, simple binding between a Relation Database Query and Java objects.</p></blockquote>
<p>Think of it as your friend that gets Hibernate or JPA out-of-your-face and lets you get on with actually writing some code.</p>
<p>The 2.1 release has a long list of changes behind it (which we&#8217;ve built over the last few months).</p>
<ol>
<li>It&#8217;s much faster than EoD SQL 2.0 was (which in turn was faster than 1.0).</li>
<li>There are a good number of bug-fixes, making it nice and stable.</li>
<li>The 2.1 release includes batch updates<br />
@Update(sql=&#8221;INSERT INTO users (name, email) VALUES (?{1.name}, ?{1.email})&#8221;,batchUpdate=true)<br />
void batchInsertUsers(Collection users) throws SQLException;</li>
<li>GWT developers rejoice! EoD SQL can now fetch objects in any Collection type you choose!<br />
@Select(&#8220;SELECT * FROM users WHERE group = ?1&#8243;)<br />
ArrayList getUsersInGroup(long groupId);</li>
<li>Byte arrays are now considered primitive types, and get mapped by EoD SQL out-of-the-box (no custom TypeMapper required)</li>
</ol>
<p>That&#8217;s far from an exhaustive list, and you should really go <a title="Download EoD SQL 2.1" href="https://eodsql.dev.java.net/servlets/ProjectDocumentList?folderID=8364&amp;expandFolder=8364&amp;folderID=0" target="_blank">download</a> the API and try out some of the cool new features.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lemnik.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lemnik.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lemnik.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lemnik.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lemnik.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lemnik.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lemnik.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lemnik.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lemnik.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lemnik.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lemnik.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lemnik.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lemnik.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lemnik.wordpress.com/307/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=307&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lemnik.wordpress.com/2010/02/02/eod-sql-2-1-released/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c7af948b9fdf02628f82c3c11dd5b55?s=96&#38;d=wavatar" medium="image">
			<media:title type="html">lemnik</media:title>
		</media:content>
	</item>
		<item>
		<title>EoD SQL 2.1 &#8211; Now in First RC Release</title>
		<link>http://lemnik.wordpress.com/2009/11/03/eod-sql-2-1-now-in-first-rc-release/</link>
		<comments>http://lemnik.wordpress.com/2009/11/03/eod-sql-2-1-now-in-first-rc-release/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 06:47:21 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[eodsql]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=300</guid>
		<description><![CDATA[EoD SQL just got a 2.1 Release Candidate kicked out the door. While there are (once again) many performance improvements and a few bug fixes, the big news of this release has got to be Batch Updates! Some people (myself included) have been waiting a very long time to see this feature in EoD SQL, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=300&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a title="EoD SQL Home Page" href="https://eodsql.dev.java.net/" target="_blank">EoD SQL</a> just got a <a title="Download EoD SQL 2.1-RC" href="https://eodsql.dev.java.net/servlets/ProjectDocumentList?folderID=8364&amp;expandFolder=8364" target="_blank">2.1 Release Candidate</a> kicked out the door. While there are (once again) many performance improvements and a few bug fixes, the big news of this release has got to be <strong>Batch Updates</strong>!</p>
<p>Some people (myself included) have been waiting a very long time to see this feature in EoD SQL, and it&#8217;s taken a fair amount of discussion to decide how it would work. The final answer came from Bernd Rinn: allow parameters to be specified as various Collection types. So to add a list of User objects to your database:</p>
<p><pre class="brush: java;">
@Update(sql=&quot;INSERT INTO users (name, birth_date, password, email) VALUES (?{1.name}, ?{1.birth_date}, ?{1.password}, ?{1.email})&quot;,batchUpdate=true)
void insertUsers(List&lt;User&gt; users);
</pre></p>
<p>Batch updates will work with any class extending Collection, or an array type. It can also be used with simple parameters:</p>
<p><pre class="brush: java;">
@Update(sql=&quot;REPLACE INTO user_group_join (user_id, group_id) VALUES (?{1.id}, ?{2.id})&quot;,batchUpdate=true)
void ensureUserInGroups(User user, Collection&lt;Group&gt; groups);
</pre></p>
<p>A Batch Update is generally much faster than a series of normal update invocations, because EoD SQL will use PreparedStatement.addBatch() to build up all of the parameters on the client-side before sending all of the data to the database in one statement. It doesn&#8217;t mean it&#8217;s a single transaction, but it does mean that the database can execute all of the parameter variations before sending any data back.</p>
<p>So why not go <a title="Download EoD SQL 2.1-RC" href="https://eodsql.dev.java.net/servlets/ProjectDocumentList?folderID=8364&amp;expandFolder=8364" target="_blank">download</a> the new release and give it a try.</p>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:0;width:1px;height:1px;">
<pre>Bernd Rinn</pre>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lemnik.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lemnik.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lemnik.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lemnik.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lemnik.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lemnik.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lemnik.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lemnik.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lemnik.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lemnik.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lemnik.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lemnik.wordpress.com/300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lemnik.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lemnik.wordpress.com/300/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=300&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lemnik.wordpress.com/2009/11/03/eod-sql-2-1-now-in-first-rc-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c7af948b9fdf02628f82c3c11dd5b55?s=96&#38;d=wavatar" medium="image">
			<media:title type="html">lemnik</media:title>
		</media:content>
	</item>
		<item>
		<title>EoD SQL 2.1-Beta Released</title>
		<link>http://lemnik.wordpress.com/2009/10/16/eod-sql-2-1-beta-released/</link>
		<comments>http://lemnik.wordpress.com/2009/10/16/eod-sql-2-1-beta-released/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 08:58:46 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[eodsql]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=293</guid>
		<description><![CDATA[EoD SQL 2.1-Beta has been released, you can go download it from the Documents &#38; Files section of the homepage. The 2.1 release is about improving speed and usability over the 2.0 release. Some of the new features included are: Specific Collection implementations (including those not in the standard Java API&#8217;s) can now be returned: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=293&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>EoD SQL 2.1-Beta has been released, you can go download it from the <a title="Download EoD SQL 2.1-Beta" href="https://eodsql.dev.java.net/servlets/ProjectDocumentList?folderID=8364&amp;expandFolder=8364&amp;folderID=0" target="_blank">Documents &amp; Files</a> section of the <a title="EoD SQL Home Page" href="https://eodsql.dev.java.net/" target="_blank">homepage</a>. The 2.1 release is about improving speed and usability over the 2.0 release. Some of the new features included are:</p>
<ul>
<li>Specific Collection implementations (including those not in the standard Java API&#8217;s) can now be returned:<br />
<pre class="brush: java;">@Select(&quot;SELECT * FROM users WHERE group = ?{1.id}&quot;)
 ArrayList&lt;User&gt; selectUserGroup(Group group);</pre></li>
<li>Select methods can now populate existing objects:<br />
<pre class="brush: java;">@Select(sql=&quot;SELECT * FROM user_meta_info WHERE user_id = ?{1.id}&quot;,into=1)
void selectMetaInfo(User user);</pre></li>
<li>Faster construction of query implementations</li>
<li>Better error reporting</li>
<li>Several small bug fixes</li>
</ul>
<p>This is of course a beta release, so there may be bugs. That said the code is pretty well unit tested and should be relatively stable. One new feature not in the release (but on the way) is batch updates. Stay tuned for more information!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lemnik.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lemnik.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lemnik.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lemnik.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lemnik.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lemnik.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lemnik.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lemnik.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lemnik.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lemnik.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lemnik.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lemnik.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lemnik.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lemnik.wordpress.com/293/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=293&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lemnik.wordpress.com/2009/10/16/eod-sql-2-1-beta-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c7af948b9fdf02628f82c3c11dd5b55?s=96&#38;d=wavatar" medium="image">
			<media:title type="html">lemnik</media:title>
		</media:content>
	</item>
		<item>
		<title>Using an Aladdin eToken with Java keytool</title>
		<link>http://lemnik.wordpress.com/2009/10/06/using-an-aladdin-etoken-with-java-keytool/</link>
		<comments>http://lemnik.wordpress.com/2009/10/06/using-an-aladdin-etoken-with-java-keytool/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 09:34:18 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=291</guid>
		<description><![CDATA[The Aladdin eToken is a great little security device when you have sensitive private key information. They are a great USB solution in that they support all major operating-systems with a PKCS#11 driver. This means they also integrate with Java on all major platforms (through the SunPKCS11 Security Provider). The one problem we have come [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=291&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.aladdin.com/etoken/security-applications.aspx" target="_blank">Aladdin eToken</a> is a great little security device when you have sensitive private key information. They are a great USB solution in that they support all major operating-systems with a PKCS#11 driver. This means they also integrate with Java on all major platforms (through the SunPKCS11 Security Provider).</p>
<p>The one problem we have come across  with the device is trying to create keys on it using the standard Java keytool application. There are two errors you&#8217;ll almost certainly face, both in the form of a <tt>sun.security.pkcs11.wrapper.PKCS11Exception.</tt></p>
<h2>Error 1: CKR_ATTRIBUTE_TYPE_INVALID</h2>
<p>This error (we found) pops up when you don&#8217;t specify the key algorithm on the command line. You need to specify &#8220;-keyalg RSA&#8221; to ensure that an RSA key (instead of the default DSA) is generated for the eToken.</p>
<h2>Error 2: CKR_TEMPLATE_INCONSISTENT</h2>
<p>This one is a little more nasty.  It&#8217;s not well documented, but effectively the keytool doesn&#8217;t generate signatures that the eToken&#8217;s PKCS#11 implementation likes (we couldn&#8217;t find any tool other than the eToken software that did). Under Windows you need a registry key:</p>
<p><tt>HKEY_LOCAL_MACHINE\SOFTWARE\Aladdin\eToken\MIDDLEWARE\GENERAL</tt></p>
<p>The key is a DWORD attribute: &#8220;TolerantX509Attributes&#8221; with a value of &#8220;1&#8243;. But what about Mac and Linux. You&#8217;ll need to look for the eToken config file: <tt>/etc/eToken.conf</tt>, then under the &#8220;[GENERAL]&#8221; section of the file add the line:</p>
<p><tt>TolerantX509Attributes=1</tt></p>
<p>This will allow keytool (and other PKCS#11 tools) to generate and store keypairs on your USB eToken.</p>
<h2>A Command Line Example</h2>
<p><tt> keytool -v -genkeypair </tt><tt>-keyalg RSA </tt><tt>-alias myKey -keystore NONE -storetype PKCS11 -providerClass sun.security.pkcs11.SunPKCS11 -providerArg /home/me/pkcs11.conf<br />
</tt></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lemnik.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lemnik.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lemnik.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lemnik.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lemnik.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lemnik.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lemnik.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lemnik.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lemnik.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lemnik.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lemnik.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lemnik.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lemnik.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lemnik.wordpress.com/291/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=291&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lemnik.wordpress.com/2009/10/06/using-an-aladdin-etoken-with-java-keytool/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c7af948b9fdf02628f82c3c11dd5b55?s=96&#38;d=wavatar" medium="image">
			<media:title type="html">lemnik</media:title>
		</media:content>
	</item>
		<item>
		<title>EoD SQL Applied – Part 5 / 5 (GWT Applications)</title>
		<link>http://lemnik.wordpress.com/2009/09/18/eod-sql-applied-%e2%80%93-part-5-5-gwt-applications/</link>
		<comments>http://lemnik.wordpress.com/2009/09/18/eod-sql-applied-%e2%80%93-part-5-5-gwt-applications/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 17:23:25 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[eodsql]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=280</guid>
		<description><![CDATA[The Dreaded &#8220;Not Serializable&#8221; Problem GWT turns all of your Java code into JavaScript, but it also obfuscates everything. With this in mind, it makes serialization a bit more complex than usual. GWT generates a serializer and deserializer for each class that could be transported across the wire to an RPC service. The difficulty comes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=280&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>The Dreaded &#8220;Not Serializable&#8221; Problem</h2>
<p>GWT turns all of your Java code into JavaScript, but it also obfuscates everything. With this in mind, it makes serialization a bit more complex than usual. GWT generates a serializer and deserializer for each class that could be transported across the wire to an RPC service. The difficulty comes in knowing which types had code generated, and which didn&#8217;t. GWT solves this problem for itself with the Serialization Policy file, where the compiler lists all of the classes that the client code will know how to deserialize.</p>
<p>This however leads to another problem: what happens when something unexpected gets in the way. Hibernate is the most used, and thus most complained about when it comes to Serialization problems. Hibernate turns any Collection object into a special &#8220;lazy&#8221; implementation that will only load your data when you ask for it. All very fine and well for a server bound application, but a GWT application needs all that data up front for serialization. When GWT comes to sending that List&lt;Message&gt; to the client, it chokes. It knows how to serialize an ArrayList, and LinkedList (since you worked with them on the client side), but a Hibernate List or PersistentCollection is a totally unknown type, so it&#8217;s not in the Serialization Policy, so the server side throws an Exception at you.</p>
<p>So how does <a title="EoD SQL Home Page" href="https://eodsql.dev.java.net/" target="_blank">EoD SQL</a> help with these problems? Read on to find out! <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> <span id="more-280"></span></p>
<h3>Loosing the Lazy Loading</h3>
<p>EoD SQL  (unlike most OR mapping layers) makes no attempt to understand the internal relationships between you objects. The reason for this is that EoD SQL is technically dialect neutral, it doesn&#8217;t actually care what you put into you @Select annotation so long as it can create a PreparedStatement and populate it with parameters. This frees you to take maximum advantage of database extensions, or weird SQL dialects. It also means that EoD SQL will never generate any SQL code for you: what you type is what gets executed.</p>
<p>Within a GWT application, you don&#8217;t have a way to block until a method is complete, and thus lazy-loading data becomes a chore, since you need to work with a lot of callbacks (a nice way of abstracting lazy-like-loading <a title="Property Binding with Async Callbacks" href="http://lemnik.wordpress.com/2008/07/22/easy-property-binding-and-aync-callbacks-in-gwt/" target="_blank">is posted on my blog</a>). This means that most of the object model given to GWT needs to be (at least partly) eager-loaded.</p>
<p>So because EoD SQL doesn&#8217;t do any lazy-loading, it &#8220;forces&#8221; you into thinking about how much data and what data you will be sending to the client. It takes a little getting used to, but over time you will find your code much clearer to read and running much faster (since less data comes from the database, fewer queries are run and the JavaScript has less data to deal with).</p>
<h2>Arrays instead of Collections</h2>
<p>The first trick to working with GWT is: when you need more than one object fetched from the database (which is most of the time), return an array instead of a Collection:</p>
<p><pre class="brush: java;">
public interface MessageQuery extends BaseQuery {

/*
* This is not a great way to do things in EoD SQL 2.0 when dealing with GWT.
* This method will return an ArrayList of Message objects, however the List implementation could
* possibly be changed in the future (not likely). Further the ArrayList is populated using the basic
* List.add(Object) method. The ArrayList will re-copy it's internal array over-and-over again as
* the ResultSet is scanned.
*
* So while this method will work with GWT, it's really not recommended.
*/
@Select(&quot;SELECT * FROM messages WHERE parent_id = ?1 ORDER BY date DESC LIMIT ?3 OFFSET ?2&quot;)
List&amp;lt;Message&amp;gt; selectChildMessagesAsList(int parentId, int start, int count);

/*
* This won't work at all with GWT. The DataSet may offer lazy-loading
* and some other wonderful tricks, but since the client code has no idea
* how to deal with a DataSet it's useless here. I thought I'd put it in for completeness.
*/
@Select(&quot;SELECT * FROM messages WHERE parent_id = ?1 ORDER BY date DESC LIMIT ?3 OFFSET ?2&quot;)
DataSet&amp;lt;Message&amp;gt; selectChildMessagesAsDataSet(int parentId, int start, int count);

/*
* This is the way to do it! Using only arrays for Serialization has a side effect
* on the GWT side of things: less JavaScript code for your clients to download.
* GWT understands how to deserialize arrays, and doesn't need to include
* Serialization code for different List implementations.
*/
@Select(&quot;SELECT * FROM messages WHERE parent_id = ?1 ORDER BY date DESC LIMIT ?3 OFFSET ?2&quot;)
Message[] selectChildMessagesAsArray(int parentId, int start, int count);

}
</pre></p>
<p>Now for the big question: why are arrays &#8220;so much better&#8221; than a List of some sort? EoD SQL takes fairly extreme measures to keep the performance of an Array as fast as possible. For the most part (that is: on most JDBC drivers) the array will be pre-sized and fetched backwards. This sounds very strange, but it is generally a lot faster than trying to work forwards and re-growing the array whenever it runs out of space (and then down-sizing it at the end). EoD SQL will run forwards if the JDBC driver requires it, but for the most part it runs backwards.</p>
<p>This technique will not only improve performance, JavaScript size, and simplicity of the code (arrays are just easier in most cases); it&#8217;ll also reduce the amount of memory your server uses (since the array is pre-sized and never copied).</p>
<p>Finally: because the type is declared as an array, you know exactly what Serialization code GWT is going to generate.</p>
<h2>Looking to the Future (EoD SQL 2.1)</h2>
<p>In EoD SQL 2.0 you can declare Collection objects as return types, but only as their interfaces (as you saw in the above code example). EoD SQL 2.1 has a new feature which allows you to declare concrete implementations as return types. This is the preferred method of declaration for GWT (since again: it minimizes the amount of JavaScript generated). A few nice little examples:</p>
<p><pre class="brush: java;">
public interface MessageQuery extends BaseQuery {

@Select(&quot;SELECT * FROM messages WHERE parent_id = ?1 ORDER BY date DESC LIMIT ?3 OFFSET ?2&quot;)
ArrayList&amp;lt;Message&amp;gt; selectMessages(int parentId, int start, int count);

@Select(&quot;SELECT title, date, author FROM messages WHERE parent_id IS NULL ORDER BY date&quot;)
MyCollectionImplementation&amp;lt;Message&amp;gt; selectTopLevelMessages();

}
</pre></p>
<p>The big difference between 2.0s handling of Collection objects, and 2.1 is that 2.1 will allow the Collection implementation (including those declared as their interfaces) to optimize their fetching of the data internally (if they are able). Thus returning a List or ArrayList will no longer cause the resize-resize-resize effect (or shouldn&#8217;t anyways). Collections will be given the same treatment as arrays in 2.1.</p>
<h2>Conclusion</h2>
<p>So we&#8217;ve looked at four different situations where EoD SQL works really well.</p>
<p>The concept to take away from this (I feel) is that: <em>with EoD SQL you are in total control of how the code is going to behave</em>.</p>
<p>If you need lazy-loading and scrolling data (like in our Swing example), you can use a DataSet; to minimize memory a DataIterator; and when lazy-loading can&#8217;t be used because of other constraints Collections and Arrays are available. Whatever the situation: EoD SQL is going to make life that little bit easier for you, without you giving up control of what goes on behind the scene.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lemnik.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lemnik.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lemnik.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lemnik.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lemnik.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lemnik.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lemnik.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lemnik.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lemnik.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lemnik.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lemnik.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lemnik.wordpress.com/280/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lemnik.wordpress.com/280/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lemnik.wordpress.com/280/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lemnik.wordpress.com&amp;blog=291115&amp;post=280&amp;subd=lemnik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lemnik.wordpress.com/2009/09/18/eod-sql-applied-%e2%80%93-part-5-5-gwt-applications/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c7af948b9fdf02628f82c3c11dd5b55?s=96&#38;d=wavatar" medium="image">
			<media:title type="html">lemnik</media:title>
		</media:content>
	</item>
	</channel>
</rss>
