2009
11.23

Wave Extension Installer

Once you have built your wave extension, you will need a way to install it into the user interface of the Google Wave client. A Wave Extension Installer is just that beast. You will need to create an Extension Manifest, which is an XML file describing where to find your extension, where you want it installed in the client UI and other information you want displayed.

We started out with the Wave Extension Installer Guide, but this document has some problems with the robot extension installer sample. Maybe its out of date, I don’t know.

The part that is in error is that there is no action element defined within the menuHook element. This is easily fixed by wrapping the participant element by the createNewWave element.

<extension
   name="Tweety"
   description="Creates a new Twitter wave.">
  <menuHook location="newwavemenu" text="Creates a new Twitter wave."
     iconUrl="http://wave-skynet.appspot.com/public/extensions/tweety/icon.png">
    <createNewWave>
       <participant id="tweety-wave@appspot.com"></participant>
    </createNewWave>
  </menuHook>
</extension>

Once this was straightened out, we put together an extension manifest for our existing sample robot, Frakky.

<extension
   name="Frakky"
   description="Creates a new Frakky wave."
   thumbnailUrl="http://robot-1.appspot.com/images/icon.png"
   >
  <author name="BitsByThePound"/>
  <menuHook location="newwavemenu" text="Creates a new Frakky wave."
     iconUrl="http://robot-1.appspot.com/images/icon.png">
    <createNewWave>
       <participant id="robot-1@appspot.com"></participant>
    </createNewWave>
  </menuHook>
</extension>

Once you have your extension manifest set up for your extension, you need to make it Internet accessible. A reasonable place to put this is next to the index.html file for your robot, in the war directory. We named the file install.xml. Then whenever you upload your robot to Google App Engine, the extension manifest will be uploaded to http:/yourappname.appspot.com/install.xml. To be able to install this manifest in Google Wave Preview, you will need to install the Extension Installer. Yeah, its name is a little confusing but I am not sure that calling it Extension Installer Extension (which better describes its function) is any less confusing.

Once this is done, you can select the dropdown next to New Wave in the center panel and choose New Extension Installer. When you are asked for the Extension Manifest URL, be sure to specify the URL including the http:// portion or else you will end up receiving an error message that implies there is something wrong with the manifest instead of saying it just cannot find the manifest. This creates a wave with a puzzle piece from which you can install the manifest into the Google Wave client. Push the Install Extension button to hook it up.

Extension Almost Installed

Extension Almost Installed

You will notice that the attributes you specified in the extension element such as name, description and thumbnailURL are used to display the puzzle piece.

Now, if you check the muted wave, Extension Settings, your extension is listed at the bottom.

Installed Extension

Installed Extension

Since our manifest added a new item to the New Wave button, clicking the dropdown next to this gives us an entry that says “Creates a new Frakky wave.” Clicking this creates a new wave with our robot set as a participant.

2009
11.23

Note these instructions are for Ubuntu 9.10 (Karmic).

In prior versions of Ubuntu, I have had some problems getting the VGA and S-Video outputs on my Inspiron 1720 working, so today I tackled this problem. In Karmic, this process is quite straightforward. Once you connect your video cable to the laptop, whether it is S-Video to a television or VGA to a monitor, you can cycle through various video distribution modes using the Fn-F8 keys. This is marked as “CRT/LCD” on the F8 key. Here is the cycle that I found using S-Video output.

1. LCD on at full resolution ; TV off
2. LCD off ; TV on at 848×480
3. LCD on at full resolution ; TV on and to right of LCD, 848×480 ; desktop shared across both screens
4. LCD on, 1024×768 ; TV on, 1024×768 ; mirrored desktop

You can change the parameters of each of these cycles by running the Display Preferences applet (System->Preferences->Display). This applet has a spacial depiction of  both displays and you may drag a display to be in a specific location with respect to the other display. For example, if in 3 above, you wanted the TV to appear logically above the CRT, you would drag the TV rectangle (labeled “unknown” for me) above the rectangle labeled “Laptop 17″.

Mode 3 shares the desktop over the 2 screens so that you can move the mouse cursor from one screen to the other screen, effectively extending your desktop. If you use an image as your desktop background, you may get the background color showing around the edges of the image as the image is centered in the extended display resolution.

