Category: Software

Word cloud program

I saw the Wordle site for making word clouds and was really impressed. I had a few ideas for doing things differently–showing phrases instead of individual words for example. So I wrote my own version.

Origin of the Species word cloud

It displays phrases, words, or combinations of words and phrases. Text size indicates the relative frequency of different words. The output is a PDF file.

Uplift word cloud

The algorithm used to arrange the words places them randomly on open spaces in the image. Horizontal and vertical placements alternate. There is a bias toward placements towards the center of the image. This helps keep the cloud together. Words difficult to place are shrunk up to 10%. The Postscript font metrics are used to find the exact size of each letter. The allows close word placement.


Here it is:
System requirements: OS X or Linux.

RAID1 recovery

One of the MA database systems went down. It wouldn’t boot, so we put in the install disk, ‘linux rescue’ at the prompt, and it booted into rescue mode. The system is set up with the system files on a pair of RAID1 SATA drives. Drive /dev/sda was gone–fdisk found no partition. /dev/sdb was fine. I looked around for hacking traces but found nothing. /var/log/messages indicated the system had shutdown for reboot two days before. We hadn’t done it, so how/why?

First, I re-partitioned /dev/sda to look like /dev/sdb using the same ‘fd’ RAID partition type.

To bring it back up, I shut down, switched the sda and sdb cables so we could boot off the good drive and then have RAID restore the second drive. The original /dev/sdb didn’t have grub installed on the MBR, so I had to reboot with the rescue disk and reinstall grub.

grub>root (hd0,0)
grub>setup (hd0)

I had to use grub because grub-install wasn’t available from the rescue environment and /mnt/sysimage/sbin/grub-install couldn’t find /sbin/grub.

Then reboot, grub comes up, the system boots. The root /dev/md1 RAID1 is degraded as this shows, so add /dev/sdb back:

mdadm --query --detail /dev/md1

mdadm --add /dev/md1 /dev/sdb

And 20 minutes later the array is clean!

vnc to linux vncserver

Figured out how to VNC from my laptop to my linux server. Forwarded X conections were too slow so I gave VNC a try. It was harder to set up than I expected. I googled around and after many tries found a post online that worked.

Here’s the stiuation. I need to connect to my lab computer from my laptop at home. The lab computer is behind UK’s firewall. Run vncserver on the lab computer–that’s the easy part. It runs on display :1 by default:> vncserver

Turns out I need to enable port forwarding on the lab computer’s sshd:
As root add this line to /etc/ssh/sshd_config

AllowTcpForwarding yes

then restart sshd:
/etc/rc.d/init.d/sshd restart

Then forward the ssh connection. On my laptop I run this command from a terminal:

ssh -L 5901:localhost:5901

And run the VNC client. My laptop runs OS X, so I downloaded “Chicken of the VNC. By default it uses port 5900, enter display 1 (so it goes to 5900+1 = 5901) and the host is localhost. Starts up and runs fast!

Messing with css

I’ve messed with the site’s css style sheets. If it looked OK before, there’s no change. If the layout used to suck, it should be fine now. Css is such a tar baby, I won’t tell you how long it took me.

And I went and downloaded 400+ new mammal pics, should be enough to keep the site in mammals all year!

Install new hard drives with Software RAID 1

This turned out to be pretty straightforward once I got the order of steps right. Don’t make the filesystems before the mkraid, you will end up with “bad superblock” errors later.

I added two 400Gb SATA hard drives in RAID1 to an existing system. I already had one pair of drives in RAID 1, the new drives form a new RAID array.

1) Phyiscally add the drives.

2) Run fdisk, make one partition on each drive.
fdisk /dev/hdc
fdisk /dev/hdd

3) Edit /etc/raidtab, add section for /dev/md1:
raiddev /dev/md1
raid-level 1
nr-raid-disks 2
chunk-size 256
persistent-superblock 1
nr-spare-disks 0
device /dev/sdc1
raid-disk 0
device /dev/sdd1
raid-disk 1

4) Make RAID, needed ‘force’ flag:
mkraid -f /dev/md1
mkraid -R /dev/md1

5) Make filesystems:
mke2fs -j /dev/sdc1
mke2fs -j /dev/sdd1

This takes 10 min or so.

6) Add new filesystem to /etc/fstab for automounting:
/dev/md1 /home ext3 defaults 1 2

And now the keychain drive gets pushed from sdc to sde:
/udev/sde1 /mnt/key vfat owner,kudzu 0 0

7) Mount new RAID:
mkdir /data
mount /data

Useful RAID commands:
more /proc/mdstat
mdadm -D /dev/md1

Useful guide:

Kernel upgrade

Upgraded the kernel on my linux server and it was the easiest thing ever:

yum upgrade kernel-smp

It updated grub and everything! Color me surprised. Linux is getting *so* easy to use.