Pages

Saturday, February 18, 2012

Fedora 16x64 and JavaFX 2.1.0-beta

JavaFx is currently unavailable for Linux x86_64. So we will use 32bit one. The steps are:
1. Download jdk-7u3-linux-i586.tar.gz from here (I have  jdk-7u3-linux-x64.rpm already installed and I don't want to mix 32 bit jvm to my package system)
2. Unpack it to /opt
3. Add to your profile (e.g. /etc/profile)

export JAVA_HOME="/opt/jdk1.7.0_03"1
PATH=$JAVA_HOME/bin:$PATH;export PATH
4. Download something like javafx_sdk-2_1_0-beta-b13-linux-i586-14_feb_2012.zip from here and unzip it to /opt
5. Install packages to support 32 bit java (maybe not needed if you have installed rpm):
sudo yum install libgtk-java.i686 gtk2-engines.i686 libxslt.i686

6.You also need libavcodec.so.52 to fully support HTML5 in JavaFX. It is not shipped nor in the main Fedora repo, nor in Rpmfusion. I have found it in the http://atrpms.net/. However this repo may come in conflict with Rpmfusion. Anyway, with this repo installed you may do
sudo yum install libavcodec52.i686

That's it! Now you may install Netbeans 7.1 and try javaFX samples. Or try them in Eclipse with this plugin. I recommend to look through these examples (code for this book - have not read it and I'm seriously doubt whether it is worth reading it). They are not very good, some of them do not compile (but are easily fixable), some of them do not work on Fedora x86_64, but I have not found anything better yet.

Thursday, February 9, 2012

Order of enums in hashset and hashmap

Recently I have found myself writing a complex sql-builder for two weeks already. Of cause I used TDD technique and this was much less like a pain comparing to the times when I didn't wrote any tests. In some moment I decided that just operating with strings in some thousand or more lines of code is not very cool and started to write some OOD for the problem. In the resulting type hierarchy there were some enums. And I used these enums as keys in HashMap. Maybe some curious reader have already guessed what this post is about ;-) If not or if you just want some detailed illustration, read the rest: