Wednesday, June 25, 2008

Could you clean up your JavaFX tutorial on the web? :-)

JavaFX Script is not a matured language yet. If you look at the early tutorials, those code will not work in the latest development tools (OpenJFX on NetBeans). After a little research on the web, I learned that Sun doesn't seem want to maintain two different flavors of the same language. They will retire the interpreted version of JavaFX. If you are like me, who want to learn JavaFX from the web, you might want to print out a copy of this link by your side. This document lets you easily see the difference between old JavaFX and the new JavaFX.
In case you are still not sure if your example is interpreted or compiled, the JavaFX Complier gives annoyingly polite messages for old interpreted syntax:

Sorry, I was trying to understand a type specification but I got confused when I saw '*' which is an operator.

If you are a tutorial author of the interpreted JavaFX, please help the community by updating it to the compiled version, or simply said "interpreted JavaFX" in the title, so people who learns them will understand the difference. For a few days I was wondering if my OpenJFX NetBeans plug-in was bad, then I learned I was using old syntax.

Here are a collection of interpreted JavaFX web sites. Those example will not work in NetBeans 6.1 OpenJFX.

Sunday, June 22, 2008

JavaFX on Mac OS X with NetBeans 6.1

NOTE: This document is outdated. The new JavaFX Public Preview SDK don't need any of the following steps.

Read through this only if you are still using the JavaOne 2008 preview version of JavaFX SDK.

If you want to run JavaFX on Mac OS X using Netbeans 6.1 as the development tool, here are some tips to make it work.

If you just follow the installation guide on OpenJFX site, and generate your first sample project, you will get an error similar to this when you try to build and run the project:

