jquery apache tomcat ajp issues , ie6 hangs

The application I work on is accessed from all over the world, we don’t have any control over what kind of browser access it. So we have to check pretty much all possible combinations. After our latest release we had trouble with some users who were running windows 2000 with internet explorer 6.

I know this is an old system, but we can’t force them to upgrade, neither can we force them to install a real browser (i.e. firefox) as they don’t have local admin accounts. I checked windows xp with ie6 and this worked without any problems. So I picked up a windows 2000 cd and installed it in a vm. I upgraded the browser to the same version as the customer but couldn’t reproduce the problem.

After some emailing and friendly help from their local IT sysadmins, I could access an identical vm on their local systems. I user our test environment to do some tests changing settings here and there. After a couple of minutes I found out that the problem had to do with the jquery library. So I tried accessing it with the actual URL, maybe there was a security constraint or something but this worked without any problem. Even stranger when I accessed the applicaiton again everything worked perfectly, normally after the login the page would freeze and you had to kill the iexplore process.

After a while I figured it out. To shrink the size of the html we were using the compression options of apache. This shrinked the actual html sometimes with 80%. However we also shrinked all javascript libraries. JQuery default ships with a minimized library. It seems that some internet explorer versions have problems with accessing this file. I imagine that ie6 can’t handle a file that is minimized file and gziped at the same time.

So any one out there experiencing the same problems, you can check if you didn’t run into the same problem as we did.

Linux vs Windows maven building

I recently received a new Dell laptop. It came with windows 7, I tried it and it didn’t look bad. But for my personal stuff I prefer Linux over Windows. The computer at the office is managed by somebody else, that off course runs windows. It’s a very good machine and the guys who manage it know what what they are doing. As soon as somebody has a virus somewhere (e.g. usb stick from a customer) they are standing next to the person within a matter of minutes. Or if somebody is consuming a lot of bandwith and effecting others, they’ll notice it. However I’m a developer and all these extra monitoring tools (network consumption isn’t on my own computer off course) consume resources from my machine.

As we build all our projects with maven, it’s pretty easy to do the build on another system. I always have a version on my laptop, so I also checked out one to my new Ubuntu 9.10 laptop. If I do a mvn clean install -DskipTests on my laptop it takes about 27 seconds. If I do this on my main workstation (that actually is a dual cpu dual core machine) it takes 4 minutes 30 seconds.

Noted that the maven version isn’t the same and that I’m running 64 bit Linux instead of Windows xp 32 bit. This still seems a big difference, but then again every time I access a file the antivirus kicks in and who knows what else.

If I had a big company I would make all my developers work on Linux machines, reducing licensing costs and gaing time 🙂

If they were .net developers, well that would make it a bit more difficult but I’ld definitely give it a go. Time is money and loosing 4 minutes for every clean build is way to much. Luckily mvn compile and some ant tasks run much faster.

EU’s delay on Sun acquisition also impacts me as a software developer

Microsoft are going to release the “Silverlight: Universal GUI toolkit”. This will allow them to build desktop appz, much like Adobe is doing with AIR. As soon as they do that, I think Silverlight and Flex have pretty much the same features for doing web and desktop development. I’m just wondering where JavaFX is?

During Devoxx I followed some JavaFX sessions. It looks promossing, but we’re already waiting for it for quite a while now. If the EU approves the Sun acquisition, Oracle could finally publicly announce their intentions with all the Sun Products. I actually think they will start pushing JavaFX very hard, so hard it will have pretty much the same features as Flex and Silverlight within a couple of months. Probably the release of Java 7 will also be moved forward again. A while ago, I was very sceptic about JavaFX, but I’m allowed to change my opinion, right? I see many benefits for Oracle investing in JavaFX and make it a real competitor for Silverlight.

Or off course they will just kill JavaFX and buy Adobe, who knows. But for me a Java software developer, what frontend should I choose, what language should I invest in? I’ve already done some Flex development and it works really good. But I believe that the power behind Silverlight (Not only Microsoft, but all big component vendors) are giving Silverlight much more momentum. Just look at the number of components available for the platforms.

If Oracle would invest in JavaFX, I imagine they also would start contacting component vendors and ask them to start developing commercial components. As soon as that happens and we get more momentum, more developers will start developing opensource components as well.

I see this as the chicken and the egg problem, so come on EU let Oracle lay its egg so we as a software community know what we should do.

DWR weirdness

Like many developers I use DWR in my java enterprise app. This facilitates communication between Javascript and backend Java code. However for a new feature I overloaded the Java backend function. I also modified the frontend to add the new parameters where necessary. On my windows machine everything worked fine. I then pulled in the data on my Linux laptop and wanted to start a debug session. However when I tried the app, the filtering wasn’t working. Hmm pretty strange, after a long debugging session I finally found the issue. I’m still not sure why or how, but this is what I noticed.

I’m sending 3 int values to the backend. It seems that for a weird reason on windows he converts the var productId = ‘4’ to an int and on Linux he didn’t do this. What happened was that my old method was executed without the new argument (as he couldn’t convert it). I would have actually expected the ap to also do this on windows as the ‘4’ isn’t an int in my eyes.

From now on I will never use overloading with DWR services. As Javascript doesn’t really check the number of arguments supplied for a function, this can do weird things!

Create a vmware esxi 4 bootable disk using linux

This is pretty straight forward, but why not put in in a post anyway.

