- 23 Jan 2010 -

Kenya seems to loathe alarm clocks. Ubuntu’s clock screen saver is sub-par, so I wrote a quick javascript clock to open in my browser and display all night long.


After opening the file in your favorite browser you can press F11 to hide all the toolbars.

This is in the babble category tagged as , , ,

Add a comment »

OpenMRS recently added a non-null uuid column to every table.  All of our dbunit xml files needed to be updated to insert values for this attribute.  I wrote the following shell script to loop over all xml files under the current folder and add a uuid attribute to all rows that didn’t have an attribute already.  There is a bit of logic in there to ignore certain tables because those tables didn’t actually get any uuids.

…read the rest of this entry »

This is in the openmrs category tagged as , , ,

Add a comment »

For some reason Ubuntu regressed a bit in the multiple monitor department between Hardy and Intrepid.  Before upgrading I was able to dock my Thinkpad and easily switch screens using fn-f7 to switch resolutions just like in the Windows World.  After upgrading function f7 usually didn’t work so I had to start just shutting down the computer (or at least control-alt-backspacing to restart x) if I switched between external monitor and the laptop monitor.

I recently discovered “grandr” and its capabilities.  It worked more often than Ubuntu’s Screen Resolution program…but I had to use my mouse and see the screen to do so.  This meant that I had to the lcd before I did a stand by or took the laptop off the dock.

I then discovered the command line “xrandr” program.  It let me set up some scripts to switch the screen resolution.

  • Use open source ATI driver (not fglrx)
  • Set up your terminal to launch with a keyboard shortcut (System–>Preferences–>Keyboard Shortcuts)
  • Figure out what randr calls the lcd and vga video card outputs with just xrandr
  • Create ./lcd.sh and ./vga.sh and set them to be executable with chmod +x


/usr/bin/xrandr –screen LVDS –auto


/usr/bin/xrandr –screen “VGA-0” –auto
/bin/sleep 4
/usr/bin/xrandr –screen LVDS –output LVDS –off

Now after undocking I don’t need to be able to see the screen to turn on the lcd.  I just type Alt-t to bring up the terminal, then ./lcd.sh and the lcd turns on. 🙂  Jaunty is supposed to have improved monitor support, so I’m looking forward to its release.

This is in the babble category tagged as , ,

Add a comment »

I’ve spoken previously about the travails of having a developer community that uses both Windows and Unix-based machines: merging files edited in both environments. Hopefully those days are over. (At least for the OpenMRS community)
…read the rest of this entry »

This is in the openmrs category tagged as , ,


I wrote this little cron script (with help from Adam Aisen) so that I could keep track of our tomcat server. I wanted to be notified by email whenever our site was down (which is does occasionally due to out of memory errors). The shell script simply looks at the http status code and sends an email to the given email address if the site has anything but a “200 OK” code.


# input validation
if [ ! -n “$1” ]
echo “You must enter a url as the first parameter”
echo “Usage: $0 <url> <emailaddress>[,<emailaddress>]”

# input validation
if [ ! -n “$2” ]
echo “You must enter an email address to notify as the second parameter”
echo “Usage: $0 <url> <emailaddress>[,<emailaddress>]”

# the default mail message
y=”The following services are broken! Oh noes! ”

# fetch the page and look for the “200” header
x=`wget -O – -q –save-headers $1 | grep “HTTP/1.1 200 OK”`
if [ ! -n “$x” ]
y=$y”\n\n$1 ”

# if one or more site above triggered an error, send the email
if test $z -eq 1
echo -e $y | mail $2 -s”Server status”

You call this script like so:

./serverstatus demo.openmrs.org/openmrs someuser@eflow.org

Now call this command as a cron job hourly/daily/minutely and you’re all set!

This is in the babble category tagged as

Add a comment »