Tuesday Jun 30, 2009

Building Facebook applications is not trivial. Most of the content is build in PHP/JavaScript and the challenge is to find hosting for your app. Scalability is another issue once the application becomes viral. There is also the issue of ease of deployment of an app once you build it in one of the traditional development environments.

zembly provides an answer to many of the issues described above. Chris put togher a quick guide on how to deploy JavaFX web applications as zembly widgets. The next step would be to show how to produce a Facebook application (I'll leave that as an exercise to the reader ... until my next blog). Below I am reproducing Chris' blog with minor changes.

Web widgetizing a JavaFX application

* Using a JavaFX applet in a zembly widget. This approach allows zembly to provide the seamless hosting of the widget and development of a server side mashup (a data service in zembly), while JavaFX provides the rich graphics (JavaScript would be used to communicating with the JavaFX runtime). Embedded a JavaFX applet can be done for both HTML widgets as well as widgets used within application types such as Facebook. There are several steps to use JavaFx in a zembly widget (The wiki contains more information about using JavaFX from zembly) :

         1. Upload the jar file containing the JavaFX code as a widget resource.

         2. In the HTML editor, add a script tag to reference the JavaFX JavaScript runtime.

            <script src="http://dl.javafx.com/1.2/dtfx.js"></script>

         3. In the HTML editor, add another script tag to setup the JavaFX applet. The ${res(’Calculator.jar’)} substitution variable is obtained using the add to editor link from the widget resources panel. This variable ensure the URL link is resolved appropriately throughout the widget lifecycle.

            <script type="text/javascript">

              javafx(

                    {

                        archive: "${res('Calculator.jar')}",

                        width: 221,

                        height: 249,

                        code: "calculator.Main",

                        id: "appl"

                    }

                ;);

            </script>

Consuming zembly services in a Java of JavaFX application

* Consuming data services (see the growing list of public Web APIs) available from zembly in a JavaFX application (running outside zembly). The zembly platform provides an open source client library which allows secure invocation of data services outside zembly. The client library has language bindings for Java and JavaFX. The wiki contains details on invoking data services outside zembly.


Thursday Jun 25, 2009

There is no secret that the Java community would like talented developers around the world to contribute their expertise to the OpenJDK project. There are many ways to contribute and not all of them have to include writing code. Though, I suspect that most of the folks are interested in scratching their itch (read - fix an annoying bug or adding their favorite lang feature). In my case I want to introduce #ifdef in Java (I still miss that from my days programming in C).

With that in mind, I decided to try to become an OpenJDK contributor and see where the community will guide me, based on expertise and skill set.

My enthusiasm was spoiled upon reading the contribution process. Having to fax the SCA is rooted in the 20th century. I pulled the sources from the repository without much fuss and I was pleasantly surprised by how fast is Mercurial. The documentation advises you to find a sponsor. Read ahead, since it seems that a sponsor is needed just for the basic setup :-).

Building OpenJDK (on Windows) should a lot simpler. The instructions on the project website are generally clear, however I could not find easily any info how to build the sources. I googled the topic and found some instructions which made me cringe. I have some of the software requirements other than cygwin. The rest seems very archaic. 

Once I have more time, I'll get back to the build process and I hope to come up with some suggestions on how to improve the process. Perhaps that will be a form of contribution in itself!

Monday Jun 15, 2009

I have not been into the code in the last couple of month, however I recently needed to look at the performance of a JavaFX application written by a 3rd party. I am using a new Windows notebook and I had the JavaFX development environment (NetBeans 6.5.1 + JavaFX SDK) setup, however the project had the sources in an subversion repository and I did not have it installed. Now onto the interesting part. As I used NetBeans in trying to connect to the SVN repository, the IDE prompted me to facilitate the installation of SVN for Windows. Sweet! I was up and running in no time. I guess this is one of the core the value proposition of IDEs - easy of use, and NetBeans delivered. 

