JS Strict Data Types - Beta 1.1 Released

JS Strict Data Types Beta version 1.1 has just been released. The new release fixes various bugs that where found in the initial release. The biggest fix was one that caused the string and integer data types to not be kept correctly in certain situations.

Any code that you may have written using the library should work with no code changes. So, we recommend that anybody using the initial release start using this new release.

You can go to our Google Code page here.

You can download the new version here.

JavaScript Table Sorter


There may be times when you have a table that you want users to be able to sort. In some cases it will make sense to have the table sorted on the server side, however for smaller tables it may be useful to have a script sort it on the client. Well, over at the Leigeber Web Development Blog they have posted a nice small script that accomplishes just that.

below is an excerpt from the post.

This JavaScript table sorting script is easy to use, fast and lightweight at only 1.7KB. It includes alternate row formatting, header class toggling, auto data type recognition and selective column sorting. It will currently sort strings, numbers and currency. More features will follow.

You can read the full story here.

You can see a demo here.

You can download the source code here.

Creating a Virtual Keyboard


With devices like the iPhone and many of the new touch computer monitors we are using traditional keyboards less and less. Add this to the fact that when many people are on the go they use public computers with possible security threats like keyloggers. With these trends in computing you may look at putting a virtual keyboard in your web applications (where it makes sense). Well, over at Design Shack they have put together a nice example of this using jQuery (although you could take the same concept and use a different library).

Below is an excerpt from the post.

For those of us who travel often, we often end up accessing our emails and other confidential web accounts on public computers. In such circumstances, we are completely at the mercy of keyloggers and other malicious software that track our keystrokes and record our passwords.

Yet, very few websites provide their users with the option of using a virtual keyboard to key in (at the bare minimum) their passwords. Yes, a few banks do it, but considering how much personal information we store in various web applications these days, the safety of these accounts are of no less significance to us. This tutorial will explain how we can implement a simple virtual keyboard with some (well, okay, lots of!) help from jQuery.

You can read the full post here.

Google Introduces Powerful Visualizations for your server-side data


Google has announced the introduction of some powerful visualizations for your server-side data. They have publicly documented the Google Visualization API's open-wire protocol (you can go to the documentation here). The API has been greatly expanded from when it first launched and can now expose server-side data, such as SQL databases and even Excel spreadsheets, and display this data through visualizations from their growing directory.

Below is an excerpt from the post.

To make it even easier for developers to get started, we have documented an open-source Python library that enables any Python developer to quickly start using the API. What we find particularly cool about this library is that it also runs on Google's AppEngine. You don't even need to be an owner of your own servers to expose your data: You can place it on AppEngine and use the Visualization API to expose your data in meaningful, insightful ways in dashboards and reports. Expect to see additional server-side tools for the Visualization API in the near future.

You can read the full post here.

Google Guice 2.0 in Beta


For those following dependency injection frameworks in Java, Google Guice has released its beta snapshot (stamped 2008-10-16) for Guice 2.0.

What's coming in Guice 2.0?

  • A tree-like structure for Injectors, i.e., an Injector can have children that inherit all of its bindings.
  • An introspection API: like reflection but for Guice bindings.
  • The ability to inject members of sets and maps using Multibinder and MapBinder respectively.
  • Private modules.
  • Pluggable type converters that convert constant string bindings to other types, i.e., Dates, URLs, etc.
  • And more...

The official word is now that Guice 2.0 will be released in Fall 2008. (The Id Software release schedule: it'll be done when it's done!)

JavaScript Support in Java 6 Update 10


The minor release with major features, Java 6 Update 10 brought a host of improvements to the long-neglected Java applet. One of these improvements was better interoperability with JavaScript, which was delivered to the new Java plug-in in the form of LiveConnect technology. As Sun's entrant into the RIA race, JavaFX, comes closer to a 1.0 release, such interoperability is crucial to the success of this effort.

