What’s new

It’s been almost a year since my last blog entry. Damn that’s a long while. So what’s new in that year. Actually a lot :)

I’ve become a father for the second time. This is costing me a lot of sleepless nights at the moment. But one smile of our daughter and it’s worth it. And boy does she smile when she sees her father.

We are finally making some progress on our new house. The plans have been drawn, the city has given a green light and now we are waiting for quotes from the construction companies. It looks like we will actually start the construction somewhere after the summer vacation of 2012.

On an IT point of view, also a lot has happened. I’m actually coding much less coding then I used to, and actually I would like to do some more coding. So I picked up some of my old pet projects and started including newer technologies like primefaces 3 and Vaadin. Have to say they work really nice. It takes less code to get some functionallity in an app, off course you have to live with they way their components work (which I do).

I actually also traded my Apple iPad for an ASUS transformer tablet with dock. I have to say magnificient machine. It took me a while to find all the replacement tools for the appstore appz ( a decent PDF reader took a while).

Lets see what 2012 holds for blogging.

Linux Exchange Integration

Like many of us, most of the companies I work for have a Windows based environment. This implies that our mail is handled by Exchange. In many cases you can access the mail with IMAP, however some companies choose not to open up anything except the webmail (and OWA).

As you may know, Android has the possibility to do over the air sync of calendar,email and contacts using the Microsoft ActiveSync software. As Android is a Linux device with a Java layer on top. I already checked if I could extract the sources from the Android app. During my search I came across a small project called davmail . Davmail is a project written in Java that acts as a proxy for OWA. It connects to the OWA of your company and exposes the receiving of mails using an IMAP or POP interface. You can also send mails using standard SMTP. This will then be translated in a Active Sync call to send the actual mail. It also exposes your contacts and calendar. I’ve not yet managed to get the Calendar working but at least my mail is now working. Up until now I was always booting a Vmware. The only thing this VM would be doing was running Oultook.

Let’s hope these days are over and I can finally leave the Windows behind. (Not if it would be a Exchange 2010 at least the webinterface would be a RIA but as it’s still the 2007 edition not much rich GUI is available for Linux).

So everybody looking for an alternative give it a go and let me know, I’m pretty interested to hear what you think about it.

maven + netbeans + Java

Today I wanted to build on of our projects with maven. (As I just deleted my .m2 repo it had to download everything and it took a while.) It went very fast until I started up netbeans that also had this project included. It seems that if you do builds command line and also have netbeans accessing the project this sometimes performs very strangly. You see netbeans keeps scanning the project and maven stopping regularly.
After killing netbeans maven again went blazing fast. After the first build from command finished I restarted netbeans and everything went fine. Pretty bizar if you ask me (however I don’t know the internals of netbeans and maven, maybe there are file conflicts??) Als rememeber that this is on my computer @ work, it’s a windows box with a virus scanner, so everytime you access a file it checks if there is a virus there, this could also have an impact off course.

JavaFX + Oracle

A while ago the javaposse opened up a system where we could post questions. A couple of episodes ago they started going through these items. Unfortunately my question didn’t get raised. Reason being that my question got more negative votes then positive votes.

If I look back now, it actually deserved this. My question went something like : “Why did Sun created JavaFX, Flex already plays nicely with Java, why not invent a Java to ActionScript compiler.” (somewhat like gwt but then ActionScript output). Now that Sun got bought by Oracle I’m pretty sure, JavaFX will succeed. At least if Oracle will put their money where their mought is. (Larry Ellison publicly announced his support for JavaFX). Why do I think this will have a big impact on the success of JavaFX. Well pretty simple, take a look at JSF. Oracle was one of the driving forces behind this. There still is room for improvement (isn’t there always). But it’s already a nice framework for building data centric applications.
If you now take a look at the new version ADF 11 and their JSF comonents. Well I haven’t seen many JFS components that are better. I have to admit, I myself am more in favor of none component based frameworks (they tend to be more flexible).
To come back to JavaFX. Currently we still don’t have a DataGrid or something. This is still a big issue, I feel somewhat like when Microsoft first released Silverlight 1. It was nice but not yet usefull. However in the near future I foresee that Oracle will finalize the basic JavaFX components and publish a nice basic DataGrid that will be on par with the Flex Grid(s).

