Monday, December 17, 2007

The Best Documentary Series Ever: The Ascent of Man by Jacob Bronowski

I have been quite silent lately because I have been so busy studying languages (this time a natural language, not a computer language :)

When I was a youngster Jacob Bronowski's TV-series "The Ascent of Man" had a huge impact on me. Recently I got this TV-series in form of DVDs as a birthday present. I was a little bit afraid that the series would have lost some of its glory during the years. My fears turned out to be unnecessary. "The Ascent of Man" is still as intellectually stimulating and inspiring as it was in the seventies. For those who don't know the series, below is the link to the Amazon page
The Ascent of Man in Amazon

A moving YouTube video clip from the series
Bronowski visiting Auschwitz

Thursday, April 12, 2007

New Books on My Bookshelf

I'm just reading "Genesis Machines" from Martyn Amos and "The Goldilocks Enigma" from Paul Davies. Both are really as good as reviewers have stated.

I also have already received Richard Dawkins: "the Selfish Gene 30th anniversary edition". I have 2nd edition but I wanted to refresh my memory with this new edition.

I have also received "The Oxford Handbook of Philosophy of Mathematics and Logic". I also managed to buy an out of print copy of the classic Wang: "From Mathematics to Philosophy".

Monday, March 05, 2007

"Java on Desktop"-experiences

I have had rather painful experiences while building Java Desktop applications. My personal opinion has been that Eclipse is more productive application development environment than NetBeans and Swing. Using Eclipse and SWT you can build quite nice look and feel user interface but the biggest issue has been deployment. I have used Web Start as a deployment model and the problem has been Java Runtime Environment installation. It is still too complicated to the normal user.

My last resort has been using NSIS to package the end product. It has installed also the whole JRE. Because SWT-applications use JNI to access native resources, they require so called all-permissions security model. This has of course caused yet another YES/NO dialog to the poor user, does she accept the certificate of my application. I have avoided this by adding my certificate to trusted certificates of the JRE-installment, which NSIS has produced. Of course as a result the size of application package has been huge .exe file: my application, SWT runtime and JRE.

Now I am seriously considering alternatives to this model. Certainly I will use SWT (or SWING) when I can expect that the user of my application has skills to install Java. If not I have to use something else than WebStart. I have so far tested SEAM
( http://www.jboss.com/products/seam ) and the results have been so far really good. After having read the Bruce Eckel's article "Hybridizing Java" http://www.artima.com/weblogs/viewpost.jsp?thread=193593
I have decided to play also with Flash and FLEX to check if it is a viable alternative. Of course I hate to use closed source tools. Surely with Flash you can build cool user interfaces. I have to persuade myself that you can build reliable business applications with Actionscript inside the constrained browser environment.

Saturday, January 20, 2007

Java 6 SecureRandom Bug with WebStart and Applet applications solved

After a lot of debugging I have found the reason for Bug ID 6505528. I have also detected a workaround for the bug. You can get more info in
Sun's Bug Database

Tuesday, January 02, 2007

Java 6 and SecureRandom with SHA1PRNG causes cryptic bug with WebStart and Applet applications

When testing new Java 6 with one application I found out that some small but important piece of code stopped functioning. To make the matter worse this code is obfuscated and even encrypted. It is also called from obfuscated and encrypted code ! As you can expect it was really a nightmare to debug.

After two days of intensive debugging the cause was revealed. SecureRandom using algorithm SHA1PRNG seems to work incorrectly. Cited from the documentation “If two instances of SecureRandom are created with the same seed, and the same sequence of method calls is made for each, they will generate and return identical sequences of numbers.” Unfortunately the seeding seems to work incorrectly in Java 6 with WebStart and Applet applications and when application is run for the first time i.e. code is loaded from the server instead of the cache.

This may sound as a minor bug but many applications use SecureRandom to initialize instances of javax.crypto.Cipher so it may have quite “cryptic” consequences.

To demonstrate the bug I wrote a small script so if you have already installed Java 6 you can try the link below to reproduce the bug
http://www.netandcode.com/AppletTest.php

AppletTest.php touches file AppletTest.class to force downloading the class file instead of using cached one. Test functions are called from Javascript because Firefox seems to have problems with Java 1.6 applets. Script also lists all sources to generate the bug.

You can call also link below to demonstrate how code works when it is cached. For example load link once, then close the browser, start browser and load link again. Now it should work fine.
http://www.netandcode.com/AppletTest.html

I have reported this bug to Sun
bug 6505528

Thursday, November 30, 2006

"Build Java from the sources"-blues

After having spent four weeks in Brazil on a vacation I have started a bold attempt to compile Java SE from the sources for Windows. I managed to compile it allmost completely back in 2001 but the build must have changed a lot during past years (I thought).

I downloaded all the necessary stuff for Java 5.0. Then I realized that the build was as terrible task as back 2001. To build Java 5.0 for Windows you'll need:

- "To do a build on a Windows system, you must use version 6.0 of Microsoft Visual C++ with Visual C++ Service Pack 3 (not Service Pack 4)"
- MKS Toolkit version 6.1a or later
- GNU make version 3.78.1 or later, built for the MKS

Now I will start to complain.

1. Microsoft Visual C++ 6.0 is surely an obsolete product.
2. MKS Toolkit version 6.1a is also an obsolete product. I have that ancient C 6.0 version but when I 2001 tried the build, it failed because of incompatibilities between MKS 6.0 and 7.0. Currently you can get MKS toolkit version 9.0. Test license is valid for 5 days. Full license costs 479 $.

So I made up my mind and decided not to pay 479 $ for MKS 9.0 Toolkit which probably can't build the Java SCSL.

When I crawled through build scripts I realized that Sun has started to add support for Cygwin as a build environment. Spent this week editing scripts; no success.

Last night I made the decision to switch to Java 6.0. There seems to be a full support for Cygwin. But I would need "Microsoft Visual Studio .NET 2003 (VS2003) Professional Edition compiler". It is also an old version which I surely won't buy. But I was lucky to find Visual Studio 2005 Professional Edition 90-Day Trial at: http://www.microsoft.com/downloads/details.aspx?FamilyID=B2C27A7F-D875-47D5-B226-E2578A116E12&displaylang=en

Just started the install. If I manage to port the Java build scripts for this compiler and the build even completes successfully, I might even buy the compiler ($799 !).

harri

Saturday, October 21, 2006

Gone to Brazil

Next four weeks I'll spent on a vacation in Brazil so I won't be Blogging for a while.

Harri

Play Yahtzee !

You can check the results from my spare time projects from
Yahtzee and Kniffel download
There you can download the popular dice games Yahtzee and Kniffel.

User interface has been made with Eclipse SWT except some graphics in Swing and Java2D. Both games use Java Web Start as a launching mechanism. Back end was programmed with PHP.

You can play single or with opponent over internet. Games are enabled for Skype so you can talk with your opponent while playing.

Yahtzee also includes game against computer AI, which plays with optimal strategy.

Both games have a free trial period for two weeks so feel free to try them. Implementing the license manager was actually most challenging part of the project but it was nice to do some cryptography again.

Harri