On a related note, I am using the VisualVM (look for jvisualvm in your JDK install path) tool that now ships with the JDK, to profile and troubleshoot the 3rd party app. Some of you may know that the VisualVM is based on the NetBeans platform and offers a plugable model for building serviceability tooling for the Java platform. I hope that John's team will shortly port the Thread Scheduling Visualizer as a VisualVM extension.

Friday May 29, 2009

Brian Goetz and the VM folks are doing it again - the 2009 JVM Language Summit. Come share your programming language expertise with industry experts and the JVM crew. There will be a number of traditional talks as well as time to interact with subject mater experts in informal settings.

Sept 16-18 (Sun campus in Santa Clara, CA)

Friday May 22, 2009

Java One is around the corner and many times developers and analysts ask us how we make money with Java. In Jonathan's blog you get a glimpse of how we leverage the ubiquity of Java on the Windows desktops to sell distributions services. There is also licensing and middleware/hardware enablement via world class performance of our VM. One of the less known programs that enables us to monetize Java in the enterprise is Java for Business. Lot's of details on the website, however if you don't have the time, here is the offering in a nutshell:
  • A subscription service offering that provides more control for customers that depend on our software while developing a compelling partnership/relationship between Sun's key customers and Sun's Java experts
  • A replacement and enhancement for Java Multi-Platform Support offering
  • A framework to offer a wide range of requested services and features to our customers
    • Porting, tuning, custom work, special builds, emergency fixes, long-term support, etc.
    • Desktop, asset management, etc.

Sunday May 17, 2009

Listening to Leo Laporte on the way to work today, I learned about Wolfram Alpha - computational knowledge engine. The concept is fascinating and I've been playing entering all kinds of nouns, expressions, verbs, etc. The results are amazing. It would be very interesting to see if the technologies that are being used to render the results evolve to include, JavaFX, Flash or the like.


 I'd also love to learn about the architecture of the (computational) service. I know that they are using MySQL as their database, however I have no data on their data center. It will be interesting to see if this research influences the future direction of Google.

Monday May 04, 2009

If you are an IRC user and looking to get "idle", get tips, news, etc about JavaFX, please join the following unofficial channel: irc://irc.freenode.net/##javafx

If you are not using chatzill, please join the ## javafx channel on freenode. See you there. 

Sunday May 03, 2009

Fri night I helped a friend buy a new notebook, at the Apple store in the Hillsdale Mall. It turned out to the best buying experience ever. The guy who helped us - Chris, was awesome. Professional, courteous, knowledgeable, friendly, helpful, he presented options, provided clarifications, mentioned discounts, offered to tutor (my friend is a Mac newbie) while we were waiting for the memory upgrade. In a nutshell, if I would have my own business right now, I'd go back to the Apple store and offer Chris a job.

My friend ended up buying exactly what we came for: 13" MacBook, 24 GHz, 4 GB RAM, MobileMe subscription, a couple of other accessories.

Tuesday Apr 28, 2009

Apple just released a developer preview of Java based on Java 6 u13. Drag to install is only possible in conjunction with Safari 4 beta and appropriate setting in the Java Preferences console. You'll need ADC membership for the VM bit. Safari is publicly available. 

[Read More]

Friday Apr 24, 2009

Craig Gering's team recently released the Java ME SDK 3.0. The bundle includes the Java Wireless Toolkit 2.5.2 and JavaToolkit 1.0 for CDC. The tooling is predictable (in a good way): emulator (Windows only for now) and utilities for rapid application development using CLDC/MIDP, CDC and BD-J. In addition you also get LWUIT support. This is cool, especially since I've seen very rich UI on HTC phones at the MWC in Barcelona earlier this year.

The SDK will be complemented later on this summer by the release of Java FX 1.2. The team is shooting for Java One in June. I am looking forward to seeing on devices on the show floor.

Monday Apr 20, 2009