While it has always been possible (to a certain extent) to call between an applet and JavaScript running the same browser, LiveConnect vastly improves the technology by

  • Improving reliability. A number of bugs involving the stability of the browser when making JavaScript<-->Java calls have been fixed.
  • Improving performance. Dramatically better performance...always a good thing.
  • Making it more consistent across different browsers. Support for JavaScript interoperability was always a little better on Mozilla browsers, but now the functionality is more consistent across different browsers with the new plug-in.
  • Increasing the functionality. It's now possible to instantiate new Java objects from JavaScript, call methods on them, as well as reference third-party packages on all browsers.

Calling Java from JavaScript

The following code shows how to invoke methods on an applet through JavaScript:


package org.example;

public class MyApplet extends Applet {
     public String getMessage() {
          return "Hello World!";


<applet id="myApp" archive="helloworld.jar" code="org.example.MyApplet"/>

<script type="text/javascript">
     var msg = myApp.getMessage();

Public fields in the Java class can also be called from JavaScript, as well as static fields and methods. Due to a new synthetic keyword, Packages, that is now attached to every applet, it is now possible to instantiate/call methods on classes that are not applets. For example, if we add a new class in the org.example package,

package org.example;

public class MyNonApplet {
     public String getOtherMessage() {
          return "This is NOT a hello world!";

we can now create an instance of this class from the JavaScript and do things with it. Using the example above, let's modify the script a little:

<script type="text/javascript">
     var other = new myApp.Packages.org.example.MyNonApplet();

This opens up the intriguing possibility of accessing a rich set of Java APIs from client-side JavaScript. Take, for example, the ability to add SVG support in (ahem) the only major browser that does not support it*. With Apache Batik and the Java plug-in, full support of SVG in the browser--SVG JavaScript API and all--becomes a reality. (Batik 1.7, by the way, is one of the most compliant implementations of SVG. And SVG might just be a faster way into the web designer's heart than JavaFX, but I digress...)

Each time a call into an applet is made from JavaScript, it is handled by a worker thread that is associated with the applet (there is only one per applet).

Calling JavaScript from Java

All instances of JavaScript objects within Java code appear as instances of netscape.javascript.JSObject. There are essentially two ways of invoking JavaScript from Java:

  1. Calling the static JSObject.getWindow(Applet arg) method with the applet object passed in as an argument. This method returns a JSObject that represents the DOM Window. This JSObject can in turn be used to call() JavaScript functions or eval() JavaScript code. The API for JSObject is here.
  2. Add a method in your Java code that takes JSObject as a formal parameter. Communication can then be bootstrapped from the JavaScript side by calling this Java method and passing a JavaScript object as an argument. It's a little less convenient than option 1, but useful if some JavaScript code wants to delegate some work to the Java code.

Furthermore, you can actually modify the HTML DOM from the Java side using a common DOM API. For the purposes of compiling Java code written with references to JSObject, you would place the jre/lib/plugin.jar on your classpath. Note also that, since JavaScript is a single-threaded language, communication from Java to JavaScript is restricted to one thread at a time; so you should structure your code accordingly.

Other JVM Languages

Of course, the other interesting possibility is the idea of languages like Scala, JRuby, Groovy, Clojure, or Fan being able to run in the browser with support for JavaScript interaction. A truly sick mind (and you know who you are) might use the applet merely as a trojan horse in order to get his/her favorite language running in the browser. I'll leave it at that!

Sun's renewed interest in the applet--sparked in part by RIA and in no small way by the resurgence of alternative browsers--has opened a door many thought closed a long time ago. Interesting times, indeed.

* Even worse now that the Adobe SVG plug-in has been discontinued.

Book Review: ZK Developer's Guide

Title: ZK Developer's Guide
Publisher: Packt Publishing
Authors: Markus Stauble and Hans-Jurgen Schumacher
Publish Date: March, 2008

Some Background

The ZK framework, created by Tom Yeh, started out life as a project on Sourceforge, where it quickly became a popular open-source project (nominated for the 2006 Sourceforge.net Community Choice Award). It has since moved to its own site (but continues to distribute files through Sourceforge), where it vies for share with other AJAX frameworks in the RIA market. The project is officially sponsored by the Potix Corporation, which provides consulting services for ZK. It is distributed under both GNU and commercial licenses.

ZK is a thin-client Java- and XML-based component framework which uses JavaScript underneath the covers to communicate between the (browser-based) client and server.

  • ZK uses its own extension of Mozilla's XUL library, ZUML, to describe the page components, which are then rendered into the appropriate HTML and JavaScript by the ZK engine. ZK can also use XHTML-based components.
  • Scripting is handled using Java and EL expressions.
  • Communication between the client and server is based on an event model: user interaction is propagated (via AJAX) back to the server, which may modify the client DOM in response to the event, passing back those modifications (via AJAX) to the framework's client-side JavaScript, which handles them. The server keeps its own hierarchy of ZK components which correspond to the browser's DOM.

There is a resemblance here to other "JavaScript-less" AJAX frameworks, notably GWT and the JSF-based ICEFaces.

The Book

Like many of Packt's books, the format is focused on being lightweight and easy to read. There are 7 chapters and 159 pages, but the pages are small and have plenty of whitespace (presumably for adding notes). Add to that an abundance of illustrations and screenshots, and you get the idea: it can easily be consumed in a day or two.

The emphasis of the book is on learning the framwork, not really serving as a reference (the authors refer you to the online documentation for that), so the book generally assumes the form of a "walk-through" of the framework with an emphasis on the "Online Media Library" example application (chapters 2-4). A general breakdown of the book is as follows:

  • Chapter 1, Getting Started With ZK, is an introduction to the framework with a definition of terms, description of underlying technologies, the obligatory "Hello World" in ZK, as well as an in-depth treatment of how the framework functions (events, phases, component creation).
  • Chapter 2, Online Media Library, is a quick overview of the example application, how to set up the project in Eclipse (as a Maven project), and develop the basic application pages using ZUML. It does not discuss ZK-Bench (the subject of Ch. 7) presumably to focus on the technology itself, rather than the tools.
  • Chapter 3, Extending the Online Media Library, goes more into the full capability of the framework, turning the example application into a full MVC (Model-View-Controller)-based application and introducing "Live Data" (AJAX) in order to make the application more desktop-like.
  • Chapter 4, Is It on the Desktop or the Web?, continues where Ch. 3 left off, adding Drag-and-Drop capability to the application, embedding the rich text editor FCKEditor into ZK, and covering internationalization.
  • Chapter 5, Integration with Other Frameworks, covers integrating the ZK framework with other popular frameworks and technologies, including Spring, Hibernate, Jasper Reports, mobile phones (ZK mobile), and even JSF (ZK's JSF components).
  • Chapter 6, Creating Custom Components, shows you how to create custom ZK components for your application.
  • Chapter 7, Development Tools for the ZK Framework, covers how to install and use the Eclipse-based ZK-Bench development environment.

The Good

ZK Developer's Guide strikes a good balance between approachability and depth, and as such is a good introduction to the framework for developers not wishing to be overwhelmed by details. It is a simple and quick read with an emphasis on practical development that will be especially useful to developers without any previous RIA or AJAX development experience. The provided Online Media Library example is simple enough for illustrative purposes with enough functionality to demonstrate the framework's functionality.

The Bad

On the downside, the book lacks coverage of many of the built-in widgets that come with the ZK framework (audio controls, slider, progress meter, charts, etc.); granted, its stated intention is not to serve as a reference, but it seems a strange omission for a book about an AJAX framework. Much of the discussion around integrating with other frameworks in Ch. 5 also seems a bit thin (outside of Spring).


ZK Developer's Guide is a good book for those wishing to get up and running with the ZK framework quickly. Though it does not include much detail on the framework's built-in widgets, this can easily be supplemented by ZK's own online documentation.

Sun Releases Java 6 Update 10


Sun Microsystems has released Java 6 Update 10, the so-called "consumer JRE" because of its ability to be deployed in a lighter-weight footprint (the "Java Kernel" or the core JRE classes) and download other classes on the fly as needed. The move is considered a necessary precursor to Sun's push into the RIA (Rich Internet Applications) space, where the accumulated bulk of the JRE is considered a drawback to faster, easier end-user distribution. Many of the improvements in Java 6u10 also pave the way for the future release of JavaFX technologies.

The New Java Plug-In

The Java Kernel is the key to the "Next Generation Java Plug-In Technology" for web browsers, which makes its debut in Java 6 Update 10. The most significant improvement in the new Java plug-in is the ability to launch applets from Java Network Launch Protocol (JNLP) files. This allows Java applets to reuse some of the extensions which had been previously available only for JNLP/Java Web Start technology, including access to JavaFX runtime libraries, support for 3D graphics via OpenGL, persistent data storage, and local filesystem storage. Other improvements in the Next-Gen Plug-In include better Java to JavaScript interoperability, a unified deployment mechanism for JNLP and applets, multiple JRE version support, classloader caching, new parameter arguments to <applet>,<object>, and <embed> tags, as well as numerous small improvements to the reliability and usability of applets. A full list of the new features is here.

Java Quick Starter

Also new to Update 10 is the Java Quick Start service, which preloads portions of the JRE onto the system disk cache, substantially decreasing the startup time. It is turned on by default in Windows 2000 and XP systems, but turned off in Vista since Vista offers its own preloading mechanisms.

Nimbus Look and Feel

Update 10 also comes with a new Swing look and feel, Nimbus. Nimbus gives a much needed face-lift to some of the stock L&F's available in the base platform with a richer, more attractive set of widgets.

Other Items of Note

Patch in Place. Update 10 brings the ability to do a patch in place when updating the JRE/JDK, allowing the simple upgrading of your installation.

Direct3D Support. On Windows platforms, the Direct3D pipeline has been completely revamped, offering much-improved rendering of Swing or Java2D applications which rely on alpha compositing, gradients, arbitrary transformations, filtering and other more advanced 2D operations. This upgrade relies on hardware acceleration (video cards) as well as the DirectX 9c runtime.

A complete set of notes on the changes in Java 6 Update 10 is available here.

JS Strict Data Types - Released

We at Ajaxonomy are happy to announce the release of the first library in the Ajaxonomy Developer's Toolkit. The library is called JS Strict Data Types and attempts to provide a way to maintain strict data types in JavaScript. Strict data types are proposed in the next version of JavaScript, however it is hard to say when you will actually be able to use it in all browsers. So, JS Strict Data Types is an attempt to allow the use of strict data types now.

The library is very easy to use. Simply include the small 7K (uncompressed) js file in your web page or application and then you can start defining variable data types strictly through the methods used in the below example.

MyVar1 = new Int(12); //Creates an Integer variable MyVar2 = new Float(2.54); //Creates a Float variable MyVar3 = new String("Some Text"); //Creates a Sting variable MyVar4 = new Boolean(true); //Creates a Boolean variable

The library uses various methods to maintain the strict data type (if you choose not to use the methods in the library strict data types may not continue to be maintained). The below shows a few of the mathematical methods that are available in the library.

MyVar1.add(5); MyVar1.sub(2); MyVar1.mult(10); MyVar1.div(7);

Since there are quite a few methods that are used to guarantee that strict data types it is recommended that you read the documentation before using the library.

This beta 1.0 release of the library is released under the GNU Lesser GPL. So, it can be used for personal and commercial use. Because of this go ahead and use the library in other libraries or any JavaScript project.

You can see a demo page that uses the library and displays the results here.

You can download the library here.

You can go to the projects Google Code page here.

You can read the projects documentation here.

Browser Wars II: The Rebels Strike Back


In the heady days of the mid-1990's, a company called Netscape Communications Inc. rode the wave of the emerging Internet excitement to technology stardom. With its flagship product, Netscape Navigator, controlling over 90% of the web browser market and a stock price that reflected that, the company seemed destined for greatness...but, alas, dreams can disappear quickly in the tech industry, and Netscape's dream was a particularly brutal example. Microsoft, sensing an opportunity in the emerging Internet as well as a potential threat to its mainstay desktop business, launched itself into the browser market in late 1995 with the release of Internet Explorer 1.0 (for Windows 95), based on code licensed from Mosaic. The first browser war had started in earnest.

Syndicate content