Java Posse #264 - Newscast for July 2nd 2009
- Mozilla releases Firefox 3.5 with HTML 5 support
- NetBeans 6.7 final has been released
- http://weblogs.java.net/blog/kalali/archive/2009/06/netbeans_67_is.html
- http://blogs.sun.com/theaquarium/entry/netbeans_6_7_final_is
- http://www.netbeans.org/features/
- http://weblogs.java.net/blog/cayhorstmann/archive/2009/06/a_first_look_at.html
- http://weblogs.java.net/blog/cayhorstmann/archive/2009/06/upgrading_to_ec.html
- http://eppleton.sharedhost.de/blog/?p=701
- http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing
- The department of justice has delayed what was previously looking to be a fast-tracked review of the Oracle's Sun takeover bid
- Java mobile app of the week - jTwitter
- James Sugrue has created an Eclipse Galileo podcast series.
- The Java.net community corner podcasts recorded at JavaOne have started to be released on java.net.
- The android project backed by Google and the open handset alliance has released support for native C/C++ development for the platform in addition to the Java development environment.
- Axel Rauschmayer has some details on eclipse-zone about the upcoming eclipse 4 development.
- Greg Brown has an article up on Java.net that covers some of the features in the upcoming Apache Pivot 1.3.
- A new refcard from DZone covers Grails.
- Silicon Valley Code Camp 2009 details have been announced. The event will take place on October 3rd and 4th at Foothill college in Los Altos.
- Michael Galpin has a new article up over at IBM developer works about how to write Scala applications for Android.
- Programming in Scala (Bill Venners, Martin Odersky, Lex Spoon)
- Unlocking Android (Frank Ableson, Charlie Collins, and Robi Sen)
- The Manga Guide to Physics (Hideo Nitta, Keita Takatsu)
Code Review Tools1. Review Board (http://www.review-board.org)2. Rietveld, from GVR, which is derived from Google's Mondrian (http://code.google.com/p/rietveld/)
OPS4J PaxRunner and PaxExamhttp://ops4j.org
Scala goes PLEAChttp://github.com/michaelkebe/pleac-scala/tree/master
PLEAC's homepage:
http://pleac.sourceforge.net
Thanks
- Libsyn.com - http://www.libsyn.com - for hosting and bandwidth
- Brice Ruth and Webprojkt.com - http://webprojkt.com - for our archives site - http://archives.javaposse.com
- Feedburner.com - http://www.feedburner.com - for feed redirect
- Kirsty Doherty, Oliver Widder and Amy Ehmann for Java Posse artwork
- Brian Ehmann - the Java Posse intern
- Craig Muth for maintaining the Java Posse Memorizable site - http://memorizable.org/Java_Posse
- Theme Music:
- Opening - "Java" the parody song Copyright 1997 Broken Records and Marjorie Music Publ. (BMI),
written and performed by Loose Bruce Kerr of the Dr. Demento Show and Sun Microsystems attorney.
Based on the WWI popular song, "Ja-da." Ukelele style on the recording taught to Bruce by his dad.
Re-produced with kind permission from "Loose" Bruce Kerr - http://loosebrucekerr.libsyn.com http://www.youtube.com/watch?v=TAX0gJt-aZg
- Closing - Juan Carlos Jimenez - In the House (Intro No. 1)
- Opening - "Java" the parody song Copyright 1997 Broken Records and Marjorie Music Publ. (BMI),
- To contact us:
- Visit our homepage - http://javaposse.com
- Post on our Google Group - http://groups.google.com/group/javaposse
- Pose a question on our Google Moderator group - http://tinyurl.com/q4javaposse
- Call us with questions and feedback - (408) 465 4626
- Or send us email - javaposse@gmail.com
Latest ADF 11g (11.1.1.1.0) Rich Client Demo is available
Boeing Shows NetBeans-Based Rich Client Platform Applications [Screencast]
OpenMQ Roadmap Updated
Ed has updated the Roadmap for OpenMQ with the information related to OpenMQ 4.4, targeted for GlassFish v3. Key features include:
• JMS Bridge -- Connect to other Open MQ clusters, or other JMS products
• STOMP -- use the Streaming Text Oriented Message Protocol in Open MQ
• Embedding -- Use Open MQ as an embedded messaging provider in your own Java application
Full details at OpenMQ 4.4 Feature Page.
Jazoon ‘09: The Conference
This was my first time to attend (and speak) at the Jazoon conference and though I was only able to attend for 2 days I really did have a great time attending the conference and talking in person (and drinking with)Â with a number of well known individuals in the Java industry including Bela “a blast” Ban (JBoss), Mike “I’m nice” Keith (Oracle), and Kirk Pepperdine (Kodewerk)Â who dared discuss and debate application performance management & monitoring approaches with me over lunches and walks to and from our hotel.

Kirk just about to experience my Irish resolve.
I did attend the keynote session given by Adrian Colyer (SpringSource) and I must say I was impressed with his presentation skills even though it was a tad bit too long in terms of the green theme and light on in-depth technical analysis but I suppose there is only so much you can do in such a short time especially when predicting the future which could all change with an acquisition. The same cannot be said for the other main session I attended in which Peter “let me put this chastity belt on your classloaders before everything drops out under” Kriens (OSGi) who did a very poor job of presenting a supposedly technical session which in fact turned out to be more like “let me preach & market my 10 year old modular framework (that keeps re-inventing new component models)”. Peter really used every cheap marketing trick in the book when it came to the information (can we even call it [data] that, more like the gospel according to Peter) he presented in his slides. His insistence that modularity should be managed entirely outside of the language and oblivious to the Java runtime sounded like someone completely divorced from reality (vital lies?).
When Juergen Hoeller (SpringSource) was pulled over to our table I did question him on whether Rod (SpringSource)Â should continue blogging or go back to coding factory classes. What is worse? His reply was “No comment”.
PostgreSQL 8.4 now available
jclouds releases updated beta for Amazon S3
What is the Appeal of Ajax and GWT?
JavaFX - ComboBox
JavaFX SDK provides Control and Skin interface which can be used to create custom controls. Lets create a ComboBox with these two classes...
For Applet mode, click on above image
The ComboBox is created using a combination of Label and ListView. The ListView instance is dynamically inserted into content of Scene so that it appears on top of all existing content. Its deleted from Scene on making list invisible.
The entire logic of control is implemented in Skin. Behavior class can be implemented to handle keyboard events. The look is copied from Nimbus. It can be easily customized.
Try it out and let me know feedback
Source:
var dzone_url = "http://blogs.sun.com/rakeshmenonp/entry/javafx_combobox"; var dzone_style = '2';
E4 – A New Area For RCP/RIA Applications
Caught Between Two IDEs
Java Forum Stuttgart
Yesterday, I was attending the 12. Java Forum Stuttgart and compared to the last time I went, which was in 2005, the event has really fledged. The quality of the sessions was good and the hallway was filled with familiar faces. The theme of the conference for me, was JPA and O/R mappers. There were a couple of really great talks about it and it seems like there's a lot of going on in that area at the moment.
I'm definitely gone be there again next year and I would love for the conference to be extended to a 2-3 days event.
Microbenchmarking Scala vs Java
Final numbers are at the end of the post.
I added few changes:
First I thought it would be better if both Scala and Java would sort the same size of array ;-) In Nick's example Java sorted 10,000 elements and Scala sorted 100,000.
The other was to do few iterations int he same JVM run to let JIT kick in. So now the Scala code looks like this:
package quicksortAnd here is the Java code:
import java.lang.Long.MAX_VALUE
object QuicksortScala {
def quicksort(xs: Array[Int]) {
def swap(i: Int, j: Int) {
val t = xs(i); xs(i) = xs(j); xs(j) = t
}
def sort1(l: Int, r: Int) {
val pivot = xs((l + r) / 2)
var i = l;
var j = r
while (i <= j) {
while (xs(i) < pivot) i += 1
while (xs(j) > pivot) j -= 1
if (i <= j) {
swap(i, j)
i += 1
j -= 1
}
}
if (l < j) sort1(l, j)
if (j < r) sort1(i, r)
}
sort1(0, xs.length - 1)
}
def main(args : Array[String]) {
var time = MAX_VALUE
for(i <- 0 to 100) (time = Math.min(time, doSort))
println("Scala time = " + time)
}
def doSort() = {
var a : Array[Int] = new Array[Int](10000000)
var i : Int = 0
for (e <- a) {
a(i) = i*3/2+1;
if (i%3==0) a(i) = -a(i);
i = i+1
}
val t1 = System.currentTimeMillis();
quicksort (a)
val t2 = System.currentTimeMillis();
t2 - t1
}
}
package quicksort;Decompiling the Scala code shows that there is no benefit of using the @specialized annotation since the Scala compiler compiles all the ints to primitives. Here is the Scala class decompiled code:
public class QuicksortJava {
public void swap(int[] a, int i, int j) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
public void quicksort(int[] a, int L, int R) {
int m = a[(L + R) / 2];
int i = L;
int j = R;
while (i <= j) {
while (a[i] < m)
i++;
while (a[j] > m)
j--;
if (i <= j) {
swap(a, i, j);
i++;
j--;
}
}
if (L < j)
quicksort(a, L, j);
if (R > i)
quicksort(a, i, R);
}
public void quicksort(int[] a) {
quicksort(a, 0, a.length - 1);
}
public static void main(String[] args) {
QuicksortJava sorter = new QuicksortJava();
long time = Long.MAX_VALUE;
for(int i = 0; i < 100; i++)
time = Math.min(time, sorter.doSort());
System.out.println("java time = " + time);
}
private long doSort(){
// Sample data
int[] a = new int[10000000];
for (int i = 0; i < a.length; i++) {
a[i] = i * 3 / 2 + 1;
if (i % 3 == 0)
a[i] = -a[i];
}
long t1 = System.currentTimeMillis();
quicksort(a);
long t2 = System.currentTimeMillis();
return t2 - t1;
}
}
package quicksort;I tried to compile and run the code in Scala 2.8 anyway and the results where exactly the same as with running it under Scala 2.7.5.
import java.rmi.RemoteException;
import scala.*;
import scala.runtime.*;
public final class QuicksortScala$
implements ScalaObject
{
public QuicksortScala$()
{
}
private final void sort1$1(int l, int r, int ai[])
{
do
{
int pivot = ai[(l + r) / 2];
int i = l;
int j = r;
do
{
if(i > j)
break;
for(; ai[i] < pivot; i++);
for(; ai[j] > pivot; j--);
if(i <= j)
{
swap$1(i, j, ai);
i++;
j--;
}
} while(true);
if(l < j)
sort1$1(l, j, ai);
if(j < r)
l = i;
else
return;
} while(true);
}
private final void swap$1(int i, int j, int ai[])
{
int t = ai[i];
ai[i] = ai[j];
ai[j] = t;
}
public long doSort()
{
ObjectRef a$1 = new ObjectRef(new int[0x989680]);
IntRef i$1 = new IntRef(0);
(new BoxedIntArray((int[])a$1.elem)).foreach(new anonfun.doSort._cls1(a$1, i$1));
long t1 = System.currentTimeMillis();
quicksort((int[])a$1.elem);
long t2 = System.currentTimeMillis();
return t2 - t1;
}
public void main(String args[])
{
LongRef time$1 = new LongRef(0xffffffffL);
Predef$.MODULE$.intWrapper(0).to(100).foreach(new anonfun.main._cls1(time$1));
Predef$.MODULE$.println((new StringBuilder()).append("Scala time = ").append(BoxesRunTime.boxToLong(time$1.elem)).toString());
}
public void quicksort(int xs$1[])
{
sort1$1(0, xs$1.length - 1, xs$1);
}
public int $tag()
throws RemoteException
{
return scala.ScalaObject.class.$tag(this);
}
public static final QuicksortScala$ MODULE$ = this;
static
{
new QuicksortScala$();
}
}
The numbers:
Scala: 1355ms
Java: 1265ms
==> Java was 7% faster then Scala (Closer gap then the 33% in the previous benchmark).
GlassFish Adoption Report for May '09
I've posted the May 09 GlassFish Adoption Report. Some growth from April 09, but not back to the March 09 peak; probably some seasonal drop, possibly some impact from the Oracle announcement.
The full report includes the usual download data for run-time and tools bundles, a comparison with JBoss downloads, GeoMap, Registration and Update Center.
I expect to post the June report next week.
Griffon @ Silicon Valley Web JUG
see you there!Keep on Groovying!
Why emacs is still in my toolbelt
When I first started out as a developer one of the crackpot nutjobs with whom I worked at the time convinced me that emacs was absolutely the best editor to use. I didn’t really know any better and he was by far the fastest and most nimble code navigator of anyone else in the group so I gave it a try. Many hundreds of hours of elisp hacking and a 37MB ~/.emacs.d directory later I am a fairly well worn emacs yeoman. For many years I used nothing but emacs, cramming all sorts of language modes in it to make it do fun stuff and syntax highlight everything from shell script to Java to Ruby to InstallScript (insert vomiting in own mouth joke here).
I say, with no small amount of nostalgia, that emacs is no longer the development workhorse it once was for me. I spend most of my time writing large Java projects and have fallen prey to the siren song of fancy IDE’s with their “Show me a list of all the places this specific method is called anywhere in my project” tricks and “Refactor this entire package hierarchy with all the file renaming and moving and even rename the getters and setters to reflect the new names” chicanery. Emacs had a few tricks to make it look like it was doing these things but it was always kinda hacky and required a great deal of TLC to keep it working across JDK upgrades and switching projects with environment variables and jdk-* elisp variables that were just right.
All that said, you can have my emacs when you pry it from my cold dead hands, and here’s a glimpse into why:
- Zip file handling smooth as a baby’s butt
Have you ever tried to open a zip file with emacs? Give it a try, its awesome. It shows you a normal list of all of the files in the zip archive. No big deal, right? Now move the cursor onto one of the files. Shows you the file, doesn’t it. Not bad, huh? Now try editing the file. Let’s you edit it, doesn’t it. Now try saving it. Oh baby. Right back into the archive where it belongs and you don’t even have temp files to clean up. Seriously? That’s worth the price of admission right there. - That’s what you’re computer is for, numbskull
If I see one more person with their hands hovering over their keyboards in some weird way just so that they can type “Down arrow, End, BkSpace, BkSpace” over and over for every line in a 500 line file I’m going to scream. I know emacs is not the only editor that does simple macro recording and playback, but if your editor doesn’t have that (yes, I’m staring at your Eclipse) then you most likely have wasted some time this week.
“C-x-( <do your thing here> C-x-) Ctrl-u 500 C-e” and 500 lines later your done. Menial tasks should not be done by people. - Graphical and terminal mode
This may be specific to you server developers out there, but sometimes you just need a decent editor on a headless server. I know, I know, use vi. If I wanted to ask my editors permission to type a letter I would install Clippy (ducks). Sorry, had to get that in there. Having a workable dev environment on a headless server has been a huge help on many occasions where fun graphical wizbang is just not an option. - Cross Platform
Linux, OS X, Solaris, even Windows if I really have to, but emacs comes with me everywhere. It always works and so does my well worn ~/.emacs.d directory of everything I’ve ever needed. Its a great way to lower the cognitive load of jumping around all the time. What good is your trust side kick if it doesn’t come with you wherever the fates may carry you?
The list really goes on and on. The idea here is less about emacs specifically and having really amazingly good reliable all purpose text editor to sit next to your honkin’ cool IDE and fill in the gaps. If you are a gainfully employed programmer and you use notepad.exe for anything, then you are a thief stealing from your employer.
I’ll be honest, I spend a lot less time in emacs than I used to, but every good carpenter needs a good hacksaw/screwdriver/nail puller/hedge trimmer/ladder/rotary drill/french coffee press/drop cloth/tire rotater. Right?
Registration Now Open for The Ajax Experience 2009
A Better Looking ADF Faces Application Sample
One of my tasks for the Fusion Middleware 11g launch event was to build the JDeveloper/ADF part of the demo (along with Juan).
One key thing that made a difference in the resulting demo was that we got help in the design of the pages from a professional UI designer - Soraya looked at the pages we designed initially and then gave us tips on how to make the application look cleaner. She also gave us the images that were used in the application. We then worked on layouting the page according to her recommendations and on skinning some of them.
One tip for better looking UI is to try and eliminate as much clutter from your UI as possible - the application we got at the end used far less components on each page.
While you can see the result in the recorded webcast of the launch event - I thought that for JSF developers out there I would give a full screen view and skip the 40 minutes talk that come before Duncan gets to actually run through the demo.
So here is a recording of the demo running on my machine - with some explanation about the specific components used in each place.
One key point - everything in this demo's UI was done decoratively with no Javascript coding.
Rails on GlassFish - "most performant of all", "simpler and just works", "blazing speed"
Here are some quotes about running Rails applications on GlassFish from user@jruby mailing list:
I find the glassfish gem to be the most performant of all -- and I don't need to war-up my app.
I also have some mongrel cluster stuff, but glassfish is simpler and just works.
Voila...blazing speed, can handle lots of traffic. Note that I am also cominging into apache from a dyndns name. So, whatever IP I have, I can go straight to execution on the glassfish gem and NO warring up! What could be easier deployment, or a faster execution?
It's running fantasticly and performing like nothing I've seen before :) Completely stable memory, no wirings or anything bad for 5 days now.. (with several ab/htperf stresstests).
It's always exciting to get good endorsements of our efforts in the GlassFish team :)
Other similar stories for using Rails/GlassFish in production are described at rubyonrails+stories.
Technorati: glassfish v3 gem rubyonrails stories jruby