Change is inevitable. The question is not how to cope with change, but how to embrace it, anticipate the next move and opportunity. Folks working in the computer industry are likely ahead of the curve, since changes in the technology are constant.

Thursday Apr 16, 2009

The Java One 2009 Conference will give full access (general and technical sessions, hands-on-labs, etc.) to all students that can make the trip. This new program provides students a huge opportunity to learn, network and interact with industry experts.

Friday Apr 03, 2009

I had a great time at the Ricoh & Java Developer challenge in London. I represented Sun, one of the sponsors of the this University event, and judged the submissions by the five finalists of the contest.

Being the judge was quite an interesting experience. I was truly inspired by the innovation and dedication of the students from Norway, Spain, Germany, France and Hungary that presented projects at the competition. Submissions ranged from Optical Mark Readers, to Context aware Multi Function Printers (MFP) software. Judging had to take into account both technical and business point of views. Hungary (Zoltan Szabo & Balazs Lajer from University of Pannonia) won, by a hair ahead of Germany. Congratulations to all the students and professors involved.

Thursday Apr 02, 2009

In the last few weeks I flew United to London a couple of times and on both flights the dinner rolls that were served with the food seemed to date the build year of the Boeing 777-200 (ca. 1995-1998). If for some reasons UAL can't serve fresh bread, I suggest they stop (hey, who needs the extra carbs anyway!). I would not mind paying for the meal as long as value is provided.

The other option for United (if they still have a large stock of last century bread) is to donate the rolls to the Pentagon. I am sure it can be used for target practice as ammunition for cluster bombs.

Monday Mar 30, 2009

I was looking to download Ubuntu so I can install it under Virtual Box on my fairly new MacBook Pro. I went through a few mirrors and found one that gave me flaming speed - ftp-mirror.internap.com

Download URL: http://ftp-mirror.internap.com/pub/ubuntu-releases/intrepid/ubuntu-8.10-desktop-i386.iso

Wednesday Mar 25, 2009

Mark Reinhold just published a blog which details the list of features that are currently planned for JDK 7, by the OpenJDK community. The idea is to give a  preview at Java One in June and release in the spring of CY10.

We are hoping for comments and feedback, via the openJDK mailing list. Dalibor is also working out the schedule for the next OpenJDK call, which will be open to all the folks in the community.

Friday Mar 20, 2009

The JavaFX team is ready to deploy the JavaFX developer challenge. Students and developers should already familiar with the concept. Companies such as Google, Adobe and Microsoft have implemented similar contests to get developers to adopt new technologies.

Here are some tips on how to improve your odds of winning:

  • Use NetBeans 6.5 - it will make you more productive
  • Deploy your application on the web, rather than just submitting the sources - JavaFX is all about build rich user interfaces, and the web is the best way to showcase your work
  • Embed you application in a widget that can become viral within social networks. For instance you could use zembly to build and deploy a Facebook application
  • Don't mix and match in your user interface. JavaFX Script provides a different programming model than Java and while you could call Java (e.g. Swing) from the UI, it will likely not look good. The team is building a new set JavaFX UI controls, however this library is not available yet.

 

Thursday Mar 12, 2009

Ken Russell, the architect and author of the new Java Browser plugin has recently completed the work on the JavaFX to JavaScript bridge. In a nusshell, JavaFX web applications could call JavaScript functions & objects in the webpage that embeds the JavaFX app and vice versa. Nota bene: this bridge calls for the plugin to use Java SE 6 update 10 or later.

JavaScript to JavaFX Script

JavaFX Script can be accessed using the synthetic script field which is exposed from JavaFX Script applets to the JavaScript engine.

function someJavaScriptCall() {

var myApp = document.getElementById("myApplet";);

myApp.script.someJavaFXScriptCall();

}

The snippet above, assumes that the Java web application (Applet) embedded in the web page is instantiated with myApplet as id.