Mode 4 shows the same content on the laptop LCD panel as on the connected screen. Note that in this mode for a connected television, the video quality is less crisp than in mode 3 due to the scaling of the 1024×768 resolution to something the television can handle.

If you connect a VGA cable to a monitor, a similar cycle is used, but the VGA resolutions used will be different.

Out of curiosity, I connected both a VGA monitor and S-Video to the TV, but preference seems to be given to the VGA monitor such that the TV never gets a signal.

2009
11.23

Free Remote PC Control software

Extracted from a Slashdot article.

http://www.teamviewer.com/ [teamviewer.com]

https://secure.logmein.com/products/free/ [logmein.com]

http://www.copilot.com/ [copilot.com]

http://skype.com/ [skype.com]

http://www.uvnc.com/addons/singleclick.html [uvnc.com] (reverse VNC)

http://www.crossloop.com/ [crossloop.com]

http://www.mikogo.com/en/ [mikogo.com]

http://showmypc.com/ [showmypc.com]

https://www.ntrconnect.com/ [ntrconnect.com]

http://www.zolved.com/remote_control [zolved.com]

http://www.wippien.com/ [wippien.com] (VPN)

http://code.google.com/p/gitso/ [google.com] (reverse VNC)

2009
11.15

Foxit, a better PDF reader for Linux

Today I got fed up with the overall poor search performance and poor rendering of Evince on 64 bit Ubuntu and looked around for an alternative. I use Foxit on my Windows machine and am generally very happy with it, having only had problems with it with government security clearance documents. A quick search shows that there is indeed a Linux version of Foxit.

Note that Foxit is a 32 bit executable so if you are running a 64 bit version of Linux, you will need to install ia32-libs from your repository.

Since a new version is supposed to be available within a couple of months, we may as make the upgrade path easier. I chose to download it to a local directory and then after uncompressing, moving it to /usr/local/foxit1.1

> cd /tmp
> wget http://mirrors.foxitsoftware.com/pub/foxit/reader/desktop/linux/1.x/1.1/enu/FoxitReader-1.1.0.tar.bz2
> bunzip2 FoxitReader-1.1.0.tar.bz2
> tar xvf FoxitReader-1.1.0.tar
> sudo mv 1.1-release /usr/local/foxit1.1
> sudo ln -s /usr/local/foxit1.1 /usr/local/foxit

We now have a link to the directory at /usr/local/foxit which we can change to the 1.2 version when it becomes available.

Now lets add it into the Gnome menu. Click on System->Preferences->Main Menu. Select Accessories then click new Item. Fill in the form, pointing to FoxitReader.

Create Launcher for Foxit

Click OK and now Foxit shows up in your Accessories list.

Now, lets change the file associations for PDF files so that if you click on a PDF from the File Browser that it opens Foxit. From the File Browser, find a PDF file and then right click and select Properties and click the Open With tab.

Adding Foxit as a PDF Handler

Click on Add, then dropdown Use a custom command and browse to where FoxitReader lives. Click Close.

Add Foxit

This adds FoxitReader into the Open With list. Select FoxitReader and click Close.

Associate

Now you should be able to click on any PDF in the File Browser and Foxit will be launched with the contents of the document.

2009
11.11

Installing Wink on 64 bit Ubuntu

Wink is great tutorial building software for Linux and Windows. It used to be available in the Ubuntu repositories but is no longer included. Currently, the Linux variant of Wink is version 1.5 and the Windows variant is version 2.0. Even though they share the same build number, they are not the same.

Unfortunately, running the newer, Windows version under Wine is not an option that I can see because there isn’t a way to capture the input from native Linux windows.

Go to the download page and download the wink15.tar.gz tarball to a temporary directory. This makes cleanup easier, since it is actually a tarbomb, extracting to the current directory.

Unzip the tarball which creates an installer.sh script and an installdata tarball.

> tar xzvf wink15.tar.gz

Now, run the installer script.

> ./installer.sh
This installer only has x86 binaries. Sorry.

Oops. I am running a 64 bit version of Ubuntu and this is a 32 bit binary only. Lets check what is in the installdata.tar.gz tarbomb.