And if all goes well, we should finally see a real Java(FX) component market happening. That’s something I still don’t understand. Flex was way ahead of Silverlight with their framework and wigdets. I recently wanted to compare them again. What struck me was the component market for Silverlight. I already have big players providing very datacentric and rich gui widgets for sale. For Flex I only found Ilog as big player there. I’m still looking for a DataGrid with very powerfull sorting,grouping,… basic stuff. In Silverlight these are already in production (have a look at http://silverlight.componentart.com/#Welcome) For Flex I’m still searching.

As Java is a much more programming driven environment I think these components will show up much faster and probably also in the opensource world. This in my opinion is the big problem of Flex. The framework and language is good enough to do this, but the most guys who know Actionscript have a design background and not a background in enterprise/component development. I really hope Oracle/Sun will release there version 2 really soon so we can see this happening. I’m actually really looking forward to the next couple of years in the Java eco system. We already have a wealth of opensource tools for doing enterprise development (starting from IDE’s,building systems,continuous integaration,testing environmonts,…) if we then would also get a good framework for doing rich gui’s that work perfectly on all platforms (even Linux, still my prefered one) … What does a developer want more?

Groovy and Grails

Rails has got a lot of buzz the last couple of years. I myself have investigated it, didn’t write any apps but it looked nice indeed. I wonder why grails doesn’t have this much attention yet. I have read the a couple books on groovy and grails and started my own small project. I have to say I like it, the thing I probably like the most is that you can package it as a standard war file and just deloy it. Another great thing is the fact that you can reuse all the big java libraries that have been released. So you create your reports in Jasper or Birt and just call them from your grails application.

I wonder how they solved this issue in rails. I can hardly imagine they rewrote entire libraries? (maybe they didn’t solve it yet).

Any grails users out there? Any good user groups in Belgium?

Xml Xsl FOP

One of the ‘new’ features that was requested in our app was the forwarding of screens to email addresses. We discussed this and adding a simple pdf version of the screen as attachment to the mail was ok.
As at the moment our application isn’t xml based (just Html with custom Javascript,Dojo and DWR) I suggested to first ‘xmlize’ our messages and then convert this xml to a pdf. At previous customers I used Velocity for performing the Xml serialization. But before I suggested this solution I read up on Groovy as I had read somewhere that it has first class support for Xml. And indeed after checking it out. You have a simple MarkupBuilder object that handles a lot for you.


import groovy.xml.MarkupBuilder

def writer = new StringWriter()
def xml = new MarkupBuilder(writer)

xml.Blog(id:"${blog.id}",type:"${blog.type}"){
Content("${blog.content}"){}
}

output = writer.toString()

This small piece of code will generate the following Xml:



Just some content

As I installed the Groovy plugin in Eclipse I get errors when my Xml is false. Not bad at all.
The really nice thing about this is that you just initialize your Groovy engine in Java. You add your Java object (in my example blog) and you can use it as if it was a Groovy object. Then I return the output to my Java code.

Sweet!

As this generates Xml I used a simple Xsl stylesheet to generate an intermediate Xml. So all objects get transformed into this intermediate Xml. This xml gets transformed in to FOP xml and with the nice Apache FOP library I generate a simple pdf.

Another added value is that for changing my pdf or Xml I don’t have to restart my application, so no downtime!!

Alleloeja!!

Hey guys,

I have to admit it’s been a while. But here I am again :D

Today I saw this post on the serverside. And I have only one word for it Alleloeja.

Just look at this piece of code


import com.jinvoke.JInvoke;
import com.jinvoke.NativeImport;

public class Example {
@NativeImport(library="User32")
public static native int MessageBox(int hwnd, String text, String caption, int type);

public static void main(String[] args) {
JInvoke.initialize();
MessageBox(0, "This MessageBox is a native Win32 MessageBox", "Caption", 0);
}
}

Why did it take this long to actually do this?

In C# you could do this right from the start. Well beter late than never probably?

Java D&D development

At a customer where I work there is a lot of Powerbuilder Development. Powerbuilder is 4GL development environment, you can quickly create simple CRUD applications with the tool. Every now and then we have discussions on it. It’s really quit funny as you can’t compare client-server development with web development or desktop applications vs web applications. The example that is always given is, how long does it take to create a simple master-detail app. Okay with the new Java web frameworks (or ruby on rails) this is also done very quickly.

With my VS.NET 2005 I have a good competitor for beating them in the client-server development area. Java however didn’t stand a chance. My DAO layer can be generated but for then building a simple Swing app, I would lose by a couple of miles. Recently I noticed the Netbeans 6 M9 however. I gave it a go and I was really amazed. I had my database ready and it took me less than 3 minutes to create a simple Master-detail Swing application. According to the documentation I could create a webstart deployement within a couple of clicks. I would say “GO SUN!!”

I do hope they will extend their default swing components palette. Sorry but the ones that are in there at the moment isn’t sufficient. Common people you don’t even have a default date picker component. Well maybe this is because the default java.util.Date in Java is just broken :) But just fix it, I as developer don’t like it that I have to search for these components. Just put them in their. If you compare the VS.NET 2005 controls that are available by default with the Swing components. I can see why we still aren’t that far on the desktop as on the server.

