


Well Its Programming Contest time at the Hattiesburg Development Center a yearly recruiting event to attract students from the surrounding universities. Unlike the ACM Contest we give good prizes like game consoles. In past years we used a knoppix based CD image for the contests machines, last year we had some issues with hardware support. The knoppix image was three years old, so I volunteered to setup a new image this year. Seeing how remastering CD images and burning 20 something CDR's is not fun at all or easy I trashed the entire boot CD idea in favor of USB flash drives.
Ubuntu has become very popular in recent years and I have heard good things (RedHat Family Man myself). So I grabbed the latest version and installed it on a Dell tower scavenged from an empty cube. It turns out that Ubuntu comes with a built in tool to create Live USB's it is called "usb-creator". It is very simple to use and it sets up the persistence for you.
Using the Live USB method the contestants can keep work saved threw system crashes and at the end of the contest they can take the entire contest environment home with them. Which i think is a little added value.
Contest Image Setup
So I boot up my new live USB ran an "apt-get upgrade" to bringe it upto date.
Installed the standard packages to support the 3 allowed submission languages: Java, C, C++, More if you can wrap them inside those 3 languages :)
To be nice to the contestants I gave them an IDE and a code friendly editor. Though in a contest an IDE will mostly slow you down.
User Accounts
I created three user accounts: Judge, Contest and Practice. The first obviously for the three judges to use for judging submissions. The practice user will be used for the practice round before the contest, to allow the team to get comfortable with the contest environment before contest start. And the contest user is for the actual contest, and we will make the password available in the problem statement packet .
I created links to the JAVA Docs and to Eclipse and Komodo Edit and placed them on the desktop of both the contest and practice user. Also copied in friedscript to make the console friendly.
One of the requirements it that the machines have to be cleaned out between the practice round and contest to prevent any work carried over. This is pretty simple as well, I created a tar.gz of the practice home directory and placed a few lines in /etc/rc.local to make sure its clean every time the machine boots. Also /tmp clears out automatically.
cd /home
rm -rf practice
tar -zxf practice.tar.gz
I can send runners around after the practice round to power cycle all the laptops.
Judge Test Harness
I created a test harness using Perl that takes three arguments the command to run the input file to pass it and the expected output file, also a fourth argument triggering debug output. The script runs the command in one thread and monitors its run time in another, if its run time extends past a set limit the command is killed and a "fail" message is sent to the judge. If the command does execute in time and produces output it is automaticly checked against the expected output using diff. The debug switch will show the judges the diff output. But if no difference between the actual output and expected output then a "Passed" message is displayed.
Boot Splash Screen Timeout
If i had more time to work on this project, I could edit the syslinux boot screen to make more sense. But I do not so I just opened up the /cdrom/syslinux/syslinux.cfg and set the timeout to 1. This will cause ubuntu to boot immediately instead of asking you if you want to install.
Final Changes
The guys working on the contest problems will be sending me the example input and output so that I can place them in a folder on the Contest users desktop. This is to prevent any confusion over white space characters on printed examples.
Also set the firefox homepage to the contest submission web site.
Mass Replication
I have been using the Unix 'dd' command to make images of my master usb flash disk for safekeeping. Its also an easy process. /dev/sdb is the USB device
dd if=/dev/sdb of=contest.img bs=64K
So my wife has a 7 port powered USB hub so I think I am going to barrow that combined with the 6 USB ports on my dell with the mouse and keyboard removed (I'll be using SSH). I can image 12 thumb disks at a time :) It will look something like this
dd if=contest.img bs=64K | tee /dev/sdb | tee /dev/sbc | ... > /dev/sdm
That should be interesting it will most likely push the USB bus to a slow crawl, but I am going to try it. I'll update this entry with my results.
(Updated) That does not work so well, the usb's produced had invalid partition tables, and only booted on my dell.
The Annual Deloitte Hattiesburg Development Center Programming Contest will take place on 4/17/2010. So we will see how successful my little image is then.