Chasing a link via Twitter, I recently read Your code sucks. Having gone over a lot of other people’s code myself, and writing code for long enough to have a good history of my own work to go over, it resonated with me.
I recently had the mispleasure of debugging a piece of code that I wrote almost ten years ago. It was, in many ways, painful to read. Although I still use the same language as back then, things have way evolved: The language, for one. Development tools. (Well, not mine: I still use Emacs.) But most of all: My knowledge and my mental horizon in programming. I’ve looked at various other things to enrich my skill set, bringing to my own coding habits tools that work well in other languages. I also got to understand the tools I use better (especially database tools – those are so rich, and so few tools ever really use them). So, with that experience in mind: My code does suck. But I much prefer something that I wrote ten years ago to be painful to read, because it means that I have learned a lot. Even though I feel great satisfaction with the things I write today, I am sure that in another ten years time, I will look back at todays work and feel a slight sensation of being ashamed of what I did.
And this humbles me in reading other people’s code. It does not hurt to assume competency in others; they may have different routes they take in solving problems. But if one gets to think like they do, understand why they wrote the code the way that they did, that certainly may lead to your taking away something for yourself.
Now, if only everyone adhered to K&R indentation, I could read all the other people’s stuff so much more easily …
For a project that we are currently implementing, we’ve asked ourselves what the best way to access the database would be. So far, a number of our projects had been realized with Pear DB, and that was mostly okay. The current project needs to be resonsive even under high server load, so we try to cut away all the slack we can. So we did a few benchmarks.
PDO, in certain cases, is up to 4 times as fast as Pear DB.
Interssanter Artikel, Google als Wahlprognose-Werkzeug zu benutzen: Anhand einer Liste von passenden Sätzen und Zählen von Links versucht der Autor eine Prognose für November: The SaltwaterPizza Blog: According to Google, Bush will beat Kerry in November
In the office, we currently have about 120gb of disk that need regular backups. We wanted to have a solution that enables us to store offsite copies easily and wasn’t too expensive. Tapes were out for handling reasons – those drives that we were willing to afford would have meant a system of cascaded incremental backups, making restoration of single files a tape-shuffling issue. DVDs don’t hold enough data and their storage times are not yet fully understood, so that didn’t quite sound so practical, either.
In the end, we decided to outfit one of the older machines around (a Pentium II) with removable hard disks (normal Western Digital 160 GB drives, fitted into run-of-the-mill aluminium mobile racks). We have two drives fitted into a carriage, so there’s always one at home and one in the machine. During the day, the appropriate machines copy their data onto that one volume over the network and I can take along the disk in the evening, bringing the other one next morning.
Most of our machines run NetBSD so I’ll just quickly run down the very basic configuration, we have here, but it should also work with many other unix-like operating systems. Operating system and all esential stuff is on a disk that always remains in the backup machine, the backup volume is a drive off the secondary IDE controller.
The machine is only powered on when the disk is in, so there’s no choking on missing disks – this could be avoided by using a hotswap-enabled IDE controller, but currently, we don’t have that need. As soon as the disk goes in in the morning, the machine is powered up, boots and shares the backup volume via NFS. The other machines (all running NetBSD) have that volume in their automounter. Scripts are started that use
dump(8) to copy their appropriate slices onto the backup drive. As soon as they’re all finished, the machine powers down again, waiting for the drive to be taken out.
And that’s all there is to it!
Price of the machine: practically nothing, we had that already. We even had an empty 4U 19″ enclosure, so it’s gone into the machine rack.
Price of the drive enclosures: 25 € each, making it 50 €
Price of the hard disks we’re using today: starting from 80 €
That makes our configuration total 210 €. Not bad for 160 GB of backup storage.