> rm installer.sh
> tar xzvf installdata.tar.gz

This creates an entire directory structure in place including the wink executable. Lets install some basic 32 bit libraries.

> sudo apt-get install ia32-libs

Now lets check whats missing.

> ldd wink
linux-gate.so.1 =>  (0xf779e000)
libgtk-x11-2.0.so.0 => /usr/lib32/libgtk-x11-2.0.so.0 (0xf73bc000)
libgdk-x11-2.0.so.0 => /usr/lib32/libgdk-x11-2.0.so.0 (0xf7327000)
libatk-1.0.so.0 => /usr/lib32/libatk-1.0.so.0 (0xf7309000)
libgdk_pixbuf-2.0.so.0 => /usr/lib32/libgdk_pixbuf-2.0.so.0 (0xf72ef000)
libpangoxft-1.0.so.0 => /usr/lib32/libpangoxft-1.0.so.0 (0xf72e6000)
libpangox-1.0.so.0 => /usr/lib32/libpangox-1.0.so.0 (0xf72d9000)
libpango-1.0.so.0 => /usr/lib32/libpango-1.0.so.0 (0xf7291000)
libgobject-2.0.so.0 => /usr/lib32/libgobject-2.0.so.0 (0xf7252000)
libgmodule-2.0.so.0 => /usr/lib32/libgmodule-2.0.so.0 (0xf724d000)
libdl.so.2 => /lib32/libdl.so.2 (0xf7249000)
libglib-2.0.so.0 => /lib32/libglib-2.0.so.0 (0xf7193000)
libgthread-2.0.so.0 => /usr/lib32/libgthread-2.0.so.0 (0xf718d000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf7174000)
libXi.so.6 => /usr/lib32/libXi.so.6 (0xf7168000)
libXext.so.6 => /usr/lib32/libXext.so.6 (0xf7158000)
libX11.so.6 => /usr/lib32/libX11.so.6 (0xf7029000)
libm.so.6 => /lib32/libm.so.6 (0xf7003000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0xf6f49000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf6f2b000)
libc.so.6 => /lib32/libc.so.6 (0xf6de6000)
libfreetype.so.6 => /usr/lib32/libfreetype.so.6 (0xf6d67000)
libpangoft2-1.0.so.0 => /usr/lib32/libpangoft2-1.0.so.0 (0xf6d3e000)
libexpat.so.0 => not found
libpangocairo-1.0.so.0 => /usr/lib32/libpangocairo-1.0.so.0 (0xf6d31000)
libXcomposite.so.1 => /usr/lib32/libXcomposite.so.1 (0xf6d2c000)
libXdamage.so.1 => /usr/lib32/libXdamage.so.1 (0xf6d29000)
libXfixes.so.3 => /usr/lib32/libXfixes.so.3 (0xf6d23000)
libcairo.so.2 => /usr/lib32/libcairo.so.2 (0xf6c9c000)
libgio-2.0.so.0 => /usr/lib32/libgio-2.0.so.0 (0xf6c06000)
libfontconfig.so.1 => /usr/lib32/libfontconfig.so.1 (0xf6bd8000)
libXrender.so.1 => /usr/lib32/libXrender.so.1 (0xf6bce000)
libXinerama.so.1 => /usr/lib32/libXinerama.so.1 (0xf6bcb000)
libXrandr.so.2 => /usr/lib32/libXrandr.so.2 (0xf6bc2000)
libXcursor.so.1 => /usr/lib32/libXcursor.so.1 (0xf6bb7000)
libXft.so.2 => /usr/lib32/libXft.so.2 (0xf6ba2000)
libz.so.1 => /usr/lib32/libz.so.1 (0xf6b8c000)
libpcre.so.3 => /lib32/libpcre.so.3 (0xf6b5b000)
/lib/ld-linux.so.2 (0xf779f000)
librt.so.1 => /lib32/librt.so.1 (0xf6b52000)
libXau.so.6 => /usr/lib32/libXau.so.6 (0xf6b4e000)
libxcb.so.1 => /usr/lib32/libxcb.so.1 (0xf6b2f000)
libpixman-1.so.0 => /usr/lib32/libpixman-1.so.0 (0xf6ae8000)
libdirectfb-1.2.so.0 => /usr/lib32/libdirectfb-1.2.so.0 (0xf6a6e000)
libfusion-1.2.so.0 => /usr/lib32/libfusion-1.2.so.0 (0xf6a64000)
libdirect-1.2.so.0 => /usr/lib32/libdirect-1.2.so.0 (0xf6a4c000)
libpng12.so.0 => /usr/lib32/libpng12.so.0 (0xf6a23000)
libxcb-render-util.so.0 => /usr/lib32/libxcb-render-util.so.0 (0xf6a1e000)
libxcb-render.so.0 => /usr/lib32/libxcb-render.so.0 (0xf6a15000)
libresolv.so.2 => /lib32/libresolv.so.2 (0xf6a01000)
libselinux.so.1 => /lib32/libselinux.so.1 (0xf69e6000)
libexpat.so.1 => /lib32/libexpat.so.1 (0xf69be000)
libXdmcp.so.6 => /usr/lib32/libXdmcp.so.6 (0xf69b9000)

