petek, 30. november 2007

Depp Copy of Objects

Ever wanted to do a clone of a Vector for example. You could use the clone() method on all objects that are in the Vector, but there are better solutions:
- Exploit Serialization To Perform Deep Copy
- Faster Deep Copies of Java Objects
- Low-Memory Deep Copy Technique for Java Objects

Whatever approach suits you best is the one for you. :)

četrtek, 8. november 2007

Migrating Class libraries between NetBeans versions

There is a nice entry in NetBeans Wiki on how to migrate class libraries between different IDE versions, so you don't have to manually enter them.

Cooler T60

After a week of using Ubuntu 7.10 I've noticed that my T60 is much cooler that it was running Ubuntu 7.04. I'm running BOINC all day long and the temperature of the CPU is 10˚C lower than on Ubuntu 7.04.

petek, 2. november 2007

Ubuntu 7.10

I've upgraded my T60 to Ubuntu 7.10. the main thing I noticed is that now hibernate/resume works as it should. Ubuntu 7.04 had a nasty bug when sound did not work anymore after resume. This has been fixed now.
And since I have an ATI x1400 card inside I also wanted to test the latest ATI drivers that support composite so compiz-fusion can work. But the drivers have a bug which prevents a notebook to go to hibernate mode. So now, until ATI releases new driver's, I'll not be using compiz-fusion since hibernate is more important to me. And for me these compiz gets in a way after a while, but it has some very nice graphics effects.

sobota, 29. september 2007

Description of DB2 sqlcodes

Did you ever need a description of a sqlcode in a programming language like Java? Did you ever wanted to know if an sqlcode is an error or a warning?
You can use SYSPROC.SQLERRM function for that:
VALUES(SYSPROC.SQLERRM('SQL0911N', '', '', 'en_US', 0))

There is a sqlcode: in the description and id this is negative then you have an error, otherwise a warning. I consider sqlcodes that don't have sqlcode: in the description as not important. :)

nedelja, 23. september 2007

Tetris

In my early days I played a lot of Tetris. On my 486 with a Turbo button :)) I even got so may points that the score counter flipped over, but I was never as good as this guy. :))
He truly is a Tetris Master.

sobota, 15. september 2007

Newline

Yesterday one of my coworkers said something that I'm laughing even today over it.
He was trying to open a CSV file with Excel, but he got some strange results. Then he noticed that a description column had newline characters in, so Excel made more lines as it should.
So he said: "Why don't they put newline in one line." :)))

nedelja, 2. september 2007

Easter Egg in Google Earth

Remember a while back when I blogged about Easter Eggs ?
There is a great one in the newest Google Earth. Download it and press CTRL-ALT-A. you'll see a flight simulator and here are the controls you can use.
Have a lot of fun. :)
What are the best Easter Eggs you've found in software?

sreda, 22. avgust 2007

How to get modem in T60 working?

Steps:
- install driver using program provided at:
http://www.linuxant.com/drivers/hsf/downloads-installer.php
or look at section "Identifying your modem"
- run "sudo sh cnxtinstall.run"
- follow instructions
- reboot
- run "sudo hsfconfig --country" to set the country
- run "sudo hsfconfig --license" to set the license. Choose FREE here.

When I start minicom, the program can initialize the modem. I have to admit I did not try if the modem really works.

torek, 21. avgust 2007

DB2 and string functions

If you have ever worked with DB2 and Unicode database, you must have stumbled across this problem:
If you are using characters that are not in ascii table, but nation specific ones, like đšžćč in my case, then function like LENGTH, SUBSTR, ... are not working right. Especially with JCC DB2 driver.
Example:
ResultSet rs = stmt.executeQuery("SELECT SUBSTR(NAME, 1, 10) AS NAME FROM TABLE1")
and then the tenth character is one of đšžćč(for example) then calling
rs.getstring("NAME") will give you an Exception.
There are three solutions:
- use APP/NET driver, so you at least don't get the exception
- do a substring in Java code
- use VARGRAPHIC like SELECT SUBSTR(VARGRAPHIC(NAME), 1, 10) AS NAME FROM TABLE1

At least I hope DB2 developers will fix this soon. Sometimes it really gets on my nerves.

četrtek, 9. avgust 2007

Specs

On Monday I got back from my R&R and started doing some work with a device that is connected to RS-232. I was following the specs for the protocol that it supports. But the device returned something that was not in the specs. Strange. Luckily I had a contact person at the company that provided the device. We figured out that the software on the device is not the right one, the one that supports the specs I got. Then we updated the software. And did it the second time, since the first was not the right version. The device still didn't function as written in the specs. Then we figured out that is was not set up correctly. Now after couple of days I have a working device as per spec. So the company says. :)
Then I found out that the specs are not right. They say something and the device says something else. Now who to believe? After three days I'm still not 100% sure if the spec and the device are on the same level.
Don't you just hate when this happens? And then your manager asks you why it took so long to send two lousy packets to the device. They are both 60 bytes long! Arrrgggg

