Latest Entries »

Have you ever been frustrated when trying to find a hidden file, or a file in a hidden directory, from an application’s open dialog? I’ve run into this a few times when trying to open disc images from disc utility. There’s an easy solution: browse to the directory where the hidden file/directory is, and hit:

Command-Shift-. [period]

This will show the hidden files. Hitting the same combination again hides them again. This might not work, depending on your region settings or key bindings. Try Command-Shift-, [comma] instead.

I have been searching high and low for the perfect camera bag. I need two, really. One is for my daily commute. This is the kind of bag that can accommodate my notebook computer and associated accessories, maybe a book or two, my lunch, and so on. It’s the kind of bag that can also accommodate my camera, and provide easy access to it. It doesn’t have to be able to fit all my camera gear – just the essentials: Body, one or two lenses, flash, extra battery maybe. This bag, I have found. It’s the Lowepro Fastpack 250. This bag does all the above, and can take for more photo gear than I expected. It’s compact, fairly discreet, goes through airport security without any problems, and after six months of daily use, show no signs of wear.
View full article »

I recently needed to do some testing with sending mail, and needed a host that would accept mails without asking questions, and just discard it. This turned out to be pretty easy with Postfix.   Starting with a fresh installation on Debian Lenny, add the following to /etc/postfix/main.cf:

# accept all mail
relay_domains = static:ALL
# then get rid of it
smtpd_end_of_data_restrictions = check_client_access static:discard

And before I even got to send a test mail, someone had beat me to it:

Jul  9 03:43:58 mx02 postfix/smtpd[13940]: 6BC681740FC: discard: END-OF-MESSAGE
from 114-45-59-8.dynamic.hinet.net[114.45.59.8]: <114-45-59-8.dynamic.hinet.net
[114.45.59.8]>: Client host triggers DISCARD action; from=<[email protected]>
to=<[email protected]> proto=SMTP helo=<98.129.169.123>

Yes, I probably should have firewalled out port 25…

This is something that comes up all the time when clients are having PCI compliance scans done on their servers – qmail, by default, allows SSLv2 to be used.

To disable it is very easy.  Edit or create /var/qmail/control/tlsserverciphers and add the following line to it:

ALL:!ADH:!LOW:!SSLv2:!EXP:+HIGH:+MEDIUM

Now restart qmail, and you’re done!

TED + iTunes

Hours spent in front of the TV are essentially a waste of life for me.  But once in a while, something happens and my brain actually works for a few seconds.  On this particular occasion I was on the couch, TV blaring some insignificant noise at me, browsing on my laptop for my daily information overload.

I remembered that I wanted to check if TED has an rss feed.  Sure they do, so I subscribed using my rss reader.   Of course, this gave me 200+ updates, and while browsing through them, I noticed that they contained direct links to mp4 files.  Hey!  Wait a minute!  iTunes should be able to make sense of this feed!  So I tried it, and what do you know – I’m now subscribed to the TED’s videos.

So here’s the quick&dirty.  Navigate to http://www.ted.com.  Scroll down to the rss feed link.  Right-click on it and copy the URL.  Now open iTunes, click on “Advanced” –> “Subscribe to podcast” and paste the URL into the box.  And that’s it!  Sit back and let the videos come to you!   As a bonus, the videos are the right format for the iPhone.  My daily commute just improved a whole lot!

Update (2009/05/05): Of course, the next morning, with a fresh mind, I realised that the TED talks were available as a podcast on the iTunes store.

Today I got tasked with removing duplicate mails from a mail folder with over 100,000 mails in it.  Doing this from a mail client is so impractical, it’s not even worth giving any thought at all.  Fortunately, the mailbox is on a mail server using Maildir style mailboxes, so I knew this could be done with minimum effort.

I discovered the ‘reformail’ utility, part of courier-imap, and after a few trial runs, I settled on the following:

# cd /path/to/mailbox/Maildir/cur

