July 03, 2009

Followup To Themes

As a quick followup to the helpful article on themes posted to the Eclipse Tips blog, I would like to point out that all of the values that are in the currently active theme are also in the JFace registry. Yes, it is possible to get the current ITheme ...

So Long, And Thanks For All The Fish

I was hoping to post this a little closer to the date but the cat has been let out of the bag.  I've decided to leave IBM for a position at RIM.  It wasn't an easy decision to make but in the end I thought it was best for me.  ...

MinGW on Linux on Windows 7???

My Windows/Linux world has gotten a whole lot more complicated in the last few days, but I'm really liking how it's set up now.

As I mentioned in my blog entry on multi-target Makefiles, I am using Fedora 11's mingw cross compiler along with gcc's multilib support and am building the little C++ project I'm working on at work for both 32 and 64-bit Linux as well as Windows all in the same Makefile and all on every build of my CDT project. That is extremely handy and I've already fixed a problem early where there is a mismatch between the linux and mingw environments, no strndup on mingw, and was able to do so without switching machines.

This is awesome and I'll be able to produce executables for all three of these platforms for testing all in one shot. Kudos to the Fedora folk for providing first class support for mingw cross compilation and not ignoring the fact that us developers still need to target Windows once in a while. That makes Fedora my favorite development environment by far.

But, alas, Linux drivers suck for laptops. I have a Dell and a port replicator at work and at home. I have a 24" monitor at work running at 1900 wide and a 22" monitor at home at 1680 wide. I swap between the two every day, and often work undocked at home with no external monitor. I could never get Linux to recognize when I dock and to figure out which monitor was hooked up. That drove me nuts.

A couple of things have also happened recently. I've been testing the Windows 7 RC on a separate partition and have started to really like it. As a lot of people have mentioned already, it's what Vista should have been. It doesn't quite have the flash of the Mac, but I find it's a great balance between flash and the stability of XP.

The other thing that happened was that VirtualBox 3.0 has been released and it now has OpenGL support for both Windows and Linux guests. That was one of the reasons I moved to Linux, to experiment with OpenGL there. Now I can do that in a guest OS.

So putting all that together, I've replaces OSes yet again (been doing that regularly for years it seems). I'm now running on 64-bit Windows 7 with two major VMs, one for my fabulous Fedora dev environment, and one for the corporate XP environment I used to have there for Outlook and Netmeeting. So far so good. I get the odd glitch once in a while but nothing I can't recover from and it is a release candidate. But now I have the best of all worlds. Except maybe MacOSX, and an iPhone dev environment. So close...

OpenMQ Roadmap Updated

ALT DESCR

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.

JSF 2.0 Managed Beans in Maia

Maia lets you reference JSF 2.0 managed beans directly from Java code and provides completion, usage search and core refactorings for them.

Android set to launch in Japan, 1.5 deployment "nearly complete"

The first Android-powered phone will launch in Japan on July 10th. New Japanese customers will have immediate access to free applications in the Android Market, with paid apps following sometime later. That’s according to a notice sent from Google’s Eric Chu to Android app developers late Wednesday. Bulgaria and Romania are on the target list after Japan, first with phones and free apps and then with paid apps.

In other news, Google says that the over the air roll-out of Android 1.5 (Cupcake) is “nearly complete”. And of course, all new phones come with 1.5 already installed. That means that Android developers can take advantage of 1.5 features such as Home screen app widgets without worrying about trying to support older versions.

(And in other, other news, I just put the finishing touches on an update of Hello, Android that features a new appendix on how to write app widgets in Cupcake. The update will be free to all owners of the PDF, mobi, or epub versions, and cheap for owners of the dead tree version.)

[ Follow me on Twitter at: @eburnette ]

Continue reading: Full text of the notice from Eric Chu >

July 02, 2009

GlassFish Adoption Report for May '09

ALT DESCR

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.

Apache Harmony and JFreeChart

According to an article in SDTimes, Craig Hayman from IBM thinks that Apache Harmony is "ready for prime time". That surprised me (OK, not really) so I decided to give the latest release (milestone 10) a quick workout with JFreeChart. I ran various demos and concluded very quickly that Harmony is...drum roll...not ready. This also seems to be at odds with the general perception that Harmony is ready for certification as a full implementation of Java 5 (even moreso when you consider that JFreeChart only requires Java 1.3 or later).

The problems were numerous, but here's a typical one to illustrate: I took DialPlotDemo2.java (alas DialPlotDemo1.java produced no output at all) and ran it on both Harmony and IcedTea (a derivative of OpenJDK). These are the screen shots (the one on the left is from Harmony, the one on the right is from IcedTea):



When running on Harmony, the code fails before the chart renders completely, giving the following stack trace:

java.awt.geom.IllegalPathStateException: First segment should be SEG_MOVETO type at java.awt.geom.GeneralPath.checkBuf(GeneralPath.java:209) at java.awt.geom.GeneralPath.lineTo(GeneralPath.java:236) at java.awt.BasicStroke$BufferedPath.createGeneralPath(BasicStroke.java:1791) at java.awt.BasicStroke.createStrokedShape(BasicStroke.java:269) at org.apache.harmony.awt.gl.CommonGraphics2D.draw(CommonGraphics2D.java:310) at org.jfree.chart.plot.dial.StandardDialRange.draw(StandardDialRange.java:339) at org.jfree.chart.plot.dial.DialPlot.draw(DialPlot.java:565) at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1235) at org.jfree.chart.ChartPanel.paintComponent(ChartPanel.java:1669) at javax.swing.JComponent.paint(JComponent.java:1000) at javax.swing.JComponent.paintChildren(JComponent.java:979) at javax.swing.JComponent.paint(JComponent.java:1002) at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:1438) at javax.swing.JComponent.paint(JComponent.java:998) at javax.swing.JComponent.paintChildren(JComponent.java:979) at javax.swing.JComponent.paint(JComponent.java:1002) at javax.swing.JLayeredPane.paint(JLayeredPane.java:220) at javax.swing.JComponent.paintChildren(JComponent.java:979) at javax.swing.JComponent.paint(JComponent.java:1002) at java.awt.Container.paintComponentsImpl(Container.java:1007) at java.awt.Container.paint(Container.java:936) at java.awt.Component.processPaintEvent(Component.java:3676) at java.awt.Component.dispatchEvent(Component.java:3502) at java.awt.EventQueueCore.dispatchEventImpl(EventQueueCore.java:149) at java.awt.EventQueue.dispatchEvent(EventQueue.java:144) at java.awt.EventDispatchThread.runModalLoop(EventDispatchThread.java:74) at java.awt.EventDispatchThread.run(EventDispatchThread.java:48)

OK, so the exception relates to some problem in Harmony's Java2D code, but there are also visible issues with the font rendering, the Swing layout in the lower part of the panel, the labelling of the JSlider components and the look and feel.

The phrase "ready for prime time" is surely premature.

July 01, 2009

Why Grails Users Will Like NetBeans IDE 6.7 Even More Than NetBeans IDE 6.5

Here's some news for Grails users. Let's say this is my domain class:

Now, this is code completion in the BootStrap.groovy for the above domain class in NetBeans IDE 6.5:

And now, in NetBeans IDE 6.7, here's code completion in the same BootStrap.groovy:

Not bad, right? Get started with Grails in NetBeans IDE here:

http://www.netbeans.org/kb/docs/web/grails-quickstart.html

...or do so here on the Grails site:

http://www.grails.org/NetBeans+Integration

In other news. Now here's an interesting movie about Michael Jackson. Can't find the second part, though.

June 30, 2009

Three NetBeans Platform Applications You Never Knew Existed

Right now, as we speak [type], I am working on articles/interviews relating to three applications on the NetBeans Platform... none of which anyone in the broader NetBeans Platform community knows about. So, to give you a sneak preview, here they are, with a little bit of background info on each. (Not too much info, otherwise why would you want to read the completed article/interview?)

First of all, I present... a financial application, which is created in Brazil, by Paulo Canedo, and a team of developers around him, who work for the Tribunal de Contas do Estado do Tocantins, a state in Brazil, where all the financial management related to the state is done on the NetBeans Platform. The application was started in 2007 and, in particular, Paulo's team likes the wizard framework of the NetBeans Platform, as well as the update center. Combined, these features enable the application to be responsible for all finances in the city, i.e., purchases and payments. The application processes data via XML and then transforms and stores in a Derby database. Furthermore, the application is used to analyze the data thus obtained and stored.

And here is a sneak preview screenshot (more in an upcoming article):

Next, an application by Ingmar Hendriks, and others, who are students at the Hogeschool van Amsterdam. Not very long ago, they completed a NetBeans Platform Certified Training. (My blog entry "Amsterdam on the NetBeans Platform" tells you all about it.) Ingmar's graduation project was to create a sensor monitoring application. He had to make two programs, a server and a client. Because he didn't have a whole laboratory full of sensors at school, he had to simulate the sensors by generating random values within a certain parameter. The generation of these random values had to be done on the server, with a time interval of a few hundred milliseconds and the server needed to store these values. This itself sounds very doable until you realize that over 400 sensors had to be simulated, each with an interval of a few hundred milliseconds and that these had to be stored into memory and not on the hard drive.

In order to achieve this, the memory had to be controlled, which is not possible with Java because you have no control over memory management... so C++ had to be used. The client, however, was a different story. It only needed to access the values of a sensor and show them in a chart. If a value on the server exceeded its preset safety parameter, it needed to show a warning or error in the client. Here's a sneak preview screenshot of the application that resulted from all of this:

And, finally, let's take a look at Central Washington University's programming tools for the blind that, hopefully, will make them more accessible. These tools are very complicated, as they involve custom compilers, debuggers, and sound architectures. These architectures then need to be built into standard IDEs.

Here is a screen capture of the environment as a whole, annotated with details of what was added at Central Washington University. Notice that, while the screen capture looks just like NetBeans IDE, what has been added is a new programming language (Hop). In addition, the debugger is "omniscient", which means that you can execute code forward and backward. For example, in most debuggers, you can click "Continue" (the green button) and step the code to the next breakpoint. In this debugger, you can also "Rewind" (the blue button) to the previous breakpoint. Similarly, most IDEs let you step over a line of code. This one also lets you step back:

What do these applications gain from being based on the NetBeans Platform? Modularity (i.e., you can create plugins for these applications), while being based on Swing (the standard UI toolkit). That's a combination that no other framework provides natively. Typically, a developer using the NetBeans Platform begins by appreciating the NetBeans Platform's Swing extensions, such as the window system and explorer views. Later, the modularity becomes increasingly useful, both from the side of development (i.e., encapsulate code on a level higher than packages, which makes it easier to create work areas for distributed development teams) and from the side of deployment (i.e., the end user is able to extend the application, by means of plugins, without needing to download/understand the entire codebase).

But, of course, this is simply the tip of the iceberg. To find out about several other NetBeans Platform applications, click here and browse through the whole showcase. Several known applications on the NetBeans Platform cannot be advertized, i.e., must remain secret, since they're the basis of, for example, military or financial systems whose underlying technologies cannot be made public. In many ways, that's a pity, because the full length and breadth of NetBeans Platform usage will probably never be known.

Want to advertize your application on the NetBeans Platform? For free? Drop me an e-mail at geertjan DOT wielenga AT sun DOT com and it will be given all the attention you desire (plus more).

June 29, 2009

Debugging JavaScript in Mozilla Firefox

IntelliJ IDEA 9M1 supports debugging of JavaScript code in Mozilla Firefox. Just create a JavaScript Debug configuration, select Firefox from the Browser list and click OK:

IntelliJ IDEA automatically installs plugin for Mozilla Firefox and executes the configuration.
Note that you need to clear Make option under Before launch group before starting debugger to work around a bug that will be fixed in next Maia EAP.

June 28, 2009

On Galileo train

Galileo? Me too :-)

I've just released updates for two of my plugins: Bytecode Outline and Data Hierarchy.

Highlights:

Here is a screenshot which may explain Data Hierarchy better then words (check the "UnreadFields" class node). You see here the data hierarchy of the AnalysisContext class:

Understanding the Mobile Killer App

Clearly, with the success of iPhone and Blackberry and the buzz around Android and Pre, mobile already has its killer apps. But for someone new like me to this arena, I find it important that I try to understand what that app is and simplify the category so I can know where to focus what little time I have to play here. So this is what I've come up with, and I hope you have an opinion you can share in the comments to help guide me.