The “libexpat.so.0 => not found” line tells us that libexpat.so.0 is missing. What is odd is that the executable also links against libexpat.so.1.

I could try and find a 32 bit version of libexpat.so.0, but it might be worth a try to fake it.

> sudo ln -s /lib32/libexpat.so.1 /lib32/libexpat.so.0
> ./wink

Ha, it runs! Initial tests shows that it captures fine and can save to HTML, PDF and Flash.

Copy the entire directory structure to a its final resting place.

> rm installdata.tar.gz
> mkdir ~/wink
> cp -r * ~/wink
> rm -rf *

Now you can either run it from the wink directory or set up some desktop links to it.

2009
11.07

Wave Robot API shortcomings

While building a Robot that inserts a Gadget into the wave I discovered something that made me shake my head. A lot of the Wave Robot API classes have methods that violate their documented contracts. The worst offender I think has to be the Event interface. Whenever an event is delivered to your Robot, you interrogate the event to gather the information the robot requires. But there are many different events that can occur and each is trying to tell the robot a different thing.

For example, one of the methods on the Event interface is getAddedParticipants(). This method makes sense only on an event where the participants have changed such as BLIP_CONTRIBUTORS_CHANGED. However the method is available for all events. The javadoc for this method is

getAddedParticipants

java.util.Collection<java.lang.String> getAddedParticipants()
Returns a list of participants added to the Wavelet (if applicable).
Returns:
a list of participants.

You will of course note its contract specifies that it returns a list of participants. So you write your code so that it wil handle a Collection of participants. And if there are no added participants, it will return an empty collection. Except that it does not return an empty Collection when there are no added participants. It returns null. Um, that behaviour is not in the contract.

Another case that is really nasty is the case of Wavelet.getRootBlip(). There are many reasons why you may want to access the root blip. Maybe the robot created a widget there and wants access to it. Sometimes you might want to compare the id of the root blip to see if it is the same as the id of the modified blip in the event you just received. The javadoc says that it returns “the root blip”. Just don’t do the following while handling the BLIP_SUBMITTED event or you will be sorely surprised.

  Blip rootBlip = wavelet.getRootBlip();
  if ( rootBlip != null ){
    String rblipid = rootBlip.getBlipId();
    // compare root blip id against changed blip id
    ...
  }

Apparently when you receive an event, you do not receive the entire wavelet, but rather only information about the current blip for which the event occurred and that blip’s parent. If neither of those is the root blip then wavelet.getRootBlip() returns a non-null value, but this blip is not the actual root blip and contains no blip data in violation of its contract. This blip has been described as empty or hollow. So when you call getBlipId() on what you thought was the root blip, a null pointer exception occurs in getBlipId() because it attempts to dereference a null blip data object within the hollow root blip.

However, using Wavelet.getRootBlipId() gives you the ID of the root blip without the API experiencing a null pointer exception. Which is fine if you only want to compare blip IDs, but does not help you if you want to actually examine the contents of the root blip, since you don’t have access to it. The recommendation from Google is to save all needed blips in your AppEngine datastore and update them as they change and retrieve them as necessary.