Exception in thread "main" java.lang.NoSuchMethodError: com.sun.tools.javac.main.RecognizedOptions.getJavacFileManagerOptions(Lcom/sun/tools/javac/main/RecognizedOptions$OptionHelper;)[Lcom/sun/tools/javac/main/JavacOption$Option;

It is very easy to resolve this issue. Simply follow the steps posted in java.net Forums.

1. Go to your home directory, cd .netbeans/6.1
2. Edit the build.properties file, find a line says platforms.default_fx_platform.bootclasspath
3. Add the JavaFX jar file in the beginning so it look like
platforms.default_fx_platform.bootclasspath=/Users/(your_user_name_here)/.netbeans/6.1/modules/ext/compiler/lib/javafxc.jar: ...
4. Add import javafx.ui.* in the beginning of your generated JavaFX source code.
5. Restart Netbeans.

Saturday, June 21, 2008

My favorite Michael Jackson MV (was never on TV)

This song was part of the History album. The clean version of music video shown on the TV at that time was ok, but not as intensive comparing to other Michael Jackson's work.  Today I realize there is actually another version that was never shown. The prison version fits the song perfectly, and it become one of my favorite MV now.

Thursday, June 19, 2008

范曉萱的接班人

林宥嘉終於推出專輯了。終究他沒有讓人失望 。
不知為什麼我想到當年如日中天的小魔女范曉萱,忽然在左三圈右三圈愛洗澡最轟動的時候把頭髮剪掉開始唱自己的歌。雖然從此之後就開始與生活掙扎,但十年後回頭看,所有歌唱比賽都在挑戰她當時堅持的那些所謂不好賣的歌曲。
 
很高興林宥嘉的專輯跟別人聽起來不一樣。

Wednesday, June 18, 2008

Firefox 3 on Mac OS X


Today is the Firefox download day. The new version has a new interface design and it matches the native OS look-and-feel. Here is a side-by-side comparison of Safari 3 (top) and Firefox 3. It does not use the control from the operating system, but it feels quite close to the Mac OS X. The new address bar has lots of functionality, but also it looks more complicated.

Monday, June 16, 2008

Firefox 3: Download today!


Today (June 17 10:00am PDT, or 1pm Eastern time) is the Firefox 3 Download Day. Get Firefox from their download day web site. 

Wednesday, June 11, 2008

Dow Jones doesn't get it on the new iPhone


Dow Jones released a comment on the new iPhone yesterday, stating that iPhone must avoid the "Razr Trap". In the article, it says that the Razr was created as a high-end product. After the price reduction, Razr lost its attraction and Motorola don't make money anymore.

In my opinion, comparing iPhone price cut with Razr is completely irrelevant. The stories are different in the following ways:

1. Razr's success is purely on its amazing form factor and a matching name. Nothing more. iPhone has a good form factor too, but that is the last reason of being a success.
2. The innovation of Apple's product is not immediately visible sometime. Simple because 3G iPhone looks like first gen iPhone doesn't mean it is lack of innovation.  
3. Like the game console industry, Apple bet on the income of the the software. The software is not limited to the things in the App Store, but also including the business solution possibilities.
4. Windows Mobile is an operating system. Google Android is an operating system.  iPhone is a full package of hardware and its optimized software. It is the last mile of the whole information roadmap of Apple. Comparing iPhone with Windows Mobile or Android is not quite correct.  Comparing iPhone with WM6 based HTC-Touch, maybe.
5. How many feature did you use inside your Razr phone? Most people just use those feature at most once (test one two three, ok its working, now what). iPhone user use more than 80% of its feature constantly. Other phone assume you aren't gonna use those feature anyway, so they provide minimum version of application and hope you can pay for more. iPhone comes with software that you can really use. Just try Razr's calculator and you'll know what I am saying.

Good job Apple.

Picture taken from Telegraph UK

Monday, June 09, 2008

這叫別的電話怎麼混啊

蘋果今天宣佈了新的3G iPhone. 內建衛星導航 價錢只要一半 ($199) 合台幣六千出頭而已
這叫別的電話怎麼混啊 :~

Saturday, June 07, 2008

JavaFX: Will it survive?

Last summer, Sun announced the JavaFX project. JavaFX is a new platform with a new scripting-like language generally considered as a competition of Rich Internet Application (RIA) frameworks, such as Microsoft Silverlight, Adobe Flash/AIR, and all AJAX technologies. These technology delivers client-side programs through the browser, thus offload the server from laying out the screen, and enhance the user interactivity.

The concept is nothing new, especially for Java platform. In 1995, Java applet was the world's first RIA framework. It was widely supported in both Netscape and Internet Explorer browser. Lots of business application rewrites into Java applet during the dot com age, and eventually all kinds of problem occurred. Ten years past, most of the rich internet experiences are now delivered by Adobe Flash or AJAX. Java applet is no longer the favorite choice for rich applications. In my understanding, there are several reasons that cause the Java applet market share decline:
  1. Java Runtime Environment (JRE) installation size. The first generation browsers came with the Java Runtime. Even if they don't, the first generation of JRE is only around 2.4MB. Java 2 doubled the installation footprint, which is considered huge in that time. Java 1.4 doubled the Java 2 installation size, which is again considered huge even now.
  2. Long startup time. This is probably one of the most complain about applet: Slow graphic user-interface (GUI) startup time. Most of the time we see a gray box in the middle of the browser and the hard drive starts churning. Finally JRE is started, and then we see another delay for applet loading.
  3. Painful GUI design. Java is a general purpose language. Using Java for GUI layout is really tedious. Early version of JRE also suffer on lightweight component slowness. Lightweight component allows Java to draw its own buttons, labels and other GUIs instead of using the native peers. Lightweight component itself is not a bad thing, but the first few generations of lightweight component don't use native code for acceleration. You can literally see the components being drawn to screen one by one in the early Java 2 releases.
  4. Bad client app design because Java has too many features. Lot of client-server application was directly ported into Java applet and eventually failed during dot com age. Rich user experience means smooth interface response. Business logic need to be carefully designed to avoid code bloat on client side.
  5. Lack of rich media support. It is require lots of effort to integrate media into applet with third party tools. The standard way of media playing (JMF) has very limited support. 
JavaFX together with Java 6 update 10 is Sun's answer to these issues. If you need to write an RIA in Java, JavaFX with Java 6 update 10 might be the best solution. Base on what I read, here is how Java come back to RIA:
  • Java 6 u10 initial runtime download size is similar to the early Java 1.1
  • Faster cold start time
  • Faster lightweight GUI
  • JavaFX scripting language is more friendly to GUI layout and tool support
  • Rich media support
I don't know if JavaFX will become a popular RIA platform, but I am sure for my next Java GUI project, I will not directly code into Swing anymore. Using a different language gives developer a chance to think what should be in the GUI layer and what should be designed elsewhere. This should promote some good thinking for application design. I am sure JavaFX will survive, but I am still not sure if it will success.