Latest Publications

JavaFX PDF viewer demo


Note: If you only see a blank area instead of a video, it might be your firewall blocking YouTube (sorry)

The most impressive JavaFX demo to me was the PDF viewer. The visual design of the application was clean and stylish, to the point that I rather be using this PDF viewer than the official Adobe Reader on my PC (which manages to lock up my browser for too long all the time). Notice in the video how changing to different pages displays a quick fading animation, previewing pages are visualized via an nice carousel animation, and how zooming in and out of documents is nicely animated.

I didn’t get a chance to ask Chris Oliver how he managed to do the PDF rendering (using an existing Java library, or all JavaFX?) but I did ask his boss Nandin Ramani about when the demo would be released. She indicated there are some license issues with the fonts and that this is preventing them from releasing the code. I think they need to make the demo available regardless of the code, this is really a killer app, more so than the Flash like demos. Don’t know about most people, but I would love a nicer looking more usable PDF Reader.

JavaFX

javafx.jpg

So yesterday at CommunityOne there were some hints about some developments on the Java client side. I guess it’s obvious to guess at this point, minutes before today’s JavaOne keynote that it’s going to be about JavaFX. This technology seems like a direct competitor with Adobe’s Flex and Microsoft’s Silverlight, and may leverage existing installations of the Java VM. More details today of course.

We’ve already seen JavaFX, it comes from a project called F3 (Form Follows Function). I was lucky enough to reserve a spot at one of those talks, and I’m glad because I’m sure it’s going to get filled up pretty soon after this has been officially announced.

Things I would like to see addressed:

  • What support is there for media (JMF is old and crusty)? If there’s anything new, can we take advantage of it on regular Java SE apps?
  • Does this include a smaller client footprint? (stripped down JVM?)
  • Is this project seen as a replacement of Applet technology?
  • Would it be possible to create JavaFX apps with Java?
  • F3 introduces it’s own scripting language ,would it be possible to easily interact with existing Java code?
  • Tool support. If I’m creating an animation, will there be visual editors (a timeline?) for an artist to compose the app?

Questions, questions, questions …

Update 1: JavaFX site open now!

https://openjfx.dev.java.net

There’s even an Netbeans plugin available (downloading now …)

No AB5K demo

AB5K

I noticed I was sitting next to Josh Marinacci at the Java Posse podcast during NetbeansDay. I asked him about the demo and he said they’re not doing the AB5K desklet demo anymore. Sad to hear, I was hoping they would showcase it during one of the general sessions, specially when James Gosling was impressed enough to blog about it.

There’s still an AB5K BOF session, and I’m hoping to meet other desklet developers out there. Hopefully a new name can be suggested while we’re there :-)

JavaOne 2007 is here

CommunityOne 2007

Well, technically today is “CommunityOne“. Got here late last night, and the conference started today at 10:00am. The first general session is discussion between Tim O’Reilly, Rich Green, Ian Murdock and Tim Bray. I got a bit late, but it’s a general discussion with some questions posted via email … nothing very technical at all. BTW, the is the first time I’ve heard the term “Web 1.5″ which is a bit silly (O’Reilly used it describe the dotcom burst). Somebody also asked a question about Web 3.0, this is beyond ridiculous

One interesting thing is Rich Green hinted at some announcements tomorrow related to using the JVM with other languages. We already know about Ruby, I wonder what the next set of languages is.

I brought my camera (and fixed it at the conference, the shutter button fell off!) but left the card reader at the hotel, I’ll be updating some of the posts later when I upload at the hotel.

The sad case of the Java object that couldn’t be instantiated in Java

dead_fish1.jpg

Today’s code blooper involves a Java object that cannot be instantiated in Java.

I was helping somebody unit test some code and we kept getting a null pointer exception on the constructor. First of all, the object in question had overly complicated constructors. Imagine something like this.

public FruitBasket(){

// Does nothing important
}

public FruitBasket(String ownerName, Fruit[] fruits, Color color, String brand, Date purchaseDate, boolean hasLid, boolean hasHandles, boolean hasLock, int maxFruits, int width, int height) {

// Copies all values, and copies array to a local array (does not keep reference to one in parameters)

}

Now imagine that constructor has 12-14 parameters, and 1 more constructor. It’s begging for some factory, or heck, just using an empty constructor and rely on “set” methods. Anyways, the thing was blowing up in the constructor and it was hard to see why. It was when it was copying the array to the array in the object. After a bit of debugging I noticed that the array was never initialized, so it was trying to reference a null array. Doh! OK, but this code runs in a real product, how could this work at all?

The answer? JNI. The object in question usually gets created by a JNI program. The array is created in the JNI code, which has full access to the Java private fields, so it’s not a problem. The irony is that without fixing this class, it can never be created in Java. I thought that was a bit ironic, but what this really shows is that this class is lacking basic unit testing in the first place. During integration test, you won’t see these problems because every bit of the application is doing its job. But when you apply unit tests, you tend to catch things like … not being able to instantiate the class!