JavaScript to JavaFX Script

JavaFX Script can interact with JavaScript on the web page, in a similar way to how Java code can interact with JavaScript. This lets you call JavaScript functions defined on the web page, modify the Document Object Model (DOM) of the web page on the fly, and generally write JavaFX Script apps that integrate well within the web page.

AppletStageExtension.eval("yourJavaScriptCall()";);

Wednesday Feb 11, 2009

The Eran Davidov show is now coming to a mobile device near you. In other words, the JavaFX team at Sun has delivered JavaFX Mobile. The JavaFX platform enables the development and deployment of rich and expressive content and services to end-users across desktop, mobile, browser and TV (due later on this year). This release follows the December '08 shipment of JavaFX 1.0 for desktop.

[Read More]

As the team is getting ready to release JavaFX 1.0 Mobile, I was experimenting with layout considerations of deploying of JavaFX applications to mobile devices.

Below are a couple of considerations for developers who will build applications for devices that have typical screen size of 320x240 pixels. The example below (inspired by Josh), draws a centered circle and uses for its radius a % of the width of the device screen size.

The other interesting point that the example illustrates is how to convert a String type into an Number. Java developers will recall using something parseInt to achieve this task (i.e. int foo = Integer.parseInt("7";);). Similarly, in JavaFX you could use this technique as follows:

var myNumber:Number = Integer.parseInt("7");

Serious developers may want to read this blog by Amy Fowler that provides a lot more details on layout management in JavaFX Script.

In general, one has to cautious about calling Java libraries and should stick to the "common" JavaFX APIs. Keep in mind that javafx.ext.swing, javafx.scene.effects packages are out of bounds for mobile developers. Also the mobile emulator (bundled with NetBeans and the SDK) is not yet available for the Mac.

Thursday Feb 05, 2009

 Java SE 6 update 12 shipped earlier this week and it is now available for download here. Key improvements include:

  • Windows 2008 Server Support : Java 6 Update 12 now support Windows 2008.
  • Java Plug-in now supports 64-bit browsers (4802695)

Sunday Feb 01, 2009

The New York Giants have proved me wrong last year. This year I'll try again to predict the outcome of the Super Bowl: Arizona 31 - Pittsburg 30.

Saturday Jan 31, 2009

 

Most of the developers that want to learn about Sun's new RIA platform - JavaFX, install the bundle that includes SDK, the NetBeans development environment (which includes a JavaFX Script plugin). On the other hand if you are already a developer that uses NetBeans and have adopted the recently release version 6.5 you have a simple way to add install the JavaFX plugin.

Just use the top level menu of the IDE: Tools | Plugin, tab to "Available Plugins" and look for the JavaFX category, select all entries, install and restart NetBeans.

Nota Bene: One of the advantages of using NetBeans to get started with JavaFX is the availability of samples. Open and File | New Project | Samples | JavaFX and you'll note about 40 samples which range from a series of simple building blocks that show you how to work with shapes, transformation, etc. to more advanced examples that illustrate how to invoke web services, or build a media player.

Wednesday Jan 28, 2009

Most of the developers that started programming in the 20th century, before IDEs were broadly used, are familiar with debugging using println statements. While I highly recommend that one uses NetBeans or Eclipse to develop JavaFX RIA applications, I believe certain people will still want to employ old techniques to debug their code.

Here is an example on how to use println in a JavaFX application to print environment variables.

There are a couple of tricks that you may have to be aware of. 

  • You can't use println while you initialize your code (between lines 18 & 34)
  • println will send the output to the console
  • If you want to print onto your UI artifact, you could employ the javafx.scene.text.Text  object
  • Printing environment variables may yield different results depending on your configuration. For instance, using the default - desktop app configuration will give you a different result than when you deploy the app to a mobile emulator

Here is an example of a JavaFX web application, deployed as a clearspring widget.[Read More]

This blog copyright 2009 by octav