HOWTO set the default target in Xcode

Your Xcode project has one or more targets. Each target builds something—a command-line tool, a framework or an application. The Target popup menu lets you determine the active target. The active target gets built when you click “Build” or “Build & Go.” But what about the default target? What is it, and why do you …

Make a typeface (font) sampler with AppleScript

Every wanted to find just the right ampersand? Or question mark? Checking it against every font in your system manually would be a pain. Font Book doesn't have the font sampler feature you need to do this. But the problem can be solved with ... AppleScript: tell application "TextEdit"   make new document at the …

HOWTO set up an SOCKS proxy via an SSH tunnel on Mac OS X

Recently, I came across some streaming video that was only available to Canadians. Being a Canadian in the US, I felt somewhat entitled. Yes: I wanted to watch a hockey game. I knew I could do this with an SSH tunnel. I just wasn’t sure how. There are lots of pages explaining how to set …

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 …

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; …