Feb 13 2008

JavaOne 2008 Sessions

I was reading over the descriptions for the currently scheduled sessions for JavaOne 2008. Here is a short list of the sessions that seem interesting to me in no particular order.

  • BOF-5110: Extending Groovys Swing User Interface in Builder to Build Richer Applications
  • BOF-5998: Meet the Java Posse
  • BOF-6229: Cutting-Edge Productivity with RIFE and Web Continuations
  • PAN-5435: The Script Bowl: A Rapid-Fire Comparison of Scripting Languages
  • TS-4806: JRuby on Rails: Web Development Evolved
  • TS-4868: From Java Technology to Ruby…and Back
  • TS-4895: The NetBeans IDE Compared to the Eclipse Rich Client Platform
  • TS-4982: Extending Swing: Creating Your Own Components
  • TS-4986: JavaScript Programming Language: The Language Everybody Loves to Hate
  • TS-5152: Overview of the JavaFX Script Programming Language
  • TS-5165: Programming with Functional Objects in Scala
  • TS-5416: JRuby: Why, What, How…Do it Now
  • TS-5572: Groovy, the Red Pill: Metaprogramming-How to Blow the Mind of Developers on the Java Platform
  • TS-5579: Closures Cookbook
  • TS-5764: Grails in Depth
  • TS-5793: Groovy and Grails: Changing the Landscape of Java Platform, Enterprise Edition (Java EE Platform) Patterns
  • TS-6096: Nimbus: The New Face of Swing
  • TS-6169: Spring Framework 2.5: New and Notable
  • TS-6457: Choosing Your Java Technology-Based Web Framework: A Comparison
  • TS-6490: JRuby on Rails Deployment: What They Didn’t Tell You
  • TS-6609: The JavaFX Script Programming Language for Swing Developers
  • TS-6611: Filthy-Rich Clients: Filthier, Richer, Clientier
  • TS-6656: Extreme Graphical User Interface Makeover: Rock Stars
  • TS-6929: Creating a Compelling User Experience

I have gone to JavaOne four out of the last five years and have compiled pretty complete conference notes for JavaOne 2007 and JavaOne 2006.

Technorati Tags: , , , , , , , , , , ,


Feb 11 2008

Reading Client-side Files with XPCOM

Recently I wrote a tutorial on how to use XPCOM in FireFox to access the user’s disk drive. With XPCOM you can access core browser functionality and with the right permissions can even read files and data off the user’s disk drive, access the network, and much more. In this code walk through we will look at how to read the contents of a file saved on the users desktop using JavaScript code from FireFox.

Before we get started we need to define XPCOM contract id and interface used to access files on the client-side. To access user files, you need to enable the correct privileges and for that you negotiate with the browser Privilege Manager.

// Id and interface for file reference
var fileContractId = "@mozilla.org/file/local;1";
var fileInterface = Components.interfaces.nsILocalFile;

// Id and interface for input stream
var inputContractId = "@mozilla.org/network/file-input-stream;1";
var inputInterface = Components.interfaces.nsIFileInputStream;

// Id and interface for scriptable input stream
var sinputContractId = "@mozilla.org/scriptableinputstream;1";
var sinputInterface = Components.interfaces.nsIScriptableInputStream;

// Request proper security privileges
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

The XPCOM interfaces we will be using here is the local file which acts as a reference to the file. The file input stream and scriptable input stream will be used to read in the file data.

As noted in the previous XPCOM tutorial, you use the contract id and interfaces get objects that implement them. The next snippet of code will define the path of the file whose data will be read and it will crate the correct file and input file objects to do so.

// Path to file
var readFilePath = "/Users/juixe/Desktop/temp.txt";

// Get file reference
var fileClass = Components.classes[fileContractId];
var file = fileClass.createInstance(fileInterface);
file.initWithPath(readFilePath);

// Get input stream
var inputClass = Components.classes[inputContractId];
var inputStream = inputClass.createInstance(inputInterface);
inputStream.init(file,0x01,null, null);

Notice that to initialize the file input stream I passed in a file reference to the file and a few other parameters. There is some XPCOM documentation on XUL Planet descring these parameters but it is probably best to find sample code to see its usage in the field as I had some difficulty making heads or tails out the documentation.

To get access at the data in the temp file use the scriptable input stream such as the following code.

// Need scriptable input stream to get content
var sinputClass = Components.classes[sinputContractId];
var sinputStream = sinputClass.createInstance(sinputInterface);
sinputStream.init(inputStream);

// Print file data
document.write("File Data: "+sinputStream.read(sinputStream.available()));

Notice that the scriptable input stream was initialized with the input stream created earlier. To read the date in the temp file use read in as many bytes as you would like.

Once done with the input streams you can just close them.

sinputStream.close();
inputStream.close();

Feb 5 2008

VMWare Fusion – Virtualization Software

After seeing a Google tech talk on VMWare Fusion, I thought I give it a try. VMWare Fusion is a virtualization software for the Mac OS X that allows you to run additional Operating Systems such as Windows XP or Ubuntu while running Mac OS X at the same time. Basically you can run an additional guest system inside a VMWare Fusion window from Mac OS X. This differs from Boot Camp in that you can run both systems at once, not pick which to run at boot time.

After installing, VMWare Fusion immideately found Windows from my Boot Camp partition. I also found a Ubuntu 7.10 VMWare image from Ubuntu itself although you can find images on VMWare’s Virtual Marketplace.

VMWare is a awesome technology that I foresee myself using as much as possible but it does have some bugs and shortcomings. I had to reactive windows after running it from VMWare Fusion, Windows complaint about having the hardware on the computer change significantly. I also experience an annoyance that the DVD player would start to play. I also found it annoying that you have to hit ctrl+alt to return to the host computer, I wish VMWare was as seamless as Windows’ Remote Desktop Connectivity. And worst of all, WMWare Fusion costs $79, while the Windows version, VMWare Player, is free!!!

Technorati Tags: , , , , , , , ,