I don't know if anyone will find this entry interesting, but it is certainly more interesting than an empty blog, and it is a harbringer of things to come. I haven't really hacked OS X very much lately - this is a testament to its functionality and stability - it hasn't needed hacking.
Instead, today I will talk about PostgreSQL - the most advanced open source database on the planet.
I've been using PostgreSQL for various chores ever since I started working with SQL databases. That, actually, was relatively recently in my career. My first computer was an Apple ][. In the late '80s, I transitioned directly from that to Suns running SunOS 4. Sort of an odd leap to make. I've moved with the cheese quite a number of times - I've changed my mind (in each case going from hating to loving) about Java, Databases, Object Oriented programming, GUI programming and Macs (thanks to OS X) in their turn.
What did it for me on Databases was running the 2nd FreeBSD core election a few years ago. I set up a small website where the developers could log in and register their votes (or revise them, if desired). At the end of the election, I presented the results. I did all this using PHP, a whole lot of regular expression parsing, and files in a hierarchy of directories. When I got done, it worked, but I couldn't help saying to myself, "there has to be a better way."
Databases. Duh. I didn't run the next core election (because I decided to run - unsuccessfully), but shortly after started designing little web applications using LAMP (in my case, FreeBSD, apache, PostgreSQL and PHP). At the time, I picked PostgreSQL over MySQL because of better support for transactions. I haven't looked back.
Anyway, back to today. Before I headed off to work this morning, I decided to upgrade PostgreSQL from 7.4.7 to 8.0.1 on my main FreeBSD machine (the one serving OSXHAX, among other things). Now the rule is, every time the first or 2nd digit of the number changes, you must do a dump/restore of the entire database. I wasn't looking forward to it.
I shouldn't have been concerned. Here's how it went:
Since I had set up the PostgreSQL periodic script that comes with the port to backup the database, I just ran it by hand to back it up.
/usr/local/periodic/daily/502.pgsql
Next, I shut down
/usr/local/etc/rc.d/010.pgsql stop
Next, I moved the data directory aside so that I could easily revert, if necessary:
cd ~pgsql && mv data data-
Next, I upgraded the database ports:
portupgrade -o databases/postgresql80-client postgresql-client
portupgrade -o databases/postgresql80-server postgresql-server
I copied the old pg_hba file, to preserve the access control I had set up
cd ~pgsql/data && cp ../data-/pg_hba.conf .
Next, I did an initdb and started up
/usr/local/etc/rc.d/010.pgsql initdb
/usr/local/etc/rc.d/010.pgsql start
Next, I recreated the users
cd ~pgsql/backups(today's date)
su pgsql
gzcat pgglobal- | psql template1
Next, I restored the databases(note, I was still using the pgsql user at this point)
foreach i (pgdump-*-(today's date)*)
pg_restore -C -d template1 $i
end
And that's all. Total time: about 10 minutes. It was easier than I had any hope it would be. Typing up this entry was harder.
Part of this ease was the existence of the FreeBSD ports system and the portupgrade command. But even if I decided to host the database on another OS, I suspect it would have been just about as easy.
Anyway, I am probably going to move away from Movable Type for this blog. I don't want to pay for the new non-free (as in beer) version. I was going to try Wordpress, but they aren't very database-neutral. So I will probably try Serendipity. I also am probably going to broaden the scope a bit. That way I can post more often without being off-topic.
I'll probably keep the OSXHAX name, though. It's just too cool.
It turns out I was wrong about the Mac Mini being able to handle full 1080i or 720p video from the EyeTV 500. What actually happens if you have less than a dual-G5 is that the video is scaled down to half-resolution (4 pixels become 1). So 1080i becomes 960x540 and 720p becomes 640x360. Then the video is blown up to fit the window or screen you're using.
This winds up looking as good as it does because the scalers that El Gato uses are really, really good. But any way you slice it, you're really winding up with EDTV rather than HDTV - or something that's approximately DVD quality.
Of course, the recordings are at full resolution. So I am going to, one of these days, install the software on my dual G5 and copy a recording over the net from the mini and see what it looks like. Alas, my dual-G5 machine doesn't have the 23" cinema display, it only has the 20", so the resolution is only 1680x1050 - I still won't be seeing actual 1080i.
It still looks plenty good to me. Certainly good enough until I can get my hands on an HD DirecTiVo. But when I do, I'll be switching back and forth between TiVo and the Mac a lot more than I do now, which will be a bit of a shame.