Playing with the Darwin Calendar Server

Sorry for the lack of posts lately, I've been caught up with school and updating my FOSS on the side whenever I have some spare time.

The server that runs this site as well as and a few others is almost always idle - the load averages rarely exceed 0.5, and are most often sitting somewhere around 0.2 (it's a 1U/Core 2 Quad Q9550@2.83GHz/8GB RAM/2x1TB RAID 1). I have bigger plans for it in the future, but at the moment there just isn't a great deal for it to do since it handles everything so quickly.

I have been wanting to see how KVM VMs perform on it as well as try out the Darwin Calendar Server (DCS)... Seeing as DCS requires Python 2.5 and I didn't want to mess around with the live server's configuration (CentOS 5.x ships with Python 2.4), I installed Fedora 13 in a virtual machine so I could test the calendar server safely.

To my surprise, KVM works really, really well... I wasn't expecting that seeing as the versions I had used in Fedora were so much more recent. The performance is good - I haven't performed any stress-testing yet (which obviously will show a gap between the VM and running natively) but the DCS is running very smoothly and feels very responsive, so I'm confident that the difference in performance is not so large.

How I got the DCS running on Linux is a whole other story... I'll save that another post (F13/F14 DCS installation guides coming soon) but is it ever handy to have a CalDAV server! Previously, I was only able to sync calendars manually (with the USB cable) which made checking for homework assignments extremely annoying, as half of the information was always my iPod and the other half on iCal and I had to sync all the time. Now it's all over-the-air, so as long as there's Internet connectivity the calendar events can be pulled in or pushed out.


A fun little script

if [ "$1" == "-h" ] || [ "$1" == "--help" ] || [ "$1" == "-v" ] || [ "$1" == "--verbose" ];then
  echo -e "\n"

if [ $UID -eq 0 ];then
  echo "Okay."
  echo "What? Make it yourself."



...I decided to tackle problem I recently found out about in fwbackups. If there is a large amount of stdout or stderr output in a short amount of time from the backup subprocesses, fwbackups hangs. That level of output should never normally happen while backing up user files, but if /proc or /dev is included in a backup for example then it could trigger the problem.

After 8 hours [1] of backup benchmarks, I've concluded that not only is python's tarfile module horrendously slow (with gzip compression enabled, it is consistently two times slower than calling "tar" from the command line as a subprocess) but that I unfortunately have to reverse the feature I added in 1.43.3rc3 that adds the display of the file currently being backed up in the GUI. Sorry in advance, but it was the only way to keep both performance and prevent fwbackups from hanging mid-backup in certain situations.

[1] which as it so happens, is also how many hours there are in the first season of How I Met your Mother. It's a hilarious show!


Fixing the iTunes 10 badness

I think many will agree that iTunes 10 was more of a marketing ploy than anything else... I found that iTunes 10.0 was worse than 9.x, primarily because of the "traffic light" style buttons in the window corner and graystyle icons. That was bearable though, and then the update to 10.0.1 came along made things even worse. No more Genius sidebar, and obnoxious "Ping" buttons every time a song is selected.

So I went on a quest to fix it, and found these commands on various forum threads and blogs:

(If you are unsure how to run these commands, quit iTunes and open Application > Utilities > Terminal. Copy/paste these commands in, hitting <Enter> after each to execute it.)

defaults write hide-ping-dropdown 1
Disables the obnoxious "Ping" drop-down menu I mentioned earlier.

defaults write show-store-link-arrows -bool TRUE
Restores the store arrow links present when a song is selected in 10.0 and earlier.

defaults write disablePingSidebar 1
Disables the ping sidebar. Sadly, I haven't found a way to re-enable the Genius sidebar.

defaults write full-window -boolean YES
Puts iTunes in "full window" mode, removing the traffic light window controls.

Now, the last thing is to restore color in iTunes. To do this, download the iTunes.rsrc file linked to in comment #7 on this thread. Next, right-click on iTunes in the Applications folder and select Show Folder Contents. Inside the Contents/Resources folder, copy the downloaded iTunes.rsrc file and opt to replace existing files when prompted. Restart iTunes and you should have coloured icons!

Note: If you're reading this but you're running iTunes on Windows, a user on Apple Discussions has posted how to do the same on Windows.


Cryptic MySQL error

Today as I was attempting to test one of my PHP applications, I received this error after attempting to connect to a MySQL database:

Warning:  mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter
than expected in index.php on line 29

Warning:  mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to
MySQL 4.1+ using old authentication in index.php on line 29

The script giving the error was running on OS X 10.6.4 with the stock PHP 5.3.1. After doing a bit of searching and reading the MySQL documentation on the old password format, I was a bit confused because I ran this on the server:
[user@host ~]# rpm -q mysql mysql-server

Both the server and client should support the new authentication version, which was introduced all the way back in MySQL 4.1. So why wouldn't it connect?

It turns out that CentOS 5 disables the new password hashes by default in favour of remaining compatible with 3.x (and earlier) MySQL clients. All you have to do is edit /etc/my.cnf and comment the old_passwords=1 line. After restarting the server, you should notice that running SELECT PASSWORD('foobar'); in a MySQL prompt will return 41-character hashes, not the old-style 16 character hashes. Reset the user passwords to start using the new hashes and you'll be good to go.