Self-signed certificates in Mail.app

I run my own mail server, including an IMAP server. I use SSL, but I was not about to pay Verisign (or anyone else) for a signed certificate. I had been putting up with the “trust this certificate?” messages every time I started the Apple Mail.app, until I came across this Apple support article.

It describes how to import your self-signed certificate into your key chain, so Mail doesn’t bother you any more.

All’s well that ends well

Two weeks ago, I was sitting at the table eating breakfast and browsing the news on my Powerbook, as I am want to do. In front of me was my bowl of cereal, and to my right, the carton of milk. And just beyond that, my two year old daughter.

You can probably guess what happened next.

The milk went over the front half of the Powerbook, luckily missing the keyboard and speakers. It still seemed to work ok, so I mopped up, packed up and went to work.

When I got there, I noticed the lid catch was a little sticky, but it opened ok and still worked. At the end of the day, I shut the lid and came home.

This was when things turned bad. That evening, I opened up the Powerbook to check my email, and was more than a little disturbed to find the bottom two thirds of my screen didn’t work. Like, it was black. And then, it wasn’t black, but wasn’t being refreshed. weep

I found that by moving the screen back and forth, I could usually get it to come good, but it wasn’t very satisfactory. It seemed get better the longer it was on… probably heat related. But it was pretty much unusable when first fired up.

The service guys at my local AppleCentre had a look, and were suitably impressed. They thought it might just be a loose connection, since the screen cable runs down to the front to connect to the logic board. Or it could be a fried logic board, which would only cost about AUD2,500 to replace. Sigh

Anyway, they booked it in, and called me on Wednesday to say they had time to look at it. So I took it in yesterday. I spent a nervous day working on my linux box, and hardly ever checking the Apple site to review the specs of the newly announced upgraded Powerbooks…

That afternoon, they called with the good news… There was nothing obvious wrong with the hardware, so they just stripped it down, cleaned everything up, re-seated the connectors and put it back together. And that seemed to do the trick. :-D

So now I have my baby back, and it seems as good as new. A happy ending to a potentially disastrous story. And now I make sure there is a good distance between open milk cartons and children.

I’ve done it

I’ve finished it. At last. The Baroque Cycle, Neal Stephenson’s three volume mega novel, sort of a prequel to Cryptonomicon. Roughly 3,000 pages, and when you get as much time as I do to read fiction (i.e. very very little), that can take a while.

It was certainly an enjoyable read, but my rather disjointed reading style did not lend itself to absorbing the complex interrelationships between all the characters and plot threads. I think I spent almost as much time flipping back and forth trying to reestablish the context as I did just reading.

Oh well, maybe when the kids have left home and I’ve retired I’ll read it all again in a single sitting. :) And then I’ll also follow all the historical references and read them too. Right.

Word is not text

Note to self: next time you have occasion to commit a Word document to CVS (dog forbid), make sure you tell it that it’s a binary file, not text.

I foolishly let Eclipse decide for me… and it picked text. Sigh. So a week after I had left the project, I get a call from my ex-manager complaining that certain documents could not be opened. Since one of the last things I did before leaving the job was to wipe my PC’s hard drive, I was a little concerned.

But a quick inspection of the “corrupt” Word document confirmed my suspicion. Every newline (0x0a) character was indeed preceed by a carriage return (0x0d). DOS line breaks! Thanks for that one, Bill!

Anyway, this small piece of Perl hackery later, and the document opened fine (in OpenOffice anyway).

Aqua Emacs Installer

I have been occasionally building Emacs packages for the Mac from CVS. Anyone can do this, of course. Just get the latest source code:

cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/emacs co emacs

change into the “mac” directory:

cd emacs/mac

and run make-package. You need to pass it some options that it gives to autoconf:

./make-package --self-contained -C,--enable-carbon-app -C,--without-x

This will result in a normal Mac installer package, EmacsInstaller.dmg, in the current directory. You can double-click on it in Finder, or use the magic “open” command from the terminal:

open EmacsInstaller.dmg

and install a lovely aquafied carbon emacs.

I’ve found CVS HEAD for emacs to be pretty stable, but it is under active development, and is not an official release, so could be broken on any given day. On the up side, what will become Emacs v22 has some pretty neat new features.

You can download my package, built from HEAD when I get around to it from time to time, here.

Spotlight Weirdness

I’ve had the uneasy feeling for some time that spotlight was not quite the full deal. I’d search for something, and not really be satisfied with the results.