You go to the vmware site and download the latest vmware esxi build. Download it somewhere in your home drive. After downloading perform following tasks:

Become root (su – or sudo -s)

mount the iso file. I made a dir /media/isoimage to mount it to:


mkdir /media/isomage/
mount -o loop -t iso9660 ./VMware-VMvisor-Installer-4.0.0-171294.x86_64.iso /media/isoimage/

I made a dir in my root folder to work in, copy the image.tgz file to there.


cd /media/isoimage/
mkdir /root/vmware-esxi-stuff
cp image.tgz /root/vmware-esxi-stuff/

Extract the image file

tar xzpfv image.tgz

Extract the actual file you need


bunzip2 VMware-VMvisor-big-171294-x86_64.dd.bz2

Now connect your usbdisk to your linux computer, make sure you know how it gets connected. I always tail my log files to make sure.


tail -f /var/log/messages

When you connect your usbdisk you will see a lot of entries passing by. You will see something like


Aug 23 12:43:06 bjornmonnens-desktop kernel: [1134680.672567] sd 6:0:0:0: [sdc] 7818240 512-byte hardware sectors: (4.00 GB/3.72 GiB)

So now you know it is on sdc. Make sure there aren’t any partitions on there or delete everything using fdisk (this might not be necessary, but I did it anyway)


fdisk /dev/sdc
Command (m for help): p

Disk /dev/sdc: 4002 MB, 4002938880 bytes
64 heads, 32 sectors/track, 3817 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x49e2fd2f

Device Boot Start End Blocks Id System
/dev/sdc1 5 900 917504 5 Extended
/dev/sdc4 * 1 4 4080 4 FAT16 <32M
/dev/sdc5 5 254 255984 6 FAT16
/dev/sdc6 255 504 255984 6 FAT16

Delete all and write to disk


Command (m for help): d
Partition number (1-8): 1

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Ok now everything should be empty, so go ahead and write your dd image to the usbdisk using the following command.


dd if=VMware-VMvisor-big-171294-x86_64.dd of=/dev/sdc

Ok it’s pretty easy, but it might help somebody. And for you windows guys us a bootable linux cd and perform these task instead of installing all kinds of rubbish on your computer.

Stupid Sabbam, paying for listening to the radio?

Am I the only one who finds this utterly stupid?

(For those who don’t understand dutch. In Belgium companies who have the radio turned on inside their companies (to make it a bit more pleasant for their employees) will have to pay.)

I still don’t fuly understand how this all fits together. Sabbam stated that if you play music in public you have to pay. So if my friends and family come over for a nice barbeque, I’ll have to pay them? If you will are carpooling, will you have to pay?

How does radio fit in here? If we will have to pay for everything we want to listen to. Why would I even listen to the radio then? I can find enought content under a opensource license. At the moment I hardly listen to the radio anymore, when I’m driving to work I always listen to my podcasts. The music business is a very strange thing if you think about it. They idea is that they want to sell as much as possible, right? They use the radio stations as advertising their media, face it if radio didn’t exist the music industrie would be much smaller. But now they even want you to pay for the advertising they do???? This is uterly insane, I know some of these things are also true for TV but … I find that employees and employers should do something about this, let’s all just stop buying music for 2 months, stop listening to the radio for 2 months, stop going to concerts,… just stop everything that gives the music industrie and sabbam money. Anybody with me?

Grails + JQuery

Today I had a bit of time to do some further grails fooling around. I already had a working application old school (so everything you do was a page refresh.). I wanted to do some small Ajax stuff (getting a product using it’s id and then prefilling the price fields with that value.)

In my domain I have the following object

class Product {

String name
String description
double buyInPrice
double unitPrice
double vatPerc

static hasMany = ['productPricings':ProductPricingHistory]

String toString(){
return "${description} ${unitPrice}"
}
}

In my controller I have to following

import grails.converters.JSON

class ProductController {

def scaffold = Product

def showjson = {
def product = Product.get(params.id)
render product as JSON
}

}

In my gsp I have to following snippit

$(document).ready(function(){
$("#product\\.id").change( function() {
setPrice($(this).val());
});
$("#units").change(function(){
calculatePrice();
});
});
function setPrice(productId){
$.ajax({
url:"../product/showjson/"+productId,
dataType:"json",
success:function(json){initProduct(json);},
error:function(xhr){
alert("Failed to save patient!: " +
xhr.status + ", " + xhr.statusText );
}

});
}

function calculatePrice(){
var unitprice = $("#unitprice").val();
var units = $("#units").val();
$("#priceExcl").val((unitprice * units));
}

function initProduct(json){
$("#unitprice").val(json.unitPrice);
}

As you can see it is really nice. Okay with Java + DWR this is also very simple, but here I have it in my controller and just say render … as JSON and grails does the rest. Actually I still have to look if Spring has some kinde of build in JSON renderer. Probably somebody already created this. But hey now I save and run (no need for start stop of my application server 😀 ) and in the end it’s still bytecode I’m using.

I still have to do some grails testing where I generate my backend in JPA and include it in a jar. However the grails/groovy part should still be reloadable, right? Anybody tried this yet?

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.

Grails new site

Today I had to download the grails binary. I went over to http://www.grails.org. It seems they restyled their website, I have to say I’m impressed. I hope the default template that’s shipped with grails also got a restyling. For you guys who like nice designs have a look.

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?