Bejug ??? Why would I ???

Today I received an email from Javapolis. They were starting advertising the upcoming new Javapolis event. On the site they also mentioned there new Javapolis DVD that was available for purchase. I noticed this was an effort from Bejug. So I got interested as I’m a Java developer :)

Now what do you get for paying 100 euro’s to join the Bejug. They have 3 workshops per year and … Well nothing actually. You still have to pay for Javapolis and for SpringOne. Please people explain me, why would I join??? If I compare it to the Linux User Group in Leuven, they have 2 workshops a month and you pay 10 euro’s a month.
I would rather start my own Jug and do the same as the Lug of Leuven. Anybody up for it ?

Hibernate Second Level Cache

When I have to develop a more advanced web application I tend to prefer java over any other language. Ok I have to admit, I haven’t tried ruby on rails yet, but I’ll wait for Thor to finish his nice plugin for netbeans :)
I just find that java has almost a nice architectural solution for every problem you face (server side that is). That’s also the downside, there are so many solutions out there, that for a new programmer its a bit overwhelming!

That said, I use Hibernate in almost all my projects. (hibernate being an orm and speeding up my development) As you might know Hibernate has caching built in. First level is the cache in your session, and it’s local for you. Second level cache is for performing queries that in most cases return the same result. Now in my case I created the query and passed it a long some parameters. The parameters were offcourse also hibernate mapped objects. I setup the objects to be cacheable and I set the query to be cached. But it still went to the database on every request!?! Strange it should work?!?
So I started digging and after a while found the problem, really stupid (offcourse). I generated my object model using the reverse enginering tools from hibernate. I thought I had overridden all the equals and hascodes of these objects (as you should always do), but it seemed for these objects I passed in as parameters I hadn’t done it yet.

So as I understand, hibernate puts you query in a container, along with all the parameters you pass to the query, and a reference to the resultset. So if you try to perform the query again, he checks if this is already in the map, but because my parameters always returned false when actually business wise being true. He kept on going back to the db. So you see, even the smallest most stupidest things can have a great impact on your whole thing. This case being overriding the equals and hashcode in a small (3 properties) object, made my app lose 0.3 seconds in a lot of requests.

But BUGFIX/ENHANCEMENT has been done :) )