Wednesday, December 23, 2009

A brush with Eclipse RCP

In my current job I seem to do quite a bit of UI work. The nice thing is that since my company is a start-up, the possibilities (in terms of technology at least) are unlimited. In the last year I've written GUIs using C# & WPF, Swing, and JavaFX. This time we were looking to create a 'system monitoring application' which should be able to present different types of information:

  • Tables
  • Graphs
  • Charts
  • Trees
  • etc...
The application also had to be easily extensible. While I personally have a fair amount of experience in GUI development, my two junior colleagues have done much less UI work. So it was just as important that the technology we choose has a gentle learning curve. Given a 4 week sprint we don't have much time to 'waste'. I have evaluated our options:
  • JavaFx: low level, lack of tools and out of box components
  • Swing: low level, good tools
  • SWT: low level
  • NetBeans platform: have personal experience
  • Eclipse RCP: unknown
It was clear that given the extensibility requirement we needed a platform. It came down to a choice between NetBeans Platform and Eclipse RCP. In the end I chose Eclipse RCP because I was able to step through this tutorial with complete ease and I felt that even though I have experience with the NetBeans platform my team mates would be faster in picking up the Eclipse RCP way of doing things.

Now, a month later, I have to say that I believe that my decision was the right one. After 3 days of tutorials and reading we were ready to go. Ultimately we have created a UI which is modular (with multiple self contained plugins), looks and feels the way our client expects, and will be easy to extend. In addition, majority of the actual UI work (using JFace, SWT, databinding, Eclipse RCP APIs) was done by my colleagues while I focused on the data models.

While I would take the NetBeans IDE over the Eclipse IDE for most things I am quite happy with the way our RCP based project turned out given the requirements.

Thursday, October 01, 2009

Sending GlassFish java.util log records to Chainsaw - no problemo

To send Java log records to from GlassFish to chainsaw we need to first translate the LogRecords (from java.util.logging) to LoggingEvents (used byt the log4j framework and accepted by chainsaw). Then also need to publish the resulting LoggingEvents to Chainsaw over a socket.

Here is how I do it:

* Copy ChainsawHandler.jar and log4j.jar into GLASSFISH_HOME/domains/domain1/lib/ext

* In Glassfish admin web console under: Application Server/Logging/General/Log Handler enter:

au.com.horseshoelane.logging.HSLChainsawLogHandler

* In Glassfish admin web console under: Application Server/JVM Settings/JVM Options/ add a new JVM Option:

-DchainsawPort=4447

this is the port to which Chainsaw clients can connect

* Restart GlassFish

* Configure a new SocketHubReceiver in Chainsaw that will connect to the chainsawPort

In case you are curious how it works or want to add functionality or fix a bug here is the source.

I would like to thank my current employer HSL for allowing me to publish this work - which they have sponsored in the form of my paycheck :)

Wednesday, September 16, 2009

JavaFX + WebStart + Web Services + GlassFish = One cool client app

In this post I will give an overview of the architecture that I've used to supply a connected thick (JavaFX) client application to a customer.

Here is the scenario: our company has an important customer who wishes to access and view some real-time data related to their business.

After some thought we've decided that the ideal platform for the client app is JavaFX (eye candy), the client deployment method is WebStart and we'll provide the data to the client via a SOAP Web Service. Easier said than done it turns out :)

There are a few issues with this set-up.

CLIENT:
The JavaFX client app can be written without major problems (see my previous posts about my beef with JavaFX tools) but I've found it best to create separate Java module to handle the WS communication. This is also useful since Maven doesn't seem to be able to build mixed source trees. Therefor the client app is composed of two separate JARs:
- Java library to handle WS client code generation and some utilities that are easier written in Java
- JavaFX GUI client that depends on the Java library

SERVER:
Simple enough Web Service deployed on GlassFish v2.1 JavaEE 5. Nothing special to note here.