petek, 3. avgust 2007

R&R

Last 14 days I've been on R&R. :))
The first of there magnitude this year. I really needed it. I've been involved in couple of large project this year (introduction of Euro currency in my country, introduction of Selfcheckout tills, ....).
During my R&R I've kinda started some work on Neural networks. We'll some where it takes us.

četrtek, 19. julij 2007

JSP form and UTF-8

Today I was trying to help one of my coworkers who had a problem accessing a value on a JSP page and storing it into a database. Of course he was using UFT-8 characters, so they ended up in database all wrong.
A solution is very simple :))))
Just add
request.setCharacterEncoding("UTF-8");

before you access any parameter in the request object.
I got the solution from a blog.

četrtek, 5. julij 2007

T-2 and IPTV and Ubuntu

If anyone has T-2 IPTV and wants to watch it on their computer then follow these steps:
- connect a cable from VOOD TV port to your computer
- have vlc installed and ready
- add a route like:
ip route add 224.0.0.0/4 via YOUR_CURRENT_IP

- get a playlist of all programs
- start vlc, load that playlist and enjoy

6516858 fixed

A bug that I reported about 6 months ago for Java is now fixed and in Java 6u2 and Java 5u12. This is my first reported and fixed bug for Java. :)

sreda, 4. julij 2007

Update on sound on T60

In my last blog I mentioned that sound sometimes is working and sometimes is not. Now I know when it is and then it isn't.
If I put my T60 into hibernation then on next boot sound is not working. If I shut down my T60 and boot it sound is working. Oh well.. :))

My own notebook

Yuppiii! Last week I got my own notebook, a ThinkPad T60:
- Intel Core 2 Duo 2.16 GHz
- 2 Gb RAM
- 120 Gb HDD
- Atheros wireless card
- ATI Technologies Inc Radeon Mobility X1400
- 15.4" display with 1680x1050

Of course it came with Windows XP, but I soon deleted it from the machine. :))) I put Ubuntu 7.04 on following this and this tutorials.
You have to use text installer to install Ubuntu 7.04, because ATIs card is not supported in this stage. After installing Ubuntu I had to follow this thread.
I had a lot of problems with the Atheros wireless card, since it was not recognized by the system, so I had to go and download the latest drivers from MadWifi homepage and do a simple make, make install. Of course every time I upgrade kernel-modules I have to do this again. Now wireless works like a charm. :))
The second problem was my sound card. It is an Intel AD1981. At first it didn't work, meaning that when I tried to play something I got a lot of Device not opened type of errors. Then I read something about this in Ubuntu forum and this thread. It seems that you have to have modem enabled in your BIOS. Doing this I still couldn't hear sound, so I followed this part of UbuntuGuide. I still kinda have a feeling that sound sometimes works and sometimes does not, like it would have a mind of it's own. :))) The main thing is that I know it does work. :)) For the most part. :))
OSD (On Screen Display) for sound and brightness (Fn + Home, Fn + End) were working from the ground up.
Of course I wanted to try beryl on T60. I have done everything that is described in these steps, but display was are mixed up. You couldn't see anything. For now I'm going to stick to GNOME and maybe later try another approach.
What is still not working is my modem. I'll have to look into this problem a bit more.

Bottom line I'm now working with a T60 for a week now and I love it. :)))
I'll keep you informed.

petek, 22. junij 2007

Glassfish on Windows and "space hell"

If you want to run Glassfish as a service on Windows than you have to use sc.exe and appservService.exe.
At first I tried this (D:\Apps\glassfish is my GLASSFISH_INSTALL directory):

D:\Apps\glassfish\lib>sc.exe create domain1 binPath="d:\Apps\glassfish\lib\appservService.exe
\"d:\Apps\glassfish\bin\asadmin.batstart-domaindomain1\"
\"d:\Apps\glassfish\bin\asadmin.bat stop-domain domain1\"" start= auto DisplayName= "SunJavaSystemAppServer DOMAIN1"

and it didn't work. Why? Look at the command that does work:

D:\Apps\glassfish\lib>sc.exe create domain1 binPath= "d:\Apps\glassfish\lib\appservService.exe
\"d:\Apps\glassfish\bin\asadmin.batstart-domaindomain1\"
\"d:\Apps\glassfish\bin\asadmin.bat stop-domain domain1\"" start= auto DisplayName= "SunJavaSystemAppServer DOMAIN1"

See the difference? No... Well, there is a space after binPath= operation. This is not the first or the second or the third, ... time I had to deal with this. And I HAVE IT ENOUGH!!!

nedelja, 10. junij 2007

Funny game

It's been a while since I played a game, but then I came accross this one.
It is very funny one to play. First time I saw it I laught for an hour. :)))