Here we go. I actually think there are two killer apps happening in the smartphone market today. (I'll leave out the *book platforms for another post as that's starting to gel in my mind as well). Start by looking at the iPhone, including the iPod Touch. It's really Entertainment apps that have made the iPhone one of the most popular mobile platforms of our time. My son has a Touch. He has his mp3's there, he watches YouTube videos there, he plays games on it. It's probably what the PSP should have been if it had downloadable content. The platform pretty much comes with good multimedia apps, so if you want to make a hit, writing a good game is the place to start. And looking at most of the other platforms, especially the ones with 3D hardware acceleration, this is true across the board. Actually, you look at the real big picture, good games are popular on all computing platforms, even Spacewar! on the PDP-1.

The other killer app is something a we talk lot about in the Eclipse community, especially my enterprise brethren. And that is thin web client apps. This is most obvious on the Blackberries that almost all business managers have today. Accessing e-mail from an exchange server on a small screen requires specialized software to ensure a good user experience. But I really think it goes beyond just e-mail. There are a lot of web services available in web browsers today. But web browsing on the small screen still sucks and likely will always suck. Writing a thin client that can present information from the web in a format suitable for the form factor is a real winner. The top Android apps I use are clients for gmail, twitter, and RSS. I'd love a good app that lets me write this blog, but I haven't found one yet. But I know the Google provides the API to do it and Twitter has a good API. Wrap those together and you got a customer. Or maybe I should be the developer ;).

Of course, now I'm torn. I've always dreamed of making games, but never had the opportunity to do it. I know it's a lot of work and probably something I couldn't do well in my spare time. I'm also pumped by the "mash-up" possibilities writing thin clients for internet apps. And that's probably something I can do more quickly. Lots of fun. And a reason why I think the industry is going through a reinvigoration. Where the killer app for the desktop has come and the shine has gone (that killer app was office apps, browsers, IDEs, and games by the way). There's an opportunity to get in on the ground floor of the new generation.

June 26, 2009

Icons Preview in Gutter Bar

Maia supports preview of icons you are using in Java code directly from the editor. For each of the icon definitions (javax.swing.Icon), Maia tries to locate a file from which it is loaded and then shows a preview in the gutter bar. You can click it to open the image for editing, of course.

June 25, 2009

Program for Android in C/C++ with the Native Development Kit (if you dare)

Not a big fan of Java? Well, get over it, because that’s the primary and recommended way to write applications for Android devices. It’s portable and… what’s that? Android’s Dalvik Java VM not fast enough for you? Granted, it’s an interpreted engine and as of version 1.5 there’s no Just-In-Time compiler. But Dan promises… oh, can’t wait for the JIT to come out? Ok, ok, we’ll let you program in C if you’re really sure.

Introducing the Android Native Development Kit (NDK). With it, you can implement *parts* of your application using native-code languages such as C and C++. You’re familiar with the Java Native Interface (JNI), right? JNI lets you load a shared library and call C code from within Java. The NDK lets you compile and build those libraries for the ARM CPU chip used in all *current* Android devices.

The NDK provides:

  • A set of tools and build files used to generate native code libraries from C and C++ sources
  • A way to embed the corresponding native libraries into application packages files (.apks) that can be deployed on Android devices
  • A set of native system headers and libraries that will be supported in all future releases of the Android platform, starting from Android 1.5
  • Documentation, samples, and tutorials

Users downloading your program from the Market will not be able to tell whether or not you used native code. In fact, some apps already on the Market use it. However, native code is not for everyone. Google engineer David Turner writes:

Keep in mind that using the NDK will not be relevant for all Android applications. As a developer, you will need to balance its benefits against its drawbacks, which are numerous! Your application will be more complicated, have reduced compatibility, have no access to framework APIs, and be harder to debug. That said, some applications that have self-contained, CPU-intensive operations that don’t allocate much memory may still benefit from increased performance and the ability to reuse existing code. Some examples are signal processing, intensive physics simulations, and some kinds of data processing.

You have been warned. Stay away from the NDK unless you really need it. Try optimizing your Java code first. Try profiling. Acupuncture, cold compresses, anything but… what did you say? “Shut the…,” hey, there’s no need to be rude. Have at it.

Maia Reaches Its First Milestone

We’re happy to announce the first Milestone release of upcoming IntelliJ IDEA 9, nicknamed Maia.
This release delivers a fresh preview of features and improvements we’ve implemented so far for IntelliJ IDEA 9:

  • Java EE 6
  • Tapestry
  • OSGi
  • Android
  • Google App Engine
  • PHP
  • And more


You’re welcome to download IntelliJ IDEA 9M1, traditionally available for Windows, Mac OS X and Unix systems.

Selecting Target Player for Flex Applications

With Maia it’s easy to target a specific version of Flash player for your Flex/AIR applications. All you need is to specify it on the Flex Compiler Settings tab of a Flex module or facet:



With Flex SDK 3.2.0 or later you can target players of either version 9 or 10. Remember that version of playerglobal.swc library attached to module or facet SDK must match your target selection. Maia takes care of it by automatically changing SDK to an one that contains required library. If there is no such SDK, it will be created for you. By the way, a default Flex SDK name contains major version of target player:



AIR SDK name does not contain target player information because it does not include playerglobal.swc library, and airglobal.swc library does not vary from version.

Note: Changing a target player version for Flex module or facet may lead to changes it its SDK configuration and vice versa — if you change module or facet Flex SDK, it may affect the target player version settings.

In IntelliJ IDEA 8.x there is no special configuration setting for target player version, so to target a custom player version you need to change playerglobal.swc library attached to the used SDK manually (either <Flex SDK>/frameworks/libs/player/9/playerglobal.swc or <Flex SDK>/frameworks/libs/player/10/playerglobal.swc) and also to write Additional compiler option like -target-player=10

Show Usages Popup Facelift

Maia brings you an improved Show Usages popup (Ctrl+Alt+F7):

  • Filter buttons let you show or hide usages right from the popup
  • Open Find Usages Tool Window button shows all usages in a tool window like Find Usages command
  • Options button lets quickly select a scope and adjust other search settings
  • Paging through usages provides for quicker appearing and does not clutter the screen


Show Usages Popup

FlexUnit 4 Support in Maia

Maia includes support for running FlexUnit 4 tests. All you need is to a add dependency to FlexUnit4.swc library and your FlexUnit4-style tests will be recognized and run. FlexUnit4 runner supports legacy tests (FlexUnit 0.9 and Flunit), so you don’t have to worry about existing code. Maia also includes some nifty testing support features:

  • Browsing for a test class, package or method while editing a FlexUnit run configuration
  • Execution of tests both in run and debug mode


Test Runner

Test with pleasure!

Windows Vista in Multiple Languages?

A few weeks back, I had to buy a laptop at short notice. In France. The laptop (a cheapish one) came with "Microsoft Vista Edition Familiale Basique" preinstalled. Everything in French, as you'd expect. I found the control panel and spent quite some time looking for the option to switch the display language to English. Modifying the country / region didn't change the language. There were options to change the locale for date and currency formatting, but nothing to change the language. I had to be missing something.

langue.png

Anyway, I had work that needed doing, so I pressed on with installing the applications I needed and copying across my data files. Only later did I come back to search again for the display language setting. And you know what - THERE ISN'T ONE. It turns out that if you have a "low end" version of Vista, you don't get to change the language. Ever. Unless you buy another version of Vista (apparently Windows Vista Ultimate or Enterprise will let you switch languages---I guess it is an "ultimate" kind of feature). I could rant and rant about how mind-numbingly stupid this, but is doesn't matter anymore because I downloaded a free update that fixes the problem (and a whole bunch of others too), and now I have my system displaying the language of my choice:

http://www.ubuntu.com/getubuntu/download

Where did you go yesterday?

June 24, 2009

Eclipse Galileo release train now arriving at gate 3.5

Besides death and taxes, there is one other certainty in the life of a software developer: slipping schedules. Every year, though, Eclipse continues to defy that expectation by releasing a major new version in late June. Today, the Eclipse Galileo release train arrived exactly on time, for the 6th year in a row.

Galileo is a synchronized release of 33 separate projects all under the umbrella of the Eclipse Foundation. Over 380 committers from 44 different organizations participated to make this release possible.

Many of the projects in Galileo are tools for developers, for example the Java Development Toolkit, C Development Toolkit, Memory Analyzer, Web Tools, Subversion, and of course the Eclipse Platform (version 3.5). Others are more oriented towards end users such as the Business and Reporting Tools.

For 2009, a new category of projects has coalesced under the name “Eclipse Runtime Technology”. This includes Equinox (Eclipse’s implementation of the OSGi standard), the Eclipse Communication Framework, Rich Ajax Platform, Riena (modular business application platform), Swordfish (SOA framework), and EclipseLink (persistence services).

Another major focus of the 2009 release is modeling tools. New innovations in Galileo include Xtext (for creation of domain specific languages) and Connected Data Objects (distributed shared models with transactions).

“The release train continues to be a great achievement of the Eclipse community,” explained Mike Milinkovich, Executive Director of the Eclipse Foundation. “Galileo demonstrates that large distributed software development can be done on a predictable schedule. This predictability makes it possible for our user and adopter community to quickly adopt new releases from Eclipse.”

Eclipse Galileo with Eclipse Platform 3.5 is available immediately from the eclipse.org download site. This year, downloads should fly thanks to a partnership with Amazon Web Services. Package sizes range from 79MB to 367MB depending on what components you need.

Related articles:

June 23, 2009

Subclipse and Eclipse 3.5/Galileo

With the Eclipse 3.5 final release now available, I thought it would be good to get a post up for Subversion users that are looking to install this release. Subclipse works great in Eclipse 3.5 and is easy to install. There are two versions of Subclipse available with support for Eclipse 3.5.

Subclipse 1.4.x is based on Subversion 1.5 client API
Subclipse 1.6.x is based on Subversion 1.6 client API

Install the version of Subclipse based on the version of Subversion you want to use. This is mainly an issue if you want to use multiple clients with the same Subversion working copy. If you do all of your work from Eclipse, then just grab the latest version. All Subversion 1.x clients can work with all Subversion 1.x servers. So, if possible, just use the latest version.

OSX and Linux users need to install the right version of the JavaHL library (1.5 or 1.6). Most Linux distros are still providing 1.5.x, but the RPM's from CollabNet include JavaHL and install on every Linux distro that I have tried (including Ubuntu). CollabNet also provides binaries and JavaHL for OSX.

I maintain a wiki on the Subclipse site with detailed information about getting JavaHL working on your system.

In other news, Subclipse 1.6.x now includes the CollabNet Merge client. This was developed as part of the merge tracking feature in Subversion 1.5 and makes merging from Eclipse very easy to do and manage. The CollabNet Merge client is part of the CollabNet Desktop - Eclipse Edition, which includes Mylyn and connectors for CollabNet's trackers. The merge client is now also available directly for Subclipse users with no other dependencies. Users that want the full merge client, which adds the change set merge option, can install the CollabNet Desktop.

Eclipse Membership providing bulk of Galileo Bandwidth

A big thanks to all those Eclipse Foundation members who will be providing the bulk of the bandwidth for the Galileo release this year. Their support helps us keep eclipse.org humming fast (as best we can for a release week) and offers users many paths to very fast downloads.

How is this for fast? EclipseSource has implemented Yoxos on Amazon CloudFront which promises to be a very fat pipe. Oracle and Actuate are making use of Akamai for their bandwidth. Moreover, Amazon has generously donated use of their bandwidth to the Eclipse Foundation to help take a lot of pressure off our Mirrors – Thanks Amazon!

That’s not to mention the other dozen (or so) members who have pledged to provide as much blazing bandwidth as they can including Blu Age, Genuitec, IBM, Intalio, Innovations, Itemis, Obeo, Polarion, Sopera and Zend!

Hope everyone has a fast and happy download experience tomorrow!

- Don

June 19, 2009

NetBeans Platform Hands-on Lab at JavaOne 2009

Hands on labs are always great at JavaOne. You aren't just listening to a presentation but you can try a technology on real machine. And there is plenty of people ready to help you with an advice when you got lost. You can imagine the session as a tutorial that you are doing with help of friend. We set up everything for you - documentation, environment,room, speakers and the proctors that wil help. You just sit down to a computer and get your hands dirty with the code ;)

This year Jiri Rechtacek and me prepared HOL about NetBeans Platform. The HOL provides you a short overview of the most important NetBeans APIs. The scenario of the tutorial is pretty simple - transform an existing Swing application to application based on NetBeans Platform. At the end you'll find out that the application looks the same but it's much more easier to create it because you can just focus on the business logic. The other things that you usually have to bother with desktop application as windows management, modules management etc. have been solved by the NetBeans Platform.

The HOL will be available on the official JavaOne online pages soon. For those who would like to try it immediately you can download the ZIP that we provided to NetBeans Dream Team. Enjoy it!

I'd like to thank to the NetBeans Dream Team members that joined the HOL. These guys really helped to increase the HOL quality with their experience with the NetBeans Platform. Who could be better proctor than somebody who use the product in daily work and makes money from it. Great thanks go to Toni Epple, Sven Reimers , Florian Vogler, Wade Chandler and Rich Unger. Thank you, guys!