Hopefully these annoying API contract violations (and bugs) will be fixed soon.

2009
11.04

Setting up Apache Tomcat for Upgrades

Plan for Change.

Note: This article is based on Apache Tomcat 6.0.20

If you set up a lot of Tomcat sandboxes, here is a sample structure to make it easy to upgrade to a new version of Tomcat without having to reinstall all applications. The trick is to have a number of Tomcat sandboxes pointing to a symbolic link, which in turn points to the latest version of Tomcat.

Download Tomcat

Get latest version of Tomcat from Apache. Check signature. Decompress. Untar.

> cd ...
> tar -xvf apache-tomcat-6.X.X.tar

Now create a symbolic link to this latest version

> ln -s apache-tomcat-6.X.X apache-tomcat-latest

Create a sandbox

A sandbox refers to a directory where you are testing a web application. Portions of the sandbox are linked back to the latest version of Tomcat. Other portions of the sandbox are original to it.

> mkdir tomcat.sandbox
> cd tomcat.sandbox
> ln -s ../apache-tomcat-latest/bin .
> ln -s ../apache-tomcat-latest/lib .
> ln -s ../apache-tomcat-latest/conf .
> mkdir work
> mkdir logs
> mkdir webapps

To add a WAR file to Tomcat, simply copy it to the tomcat.sandbox/webapps directory. It will be auto detected when Tomcat starts and deployed.

Finally, start Tomcat.

> cd bin
> ./catalina.sh run

Obviously, there is more to configuring and running Tomcat. You can get more information by starting at the Tomcat Homepage.

Upgrading

When a new version of Tomcat becomes available, repeat the first step. Download, verify, decompress and untar the latest version, alongside the first version. Then, change the symbolic link of latest Tomcat to the new one.

> cd ...
> tar -xvf apache-tomcat-6.Y.Y.tar
> rm apache-tomcat-latest
> ln -s apache-tomcat-6.Y.Y apache-tomcat-latest

Now, all sandboxes are pointing at the latest libraries. Restart all sandboxes.

Unless major changes have occurred in configuration files, this trick should let you upgrade painlessly.

2009
11.04

Setting up Jetty for Upgrades

Plan for change.

Note: this article refers to Jetty-7

If you set up a lot of Jetty sandboxes, here is a sample structure to make it easy to upgrade to a new version of Jetty without having to reinstall all applications. The trick is to have a number of Jetty sandboxes pointing to a symbolic link, which in turn points to the latest version of Jetty.

Download Jetty

Get latest version of Jetty from http://www.eclipse.org/jetty/downloads.php Check signature. Decompress. Untar.

> cd ...
> tar -xvf jetty-distribution-7.X.X

Now create a symbolic link to this latest version

