Launching Previously Run Webstart Apps Via The Java Control Panel

I’m a huge fan of Java WebStart.

Most people generally launch WebStart based apps by simply hitting a URL which pulls down a JNLP file. A JNLP file is simply an XML descriptor which describes the jars that make up the application, the main class, etc. Once the JNLP file is pulled in, Java takes over and will retrieve the specified jars and then launch the Java application.

To re-launch the app in the future, you can simply bookmark the original JNLP URL in your browser (note to MotioPI users – you can simply bookmark the original URL sent via email and do this with MotioPI).

But suppose you’re in disconnected mode (perhaps waiting in the airport, or on a plane). You can still launch previously executed WebStart based applications by using the Java Control Panel.

If you’re using Windows XP, you can get to this via Start | Control Panel, then double click on the “Java” icon.


Step 1 - Launch Java Control Panel

This will launch the Java Control Panel. From there, select the “View” button (bottom right).


Step 2 - Select the View Button

This will open the Java Cache Viewer. You should have an entry for each WebStart app that you’ve previously run (screenshot below):


Step 3 - Java Cache Viewer

From here, you can right click on any of the cached WebStart apps and do things such as :

  • Run the application
  • Create a shortcut on your desktop to launch the app (so it behaves like a typical client side app)
  • Show the JNLP File
  • Delete the App
Advertisements

An Easy Way to Test against Multiple Versions of IE…

Most web developers have felt the pain of having to test their webapp in N different browsers (and having to work around the quirks in each).

I just spent the better part of the afternoon testing some fluid resize logic in IE7, Chrome and Firefox. I got everything working between those three, but I knew IE6 was probably going to bite me. I only have IE7 installed locally, so I was kind of resigned to testing it later, from a separate machine.

Then a friend pointed me at the following utility which will let you run multiple prior versions of IE, side by side with your existing IE7. Its a breeze to install and works great. You can actually have IE6 and IE7 up at the same time (sweet!).

A 1 minute overview of JSON

JSON is (for the most part) perfectly legal JavaScript syntax, that has been around for quite a while. Think of it as shortcut literal syntax for quickly building a JavaScript object graph.

  • Every Object in JavaScript is an associative array (think Map in Java, a set of key -> value pairs).
  • In JavaScript, the curly braces {} are shorthand for “new Object()”
  • In JavaScript, the square brackets [] are shorthand for “new Array()”

So the following two snippets will build the exact same JS Object graph :

      // In JSON syntax 
      var contact = {
         'name': {
            'first': 'Lance',
            'last': 'Hankins'
         },
         'phone': {
            'mobile': '214.555.5555',
            'work': '972.555.5555'
         },
         'email':  {
            'work':'lhankins@work.com',
            'personal':'lhankins.hankins@home.com'
         }
      };

A non-JSON equivalent :

      // The more traditional NON-JSON way to do the same thing :
      var contact2 = new Object();

      contact2.name = new Object();
      contact2.name.first = 'Lance';
      contact2.name.last = 'Hankins';

      contact2.phone = new Object();
      contact2.phone.mobile = '214.555.5555';
      contact2.phone.work = '972.555.5555';

      contact2.email = new Object();
      contact2.email.work = 'lhankins@work.com';
      contact2.email.personal = 'lance.hankins@home.com';

Since JSON is so good at letting you concisely describe an object graph (hierarchical data), its often a great choice as the output format for server side responses to AJAX calls. On the client side, you can simply “eval” the response text to create the resultant JS object graph.

Here’s another link which also describes JSON in a concise form – and has a funny picture 🙂 Also, this post describes some of the exception cases where JSON is not actually legal JS (JS is a little more restrictive on the allowed characters for property names).

A way to get true Symbolic Links on Windows…

Its always really annoyed me that Windows “shortcuts” to folders don’t truly behave like Unix / Linux symbolic links. I’ve been especially annoyed by this recently, since I’ve been forced to use Outlook Web Access for one of my clients, and when you try to attach a file to an email message in OWA, if you try to navigate through a shortcut to a folder, rather than actually navigate to the target folder it will “attach” the shortcut to the message. Sigh…

I just realized that the sysinternals suite has a utility called Junction which will let you create a true symbolic link to a directory on Windows. Sweet!