Anyway, today, I needed to find a phone number that I’d mentioned in an Adium chat last week. Something to do with Anthony, and it had two 8s in it. But spotlight denied any knowledge of such a file. :-/ In the end, I browsed my Adium logs manually and found it, but it annoyed me enough that spotlight couldn’t even perform this simple task, that I started looking into it.

The file (that I found manually) was definitely being indexed, since mdls returned all its metadata. But neither the GUI spotlight nor mdfind found it. A bit of googling around turned up no better suggestion than “blow it away”. That is, apparently the spotlight index can become corrupt, and forcing it to rebuild is the only way to fix it.

This is accomplished with the command:

sudo mdutil -E /

(which erases the index for the startup volume).

Of course, OS X will then go and rebuild the index, which in my case took less than a couple of hours.

And now I can find that Adium transcript!

iPod Redux

A couple of cool things of note about my iPod and iTunes 4.9. First, and this has probably been there forever and I just didn’t notice, but when you’re playing a track, and click the “select” button (the centre of the click wheel), the progress indicator changes from a bar to a diamond. I couldn’t figure out why, until yesterday I happened to “spin the wheel” while in this mode—and I was zooming through the track! Cool! This is a much quicker way of moving around in a long track than my previous technique of holding down the forward or back buttons, which would cause the player to fast forward (or back) at about 20x normal speed.

Second, and this is definitely new in iTunes 4.9 (well, firmware 1.4 for the mini anyway): syncing podcasts now checks for what ‘casts will be removed in a sync (because they’ve been played) as well as what will be added before calculating the available space. Previously, it had pained me greatly (having “only” a 6GB mini) that I’d have to manually juggle my iPod contents when syncing if I had lots of new ‘casts. Even though those on the ‘pod that I’d listened to (and would be removed by my smart playlist) would have freed enough space for the new ones, iTunes was not smart enough to work that out. But with the new explicit support for podcasts (they’re a “first class” thing on the iPod now, not just another mp3), the sync removes played ones before updating news ones. Cool++!

I know it sounds like a cliche (ok, is a cliche), but podcasting is really changing the way I think about radio—most of the podcasts I subscribe to are ABC or NPR radio shows, and now I can listen to them when it suits me, not just if I happen to be near a radio (and sufficient silence) when they are being broadcast.

Griffin EarJams Revisited

I was quite quick to complain about about my ear jams. I’m tempering my original judgement a little… after giving them a bit more of a go, I’m finding listening to some types of music decent enough. (E.g. The White Stripes, who seem to be heavy on the mid-range in production anyway, or Beck, where the prominent bottom end really helps.)

Just don’t try for anything like a Bach violin concerto. I’m still saving for a really good pair of in-ear buds.

Got some Griffin EarJams

I really should learn to read reviews before I rush out and buy something…

So, I grabbed a set of Griffin EarJams for my iPod yesterday. I was finding the standard iPod ear buds difficult to keep in my ears if I moved my head at all. And the EarJams promised “massive bass” and “improved sound”, along with the “enhanced comfort” of in-ear buds.

Well, they were certainly right about the massive bass, but they neglected to mention the massively attenuated top end. The “jams” are indeed quite comfortable in my ears, but the sound is muddied and flat.

It’s quite disappointing, because I wasn’t unhappy with the sound quality of the ear buds that came with my iPod, I just wanted them to stay in my ears while I walked. But even after playing with the “eq” settings on the iPod to pull the bass back a bit, I just couldn’t listen to music through the things. I suppose they will be ok for podcasts (such as the excellent ABC Radio National ones).

I guess I’ll have to save up for some “real” in-ear headphones.

Adium script to insert NetNewsWire URL

I quite often find myself reading feeds in NetNewsWire and find something I want to share with a “buddy” in an Adium chat. Adium has a neat little “safari” button that inserts a link to the web page you are currently viewing in Safari, but nothing equivalent for NetNewsWire. And to do it manually is a pain, involving multiple mouse movements and clicks (including right clicks, which are cumbersome with the powerbook) and key presses to cut and paste.

AppleScript to the rescue!

The following bit of AppleScript (my first actual functional applescript!) gets the necessary values from NetNewsWire:

using terms from application "NetNewsWire"
    tell application "NetNewsWire"
        set linkHTML to "<HTML><A HREF=\"" & (URL of selectedHeadline) \
            & "\">" & (title of selectedHeadline) & "</A></HTML>"
        return linkHTML
    end tell
