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.