Archive for May, 2007

Seam makes JSF sexy again

Thursday, May 31st, 2007

Kito Mann of JSFCentral just posted the PDF slides for our JavaOne talk on Seam and JSF. The slides cover what is hot about JSF and what is not, and more importantly, how Seam enhances and improves JSF in 14 important ways. :) Just to wet your appetite, here are the 14 key points elaborated in the slides:

1. Reduces Boilerplate code
2. Dependency bijection
3. No XML hell
4. Integrated ORM support (a.k.a, use Hibernate as Gavin intended! ;))
5. RESTful URLs and page actions (for GET requests)
6. Extensive and expanded use of JSF Expression Language (EL)
7. Fine-grained stateful conversations (web transaction, multi-tab support etc.)
8. Direct JavaScript integration for Ajax (use Dojo with your JSF apps)
9. Elegant input validation
10. Graceful exception handling
11. Easy-to-use and rule-based security
12. Business process and rules integration
13. Very easy to test (both unit test and integration test)
14. Tools support (Seam Gen for RoR-like experience for CURD apps)

Go check it out!

Seam NetBeans Plugin Updated

Wednesday, May 30th, 2007

Petr Pisl has released the 0.2 version of the Seam NetBeans plugin (man, he is so conservative with version numbers! ;)). It works with Seam 1.2.1 GA (w/ deployment to JBoss AS 4.0.5 GA). Petr has also fixed a few Windows bugs. It is essentially the same plugin we demonstrated at JavaOne. Please visit here for a quick tutorial on how to use the plugin.

Eclipse users: stayed tuned! The Red Hat Developer Studio with full Seam support is just around the corner! It will be worth the wait!

Seam book examples updated to JBoss AS 4.2.0 GA

Tuesday, May 29th, 2007

I have just updated all the 17 sample applications in my JBoss Seam book to JBoss AS 4.2.0 GA (w/ Seam 1.2.1 GA). You can now download the sample projects for both JBoss AS 4.0.5 and 4.2.0. If you find those examples useful, I’d appreciate if you can buy a copy of the book as well. :)

Since a lot of people seem to be confused about this, let me list the steps you need to convert a Seam application from JBoss AS 4.0.5 to JBoss AS 4.2.0:

1. Edit the resources/WEB-INF/web.xml file, and remove the MyFaces listener.

2. Edit the resources/META-INF/application.xml file, and remove the modules referencing el-api.jar and el-ri.jar.

3. Remove the el-api.jar and el-ri.jar files from the final application archive (edit the build.xml file for the ear or war tasks).

4. Edit the resources/WEB-INF/faces-config.xml file and add the SeamELResolver using the new JSF 1.2 XML schema declaration.

Do NOT miss the crucial step of removing el-*.jar from both the application and from the application.xml. If you do not remove those JARs and their references, your application will hang on JBoss AS 4.2.0 GA with a cryptic error message (before you ask, yes, we are fixing it). So, be aware!!

Note: Evidentially, the Seam security package still has some residue dependency on the Sun EL RI package. So, you might consider leaving el-ri.jar in the app if you use those features. It is confirmed to work in JBoss AS 4.2.1 GA. See comments below.

Made it to the Amazon best seller list (Java category)

Sunday, May 27th, 2007

Okay, now the “JBoss Seam” book is not only a top 10 best seller in JavaOne 2007. It is also an Amazon.com #19 best seller in the “Computer Programming — Java” category! Since Amazon lists more than 2500 books in the category, that makes it top 1%. I’d like to congratulate myself here. ;) Here is proof:

Picture 2.png

Hybrid car repair blues

Friday, May 25th, 2007

In a very stupid parking lot accident, I rear-ended our favorite car (sorry Ju) — the Toyota Prius — against a wall. It was a very low-speed accident (less than 5mph). But because of the hatchback design, the tail lights, rear bumper, and back door all have minor damages. As soon as I see it, I know the repair bill will be high with so many parts to replace. But still, I can drive it just fine on the highway. The repair cannot cost more than $2000-$3000, right? Very wrong!

The repair shop told me that the estimated repair cost runs around $8000! I can buy a new car (or two) for that kind of money! Good thing that the insurance pays for that! The costly part is that the bodyshop has to send the car to the Toyota dealer to remove the hybrid battery and store it in a special storage facility. Then, they work on the body. After the body work is done, they send the car back to the dealer to install the battery and re-test all the electronics. Notice that we are not talking about some no-name bodyshops here — we are talking about one of biggest and best bodyshops in the area! Yet, they have no in-house experience to work on a Prius hybrid car.

Is this going to be a problem when the current hybrid car fleet age? When we bought our Prius in 2004, we had to wait for months in order to get one. But now hybrid cars and SUVs are readily available in a variety of popular models. The body shops have to get themselves more prepared!

We love the Prius. It has exceeded all our expectations (reaching 55mpg in normal driving) except for this repair sticker shock (although this is really my stupid mistake). We are planning to buy a second Prius next year (the 100mpg one!). But we really hope the readiness of repair service will improve soon in the future (not that I will have any accident again! knocking the wood …).