The bug is a common mistake, but the biggest problems are having multiple constructors share zero code, long constructors that are only large because people keep adding features, and zero unit testing for core classes that are used all over the place.

Bad dialog practices …

nb-error-dialog-cvs-vcs.png

 

When I launch Netbeans 5.5, it seems I’ve installed some version control module that produces these two dialogs whenever I start the IDE. I still can’t figure out what the program wants me to do here. First of all, it has to be a bug and not a feature that it’s popping up 2 modal dialogs at the same time. Very annoying. However, what really confuses me is that one dialog is for “CVS” and the other for “VCS“, which adds to the confusion because just by looking at the text you really get the terms confused. (I’m guessing I get these because they are 2 different but related Netbeans Modules/Plugins)

But the worst part is that I’m not sure what these dialogs are trying to tell me. Both say that a module is being installed, while an older version of the source control infrastructure is being disabled. Both dialogs have almost the same exact text, but one at least is telling me that it “strongly recommends I restart the IDE after the installation is complete”. The question is, why do I have to do this manually? I’m not even sure when the installation is complete, there’s no visual indication. Wouldn’t it be better to bother me about the restart option once you are ready? Even better, how about restarting the IDE when it needs to do this (Would you like to restart the IDE so VCS/CVS modules can complete their installation?).

I also don’t know how to get rid of these dialogs. I get the impression I’m not supposed to do any manual operation, but I keep getting them. Perhaps it’s time to blast my current installation and start over again, which is never a fun thing to do.

No training wheels!

riding_bicycle.jpg

It only took a couple of days, but yesterday Monica was able to ride her bike with no training wheels by herself for a nice little distance around our street. I’m so proud of her, and it’s been a lot of fun teaching her how to ride a bicycle. We still have a lot of work to do, like perfecting those turns, but it’s really something to see your “baby” growing up so fast. I just thank God I’m blessed with these moments.

Oh I forgot to mention, we did have a couple of accidents along the way:

falling_from_bike.jpg

Don’t worry, that last pic is staged of course ;)

Magnetic Desklet v 0.1

Magnetic Desklet v 0.1

 

I uploaded the first version of the “magnetic desklet”. If you have AB5K installed, it should install and start by clicking/downloading this:
http://sellmic.com/download/MagneticDesklet.desklet.

I have a blog entry that describes the concept of what this is trying to do (not everything is implemented), and another post on the desklet dev list with more details. The short description is that it’s sort of a window manager for desklets (desklets are the same concept as gadgets or widgets) with a magnet metaphor.

There’s a lot of changes being committed to AB5K now, so this desklet won’t work for long. Give it a try if you get a chance.

Magnetic Desklet – Initial Thoughts

Recently Joshua Marinacci and Robert Cooper announced their new AB5k project, a cross platform Java based widget system.

I’ve been pretty interested in the project and was wondering what desklet to develop. I’ve always been interested in window management issues, and in the AB5k forum there was a discussion about using the “magnet” name. That gave me a little idea for developing a”Magnetic Desklet”.

Goal

The main purpose of the Magnetic Desklet is to help users manage the layout of their desklets. Some of the functions are basic window management and could be implemented by the desklet container (ex: hide all my desklets, restore them), but the idea here is to complement the container and do it in a fun metaphor that makes sense usability wise.

Description

The best way to describe the window management features of this desklet is visually.

01-magnet.jpg

Figure 1

The Magnetic Desklet should be just another desklet that you can load into your system, since it will do window management, it will probably need to ask for special permissions. You can drag the magnet anywhere you want and access functions via a right click popup menu (there might be better ideas for this, as I don’t like hidden functions).

02-magnet-desklets.jpg

Figure 2

The main point of this desklet is to help you organize your desklet container. So for example, if I have a set of open desklets and I want to make some space, I should be able to click on the magnet (or access a “collapse” menu item in the popup menu) to group them all together.

(more…)

India

India Photo Gallery

I’ve been in India this week, and haven’t had much time to update the blog. I was in Mumbai until yesterday, and today I’m in Hyderabad. A gallery of the current pictures I’ve collected so far is here.

It’s been a great trip. Everybody is very friendly here, and we had a chance to visit a lot of Mumbai on Sunday. Mumbai is a very interesting place, the density of the population is unbelievable. We saw a lot of extreme poverty, but we also saw a lot of happy people. The picture in the blog post is one of my favorites. Just a kid with his dad having fun in their motorcycle. BTW, this is a very dangerous but common practice in India. I saw up to 4 people in a small motorcycle, wearing no helmets!

Hyderabad is pretty different. Still a lot of people, but not to the scale on Mumbai. It also seems somewhat more modern, with very lavish stores and malls all over the place. Hopefully I can capture some of the city before we head back home this Saturday. I’m really looking forward going back home because I deeply miss my family. Can’t wait to see Roxana and the girls soon!!!!