DEPLOYMENT:
This was one of the trickiest parts. Since we have a number of servers (dev, test, stage, production, etc.) and we want a client which is downloaded from a specific server to connect to the WebService running on that same server. This we achieved by using a servlet to dynamically generate the JNLP file for the WebStart deployment. The servlet plugs the correct values into the JNLP for two things:
- where the client jars are located (i.e. codebase)
- a run-time property for the client specifying the WS location
The client (once launched) uses the WS location property to connect to the correct web service.
The servlet gets this information from system properties which can be easily set using the GlassFish web admin console. This means that we compile the code once and deploy it to any GlassFish server and all works well as long as we don't forget to add the two properties to the server.

Monday, August 31, 2009

More JavaFX impressions

So I have been using JavaFX for about 2 weeks now. I am working on commercial application for a client and now that I am more familiar with both tools and language I think it's a good time to post an update.

Tools still suck - no surprise here :) but they suck even worse in Eclipse than in NetBeans so even though my workplace is an Eclipse shop we're using NetBeans for our JavaFX development. I've had a quick chat with David Kaspar, a friend of mine and one of the developers who are currently working on JavaFx tools at NetBeans and he told me that Sun is aware of the situation and it is about to improve, so FX support NetBeans 6.8 should be much better.

I really hope so because the language is awesome and despite everything I do enjoy working in it.

Tuesday, August 04, 2009

First JavaFX impressions

In my job I've been playing around with some pretty cool and new technologies lately. This gave me the opportunity to write a a WPF based video player (with some very client specific functionality) in C# in just about a month. Coming from Java background with no prior .NET experience at all, it was quite an accomplishment. But it is not simply a credit to my genius but mostly to the tools that were available to me: Visual Studio with ReSharper. As occasional IntelliJ user I was soon very comfortable and pumping out code like nobodies business. As a SWING developer used to working with NetBeans forms editor I found the XAML editor fairly intuitive.

This brings me to my JavaFX experience. I've been assigned the task of evaluating technologies for a new UI project. I am currently down to either SWING or JavaFX, and while I would really love to use JavaFX there is a single major reason that is making me very hesitant:

Lack of Good Development Tools

While I love the demos that I downloaded for JavaFX I am sorely disappointed with the available tools. It's kind of sad really, since most of my old colleagues at Sun who used to work with me on Mobility support are working on JavaFX support now. I know many people on that team and they are some of the smartest most capable developers. Something must have gone very wrong along the way because at the time of writing this I personally find the JavaFX support in NetBeans to be an embarasement. The most basic features are missing from the editor which makes it a major pain to work with (source formatting, cut/paste imports, automatic imports while typing, auto-completion is of mark at times, etc. etc.). This makes it very difficult for me to be productive with the language from the start. Sun has been pushing JavaFX hard because it does enable some very cool UI magic but I wish they put as many resources into making it usable to developers thus speeding up adoption.

I will continue to play around with JavaFX and I hope that in the end I'll find that I can live with (and remain productive with) it's current tool set.

Saturday, April 18, 2009

Cotopia: Over 1 Million games played

That's right folks - we've had over 1 million games played!! Isn't that awesome? It makes me very happy that we've been able to bring our community that much fun. I mean seriously, more than 1 million games, I can hardly believe it. It's been a good ride for us on the development team and I hope that we'll soon celebrate by releasing the long awaited mobile game of Go.
I'd like to send a big 'Thank you' to our community for making this happen.

Sunday, April 12, 2009

Economy and IT jobs in Sydney

I thought that I'd quickly comment on the state of affairs regarding IT / jobs / economy here in Sydney. I was affected by the economic downturn just like many others, as companies shed contractors to tighten their budgets. This was around 2 months ago. I has taken me 8 weeks to find work - half of that time spent looking while I was finishing off my previous contract at a great Sydney IT firm Object Consulting. 8 weeks is the longest it has taken me to find work since 2002. Usually I have a job withing 2-4 weeks.

