Web Info & Tutorials

April 11th, 2008

DROMAEO: JAVASCRIPT ENGINE TESTING

Dromaeo

John Resig has put out Dromaeo maybe a touch before he wanted to due to people finding it :) The site hosts a subset of the WebKit Sun Spider JavaScript engine tests right now, with the desire to push on and do a lot more.

You can run tests and then compare your own results. What is particularly cool about all of this, is how we can harvest performance data. If enough people start running this bad boy from different parts of the world, and different devices (especially mobile devices) we will get a nice picture of performance of JavaScript engines.

The Mozilla Wiki has more information which covers the methodology, changes the other browsers would like to see, how to download and run locally, and a lot more.

Cool stuff. I hope to see this expand beyond JavaScript too and get even more “real world”.

April 11th, 2008

JAVA PLUGIN: THE KERNEL IS BACK

Ethan Nicholas of Sun has posted an article on Java 6 update 10 which just came out in beta to play.

For Java folk there are some huge wins, and for the first time in ages the Java applet has huge changes. If Java Applets can get past the sniggering baggage, there is actually interesting things to see there.

What was the pain again?

Once a Java program is up and running, it's generally smooth sailing.
Modern Java Runtime Environments (JREs) are stable, reliable, and fast.

Unfortunately, getting to the "up and running" part has historically been
more difficult than it should be. Challenges have included:

  • Difficult to detect JREs, especially from a web browser
  • Difficult to automatically install new JREs
  • Large download size
  • Poor cold start performance
  • Little overlap between applets and Web Start programs

Java 6u10 was created as a response to these challenges. By carefully
avoiding public API changes, we can get the fixes into your hands sooner --
no need to wait for Java 7!

And the solutions?

Java Kernel

Java Kernel is a new distribution aimed at getting Java software up and running faster. Instead of a full JRE, users download a small installer (the "kernel") which includes the most commonly needed JRE components. Additional components are downloaded as needed, and the JRE will download remaining components in the background and then reassemble itself.

In the current build, the typical download size for Swing programs and Java applets is on the order of 4-5MB, compared to 14.4MB for the full JRE.

Next-Generation Java Plug-In

Java 6u10 includes a brand-new implementation of the Java Plug-in, which is
used by default as long as you are using Firefox 3 or Internet Explorer. The
next-generation plug-in runs applets outside of the browser in one or more
separate processes. Applets still appear inside of the web browser window as
they always have, but this means that it is now possible to use different JRE
versions, command-line arguments, and configurations to run different applets.
The isolation provided by running the web browser and the JRE -- two very large,
very complex pieces of software -- in separate process spaces improves the
reliability of both, and gives applets the same flexibility and control over JRE
configurations that other Java software has always enjoyed.

Since applets now feature the same powerful JRE selection and configuration
that Java Web Start programs do, it was only natural to use the same mechanism
for both. The Java Plug-In now supports using Java
Network Launching Protocol
(JNLP) files to specify applet configuration and
startup options. With very little additional work, you can now deploy the same
program as both an applet and a Web Start program, and still take advantage of
JNLP services such as PersistanceService and

FileSaveService.

New Plug-In Advantages:

  • Improved reliability
  • Improved JavaScript communication
  • Per-applet control of JRE command-line arguments
  • Per-applet control of JRE memory settings, larger maximum heaps
  • JNLP support
  • Per-applet JRE version selection
  • Improved Vista support

Much more information about the new plug-in can be found in the release notes.

Java Deployment Toolkit

The Java Deployment Toolkit makes deploying Java applets or Java Web Start
programs a snap. The
Deployment
Toolkit JavaScript file
provides:

  • Accurate detection of installed JREs
  • Seamless JRE installation
  • Complete applet launching (JRE detection and, if necessary, upgrading)
    in a single line of code
  • Complete Web Start program launching in a single line of code

The following HTML code is all it takes to ensure that Java 1.6 is installed and
then a Java applet is launched:

JAVASCRIPT:
  1.  
  2. <script src="http://java.com/js/deployJava.js"></script>
  3.    
  4. <script>
  5.   deployJava.runApplet({codebase:"http://www.example.com/applets/",
  6.      archive:"ExampleApplet.jar", code:"Main.class",
  7.      width:"320", Height:"400"}, null, "1.6");
  8. </script>
  9.  

Also note, that with this version you can take a running Applet in the browser, pull it OUT of the page, close the browser, and see the applet still running (since it runs in a different process). This is very cool indeed.

Add to all of this the easy bridge between Java and JavaScript, and there are interesting opportunities.

April 11th, 2008

UPSIDE DOWN TEXT

Yup, check the calendar, it's Friday!

John Dyer has implemented the much asked for upside down text JavaScript that lets you code this:

HTML:
  1.  
  2. <script type="text/javascript" src="upsidedown.js"></script>
  3.  
  4. <div class="upsidedowntext">I can be read in any orientation</div>
  5. <div>I can be read in any orientation</div>
  6.  
  7. <div class="upsidedowntext">This is Tom Cruise taking your picture</div>
  8. <div>This is a boring Russian Mig</div>
  9.  

to see this:

Upside Down

If you look at the source you will see that the magic is in a flip table that does the unicode thing.

I love the rationalization:

There is a huge need for upside down text on the web. With everyone "going mobile," developers cannot simply rely on users having their screens oriented the same way all the time.

Nice joshing :)

April 11th, 2008

MOZILLA FENNEC: THE MOBILE BROWSER WARS

IE may be the dominant browser on the desktop, but the mobile wars are going strong. WebKit, Opera, and Pocket IE have a lot of users, but Mozilla has been a little weak in the past.

Now though, they have a new Fennec browser that takes the great performance gains in Firefox 3, and makes a mobile oriented version.

Sullivan explained that the Fennec project aims to bring the desktop Firefox user experience to handheld devices but will focus on meeting the unique requirements of mobile computing users. "Our goal on mobile is to embody the principles that have made Firefox so successful on the desktop, but with the recognition that mobile is different—not so much in that it presents some constraints, but in that it enables new types of experiences, and people's interaction with these devices are different than when they're sitting at their desks," he says. "Web compatibility, security, performance, support for rich internet apps will all be key."

I have been curious how it can scale down, just due to the XUL overhead, but it works great.

Much of the Firefox user interface is constructed with XUL, an XML-based user interface description language. This makes Firefox very easy to customize and extend. Mozilla hopes to leverage this advantage to encourage experimentation with new mobile user interface concepts. Developers can augment or reinvent the Fennec user interface by modifying the browser.xul file in the Fennec chrome directory and the associated browser.css file. Additional functionality can be implemented in JavaScript by modifying the browser.js file. Fennec will eventually support a complete extension system like Firefox 3 that developers will be able to use for modifying the browser's behavior and user interface.

"Another exciting thing is that we're providing full support for add-ons," Sullivan notes. "These will fall into three buckets: most add-ons will just work out of the box; some won't make much sense away from a PC; and a whole new class will be created that are going to be new for mobile."

There are other aspects of the Mozilla Mobile initiative that will appeal to developers as well. Mobile software development is hard, and Mozilla could potentially offer a novel approach to simplifying the process. The underlying XUL technology on which the Firefox interface is built can be used independently with a XULRunner runtime to create platform-neutral mobile applications with XML and JavaScript.