# for i in `find . -type f`; do reformail -D 10000000 /tmp/duplicates <$i && rm $i; done


-D looks for, and deletes duplicates.

10000000 is the length of the temporary file where a list of message IDs will be written

/tmp/duplicates is the aforementioned temporary file.

The temporary file needs to be big enough to accommodate the message ID of each mail.  In this particular case, I have found the average length to be 54 characters, but I would suggest using around double that to be safe.  So adjust to your needs.

In a big mail folder, and especially on ext3, this will take a long time to complete.

I recently decided to move my enormous mail archive from my trusty Courier-imap/Maildir setup to DBmail. The reason is simple.  I have several mail folders with 100,000+ mails in.  That means several directories with upwards of 100,000 files in.   And that means bad performance.    There is another reason:  I can execute far more powerful searches with an SQL query, than any mail client can allow me to do.

DBmail is a POP3/IMAP server that uses a regular database server (currently MySQL, PostgreSQL or SQLite) for its mail store.  Given the obvious advantages, I’m surprised this isn’t more popular.

There is one gotcha to the setup.  MySQL, being Swedish, has a default collation setting of ‘latin1_swedish_ci’ while DBmail assumes ‘utf8_general_ci’ will be set.  But the DBmail docs, and even the MySQL notes page, does not mention this* at all, and the included create_tables.mysql script does not set the correct collation either.   This results in the following error showing up in the logs:

Sep 14 03:00:01 hermes dbmail/maintenance[16708]: Error: dbmysql.c,db_mysql_check_collations(+138): collation mismatch, your MySQL configuration specifies a different charset than the data currently in your DBMail database.

This is easily fixed.  Assuming your database is called ‘dbmail’ do:

mysql> use information_schema;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> select * from SCHEMATA where SCHEMA_NAME = ‘dbmail’;

The ‘DEFAULT_COLLATION_NAME’ column will most likely show ‘latin1_swedish_ci’ – this is the problem.  Run the following:
mysql> alter database `dbmail` collate `utf8_general_ci`;
Query OK, 1 row affected (0.02 sec)

Run the select query again and check if the right collation is showing.  After doing this, dbmail should connect to MySQL without any problems.

From time to time,  Squirrelmail gives this error on a Plesk machine:

Error opening /var/lib/squirrelmail/prefs/default_pref
Could not create initial preference file!
/var/lib/squirrelmail/prefs/ should be writable by user apache
Please contact your system administrator and report this error.

Squirrelmail depends on safe_mode being off.  Let’s see if this is the case:

# grep ^safe_mode /etc/php.ini
safe_mode = On

Since this is a multi-domain system, we want to make changes only to the effected subdomain, in this case the webmail.* subdomain.  But changing the Plesk config won’t help, since Plesk will just overwrite it.   So we create a second file, that will load after, and thus override the Plesk file:

# vi /etc/httpd/conf.d/zz011_squirrelmail_safemode_fix.conf

And add the following:

<Directory "/usr/share/squirrelmail">
     php_admin_flag safe_mode off
</Directory>

Now check your apache config and restart gracefully:

# httpd -t
OK
# apachectl graceful

You may also need to set the following in /usr/share/squirrelmail/config/config_local.php

$default_folder_prefix = 'INBOX.';

Reload Squirrelmail in your browser – it should work now

Have you seen a “suspicious looking” photographer lately? You should read this article by Bruce Schneider, BT’s chief security technology officer.

While I haven’t been hassled yet (not in the UK, at least – US is a different story), it is saddening to read about ordinary people being harassed by police officers, security guards, and yes, even other ordinary people. While people absolutely should be vigilant, it’s really worrying when people are taking on government’s distrust of their own people.

OK, you’ve heard it all before.  And I’m going to spare you the debate. The Gadget Show made some really big prints – one from a Nikon D700 and one from a Nikon F4. The results are interesting, to say the least.

I could poke several holes in their methods, but as I said, I’m going to spare you the debate. Have a look and decide for yourself.