I normally look for senior developer positions related to JavaME or Core Java / Swing, which is not where most of hiring happens - any Java developer will know that majority of advertised jobs resolve around web, databases, finances, or insurance (i.e. gather financial/insurance data on the web and stuff it into a DB - not my cup of tea). This definitely doesn't the job search any easier but it ensures that usually I find something at least somewhat interesting.

In addition to taking a few extra weeks to find a job I also have to say that the compensation packages on offer are not exactly what they used to be a year ago, but they aren't completely unacceptable either.

To sum up - I believe there is work to be found even for those of us that are a little more picky, even though it may take longer to find it and one may have to do with less money.

Saturday, February 28, 2009

Doing my bit for atheism :)

OK, so here is an idea for like-minded people.

At our local bookshop they have a "Religion" section with all sorts of books. Unsurprisingly, propaganda and early indoctrination literature (i.e. Children's bibles, Good News bibles, and other bibles) is on the eye-level top shelf. While some of my preferred reading such as "The God Delusion" or "God is not Great: How Religion Poisons Everything" sits on the very bottom shelf where it doesn't receive proper attention.

The thing that I like to do, when I browse in the store, is to rearrange the books to correct the unfortunate placement of my favorites. I do this about once every 2 weeks or so.

That's the whole idea. I am not sure how much it accomplishes but since there is no church of atheism where I could make donations it's one fun way I like to try and forward the cause.

Wednesday, February 11, 2009

Starship Sofa

Again with the Podcasts :)

I've recently discovered another excellent SciFi podcast at http://www.starshipsofa.com
I was completely blown away by it's first short story (by Michael Moorcock no less) called London Bone which in it's quality (writing and production) rivals to that of Variant Frequencies.

The thing about Starship Sofa is that they tend to put out stories by established authors rather than by new and upcoming ones. There have been a couple of stories I've skipped, I guess every 5th or so, whereas on Variant Frequencies I have yet to skip one. This, I guess, is because the Sofa tends to cover a broader range of stuff and some things are just not my cup of tea, however the stories that stick do so in a big way!

Give the Sofa a listen - I can pretty much quarantee you'll like it.

Sunday, February 01, 2009

SF & christian indie music - wtf??

Off-topic rant warning.

I love sci-fi and sci-fi story podcasts - hence I love Escape Pod (I've donated about $200 to them so far) and I love Variant Frequencies - they don't ask for money so I didn't give them any yet.

My rant today is about Variant Frequencies, VF is a monthly podcast and in my opinion it's simply the best in terms of quality (both writing & production). The guys behind VF are simply amazing. Except... Except in the last episode called "Creature of God" (which admittedly has some religious themes as the name would imply) the featured an advertisement for indie christian rock music or some such non-sense.

To me the reasons for doing this may be that:
1. the guys at VF are religious and are actively trying to help spread the virus
2. or it may be that they are short of cash and thus in need advertisement dollars

If case 1. is true I am very disappointed, and I feel a bit tricked. It kind of reminds me of one beautiful day in my teens when 2 VERY pretty girls we smiling at me from across the food court in the mall. They then approached me (giggling), made small talk and were being extremely friendly, and then they asked me to come and meet them again in their church :) Wow, what a recruitment strategy, even the Army won't go that far.
Perhaps VF isn't doing exactly the same thing but I do feel baited in with some pretty awesome SF and then hit with a completely bullshit religious advertisement.

If case 2. is true (and I hope to .. err.. I mean I really hope so) I would suggest to VF to put up a paypal donations button on the front page, ask for money at the end of the show, ask for money at the start of the show, put some non-offensive adverts for headphones in, do whatever else but please stay away from pushing religion. I've bough Scott Sigler's books, I've given a fair amount of money to EscapePod (and the guy from there once mentioned he is religious - to my great surprise) so I will definitely support my favourite sci-fi podcast EVER by donating, and once "The last fix" comes out in Australia I buy the book.

If I missed case 3. I hope it's a good one that doesn't involve propagating the evil of religion on purpose.