Friday, April 30, 2010

tightvnc with gnome messes up the keyboard mapping

Everytime I run our unit tests, I get Java Swing windows flying across my screen making it impossible to work. A friend suggested that if I ran the tests in a vncclient session, the windows will be contained within vncviewers window.

So I installed tightvncserver and client on my Ubuntu 9.10 machine. When I started vncviewer I realized that the keyboard mapping as messed up, making it impossible to type anything sensibly in the vnc session.

Some searching seems to suggest that Gnome is causing this problem. This page offered a solution of changing VNC's startup file to not fully start Gnome, and it worked for me.

Workaround: I modified my ~/.vnc/xstartup to be:


xrdb $HOME/.Xresources
gnome-wm &
gnome-panel &
nautilus --no-default-window &
gnome-cups-icon &
gnome-volume-manager &
xterm &

Tuesday, April 27, 2010

Java Applet on 64 bit Linux

I have been working on an Ubuntu 9.10 (64 bit system) from some time. I had read some stories of problems running 64 bit Java Applets on 64 bit Firefox, so when I needed to use Applets I did some googling to figure out how to do it.

I came across a couple of posts. Some had different solutions for different versions (3.5, 3.6) of Firefox, and they also wanted me to use IcedTea. The solution I used is outlined here, and it worked perfectly well for me.

Note: You may not have in the same place mentioned below.

mkdir ~/.mozilla/plugins/
ln -s /usr/lib/jvm/jre1.6.0_12/lib/amd64/ ~/.mozilla/plugins/

Tuesday, April 06, 2010

Showing lines before and after a grep match

Today I ran running grep on the output of hg log, but only to realize that I wanted a couple of lines before and after the line which matched as well.

I am sure this is common knowledge, but I did not know how to do it, so am sharing it in the hope that someone finds it useful.

hg log | grep --before-context=2 --after-context=2 username

Running the above showed me changeset number, comments etc for all the mercurial changesets committed by the specified user.