Geertjan and Tone had a similar technical session TS-3886 Porting an Application to the NetBeans Platform where they explained more reasons the NetBeans Platform and how it helps developers.

Finally a portable implementation! The Bayeux protocol now supported by the Atmosphere Framework

The work done by the Cometd team, the java implementation of the Bayeux Protocol, can now run on top of the Atmosphere Framework. Under the hood, the proper Comet API is as usual detected!

mathieu 019.jpg

The default implementation uses Jetty 7 Continuation under the hood...but now if you run it on top of the Atmosphere Framework, it will auto detect the container's native Comet API (or use the Servlet 3.0 async if available)! So you can now run the same application using GlassFish, Tomcat 5/6, Jetty 6, WebLogic, JBossWeb and event Tomcat 4 (happy 10 years!)

So for the first time (why? read Matthias here), we have finally a PORTABLE Bayeux protocol implementation! See the official announcement here (and how to try it).

For any questions, go to our main site and use our Nabble forum (no subscription needed) or follow us on Twitter and tweet your questions there!

technorati:

June 18, 2009

Fresh Update: IntelliJ IDEA 8.1.3

IntelliJ IDEA 8.1.3 update is available. Download the fresh build that includes:

  • SVN 1.6 integration
  • TFS checkin policies support
  • Keymap for NetBeans users
  • More robust indexes


For more information about fixes and improvements see Release Notes.

June 17, 2009

My notes for Ubuntu 9.04 64b

My hard drive crashed therefore I received a new one. It means reinstall the Ubuntu 9.04 again. This post shgould be gathering of the steps necessary for me to start work again.

June 16, 2009

Mobile megahertz madness heats up

The competition is heating up in the market for smartphones and other mobile devices. Literally. As competitors try to leap-frog each other in performance we’re seeing a repeat of the desktop computer’s Megahertz arms race, only this time the palm of your hand. You might want to put on some oven mitts.

The story so far:

Continue reading: Megahertz madness >

June 15, 2009

Jazoon!

I'll be spending next week in Zurich at Jazoon'09. They've got a great lineup of technical sessions to pump your head full of all the latest everything. The lineup of speakers is pretty impressive.

PS. Several folks have asked why I disappeared from JavaOne so quickly after my Toy Show keynote: my youngest daughter's school was holding a talent show at noon, and I had to be there. Work is not at the top of life's priority list :-)

Firefox 3.0.11 fixes 67 bugs including bookmark corruption

The latest update to Firefox addresses 67 bugs and enhancements, according to Mozilla. 23 bugs were marked as “critical” or higher. (Coincidentally this was the same number addressed by the 3.0.9 update in April.)

Nine potential security vulnerabilities were patched including 1 marked as “high” and 4 “critical”:

  • MFSA 2009-32 JavaScript chrome privilege escalation (critical)
  • MFSA 2009-31 XUL scripts bypass content-policy checks
  • MFSA 2009-30 Incorrect principal set for file: resources loaded via location bar
  • MFSA 2009-29 Arbitrary code execution using event listeners attached to an element whose owner document is null (critical)
  • MFSA 2009-28 Race condition while accessing the private data of a NPObject JS wrapper class object (critical)
  • MFSA 2009-27 SSL tampering via non-200 responses to proxy CONNECT requests (high)
  • MFSA 2009-26 Arbitrary domain cookie access by local file: resources
  • MFSA 2009-25 URL spoofing with invalid unicode characters
  • MFSA 2009-24 Crashes with evidence of memory corruption (rv:1.9.0.11) (critical)

The new release addresses a problem that apparently affected a lot of people (bug 464486). If Firefox crashed or your machine died at just the right time, your bookmarks and history database could have been lost or corrupted. The earliest report I could find of the problem was on September 7th, 2008.

In the end, a 2 line fix to turn on full synchronous operation of the SQLite database used to store bookmarks was all that was needed. Although the fix was known in January, it wasn’t backported to Firefox 3.0 until recently because of concerns about how it might affect performance, especially on Linux. Further study showed, however, that performance was only slightly degraded on newer versions of Linux, and data integrity was deemed to be more important.


Mozilla has been updating Firefox 3 approximately once a month since its release in June of last year. Here’s a list of all the updates so far:

June 13, 2009

Atmosphere 0.2 GA now available

Finally, Atmosphere 0.2 released with support for annotations for REST application, improved support for Tomcat/Jetty/GlassFish, native support for JBossWeb 2.1.x, and EJB/External components broadcast lookup available.

02-atmosphere.png

Official announcement here

technorati:

June 11, 2009

Updated version of Python plugin for IDEA 8 and 9

Today we’ve released an updated version of the Python plugin, with support for both IntelliJ IDEA 8 and “Maia” EAP. New features of the plugin include:

  • Graphical test runner
  • Python facet (allowing to work with Python scripts in Java and other modules)
  • Several new quickfixes
  • Code completion, syntax highlighting and editing improvements

You can find detailed release notes and screenshots of the new plugin on our Confluence space.

Getting started with the Atmosphere Framework part III: Dead Simple async REST application

In that part, I describe a simple asynchronous REST application using behaviors.js, prototype.js and the Atmosphere Framework. As usual, you can deploy the app anywhere! If you interested to look for a complex Atmosphere application, take a look at the Twitter revisited one.

Picture 426.jpg

To understand the basic of Atmosphere, I recommend you take a quick look at part I and II. This time I will explains a simple application, which uses long polling for suspending connection. First, let's see what the war file structure looks like:

./index.html
./WEB-INF
./WEB-INF/context.xml
./WEB-INF/classes
./WEB-INF/classes/org
./WEB-INF/classes/org/atmosphere
./WEB-INF/classes/org/atmosphere/samples
./WEB-INF/classes/org/atmosphere/samples/rest
./WEB-INF/classes/org/atmosphere/samples/rest/counter
./WEB-INF/classes/org/atmosphere/samples/rest/counter/RestLongPolling.class
./WEB-INF/lib
./WEB-INF/lib/jersey-core-1.1.1-ea-SNAPSHOT.jar
./WEB-INF/lib/atmosphere-core-0.2.jar
./WEB-INF/lib/asm-3.1.jar
./WEB-INF/lib/atmosphere-portable-runtime-0.2.jar
./WEB-INF/lib/jersey-server-1.1.1-ea-SNAPSHOT.jar
./WEB-INF/lib/jsr311-api-1.1.jar
./WEB-INF/web.xml
./javascripts
./javascripts/prototype.js
./javascripts/counter.js
./javascripts/behaviour.js
./META-INF
./META-INF/context.xml
./META-INF/atmosphere.xml
./stylesheets
./stylesheets/styles-site.css

The two important files are the RestLongPolling, which contains the server side code, and the counter.js, which contains the client side code. The client simply looks like:

  1 var counter = {
  2     'poll' : function() {
  3         new Ajax.Request('dispatch/counter', {
  4             method : 'GET',
  5             onSuccess : counter.update
  6         });
  7     },
  8     'increment' : function() {
  9         var count = $('count').innerHTML * 1;
 10         new Ajax.Request('dispatch/counter/' + count, {
 11             method : 'POST'
 12         });
 13     },
 14     'update' : function() {
 15         var count = $('count').innerHTML * 1;
 16         $('count').innerHTML = count + 1;
 17         counter.poll();
 18     }
 19 }
 20 
 21 var rules = {
 22     '#increment': function(element) {
 23         element.onclick = function() {
 24             counter.increment();
 25         };
 26     }
 27 };
 28 
 29 Behaviour.register(rules);
 30 Behaviour.addLoadEvent(counter.poll);

On the screen, it looks like:

click.png

