Java: casting Object to int

I found something odd when writing a Java program yesterday.

In a JTable you have an int to display (the amount ordered e.g.), but when getting the value of a cell you obviously get an Object, not an int.

In order to get the Object into an int variable, you might experience this issue:

//this does not works (obviously)
int element = this.jTableProducts.getElementAt(4, 4);

//this works! (obviously, Integer is a subclass of Object)
Integer element = (Integer)this.jTableProducts.getElementAt(4, 4);

//this odly enough does not works
int element = (int)this.jTableProducts.getElementAt(4, 4);

//but this works
int element = (Integer)this.jTableProducts.getElementAt(4, 4);

This is due the autoboxing of Integer to int (and vice versa).

MSDN downloading on Vista

Let’s say you are one of the gifted persons to have MSDN access.

Let’s say you use Vista 64-bit (I don’t know if the problem occurs on 32-bit).

Let’s say you want to download something from MSDN with Microsoft File Transfer Manager.

And it does not work.

Well use this workaround:

First: download the File Transfer Manager from here.

Download and install the MSI. The default path is c:\Program Files (x86)\Microsoft File Transfer Manager”. Remember this.

Then use Firefox to go to the MSDN website, start a download, and it will prompt you to do something with the default.aspx. Well open that file with the File Transfer Manager. And it works!

Woei!

AVG 8 update marks user32.dll as False Positive on XP SP2

DO NOT REMOVE user32.dll, even though AVG 8 states that there is a virus in the file.

Doing so will remove the file, and cause a BSOD, and makes your system unable to boot.

It marks the file as infected with Trojan Horse PSW.BANKER4.APSA.

Possibilities are to wait for an update from AVG, or (preferably) upgrade to XP SP3!