Archives / Search ›

lftp deserves an award

lftp is really amazing. Perhaps it seems odd I’m saying this for a command-line utility, but it does what I mean, virtually every single time. I’ve hardly glanced at the manual because it follows the user interface conventions of shells and FTP clients where appropriate, gracefully extending and varying the functionality where it makes sense.

Consider what I tried tonight:

lftp odin:~/zilles/profiling/Maximum bias 0.4> mput -d **/*.pdf

As a zsh user, I’d expect that **/*.pdf would expand to all items with a .pdf suffix in the current directory and subdirectories. Indeed, lftp did what I expected; my files are transferring now.

Aside from edit-in-BBEdit-style functionality, for which I still use MacSFTP, lftp has completely replaced the other command-line and graphical FTP/SFTP clients I used to use. It does a better job than wget at mirroring Web sites. Its caching autocompletion is just the sensible thing to do, and the ability of the fish:// protocol to simulate SCP/SFTP has let me exchange files with old and broken systems: no hassle, no problem.

If you’ve ever struggled with command-line FTP, or SFTP, or wget mirroring, or if you felt the wall between your shell and file transfer client needed breaking down, check out lftp.

Switching to Dvorak

My RSI pain has signifigantly worsened over the past two weeks, triggered by an inadvisable sixty-hour workweek installing the med school’s new mail server. Jeremy Bowers writes about switching to Dvorak, and that’s what I am doing too. Unlike my previous attempt, I am not bothering with a typing tutor program, which can actually increase my pain, but will switch and not switch back.

The biggest problem is not typing text, but keyboard commands. Command-zxcv aren’t anywhere near as convenient when they aren’t one-handed. This one could be worked around with the “DQ” keyboard layout, but that doesn’t help with Mutt or Emacs. So I’m switching to the plain Dvorak “DV” layout, and will just put up with slow typing for a few weeks or months.

RAM vs. AirPort Express, and PowerBook upgrades

Michael McCracken writes about upgrading the memory in his PowerBook, the resulting performance improvement, and not buying an AirPort Express thereafter. Coincidentally, last week I had the same dilemma, but post-AirPort Express release: memory or music? My choice was the same; to upgrade my memory, and stay with my current bizarre music-broadcasting setup (which involves Nicecast, Shoutcast, and three computers) for a while longer at least. AirPort Express does exactly what I need, though; I hope it takes off, and Apple expands it beyond iTunes.

I had a tendency not to upgrade my laptops ever if at all—my PowerBook G3 still has the same 96 MB RAM it had when I bought it in 1998, and its predecessor PowerBook 540 didn’t get upgraded at all, memory, disk or CPU, from 1994 to 1998. But my PowerBook G4 has moved from auxiliary to main machine since I bought it: instead of having my desktop Mac at my research office, I have it at home, and use my PowerBook at school with an external monitor and Linux box through osx2x. Overall, it works very well as long as I don’t try to run simulations on it; but with 14 applications open, it bogs down a bit (Finder, iTunes, osx2x, Safari, Mail, Colloquy, Adium, Emacs, FileMerge, Terminal, OmniOutliner, Graphviz, Preview, BBEdit, to take an arbitrary sample).

If you’re buying memory, make sure you follow a link from a price-comparison site such as dealram; the price for 512 MB PC133 SDRAM at one vendor went down by $15 when I did so. Just knowing that vendor X will have the lowest price isn’t enough.

Update: my memory arrived yesterday; what a difference. With the above applications open, top reports PhysMem: 102M wired, 218M active, 355M inactive, 676M used, 347M free. Some room to run my memory-hogging research software. :)

The incredible shrinking (disappearing?) Mac publications

I couldn’t sleep tonight. I’ve been reading a lot of fiction this week, to the point that I had to put a book down because the imaginary world had become overpowering. I wanted to get back to planet Earth for a while.

In search of technical material, and having left my stack of research papers at school, I noted the lack of Mac publications I usually read in bed. I wasn’t dreaming—there’s a lot less than there used to be.

Consider MWJ. For a mostly-weekly journal (48 issues a year according to the Web site), it’s not doing so well with 13 issues so far this year. I’ve been a subscriber since January 2000; here’s what’s happened to the output since then:

MWJ keeps shrinking...

How about MacTech, the other publication for which I have a paid subscription? There hasn’t been a MacTech issue since the Feburary 2004 one, the longest gap I can remember.

