Alleloeja!!

Hey guys,

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

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.

Crystal Reports in VS.NET 2005

For a client I had created a couple of records. Problem was that they another company had developed stuff in Access and I had to integrate with that flat file. The Access file was located on a network share. When I developed it was on my local disk and when I deployed my Typed Dataset objects were updated automatically. The crystal reports however didn’t get updated. After a long time I finally found a solution for setting the database location @ runtime.


CrystalReport1 rep = new CrystalReport1();
TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo =rep.Database.Tables[0].LogOnInfo;
ConnectionInfo connectionInfo = new ConnectionInfo ();
connectionInfo = logOnInfo.ConnectionInfo;
connectionInfo.DatabaseName = "Database";
connectionInfo.ServerName = "Server";
connectionInfo.Password = "pwd";
connectionInfo.UserID = "uid";
rep.Database.Tables [0].ApplyLogOnInfo(logOnInfo);

There’s one stupid thing here. I had made my application so that I gave my report as string param. The application that woud look in the application path for that report. This way I could update my reports without redeploying. Unfortunately if you do it like this I didn’t find a way to access the tables of my report. The reportview seems to not give you the actual CrystalReport object when you load it from a string???

Well in in the end it works, that’s all that matters!

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 ?

Quicksilver on Linux

Another thing that got mentioned on the user group was the lack of a Quicksilver copy for Linux. As I find it hard to believe this didn’t exist for Gnome, I searched a bit and it seems Deskbar is doing this kind of stuff. I just put it on my top menu and I think I’m gonna use it a lot. It really looks nice, eve the del.icio.us plugin is nice.

Probably it will add a lot of extra load on your network with all the web calls it does. But hey I don’t have any limit so … 😛

Ubuntu getting momentum

Today I joined a small Java user group meeting. We discussed DWR and GWT. I already had investigated a bit both toolkits, I even used DWR in an application for a customer. The session still was interesting, although I knew most things. But there was one thing that was remarkable. Last time this user group was held, I was the only one who actually was using Linux on a daily basis (all my systems here are on Ubuntu, all my servers are running some flavor of Linux).

But today it seemed that more guys switched to Ubuntu. They preferred it over Windows. Okay, I know these guys are also programmers, and have some level of geekness. But they weren’t using it half a year ago, so there is momentum. Maybe not yet as mainstream as we would like, but Rome wasn’t build in a day either. And hey you can bet if a friend of these guys asks him to help him with computer trouble they will start advising Ubuntu over Windows. I can’t even count the number of computers I had to fix due to some kind of spy-ware. And I really am getting sick of it, and so will these guys probably.

\o/

Switch from hunderbird back to Evolution …

Today I switched my default mail client back from Thunderbird to Evolution.

Why???
I installed Beagle and I want all my mails to be indexed for searching. I lost 10 minutes searching for a stupid mail today (yeah, it’s really stupid heaving 5 large mailboxes that you use frequently)

After installing I started replying some emails and I noticed that my Nautilus mounted SSH folders were included in the add attachments screen. sweet The Thunderbird version didn’t have that option and that was pretty stupid. I had to copy the files locally and then attach them 🙁

I did notice however that the response off Thunderbird is much better than Evolution, but hey at my customer I’m have to use M$ Outlook so I’m glad when I’m back at my office using Evo.

I also stopped using Amsn, I also fully switched to Gaim. Okay the integration with the MSN messenger service isn’t as good as Amsn but Gaim also gets indexed by Beagle. I was already using Gaim for my Jabber and Gmail friends but not yet for my MSN friends. So you guys are now on my Gaim list and are being indexed 😀

You get the point, my whole entry is about indexing. Lets see how much more efficient I get in the future.

On a side note, I now seem to have my spelling checker enabled in Firefox. So I’ll pay more attention on my writing skills as some of you seem to have problems with my bad English!

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 :))