dpkg has a very useful feature where if you delete a conffile (pretty
much everything under /etc and a few other files) it isn’t
replaced when you upgrade the package[0]. This behaviour was
confusing me for a while until I realised what was happening. I was
attempting to reinstall a package to get the default configuration
files back that had been accidentally deleted, but no matter what I
tried, the files didn’t exist after running dpkg. Once I
figured out that dpkg had this behaviour the solution was
simple; use the --force-confmiss command line argument.

root@quux:~# dpkg --force-confmiss -i /tmp/foo_2.0.0-build.14_all.deb
(Reading database ... 33418 files and directories currently installed.)
Preparing to replace foo 2.0.0-build.14 (using .../foo_2.0.0-build.14_all.deb) ...
Unpacking replacement foo ...
Setting up foo (2.0.0-build.14) ...

Configuration file `/etc/foo/foo.xml', does not exist on system.
Installing new config file as you request.
root@quux:~#
[0] If the file didn’t exist in
the previously installed version, it is installed, so you get new
configuration files.

Phishers aren’t even trying these days:

The following things stand out:

  • The date header is +0900. Suspicion rating: 2/10
  • The recorded log in time is in EST. The Halifax and myself are in GMT. Suspicion rating: 6/10
  • The recorded log in time hadn’t occured by the time I get the email. Suspicion rating: 8/10
  • I don’t bank with the Halifax. Suspicion rating: 10 million/10

If you’ve got various indenting and text wrapping options turned on in vim, pasting
text into the editor results in screwed up results. You can get around
this by turning on paste mode using :set paste and off with
:set nopaste. To make things a little easier, you can use the
following snippet in your .vimrc to allow you to toggle paste
on and off using a single keypress:

nmap <F4> :set invpaste paste?<CR>
imap <F4> <C-O>:set invpaste<CR>
set pastetoggle=<F4>

(Warning: my vim settings have organically grown over the last
10 years, so they may not be the best or modern way of achieving an
effect.)

If you’re trying to import a dump file created using
mysqldump and you get an error like:

ERROR 1005 (HY000): Can't create table './Database/Table.frm' (errno: 150)

Then you’ve just been bitten by mysqldump being far too stupid. The
problem occurs because mysqldump includes foreign key constraints in the
initial CREATE TABLE command, so if a table refers to a table
that doesn’t currently exist, it throws an error. mysqldump does
correctly disable the contraints when inserting data into the tables. The correct way for
this would be for mysqldump to create all the tables without the
constraints, use ALTER TABLE to add the constraints to the
tables, and then importing the data into the tables.

The workaround for this problem is to use:

SET FOREIGN_KEY_CHECKS = 0;
source dump.sql
SET FOREIGN_KEY_CHECKS = 1;

Update: Someone has pointed out that it appears that
mysql 5 has fixed
this problem
by including the above statements in the dump.

Breaking news on BBC New24. Just confirmed in the last few minutes.
Very few details…. Last night, Tony Blair converted to Catholism

Why is this news? Who cares? Why is the BBC treating this like it’s
the biggest news item of the year? Why have they rolled out Anne
Widdecomme to do a phone interview? His wife is a catholic, his children
are catholic, it’s been on the cards for a while. He isn’t in power any
more. It remains to be seen if he has any relevance any more. So why
does it matter what denomination he is.

Dear Lazyweb,

I’m possibly asking for the moon on a stick here, but in the office
we have VoIP phones, which talk to our Asterisk server. Unfortunately,
the ringtone on them are incredibly quiet and I tend to listen to music
and don’t notice either the ring or the small green flashing light when
a call comes in.

The question then is does anyone know of a program which will talk
SIP to the asterisk server and notice when a call comes in and turn my
music down and display a notification?

In my
article
on Perl’s IO::Handle objects I talked briefly about IO::AtomicFile
and IO::Digest. I’ve just had reason to use these very useful modules to
create a script which edits a file in place. These modules allowed me to
do the rewrite atomically and optionally make a backup if the contents
have changed. The example assumes you have a function called
perform_rewrite that takes two file handles as the first two
parameters.

use File::Copy;
use IO::File;
use IO::AtomicFile;
use IO::Digest;

sub rewrite_file {
   my $file = shift;
   my $sub = shift;
   my $input = new IO::File($file,'r');
   my $input_md5 = new IO::Digest($input, 'MD5');
   my $output = new IO::AtomicFile($file,'w');
   my $output_md5 = new IO::Digest($output, 'MD5');

   $sub->($input, $output, @_);

   if ($input_md5->hexdigest ne $output_md5->hexdigest) {
           copy ("$file", "$file.bak");
           $output->close();
   } else {
           # we haven't changed so don't bother updating
           $output->delete();
   }
   $input->close();
}

rewrite_file("/foo/bar", &perform_rewrite, $baz, $quux);

Currently listening to Biffy Clyro’s new album, Puzzle, and I have to
say it is definitely their best album yet. It’s up there with
65daysofstatic for best album of the year so far. It’s made a change
from all the recent albums where it’s taken repeated listenings to like
the album. With the first listen I love this album. I am definitely
going to have to see them live more often. I’ve only seen them twice and
the gig a fortnight ago was possibly one of my best gigs ever.

I’m looking to buy either a Samsung E900 or D900 and would like some
horror stories on either phone from the LazyWeb. I’m tended towards the
E900 as it’s a smaller phone, but then the D900 has a better camera. I
haven’t really felt the need for a camera phone, but the quality is
reaching the same as my digital camera, with the exception of not having
an optical zoom.

Particularly interested in tales of slow or confusing UI and success
stories of running an ssh client on it. Not really interested in
recommendations of other phones at the moment. That might come later
when I discover how bad these phones are.

Tim Bray just posted an
entry
about including a comment count in his atom feed. He said that
he soon disabled it as people complained that it meant they saw the
entry again as an updated entry. As I’ve recently done the same for my
atom feed, I’m confused as to why this is happening. In my case I don’t
update either <published> or <updated>, just the
<content> element. As the guid never changes, readers shouldn’t
consider it updated. Do readers really take a hash of the contents and
consider it updated if it changes? Why do readers ignore the date
fields. Is this affecting anyone? Certainly, it doesn’t seem to affect
Planet or the few readers I’ve tried it on.