Useful stuff for your blog-reading pleasure.

Sunday November 04, 2007
Just arrived in SFO and waiting for my first breakfast, but here's a good cause to support that I didn't want to miss. If you want Java 6 in OS X Leopard to happen, express your vote by posting the magic string: in your blog. The more hots Google finds, the better. 275 hits already. I guess that's the Web 2.0 version of collecting signatures :). More details in the Babelfish Blog. Thanks Henry, for setting this up! I'm now holding off my planned purchase for a new MacBook Pro for a while...
"Vote for supporting Java in Max OS X Leopard!" has been brought to you by Constantin's Blooog.
This entry was created on 2007-11-04 07:48:02.0 PST and is associated with the following tags:
1.6
13949712720901forosx
java
jdk
leopard
mac
os
vote
web2.0
x
You're welcome to use this Permalink
, add a comment below or send your feedback to constantin at sun dot com.

Tuesday October 16, 2007
Now that I'm back from CEC and out of jetlag, I've had some time to clean up the CEC 2007 Message Prompter source code. Thanks to all those who asked for it, that was quite a motivation.
The CEC Message Prompter source code is free for your reading pleasure under an as-is basis, no warranty, no support, etc. Still, comments are of course very welcome. The easiest way to try this out is to load up NetBeans (I use the current Beta 6), install the JavaFX module, then create a new JavaFX project. The stuff in the source code archive goes into the src subdirectory of your new JavaFX project. Choose "Main.fx" as the main class and feel free to enable Java Web Start. In order to compile/run the app, you also need JAXB 2.0 (or use J2SE 6) and the mySQL JDBC Connector installed in NetBeans as libraries and assigned to the project you use for this app. After starting the app, you'll see the window above. To the top is the message source selection GUI. Choose whether you want to have a database or a URL (for XML) connection. A sample XML file with some messages is included, so you probably want to use the URL method. Enter the file URL where you have your messages stored into the URL field, then click on the right (next) or left (previous) or the X (clear) buttons to display the messages. The optional Session field is for filtering messages by session ID but we never got to use it yet. Before I start with the code, a few words of introduction: This is my first JavaFX project and I welcome any suggestions on how to better code in JavaFX. It is also my first Java/NetBeans project since a long time, so I'm sure I can still learn a lot more about how to properly do it. But the learning journey into creating this app has been a fun and instructive one, so I hope this code can help others learn more about JavaFX too. If I had to do it again (And I hope I will, next year), I'd do some stuff differently, which I'll discuss at the end of this posting. Let's walk through the code in roughly the order of how the message flow works: - The audience sends their questions, feedback, messages etc. to the CEC backstage team through either Email, Instant Messaging or SMS through special Email or IM accounts or mobile phone numbers. The CEC backstage team reads the messages and stores them in a database where they can be approved, marked for deletion, marked for display on the Message Prompter and assigned a sequence to display in.
- The CEC Message Prompter is the application that the people on stage and occasionally the audience see/s and where the current question to be asked to the people on stage is displayed. So the app has to fetch messages from the database and display them on screen on demand and in a visually intuitive way.
- For testing/development/backup purposes, the Message Prompter can also accept messages out of a single XML file instead of a database.
That was it. All in all, learning JavaFX was a fun experience. And you can do it too, just go to the OpenJFX website and check out the tutorials and references. What would I do differently if I had to write this app from scratch? Probably one or more of the following: - Use real object oriented style by attaching methods to classes etc. Possibly different classes in different files, loosely coupled by the main class, as in this nice Mariah Carey website example.
- Rework the animation so it works on triggers. Triggers are a way of coupling code to variables, similar to binding. So, whenever a variable is changed, the trigger code gets executed. For instance, the tags could be updated and animated using triggers.
- Introduce more eye-candy. JavaFX comes with full Java2D support, so I'd dig in deeper into its classes to implement nicer animations.
- Make it more interactive by letting GUI elements slide in and out only when necessary so there's more real estate for the messages.
- Introduce images and symbols to help with the eye-candyness.
Thank you for reading this and I hope you enjoyed this JavaFX example. Let me know your thoughts by using the comment function or by sending me email!
"Walking through the CEC 2007 JavaFX Message Prompter Source" has been brought to you by Constantin's Blooog.
This entry was created on 2007-10-16 03:44:16.0 PST and is associated with the following tags:
2007
cec
cec2007
client
java
javafx
jdbc
messaging
netbeans
open
opensource
source
suncec2007
swing
xml
You're welcome to use this Permalink
, add a comment below or send your feedback to constantin at sun dot com.

