Wednesday, June 24, 2009

Environment Variables in Ubuntu

I got some problems to find out where I should define environment variable in Ubuntu.
I had to search a while and finally found the right page:

https://help.ubuntu.com/community/EnvironmentVariables

in summary
  • ~/.profile - This is probably the best file for placing environment variable assignments in, since it gets executed automatically by the DisplayManager during the startup process desktop session as well as by the login shell when one logs-in from the textual console.

  • ~/.bash_profile or ~./bash_login - If one of these file exist, bash executes it rather then "~/.profile" when it is started as a login shell. (Bash will prefer "~/.bash_profile" to "~/.bash_login"). However, these files won't influence a graphical session by default.

  • ~/.bashrc - Because of the way Ubuntu currently sets up the various script files by default, this may be the easiest place to set variables in. The default configuration nearly guarantees that this file will be executed in each and every invocation of bash as well as while logging in to the graphical environment. However, performance-wise this may not be the best thing to do since it will cause values to be unnecessarily set many times.

Tuesday, June 16, 2009

Java lists and JavaFX sequences

I play with JavaFX and found a strange behaviour.
The size of a Java list is not the same as the size of a JavaFX sequence !
Let me show what I mean.

With a simple Java class I build a list with 2 elements.

public class ListTestJava
{
public List getList()
{
List list = new ArrayList();
list.add("j one");
list.add("j two");
return list;
}
}
In Java FX, I instantiate the Java class, and ask for its size.
To compare I also build a JavaFX sequence.


var java = new ListTestJava;
var javaList :List =java.getList();
println(sizeof javaList);
for(j in javaList)
{
println("java value: {j}");
}

var count = ["fx one","fx two"];
println(sizeof count);
for(fx in count)
{
println("fx value: {fx}");
}


The result is:
1
java value: j one
java value: j two
2
fx value: fx one
fx value: fx two

Strange isn't it?
The reason for this behaviour is that the sizeof operator returns 1 on anything other than a sequence. A list is not a sequence.
Until now I don't know how to convert a Java list into a sequence!


Monday, June 15, 2009

JavaFX constructor

Interestingly, and quite surprisingly, there is no Constructor in JavaFX. This is disturbing when coming from Java.
Instead you use

postinit{
loadFile()
}

see James Weaver's Blog

JavaFX wish list

I started to play with JavaFX.
I must say I enjoyed the ride and wish I could use it for some "real" stuff, but
as I know business, there is no chance in a near future.
What could strongly help JavaFX adoption is some JavaFX Application Framework. These days, Eclipse RCP and to a lesser extend NetBeans Platform are buzz words, and everybody should use the platforms. IMHO both framework have a too steep learning curves for simple guis.
If we could have something similar to JSR 296 (Swing Applicatin Framework SAF) with some additional functionaliteies, for me Docking Framework and Modularity is what is missing from SAF, we could start using JavaFX.