As soon as you click, the counter send a request, appending the count value to the URL. Every browser connected will be updated as soon a click event happens. The idea here is to really show something simple. Now, on the server side, we only have (I'm not kidding!):

  1 package org.atmosphere.samples.rest.counter;
  2 
  3 import com.sun.jersey.spi.resource.Singleton;
  4 import java.util.concurrent.atomic.AtomicInteger;
  5 import javax.ws.rs.GET;
  6 import javax.ws.rs.POST;
  7 import javax.ws.rs.Path;
  8 import javax.ws.rs.PathParam;
  9 import org.atmosphere.core.annotation.ResumeOnBroadcast;
 10 import org.atmosphere.core.annotation.Suspend;
 11 
 12 @Path("{counter}")
 13 @Singleton
 14 public class RestLongPolling{
 15     private final AtomicInteger counter = new AtomicInteger();
 16     
 17     @GET
 18     @Suspend
 19     public String suspend(){
 20         return "<!-- Atmosphere is your future-->";
 21     }   
 22     
 23     @POST
 24     @Path("{counter}")
 25     @ResumeOnBroadcast
 26     public String increment(@PathParam("counter") String count){
 27         counter.incrementAndGet();
 28         return counter.toString();
 29     }   
 30 }

So, when the Browser load the page, the counter.poll will invoke, on the server side the suspend() method. Since that method is annotated with the @Suspend annotation, the connection will be suspended after the method execution, waiting for event. You can see the Browser icon spinning in that demo as the GET has not yet returned. As soon as a click happens (line 8), the POST will invoke the increment(..) (line 26) method, and since the method is annotated with the @ResumeOnBroadcast, then the returned value will be broadcasted to all suspended connections, then written on the wire, and then the connection will be resumed. On the Browser side, the spinning will stop for a few milliseconds, as the Browser will re-issue a GET, which will again be suspended. Note that for that simple demo, I'm not updating the client side using the returned value of the increment(..) method to keep it extremely simple.

Now technically this application use the Atmosphere module called core, which build on top of the Comet Portable Runtime (CPR), hence allowing the application to be deployed anywhere. The CPR always auto detect the container is running on top of, like:

First with Glassfish v3:

10-Jun-2009 8:02:05 PM org.atmosphere.cpr.AtmosphereServlet loadAtmosphereDotXml
INFO: Sucessfully loaded org.atmosphere.handler.ReflectorServletProcessor@e1ca74 mapped to context-path /dispatch
10-Jun-2009 8:02:05 PM org.atmosphere.cpr.BroadcasterConfig 
INFO: DefaultBroadcaster configured using a Thread Pool of size: 2
10-Jun-2009 8:02:05 PM org.atmosphere.cpr.AtmosphereServlet autoDetectContainer
INFO: Atmosphere Framework running under container javax.servlet version 3.0

...and then Tomcat 6

INFO: DefaultBroadcaster configured using a Thread Pool of size: 2
10-Jun-2009 8:03:46 PM org.atmosphere.cpr.AtmosphereServlet autoDetectContainer
INFO: Forcing the use of the container's native Comet API implementation instead of Servlet 3.0
10-Jun-2009 8:03:46 PM org.atmosphere.cpr.AtmosphereServlet autoDetectContainer
INFO: Atmosphere Framework running under container Tomcat version 6.0.x

The two log above are showing that if the framework detect Servlet 3.0 Async Support implementation, it will use it. If not, then it will use the native Comet implementation.

Finally, two descriptors are needed to make the application works. The first one, the atmosphere.xml, just tells Atmosphere to use Jersey's Servlet to process request. Under the hood, all annotation processing and REST support comes for free from Jersey:

<atmosphere-handlers>
    <atmosphere-handler context-root="/dispatch" class-name="org.atmosphere.handler.ReflectorServletProcessor">
        <property name="servletClass" value="com.sun.jersey.spi.container.servlet.ServletContainer"/>
    </atmosphere-handler>
</atmosphere-handlers>

Next, the web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="3.0"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee    http://java.sun.com/xml/ns/j2ee/web-app_3_0.xsd">
    <description>Atmosphere DeadSimple</description>
    <display-name>Atmosphere DeadSimple</display-name>
    <servlet>
        <description>AtmosphereServlet</description>
        <servlet-name>AtmosphereServlet</servlet-name>
        <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
        <async-supported>true</async-supported>
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>org.atmosphere.samples.rest.counter</param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.spi.container.ResourceFilters</param-name>
            <param-value>org.atmosphere.core.AtmosphereFilter</param-value>
        </init-param>
        <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>AtmosphereServlet</servlet-name>
        <url-pattern>/dispatch/*</url-pattern>
    </servlet-mapping>
</web-app>

The only important line above is the init-param that tells Jersey were to lookup our resources, e.g. under org.atmosphere.samples.rest.counter. That's it. You can download the sample from here (and many more here).

For any questions, go to our main site and use our Nabble forum (no subscription needed) or follow us on Twitter and tweet your questions there!

technorati:

June 10, 2009

New Resources at AndMob

Some new resources at AndMob have popped up including code examples, both links to Eclipse and Netbeans plugins and etc. You can find the link to AndMob on the right side of where this blog moved to, namely Mobilebytes. Also do not forget AndroidSnippets and Stackoverflow even has an Andorid area of questions and answers. Recent AndroidSnippets additions are featured on AndMob. You can reach Stackoverflow from my MobileBytes right menu and do an andoird word search in the search box to find the Android development questisn and answers.

June 09, 2009

Named Parameters Completion in Groovy

Groovy language support becomes a little bit better in Maia with the support for named parameters completion. Maia is now capable of displaying all named parameters ever used in method bodies.

June 08, 2009

Apple introduces the iPhone 3GS, drops price on 3G to $99

At today’s World Wide Developer’s Conference keynote, Apple announce a new, faster version of the iPhone: the iPhone 3GS. The S stands for Speed.

The new device is 2.1x faster to launch Messages, 2.9x faster to launch a big web page. It includes OpenGL|ES 2.0, and has 7.2MBps HSDPA built-in.

Besides the faster processor, the big draw for the 3GS is its new 3.0 megapixel camera. It features:

  • Tap-to-focus - tap an item in the photo to focus on it. Resets the light balance too.
  • Improved low-light sensitivity.
  • Automatic macro photographs (10cm).
  • Video capture, 30fps VGA.
  • Videos show up in photo library. You can trim them, share via emal, MMS, YouTube, MobileMe.

The new 3GS also features voice control. You hold down the home button for a few seconds in any application. Commands that you can say start floating around on the screen. Say one of them and it happens. Examples: “Dial scott forestall”, “play the killers”, “play more songs like this”, “what’s playing now”.

Other features:

  • Built-in digital compass.
  • New accessibility settings.
  • Nike+ support.
  • Hardware data encryption.
  • Improved battery life. 9 hours on WiFi, 10 hours watching video, 30 hours audio, 12 hours 2G talk, 5 hours 3G talk.
  • Greener materials, packaging.

Price and availability:

The iPhone 3GS will be available in 7 countries on June 19th for $199 (16GB) and $299 (32GB). Both come in black and white. The old 3G will continue to be available, but at a lower price-point: $99. All prices are for AT&T new and qualifying customers and may vary on other carriers.

JavaOne 2009: another amazing experience.

This was another amazing JavaOne. It was also the weirdest: between the Oracle situation, the global meltdown, and the financial situation, it was very different. Early on, we were really concerned (==nearly paniced) that no one would show up. Almost every company that usually sends a crowd of people to JavaOne had travel restrictions that meant that few could attend. From what we had seen from other conferences, we feared the worst. And yet, attendance ended up being about 15,000. Very respectable!

The press, of course, was weird this year: we did few interviews, mostly because there was only one topic they wanted to ask about, and there was nothing we could say.

My favorite part of JavaOne this year was the standing ovation that Scott got on Monday. It was a remarkably emotional moment for everyone. To all of you who contributed to that thundering applause: Thanks!

Our lineup of new technologies was great: JDK7 is looking wonderful; JavaFX reached another release milestone and is maturing nicely, along with it's tools; glassfish V3 is becoming totally wonderful; NetBeans 6.7+kenai is a killer combination; and the store is on it's way to being an amazing addition.

The fun part, for me, is the Toy Show. It's not about strategic initiatives, business issues, corporate relations, or new releases. It's all about jaw-dropping surprise. Everything from the Mifos (MIcroFinance, Open Source) project: bringing millions out of poverty. To Manuel Tijerino's jukebox architected to give indie musicians broad exposure and a source of revenue independent of the studios. To teaching kids through BlueJ and robotics competitions. And saving lives by doing computationally intensive image matching in an EE server with a JavaFX front end to analyse cancer biopsies. And the total victory of technology and style over common sense that is Neil Young's LincVolt. And a whole lot more.

WWDC 2009 live

It’s that time again: the annual Apple World Wide Developer’s Conference and its highly anticipated keynote address. Phil Schiller ran the show this year, and while he’s no Steve Jobs most observers agree that he did a pretty good job. Highlights include a revamping of the MacBook Pro line, the introduction this fall of Snow Leopard, and the announcement of a new, faster iPhone called the iPhone 3GS.

[Now that the keynote is over I've rearranged my updates in chronological order. Enjoy! -Ed]

9:21am: Welcome to live coverage of the 2009 Apple World Wide Developer’s Conference (WWDC). I will be your host this morning.

9:25am: WWDC 2009 is being held in Moscone West, the same location as the Google I/O conference.

9:30am: WWDC, of course, is a bit more closely watched.

9:33am: Judging by the posters it looks like the Mac will get some love this time around, in the form of Snow Leopard, 64-bit support, Grand Central, and OpenCL.

9:50am: Ever notice that WiFi becomes useless in a crowded room?

9:57am: Gizmodo live site bites the dust - Ars and Engadget still up.

10:00am: It’s showtime!

Continue reading: Phil Schiller takes the stage >

To MY OEM Readers

To my OEM readers such as RIM, SonyEricsson, Nokia, Motorola, and etc. As I progress towards the last seps in the AndCooper Android Build Tool 0.1 release I have moved my blogging to a new platform and site.  The new site is:

http://mobilebytes.wordpress.com

on the wordpress blog/CMS platform. since I am able to post sample code easier with wordpress and etc I would like  to see my OEM blog readers at my new site of Android Code and Development blogging. Hopefully, I will see yoru readership there.  Hopefully, at some point PLanetAndorid changes their blogroll links and feed crawing to include and craw my new Android development Blog.

June 07, 2009

I'm moving to Wordpress

In the last few days I moved this blog to wordpress and you can reach the content through http://tomsondev.bestsolution.at/

June 05, 2009

FindBugs in the cloud

For those who didn't attended Bill's presentation Defective Java™ Code: Mistakes That Matter on Java One 2009

, here is the link to the FindBugs Eclipse 3.5 RC3 analysis. This link loads a FindBugs instance with recorded analysis results, and you can try out the new "cloud" features built in in the recent FindBugs development release.

As requested by Wayne a day before, I've created a new bug for Eclipse 3.5 RC3 analysis results. Feel free to comment on it or to pick and post your own favorite bugs into the Eclipse bugzilla too.

P.S.
FindBugs is open source, and it can only evolve if you participate too. Please do not hesitate to report FindBugs

false positives, bugs or enhancement requests. If you like to contribute code, here are the instructions how to checkout and build FindBugs from scratch.

[update]
It seems that the original FindBugs jnlp link does not work on older Windows Sun VM. Until it's fixed, you ca try this one: http://andrei.gmxhome.de/findbugs/eclipse.jnlp. Of course I've created a bug for it ;-)

June 03, 2009

Deploying Your Rich Internet Application Nice And Easy!

<p>You've developed this cool web site with snazzy Java rich internet applications that are certain to wow the end user. Now, the million dollar question - will your rich internet applications (RIA - applet or Java Web Start application) start up quickly and run consistently across all browsers and operating systems?</p> <p>Do you wish you could determine the end user's browser, or Java Runtime Environment (JRE) version and customize the user experience based on that? Wouldn't it be nice if you could deliver the same user experience irrespective of the user's environment? </p> <p><img src="http://blogs.sun.com/thejavatutorials/resource/dt.jpg" /></p> <p>Recent improvements in the browser's Java Plug-in, support for applet deployment with JNLP, and the Deployment Toolkit, can help you build a web site that is robust and has a custom, well thought out user experience for every end user environment.</p> <p>The Java One presentation, &quot;Deploying Java Technologies To The Masses&quot; By Thomas Ng, provides valuable insight into how Java Deployment technology can be leveraged to easily deploy rich internet applications. This blog highlights some of the deployment tips using examples. </p> <p>Consider this scenario - You have a web site called "Design Your Home" that lets end users design their home by creating a floor plan and picking various interior decoration options. You have developed some very cool applets that let users drag and drop widgets, make choices and see their dream home being built...virtually. :-) </p> <p>You are of course, a wordly-wise developer who knows that folks have various versions of operating systems, browsers and JREs running on their computers. Your applets need at least JRE version 1.6.0_10 (Java SE 6 u 10) to run correctly. So you've built a couple of different versions of the functionality to accommodate older environments. And as far as possible, you want the user to have a smooth un-interrupted experience on your web site. You also want to applets to load up quickly so that users don't get frustrated by slow loading web pages. </p> <p>Let's explore several ways to improve performance and user experience and see how deployment technologies can be used to accomplish this goal. See the <a href="#relreading">Related Reading</a> section for other deployment related information.</p> <p> <ul> <li><a href="#downloadtime">Reducing your RIA's download time</a></li> <li><a href="#updatecheck">Improving start up time by avoiding unnecessary update checks</a></li> <li><a href="#sign">Signing RIAs only when necessary</a></li> <li><a href="#preloading">Preloading your Java Web Start application</a></li> <li><a href="#correctJRE">Ensuring that the correct version of Java is installed on the client</a></li> <ul> <li><a href="#correctJREAtOutset">Checking and installing the latest JRE as soon as the user lands on your web site</a></li> <li><a href="#correctJREOnUse">Installing correct JRE only when the user attempts to use your RIA</a></li> </ul> <li><a href="#splashscreen">Customizing RIA's splash screen</a></li> <li><a href="#fxpackager">Java FX Packager</a></li> </ul> </p> <h2><a name="downloadtime" id="downloadtime"></a>Reducing your RIA's download time</h2> <p>The time it takes to download a RIA, depends on the size of your RIA jar file (DynamicTreeDemo.jar is the RIA's jar file in this example). Deploy pack200 compressed jar files as shown below.<ul> <li>Compress the jar file using the pack200 tool <pre> // compresses DynamicTreeDemo.jar to produce DynamicTreeDemo.jar.pack.gz $ pack200 DynamicTreeDemo.jar.pack.gz DynamicTreeDemo.jar </pre> </li> <li>Set the <code>jnlp.packEnabled</code> property in the JNLP file <pre> // add the jnlp.packEnabled property in the JNLP file for the RIA &lt;resources&gt; &lt;!-- Application Resources --&gt; &lt;j2se version=&quot;1.6+&quot; href=&quot;http://java.sun.com/products/autodl/j2se&quot; max-heap-size=&quot;128m&quot; /&gt; &lt;jar href=&quot;DynamicTreeDemo.jar&quot; main=&quot;true&quot;/&gt; &lt;property name=&quot;jnlp.packEnabled&quot; value=&quot;true&quot;/&gt; ... ... &lt;/resources&gt;</pre> <p>When the <code>jnlp.packEnabled</code> property is set, the Java Plug-in looks for the appropriate jar file with the <code>.pack.gz</code> extension (e.g. DynamicTreeDemo.jar.pack.gz). If found, the Java Plug-in automatically unpacks and loads the jar file. If a file with the <code>.pack.gz</code> extension is not found, then it attempts to load the jar file itself (e.g. DynamicTreeDemo.jar). </p> <p>If you plan to sign your RIA, pack first and then sign.</p> </li> <li>Remove unnecessary white space from the JNLP file and JavaScript files.</li> <li>Optimize images and animation to reduce download time.</li> </ul> </p> <p><strong>Note: </strong>You need to deploy your RIA on a web server to use / test this property</p> <h2><a name="updatecheck" id="updatecheck"></a>Improving start up time by avoiding unnecessary update checks</h2> <p>RIAs are cached locally to improve start up time. However, before launching the RIA, the Java Plug-in checks to make sure that every jar file referenced in the JNLP file is up-to-date. In other words, the Java Plug-in makes sure that you are running the latest version of the RIA and not an older cached copy. These update checks can take up to a few hundred milliseconds depending on the number of jar files and network speed. </p> <p>You can leverage the <em>version download protocol</em> to eliminate unnecessary version checks. See the steps below to enable this protocol. <ul> <li>Rename the jar files to include a version number suffix <pre> naming convention - &lt;jar file name&gt; &quot;__V&quot; &lt;version number&gt; &quot;.jar&quot; example - DynamicTreeDemo__V1.0.jar </pre> </pre> </li> <li>In the JNLP file, specify a version for every jar file. Set the <code>jnlp.versionEnabled</code> property to true. <pre> &lt;resources&gt; &lt;!-- Application Resources --&gt; &lt;j2se version=&quot;1.6+&quot; href=&quot;http://java.sun.com/products/autodl/j2se&quot; max-heap-size=&quot;128m&quot; /&gt; &lt;jar href=&quot;DynamicTreeDemo.jar&quot; main=&quot;true&quot; version=&quot;1.0&quot;/&gt; &lt;jar href=&quot;SomeOther.jar&quot; version=&quot;2.0&quot;/&gt; &lt;property name=&quot;jnlp.versionEnabled&quot; value=&quot;true&quot;/&gt; ... ... &lt;/resources&gt;</pre> </pre> <p>When the <code>jnlp.versionEnabled</code> property is enabled, the Java Plug-in performs only <em>one</em> update check to make sure the JNLP file is up-to-date. It compares the version numbers specified in the JNLP file with the corresponding jar file versions (per the naming convention mentioned above) and updates only the outdated jar files. This is efficient because only the update check for the JNLP file happens over the network. All other version checks happen locally. </p> <p>If a file with the correct version number is not found, the Java Plug-in attempts to load the default jar file (e.g. DynamicTreeDemo.jar).</p> </li> </ul> </p> <p>If it is not critical for the user to immediately run the latest version of your RIA, you may run the update check in the background. The newer version will be launched the next time the user uses your RIA. Add the following to your JNLP file: <pre> &lt;update check='background'/&gt; </pre> </p> <p><strong>Note: </strong> <ul> <li>When using <code>jnlp.versionEnabled</code> and <code>jnlp.packEnabled</code> properties together, rename the packed jar file per the version protocol naming convention (e.g. DynamicTreeDemo__V1.0.jar.pack.gz) </li> <li>You need to deploy your RIA on a web server to use / test this property</li> </ul> </p> <h2><a name="sign" id="sign"></a>Signing RIAs only when necessary</h2> <p>Signed RIAs will display security warnings to the user. When trying to access a simple RIA, security dialogs may unnerve users and turn them away from the application. So, sign only if you need to (for example, when accessing native libraries)</p> <p>Recent enhancements to RIA security model eliminate the need to sign your RIA in the following cases: <ul> <li>Accessing services on web sites other than the RIA's own domain - The Java Plug-in has support for cross domain policy files. This means that if the third-party site allows access from other domains, then your unsigned RIAs can invoke services from these sites </li> <li>Setting trusted VM arguments - You do not need to sign your RIA to pass secure VM arguments. You can set secure VM arguments in the JNLP file or specify them directly in the <code>java_arguments</code> parameter in the applet tag. Examples of secure VM arguments include maximum heap size, sun.java2d.noddraw, javax.swing.defaultlf etc. </li> <li>Setting system properties used by your RIA only - You may need to set some system properties that only your RIA needs to use. If the name of the system property begins with <code>jnlp.</code> then you do not need to sign your RIA.</li> </ul> </p> <h2><a name="preloading" id="preloading"></a>Preloading your Java Web Start application</h2> <p>If you plan to deploy your RIA as a Java Web Start application in an enterprise where you have some administrative control, you can preload your application to various clients so that it is cached and ready to use. Use the following command to preload your Java Web Start application: <pre> javaws -import -silent &lt;jnlp url&gt; </pre> </p> <h2><a name="correctJRE" id="correctJRE"></a>Ensuring that the correct version of Java is installed on the client </h2> <p>With the Deployment Toolkit, you have at least two ways to handle this.</p> <ol> <li>You can check and make sure users have or install the latest JRE as soon as they land on your web site, or, </li> <li>You can let them surf the site, and check and get the latest JRE only when they attempt to use your rich internet application. </li> </ol> <p>Let's explore each option. To use the Deployment Toolkit, the client's browser should have JavaScript enabled.</p> <h3><a name="correctJREAtOutset" id="correctJREAtOutset"></a>Checking and installing the latest JRE as soon as the user lands on your web site</h3> <p>The example below checks if a user has JRE version 1.6.0_13 or greater installed. If not, it installs the latest JRE.</p> <pre> &lt;script src="http://java.com/js/deployJava.js"&gt;&lt;/script&gt; &lt;script&gt; // check if current JRE version is greater than 1.6.0 alert("versioncheck " + deployJava.versionCheck('1.6.0_10+')); if (deployJava.versionCheck('1.6.0_10+') == false) { userInput = confirm("You need the latest Java(TM) Runtime Environment. Would you like to update now?"); if (userInput == true) { // Set deployJava.returnPage to make sure user comes back to // your web site after installing the JRE deployJava.returnPage = location.href; // install latest JRE or redirect user to another page to get JRE from. deployJava.installLatestJRE(); } } &lt;/script&gt; </pre> <h3><a name="correctJREOnUse" id="correctJREOnUse"></a>Installing correct JRE only when the user attempts to use your RIA</h3> <p>If you deploy your rich internet application using the Deployment Toolkit, you do not have to take any additional steps to ensure that the client has a specific JRE version. The functions described below also deploy your RIA using the correct HTML tags (applet, object, embed), depending on the user's environment. </p> <p>Use the <code>runApplet</code> function to deploy an applet, as shown in the example below. The last parameter to the <code>runApplet</code> function is the minimum version required to the run your applet. <pre> &lt;script src=&quot;http://java.com/js/deployJava.js&quot;&gt;&lt;/script&gt; &lt;script&gt; var attributes = { code:'components.DynamicTreeApplet', width:300, height:300}; var parameters = {jnlp_href: 'dynamictree-applet.jnlp'}; deployJava.runApplet(attributes, parameters, '1.6'); &lt;/script&gt;</pre> </p> <p>To deploy as a Java Web Start application, use the <code>createWebStartLaunchButton</code> function with the correct minimum version parameter. <pre> &lt;script src=&quot;http://java.com/js/deployJava.js&quot;&gt;&lt;/script&gt; &lt;script&gt; var url = &quot;dynamictree-applet.jnlp&quot;; deployJava.createWebStartLaunchButton(url, '1.6.0'); &lt;/script&gt; </pre> </p> <p>The <code>runApplet</code> and <code>createWebStartLaunchButton</code> functions check the client's version of Java. If the minimum version is not installed, they install the latest version of Java. </p> <h2><a name="splashscreen" id="splashscreen"></a>Customizing RIA's splash screen</h2> <p>You can customize the splash screen for your RIA. This ensures a consistent RIA loading experience across all platforms. </p> <p>For Java based RIAs, specify the <code>image</code> attribute to customize the splash screen. <pre> &lt;script src=&quot;http://java.com/js/deployJava.js&quot;&gt;&lt;/script&gt; &lt;script&gt; var attributes = {code:'components.DynamicTreeApplet', width:300, height:300}; var parameters = {jnlp_href: 'dynamictree-applet.jnlp', image: 'dukeanimated.gif'}; deployJava.runApplet(attributes, parameters, '1.6'); &lt;/script&gt; </pre> </p> <p>For Java FX based RIAs, specify the <code>loading_image_url</code> and related attributes as shown below <pre> &lt;script src="http://dl.javafx.com/1.2/dtfx.js"&gt;&lt;/script&gt; javafx({ archive: "BouncingBall.jar", width: 240, height: 320, code: "bounce.Main", name: "BouncingBall", loading_image_url: "loading.gif", loading_image_height: 100, loading_image_width: 100 }); </pre> </p> <h2><a name="fxpackager" id="fxpackager"></a>Java FX Packager</h2> <p>If you are building a Java FX application, use the Java FX Packager to deploy your application. The Java FX Packager accepts a few user options and automatically <ul> <li>compiles the Java FX source code</li> <li>generates, signs and packs jar files</li> <li>generates JNLP and HTML files</li> </ul> </p> <p>With these neat tools and tips, you should be able to deploy your rich internet applications flawlessly and efficiently across multiple platforms.</p> <h2><a name="relreading" id="relreading"></a>Related Reading</h2> <p> <ul> <li><a href="http://blogs.sun.com/thejavatutorials/entry/deploying_an_applet_in_under" target="_blank">Deploying An Applet in Under 10 Minutes</a></li> <li><a href="http://blogs.sun.com/thejavatutorials/entry/deployment_toolkit_101" target="_blank">Deployment Toolkit 101</a></li> </ul> </p> <p>Please let us know if you'd like more information on specific topics. As always, we welcome feedback!</p> <br/> -- Sowmya Kannan

June 01, 2009

High Five from JavaOne

High Five from JavaOne, or 5 chances to listen to an ugly Quebecois accent.

DSC_2022.JPG

This year I'm invading JavaOne again, and 5 times...4 times on Tuesday (nice scheduling tool...NOTD!). Which one I would pick? Well the new Atmosphere baby is certainly the one I like the most! This is the last JavaOne as we know it, so don't miss any party :-) See you there :-)

May 29, 2009

Google Wave: Catching the Big One

Google unveiled a new online communications tool Thursday at its annual Google I/O Developer’s Conference. Called “Google Wave“, the new system sets its sights pretty high: replacing email, instant messaging, wikis, blogs, and static documents. If anybody can do it, it just might be Lars Rasmussen, creator of the wildly popular Google Maps application.

“We tried to imagine what email might look like if it were invented today,” said Lars during a keynote address to a packed house of developers. And what an imagination it is. After a masterful series of demonstrations, Lars and his team received a standing ovation that even Steve Jobs would be envious of.

Observing this from the front row I could tell he was moved and energized by the reaction. Heck, *I* was moved and energized by it, as you could probably tell if you followed my twitter feed.

So what is Google Wave?

Google Wave is different things to different people. To ordinary users, it’s a souped-up version of GMail that includes tons of new features like an eerily accurate spell checker, the ability to edit messages after sending them, carry on conversations in real-time seeing everything the other person types as soon as they type it, adding comments to the middle of a message, adding people at any point in a conversation and letting them see the full context and history of who said what, drag-n-drop attachments, and more.

To Ajax web developers Google Wave is a way to embed interactive social content like threaded comments into their web site. To server-side developers it’s a way to manipulate and mash up content on the server from various sources. To gadget developers it’s a new platform for creating interactive extensions. To the corporate IT department, it’s a way to get the latest communications technology without giving up control of data on internal servers and networks. And to big media/social companies like Yahoo! and Microsoft it’s an opportunity to finally tie together the mesh of formerly incompatible mail, messaging, document, and account systems through Federation.

On the shuttle ride to the airport I sat next to a guy from IBM who said they’ve had all this for 10 years in the form of Lotus Notes and Domino. There are similarities, but differences too. First, Wave will be open sourced, with an open protocol that anyone can use and implement without charge. Second, the clients we saw during the demo were web based.

Using the newfound power of HTML5, the Wave client can run inside any modern browser (even IE, eventually). Maybe there’s something to this interweb thing after all.

I Had More To Say But...

It's the end of May, so it's probably time to end my state of Eclipse series. I had more to say (the blog entries are written and waiting), but there doesn't seem to be any point. The Foundation is what it is. It's good at some things (e.g., blessing the IP cleanliness of code) and bad at other things (e.g., resourcing the common good; encouraging innovation). The jury is out on other things (e.g., providing member value), but I guess that because the members continue to pay their dues, they must be happy.

May 28, 2009

Worst ever Java EE 6 Blog

Bonjour, comment Java?

I'm preparing some Java EE 6 JavaOne demos. While doing that, I was thinking: how can I compress most of the Java EE 6 technology inside *one* single Java Class?
If you are my manager, stop reading now...
If you believe you are an architect, stop reading now...
If you are a member of the Java Blueprints team, stop reading now...
If you are a regular java blog reader, stop reading now...
The following code is PG 40. Talk to you parents if you are less than 40.

Still reading? Not sure why, but here we go.

The following Java EE 6 compliant Application is a Web Application with just 2 source files: MonsterServlet.java and persistence.xml.
It demonstrates the following Java EE 6 features:
  • Annotated Servlets 3.0, avoiding the need for web.xml!!!
  • EJB without local Interface: 100% POJO, and transactional (managed by the container) and securable
  • EJB inside a Web Application
  • JPA (still needs a persistence.xml ,  here it's defined as creating the tables at deploy time, assuming the database is already running)
  • EclipseLink Implementation
  • Default GlassFish v3 JavaDB database registered as "jdbc/__default" datasource.
  • Beans Validation framework (JSR 303...Merci Emmanuel)
  • Injection of EJBs inside a Servlet
Are you still reading? Remember the 3 tier architecture, with Data Layer, Business Layer, then Presentation Layer? Well forget it for this monster application which merges all the layers into one single Java Class, which is a Servlet, an EJB and a Entity JPA bean validated with some Bean Validation annotations...



MonsterServlet.java
package monster;

import java.io.*;
import java.util.*;
import javax.ejb.*;
import javax.servlet.annotation.*;
import javax.servlet.http.*;
import javax.naming.*;
import javax.persistence.*;
import javax.servlet.*;
import javax.validation.*;
import javax.validation.constraints.*;
/**
* @author: Not Me!!!
**/
@Stateless @Entity @WebServlet(urlPatterns = "/monster")
@Table(name = "MONSTERTABLE")
@NamedQueries({@NamedQuery(name = "MonsterEJB.findAll", query = "SELECT c FROM MonsterServlet c")})
@PersistenceContext(name = "monsterContext", unitName = "MonsterWebAppPU")
public class MonsterServlet extends HttpServlet {
@Id @GeneratedValue(strategy = GenerationType.SEQUENCE) private int monsterId;
@Max(2) @NotNull private String name;
@Transient @EJB MonsterServlet monsterEJB;
/*@Transient @PersistenceUnit(unitName = "MonsterWebAppPU") //does not work see EclipeLink bug
private EntityManagerFactory emf;*/ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=277550

@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws
ServletException, IOException {
response.getWriter().println("In Servlet calling the EJB side " + monsterEJB.EJBBusinessMethod("" + this));
}

public String EJBBusinessMethod(String name) {
try {
InitialContext ic = new InitialContext();
EntityManager em = (EntityManager) ic.lookup("java:comp/env/monsterContext");
this.name = name;

em.persist(this);

Query allMonsterQuery = em.createNamedQuery("MonsterEJB.findAll");
List allMonsters = allMonsterQuery.getResultList();
String error = validateTheMonsterJPA((MonsterServlet) allMonsters.get(0));
return "BusinessMethod from EJB" + allMonsters.toString() + error;
} catch (NamingException ex) {
return "Error in EJBBusinessMethod "+ex.getMessage();
}
}

private String validateTheMonsterJPA(MonsterServlet m) {
String error=" ";
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<MonsterServlet>> s = validator.validate(m);
for (ConstraintViolation<MonsterServlet> c : s) {
error = error+ " Contraint Violation: " + c.getMessage());
}
return error;
}
}


