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 …

Stop FISA “compromise” sham and telecom immunity

Please call today and oppose the FISA Amendments Act (HR 6304). It is not acceptable to give away our civil liberties. Granting retroactive immunity to telecom companies is wrong. This bill is not a “compromise.” It is a get-out-of-jail-free card bought by lobbyists for large phone companies. No matter how illegal, offensive or intrusive a …