MySQL: permissions needed for mysqldump

If you want to give a user permissions to back up a MySQL database, what do you do? The MySQL GRANT page didn’t tell me. Searching wasn’t helpful. Here’s the answer, in the hopes it will help others: SELECT and LOCK TABLES. mysql> grant select, lock tables on foo.* to bar@localhost indentified by ‘ugh’; mysql> …

HOWTO get the real host name of your server in PHP

In PHP, to get the name of the web server, you can print $_SERVER[“HTTP_HOST”]. However, if you use round-robin DNS or a load balancer, this will give you the name Apache thinks your machine is. What if you want the real hostname — what you’d get from hostname or uname? print gethostbyaddr(“127.0.0.1”); That’s all. It …

JavaScript: how to unescape HTML entities

I was searching the web for JavaScript HTML entity unescaping code. I found lots of really bad ideas. Sound familiar? Some were quite complicated. It looked like the scriptaculous guys had the right idea. However, all I could find was a cached page with no code. A quick peek inside prototype set me on the …

How to create a self-signed SSL certificate for Dovecot on Debian

Here is how you create a self-signed SSL certificate for the Dovecot IMAP/POP server on Debian Linux: openssl req -new -x509 -days 1000 -nodes -out “/etc/ssl/certs/dovecot.pem” -keyout “/etc/ssl/private/dovecot.pem” The default is 365 days, but I upped it to 1000, so I don’t have to do this so often. Dovecot does this on installation via /var/lib/dpkg/info/dovecot-common.postinst; …

Local Obama website roundup

There are lots of San Francisco Bay Area-oriented Obama web sites. However, many of them have not been updated in quite a while: Silicon Valley for Obama aka Ca14forObama (June 22, 2008) Bay Area for Obama (and its clones, South Bay for Obama, etc.) (February 22, 2008) Obama SF (unknown) SF 4 Obama (unknown) Are …