Skip to content


OSX Scrollbars Top and Bottom

In Terminal:

defaults write "Apple Global Domain" AppleScrollBarVariant DoubleBoth

Popularity: 84% [?]

Posted in Snippets.


MailAnnounce Applescript Source

I have received several requests for the source of my MailAnnounce script that is able to speak the subject of mails using Mail.app and Applescript.

Source for version 1 of the script is now available.

Popularity: 89% [?]

Posted in Apple / Mac, Development.


rpmdb: unable to join the environment

This weekend I was contacted by a client regarding a server that had run out of room on the main hard drive. Among the things that were corrupted by the drive filling up was the RPM database.

When trying to query of upgrade any package, the error message

rpmdb: unable to join the environment
error: db4 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages index using db3 - Resource temporarily unavailable (11)
error: cannot open Packages database in /var/lib/rpm
warning: /root/webmin-1.360-1.noarch.rpm: V3 DSA signature: NOKEY, key ID 11f63c51
rpmdb: unable to join the environment
error: db4 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages database in /var/lib/rpm
rpmdb: unable to join the environment
error: db4 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages database in /var/lib/rpm

A search turned up this howto on repairing the db.

These two commands made quick work of the fix. First remove any old lock files:

rm -f /var/lib/rpm/__db*

Then rebuild the RPM database:

rpm -vv --rebuilddb

Popularity: 90% [?]

Posted in SysAdmin.


Blattodephobia

n. The fear of cockroaches

Popularity: 89% [?]

Posted in Dictionary.


Quickly Copy MySQL Database to Remote Host

Copy an entire database:

mysqldump LOCAL_DBNAME | ssh USER@REMOTE_HOST mysql -p REMOTE_DBNAME

Copy a single table:

mysqldump LOCAL_DBNAME LOCAL_TABLE | ssh USER@REMOTE_HOST -p REMOTE_DBNAME REMOTE_TABLE

This shortcut only works if you can access the local DB without a password. If you have to login to both local and remote MySQL servers, the MySQL password prompts get mashed together. You could specify the password on the command line like

-pPASSWORD

but your shell may keep the password in its history so that anyone with access to your account could pick through your shell history and retrieve the password. Using the MySQL password prompt doesn’t do this.

Popularity: 100% [?]

Posted in SQL, Snippets.


PHP gethostbyname() and DNS

For PHP’s gethostbyname() to work properly, the server’s DNS must be properly configured with available nameservers in /etc/resolv.conf (on Linux boxes). Without a work domain name resolution kit, gethostbyname() returns the hostname supplied to the function.

Make sure /etc/resolv.conf contains several nameservers to query. The format is

nameserver xxx.xxx.xxx.xxx
nameserver yyy.yyy.yyy.yyy

Where xxx.xxx.xxx.xxx and yyy.yyy.yyy.yyy are the IP addresses of nameservers the host has permission to use.

OpenDNS is a free DNS service that allows public access to their nameservers at:

208.67.222.222
208.67.220.220

To use in /etc/resolv.conf use:

nameserver 208.67.222.222
nameserver 208.67.222.220

Using OpenDNS’s nameservers could even boost your server’s performance. Their goal is to provide some of the faster domain name resolvers on the internet for free.

Popularity: 26% [?]

Posted in Development, PHP.