Remember the happier days …
DSC_0102.jpgDSC_0106.jpgDSC_0107.jpg

AK-47

Thursday, May 24th, 2007

I have been living in Texas for 10 years and was never part of the “gun culture” here. Well, part of the reason is that I have always favored tighter gun control laws. On the other hand, I realize that the Texas gun law is not going to change any time soon, and the best outcome from the current law is for lawful citizens to learn how to use a gun — to fend off the bad guys when needed. Oh well, when in Rome

So, I went out to the shooting range with my colleague Thomas Cameron today to play with his AK-47 and AR-15 (a.k.a M-16 in US Army) assault rifles — they are basically the guns we see every day in Iraqi news (the bad guys use AK-47 while the good ones use M-16). I fired more than 100 rounds on both guns.

20052007076.jpg

Turns out that my AK-47 score is not too bad — all 30 rounds in the magazine are accounted for on this target — of course, I did hang the target fairly close so that I can point and shoot. ;)

DSC_5012.jpg

Did I enjoy this? You bet I did! Firing a loud, powerful weapon is a great stress reliever (for a guy anyway!), and the shooting range is probably the safest place to fire a gun. I will probably do it again when I have a chance, although I am not going to bring home an AK-47 any time soon. ;)

com.sun.robot.humanoid — the Office Toy in JBoss/RedHat Austin

Friday, May 18th, 2007

Phillip and I bought the "Java robot" from JavaOne, and decided to keep it in the office as an "office toy". This is easily the coolest geek toy I have seen in years. It can walk around, sit / get up, pick up stuff with its hands, speak / sing (plays any MP3), play video / games on its LCD screen, and even take pictures. It detects and responds to sound, visual objects, and colors. It can even automatically recognize and follow humans. Of course, it can be remotely controlled as well.

Picture 7.png

But the best feature of all is that the robot runs Linux and can be programmed via a simple Java API! There is a simple Java wrapper class that allows your application to interact with all sensors and motors on the robot. You typically run your application in a loop, and try to make the robot respond to events coming in from the sensors. I have not tried but here is some sample code from the SDK. You are smarter than the robot and can figure out what it is supposed to do. :) Isn't that COOL!

JAVA:
  1. Humanoid humanoid = Humanoid.getInstance();
  2.  
  3. ... ...
  4.  
  5. while (true) {
  6.   // Turn off the bright LED in the eyes.
  7.   humanoid.enableLED(false);
  8.            
  9.   // Look around.
  10.   humanoid.VISION.track();
  11.            
  12.   // Check for color red in vision field. Run to red.
  13.   if (humanoid.VISION.getTarget(Vision.RED)) {
  14.     // Turn on the LED in eyes to signal that it sees RED
  15.     humanoid.enableLED(true);
  16.                
  17.     // Advance on target.
  18.     humanoid.WALK.walk(Walk.FORWARD_GAIT1, 10);   
  19.                
  20.     // Are we at the bump?
  21.     If (humanoid.TOUCH_LEFT_FOOT_FRONT.isTriggered()||
  22.               (humanoid.TOUCH_RIGHT_FOOT_FRONT.isTriggered()) {
  23.       // We are done.
  24.       break;
  25.     }
  26.   } else {
  27.     // Do not see RED in current vision field -- so the robot moves around to search for RED
  28.     boolean wanderLeft = 1 != rand.nextInt(1);
  29.              
  30.     // Wander left or right
  31.     if( wanderLeft ) {
  32.       humanoid.WALK.turnRight(2);
  33.     } else {
  34.       humanoid.WALK.turnRight(2);
  35.     }
  36.              
  37.     // Walk forward a bit
  38.     humanoid.WALK.walk(Walk.FORWARD_GAITFAST, rand.nextInt(3) + 3);
  39.   }
  40. }
  41.  
  42. // Raise the arm to declare victory
  43. humanoid.SHOULDER_LEFT_SERVO.moveToPosition(
  44.   humanoid.SHOULDER_LEFT_SERVO.maxPosition() / 4,
  45.   humanoid.SHOULDER_LEFT_SERVO.maxSpeed());
  46.  
  47. // Take a picture of the RED target and display it on the LCD
  48. String pictureFile = humanoid.CAMERA.takePhoto(0);
  49. humanoid.CAMERA.displayImage(pictureFile, 5000);
  50.  
  51. // Say something
  52. humanoid.AUDIO.playClip(mission_accomplished.mp3);
  53. ... ...

The robot is BIG -- it was a challenge to bring it back from San Francisco. :) Just notice how big it is compared with Phillip's 19" monitor in the background.

Picture 6.png

Anyway, we have not officially started playing with it yet (product release deadlines! ;)). I will continue to blog about it here in this blog as we discover its features. If you have ideas on applications, leave a comment -- we might implement it and post a video!

The Weird Geeky T-shirt from Sun’s CommunityOne Event

Monday, May 14th, 2007

It took me a while to figure out the cartoons on Sun's "CommunityOne" T-shirt ...

The front of the T-shirt says: O-pen-sew-(hor)se: Open Source

Picture 31.png