Wednesday October 10, 2007
Boy is this CEC 2007 conference a busy place! Here's a couple of things that got me excited since my last post: - Yesterday we had an Unconference session coupled with a couple of speed geeking sessions. Three of the speed geeking sessions were centered around Web 2.0: Neeraj presented on CE 2.0, our new collaborative infrastructure for the field that leverages a lot of Web 2.0 principles. Hal Stern shared some fascinating thoughts about why DRM is Morons and why sharing content is always a good thing, even if it's professional music or movies or other traditional content.
- Today, after the morning sessions and the big launch, a couple of colleagues and I sat down to record the second episode of the CEC 2007 Podcast. This time, Jonathan Schwartz and John Fowler joined in, together with Matthias Pfützner, Robert Holt, Dave Levy and Michael Ramchand. Don't miss this episode where we share our impressions of CEC and discuss some thoughts about the value of Web 2.0 to us.
- This CEC has also probably seen the debut of JavaFX and JavaFX Script on a big stage :). To the top, you see a screenshot done by Rajesh of an application that we use to prompt questions from the audience to the presenters on stage. Questions come in through SMS, Email and Instant Messaging while the presenter on stage gives his talk. They are aggregated and fed into a database by the CEC Backstage Messaging Team. Finally, they are displayed onto a screen through the CEC Message Prompter for the speaker and the audience to see.
The message prompter is written in JavaFX Script. It uses traditional Java classes to access the database through JDBC and it can also digest messages in an XML format through the JAXB API and this is the first significant feature of JavaFX: You can mix traditional Java Classes with JavaFX Script seamlessly, leaving all the heavy-lifting to Java so you can concentrate on the GUI through JavaFX script. Another nice feature of JavaFX Script is the declarative syntax: You just write down how what you want and the JavaFX runtime takes care of instantiating the objects, initializing their parameters and fiddling them into the Swing event loop. The above photo only shows a screenshot, but the application is animated: Every time a new message is highlighted, old messages are reduced in size and color while the highlighted message grows and becomes a darker color. Also, to the right, there is a dynamic tag cloud that reflects all of the words visible on screen and where the size of the word indicates its multitude. Again, the tags are animated based on the changes in the message part. Programming animations in JavaFX is very easy thanks to two constructs: Variable binding and parameter streaming. Variable binding means binding an object attribute (i.e. the HTML code that describes the rendering of the message) to a variable (the position of the message in the message list). After the binding, the attribute behaves much like a marionette: As soon as something changes in the data model (i.e. a new message is added to the display list), the attribute is updated in real time and the font characteristics are updated to reflect the change (in this case, the next message grows while the older one shrinks). And here comes another mechanism to help, the "dur" statement. A line like "myVariable = [0..100] dur 500" means: Assign the values 0 to 100 to the variable myVariable during the next 500 milliseconds. Perfect for animation control! JavaFX takes care of all the setting up of timer threads etc. under the hood, while the programmer can essentially animate everything in their application. Very nice. Of course, the CEC Message Prompter is not bugless, and unfortunately, the highlighting went wrong a few times :). Fortunately, this didn't seem to confuse anyone, but today I implemented a watchdog mechanism to make sure stuff always has the right size no matter what. I hope that this works more smoothly tomorrow... I'd like to encourage everyone to try JavaFX script out. It still feels a lot like beta but it's already quite useable, heck, we're using it in production right now at CEC :). Let me know if you want the source code to the CEC Message Prompter application.
Well, that's it for now. Off I go to drop into a session real quick before attending a meeting and then there's a party scheduled, too...
"CEC 2007: JavaFX on stage, podcasting with Jonathan and Web 2.0 at the unconference" has been brought to you by Constantin's Blooog.
This entry was created on 2007-10-09 16:08:01.0 PST and is associated with the following tags:
2007
cec
cec2007
cmt
java
javafx
niagara
podcasting
suncec2007
t2
ultrasparc
You're welcome to use this Permalink
, add a comment below or send your feedback to constantin at sun dot com.
|
|
|
|