And the persistence.xml to put in the WEB-INF/classes/META-INF directory of this Web Application
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="MonsterWebAppPU" transaction-type="JTA">
<jta-data-source>jdbc/__default</jta-data-source>
<properties>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
</properties>
</persistence-unit>
</persistence>

This Web Application can be deployed as it to the latest builds of GlassFish v3. The page output is something like:

In Servlet calling the EJB side BusinessMethod from EJB[monster.MonsterServlet@5718c3a7]  Contraint Violation: must be less than or equal to 2

Now the quiz:
  1. Explain the following statement: @Stateless @Entity @WebServlet
  2. what do you need to change in the code to remove the Contraint Violation statement in the output?
  3. Why do we need to inject the EJB aspect of this class into the servlet and cannot  just use "this" ?
  4. Do you think this bug will be fixed?  https://bugs.eclipse.org/bugs/show_bug.cgi?id=277550 

Still reading? Now I have just corrupted your brain: while not recommended, it is possible to write a 3-tier Java EE 6 Application with Servlets, EJBs, JPAs, Beans Validation in one single Java class and one single xml file...
Can't wait for Java EE 7 when persistence.xml will become optional:-)

See you at JavaOne. You can now forget this blog. Someone had to write it. It's over now:-)
Ludo



Google I/O: Mastering the Android Media Framework