> ln -s jetty-distribution-7.X.X jetty-7-latest
> chmod a+x jetty-7-latest/bin/*.sh

Create a sandbox

A sandbox refers to a directory where you are testing a web application. Portions of the sandbox are linked back to the latest version of Jetty. Other portions are copied from the latest Jetty. Finally, some portions of the sandbox are original to it.

> mkdir jetty.sandbox
> cd jetty.sandbox
> ln -s ../jetty-7-latest/bin .
> ln -s ../jetty-7-latest/lib .
> ln -s ../jetty-7-latest/start.ini .
> ln -s ../jetty-7-latest/start.jar .
> cp -rp ../jetty-7-latest/etc .
> cp -rp ../jetty-7-latest/resources .
> mkdir contexts
> mkdir logs
> mkdir webapps

At this point, we must configure the sandbox. There are two steps to adding a WAR file:

  1. Copy WAR file to jetty.sandbox/webapps
  2. Create a context file (.xml) located in jetty.sandbox/contexts to enable application. Look at jetty-7-latest/contexts for inspiration.

Finally, start jetty.

> bin/jetty.sh run

Obviously, there is more to configuring and running Jetty. You can get more information by starting at the Jetty Homepage.

Upgrading

When a new version of Jetty becomes available, repeat the first step. Download, verify, decompress and untar the latest version, alongside the first version. Then, change the symbolic link of latest Jetty distribution to the new one.

> cd ...
> tar -xvf jetty-distribution-7.Y.Y
> rm jetty-7-latest
> ln -s jetty-distribution-7.Y.Y jetty-7-latest
> chmod a+x jetty-7-latest/bin/*.sh

Now, all sandboxes are pointing at the latest libraries. Restart all sandboxes.

Unless major changes have occurred in configuration files, this trick should let you upgrade painlessly.

2009
11.02

64bit Karmic and Eclipse GWT plugin

After upgrading to Ubuntu 9.10 from 9.04, the GWT plugin for Eclipse doesn’t work so well when trying to run an app in hosted mode.

** Unable to load Mozilla for hosted mode **
java.lang.UnsatisfiedLinkError: /home/igough/installs/eclipse-3.5/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.7.1.v200909221731/gwt-linux-1.7.1/mozilla-1.7.12/libxpcom.so: libstdc++.so.5: cannot open shared object file: No such file or directory

Karmic does not have libstdc++.so.5 as part of the distribution but you can download the one from 9.04 from the Ubuntu repository. I am running 64 bit Ubuntu, and would normally download the 64 bit version of the library, but the GWT Eclipse plugin uses a 32 bit version of Mozilla for hosted mode. And its hosted mode that wants the Standard C++ library. So we must download and install the 32 bit version.

Download libstdc++5_3.3.6-17ubuntu1_i386.deb from the Ubuntu respository link above. Then install using:

> sudo dpkg --install --force-architecture libstdc++5_3.3.6-17ubuntu1_i386.deb

Once you do this, hosted mode should work again.

2009
10.31

Karmic Upgrade and Drive Fail warning

Today, I upgraded my laptop, currently running Ubuntu 9.04 to Ubuntu 9.10.

In general, 9.04 has seemed to have been an ill-behaved release with all sorts of problems handling the Intel GM965 chipset in my Inspiron 1720, in particular the X3100 graphics subsystem. It got so bad for JP that he moved his laptop over to a very pre-release version of Karmic a few months back.

One of the new features that runs on Karmic is that Palimsest Disk Utility 2.28 which you can find at System->Administration->Disk Utility. This utility monitors the SMART data from all drives in your system to let you know when the disks start getting flakey. When JP upgraded, the utility warned him that his disk was starting to go bad, with dire warnings about the disk failing at any moment. JP replaced the stock Fujitsu drive with a Seagate 500Gb drive and all has been well. When I did the Karmic upgrade, Palimsest gave me a disk failure warning too. I looked at the SMART data that the utility was reporting and marveled that the numbers that were being reported were so high. So then I ran Spinrite 6 against the drive. Spinrite did not detect any problems, but did show the same oddly high SMART numbers. So I ran smartctl

> sudo smartctl -a /dev/sda

Now this pointed out that the particular drive, a FUJITSU MHY2160BH is not in the smartctl’s database. Apparently, SMART isn’t as much a standard as it should be. Different vendors do different things with the SMART attributes. My suspicion is that if the particular drive is not in the database, the program cannot know how to interpret the raw numbers correctly. Palmisest and smartctl are show the same raw values for the SMART attributes.

Lets take a look at some of the raw numbers:

Reallocated_Sector_Ct   8589934592000

Wow, thats a lot of reallocated sectors. 8 trillion. On a 160Gb hard drive. I’m not buying it. But that number in hex is 07D0 0000 0000, an oddly round number. Maybe its not a 48 bit number in this case, but rather a 16 or 32 bit number and the real value is zero.

Power_On_Hours  897474

Lot of hours. I know the drive has not been powered on for 101 years, so this number is suspect too. Converting to hex gives 000D B1C2, but I cannot relate any portion of this number to reality. I would expect in the order of 16800 hours (0×41A0).

Ok, so now I don’t trust anything that Palimpsest is telling me. Maybe its wrong. Spinrite thinks the drive is fine and that is good enough for me. I only have the single drive in my laptop and have automatic daily backups and regularly run Spinrite on the drive. So if Palimpsest is not telling me anything useful, no sense in it taking up memory, so I have stopped it from starting when my laptop boots.