Friday, August 15, 2008

Kevin Kempter

I met Kevin Kempter at a CLUE Installfest.

Kevin was hauling around gear in a great, Marine Corps bag. I thought, "Hah! Another jarhead. Hey ... how can I get one of those bags?"

He'd had the same thought. On a visit to MCRD, he saw a guard with the same bag, and asked him where he could get one.

"They're only for active-duty Marines, so I'm not allowed to tell you that if you go down that way one block and over two, you'll find the PX. Sir."

"Interested in giving a BLUG talk?" I asked Kevin.


"What would you talk about?"


Turns out, people are interested in Postgres.

Kevin played to a standing-room-only crowd last night.

He told us he has one client who's now pulling in a terabyte of data a day, and expects to expand this by a factor of 100.

Thursday, August 14, 2008

Apache Status

You can get your apache2 (and, I suspect, apache) server to display status information on prefab server-status and server-info pages by loading the status and info modules and tweaking the configuration files to pay attention to them.

Having done that, http://localhost/server-info and http://localhost/server-status
will tell you what modules are loaded and what they do. With little more work, you can also permit access to these pages by other boxes.

I set this up yesterday at work, but haven't done it at home because this laptop isn't serving up web pages at all.

Monday, August 11, 2008


I spent part of the weekend playing with gitosis, a tool for administering remotely-accessible git repositories.

Access revolves around ssh and public/private key pairs. You give me your public key, and I can grant you selective permissions, repo-by-repo, if I'm the gitosis administrator. Once I do, it's painless to check stuff in and out, since all the permissions stuff is under-the-covers. Much nicer than Subversion's cacheing of passwords in plain text.

One of the coolest things is that the administrative data, including public keys, are kept in a git database. If I'm the (or an) administrator, I can administer access remotely, with git pull and git push -- including adding new users and their keys -- using gitosis itself for the repo access.

Sunday, August 10, 2008

Error-handling, again.

Here's a better version of my error-handling shell functions. Maybe I am educable, after all.
# common error-handling functions

if [ $_gripe ]; then return 0; else _gripe=1; fi # include guard

warn() { printf "$* at line %s file %s: $msg\n" $(caller) 1>&2 ; }
die() { printf "$* at line %s file %s: $msg\n" $(caller) 1>&2 ; exit -1; }
I have an include guard so I can include it in other shell functions that may be included with one another. I use if, rather than a [test] || alternative construct because I'm often running set -e, and don't want to die because of the test itself.

I have die() printing its own message, instead of calling warn(), so that it reports where it's invoked. Otherwise, warn() announces it's being called by die(). Duh.

It amazes me that after doing this for so long, I can still be fixing bugs in my own code -- and code as basic as this.

Saturday, August 9, 2008

Making Makefiles Behave: Loops

The last command in a shell for loop determines whether the loop succeeds or fails.

This succeeds:
$ for i in false true; do echo $i; $i; done
$ echo $?
This fails
$ for i in true false; do echo $i; $i; done
$ echo $?
When does this matter? In Makefiles. Suppose you have a make rule that looks like this:
for dir in $(SUBDIRS); do $(MAKE) -C $$dir; done
A failure of one of the subdirectory makes will not cause the make to fail!

How do you solve this? There are several sophisticated ways, but the dead-easy way is to start the Makefile like this:
SHELL := /bin/bash -e
This will cause all shell commands to be executed with the -e flag, which causes any simple command to terminate the shell.
$ ( set -e; for i in false true; do echo $i; $i; done )
$ echo $?
(I have to put the command and the set -e in parens here -- though not in the Makefile -- because any failure causes the command to fail and the shell to exit, so the following "echo $?" would never be reached.

Tuesday, August 5, 2008


For fun, I've set up CruiseControl on my laptop.

It's annoyingly hard to configure, and there seems not to be an rpm for Ubuntu, but it works.

I have it set up to watch a git repository, and build "hello, world." I can push to the repository from elsewhere and trigger a new build.


Sunday, August 3, 2008

Google Chat-Bots for Translation

I use the Google chat-bots for quick translations. Here's an illustration from a note to a friend:
For whatever reason, I looked at the story you gave me, saw "laberintos," and thought, "Shouldn't that be 'labArintos'?"

So I popped up a chat window in gmail, invited <> to chat, and typed in "labyrinth." It responded,

I said, "thank you," to which it replied "Gracias." :-)

Now that Google has group chat, you can invite a pair of simultaneous translators to join, and have chats with people you don't even share a language with. Mostly, though, I use them for quick translation: it's easier than going to a website.

Update: I just looked, and Google has added many more translation-bots.