This afternoon at Google I/O 2009 Dave Sparks gave the most technical presentation of the conference so far when he delved into the details of the Android Media Framework. Here are my notes from the talk.

Design Goals of the Media Framework include:

  • Simplify application development
  • Share resources in multi-tasked environment
  • Provide a strong security model
  • Leave room for future growth

The typical stack for a media function call is pretty complex:

DVM proxy > JNI > Native proxy (C++) > Binder Proxy > Binder Native > Native Implementation

Thankfully you don’t need to make many calls to the framework. Using a native proxy will allow developers to call media from native games in the future.


Internally the media framework has its own handlers for .ogg and .mid files, and sends anything else to the OpenCORE library. That’s why the .ogg format is preferred for lightweight sound effects.

Android video codecs include:

  • H.263 Video. Originally designed for low bit-rate video conferencing. Simple encoder and decoder, 3GPP standard, Used by many streaming sites for low bit-rate video.
  • MPEG4-SP (Simple Profiler) Video. Designed as a replacement for MPEG1/2 codecs. Simple encoder. Not much improvement over H.263. It’s missing the deblocking filter.
  • H.264 AVC. Better compression (e.g., multiple reference frames, not supported currently in Android), better quality, different profiles, more complex.

Audio codecs include:

  • MP3 approx 10:1 compression @ 128Kbps. Sonic transparency 192Kbps.
  • AAC (Advanced Audio Codec). Better compression, sonic transparency 128Kbps. Commonly used in MPEG-4 streams.
  • Ogg Vorbis. Better compression than MP3. Low overhead player; low latency, uses less memory. Can loop seamlessly (unlike MP3).
  • Adaptive Multi-rate (AMR) audio. Speech codec, narrow band 8KHz, wide band 16KHz. Used in 3GP streams. AMR narrow is the only encoder available in software.

Typical streams look like this:

  • 3GPP - lower quality, H.263 video, AMR-NB audio, bit rates up to 192Kbps
  • MPEG-4 - higher quality, H.264 video, AAC audio, Bit rates up to 500Kbps

New features for Cupcake V1.5 include:

  • Video recording
  • AudioTrack — direct access to raw audio
  • AudioRecord — ditto
  • JET interactive MIDI engine

AudioTrack and AudioRecord are interesting to low level audio developers:

  • Expose raw PCM audio streams to applications
  • AudioTrack: Write PCM audio directly to mixer engine
  • AudioRecord: Read PCM audio directly from mic
  • Callback mechanism for threaded application
  • Static buffer for playing sound effects

The JET Interactive MIDI Engine is new for Cupcake:

  • It’s based on MIDI - file sizes can be small
  • You can pre-author content that is very interactive
  • DLS support allows for better quality instruments (load your own samples)
  • Precise synchronization for layered MIDI tracks
  • Native code - very efficient
  • Synchronization callbacks to applications for rhythm games
  • Open source engine and creation tools
  • VST plugin - use it inside your favorite DAW tool (Digital Audio Works?)

Dave spent some time in the talk going over common problems with the Media framework that he has seen users encounter. For example, one common problem is that volume control behavior is inconsistent.

  • Volume control is overloaded
  • If you’re in a call, adjusts in call value
  • if rinning, mute ringer
  • if media track active, adjust media volue
  • otherwise adjust ringtone volume <— default

In an application that plays sounds periodically the volume behavior is not consistent.
The solution is to set the default stream type in your onCreate() method:

setVolumeControlStream(AudioManager.STREAM_MUSIC);

Unable to play file from a resource?

  • mp.setDataSource(”res:com.myapp…”) doesn’t work
  • solution: use AssetFileDescriptor

Out of MediaPlayers?

  • Call release() and set to null, or call reset() then setDataSource()
  • Limit to 2 or 3 maximum
  • Especially in your onPause()

CPU Overloaded?

  • This happens when you’re playing too many compressed streams at a time (like MP3)
  • Solution: use SoundPool. 1.0/1.1 had problems but 1.5 is much better.
  • Decodes and loads into memory so they’re ready to play.
  • 5% per stream overhead (instead of 20-30%)

During the Q&A Dan revealed that OpenGL 2.0 support was coming in the Eclair version (currently at HEAD in source control). The 2d framework will be running in a 3d context. He also said this would allow the support of video as a texture.

Google I/O: Coding for better battery life

Jeff Sharkey, recently hired by Google, presented an interesting session this afternoon called “Coding for Life - Battery Life, That Is”. In it, he offered several practical tips for Android developers to prolong the life of their users’ batteries.

All apps need to work together to be good citizens and conserve the limited battery power available on today’s mobile devices, according to Jeff. Here are some typical battery capacities:

  • HTC Dream: 1150mAh
  • HTC Magic 1350mAh
  • Samsung i7500: 1500mAh
  • compare to Asus EEE PC: 5800mAh

Most users report under a day’s worth of battery life on the HTC Dream (T-Mobile G1), so where does all the power go?

Waking up in the background when the phone would otherwise be sleeping costs a lot. For example, if an app wakes up every 10 minutes to update, and takes about 8 seconds to update, that’s 350mA. Cost during a given hour: 5mAh resting, plus 6 updates an hour is another 4.6mAh updating. So basically that app cut your battery life in half. On top of that, just one app waking up can trigger a cascade of other apps that try to pile on and do their updates as well.

Bulk data transfer costs a lot. For example a 6MB song costs up to 45mAh on EDGE because it takes 9.1 minutes * 300mA. Moving between cells/networks is another cost because of radio ramp up and BroadcastIntents. Parsing textual data, and doing regex without JIT also contribute.

So what can developers do to improve the situation?

The first way is to be smarter about networking. Check network connection, wait for 3G or WiFi. Check connectivity.getBackgroundDataSetting() (new in Cupcake). Use an efficient data format and parser (XML > JSON > Protobuf; tree parser > steam parser). And use GZip for text data whenever possible. Android GZip libs use native code.

The next way is to look at foreground apps. Wakelocks are costly if forgotten. Pick the lowest level possible, and use specific timeouts to work around unforseen bugs. Use android:keepScreenOn to ensure correctness. Recycle Java objects, especially complex objects. - Use coarse network location - it’s much cheaper. Avoid floating point math, and use a slower accelerometer rate.

Next, consider your background applications. Services should be short-lived; these are not daemons. Each process costs 2MB and risks being killed/restarted as foreground apps need memory. Otherwise keep memory usage low so you’re not the first target. Trigger wake-up through AlarmManager or with <receiver> manifest elements, and call stopSelf() when finished.

Android 1.5 (Cupcake) introduced inexact repeating alarms (the setInexactRepeating() method) which lets the system batch up your update with others to minimize the number of wakeups the system has to do in a given time period.

in the Q&A session, Jeff shared some other insights. One that stuck out for me was that changing the screen brightness didn’t affect battery life all that much. At the lowest brightness, the LCD backlight drew about 70mA, but it only drew about 110mA at its highest brightness. With factory defaults it takes about 90mA.

May 27, 2009

Just released -- Java Tutorials update

To coincide with the JDK7 Preview Release and JavaOne, we have just published an updated version of the Java Tutorials. Besides fixing many typos and errors that you have reported, this release includes:

  • An entirely reworked File I/O lesson, featuring NIO.2. This functionality is part of JDK7, which is available now through the Open JDK project on java.net.
  • A new specialized trail covering Sockets Direct Protocol, also new in JDK7.
  • A new facility for gathering feedback about the tutorial. At the bottom of each tutorial page, under the "Discuss" heading, you can leave a publicly viewable, blog-style comment. Let us know what you think about the inclusion of this JS-Kit mechanism.

Thanks, as always, for your feedback. It helps us improve the tutorial!

-- Sharon Zakhour

May 26, 2009

Grizzly 2.0.0-M2 released.

Small entry for those who aren't following us on twitter.com/project_grizzly. Project Grizzly 2.0.0-M2 is now officially available.

aaaa.jpg

The official announcement was posted here or here. Thanks to all the feedback we have got since 2.0.0-M1 release, and don't stop!

technorati:

CPAN Modules

Eclipse projects should strive to be like CPAN modules:
  • bits of functionality that you can include into any project
  • generally high quality
  • have a common build and distribution system
  • be tested
  • be tested on your system
When I last checked, Eclipse projects met two or three of those goals, but fell down on the "common build system" and "tests run on your system" - two essential characteristics of a truly universal module system.

May 24, 2009

Useing Qt to write Equinox-OSGi-UI-Applications

I saw I didn't blogged since about 2 months. So I thought I'll start a series of blog entries showing off new things and paths I'm exploring.

I'll start with a Technical Topic because it's a really exciting thing I guess not only for me but also for the whole Equinox-OSGi/Java-Community.

Since some time Qt is released under LGPL and since some weeks now their Java-Binding named Qt-Jambi is released too under LGPL. I've been playing with Qt-Jambi (because my UFaceKit project has a Qt-Port) before but now that the code is under LGPL it's getting more interesting to the wider Java-audience and naturally also people who use Equinox-OSGi for their applications.

A simple QtJambi-Application


Before digging into the details what I've done let's look at a simply QtJambi-Application if we are not using Equinox-OSGi.


package at.bestsolution.qt;

import com.trolltech.qt.gui.QApplication;
import com.trolltech.qt.gui.QGridLayout;
import com.trolltech.qt.gui.QLabel;
import com.trolltech.qt.gui.QLineEdit;
import com.trolltech.qt.gui.QMainWindow;
import com.trolltech.qt.gui.QWidget;

public class HelloWorld extends QMainWindow {

public HelloWorld() {
setWindowTitle("Hello World!");

QWidget composite = new QWidget();

QGridLayout layout = new QGridLayout();
composite.setLayout(layout);

QLabel label = new QLabel();
label.setText("Label");
layout.addWidget(label,0,0);

QLineEdit text = new QLineEdit();
layout.addWidget(text,0,1);

setCentralWidget(composite);
}

public static void main(String[] args) {
QApplication.initialize(new String[0]);

HelloWorld world = new HelloWorld();
world.show();

QApplication.exec();
}
}