The back of the T-shirt says: Comb-ewe-knit-e-one: CommunityOne (Thanks David for the correction, see comments. I am bad at math ;))

Picture 4.png

The In-Room Sensor in the W Hotel

Monday, May 14th, 2007

I stayed in the W Hotel for this year's JavaOne conference. It is a very nice hotel with the best location for JavaOne -- I can go back to my room after a session, change, and catch the next session in time. The room is tiny for its $400 / night price tag -- it can barely hold two people chatting with each other. But hey, this is San Francisco real estate.

What I found most amusing about the room is that it has a small box mounted on the wall facing the bed. At the first glance, it looked like a video camera. Why would a hotel install a video camera to spy on guests? So, I decided to climb up the desk and have a better look. It turns out to be more high tech than I thought!

It is actually an IR / heat sensor capable of detecting people in the room. If it detects no one in the room, it automatically adjusts the A/C to save energy and notifies the housekeeping staff that it is okay to come into the room now. That is pretty neat. I guess each housekeeper would also have a handhold device to query for this information as they go from room to room? That would be excellent use case for a Java end-to-end application. :)

Now I think of it, maybe such sensors have been installed in many hotels I stayed in the past. But this time I stayed in the tiny W hotel room for week -- so I had a better chance to actually notice it. ;)

JBoss Seam book makes the JavaOne official best seller list

Wednesday, May 9th, 2007

JavaOne has a long tradition of tabulating and ranking book sales from the conference official book store. All technical book publishers are present in the bookstore and they make their most popular Java book titles available at a discount to the 15,000+ JavaOne attendee. The attendees' interest in technical books is often a gauge of the technology trend in the Java world.

Well, on the first day of the conference, my new book "JBoss Seam" made the top 10 best seller list! That says a lot about Seam's momentum among developers. Furthermore, I have several interesting observations of titles on the list:

1. JavaServer Faces (JSF) is really taking off! Despite what the "cool kids" say in the blogsphere, JSF is very much in demand in the real world! The number one book on the list is a JSF book and my book is closely related to JSF. Actually, according to Matt Raible's 2007 web framework comparison report: JSF leads other post-Struts web frameworks by a big margin in terms of number of jobs available.

2. In terms of dynamic scripting languages, people are much more interested in Groovy / Grails than Ruby / JRuby / Rails -- that is despite 2 days of intensive JRuby / Rails brain-wash from Sun. The best selling Rails book is at #15 while 3 Groovy / Grails books made into top 10. I guess Java developers do want a scripting language that is closely related to Java!

3. Netbeans marketing surely is effective!

Here is the actual list:

Picture 3.png

JavaOne book store will update the best seller list on a daily basis. So, let's stay tuned to see what happens tomorrow! :)

Update: By the end of the conference, the book remained at #6 on the best seller list although other top books get shuffled around. I finally got a JavaOne best seller under my belt! :) Here is the final tally:

Picture 1.png

Interests in JBoss Seam is Very High in JavaOne

Wednesday, May 9th, 2007

Last night, we had two Seam-related BoFs in JavaOne. Kito Mann and myself presented "Extend and Improve JSF with Seam" at 9pm, and then Petr Pisl and I presented "Rapid Seam App Development with NetBeans" at 10pm. Despite the late timing, the first BoF attracted around 150 to 200 people, and the latter one attracted around 80 people. That was more people than some afternoon technical sessions! I have presented on JavaOne BoFs for years and those were the best turn-outs I have seen. Seam is the way to go!

We will post more materials -- slides, demos, and update software -- from the sessions very soon (after I recover from all the partying in San Francisco! ;)). Stay tuned!

The Most Stolen Book in JavaOne?

Wednesday, May 9th, 2007

My new JBoss Seam book came out just in time for the JavaOne conference. The publisher (Prentice Hall) brought 5 copies of the book for display in their booth as well as in the Red Hat booth. Well, before the day's end, we only have 2 copies left! The display copies are simply disappearing from the booth as people walked by! ;)

41vCXc6lGUL._AA240_.jpg

It is hard to imagine that people paying $5000+ to attend JavaOne would "steal" a $40 book on the show. They probably think that the display copies are vendor freebies? But then, this does not seem to happen to other books and certainly never happened in the vendor booths I had worked in the past 3 JavaOne conferences (we have books on display every year)!

Anyway, we will be running out of display copies very soon at this rate. But here is a tip: there are plenty copies in the JavaOne official book store -- along side with my Java ME best seller "Enterprise J2ME". So, bring it on! Go steal that book!

PS. That just remind me an episode a year ago when my "Nokia Smartphone Hacks" book made the "daily most downloaded book" on popular BitTorrent site Mininova. Well, I am flattered and offended at the same time!

Dr. Junying Yuan elected into the American Academy of Arts & Sciences

Saturday, May 5th, 2007

My first cousin Junying Yuan has always been the "smart kid" in our family. She is a professor at Harvard University and has made major discoveries in medical research.

This year, she was elected into the American Academy of Arts & Sciences. This is one of the highest honors an American scholar can achieve in her/his professional career. I am so very proud of her!