end using terms from

This code needs to be wrapped in the appropriate Adium hook:

on substitute()
    ....
end substitute

Finally, the whole thing needs to be packaged up in a bundle that can be installed in Adium. The source code is available at my svn repository, and the installable bundle can be downloaded from NetNewsWire.AdiumScripts.zip.

Problem adding a user in Mac OS X

Weird… I tried to create an account for a friend on my Powerbook today (Mac OS X Tiger 104.1), and it kept failing. Well, it appeared to work ok (no errors in the GUI), but the account would not be created. I tried a couple of times (thinking I must have hit the wrong button or something), but same result. In the system.log, the following lines appeared:

2005-06-05 09:06:07.121 System Preferences[16863] ### Error:-14120 File:DSRecord.m Line:349
2005-06-05 09:06:07.124 System Preferences[16863] ### Error:-14120 File:DSRecord.m Line:349

A quick google search turned up nothing. So I rebooted and tried again, and it worked. Weird.

Google site search

Finally, I have Google site search working. (See the search box on the left.) I’m not sure what the problem was, but the last few times I tried, google claimed not to have any indexed pages for mojain.com. Which was demonstrably wrong, since I came up in searches. But anyway, it works now. If only I had some interesting content… ;)

Powerbook back in business

So, Friday afternoon I picked up my powerbook, resplendant with its new hard disk. Thanks to Desktop Power for the quick turn around. They had installed panther, so of course the first thing I did was to do a clean install of Tiger.

I briefly considered partitioning the disk to allow me install linux, but I figured… what’s the point? I’m very happy using OS X, and if I need to run linux for some reason, the Ubuntu live cd works a treat.

So a few hours of installing and configuring and restoring later, I was back up and running.

While I had what I thought was a complete backup of my home directory, it turned out there were a few gaps… I had made the backup by dragging /Users/mrowe to an external firewire in Finder. Unfortunately, Finder ignores little things like dot files (.bash_profile, .emacs, .muttrc). :-/

Fortunately, I have the equivalents of all of those files on my linux desktop, so it didn’t take too much work to fine-tune them for my powerbook. But the first thing I did afterwards was whack them all in subversion. :)

Subversion and IPCop

In the default configuration, IPCop’s transparent proxy does not allow subversion to work (when using WebDAV—ssh would be fine of course).

Although the squid proxy supports WebDAV, subversion uses some non-standard methods that squid blocks.

For example, trying to check out a module fails:

svn: REPORT request failed on '/svn/mojain/!svn/vcc/default'
svn: REPORT of '/svn/mojain/!svn/vcc/default': 400 Bad Request (http://...)

Adding the following lines to squid.conf (which on IPCop 1.4.6 is located at /etc/squid/squid.conf) allows svn to work:

extension_methods request REPORT
extension_methods request MKACTIVITY
extension_methods request CHECKOUT
extension_methods request MERGE

You need to restart squid for this to take effect:

/usr/local/bin/restartsquid

Dead powerbook :(

My powerbook died. Well, more precisely, my powerbook’s hard disk died. But it amounts to the same thing.

I’d been noticing an accelerating degradation of performance over the past week or two, starting with little oddities like pauses on disk access, or suspend taking much longer than normal (1-2 minutes as opposed to a couple of seconds), and disturbing noises from deep in the bowels of the powerbook. Then yesterday afternoon, things started going pear-shaped very rapidly.

Simple stuff like moving to the next article in NetNewsWire resulted in the Beachball Of Death, and nothing happening for several minutes. Closing tabs in Safari took similarly forever. Basically, I couldn’t even shut down, and had to resort to ^-Cmd-Power. On restart, the login window came up, but when I tried to log in (which took, again, forever), Finder never really started (no desktop icons).

When I got home, I booted off the Tiger DVD, and managed to save a bit of data to my external firewire disk. The installer gives you a “Tools” menu that includes Disk Utility. So, I launched Disk Utility and used it’s “Create image from folder” functionality to create a DMG on my external drive of my ~/Library folder. It took, once again, forever (at least hours—I went to bed), for a total size of about 500MB. I also tried to do the same thing for my iTunes library, but that was looking unlikely to finish before the heat-death of the universe.

This morning I dropped in at my local Apple Centre (Desktop Power in Ivanhoe, for those to whom it might be relevant). They listened to my description of the symptoms, listened to the noises from the hard disk and quickly agreed with my diagnosis. :( By the time they got it out the back and booted of an external drive, the system wasn’t recognising the disk at all. *sigh*

Anyway, the good news from the whole thing is (a) it’s still under warranty, (b) I made a complete backup before installing Tiger a few weeks ago, and (c) I was planning on doing a fresh install some time anyway. Silver lining and all that…

Displaying a node in a block

I had a requirement to display a custom block on a drupal site, but to allow site editors to update the contents of the block. I don’t particularly want to give editors the ability to create/edit blocks, but they are already able to edit nodes.

A bit of PHP in a custom block does the (somewhat hackish) trick:

<?php
$node = node_load(array('nid'=>1));
echo node_view($node, false, false, false);
?>

Obviously, the node id is hard coded. No, this is not elegant or ideal, but it quickly solves a problem.

Also worth noting is the following snippets of template.php and node.tpl.php in my phptempalte theme, which allow me to contol the display of the “info” (attribution) for node types—if you use a page node as the target of the above block, you can turn off the display of the info line while not affecting story nodes.

template.php:

<?
function _phptemplate_variables($hook, $vars) {
    switch ($hook) {
    case 'node':
        $vars['info'] = theme_get_setting('toggle_node_info_' . $vars['node']->type);
        break;
    }
    return $vars;
}
?>

node.tpl.php:

<?php if ($info): ?>
  <div class="info"><?php print $submitted ?>
  <?php if ($terms): ?>[<?php print $terms ?>]<?php endif; ?>
  </div>
<?php endif; ?>

Got emacs working on tiger

What seemed to make the difference was adding “—without-x” to the configure:

./configure --with-carbon-app --without-x
make bootstrap
sudo make install

(I arrived at this by noticing in the compile error message:

macterm.h:590: error: conflicting types for 'display_x_get_resource'

and on a hunch figured, well, I don’t need X so lets try without it. I haven’t looked in to what I lose by disabling it. *shrug* )

Oddly, the make install didn’t. Or rather, it installed the non-carbon version in /usr/local, but did not install the carbon app in /Applications. Hopefully I will find out why, because I’m sure it did the last time I built emacs on Panther (a week or two ago).

Anyway, I have aqua/carbon emacs working on tiger, and I’m a happy little camper.

Oh, by the way, for those who came in late… the current CVS emacs has native aqua/carbon support, which is how I’m building this. To get it, do this:

cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/emacs co emacs

then the aforementioned configure/make. One of these days I’ll get around to uploading packages.

I’m all tigered up!

So, I took myself off to the local AppleCentre Friday evening, just after 6pm, like a good fanboy. :) Unfortunately, family and social commitments (what sort of a geek am I?) prevented me from installng it until this morning, but now I’m in dashboard and spotlight bliss.

The Good

Apart from all the eye-candy goodness of dashboard, etc., the number one highlight so far is the built-in ability to map caps-lock to control. Which is just as well, because I pretty much can’t use a computer with out the control key where it’s meant to be, and my previous solution, uControl, doesn’t work with Tiger. Big thanks to Apple for making it standard.

The Bad

Alas, alak! Emacs (the aqua version) doesn’t work! The horror! Even a simple rebuild from source didn’t work either. And google didn’t help… So I’m creating this entry in a substandard editor until I find a solution…

A Patch to make blosxom’s entries_index plugin work with symlinks

I’ve been spending some time reorganising my blog and general revision management. Part of this has been to bring it all into a Subversion server, which went well, and to set up blosxom to statically render (so I can just publish HTML files, rather than hit the CGI script for every page view).

This presented a small problem: I use a Mac as my primary machine, but I’m deploying to a linux host. I wanted to set up svn hooks to actually do the render (rather than render locally and upload as a separate step). This gives me a nice workflow for blogging, as I can write away and work on stuff for as long as I like, and when I’m ready to publish I just commit to svn and it automagically gets published on the site.

Anyhow, the problem… because I want to (a) work in a svn-managed directory locally, (b) view the site locally, which under Mac OS X defaults to ~/Sites, and (c) publish to ~/public_html on the linux box, I need to use symlinks. But this didn’t work with blosxom’s static rendering. :(

It turns out that blosxom, or in my case the entries_index plugin, uses File::Find, which defaults to not following symlinks. So without further ado, herewith and henceforth, a patch to entries_index to cause it to follow symlinks:

Index: plugins/entries_index
===================================================================
--- plugins/entries_index   (revision 21)
+++ plugins/entries_index   (working copy)
@@ -18,9 +18,39 @@
   1;
 }

+my(%files, %indexes);
+
+sub process_files {
+    my $d; 
+    my $curr_depth = $File::Find::dir =~ tr[/][]; 
+    if ( $blosxom::depth and $curr_depth > $blosxom::depth ) {
+      $files{$File::Find::name} and delete $files{$File::Find::name};
+      return;
+    }
+ 
+    $File::Find::name =~ m!^$blosxom::datadir/(?:(.*)/)?(.+)\.$blosxom::file_extension$!
+      and $2 ne 'index' and $2 !~ /^\./ and (-r $File::Find::name)
+        # to show or not to show future entries
+        and (
+          $blosxom::show_future_entries
+          or stat($File::Find::name)->mtime <= time
+        ) 
+          and ( $files{$File::Find::name} || ++$reindex )
+            and ( $files{$File::Find::name} = $files{$File::Find::name} || stat($File::Find::name)->mtime )
+              # Static
+              and (
+                param('-all') 
+                or !-f "$blosxom::static_dir/$1/index." . $blosxom::static_flavours[0]
+                or stat("$blosxom::static_dir/$1/index." . $blosxom::static_flavours[0])->mtime < stat($File::Find::name)->mtime
+              )
+                and $indexes{$1} = 1
+                  and $d = join('/', (blosxom::nice_date($files{$File::Find::name}))[5,2,3])
+                    and $indexes{$d} = $d
+                      and $blosxom::static_entries and $indexes{ ($1 ? "$1/" : '') . "$2.$blosxom::file_extension" } = 1;
+}
+
 sub entries {
   return sub {
-    my(%files, %indexes);

     if ( open ENTRIES, "$blosxom::plugin_state_dir/.entries_index.index" ) {
       my $index = join '', <ENTRIES>;
@@ -32,34 +62,7 @@
     for my $file (keys %files) { -f $file or do { $reindex++; delete $files{$file} }; }

     find(
-      sub {
-        my $d; 
-        my $curr_depth = $File::Find::dir =~ tr[/][]; 
-        if ( $blosxom::depth and $curr_depth > $blosxom::depth ) {
-          $files{$File::Find::name} and delete $files{$File::Find::name};
-          return;
-        }
-     
-        $File::Find::name =~ m!^$blosxom::datadir/(?:(.*)/)?(.+)\.$blosxom::file_extension$!
-          and $2 ne 'index' and $2 !~ /^\./ and (-r $File::Find::name)
-            # to show or not to show future entries
-            and (
-              $blosxom::show_future_entries
-              or stat($File::Find::name)->mtime <= time
-            ) 
-              and ( $files{$File::Find::name} || ++$reindex )
-                and ( $files{$File::Find::name} = $files{$File::Find::name} || stat($File::Find::name)->mtime )
-                  # Static
-                  and (
-                    param('-all') 
-                    or !-f "$blosxom::static_dir/$1/index." . $blosxom::static_flavours[0]
-                    or stat("$blosxom::static_dir/$1/index." . $blosxom::static_flavours[0])->mtime < stat($File::Find::name)->mtime
-                  )
-                    and $indexes{$1} = 1
-                      and $d = join('/', (blosxom::nice_date($files{$File::Find::name}))[5,2,3])
-                        and $indexes{$d} = $d
-                          and $blosxom::static_entries and $indexes{ ($1 ? "$1/" : '') . "$2.$blosxom::file_extension" } = 1;
-      }, $blosxom::datadir
+      { wanted => \&process_files, follow => 1 }, $blosxom::datadir
     );

     if ( $reindex ) {

Phew.

There’s probably a neater way to do that, but it Works For Me.

Blosxom static rendering and the Textile plugin

There’s a known problem with the Textile plugin for blosxom in static rendering mode. http://groups.yahoo.com/group/blosxom/message/4052

I reproduce the relevant patch here:

--- plugins/1textile2   (revision 21)
+++ plugins/1textile2   (working copy)
@@ -51,6 +51,7 @@
 #   image_rel_base     relative image filenames relative to this

 sub blostile {
+    local $_;
     my $str = shift @_;
     my $ctx = shift @_;
     if (!$textile) {