This looks not much different to a SWT-Application besides the fact that one doesn't has to pass a parent when creating a widget and instead of running the event loop one simply calls QApplication.exec().

QtJambi and Equinox-OSGi


Couldn't be hard you think when you've used other UI-Toolkits (SWT,Swing) in your Equinox-OSGi-Applications already but the problem is that Swing is not problematic because it is part of the JRE and SWT is shipped as an (in fact multiple) Equinox-OSGi-Bundle/Fragment.

What we need to do is to Equinox-OSGify the bundles coming from Qt but this task is more complex then it looks on the first sight because using the simple converter provided by PDE is not providing us a solution because QtJambi-Code expects to load the libraries in very special way which means we need to patch their Java-Code to make it aware of Equinox-OSGi.

The really cool thing is that patching and maintaining the patch is easier than one might think because they provide their sources through a git-repo one could simply clone and maintain the patched sources. So maintaining the patch is easier than it is for example to maintain a patch for the eclipse-platform because of git.

The tough thing is to get the environment setup in a way than one can produce .jars from the sources because one

  • Has to compile the Qt-Sources

  • To generate the Java-Binding-Classes to the Qt-Sources (extracted from the C++-Header-Files)


which is a bit time consuming and not documented very well at the moment. Though this is doable for a medium skilled Java-Dev I think one should be able to checkout the complete project with native and generated Java-Code and doesn't have to compile all the stuff.

After having managed to setup a build environment I patched the libary loading classes and recreated the .jar-packages. QtJambi is split in 2 .jars:

  • qtjambi.jar: Hold platform independent Java-Classes

  • qtjambi-${os}.jar: Holding native libraries for the platform and the JNI-Glue


So the setup is similar to SWT but in SWT also the Java-Code is part of the native fragment because it differs from platform to platform and the host bundle is simply an empty bundle. In contrast to that in Qt the Host-Bundle is holding all Java-Classes and in the native fragments one has the native-libs and JNI-Glue.

So what this all means for you? Not too much because I did 2 things as part of UFaceKit-Target-Setup:

  • Packaged my changes to the Java-Code and provide it for download

  • Added ant-tasks who fetch the native libs from Qt-Software and repackage them



