<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-4133036378510199203</atom:id><lastBuildDate>Tue, 02 Feb 2010 15:36:21 +0000</lastBuildDate><title>Dot Neverland</title><description>Ooh! lookie here, yet another tech blog...</description><link>http://dotneverland.blogspot.com/</link><managingEditor>noreply@blogger.com (julian_za)</managingEditor><generator>Blogger</generator><openSearch:totalResults>49</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/DotNeverland" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="dotneverland" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-4933888136118793648</guid><pubDate>Fri, 29 Jan 2010 17:47:00 +0000</pubDate><atom:updated>2010-01-29T11:46:27.730-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">iPhone</category><category domain="http://www.blogger.com/atom/ns#">iPad</category><category domain="http://www.blogger.com/atom/ns#">Apple</category><title>A few thoughts on the iPad</title><description>Being the resident Mac fan I thought I might add my $0.02 on the iPad.&lt;br /&gt;&lt;br /&gt;Firstly the name is aweful, I can't believe that someone didn't start giggling the moment the suggestion was made. I have two theories about how this one got through; 1) The obvious : Steve Jobs made the suggestion therefore it was so. Or 2) The marketing guys were stereotypically stoned so that means a) no one thought much about the giggling and b) they were - well - stoned.&lt;br /&gt;&lt;br /&gt;Secondly, yes, it is a large iPhone. Rumor has it that the iPad design has gone back and forth between the drawing board and prototype stage a couple of times, in fact it's technologies became the basis of the iPhone, Now the leaked sources pretty much confirmed that the iPad was going to be using the iPhone OSX as a basis so the way the OS looks and works was not at all surprising, but I'm rather dissapointed that Apple chose to so blatantly follow the physical look of the iPhone, after all, it is a design which - while being very pretty - is getting on in the years. Now it was probably too late by then, but I hope Steve is going "Oh crap why didn't we think of that" when he watched Avatar.&lt;br /&gt;&lt;br /&gt;Thirdly it's not an iPhone at all. If you drill down into this logic you can quite easily make that argument that my laptop shares many of the characteristics of my iPhone by virtue of the fact that both can perform many of the same functions.&lt;br /&gt;&lt;br /&gt;So what is the iPad then, it's not a laptop, it's not a netbook, it's not a phone, it's also nothing at all like Bill Gate's vision for the tablet PC way back in 2001.&lt;br /&gt;&lt;br /&gt;The fact is that the iPad simply doesn't fall into any of the current categories, Apple has the rather daunting task of trying to create a completely new class of mobile device.&lt;br /&gt;&lt;br /&gt;This is both a blessing and a curse.&lt;br /&gt;&lt;br /&gt;If the iPad takes off, it will be great for Apple of course, being the pioneers in a new category, the problem of course is that in order for this new category to take off you need to have customers who have a reason to buy one.&lt;br /&gt;&lt;br /&gt;In other words you need a killer application.&lt;br /&gt;&lt;br /&gt;Now with that in mind here are a few things to ponder:&lt;br /&gt;&lt;br /&gt;The starting price is $499, which will translate into about +- R5500 after import duties (unless the importers decide to milk us dry). This makes it cheaper than many smartphones including HTC's Android phones. It also falls in the same pricing bracket as many Netbooks.&lt;br /&gt;&lt;br /&gt;It has quite an awesome battery life, You could use this device for most of the day, no boot up time and no hibernating.&lt;br /&gt;&lt;br /&gt;The type of functionality being offered by the iPad is basically 100% of what most mobile office workers need from a computing device, my boss for example spends his entire work day in meetings and uses his PC for nothing but e-mail and documents.&lt;br /&gt;&lt;br /&gt;I think therefore that there is potential for this device, however Apple is going to have to work harder to make that obvious.&lt;br /&gt;&lt;br /&gt;Now in closing it's worth noting that the device simple had no way to live up to the hype surrounding it. It's a version 1.0 device, it has many flaws and omissions which Apple will need to address (although at the price you DO get quite a bit), So quite honestly It mightn't be bad idea to wait for version 2.0.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-4933888136118793648?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/01/few-thoughts-on-ipad.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-5348488871911667786</guid><pubDate>Wed, 16 Dec 2009 11:54:00 +0000</pubDate><atom:updated>2009-12-16T05:20:14.309-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java scala groovy ruby clojure</category><title>No Next Big Language... Dunno, I suspect we may be stuck with one.</title><description>I've just read Alex Miller's &lt;a href="http://tech.puredanger.com/2009/12/15/the-next-big-language-is/"&gt;blog entry&lt;/a&gt; regarding the NBL (Next Big Language) or rather the fact that there will not be a NBL and that the age of multiple programming languages has arrived.&lt;br /&gt;&lt;br /&gt;I like the idea and I'm all for it to take off...&lt;br /&gt;&lt;br /&gt;It's just that in my experience companies, especially those who's core industry is not IT related tend to minimize risk as much as possible, and therefore try to stay as mainstream as possible.&lt;br /&gt;&lt;br /&gt;Java after all, quickly got pushed into the mainstream by companies like IBM and Oracle throwing their weight behind it, And consequently companies adopted it - I daresay - because it presented a much lower risk than many of it's competitors at the time such as Smalltalk.&lt;br /&gt;&lt;br /&gt;Furthermore companies seem to like to standardize on a programming language since it makes things like hiring and training and administration a lot easier.&lt;br /&gt;&lt;br /&gt;Its also these companies which keep the bulk of the programming community employed.&lt;br /&gt;&lt;br /&gt;Therefore as much the acceptance of multiple programming languages is growing among us programmers I see very little acceptance of it with these companies who fork out the majority of the cash to get systems built.&lt;br /&gt;&lt;br /&gt;Consider that Microsoft talked much about multiple programming languages when it released .Net and after almost 8 years you will be hard pressed to find a lot of work being done on .Net which isn't written in C# or VB.Net.&lt;br /&gt;&lt;br /&gt;Consequently then it's normal that one of the language will get used the most and therefore employ the most people and become the NBL.&lt;br /&gt;&lt;br /&gt;Now having said that I think Sun-Acle may actually be in a good position to take the multi-language concept mainstream, more so than Microsoft in 2002. For one thing the JVM is still the most portable runtime around, furthermore it's battle tested and smokin' fast. It's also widely adopted, supported and well understood.&lt;br /&gt;&lt;br /&gt;The JVM could allow a company to standardize on the infrastructure but pick the tool which will be the most productive for the development task at hand.&lt;br /&gt;&lt;br /&gt;Of course if this idea takes of, then we our next debate will be on the NBR (Next Big Runtime).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-5348488871911667786?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/12/no-next-big-language-dunno-i-suspect-we.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-8011175571053912989</guid><pubDate>Fri, 20 Nov 2009 05:23:00 +0000</pubDate><atom:updated>2009-11-19T21:38:37.272-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java7</category><title>Regarding Sun and Java 7 Closures</title><description>Here in South Africa we have a colloquial term: "oke". Pronounced "oak" it is basically a casual friendly reference for another male, kinda like "dude".&lt;br /&gt;&lt;br /&gt;The word itself is actually from the Afrikaans language and has transferred into daily use by English speaking South Africans males. How it originated in Afrikaans I don't really know, It might simply be the Afrikaans translation of the English "bloke".&lt;br /&gt;&lt;br /&gt;Typical usage is normally within a group of friends, for example you might tell your wife: "I'm off to have a beer with the &lt;span style="font-style: italic;"&gt;okes&lt;/span&gt;" or as a more general reference: "Geez! did you see that try by Brian Habanna! That &lt;span style="font-style: italic;"&gt;oke&lt;/span&gt; must be on speed or something".&lt;br /&gt;&lt;br /&gt;Now regarding Java 7 and closures, I have this to ask of Java's venerable leaders: "Dear Sun, what the [&lt;span style="font-style: italic;"&gt;expletive&lt;/span&gt;] are you okes doing?!"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-8011175571053912989?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/11/regarding-sun-and-java-7-closures.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-7245950927880005777</guid><pubDate>Wed, 23 Sep 2009 06:53:00 +0000</pubDate><atom:updated>2009-09-23T00:17:09.310-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">iPhone</category><category domain="http://www.blogger.com/atom/ns#">Apple</category><title>Apple and it's nefarious ways.</title><description>I hope this whole Google Voice App scandal completely blows up in Apple's face.&lt;br /&gt;&lt;br /&gt;A nice hefty fine consisting of least 9 digits would be perfect.&lt;br /&gt;&lt;br /&gt;Why you ask, because like other iPhone developers I'm rather fed up with the whole process.&lt;br /&gt;&lt;br /&gt;Furthermore Apple seems to forget that it's not a monopoly, I have plans to write software for the Android platform (when commercial apps come to my region), and quite honestly if the experience is better what reason could I possibly have to do iPhone work.&lt;br /&gt;&lt;br /&gt;A nice scandal like this might have the ability to force Apple to be a little more transparent with developers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-7245950927880005777?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/09/apple-and-its-nefarious-ways.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-9010227395401492924</guid><pubDate>Tue, 22 Sep 2009 18:41:00 +0000</pubDate><atom:updated>2009-09-22T13:11:40.680-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">fanboys of the world unite</category><title>The naked fan boy</title><description>I'm an Apple fan, and I am the proud owner of both a Mac book pro and an iPhone 3G. I've always been quite happy to admit that I am a "fanboy" of Apple products.&lt;br /&gt;&lt;br /&gt;It turns out though that I didn't actually know what a "fanboy" is.&lt;br /&gt;&lt;br /&gt;My understanding of what a fanboy is, is rather mundane: It's simply a person who is a fan of a product or brand or even a personality.&lt;br /&gt;&lt;br /&gt;My friend however has a different view, his view of what a fanboy is seems rather more suited to someone who is a member of Al-Qaeda.&lt;br /&gt;&lt;br /&gt;Now much as I like Apple I'm not blowing myself up because someone happens to criticise the new iPod.&lt;br /&gt;&lt;br /&gt;So in order to reduce my ignorance I consulted that completely reliable source of truth: Wikipedia to find out more about what a fanboy is. This is what I found:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"Fanboy is a term originating in the United States[citation needed], used to describe a male who is highly devoted and biased in opinion towards a single subject or hobby within a given field. The earliest known recorded use is dated 1919.[5]"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The key phrases here are "highly devoted" and "biased".&lt;br /&gt;&lt;br /&gt;Kinda strong words for  something that should be as black and white as a technology choice.&lt;br /&gt;&lt;br /&gt;The fact is though that if you step back and look at the whole IT scene and apply this definition you can't help but feel that us computer geeks are nothing much but a whole bunch of fanboys. Here is a short non exhaustive list of some of the fanboy debates I've been privy to during my time as a computer geek:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;AMD vs Intel.&lt;/li&gt;&lt;li&gt;ATI vs NVidia.&lt;/li&gt;&lt;li&gt;3Dfx vs NVidia.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;.Net vs Java.&lt;/li&gt;&lt;li&gt;C++ vs Java.&lt;/li&gt;&lt;li&gt;[for brevity's sake: Insert your language of preference here] vs Java.&lt;/li&gt;&lt;li&gt;RISC vs CISC.&lt;/li&gt;&lt;li&gt;Linux vs BSD.&lt;/li&gt;&lt;li&gt;Linux vs Windows.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;OS2 Warp vs Windows 95.&lt;/li&gt;&lt;li&gt;Xbox vs Playstation.&lt;/li&gt;&lt;li&gt;Microsoft vs Open Source.&lt;/li&gt;&lt;li&gt;OSX vs Windows.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;What really amazes me though is how the same person who can explain to you the nuances of Lisp on the one hand, can then on the other hand scream bloody murder because you bought product X instead of Y and that makes you an idiot because product Y is clearly 5 attoseconds faster than product X and unlike product X, product Y's maker does not sacrifice little children in order to gain market share.&lt;br /&gt;&lt;br /&gt;And we're supposed to be that smart guys....&lt;br /&gt;&lt;br /&gt;I guess it's perhaps a reflection of our passion, by in large technology people are very passionate about what they do and have a strong belief in the importance of what they do, after all; no other profession has caused as a dramatic a change in the last few decades to the way the world works as we have.&lt;br /&gt;&lt;br /&gt;Of course it's perhaps also indicative of the fact that when it's all said and done, Computer geeks are just as driven by emotion as the rest of humanity.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-9010227395401492924?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/09/naked-fan-boy.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-8110152156382947394</guid><pubDate>Fri, 18 Sep 2009 11:10:00 +0000</pubDate><atom:updated>2009-09-18T09:05:51.036-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">scala</category><title>A quick sample of Lists and Tuples in Scala</title><description>So I've been challenged with a simple problem to solve in Scala, that is; to take a List of values and and then sum each corresponding value in the list together into a resultant list.&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[1,2,3,4,5]&lt;/span&gt; becomes&lt;span style="font-weight: bold;"&gt; [3,5,7,9]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can accomplish this in Scala using the List class and its functions, these include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;zip&lt;/span&gt; : this function takes an input list and creates a list of tuples with each mapping pair, discarding jagged values.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;tail&lt;/span&gt; : this function returns a list minus the first element of the list on which tail is performed.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;foldLeft&lt;/span&gt; : combines the elements of the list together with a seed value (in my case I use a target List).&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;reverse&lt;/span&gt; : reverses the order of the list.&lt;/li&gt;&lt;/ul&gt;so here is the code to do this:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;object SumPairs extends Application {&lt;br /&gt;&lt;br /&gt;val numbers = List(1,2,3,4,5);&lt;br /&gt;val result = numbers.zip(numbers.tail)&lt;br /&gt;             .foldLeft(List[Int]()) (&lt;br /&gt;                (list, y) =&amp;gt; {&lt;br /&gt;                   y._1 + y._2 :: list&lt;br /&gt;                }&lt;br /&gt;              )&lt;br /&gt;             .reverse;&lt;br /&gt;println(result);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Basically this works as follows:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;I create a List of Tuples of each adjacent value in the List by getting the tail of the List.&lt;/li&gt;&lt;li&gt;I get each Tuple in the list, sum it and prepend it to the List returned by "foldLeft".&lt;/li&gt;&lt;li&gt;I reverse the List to fix the order as a result of doing a prepend.&lt;/li&gt;&lt;/ol&gt;Now this is is designed to be functional but not overly complex (at least I hope not), Since I'm still fairly green in the Scala dark arts I'd like to hear on improvements.&lt;br /&gt;&lt;br /&gt;BTW the challenge I'm talking about can be found &lt;a href="http://github.com/apauley/RandomHacks/tree/master/CodeSnippets/SumPairs/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;UPDATE:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;Another solution would be to use &lt;i&gt;List.flatMap&lt;/i&gt; which basically takes a function which returns an &lt;i&gt;Iterable &lt;/i&gt;and appends it to a function, it pretty similar, It's maybe a little more concise, I'll let you decide:&lt;/div&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;val numbers = List(1,2,3,4,5);&lt;br /&gt;numbers.zip(numbers.tail).flatMap {&lt;br /&gt;     value =&amp;gt; {&lt;br /&gt;          List(value._1+value._2);&lt;br /&gt;      }&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-8110152156382947394?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/09/quick-sample-of-lists-and-tuples-in.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-3245793227443394452</guid><pubDate>Sat, 01 Aug 2009 06:52:00 +0000</pubDate><atom:updated>2009-08-01T00:25:24.572-07:00</atom:updated><title>Dynamic Data Access Objects for JPA</title><description>JPA is pretty cool and JPA 2.0 looks even better, in a standardised way JPA has managed to rid us of the pain of CRUD, which; when it's all said and done is still the heart of most enterprise apps.&lt;br /&gt;&lt;br /&gt;One thing that isn't very clear is how to implement the Data Access Object pattern in JPA. For one thing EntityManager pretty much takes car of abstracting your data access and that as some notable &lt;a href="http://www.adam-bien.com/roller/abien/entry/generic_crud_service_aka_dao"&gt;authors&lt;/a&gt; have pointed out you don't necessarily need to create a DAO at all. I agree with this but there are a couple of problems I keep running in to:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;How to manage the vast numbers of queries that you get when you start doing anything useful in an Enterprise System. &lt;/li&gt;&lt;li&gt;Testing is made hard in that &lt;span style="font-style: italic;"&gt;EntityManager &lt;/span&gt;is the pits to test especially when you start writng queries with many parameter, inevitably you end up with a vast brittle network of mocked objects which don't actually add any value and make my life miserable every time you make a change.&lt;/li&gt;&lt;li&gt;Named queries are great but but they really bloat your code for a multitude of "adhoc" queries which just seem overkill for me to put into a &lt;span style="font-style: italic;"&gt;NamedQuery&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;Queries are still strings and until JPA2.0 rolls out we can't avoid this indirection. One of things that the DAO pattern used to provide is a method for a query which normally named the purpose of the query and named its parameters and typed them, which was a real blessing when you had to work on code several years old.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Of course the other side of the coin is that we don't want to bring back a lot of boilerplate code, and end up writing too much custom stuff which re-implements features that JPA already has.&lt;br /&gt;&lt;br /&gt;My suggestion therefore is to shamelessly steal ideas from Ruby on Rails albeit in a Java-fied manner.&lt;br /&gt;&lt;br /&gt;The idea in question is the concept of a finder method in Rails. The one where you can simply call a class method on your Entity: &lt;span style="font-weight: bold; font-style: italic;"&gt;EntityClass.findByName(theName)&lt;/span&gt; and thanks to the magic of Ruby's MOP; Rail's &lt;span style="font-style: italic;"&gt;ActiveRecord&lt;/span&gt; pattern ORM framework can dynamically generate a sql query to go hunt for records for the entity where the &lt;span style="font-style: italic;"&gt;name &lt;/span&gt;column is equal to "&lt;span style="font-style: italic;"&gt;theName&lt;/span&gt;". All this without you having to write a single line of additional code.&lt;br /&gt;&lt;br /&gt;Of course by now most readers will be smiling since they know that Java definitely has no Meta class facilities. This is of course very true, We can't replicate the exact flexibility of ActiveRecord but we can get some features by resorting to the closest thing Java gives; none other than the good old Dynamic Proxy.&lt;br /&gt;&lt;br /&gt;Lets take the following interface:&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;&lt;br /&gt;package repo;&lt;br /&gt;import java.util.Collection;&lt;br /&gt;&lt;br /&gt;public interface AnEntityRepository extends EntityRepository&amp;lt;AnEntity&amp;gt; {&lt;br /&gt;&lt;br /&gt; AnEntity findByName(String name);&lt;br /&gt;&lt;br /&gt; Collection&amp;lt;AnEntity&amp;gt; findAll();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;This interface extends an interface called &lt;span style="font-weight: bold; font-style: italic;"&gt;EntityRepository &lt;/span&gt;(this is just a little marker interface so that I can hit &lt;span style="font-style: italic;"&gt;F4 &lt;/span&gt;in Eclipse and I also use the type parameter to link the interface to an Entity) Each method on the interface maps to a specific query we want to run against an Entity class "&lt;span style="font-weight: bold; font-style: italic;"&gt;AnEntity&lt;/span&gt;", the first method is a simple &lt;span style="font-style: italic;"&gt;findByName &lt;/span&gt;which will have JPAQL generated dynamically, the next one is &lt;span style="font-style: italic;"&gt;findAll &lt;/span&gt;which we map to a Named query.&lt;br /&gt;&lt;br /&gt;Here is how we will do it: we will pass this interface to the dynamic proxy framework together with our own code to handle invocations which will do the following: first try map the invoked method name to a named query, if that fails we check if the method name starts with "&lt;span style="font-style: italic;"&gt;findBy&lt;/span&gt;" we then do some funky string gymnastics on the rest of the method name to attempt to extract properties of the targeted entity and then build some &lt;span style="font-style: italic;"&gt;JPAQL &lt;/span&gt;from that, then create the query and map the passed method parameters as query parameters to it. If any of the previous steps fail we blow up with a Runtime exception.&lt;br /&gt;&lt;br /&gt;First step: The proxy framework requires an invocation handler (&lt;span style="font-weight: bold; font-style: italic;"&gt;java.lang.reflect.InvocationHandler&lt;/span&gt;), this class is responsible for handling method dispatches from the proxied interface, mine is called &lt;span style="font-weight: bold; font-style: italic;"&gt;RepoInvocationHandler &lt;/span&gt;(Repo being short for Repository):&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;&lt;br /&gt;package repo;&lt;br /&gt;&lt;br /&gt;import java.lang.reflect.InvocationHandler;&lt;br /&gt;import java.lang.reflect.Method;&lt;br /&gt;&lt;br /&gt;public class RepoInvocationHandler implements InvocationHandler {&lt;br /&gt;&lt;br /&gt; public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;the &lt;span style="font-style: italic;"&gt;invoke &lt;/span&gt;method will actually handle all the dispatches coming from the proxy, the parameters indicate the proxy instance that called with method, the actual method being called and the parameters that were passed to the method respectively. The first iteration of this invocation handler will be to build a JPAQL from the simple finder method, note that we pass a class in to the invocation handler, this is the entity we wish to query. Here is the implementation of the &lt;span style="font-weight: bold; font-style: italic;"&gt;RepoInvocationHandler &lt;/span&gt;to do precisely that:&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;&lt;br /&gt;package repo;&lt;br /&gt;&lt;br /&gt;import java.lang.reflect.InvocationHandler;&lt;br /&gt;import java.lang.reflect.Method;&lt;br /&gt;import java.util.Collections;&lt;br /&gt;import javax.persistence.EntityManager;&lt;br /&gt;import javax.persistence.Query;&lt;br /&gt;&lt;br /&gt;public class RepoInvocationHandler implements InvocationHandler {&lt;br /&gt;&lt;br /&gt; Class&amp;lt;?&amp;gt; targetEntity;&lt;br /&gt; EntityManager entityManager;&lt;br /&gt;&lt;br /&gt; public RepoInvocationHandler(Class&amp;lt;?&amp;gt; targetEntity, EntityManager entityManager) {&lt;br /&gt;    this.targetEntity = targetEntity;&lt;br /&gt;    this.entityManager = entityManager;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {&lt;br /&gt;    String name = method.getName();&lt;br /&gt;    String query = buildQuery(name);&lt;br /&gt;    Query q = entityManager.createQuery(query);&lt;br /&gt;    int parmIndex = 0;&lt;br /&gt;    for (Object arg : args) {&lt;br /&gt;      q.setParameter(parmIndex++, arg);&lt;br /&gt;    }&lt;br /&gt;    //we can add the functionality to return a single result or multiples&lt;br /&gt;    //by checking if the return type is a Collection instance.&lt;br /&gt;    if (Collections.class.isAssignableFrom(method.getReturnType())) {&lt;br /&gt;       return q.getResultList();&lt;br /&gt;    } else {&lt;br /&gt;       return q.getSingleResult();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; String uncapatalise(String property) {&lt;br /&gt;    return property.substring(0,1).toLowerCase()+property.substring(1);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; String buildQuery(String name) {&lt;br /&gt;   if (name.startsWith("findBy")) {&lt;br /&gt;      String property = name.substring("findBy".length());&lt;br /&gt;      //uncapitalise to adhere to conventions&lt;br /&gt;      property = uncapatalise(property);&lt;br /&gt;      return "select x from " + targetEntity.getName() + " x where x." + property + " = ?";&lt;br /&gt;   }&lt;br /&gt;   throw new RuntimeException("oops, looks "+name+" is not a finder method");&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;/pre&gt;A note: you can make finder methods as complex as you want, this case just takes a single property and does an equals to query (&lt;span style="font-style: italic;"&gt;select x from repo.AnEntity x where x.name = ?&lt;/span&gt;). The possibilities -however - are endless, Ive implemented this with AND and OR functionality so I can write "&lt;span style="font-style: italic;"&gt;findByNameAndSurname(String name, String surname)&lt;/span&gt; or "&lt;span style="font-style: italic;"&gt;findByNameOrSurname(String name, String surname)&lt;/span&gt; with &lt;span style="font-style: italic;"&gt;n &lt;/span&gt;levels of predicates. however I want to keep the features of the generated finder method simple, if your query becomes to complex it should become a &lt;span style="font-style: italic;"&gt;NamedQuery&lt;/span&gt;, which then brings us to the next iteration.&lt;br /&gt;&lt;br /&gt;The next iteration of the invocation handler adds the ability to utilise &lt;span style="font-style: italic;"&gt;NamedQuery &lt;/span&gt;functionality in order to handle complex queries, it also allows us to override the standard finder functionality:&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;package repo;&lt;br /&gt;&lt;br /&gt;import java.lang.reflect.InvocationHandler;&lt;br /&gt;import java.lang.reflect.Method;&lt;br /&gt;import java.util.Collections;&lt;br /&gt;import javax.persistence.EntityManager;&lt;br /&gt;import javax.persistence.Query;&lt;br /&gt;&lt;br /&gt;public class RepoInvocationHandler implements InvocationHandler {&lt;br /&gt;&lt;br /&gt; Class&amp;lt;?&amp;gt; targetEntity;&lt;br /&gt; EntityManager entityManager;&lt;br /&gt;&lt;br /&gt; public RepoInvocationHandler(Class&amp;lt;?&amp;gt; targetEntity, EntityManager entityManager) {&lt;br /&gt;  this.targetEntity = targetEntity;&lt;br /&gt;  this.entityManager = entityManager;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {&lt;br /&gt;  String name = method.getName();&lt;br /&gt;&lt;br /&gt;  Query q = null;&lt;br /&gt;  //Note that I create a named query in the format EntityClassSimpleName.methodName&lt;br /&gt;  //this is because named queries are global not so by prefixing the entity class name&lt;br /&gt;  //it mostly eliminates duplicate named queries, it also gives a useful convention.&lt;br /&gt;  try {&lt;br /&gt;      String namedQuery = targetEntity.getSimpleName()+"."+method.getName();&lt;br /&gt;      q = entityManager.createNamedQuery(namedQuery);&lt;br /&gt;  } catch (IllegalArgumentException e) {&lt;br /&gt;      //yes there are more efficient ways to do this, however this is easiest&lt;br /&gt;  }&lt;br /&gt;  //no named query so lets build one from the method name&lt;br /&gt;  if (q == null) {&lt;br /&gt;      String query = buildQuery(name);&lt;br /&gt;      q = entityManager.createQuery(query);&lt;br /&gt;  }&lt;br /&gt;  int parmIndex = 0;&lt;br /&gt;  for (Object arg : args) {&lt;br /&gt;      q.setParameter(parmIndex++, arg);&lt;br /&gt;  }&lt;br /&gt;  if (Collections.class.isAssignableFrom(method.getReturnType())) {&lt;br /&gt;      return q.getResultList();&lt;br /&gt;  } else {&lt;br /&gt;      return q.getSingleResult();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;String uncapatalise(String property) {&lt;br /&gt;  return property.substring(0,1).toLowerCase()+property.substring(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;String buildQuery(String name) {&lt;br /&gt;&lt;br /&gt;  if (name.startsWith("findBy")) {&lt;br /&gt;      String property = name.substring("findBy".length());&lt;br /&gt;      //uncapitalise to adhere to conventions&lt;br /&gt;      property = uncapatalise(property);&lt;br /&gt;      return "select x from " + targetEntity.getName() + " x where " + property + " = ?";&lt;br /&gt;  }&lt;br /&gt;  throw new RuntimeException("oops, looks "+name+" is not a finder method");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;For reference purposes I've included what the &lt;span style="font-style: italic;"&gt;NamedQuery &lt;/span&gt;declaration would look like on &lt;span style="font-weight: bold; font-style: italic;"&gt;AnEntity &lt;/span&gt;for the method "&lt;span style="font-style: italic;"&gt;findAll&lt;/span&gt;":&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;@NamedQueries( {&lt;br /&gt; @NamedQuery(name="AnEntity.findAll", query="select x from AnEntity x")&lt;br /&gt;})&lt;br /&gt;public class AnEntity implements Serializable{&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;And there we have the basic functionality I want to implement, the last thing we need to do is create the proxy, I have a simple factory which takes in the Interface (I've forced all the interfaces to extend the &lt;span style="font-style: italic;"&gt;EntityRepository &lt;/span&gt;interface, for documentation and typing purposes) as follows:&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;package repo;&lt;br /&gt;&lt;br /&gt;import java.lang.reflect.ParameterizedType;&lt;br /&gt;import java.lang.reflect.Proxy;&lt;br /&gt;import javax.persistence.EntityManager;&lt;br /&gt;&lt;br /&gt;public class EntityRepositoryFactory {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public static &amp;lt;T extends EntityRepository&amp;lt;?&amp;gt;&amp;gt; T createEntityRepository(Class&amp;lt;T&amp;gt; homeRepositoryClass, EntityManager entityManager) {&lt;br /&gt;  ParameterizedType type = (ParameterizedType) homeRepositoryClass.getGenericInterfaces()[0];&lt;br /&gt;  Class&amp;lt;?&amp;gt; entityType = (Class&amp;lt;?&amp;gt;) type.getActualTypeArguments()[0];&lt;br /&gt;  return (T) Proxy.newProxyInstance(&lt;br /&gt;                  Thread.currentThread().getContextClassLoader(),&lt;br /&gt;                  new Class[] {homeRepositoryClass},&lt;br /&gt;                  new RepoInvocationHandler(entityType, entityManager));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Finally using this interface is as simple as creating it via the factory and then calling the methods:&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;   AnEntityRepository repo = EntityRepositoryFactory&lt;br /&gt;                              .createEntityRepository(AnEntityRepository.class, entityManager);&lt;br /&gt;  AnEntity entity = repo.findByName("Fred");&lt;br /&gt;  Collection&amp;lt;AnEntity&amp;gt; allEntities = repo.findAll();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;A few final notes:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;For testing purposes you simply mock out the &lt;span style="font-style: italic;"&gt;&lt;/span&gt;interface, either with a mocking framework or an anonymous classes.&lt;/li&gt;&lt;li&gt;There's nothing stopping you from creating the factory in Spring if you are using Spring.&lt;/li&gt;&lt;li&gt;I wish EJB3.1 had introduced a Factory concept for creating instances of beans much like Spring has this would make life easer in the EJB world.&lt;/li&gt;&lt;li&gt;Sooner or later you will need to create pagination, you can add this functionality by using parameter annotations, I was thinking of something like: "&lt;span style="font-weight: bold; font-style: italic;"&gt;findAll(@Start int start,@Max int max)&lt;/span&gt;";.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-3245793227443394452?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/07/dynamic-data-access-objects-for-jpa.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-6455786466235126676</guid><pubDate>Mon, 08 Jun 2009 17:27:00 +0000</pubDate><atom:updated>2009-06-08T11:04:10.876-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java scala groovy ruby clojure</category><title>Is Javaless Java reaching critical mass?</title><description>There is a lot of talk about how this is possibly the last JavaOne, as Oracle is about to buy Sun out.&lt;br /&gt;&lt;br /&gt;However if you look at what everybody was at talking about at JavaOne you can't but help get the idea that JavaOne is an anachronism any way, this trend seems to involve:&lt;br /&gt;&lt;br /&gt;- JavaFX.&lt;br /&gt;- Groovy.&lt;br /&gt;- Scala.&lt;br /&gt;- JRuby.&lt;br /&gt;- Honourable mentions for Clojure and Jython.&lt;br /&gt;&lt;br /&gt;It's hard to miss the lack of Java here...&lt;br /&gt;&lt;br /&gt;Ok so people are interested in other languages in the JVM, however interest doesn't necessarily translate into use. &lt;br /&gt;&lt;br /&gt;This brings me to my question: have alternative JVM languages gone mainstream? can I go to my client who is still trying to get COBOL out of their system and confidently sell him on one of these alternative languages?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-6455786466235126676?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/06/is-javaless-java-reaching-critical-mass.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">8</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-170513670340814921</guid><pubDate>Mon, 01 Jun 2009 16:09:00 +0000</pubDate><atom:updated>2009-06-01T10:31:25.364-07:00</atom:updated><title>Enterprise Scala Beans</title><description>This is a "hello world" tutorial to show how to get a Scala class configured to run as an EJB 3.0 inside a JEE app server, in this case Glassfish V2.&lt;br /&gt;&lt;br /&gt;Why exactly are you doing this?&lt;br /&gt;&lt;br /&gt;Well mostly to see if it's possible, one of Scala's benefits is the fact that it runs on a Java Virtual Machine with Java interoperability as a feature, this would allow developers to make use of Scala's additional language features to create a little more concise code and still make use of an enterprise's existing investments in JEE.&lt;br /&gt;&lt;br /&gt;First up.&lt;br /&gt;&lt;br /&gt;To create EJB3.0 beans, a language will need to support the following:&lt;br /&gt;&lt;br /&gt;- A compiler which compiles to standard Java classes (with the actual implementation bean using the standard no-args constructor for instantiation).&lt;br /&gt;- A construct which can map logically and physically to a Java interface in order to support the EJB's local and remote interfaces.&lt;br /&gt;- Annotations (although you could get away with ejb-jar.xml but that sucks) in order to integrate into the EJB container.&lt;br /&gt;&lt;br /&gt;Huh?! you need interfaces! Scala doesn't have interfaces!.&lt;br /&gt;&lt;br /&gt;Scala does not have interfaces per se, however it has traits (basically interfaces which allow implementation of methods). As it turns out Scala compiles the basic type skeleton specified by the trait into an interface.&lt;br /&gt;&lt;br /&gt;Now with that out the way here's the code:&lt;br /&gt;&lt;br /&gt;First we define the Trait which will serve as a remote Interface, for our example we are going to define a simple trait called &lt;span style="font-weight:bold;"&gt;ITest&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;package net.jexenberger&lt;br /&gt;&lt;br /&gt;trait ITest {&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  def doStuff(x: String) : String;&lt;br /&gt; &lt;br /&gt;  def hello() : Unit = {&lt;br /&gt;    System.out.println(&amp;quot;hello world&amp;quot;);&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This trait has one unimplemented method and one implemented method (this is to illustrate that you don't lose the functionality of traits with Scala when you have to work in a pure interface world).&lt;br /&gt;&lt;br /&gt;Secondly we define the actual implemention of the trait &lt;span style="font-weight:bold;"&gt;ITest&lt;/span&gt; in a class &lt;span style="font-weight:bold;"&gt;TestBean &lt;/span&gt;as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;package net.jexenberger&lt;br /&gt;&lt;br /&gt;import javax.ejb._;&lt;br /&gt;import javax.annotation._;&lt;br /&gt;&lt;br /&gt;@Stateless { val name=&amp;quot;ScalaTestBean&amp;quot;, val mappedName=&amp;quot;ScalaTestBean&amp;quot; }&lt;br /&gt;@Remote {val value = Array(classOf[ITest])}&lt;br /&gt;class TestBean extends ITest {&lt;br /&gt; &lt;br /&gt;  @Resource&lt;br /&gt;  var ctx:SessionContext = null&lt;br /&gt; &lt;br /&gt;  def doStuff(x : String)  : String = {&lt;br /&gt;      &amp;quot;hello &amp;quot;+x+&amp;quot; called with &amp;quot;+this.ctx.toString()&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  @PostConstruct&lt;br /&gt;  def postConstruct() : Unit = {&lt;br /&gt;    System.out.println(&amp;quot;Post Construct called&amp;quot;);&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Note the following about the implementation:&lt;br /&gt;&lt;br /&gt;Firstly you will see that annotations are defined almost exactly the same as in Java, however the annotations have been "Scalafied" to look more Scala like with the use val and functions and of course Arrays, as illustrated by the &lt;span style="font-weight:bold;"&gt;@Remote&lt;/span&gt; usage above the class declaration. Finally we also inject the &lt;span style="font-weight:bold;"&gt;java.ejb.SessionContext&lt;/span&gt; object as an instance variable &lt;span style="font-style:italic;"&gt;ctx&lt;/span&gt; and a &lt;span style="font-weight:bold;"&gt;@PostConstruct&lt;/span&gt; method; &lt;span style="font-weight:bold;"&gt;postConstruct()&lt;/span&gt;, this is to test that we can map Scala variables and methods directly to Java methods and variables in order to utilise the EJB container's dependency injection mechanism and to integrate into the EJB lifecycle.&lt;br /&gt;&lt;br /&gt;We can now package the bean into a standard java jar (with &lt;span style="font-weight:bold;"&gt;META-INF/ejb-jar.xml&lt;/span&gt; if required), it can then be deployed as part of an EAR or indeed as a standalone EJB application. I built and packaged the project using Maven's standard &lt;span style="font-style:italic;"&gt;maven-ejb-plugin&lt;/span&gt; and the Maven Scala plugin (&lt;span style="font-style:italic;"&gt;org.scala-tools.maven-scala-plugin&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;Finally we write a remote client to invoke the Scala EJB:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;package net.jexenberger;&lt;br /&gt;&lt;br /&gt;import java.util.Properties;&lt;br /&gt;import javax.naming.Context;&lt;br /&gt;&lt;br /&gt;public class JavaTest&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) throws Exception {&lt;br /&gt;        Properties props = new Properties();&lt;br /&gt;        props.setProperty(&amp;quot;java.naming.factory.initial&amp;quot;, &amp;quot;com.sun.enterprise.naming.SerialInitContextFactory&amp;quot;);&lt;br /&gt;        props.setProperty(&amp;quot;java.naming.factory.url.pkgs&amp;quot;, &amp;quot;com.sun.enterprise.naming&amp;quot;);&lt;br /&gt;        props.setProperty(&amp;quot;java.naming.factory.state&amp;quot;, &amp;quot;com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl&amp;quot;);&lt;br /&gt;&lt;br /&gt;        Context ctx = new javax.naming.InitialContext(props);&lt;br /&gt;        ITest instance = (ITest) ctx.lookup(&amp;quot;ScalaTestBean&amp;quot;);&lt;br /&gt;        System.out.println(instance.doStuff(&amp;quot;world&amp;quot;));&lt;br /&gt;        instance.hello();&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Note that is a straight Java class, used to illustrate that the EJB could still be consumed by using straight Java code, also note that ITest is recognised as a standard Java interface.&lt;br /&gt;&lt;br /&gt;The output produced by by running the client is:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;net.jexenberger.personal._ITest_Wrapper@4a1c06a1&lt;br /&gt;hello world called with ScalaTestBean; id: [B@12d9e34&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And on the server we get:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;[#&amp;#124;2009-06-01T13:13:12.538+0200&amp;#124;INFO&amp;#124;sun-appserver2.1&amp;#124;javax.enterprise.system.stream.out&amp;#124;_ThreadID=23;_ThreadName=p: thread-pool-1; w: 9;&amp;#124;&lt;br /&gt;Post Construct called&amp;#124;#]&lt;br /&gt;&lt;br /&gt;[#&amp;#124;2009-06-01T13:13:12.541+0200&amp;#124;INFO&amp;#124;sun-appserver2.1&amp;#124;javax.enterprise.system.stream.out&amp;#124;_ThreadID=23;_ThreadName=p: thread-pool-1; w: 9;&amp;#124;&lt;br /&gt;hello world&amp;#124;#]&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And there we have it. An EJB 3.0 compliant Scala Enterprise Bean!&lt;br /&gt;&lt;br /&gt;A final note on packaging and deployment:&lt;br /&gt;&lt;br /&gt;Scala obviously requires its supporting runtime and libraries, in order to do this, you will need to package and specify the dependencies in an EAR or copy it into a location in your app Server. In Glassfish the easiest thing to do is copy scala-library.jar to &lt;span style="font-style:italic;"&gt;[Glassfish home]&lt;/span&gt;/lib/endorsed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-170513670340814921?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/06/enterprise-scala-beans.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-6884977072540558369</guid><pubDate>Thu, 28 May 2009 18:33:00 +0000</pubDate><atom:updated>2009-06-03T06:58:01.813-07:00</atom:updated><title>First iPhone application: iBoredom</title><description>Yes this is a shameless punt...&lt;br /&gt;&lt;br /&gt;But hey, if you like it, &lt;a href="http://appshopper.com/entertainment/iboredom"&gt;buy it&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It's and iPhone app called iBoredom, the perfect companion for when you are bored...&lt;br /&gt;&lt;br /&gt;It aggregates sites with a random content feature like Stumbleupon and wikipedia and allows you to randomly browse content, almost like a remote control.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-6884977072540558369?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/05/first-iphone-application-iboredom.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-3988454149254214832</guid><pubDate>Wed, 06 May 2009 16:50:00 +0000</pubDate><atom:updated>2009-05-06T12:53:39.416-07:00</atom:updated><title>A Groovy DSL for working with the filesystem.</title><description>I've recently come back to the idea of using Java as a shell scripting tool. There are a couple of reasons for this; firstly Java is familiar with all my developers, secondly Java's startup time has seriously improved with the 6u1x series of the Hotspot VM, finally Java has a brilliant dynamic language which slips over core Java in the form of Groovy.&lt;br /&gt;&lt;br /&gt;However there are still some problems; the most immediately obvious is the fact the shell scripting often involves a lot file manipulation and calling of external processes, tasks which involve a lot of navigation around the file system. &lt;br /&gt;&lt;br /&gt;Unfortunately Java has never had a &lt;span class="Apple-style-span" style="font-style: italic;"&gt;chdir()&lt;/span&gt; function, so that means you have to work with everything as an absolute file path, often resulting in some nasty string based code.&lt;br /&gt;&lt;br /&gt;Fortunately Groovy can overcome this with it's ability to create Domain Specific Languages. We can use these features to map to standard file system concepts.&lt;br /&gt;&lt;br /&gt;Lets take the following bash script. This script  creates a directory in the home folder, downloads and unzips a contrived application called myapp into the directory and then creates a shortcut link on the desktop:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# create directory in home&lt;br /&gt;mkdir ~/myapp&lt;br /&gt;# change to directory&lt;br /&gt;cd ~/myapp&lt;br /&gt;# download myapp.zip with wget&lt;br /&gt;wget http://www.myapp.com/download/myapp.zip&lt;br /&gt;# extract myapp.zip using unp&lt;br /&gt;unp myapp.zip&lt;br /&gt;# delete myapp.zip&lt;br /&gt;rm myapp.zip&lt;br /&gt;# change Desktop in home&lt;br /&gt;cd ~/Desktop&lt;br /&gt;# create shortcut and append an entry to the executable to myapp&lt;br /&gt;&gt; myapp.desktop&lt;br /&gt;echo "Exec=${HOME}/myapp/myappExecutable" &gt;&gt; myapp.desktop&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;While we couldn't map this exactly in Groovy we could at least do something similar, this is what I came up with:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;//create the my app directory in home&lt;br /&gt;myAppPath = (~Path + "myapp")&lt;br /&gt;//download and extract&lt;br /&gt;myAppPath.exec "wget -q http://www.myapp.com/download/myapp.zip" .exec "unp myapp.zip"&lt;br /&gt;//delete myapp.zip&lt;br /&gt;myAppPath - "myapp.zip"&lt;br /&gt;//create a pointer to myApp executable&lt;br /&gt;myAppPath/"myAppExecutable"&lt;br /&gt;//create shortcut in Desktop folder&lt;br /&gt;~Path/"Desktop"/"myapp.desktop" &gt;&gt; "EXEC=${myAppPath}"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;How would we accomplish this in Groovy.&lt;br /&gt;&lt;br /&gt;First we define a class called Path with the ability to ability to build up a path via an append method and a &lt;span class="Apple-style-span" style="font-style: italic;"&gt;toString&lt;/span&gt; method to create a string representation of the path:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class Path {&lt;br /&gt;&lt;br /&gt;Stack pathStack;&lt;br /&gt;&lt;br /&gt;Path {&lt;br /&gt;  pathStack = new Stack();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public append(String element) {&lt;br /&gt;   pathStack.push "element"&lt;br /&gt;   return this&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String toString() {&lt;br /&gt;  //code to build up the path from the stack&lt;br /&gt;  .....&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now we use Groovy's operator overloading feature to be able to add write &lt;span class="Apple-style-span" style="font-style: italic;"&gt;pathInstance / "aPathelement"&lt;/span&gt;, to do this we simply implement the method &lt;span class="Apple-style-span" style="font-style: italic;"&gt;div&lt;/span&gt; on the Path class:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public div(String element) {&lt;br /&gt;return append element;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Next we want to be able to quickly get an instance of Path which points to the home directory quickly. I wanted to map this to Bash's '~' home folder expansion. Fortunately we can implement this by overloading the bitwise operator on a static method on the path object:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public static Path bitwiseNegate() {&lt;br /&gt;return new Path()/System.getProperty("user.home")&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This allows us to write &lt;span class="Apple-style-span" style="font-style: italic;"&gt;~Path&lt;/span&gt; to create a Path instance to point to the home folder.&lt;br /&gt;&lt;br /&gt;Next we want to be able to easily add a new folder to the existing Path instance and then point the Path instance to the new directory by overloading the &lt;span class="Apple-style-span" style="font-style: italic;"&gt;+&lt;/span&gt; operator by implementing the add method:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public Path plus(String element) {&lt;br /&gt;this / element&lt;br /&gt;f = new File(toString())&lt;br /&gt;if !(f.exists()) {&lt;br /&gt; f.mkdirs()&lt;br /&gt;}&lt;br /&gt;return this;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now we need to implement an &lt;span class="Apple-style-span" style="font-style: italic;"&gt;exec&lt;/span&gt; method to execute processes in the directory specified by the Path instance:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public exec(String command) {&lt;br /&gt;//test that the path is a directory&lt;br /&gt;...&lt;br /&gt;command.execute(new File(this.toString(),null)&lt;br /&gt;return this&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;We also need to be able to delete the file by overloading the '-' operator by creating a &lt;i&gt;minus&lt;/i&gt; method:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public Path minus(String element) {&lt;br /&gt;this / element&lt;br /&gt;f = new File(toString())&lt;br /&gt;f.delete();&lt;br /&gt;return this;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Finally we want to be able to easily write to a file, we can map to to the unix "&gt;&gt;" shell command which is normally used to route a processes &lt;span class="Apple-style-span" style="font-style: italic;"&gt;std.out&lt;/span&gt; to an existing file (kinda what we are trying to do). We can do this by overloading the right shift operator by implementing the &lt;span class="Apple-style-span" style="font-style: italic;"&gt;rightShift&lt;/span&gt; method:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public Path rightShift(String valueToAppend) {&lt;br /&gt;f = new File(toString())&lt;br /&gt;if (!f.exists()) {&lt;br /&gt; f.createNewFile()&lt;br /&gt;}&lt;br /&gt;f.append valueToAppend&lt;br /&gt;return this&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And there we have enough to implement the script example. It is however worth noting that the Path class is far from complete. For example another common task would be to list the contents of a directory and filter via a regular expression, so we can add a method &lt;span class="Apple-style-span" style="font-style: italic;"&gt;each&lt;/span&gt; which takes a regex and a closure to handle each file as a Path instance:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public each(Pattern p, Closure c) {&lt;br /&gt;new File(toString()).each {&lt;br /&gt;  if (p.matcher(it).matches()) {&lt;br /&gt;       //..clone current path&lt;br /&gt;       Path newPath = ...&lt;br /&gt;       newPath / it&lt;br /&gt;       c.call(newPath)&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;now you can write:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;~Path.each /foo/ {&lt;br /&gt;//do stuff with it&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;However Groovy allows you to call a method as a string literal for example to call &lt;span class="Apple-style-span" style="font-style: italic;"&gt;x.toString()&lt;/span&gt; you could use &lt;span class="Apple-style-span" style="font-style: italic;"&gt;x.'toString'()&lt;/span&gt;, furthermore we can intercept method calls to methods that don't exist, and enhance this a little and rewrite the former as:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;~Path.'/foo/' {&lt;br /&gt;//do stuff with it&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To do this we implement the &lt;span class="Apple-style-span" style="font-style: italic;"&gt;invokeMethod&lt;/span&gt; to handle the non existent method:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public invokeMethod(String name, args) {&lt;br /&gt;if (name.startsWith("/") &amp;amp;&amp;amp; name.endsWith("/") {&lt;br /&gt;//strip out regular expession and create Pattern object and assign to 'createPattern' variable&lt;br /&gt;each(createPattern, args[0]);&lt;br /&gt;} else { //blow up&lt;/pre&gt;&lt;pre&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So there we have it. Of course this class is not complete, we can add additional methods to do additional operations such as iterating through the elements in the Path instance. Furthermore we might be able to further enhance the class by utilising Groovy's Meta Object Protocol.&lt;br /&gt;&lt;br /&gt;A full Listing of the Path class can be found &lt;a href="http://docs.google.com/Doc?id=dgqkrr3t_7dpmf6772"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-3988454149254214832?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/05/groovy-dsl-for-working-with-your.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-8118309747447547498</guid><pubDate>Sat, 02 May 2009 04:50:00 +0000</pubDate><atom:updated>2009-05-02T00:51:22.817-07:00</atom:updated><title>Java and Oracle, the real question.</title><description>So unless you've been living under a rock, you know that Oracle is buying Sun. And of course one of Larry Ellison's motivators to do so is to gain control of Java.&lt;br /&gt;&lt;br /&gt;Feelings on how this will affect Java run the gamut from "Blissfully happy" to "The end is nigh".&lt;br /&gt;&lt;br /&gt;The press seems to look at Java aspect of the acquisition regarding the product overlap and how little money Sun made off Java. They also seem to view Java as purely an enterprise play, This is an incredibly narrow view as makers of everything cell phone apps to desktop apps to Blu-ray applications will happily attest to.&lt;br /&gt;&lt;br /&gt;Java is not a product in the traditional sense of the word, Java is more a community marketplace centered around the Java technology as opposed to a shrink wrapped product.&lt;br /&gt;&lt;br /&gt;Java's real value IMHO is then in it's vast reach both in the general development landscape and the vast community of programmers, not so much in the IP or the source code that makes up the JVM.&lt;br /&gt;&lt;br /&gt;My question is then if Oracle realizes this.&lt;br /&gt;&lt;br /&gt;Community is something that Oracle has not traditionally had to deal with.&lt;br /&gt;&lt;br /&gt;Oracle has always been a product company focused on generating healthy margins of all of it's products from a set of clients with deep pockets.&lt;br /&gt;&lt;br /&gt;It is now in a position where it will need to support and grow a community of Java users which provide little or no tangible benefit to Oracle's bottom line.&lt;br /&gt;&lt;br /&gt;There are many examples of this.&lt;br /&gt;&lt;br /&gt;One such example is Glassfish which overlaps with Weblogic and seemingly has no place, however Oracle is now in charge of the JCP and as such has to provide reference implementations for the specifications somehow. Glassfish currently fulfills this role. They could maybe use Geronimo or even JBoss but in a space that will eventually commodotize, it might a bad idea to promote a competitor. Oracle may decide to cripple Glassfish purely to be used for reference but then the fact remains that they have to expend resources on a piece code which makes them no money in order to support the Java community.&lt;br /&gt;&lt;br /&gt;Another is the fact that the Java community also consists of companies that compete directly with Oracle. Oracle as the Java shepard must now support these competitors: most notably IBM; the 800 pound Gorilla of the Java community. Strategically it's better for Oracle and IBM to jointly run Java even as competitors lest they both cede a great deal of the Enterprise market to Microsoft. Oracle must therefore keep IBM happy, potentially even spend money to keep them happy in order to preserve the status quo. It must also do the same for it's smaller competitors to expand the reach of Java as far as possible.&lt;br /&gt;&lt;br /&gt;Finally Oracle now enters into strange new markets through Sun's acquisition. Oracle's never had any presence in places like the embedded market and now must do work for people who make such strange things as cell phone applications and software for set top boxes, many of whom will never even see an Oracle database or an Oracle App server. Oracle must now keep them happy potentially at margins which don't quite resemble what they make on 11g CALs together with the reality that there is little chance to sell other Oracle products.&lt;br /&gt;&lt;br /&gt;No doubt Oracle's shareholders will want Larry Ellison to make good on Sun's purchase but to fit Java into the way Oracle traditionally does things is probably not going to work and might very well end up killing Java.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-8118309747447547498?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/05/java-and-oracle-real-question.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-74405666811621254</guid><pubDate>Sat, 20 Dec 2008 16:47:00 +0000</pubDate><atom:updated>2008-12-20T10:07:30.748-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">misc</category><title>It's recession time and Sun has the best recession kool aid.</title><description>So you're a CIO and you have several projects to deliver. The only problem is that you've had your budgets slashed.&lt;br /&gt;&lt;br /&gt;What is a CIO to do....&lt;br /&gt;&lt;br /&gt;Well I don't know if anyone has noticed but one of the coolest recession friendly enterprise software stacks around is being offered by that company we all love to hate: Sun Microsystems.&lt;br /&gt;&lt;br /&gt;Consider this:&lt;br /&gt;&lt;br /&gt;Sun has a really cool application server which is fully buzzword compliant in the form of Glassfish. Besides the fact that its pretty scalable with old Grizzly, it comes with a rock solid ESB and messaging system, A decent compatible web service stack, and on top of that it is dead simple to administer. And then of course lets not forget the awesomeness that is Glassfish 3.0.&lt;br /&gt;&lt;br /&gt;Now Java and JEE can be a little heavyweight, but that's no problem, Sun supports Ruby and Ruby on Rails and has a Ruby interpreter that really rocks in the form of JRuby, and the best part is that you can run it on said application server. And If Ruby is not too your taste, don't forget Groovy and Grails, and soon Python with Django, and if you really want to go exotic there is Scala and Lift. All using it's battle tested core runtime environment otherwise known as Hotpsot.&lt;br /&gt;&lt;br /&gt;Of course now you need to save your precious data in a database. Databases of course tend to be notoriously recession unfriendly. Once again Sun provides a proven lightweight solution in the form of MySQL.&lt;br /&gt;&lt;br /&gt;Finally no system is complete without a little bit of User interface. Sun provides a good web stack with Glassfish, however you wanna got fat. No problem, JavaFX now provides a good fat solution.&lt;br /&gt;&lt;br /&gt;So now you have all the libraries and runtimes, what about an IDE. Once again we have Netbeans, an increasingly one stop shop for doing development, besides doing Java and C++ it does Ruby, Groovy, Scala, JavaScript, PHP and it's newest addition: JavaFX, all with a simple easy interface and allows you to get up and running very quickly.&lt;br /&gt;&lt;br /&gt;It's also worth mentioning that Sun also offers a slew of other tools, everything from a continuous integration server in Hudson to an identify management system in the form of OpenSSO, and countless other products.&lt;br /&gt;&lt;br /&gt;Once you have all that together, you need an OS to run it all on. Once again you have the increasingly interesting looking OpenSolaris, or it's commercial brother Solaris, which once it's all said and done, is still one of the best OSes on the planet.&lt;br /&gt;&lt;br /&gt;Now what is really cool about this whole stack is that everthing I've mentioned here is either open source or free, with support contracts available. If you wanted you could download all individual components and not cost to you, that's right no cost. How recession friendly is that.&lt;br /&gt;&lt;br /&gt;But wait there's more, since you've saved all this money on software, why not look at some of Sun's hardware, which includes everything from fast Opteron servers to those Sparc boxes with like a gazillion CPU cores. Then of course there are those Jaw dropping ZFS based Open Storage systems.&lt;br /&gt;&lt;br /&gt;So there you have it: If you need to get some bang for your buck, have a look at Sun: your one stop shop for all things EIS.&lt;br /&gt;&lt;br /&gt;There is unfortunately one small little caveat...&lt;br /&gt;&lt;br /&gt;Sun either isn't interested in dishing out it's kool aid, or is trying too, but no one seems to understand where to get some.&lt;br /&gt;&lt;br /&gt;My employer recently bought a whole stack of stuff, and based on what they where looking for a stack like the one I presented here would have appealed to them. All Sun would have had to do, is bundle it up under the banner of a product suite and do some old fashioned selling.&lt;br /&gt;&lt;br /&gt;The worst part is that I don't think the Sun people understand what they have. When you watch a Sun presentation you get bombarded with Sun's entire portfolio of products, the only problem is that they present them as a mass jumble of vaguely related products which simply overloads the presentee with information. There's no common theme to say: this is the value proposition we are giving to you.&lt;br /&gt;&lt;br /&gt;Now I don't represent Sun in any capacity, but I would find it incredibly sad to see a company that does so much cool stuff fold, and see all this cool stuff potentially disappear.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-74405666811621254?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/12/its-recession-time-and-sun-has-best.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-4281248093451249409</guid><pubDate>Sun, 10 Aug 2008 09:43:00 +0000</pubDate><atom:updated>2008-08-10T04:15:36.308-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">javafx</category><title>A simple MP3 Player in JavaFX</title><description>This is pretty much my first attempt at JavaFX and after looking around I wasn't able to find much about using the media player capabilities of JavaFX so I decided to create a simple MP3 player to basically get up and running with JavaFX.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_eLI3wcTStKo/SJ7IoPiNlaI/AAAAAAAAADE/TgK9oozombE/s1600-h/mp3player.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_eLI3wcTStKo/SJ7IoPiNlaI/AAAAAAAAADE/TgK9oozombE/s400/mp3player.JPG" alt="" id="BLOGGER_PHOTO_ID_5232840410741446050" border="0"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So, for a start what does JavaFX give us in terms of media APIs.&lt;br /&gt;&lt;br /&gt;Well the JavaFX SDK contains the &lt;font style="font-style: italic;"&gt;javafx.scene.media&lt;/font&gt; package which contains the classes for using media within your application.&lt;br /&gt;&lt;br /&gt;This package consists of the following classes:&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;font style="font-weight: bold;"&gt;Media&lt;/font&gt; : This class wraps a media source, i.e: in this case the location of the MP3 file.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;font style="font-weight: bold;"&gt;MediaPlayer&lt;/font&gt; : This class provides functionality to drive the playback of a Media instance.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;font style="font-weight: bold;"&gt;MediaError&lt;/font&gt;: This class represents an error that occurs during media playback.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;font style="font-weight: bold;"&gt;MediaTimer&lt;/font&gt;: This class allows you to execute actions at an interval during the playback of media.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;font style="font-weight: bold;"&gt;MediaView&lt;/font&gt;: This class is a visual component for displaying your media in the case of video.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;For the purposes of this blog I'm only going to focus on the &lt;font style="font-style: italic;"&gt;Media&lt;/font&gt; class, &lt;font style="font-style: italic;"&gt;MediaPlayer&lt;/font&gt; class and &lt;font style="font-style: italic;"&gt;MediaError&lt;/font&gt; class since these are enough to create a very basic MP3 player.&lt;br /&gt;&lt;br /&gt;&lt;font style="font-weight: bold;"&gt;Media Playback using the MediaPlayer class.&lt;/font&gt;&lt;br /&gt;So the first thing to do is create a most basic &lt;font style="font-style: italic;"&gt;MediaPlayer&lt;/font&gt; instance:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; var player =&lt;br /&gt;     MediaPlayer {&lt;br /&gt;       repeatCount:MediaPlayer.REPEAT_FOREVER&lt;br /&gt;       onError: function(e:MediaError) {&lt;br /&gt;                  display = e.message;&lt;br /&gt;                }&lt;br /&gt;     };&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can see here that I've set two attributes: &lt;font style="font-style: italic;"&gt;repeatCount&lt;/font&gt; and &lt;font style="font-style: italic;"&gt;onError&lt;/font&gt;.&lt;br /&gt;&lt;br /&gt;The &lt;font style="font-style: italic;"&gt;repeatCount&lt;/font&gt; attribute indicates if the media should loop or play once and then stop. The values for &lt;font style="font-style: italic;"&gt;repeatCount&lt;/font&gt; are defined as constants on the &lt;font style="font-style: italic;"&gt;MediaPlayer&lt;/font&gt; class, I've selected &lt;font style="font-style: italic;"&gt;MediaPlayer.REPEAT_FOREVER&lt;/font&gt; in order to loop playback.&lt;br /&gt;&lt;br /&gt;Note: &lt;font style="font-weight: bold;"&gt;if you leave out &lt;font style="font-style: italic;"&gt;repeatCount&lt;/font&gt;, playback will not occur&lt;/font&gt; (and no error is thrown either if you don't set it, which led to a rather annoying few hours for me).&lt;br /&gt;&lt;br /&gt;The &lt;font style="font-style: italic;"&gt;onError&lt;/font&gt; attribute sets a closure (anonymous function) which gets executed when an error occurs. The closure is passed an instance of &lt;font style="font-style: italic;"&gt;MediaError&lt;/font&gt; to indicate what happened. In my example I simply set a variable called &lt;font style="font-style: italic;"&gt;display&lt;/font&gt;, which I bound to a Text node in the UI.&lt;br /&gt;&lt;br /&gt;&lt;font style="font-weight: bold;"&gt;Controlling the MediaPlayer class.&lt;/font&gt;&lt;br /&gt;The next thing we need to do define a method to control your player. &lt;font style="font-style: italic;"&gt;MediaPlayer&lt;/font&gt; has two methods on it which allow you to control it: &lt;font style="font-style: italic;"&gt;play()&lt;/font&gt; which starts or resumes playback and &lt;font style="font-style: italic;"&gt;pause()&lt;/font&gt; which allows you to stop (but not reset) the current media playback in the player.  For my example I wrote a very simple Button which stops and starts my MediaPlayer instance based on the button's state and the player's state:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Button {&lt;br /&gt;   enabled : bind enabled&lt;br /&gt;   text: bind text&lt;br /&gt;   action: function() {&lt;br /&gt;              if (text == "Stop") {&lt;br /&gt;                 player.pause();&lt;br /&gt;                 text = "Play"&lt;br /&gt;              } else if (player.media != null and text == "Play") {&lt;br /&gt;                 player.play();&lt;br /&gt;                 text = "Stop";&lt;br /&gt;              }&lt;br /&gt;           }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Nothing very fancy here, when the Button is clicked in Playing state I call &lt;font style="font-style: italic;"&gt;player.pause()&lt;/font&gt;, if it's in Stopped state I check firstly that there is media available for the player and then that the button is in a state for me to start playing.&lt;br /&gt;&lt;br /&gt;&lt;font style="font-weight: bold;"&gt;Creating a Media instance for the MediaPlayer class&lt;/font&gt;&lt;br /&gt;The last thing really left to do is select some media for playback. Now the &lt;a href="http://javafx.com/releases/preview1/docs/api/"&gt;JavaFX SDK&lt;/a&gt; doesn't wrap all of the Swing API, only a select set of components which you can find in the &lt;font style="font-style: italic;"&gt;javafx.ext.swing&lt;/font&gt; package. Most notably it's doesn't wrap any of the standard Swing dialogs including &lt;font style="font-style: italic;"&gt;javax.swing.JFileChooser&lt;/font&gt;. The good news is that's it's easy to call JFileChooser from within JavaFX code. Once again I used a &lt;font style="font-style: italic;"&gt;javafx.ext.swing.Button&lt;/font&gt; to call my code to select media and set it in my media player instance:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;var fileBtn: Button&lt;br /&gt;component:&lt;br /&gt;    fileBtn = Button {&lt;br /&gt;                text: "File"&lt;br /&gt;                action: function() {&lt;br /&gt;                          var fc = new JFileChooser();&lt;br /&gt;                          var mp3Filter = new ExtensionFileFilter();&lt;br /&gt;                          mp3Filter.addExtension("mp3", "MP3");&lt;br /&gt;                          fc.addChoosableFileFilter(mp3Filter);&lt;br /&gt;                          var result = fc.showOpenDialog(fileBtn.getJButton());&lt;br /&gt;                          if (result == JFileChooser.APPROVE_OPTION) {&lt;br /&gt;                             var fFile = fc.getSelectedFile();&lt;br /&gt;                             display = fFile.getName();&lt;br /&gt;                             var file = fFile.toURL().toExternalForm();&lt;br /&gt;                             file = file.replaceAll(" ","%20");&lt;br /&gt;                             if (file != player.media.source) {&lt;br /&gt;                                player.pause();&lt;br /&gt;                                player.media = Media {source:file};&lt;br /&gt;                                text = "Play";&lt;br /&gt;                                enabled = true;&lt;br /&gt;                             }&lt;br /&gt;                           }&lt;br /&gt;                         }&lt;br /&gt;                                     &lt;br /&gt;              }&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This code basically calls a &lt;font style="font-style: italic;"&gt;JFileChooser&lt;/font&gt; which selects &lt;font style="font-style: italic;"&gt;.mp3&lt;/font&gt; files from the file system using a simple &lt;font style="font-style: italic;"&gt;javax.swing.filechooser.FileFilter&lt;/font&gt; instance &lt;a href="http://docs.google.com/Doc?id=dgqkrr3t_5f37zdhcr"&gt;FileExtensionFilter&lt;/a&gt; - which I wrote for my purposes - to get all the .mp3 files in the file system.&lt;br /&gt;&lt;br /&gt;Note that when you call &lt;font style="font-style: italic;"&gt;showOpenDialog()&lt;/font&gt; on the &lt;font style="font-style: italic;"&gt;FileChooser&lt;/font&gt; you have to pass in a &lt;font style="font-style: italic;"&gt;java.awt.Component&lt;/font&gt; instance. The &lt;font style="font-style: italic;"&gt;Button&lt;/font&gt; class does not implement this even though it's wraps a Swing &lt;font style="font-style: italic;"&gt;JButton&lt;/font&gt; component. However Button does give you a method &lt;font style="font-style: italic;"&gt;getJButton()&lt;/font&gt; which returns the underlying &lt;font style="font-style: italic;"&gt;JButton&lt;/font&gt; instance, which you can use to pass to the &lt;font style="font-style: italic;"&gt;FileChooser&lt;/font&gt;.&lt;br /&gt;&lt;br /&gt;Finally once you have the select .mp3 file, the last thing you need to do is create &lt;font style="font-style: italic;"&gt;Media&lt;/font&gt; object and pass it to the &lt;font style="font-style: italic;"&gt;MediaPlayer &lt;/font&gt;instance. The Media class has an attribute: &lt;font style="font-style: italic;"&gt;source&lt;/font&gt; which is a string URL pointing to the location of the media. the Media object will also only accept escaped URLs, which &lt;font style="font-style: italic;"&gt;java.io.File.toURL()&lt;/font&gt; does not do. This means you have manually escape the URL string before you pass it to the &lt;font style="font-style: italic;"&gt;Media&lt;/font&gt; object.&lt;br /&gt;&lt;br /&gt;And that's it really, &lt;font style="font-weight: bold;"&gt;the full source code for my player is available &lt;a href="http://docs.google.com/Doc?id=dgqkrr3t_4d2bdnmc5"&gt;here&lt;/a&gt;&lt;/font&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-4281248093451249409?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/08/simple-mp3-player-in-javafx.html</link><author>noreply@blogger.com (julian_za)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_eLI3wcTStKo/SJ7IoPiNlaI/AAAAAAAAADE/TgK9oozombE/s72-c/mp3player.JPG" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-1745362986265255440</guid><pubDate>Wed, 06 Aug 2008 20:10:00 +0000</pubDate><atom:updated>2008-08-07T13:16:32.207-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Java 7.0 or Java.next?</title><description>A while back I was in a WCF master class hosted by Juval Lowy the MS software legend. &lt;br /&gt;&lt;br /&gt;At the time Visual Studio 2008 was a pending release so most of the people were not yet familiar with the language changes in C#.&lt;br /&gt;&lt;br /&gt;Juval took a little time to demonstrate the closures in C# to an impressed bunch of hardcore .Net programmers.&lt;br /&gt;&lt;br /&gt;At the time I had been regularly writing ruby scripts and all I could think of when I saw the C# closures syntax is: "Man that looks terrible".&lt;br /&gt;&lt;br /&gt;Ever since then, I can't help but get the feeling that if MS keeps chucking new features into C# it's not going to look pretty in a few releases.&lt;br /&gt;&lt;br /&gt;But regardless of the impact of those features to the core C# language. MS has managed to - with the help of frameworks to make use of the features - create a whole lot of excitement around C# and .Net.&lt;br /&gt;&lt;br /&gt;And in the IT industry, excitement around products is important unless you want to leak market share.&lt;br /&gt;&lt;br /&gt;It unfortunately also been a couple of years since there's been any excitement around Java.&lt;br /&gt;&lt;br /&gt;So what is a direction-less Java developer to do?&lt;br /&gt;&lt;br /&gt;One of the options is the &lt;span style="font-weight:bold;"&gt;Java.next option&lt;/span&gt;: keep the JVM but use another language to run on top of it. &lt;br /&gt;&lt;br /&gt;This has got quite a few advantages:&lt;br /&gt;&lt;li&gt;You can maintain the investment in Java while moving onto a new language.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;You have an nice way to re-skill developers quickly.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;You have a clean slate to start from when you design the language.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;You can generate excitement while placating your very corporate customers.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;As a developer you have a nice new toy to play with.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;But before you can do this there are some requirements for corporate IT to accept this:&lt;br /&gt;&lt;li&gt;It must have vendor support, and by vendor support I mean the big guys; IBM, Oracle, Sun etc. etc.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;It has to be very easy to to move from Java to Java.next. In fact ideally it should be a superset of Java but that might be pushing it :-).&lt;/li&gt;&lt;br /&gt;&lt;li&gt;It has to seamlessly interoperate with all the existing Java frameworks and libraries.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;IDE support needs to be on par with Java.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;JCP certification wouldn't hurt.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;Another option is the &lt;span style="font-weight:bold;"&gt;Java 7.0 option&lt;/span&gt;: simply add new language features to Java to at least maintain parity with other languages. And that of course comes with the risk of messing up the language. Furthermore the changes need to added within a certain time line in order to not create the perception that the language is behind the times.&lt;br /&gt;&lt;br /&gt;And then if that fails there is always the &lt;span style="font-weight:bold;"&gt;COBOL option&lt;/span&gt;: leave the language be and then for us developers; when the Java well runs dry we become COBOL style system maintainers or we simply dump the platform all together and start from scratch.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-1745362986265255440?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/08/java-70-or-javanext.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-2127604719021588805</guid><pubDate>Tue, 05 Aug 2008 19:45:00 +0000</pubDate><atom:updated>2008-08-05T14:24:22.542-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">misc</category><title>Running your physical Windows XP partition as a VM using Virtualbox on Ubuntu.</title><description>Ok, so you've just installed your shiny new Hardy Heron OS but you still have all those pesky Windows apps you need to run.&lt;br /&gt;&lt;br /&gt;Currently you're dual booting, but that sucks.&lt;br /&gt;&lt;br /&gt;No worries, the latest version of Virtualbox allows to wrap an existing physical partition as a virtual machine.&lt;br /&gt;&lt;br /&gt;Here's how to do it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;1. Install Virtualbox&lt;/span&gt;&lt;br /&gt;Firstly; &lt;span style="font-weight:bold;"&gt;do not install the Virtual box which comes standard in the Ubuntu repositories&lt;/span&gt;. In order to support this functionality you have to download the &lt;a href="https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_SMI-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=innotek-1.6-G-F@CDS-CDS_SMI"&gt;closed source version&lt;/a&gt; from Sun. &lt;span style="font-style:italic;"&gt;BTW I give Kudos to Sun for being .deb friendly.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;2. Setup your permissions.&lt;/span&gt;&lt;br /&gt;After you've installed virtualbox you will need to assign your user to certain groups in order to access the physical partition and virtualbox for that matter. &lt;br /&gt;&lt;br /&gt;The commands are as follows:&lt;br /&gt;- &lt;span style="font-style:italic;"&gt;"sudo usermod -a -G disk &lt;username&gt;"&lt;/span&gt;&lt;br /&gt;- &lt;span style="font-style:italic;"&gt;"sudo usermod -a -G vboxusers &lt;username&gt;"&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;You will need to log out of your terminal and then log back in for the changes to take effect.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;3. Prep your Windows installation.&lt;/span&gt;&lt;br /&gt;Since Virtualbox imposes a Virtual hardware environment to the guest operating system, Windows is going to try install all the new drivers for Virtualbox's virtual hardware environment. This is a problem if you wish to boot back into that Windows partition. For this reason you have to create two separate hardware profiles in Windows; one to run physically and one to run as a guest operating system. This can be done under &lt;span style="font-style:italic;"&gt;System Properties &gt; Hardware &gt; Hardware profiles&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Next you have to run a utility called MergeIDE which you can get &lt;a href="http://www.virtualbox.org/attachment/wiki/Migrate_Windows/MergeIDE.zip"&gt;here&lt;/a&gt;. As it turns out Windows writes some registry information about your physical IDE controller into the registry. MergeIDE does some funky rewiring of the registry in order to get around this so that you can "move" your Windows installation onto another hardware environment.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;4. Create a virtual hard disk for Virtualbox (VMDK file).&lt;/span&gt;&lt;br /&gt;The first thing you need to do is determine which partition your MBR (master boot record) lives on. You can determine this using fdisk or checking your Grub settings.&lt;br /&gt;&lt;br /&gt;Finally when you have all this information you create the VMDK file using the command:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;VBoxManage internalcommands createrawvmdk -filename [Absolute_Path_to_output_File] -rawdisk /dev/sda -register&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You then start Virtualbox, create a new Virtual machine and select this created VMDK file as the hard disk for this VM.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;5. Modifying your VM settings for Windows.&lt;/span&gt;&lt;br /&gt;In the settings for your virtual machine, under "general" you need to enable the &lt;span style="font-style:italic;"&gt;IO APIC&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;VT-x/AMD-V&lt;/span&gt; options  in the "advanced" tab.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;6. Fixing the licensing issues.&lt;/span&gt;&lt;br /&gt;The Windows XP volume license registers your license key against the BIOS for that machine. When Virtualbox loads your guest operating system it presents virtual BIOS information to that OS, which obviously invalidates the license you currently have installed for XP since from it's point of view it's now on a different machine.&lt;br /&gt;&lt;br /&gt;In order to fix this you have to modify the settings of your VM config file in order to report your physical BIOS information.&lt;br /&gt;&lt;br /&gt;First you have to get the information using the dmidecode command. To get the DMI bios information and the the DMI system information run: &lt;span style="font-style:italic;"&gt;dmidecode -t0&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;dmidecode -t1&lt;/span&gt; respectively.&lt;br /&gt;&lt;br /&gt;You then have to append this information as a set of key-value pairs to your virtual machine settings. A list of all the variables can be found in section 9.13 of the VirtualBox user guide. &lt;br /&gt;&lt;br /&gt;The user guide explains how to do this using the "VboxManage" command I found it easier to add the variables myself to the config file of your VM which can be found at &lt;span style="font-style:italic;"&gt;~/.VirtualBox/Machines/My_Windows_Machine/My_Windows_Machine.xml&lt;/span&gt; and can be added under the &lt;span style="font-style:italic;"&gt;&amp;lt;ExtraDataItems&amp;gt;&lt;/span&gt; element.&lt;br /&gt;&lt;br /&gt;And that should be it, now you can fire it up!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Some final information.&lt;/span&gt;&lt;br /&gt;&lt;li&gt;When you start the virtual machine it will effectively start the same boot loader you normally use for the dual boot system. &lt;span style="font-weight:bold;"&gt;Under no circumstances boot into the same OS you are currently running&lt;/span&gt;. If you do this I can guarantee you a world of pain.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Performance is not fantastic. This seems to mostly stem from lack of decent graphics acceleration. I upped the Video memory and turned off all visual effects in Windows which helped however if you know a way to improve graphics performance, let me know.&lt;/li&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-2127604719021588805?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/08/running-your-physical-windows-xp.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">11</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-5097721358581369586</guid><pubDate>Sun, 03 Aug 2008 18:08:00 +0000</pubDate><atom:updated>2008-08-03T12:29:07.819-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Java and the closures hall of shame</title><description>So, to see how far the closures rabbit hole goes I decided to make a list of all the languages in the top ten on the &lt;a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html"&gt;Tiobe&lt;/a&gt; index which have no closures support or no confirmed closures support in an upcoming version.&lt;br /&gt;&lt;br /&gt;The initial list consists of these languages:&lt;br /&gt;- Java.&lt;br /&gt;- C.&lt;br /&gt;- C++.&lt;br /&gt;- PHP.&lt;br /&gt;&lt;br /&gt;Oops I forgot about C++0x and it &lt;a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions"&gt;looks like it has closures support&lt;/a&gt;, remember I said confirmed closures support in an upcoming version.&lt;br /&gt;&lt;br /&gt;Oh and lets not forget PHP 5.3 and the &lt;a href="http://wiki.php.net/rfc/closures"&gt;closures rfc&lt;/a&gt; that's already in HEAD.&lt;br /&gt;&lt;br /&gt;Therefore the refined list looks as follows:&lt;br /&gt;- Java.&lt;br /&gt;- C.&lt;br /&gt;&lt;br /&gt;Now what about C. It's true that ANSI C forbids nested functions but as it turns out GCC has a &lt;a href="http://linuxgazette.net/112/ramankutty.html"&gt;few extensions which allow you to do closures&lt;/a&gt;. It's also worth considering if C belongs here since it's modern use case and characteristics tends to place it in a different category to the rest of the languages on the index. On those grounds I'm going to apply Occam's razor and remove C from the list.&lt;br /&gt;&lt;br /&gt;The final list looks as follows:&lt;br /&gt;- Java.&lt;br /&gt;&lt;br /&gt;This means that after the next iteration of language versions, Java will lack in capabilities compared to competing languages. Now I can carry on coding without closures - albeit somewhat unhappily. But bear in mind that Java increasingly has to compete with other languages. And if Java is perceived to be obsolete it's going to be a harder sell in the enterprise.&lt;br /&gt;&lt;br /&gt;Now I know that time is running out for finalizing Java 7.0 but for goodness sakes Sun you really need to do something.&lt;br /&gt;&lt;br /&gt;Now purely from my point of view I wouldn't be upset with either of the following: &lt;br /&gt;- Pushing out the Java 7.0 time line in order to add these language features.&lt;br /&gt;- Make another language such as Groovy a required part of the Java 7.0 spec.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-5097721358581369586?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/08/java-and-closures-hall-of-shame.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">10</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-14436060268026307</guid><pubDate>Mon, 28 Jul 2008 19:56:00 +0000</pubDate><atom:updated>2008-07-28T14:14:48.585-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">.Net</category><title>(Yet another) Benchmark of the CLR vs the JVM</title><description>I read this &lt;a href="http://codeeleven.blogspot.com/2008/07/benchmarking-clr-vrs-jvm.html"&gt;blog entry&lt;/a&gt; today on "This Code Goes to Eleven" regarding a JVM vs CLR benchmark.&lt;br /&gt;&lt;br /&gt;I decided to redo the benchmark. The first thing I did is slightly tweak the Java version &lt;a href="http://docs.google.com/View?docID=dgqkrr3t_3xq3rfhds&amp;revision=_latest"&gt;(found here)&lt;/a&gt; to use &lt;span style="font-style:italic;"&gt;System.currentTimeMillis()&lt;/span&gt; as opposed to creating a new Date object which IMHO is fairer test with the C# .Net version. The &lt;a href="http://www.gfilter.net/junk/Benchmark.zip"&gt;C# version&lt;/a&gt; was unchanged.&lt;br /&gt;&lt;br /&gt;I then ran the program in both the JVM's client profile and server profile ("&lt;span style="font-style:italic;"&gt;java -client BubbleSort&lt;/span&gt;" and "&lt;span style="font-style:italic;"&gt;java -server BubbleSort &lt;/span&gt;respectively").&lt;br /&gt;&lt;br /&gt;To provide some background. Sun's JVMs run in two profiles: the server profile which is optimised for environments which have loads of memory and CPU time and doesn't really have UI interaction, whereas the client is designed to work with more constrained UI centric environments.&lt;br /&gt;&lt;br /&gt;My machine specs were as follows:&lt;br /&gt;- Windows XP SP2 32-bit&lt;br /&gt;- Intel(R) Core(TM)2 Duo CPU 2.33GHz&lt;br /&gt;- 4096MB of memory&lt;br /&gt;&lt;br /&gt;This was the outcome (click to enlarge):&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_eLI3wcTStKo/SI4szECLLlI/AAAAAAAAAC0/EwbXGOwB5s8/s1600-h/benchmark_html_46863a9a.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_eLI3wcTStKo/SI4szECLLlI/AAAAAAAAAC0/EwbXGOwB5s8/s400/benchmark_html_46863a9a.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5228165473191538258" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The results are noteworthy; for one thing the client profile for the JVM is considerably slower than either the CLR or the JVM server profile. Furthermore the JVM running in server profile is markedly faster than the CLR version.&lt;br /&gt;&lt;br /&gt;But what have I actually proved?&lt;br /&gt;&lt;br /&gt;Absolutely nothing really.&lt;br /&gt;&lt;br /&gt;To illustrate, lets take this another step: I took the same test and I ran it on my Ubuntu 8.04 partition on the same machine (once again click to enlarge): &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_eLI3wcTStKo/SI4uPibK5oI/AAAAAAAAAC8/lqJ3t2rM8ek/s1600-h/benchmark_html_5f2ac315.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_eLI3wcTStKo/SI4uPibK5oI/AAAAAAAAAC8/lqJ3t2rM8ek/s400/benchmark_html_5f2ac315.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5228167061897406082" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As it turns out the Linux version of the JVM running the same program in server mode is slightly faster overall than it's Windows counterpart and the client mode is on average slower than it's Windows counterpart:&lt;br /&gt;&lt;br /&gt;And that's the problem with this whole benchmark.&lt;br /&gt;&lt;br /&gt;You can never simply make a blanket statement and say Java is faster than .Net. There are several reasons for this.&lt;br /&gt;&lt;br /&gt;A JVM is only as fast as it's implementation allows it to be. IBM's JVMs will perform differently to Sun's JVMs to Oracle's JVMs to Apple's JVMs since the guts of the JVM are implemented quite differently for each vendor. Each company's has engineers who will approach the JVM design differently and have a different set of priorities which may get dictated by the market segment within which they compete.&lt;br /&gt;&lt;br /&gt;Secondly a JVM is also constrained by it's platform. If you have a JVM which makes a system call which is slow, or has to generate native code which is slow it's going make your program slow. This means that a Java program performs differently across different operating systems.&lt;br /&gt;&lt;br /&gt;Thirdly .Net is supposed to be Microsoft's pre-eminent development tool for the Windows platform. It's fair to say that MS can tweak their stuff for Windows like no one else can (In fact many people have complained that they purposefully do this). The fact that Java does beat .Net on Windows is quite surprising&lt;br /&gt;&lt;br /&gt;Finally the usage of Java and .Net in the industry has taken the development of the CLR and JVM down different directions. Java - at least from Sun's point of view - took the high road and thus has had a lot of work done for big iron type environments, meaning that their JVM performs better in server environments than client environments. MS on the other hands needs to keep both environments as happy as possible without rocking the boat too much.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-14436060268026307?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/07/yet-another-benchmark-of-clr-vs-jvm.html</link><author>noreply@blogger.com (julian_za)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://bp3.blogger.com/_eLI3wcTStKo/SI4szECLLlI/AAAAAAAAAC0/EwbXGOwB5s8/s72-c/benchmark_html_46863a9a.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-2902730328606942589</guid><pubDate>Mon, 21 Jul 2008 19:24:00 +0000</pubDate><atom:updated>2008-07-21T12:48:01.380-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">humor java javafx</category><title>If JavaFX is a flop will you...</title><description>&lt;iframe allowtransparency='true' frameborder='0' height='260' name='poll-widget-5942806366580000216' src='http://www.google.com/reviews/polls/display/-5942806366580000216/blogger_template/run_app?txtclr=%23999999&amp;lnkclr=%236699cc&amp;chrtclr=%236699cc&amp;font=normal+normal+100%25+Verdana%2C+sans-serif&amp;hideq=true&amp;purl=http%3A%2F%2Fdotneverland.blogspot.com%2F' style='border:none; width:100%;'&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Disclaimer&lt;/b&gt;: This poll is utterly unscientific, represents no ones opinion really and is just pretty much a time filler for when you know you should be writing code, but the wild wild web is just more interesting...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-2902730328606942589?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/07/if-javafx-is-flop-will-you.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-3573442452679935815</guid><pubDate>Wed, 09 Jul 2008 17:17:00 +0000</pubDate><atom:updated>2008-07-09T12:14:43.130-07:00</atom:updated><title>Java 7 "quick wins" some ideas</title><description>I while back I was listening to &lt;a href="http://www.javaposse.com/index.php?post_id=340584"&gt;Danny Coward's Java 7.0 interview on Java Posse&lt;/a&gt;. He made a comment about the fact that the typical new language features they were looking for are small language changes which don't impact the language too much. &lt;br /&gt;&lt;br /&gt;The example he used was a the "foreach" loop which was a relatively small change but had a huge impact with developers, since it actually did make life a little easier as a Java developer. &lt;br /&gt;&lt;br /&gt;So I decided to compile a list of some - hopefully - small ideas to reduce genuine sticking points I encounter daily doing meat and potatoes Java programmer.&lt;br /&gt;&lt;br /&gt;Now firstly the disclaimer: I'm no language designer nor do I claim originality for these ideas. They are simply ideas that will make my life easier in my Job, they could introduce a whole set of complexities I couldn't even fathom, but anyway here goes...&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Remove the final requirement for outer scoped variables which are accessed inside anonymous inner classes. This would allow me to do most of the things I want closures for.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;How about a shorthand notation for getters and setters ala Ruby style, for example you would be able to declare something along the lines of:&lt;br /&gt;&lt;br /&gt;  &lt;span style="font-style:italic;"&gt;int myProperty {read;write}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The compiler could simply insert appropriate get and set methods using standard JavaBeans naming conventions. Now generating these haven't been an issue since even the early Java IDEs, but the getter and setter code can still add several hundred lines of clutter to a class and 99% of the time they don't add any real value. If you need to do something specific in the method you can still manually define the getter or setter. Ideally of course, &lt;a href="http://oslo.cs.sjsu.edu:8080/xwiki/bin/view/JavaProperties/"&gt;this&lt;/a&gt; might be a better option&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Finish Autoboxing, I want to be able to do &lt;span style="font-style:italic;"&gt;1.toString()&lt;/span&gt;.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Shorthand notation for creating maps and lists, something along the lines of...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;List&lt;String&gt; myList = {"1","2","3"};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Map&lt;String,String&gt; = {"key1"="value1","key2"="value2"};&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;While we are at it, what about some basic fixed operator overloading for collections, this has already been &lt;a href="http://tech.puredanger.com/java7#misc"&gt;suggested&lt;/a&gt; and IMHO is a no brainer&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Is there absolutely nothing that can be done about anonymous inner class syntax, especially since about 80% of the time my anonymous inner class comprises of precisely one method, couldn't we somehow inline single method classes maybe something along the lines of...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;myComponent.addListener(new ActionListener.actionPerformed(ActionEvent e)() {&lt;br /&gt;  ...do stuff here&lt;br /&gt;});&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Although admittedly this just a manifestation of my desire for closures :-(.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Make one of the "buzz" languages a standard part of JSE. By buzz I mean something like JRuby or Groovy. This would make it easier to embrace these languages in a corporate and give some flexibility to platform. A good option might be Groovy since it's the most "Java-ish" language and it is also the only other language which is a &lt;a href="http://jcp.org/en/jsr/detail?id=241"&gt;Java standard&lt;/a&gt;. This has the advantage of requiring no core language changes and could showcase the new &lt;span style="font-style:italic;"&gt;invokedynamic&lt;/span&gt; bytecode.&lt;/li&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-3573442452679935815?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/07/java-7-quick-wins-some-ideas.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">6</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-5994906758426189963</guid><pubDate>Thu, 03 Jul 2008 18:04:00 +0000</pubDate><atom:updated>2008-07-03T11:10:27.573-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">humor</category><title>Why Windows has become so secure</title><description>It's amazing how secure Windows has become.&lt;br /&gt;&lt;br /&gt;The following screen shot illustrates just to what lengths Microsoft goes to, to protect you the user from any "viruses" that might destroy your data..&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_eLI3wcTStKo/SG0VbClzlaI/AAAAAAAAACU/SBZweN7SpAI/s1600-h/explorer_broken.bmp"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_eLI3wcTStKo/SG0VbClzlaI/AAAAAAAAACU/SBZweN7SpAI/s400/explorer_broken.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5218851097488364962" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-5994906758426189963?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/07/why-windows-has-become-so-secure.html</link><author>noreply@blogger.com (julian_za)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://bp2.blogger.com/_eLI3wcTStKo/SG0VbClzlaI/AAAAAAAAACU/SBZweN7SpAI/s72-c/explorer_broken.bmp" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-6778629294601970486</guid><pubDate>Sat, 21 Jun 2008 14:21:00 +0000</pubDate><atom:updated>2008-06-21T07:46:35.922-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">humour opinion</category><title>New buzzwords to reflect reality</title><description>Recently I've been exposed to the process of the aquisition of a large suite of software for the development of a large system. Needless to say the company is a large vendor, the client is a large organisation and the volumes of money involved were, well, volumous.&lt;br /&gt;&lt;br /&gt;As usual the decision makers of the large organisation were bombared by a dizzying array of buzzwords designed to exploit the lack of technical knowledge of said decision makers by the vendors.&lt;br /&gt;&lt;br /&gt;I thought it's time we start creating a set of buzzwords which are a closer reflection on reality.&lt;br /&gt;&lt;br /&gt;These buzzwords are designed to express your feelings in front of managers in a non career limiting manner&lt;br /&gt;&lt;br /&gt;Here are a couple that come to mind...&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;VDD&lt;/strong&gt; - Vendor driven development: this is when a vendor sells you a set of tools which force you to adapt your working processes to be able to use their technology, since the software is normally too bad to use any other way and you paid a fortune for it, so you have to use it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;COA&lt;/strong&gt; - Consultant orientated architecture (pronounced "kowa"): this is when you have to buy additional services via expensive consultants in order to make the software you bought for your VDD work.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SaaPG&lt;/strong&gt; - Software as a Porsche Generator: What software means to the sales people selling you tools.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;B-CIEPS&lt;/strong&gt; - Bean Counter Ignorance Exploitation Procurement strategy (pronounced "beeseeps") : this is the strategy sales people use to enable SaaPG. This strategy works well with large companies.&lt;br /&gt; &lt;br /&gt;&lt;strong&gt;ROP&lt;/strong&gt; - Resume orientated programming: 'Nuff said really, just a reminder that we developers aren't exactly blameless either.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;BCVLI&lt;/strong&gt; - Buzzword compliant vendor lock in: This is when a vendor sells you "compliancy" with standards even though the standard is bent or broken or the standardisation process is so bad that only their tools work with the "compliant" product. Anyone who has ever worked with web services can atest to this.&lt;br /&gt;  &lt;br /&gt;&lt;strong&gt;The "Gates-Palminsano-Ellison process"&lt;/strong&gt;: The process whereby you make Bill Gates, Sam Palmisano and Larry Ellison richer men by buying their products, this is actually more an indictment on the company buying the software rather then the vendors, Many decision makers often lean towards large vendors and neglect smaller but equally capable companies because their butts are one the line.&lt;br /&gt; &lt;br /&gt;&lt;strong&gt;6-zero compliancy&lt;/strong&gt;: This is the rule that states that in order for a product to be perceived to be useful it's price must have at least 6 zeroes behind the most significant digit, hence; 6-zero compliancy.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;UFL&lt;/strong&gt; - Usefulness follows licensing: This is a rule normally applicable in VDDs, whereby only the basic functionality you could have got downloading an open source product is available and the additional features you actually bought the product for are only available after you purchase additional licenses.&lt;br /&gt;&lt;br /&gt;So when you start having project issues because of the load of junk the CIO bought, and your manager asks you why, you can safely look him in the eye and tell him straight: "Well you see this product is very strictly VDD so we have to change the way we work and that takes time, The other product didn't have this problem but it wasn't 6-zero compliant and the "Gates-Palmnisano-Ellison process" eliminated which normally happens when B-CIEPS is employed. It should get better when we start applying UFL, the developers are also quite stoked to start doing ROP.&lt;br /&gt;&lt;br /&gt;This list is only the tip of the iceberg, so if you have more let me know, a follow up post should be fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-6778629294601970486?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/06/new-buzzwords-to-reflect-reality.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-1396672635404190894</guid><pubDate>Mon, 16 Jun 2008 12:55:00 +0000</pubDate><atom:updated>2008-06-16T11:35:40.863-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">misc</category><title>The Asus eeePC. What does it's success mean for developers?</title><description>It's been a while since I last blogged, mostly because I've had quite a lot of - shock horror - work to do and just haven't had the time to do any blogging.&lt;br /&gt;&lt;br /&gt;However things are quieting down and I'm back to see how many people I can annoy :-)&lt;br /&gt;&lt;br /&gt;Anyway, I bought an Asus eeePC for my wife this weekend. &lt;br /&gt;&lt;br /&gt;Her needs are very simple; she has a corporate application she needs to run (written in a 4GL called Magic) and she needs to be very mobile.&lt;br /&gt;&lt;br /&gt;The Asus eeePC is pretty much perfect for her. The one caveat however is that her corporate application needs Windows. So after much googling I created a stripped down version of Windows XP using a utility called NtLite and managed to cram both Windows XP and her required application into the eeePC's little 2GB flash drive, with a decent amount of space to spare.&lt;br /&gt;&lt;br /&gt;The eeePC really is a sweet little machine, besides the fact you can't but help smile when you see this little machine you realise quickly that it could so easily fulfill so many applications.&lt;br /&gt;&lt;br /&gt;As I was trying to overcome some of the of the shortcomings of the machine it made me think about about some of the implications for me as a developer if the UMPC market segment takes off and I have to ensure that apps run on this class of computer.&lt;br /&gt;&lt;br /&gt;There are a couple things I suddenly need to think about:&lt;br /&gt;&lt;br /&gt;&lt;li&gt;My company has standardised on 1024 x 768 as the standard screen size for all applications, this is going to cause a stir when somebody important tries to use the system via their UMPC.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Desktop apps suddenly need to be a little leaner than they have been in the last couple of years, on the 2GB machine, 100MB is a lot, this of course includes data. Gigs and Gigs of hard disk space are suddenly a luxury.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Referring to the previous point, it's also important to make the data more portable, embedded databases are useful but having to make the user perform some complex mount operation in order to run their database off a USB disk is no good.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;If Linux ends up dominating this segment, then you can no longer say that the target OS on the desktop is going to be Windows (Not that, that ever bothered a Javaphile like me).&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;UMPCs are aimed primarily for Web access, this means the browser, JavaScript: say hello to your new, um, "female dog".&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;I actually question the value of RIA platforms here, if JavaScript/HTML is sufficient for 95% of my applications, and is the lowest common denominator anyway, do I really want the extra overhead of a RIA runtime?&lt;/li&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-1396672635404190894?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/06/asus-eeepc-what-does-its-success-mean.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-5025456172762574905</guid><pubDate>Sat, 24 May 2008 10:11:00 +0000</pubDate><atom:updated>2008-05-24T04:20:09.475-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Ruby</category><category domain="http://www.blogger.com/atom/ns#">groovy</category><category domain="http://www.blogger.com/atom/ns#">scala</category><title>Is Java the new C?</title><description>I've been watching the language changes being proposed by the community for Java 7.0 like a hawk.&lt;br /&gt;&lt;br /&gt;Alex Miller's &lt;a href="http://tech.puredanger.com/"&gt;Pure danger tech&lt;/a&gt; blog has become one of my favourite reads as a result.&lt;br /&gt;&lt;br /&gt;However I'm pretty sure I'm not the only one who seems to be rather disappointed about what came out of JavaOne this year regarding the proposed Java language features.&lt;br /&gt;&lt;br /&gt;It seems that many of the changes will probably be &lt;a href="http://www.javaposse.com/index.php?post_id=340584"&gt;postponed&lt;/a&gt; until Java 8.0.&lt;br /&gt;&lt;br /&gt;Maybe this is not such a bad thing though.&lt;br /&gt;&lt;br /&gt;If I look at the message coming out from JavaOne I could summarise it as being: "Please use Java as a platform but you don't need to use the Java language at all".&lt;br /&gt;&lt;br /&gt;In fact I have have a vast array of excellent choices:&lt;br/&gt;&lt;br /&gt;&lt;li&gt;If I want a highly productive platform for doing web development, use JRuby.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;If I want a highly productive platform for my existing Java Developers use Groovy.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;If I want a concise type safe platform with high productivity use Scala.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;If I want a mainstream language with Java benefits and high producivity (when it matures) use Jython.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;Of these languages, Jython (Python in Java) and JRuby (Ruby in Java) are the most "mainstream" being in the top ten on the &lt;a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html"&gt;Tiobe index&lt;/a&gt; with Python and Ruby respectively sandwiching C# - which in itself is quite amazing considering that neither have had C#'s marketing.&lt;br /&gt;&lt;br /&gt;Groovy and Scala are a little less mainstream but both have broken into the top 50 with Groovy at number 33 behind Smalltalk and Haskell and Scala finally breaking into the top 50.&lt;br /&gt;&lt;br /&gt;Would I still need to write stuff in Java? sure, but only for those bits and pieces which need some low level stuff where speed becomes important especially considering that Java is the only language in the list which still supports primitives, In this scenario the Java language takes on roll much like C. &lt;br /&gt;&lt;br /&gt;In fact I'd even go so far to say that Java needs to stay the way that it is in in order to keep it viable for this very important role.&lt;br /&gt;&lt;br /&gt;After all we wouldn't want to turn it into the new C++.&lt;br /&gt;&lt;br /&gt;Maybe then we should stop regarding Java as the new Cobol but rather look at it as the new C.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-5025456172762574905?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/05/is-java-new-c.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">6</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-1441458810830344749</guid><pubDate>Sat, 10 May 2008 06:09:00 +0000</pubDate><atom:updated>2008-05-09T23:57:25.372-07:00</atom:updated><title>JavaFX is a good thing! Really it is!</title><description>I feel like I must be the only person who thinks that JavaFX is a good thing.&lt;br /&gt;&lt;br /&gt;As a Java developer who wrote his first Applet some ten years ago, I kind of find it hard to swallow when IT journalists say things like "Sun has discovered RIA's four years late".&lt;br /&gt;&lt;br /&gt;I've got news for you pal, Sun discovered RIA's back in 1995. &lt;br /&gt;&lt;br /&gt;What about Adobe Air? huh! don't make me laugh, I've been using Webstart for many, many years now.&lt;br /&gt;&lt;br /&gt;Now Applets are not cool, their is no way to get around that, but they were RIA technology version 1.0 or maybe even version 0.9 and it's true that Flash and Silverlight are definitely version 2.0.&lt;br /&gt;&lt;br /&gt;It's also true that JavaFX in terms of features doesn't bring too many new things to the table.&lt;br /&gt;&lt;br /&gt;But is that a bad thing? There are so many reasons why JavaFX is a good thing. consider the following:&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Somebody seems to forget to mention that JavaFX has the only runtime that has first class support for every major operating system. And that's not planned support, that's support that is available today. I'd like to see a Silverlight application running on AIX or even on my PS3.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;JavaFX has the same runtime technology that powers many of the world's mission critical systems today. That full power is made available to you on the desktop. It might not be important for a Gmail interface but it is important for a corporate developer like me.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;If Sun makes good on it's promises, JavaFX will be the only fully open source RIA with a fully open source runtime. It will even have open source development tools.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;It means that companies can re-use their existing Java skills - aka, you and me - for the creation of RIAs.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;If it does nothing else, maybe JavaFX might give some credibility back to Java as a GUI development tool. And maybe, just maybe it means that companies might start reconsidering deploying Swing based applications to the desktop. Especially considering that Swing has never been better than it is right now with beans binding and JSR-296, together with the vast array of  Swing improvements under the hood.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;If Java regains credibility on the desktop, it gives an opening to all languages running on the JVM on the desktop. Maybe it might allow Ruby to break the rails mould.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;JavaFX is a very interesting language, I am personally looking forward to seeing where I can push it outside of the RIA space.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Having worked with XAML, the prospect of defining GUIs in horrid XML is very unappealing, give me flash and indeed JavaFX any day of the week&lt;/li&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-1441458810830344749?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2008/05/javafx-is-good-thing-really-it-is.html</link><author>noreply@blogger.com (julian_za)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">7</thr:total></item></channel></rss>