I have always been very fond of the sysinternals tools… Process Explorer and Tcpview are probably the ones I’ve gotten the most mileage out of. Many thanks to Mark Russinovich for this excellent suite of utilities.

IPhone Software Update Hangs after installing AT&T Wireless Card…? This reghack may fix it…

I tried to sync my iPhone this morning (heading out of town later today). ITunes asked me if it could apply a software update, and I mistakenly said yes… About half way through it just hung, and ended up totally hosing my iPhone.

When it hangs like this during a software update, the iPhone will go back into “factory restore mode” (basically it looks like it did when you first purchased it, it will do nothing save for tell you to plug it into ITunes). When you plug it back into ITunes, it will ask you if you want to restore it to its initial state (which you must do before you can then restore a backup).

Regardless of how many times I tried (I wasted hours), during the restore, the process would hang on the “verifying iPhone software” task (eventually the iPhone would restart and the cycle would start again).

After much googling (and cursing), it turns out this was due to a registry setting that was added by the software for my new AT&T wireless card (I did the free upgrade to AT&T’s latest wireless card a few weeks back, and this came with new software).

Apparently AT&T’s software sets a TCP registry setting (on XP) which causes this problem.

Many thanks to jgkurz for his post on the following thread in the apple support forums.

Here’s a copy-paste of the post :

I had the “Verifying iPhone Software” issue on both the 2.2 and 2.2.1 upgrade. I just got off the phone with Apple support and they had me delete the WinXP registry key “TcpWindowSize” located here:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Apparently this setting was added by my AT&T Aircard and is known to cause the “Verifying iPhone Software” issue. I had to do a restore on my same PC and not a second iTunes but all seems to work properly now.

I hope this helps.

I removed the offending registry entry, rebooted, and the problem went away. Here’s a screenshot of the offending registry key :


screenshot of registry entry

Oracle: Difference between two Timestamps, in seconds…

In oracle, if you subtract two timestamps, the result is of type “interval”. Its somewhat cumbersome to get the total number of seconds this interval represents. Here’s an Oracle function which will yield the total number of seconds between two timestamps :

CREATE OR REPLACE function timestamp_diff_in_seconds (ts1 in timestamp, ts2 in timestamp)
       return number is total_secs number;
       diff interval day(9) to second(6);
   begin
   diff := ts2 - ts1;
   total_secs := abs(extract(second from diff) + extract(minute from diff)*60 + extract(hour from diff)*60*60 + extract(day from diff)*24*60*60);

   return total_secs;
end timestamp_diff_in_seconds;

Using the above, we can get the toal time in seconds, between two timestamp parameters (effectively converts the “interval” difference of the two timestamps into to the total number of seconds)

XP Tip: “right-click on file and send-to cygwin tail”

During a typical “development” day, there are many times when I want to “start a tail” on some arbitrary log file. Wouldn’t it be nice if you could just right-click on a file in Windows Explorer and start a tail on it…? Here’s how.

First, we create a simple 1 line batch file called “startTailOn.cmd”. The batch file will expect a single parameter (the path to the file).

      start "tail on %1" c:\dev\cygwin\bin\tail.exe -n 1000 -f %1

This batch file simply starts a new command prompt with a title of “tail on “, and then executes the cygwin tail command on the specified file.

Now we just need to add a shortcut to our batch file to our Windows “send to” menu (shown when you right click on a item in Windows Explorer). To add a new action to your “send to”, you just need to add a shortcut to the action in the SendTo folder in your home directory (e.g. mine is at C:\Documents and Settings\lhankins\SendTo).

So in keeping with our earlier example, we’ll add a shortcut here to our “startTailOn.cmd” file (as depicted below).

add shortcut on sendto

Note – you can rename the default shortcut name of “Shortcut to startTailOn.cmd” to just “tail”.

That’s it. Now suppose we right click on d:\temp\boot.log and select our new “send to tail” action :

tail on log

The only shortcoming here is that the batch file we created will barf if the path to the in question has spaces in it (the part that fails is the ‘window title’ argument to the ‘start’ command). I generally keep a second batch file on my SendTo menu to handle these cases, e.g. “startTailOnPathWithSpaces.cmd”.

   start "tail" c:\dev\cygwin\bin\tail.exe -f %1