One could also use these ant-tasks when not using UFaceKit (I'm using it for my RCP-Development-Setup).

The Equinox-OSGi-Support is not fully finished and I'll maybe rework it a bit in future when understanding the code better but for now it sufficient to go on and file a CQ to make use of Qt in UFaceKit. Let's see what's coming out from this now that Qt is LGPL.

Simple Qt-Jambi and Equinox-OSGi-Application


Let's create an Equinox-Application which uses Qt as UI-Toolkit now. The easiest thing is to use the PDE-Wizard to create a "Headless Hello RCP" and add a MainWindow.java.
package at.bestsolution.qt;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.trolltech.qt.gui.QApplication;
import com.trolltech.qt.gui.QGridLayout;
import com.trolltech.qt.gui.QLabel;
import com.trolltech.qt.gui.QLineEdit;
import com.trolltech.qt.gui.QMainWindow;
import com.trolltech.qt.gui.QPixmap;
import com.trolltech.qt.gui.QPushButton;
import com.trolltech.qt.gui.QWidget;

public class MainWindow extends QMainWindow {

public MainWindow() {
QWidget widget = new QWidget();
widget.setObjectName("main_window");

QGridLayout layout = new QGridLayout();
layout.setMargin(0);
widget.setLayout(layout);

addHeader(layout,"Tom Schindl","at/bestsolution/qt/bookmarks.png");

QWidget content = new QWidget();
QGridLayout contentLayout = new QGridLayout();
content.setLayout(contentLayout);

addLine(0, contentLayout, "Firstname");
addLine(1, contentLayout, "Lastname");
addLine(2, contentLayout, "Age");

QPushButton button = new QPushButton();
button.setObjectName("submit");
button.setText("Submit");
contentLayout.addWidget(button,3,1);

layout.addWidget(content);

setCentralWidget(widget);
}

private void addHeader(QGridLayout layout, String labelText, String icon) {
QLabel header = new QLabel();
layout.addWidget(header);
header.setObjectName("header");
QGridLayout headerLayout = new QGridLayout();
headerLayout.setMargin(0);
header.setLayout(headerLayout);

QLabel headerIcon = new QLabel();
headerIcon.setObjectName("header_icon");
headerIcon.setPixmap(loadImage(icon));

headerLayout.addWidget(headerIcon);

QLabel headerText = new QLabel();
headerLayout.addWidget(headerText,0,1);
headerLayout.setColumnStretch(1, 100);
headerText.setObjectName("header_text");
headerText.setText(labelText);
}

private void addLine(int line, QGridLayout contentLayout, String labelText) {
QLabel label = new QLabel();
label.setText(labelText);
label.setObjectName("label");
contentLayout.addWidget(label);

QLineEdit text = new QLineEdit();
text.setObjectName("text");
contentLayout.addWidget(text,line,1);
}


private QPixmap loadImage(String path) {
try {
InputStream in = getClass().getClassLoader().getResourceAsStream(path);
ByteArrayOutputStream out = new ByteArrayOutputStream();

int l;
byte[] buffer = new byte[1024];

while ((l = in.read(buffer)) != -1) {
out.write(buffer, 0, l);
}

QPixmap pic = new QPixmap();
pic.loadFromData(out.toByteArray());
return pic;
} catch (Exception e) {
e.printStackTrace();
}

return null;
}
}

and modify the generated application class like this:
package at.bestsolution.qt;

import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;

import com.trolltech.qt.gui.QApplication;

public class Application implements IApplication {
public Object start(IApplicationContext context) throws Exception {
QApplication.initialize(new String[0]);

MainWindow window = new MainWindow();
window.show();

QApplication.exec();

return IApplication.EXIT_OK;
}

public void stop() {}
}

Well as you see I'm not a good designer and the application looks well not really nice though it looks native on my OS-X though this is only faked by Qt because they are drawing everything on the screen as far as I understood it.

One could think that this fact is a draw back of Qt but IMHO it's the other way round because with this strategy they can support things SWT can't support easily - Completely restyle your application using a declarative language and well they use CSS like e.g. E4 does too.

The first thing to do is to add a method to load a stylesheet to Application.java:
private String loadStyles(String cssPath) {
InputStream in = getClass().getClassLoader().getResourceAsStream(cssPath);
BufferedReader r = new BufferedReader(new InputStreamReader(in));
StringBuilder s = new StringBuilder();
String line;

try {
while( (line = r.readLine()) != null ) {
s.append(line);
}
} catch (IOException e) {
e.printStackTrace();
}

return s.toString();
}

and set the style sheet on the main window:
public Object start(IApplicationContext context) throws Exception {
QApplication.initialize(new String[0]);

MainWindow window = new MainWindow();
window.setStyleSheet(loadStyles("at/bestsolution/qt/style.css"));
window.show();

QApplication.exec();

return IApplication.EXIT_OK;
}
and we need to define some styles:

resulting in this application:


which we all agree looks better than:



As you see this is also not my design but then one you get when using the Eclipse-Forms-API with the difference that in Eclipse one has to learn a new API to deal with besides SWT whereas in Qt the UI-Code is still Qt and styled by a declarative syntax and if you ask me the Forms-API is going to replace in space of Eclipse in E4 through SWT + CSS but this is only my personal opinion.

So should we all now move to Qt-Jambi to write UI-Applications in Java like we did years ago when we abandoned Swing and started using SWT?

Let's look at some potentially problematic areas:

  • Qt and QtJambi misses an application framework like eclipse RCP provides one for SWT-Application developers

  • Qt and QtJambi misses Databinding support like Eclipse-Databinding provides one for SWT, JavaBeans and EMF

  • Nokia removed all resources from QtJambi development and wants to build a community to work on it


For at least 2 of the above there are solutions already today:

  • E4's core application platform is UI-Toolkit agonstic so though E4 is not released until 1.5 years it would give people the possibility to use Qt as their UI-Toolkit of choice which supports many many things starting from animations, multimedia integration, ...

  • UFaceKit provides JFace-Viewer like and Eclipse-Databinding support for QtJambi if the CQ I'm going to file is approved


Still the killer problem is the lacking support from Nokia on QtJambi and it's unclear if a community could be build around it who not even maintains but also adds new features.

I think this is a bitty because with getting a real application framework with E4, it's themeing, multimedia and animation support I think QtJambi could get a real possibility to write cross-platform RCP-Applications in Java without the sometimes really hurting lowest common denominator problem we have in SWT.

So what should one do? Though QtJambi looks like a real solution for writing nice looking RCP-Applications the uncertainness caused by Nokia by cutting resources makes it unusable for most companies.

For form developers I could point you once more to UFaceKit which supports both SWT and Qt and your form application code is not affected by changing the underlying technology but one can still rely on native stuff where needed (e.g. using Qt animation/multimedia support).

For me as one of E4 committers and UFaceKit-Project lead it means:

  • I'd try to keep the application runtime widget agonstic if possible (well we are on a good track here)

  • I'll file a CQ to let UFaceKit make use of QtJambi and provide first class JFace-Viewer and Eclipse-Databinding support for QtJambi


  • 1. updated my wrong capitalization of Qt
    2. please note that I'm using Equinox specific stuff to make this work so it is maybe not runnable on other OSGi implementations but I'm happy to incooperate feedback and suggestions into my git-clone to support other OSGi implementations

May 22, 2009

GlassFish Tooling

Bonjour Comment Java?

Finally the GlassFish Tools bundle for Eclipse has been released: version 1.0 is available at http://download.java.net/glassfish/eclipse

The Tools bundle contains:
  • Eclipse 3.4.2 IDE with WTP Java EE support
  • GlassFish v2.1 pre-registered and configured
  • GlassFish v3 Prelude pre-registered and configured
  • JavaDB sample database pre-registered and configured
  • GlassFish Plugins
  • GlassFish documentation
  • And optionally, a JDK 1.6.
splash1.0.bmp

Installers are available for Windows and MacOSX, and tar.gz for Linux systems.
If you have used a preview release (pre version 1.0), make sure to read the release notes  http://download.java.net/glassfish/eclipse/releasenotes.html for information about a known issue regarding reusing workspaces created with preview releases. Commercial support for this bundle is also available at http://developers.sun.com/services/buying_guide.jsp.

I like the fact that the GlassFish servers are preconfigured, ready to use, even with a sample Java DB database pre registered (to use the JPA entities tooling). By default the "Deploy On Save" feature is enabled for GlassFish v3 Prelude: it means that the moment you save a Servlet, a utility class, or even an EJB, the application is automatically updated and redeployed to the running server in an optimal way. If you want to play with leading edge bits for GlassFish v3 Java EE 6, you can even register and download from the bundle a promoted build (happens every week) of the latest GlassFish v3 server. We will demo more about that at the JavaOne conference.

We are now working on a version 1.1 (and nightly builds will be available next week. Version 1.1 will add the OpenSolaris 2009.05 target, an optimized installer with Pack200 technology to reduce the download size by almost 2!, the JAX-WS and JAX-RS Jersey RestFul GlassFish Plugins, Maven 2, a MySQL JDBC driver pre registered for better out of the box experience with the MySQL database, the entire Java EE 6 Javadoc available in the Eclipse Editor code completion, and of course the latest bug fixes.

I hope to see you at JavaOne 2009.
Ludo


Getting started with the Atmosphere Framework part II: Writing a REST application with Comet support

This time I will demonstrate how easy and dead simple is to write a REST application using Atmosphere annotations…with the help of Jersey!

IMG_0128.JPG

In part I I’ve described how easy it is to write an asynchronous/comet based application using an AtmosphereHandler. I strongly recommend you first read part I to understand the steps needed to generate the proper layout for your application. I also assume you already know how to write REST application using Jersey. Why? Let me introduce a new module available with the Atmosphere Framework named atmosphere-core. As a reminder, in part I have introduced atmosphere-cpr (Comet Portable Runtime), which allow a developer to write an AtmosphereHandler and deploy it in any Servlet container. Under the hood, the CPR always make sure its use the native comet support available, e.g if deployed on WebLogic, use the AsyncServlet, if deployed in Grizzy/GlassFish, use the Grizzly Comet Framework etc. Yes, you write once and deploy everywhere your Comet application.

The atmosphere-core module builds on top of the CPR and Jersey! The aim of Atmosphere is to simplify the development of Comet application, and since every time I’ve used Jersey, I always found it is really easy to write powerful application…then I've decided to build on top of Jersey! So here we come: announcing atmosphere-core v.0.2-M1, powered by atmosphere-cpr and Jersey (including all functionality supported by Jersey!).

Like it part I, let’s first define our META-INF/atmosphere.xml:


<atmosphere-handlers>
    <atmosphere-handler context-root="/resources" class-name="org.atmosphere.handler.ReflectorServletProcessor">
        <property name="servletClass" value="com.sun.jersey.spi.container.servlet.ServletContainer"/>
    </atmosphere-handler>
</atmosphere-handlers>

If we compare with part I, this time the class-name we are using is a special AtmosphereHandler called ReflectorServletProcessor (RSP). The RSP listen to AtmosphereEvent like a normal AtmosphereHandler, but delegate the processing on the event to a servlet.service() method (a normal Servlet invocation), with a special addition which consist of storing the AtmosphereEvent as an HttpServletRequest attribute. The idea here is to support existing framework (like Jersey, Strut, JSF, etc.) without the need to modify those to support Atmosphere. Most of those frameworks support extension point, and all of them just need a reference to the AtmosphereEvent in order to suspend, resume and broadcast. Why is it called a Reflector? Mostly because every message broadcasted will be sent back to the client without any filtering or transformation. Say differently all suspended response will write as it is the message they receive (See AtmosphereHandler.onMessage for more info). Anyway as a developer you don’t need to know that…but if you are a framework developer, this is how you can use the Atmosphere Framework easily. In the current case, the RSP is configured using the Jersey’s main Servlet, called ServletContainer. As soon as you deploy your application, the Atmosphere framework will handle the lifecycle of the Jersey Servlet.

Next step is to write the web.xml:

        <servlet>
            <description>AtmosphereServlet</description>
            <servlet-name>AtmosphereServlet</servlet-name>
            <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
            <!-- Uncomment if you want to use Servlet 3.0 Async Support
            <async-supported>true</async-supported>
            -->
            <init-param>
                <param-name>com.sun.jersey.config.property.packages</param-name>
                <param-value>org.atmosphere.samples.chat.resources</param-value>
            </init-param>
            <init-param>
                <param-name>com.sun.jersey.spi.container.ResourceFilters</param-name>
                <param-value>org.atmosphere.core.AtmosphereFilter</param-value>
            </init-param>
            <load-on-startup>0</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>AtmosphereServlet</servlet-name>
            <url-pattern>/resources/*</url-pattern>
        </servlet-mapping>

In short, we define our usual AtmosphereServlet and maps all requests to /resources to it. There is two Jersey related properties defined. The only one you need to care is com.sun.jersey.config.property.packages. The property is required by Jersey to locate where to look for your application. Eventually Atmosphere will auto detect those, but for now you need to add it. In our case, it the fully qualified name of the package of our application. The second property is the Jersey extension point. No need to talk about it this time.

We are now ready to re-write the chat demo described in part I, re-using the same javascript code on the client side but this time without using any AtmosphereHandler, AtmosphereEvent, or Broadcaster, but instead using annotation (yeah!). Let’s start with the survival tool of Atmosphere annotation, which are @Suspend, @Resume and @Broadcast. You can write very powerful application by just using those I will talk about more annotations in part III). What the annotations are for:

  • @Suspend: write the returned value of the annotated method, then suspend the response
  • @Resume: resume the response by committing it
  • @Broadcast: broadcast to all suspended connection the returned value of the annotated method

So without going into the details of REST and Jersey (see this tutorial), writing a chat application just consist of:

 
    @Suspend // the returned String will be written and then response suspended
    @GET
    @Produces("text/html")
    public String cometGet() {
        return "<!-- Comet is a programming technique that enables web " +
                    "servers to send data to the client without having any need " +
                    "for the client to request it. -->\n";
    }

    @Broadcast // The returned String will be broadcasted to all suspended response.
    @Consumes("application/x-www-form-urlencoded")
    @POST
    @Produces("text/html")
    public String cometPost(
       @FormParam("action") String action,
       @FormParam("name") String name,
        MultivaluedMap form) { 

        if ("login".equals(action)) {
            return BEGIN_SCRIPT_TAG + toJsonp("System Message", name + " has joined.") + END_SCRIPT_TAG;
        } else if ("post".equals(action)) {
            return BEGIN_SCRIPT_TAG + toJsonp(name, form.getFirst("message")) + END_SCRIPT_TAG;
        } else {
            throw new WebApplicationException(422);
        }
    }

Simple, is it? The way it works is the cometGet will be invoked, its returned value will be written back to the client and the response suspended. When the cometPost gets invoked, it’s returned value will be broadcasted, e.g. all suspended responses will be invoked and the value written as it is to the client since we are using the ReflectorServletProcessor. That’s it! With the use of two simple annotations, we were able to write our first atmosphere-core REST based application. OK, it's REST twisted, but still :-).

You can download the entire application here, or browse the source code. If you are already using Atmosphere, you must upgrade to Atmosphere 0.2-M1 to take advantages of those new functionality.

As usual, THANKS to the great feedback I’ve got so far. Early adopter, you make a big difference! For any questions, go to our main site and use our Nabble forum (no subscription needed) or follow us on Twitter and tweet your questions there! And if you are going to JavaOne, don’t miss the Atmosphere BOF on Tuesday @ 8h30pm with Jersey lead and Java Champion’s Paul Sandoz, which is a great speaker without a Quebecois accent

technorati:

May 19, 2009

Will the Java Platform Create The World's Largest App Store?

To say the past few months have been a whirlwind is an understatement.

And thanks for the reminders, I recognize it's been a while since I've posted a blog. For reasons why, just click here to read the background. And before you ask, SEC regulations and securities laws limit what I can discuss about the Oracle transaction, so don't expect any insights on the topic.

But there's still a ton going on at Sun - with JavaOne (June 2nd, in San Francisco) coming up fastest on the horizon. We're preparing to reveal what I believe is one of the most important advancements ever for the Java community - and this time, it's all about revenue and business opportunity.

As you know, we're fond of throwing great big numbers around when talking about Java's distribution: billions of PCs', mobile devices, and smartcards, millions of enterprise servers, set top boxes, Blu-Ray DVD players and a growing number of very cool Kindles (buy one here). Very few technologies on the internet have anywhere near that kind of distribution muscle. Adobe's Flash, and Microsoft's Windows are just about its only peers when measured by runtime volume.

But not all Java runtimes are the same. For most devices, from RIM's Blackberry to Sony's Blu-Ray DVD players, original equipment manufacturers (known as "OEM's") license core Java technology and brand from Sun, and build their own Java runtime. Although we're moving to help OEM's with more pre-built technology, the only runtimes currently that come direct from Sun are those running on Windows PC's.

And oddly enough, that's made the Windows Java runtime our most profitable Java platform. I thought I'd provide some insight into that business here, and then introduce a project we're planning to unveil at this year's JavaOne, known internally as Project Vector.

As a business model, traffic for traffic's sake isn't that interesting (but never confuse traffic with adoption). Free internet traffic is only interesting if a third party is willing to pay to drive distribution of their content to your audience - from highway billboards to internet runtimes, businesses will pay for exposure and distribution to drive their business, whether through branding/advertising, delivering news, or selling movies or retail products. "Getting distribution" used to mean getting access to bricks and mortar distributors in shopping malls - nowadays, it means having another company propel your content into the market via the internet.

Now to that point, a few years ago, we called our friends at one of the world's largest search companies (you can guess who), to talk about helping them with software distribution - because of Java's ubiquity, we had a greater capacity than almost anyone to distribute software to the Windows installed base. We signed a contract through which we'd make their toolbar optionally available to our audience via the Java update mechanism. They paid us a much appreciated fee, which increased dramatically when we renegotiated the contract a year later. Distribution was becoming quite valuable to us and to them - and given the "take" rates, or the rates at which consumers were choosing to install new content, the Java audience saw value in the new application.

The year following, the revenue increased dramatically again - when an aspiring search company (again, you can figure out who) outbid our first partner to place their toolbar in front of Java users (this time, limited to the US only). Toolbars, it turns out, are a significant driver of search traffic - and the billions of Java runtimes in the market were a clear means of driving value and opportunity.

The revenues to Sun were also getting big enough for us to think about building a more formal business around Java's distribution power - to make it available to the entire Java community, not simply one or two search companies on yearly contracts.

And that's what Project Vector is designed to deliver - Vector is a network service to connect companies of all sizes and types to the roughly one billion Java users all over the world. Vector (which we'll likely rename the Java Store), has the potential to deliver the world's largest audience to developers and businesses leveraging Java and JavaFX. What kinds of companies might be interested?

If you talk to a Fortune 500 company or a startup, pretty much everyone craves access to consumers - which is the one problem we've solved with the Java platform. Most folks don't think of Sun as a consumer company, and largely we're not, but our runtimes reach more consumers than just about any other company on earth. That ubiquity has obvious value to search companies, but it's also quite valuable to banks looking to sign up new accounts, sports franchises looking for new viewers, media companies and news organizations looking for new subscribers - basically, any Java developer looking to escape the browser to reach a billion or so consumers.

How will it work? Candidate applications will be submitted via a simple web site, evaluated by Sun for safety and content, then presented under free or fee terms to the broad Java audience via our update mechanism. Over time, developers will bid for position on our storefront, and the relationships won't be exclusive (as they have been for search). As with other app stores, Sun will charge for distribution - but unlike other app stores, whose audiences are tiny, measured in the millions or tens of millions, ours will have what we estimate to be approximately a billion users. That's clearly a lot of traffic, and will position the Java App Store as having just about the world's largest audience.

This creates opportunity for everyone in the developer community - and specifically, for any developer (even those not using Java/JavaFX) seeking to reach beyond the browser to create a durable relationship with their customers (and btw, don't forget to join us for CommunityOne - the day before JavaOne, June 1st, same location - click the graphic to learn more). Remember, when apps are distributed through the Java Store, they're distributed directly to the desktop - JavaFX enables developers, businesses and content owners to bypass potentially hostile browsers.

For details on how Vector will work, when it'll be available, how to submit your content or application - alongside insights into Project Vector's technology, roadmap, features and business model, come see us at JavaOne... In the interim, you can learn more about the latest JavaFX news at sun.com/javafx, and download the latest JavaFX design tools at netbeans.org.

And although we obviously don't comment on rumors, we might even have a special guest or two at JavaOne.

See you in San Francsico (or on the webcast...)!

May 17, 2009

Leaving Sun

I have decided to quit Sun Microsystems. I spent amazing 5 years at Sun and I am very grateful for all I've learned with the company. Working on both NetBeans and OpenSolaris adoption was real fun so I leave with very mixed feelings.

I am going back to Java developer business and will be going to Java One with my new employer, so you will find me in the Java One pavilion area if you want to say hi. I wish my Sun colleagues good luck with their new adventures!

P.S. Thanks for all the beans.

Understanding Open Source

I came across this couple of times before and I always wanted to blog about it. In my daily work life I see many developers which just don’t get Open Source. For example, some discover issues in libraries they use. But they don’t fix them. They don’t even inform the maintainers of a library. Yet others have a great new use-case to address. Again, the library doesn’t support it. Thus, they write a great deal of new code to address their issue and eventually run into new ones (for example, see this thread).

But it’s that darn simple!

  1. Checkout the library from source. You can use a well known tag/branch for this.
  2. Get in touch with the maintainers and implement your modifications.
  3. Build and release your modified version until a new official release is available.

May 11, 2009

These Are Economic Truths

Kevin McGuire posted an excellent reply on "Commercial Success is Our Success". His comment-post is worthy of being an entire post of its own, so I direct you to read it.

Developers are the lifeblood of Eclipse and we should be doing everything we can to make them as productive as possible. Companies pay those salaries and must believe it's money well spent. The foundation must provide value above that of the projects themselves (which the companies are already funding through the developers) in order for companies to see value for their dues. These are the economic truths.

(comments should be posted over there)

May 06, 2009

Eclipse Summit Europe 2009 Call for Sponsors!

Things continue to go very strong for Eclipse in Europe. So well, in fact, that we already have 16 sponsors lined up for Eclipse Summit Europe 2009! Kudos to Ralph and his incredible Rolodex and hard work.

Mark your calendars -- October 27-29th once again in Ludwigsburg, Germany.

We would love to get to 20 sponsors in time for the CFP process -- if you're interested, please check out our sponsorship page.

- Don

May 05, 2009

With Respect

I've written a dozen or so of these columns now so I thought I'd take a little break here and point out that I have a great deal of respect for Mike, for Ralph, for Donald, for Denis, etc. I've said so once before and I'll say so again. And again. And I say so when the cameras are off.

At the same time, I disagree with them on certain points but my disagreement does not diminish my respect for them nor should it diminish yours for them. They are a smart, hard-working, well-intentioned team. I agree with most of their decisions and positions. I have enjoyed working with them and I would enjoy doing so again in the future.

So please don't misunderstand Disagreement for Disrespect -- it's a good team there at the Foundation.