What’s going on here? Are mediocre Web sites enough for everyone, to the point that even worthwhile publications are struggling? Weblogs have done a bit to give me a steady stream of interesting technical news, but the number of well-researched technical articles (of which the best example was BYTE, RIP) is tiny.

Updates: Thanks for the comments, folks. Avi reports that he received an April issue of MacTech, and John the March issue. I might have the March one sitting around somewhere, but what led me to believe February was the latest was that its cover appeared on mactech.com (still does in fact). Guess I should find out if my subscription has been “misplaced.”

The y axis of the graph above indicates kilobytes: it was generated from the “size” column in a Eudora mailbox window. (Earlier versions of the graph had the units labeled, but I had to try so many times to get Excel to do my bidding, that I forgot to include it in the version posted above.)

Sven-S. Porst wrote:

The last time I’ve seen an interesting technical article in a computer magazine was well back in the past millenium. As far as I am concerned the magazines deserve to die. While lots of web content are mediocre, the printed magazines aren’t any better. In fact, authors often seem to be less informed than I am and ‘technically challenged’.

Indeed, this accounts for my lack of support for magazines that just shovel uninformed garbage issue after issue. My point was that even those few holdouts which deliver consistently good content, such as MWJ, are struggling, and I still can’t understand why. Not to sound like a marketer, but I get information in MWJ I see nowhere else—in yesterday’s edition, for example, an interesting point about a disappearing Apple board member and a terrific dissection of undocumented changes in the Mac OS X 10.3.4 update.

Kerberized LDAP from a scripting language, part 2

Patrick Boettcher helped me figure out my problems using Authen::SASL::Cyrus with Net::LDAP.

Authen::SASL supports plugins for different SASL implementations: Authen::SASL::Perl includes pure-Perl methods, and Authen::SASL::Cyrus which talks to Cyrus SASL or SASL2. When it fails to find one of these modules, it gives the “No SASL mechanism found” message. But, in my case, the modules were installed and readable.

I was once again caught by my umask. I had installed a bunch of other modules from the CPAN shell, as root with an 077 umask, and the Perl module searching mechanism, I assume, gave up once it couldn’t access a file or directory, even though none of the inaccessible modules were dependencies of Authen::SASL::Cyrus. The Authen::SASL::Cyrus module, which I compiled manually, was installed and readable.

Finally, I needed to use SASL2; compiling Authen::SASL::Cyrus with SASL1 gave me a Perl equivalent of the useless “Local error” I was seeing in Python. python-ldap had been using SASL2 all along.

Here’s the script I ended up with:

#!/usr/bin/env perl

# Generate aliases from Active Directory users with 'mail' attributes.

use strict;
use warnings;
use diagnostics;

use Net::LDAP;
use Authen::SASL;
use Expect;

\$Expect::Log_Stdout = 0;

my \$timeout = 5;
my \$expect = Expect->spawn('/usr/kerberos/bin/kinit',
                           'postfix@MED.UIUC.EDU')
    or die "can't spawn kinit: \$!\n";
\$expect->expect(\$timeout, 'Password for postfix@MED.UIUC.EDU:');
\$expect->send("password\n");
\$expect->soft_close();

# empty callback so Net::LDAP doesn't override it
my \$sasl = Authen::SASL->new('GSSAPI', 'user' => '');
my \$ldap = Net::LDAP->new('med-banting.med.uiuc.edu',
                          version => 3) || die "\$@";

my \$mesg = \$ldap->bind('', sasl => \$sasl);
\$mesg->code && die \$mesg->error;

\$mesg = \$ldap->search(base => 'dc=med,dc=uiuc,dc=edu',
                      filter => '(&(mail=*)(objectClass=user))',
                      attrs => ['mail', 'userPrincipalName']);
\$mesg->code && die \$mesg->error;

open(ALIASES, '>> /home/lists/aliases');
foreach my \$entry (\$mesg->sorted('userPrincipalName')) {
    my (\$username) = 
        (\$entry->get_value('userPrincipalName') =~ /([^\@]+)\@med.uiuc.edu/);
    unless (\$username) {
        \$entry->dump;
        die "can't understand principal name\n";
    }
    print ALIASES \$username . ': ' . \$entry->get_value('mail') . "\n";
}
close(ALIASES);

\$ldap->unbind;

system('/usr/kerberos/bin/kdestroy');

I got the basic idea of the above from Chris Covington’s Postfix & Exchange 2000/2003 how to.

‹ Newer Posts  •  Older Posts ›