April 30, 2008

Linux Quickies

Filed under: Emacs, Linux, Tech — Chris @ 8:31 pm

The upgrade from Ubuntu Gutsy to Hardy Heron (cool logo, right?) was relatively uneventful. Some minor points…

  • I always thought the main Ubuntu servers would farm my downloads off to an appropriate mirror, but apparently that’s not the case. You’re likely to get better download times if you choose a mirror in System -> Administration -> Software Sources. If you choose “Other…”, there’s a “Select Best Server” feature. Oddly, my best response times were from New Zealand… maybe because they were all asleep when I tried it.
  • The “ugly fix” for the infamous hard disk annihilating bug stopped working after I upgraded. This new, different (but still ugly) fix worked for me. It would be really great if the Ubuntu team could find a way to make the OS stop trying to kill my hard disk by default.
  • My WiFi light stopped working after the upgrade. This is very easily fixed by installing the package linux-backports-modules-hardy.
  • etckeeper is a great idea: it puts all the config files in /etc under Git, Mercurial, or Bazaar source control and forces APT to commit before and after any upgrade, so it’s easy to isolate and revert changes. (As a side note, using Bazaar for a few weeks makes it physically painful to be forced to deal with CVS.)
  • Anti-aliased fonts in Emacs are really nice. On Ubuntu Hardy, install emacs-snapshot-gtk (on prior releases, downloads “Pretty Emacs”), then run emacs-snapshot instead of emacs (or run update-alternatives to set emacs-snapshot as the default). You should then be able to run, e.g., emacs --font "Monospace-10" and get pretty, pretty (lick-able, as they say) fonts. Other reasonable choices are "BitstreamVeraSansMono-X" or "LiberationMono-X", where X is your desired point size. You can also invoke M-x set-default-font and type your choice interactively, but for some reason the TrueType fonts above won’t tab-complete—if you type a non-existent font, Emacs will silently use the default system fixed-width font (see System -> Preferences -> Appearance -> Fonts). I’ve added the following to my .emacs:

    (if (>= emacs-major-version 23)
    (set-default-font "Monospace-10"))

    (The conditional is necessary if you may come into contact with earlier versions of Emacs, which will barf on TrueType fonts.)

  • In my experience, the fonts in your web browser will look better if you don’t use Microsoft’s gratis TrueType core fonts (package msttcorefonts in Ubuntu/Debian). In particular, the Trebuchet font (which crops up frequently, including at the top of this page) tends to look pretty bad with subpixel rendering turned on. Red Hat’s Liberation fonts (package ttf-liberation) are designed as drop-in replacements for the Microsoft fonts, but I haven’t seen much value in installing them.
  • The instructions I gave last month for hooking up to a projector aren’t complete, because they often won’t let you run the projector at a resolution greater than 640×480. This led to a rather embarrassing scene in front a class of undergraduates, where simply refused to operate at such a pathetic resolution. This problem can be solved by the methods presented here, though it requires a bit of tweaking to get things just so. I haven’t yet discovered a minimal solution—first I need to crack the meaning of the X11 “MetaModes” option. When I do, you’ll be the first to know.

April 15, 2008

Only Thus Can It Be Unmade

Filed under: Linux, Tech — Chris @ 3:08 pm

The cleverer among you will espy the problem below immediately

$ export DATE=`date`
$ echo $(DATE)
bash: DATE: command not found

In my half-caffeinated state, it took several minutes of frustration to figure out what was wrong: $(DATE) is a Make-style variable; in Bash, $(DATE) is the same as `DATE` (a command substitution). The correct token is $DATE.

$ echo $DATE
Tue Apr 15 11:08:38 EDT 2008

I apologize for inflicting my stupidity upon you.

April 3, 2008

On the Subject of Dementia

Filed under: Not Tech, Politics, YouTube — Chris @ 10:35 pm

Ladies and gentlemen, I give you Mike Gravel, former Democratic and current Libertarian candidate for president. (Via Matthew Yglesias, who needs the traffic.)

April 2, 2008

Using an External Monitor or Projector With My Linux Laptop

Filed under: Linux, Tech — Chris @ 9:26 pm

For years, it was difficult enough to get my laptop working with an external monitor that I didn’t even bother trying: I would boot into Windows in order to give a presentation. (This is the only reason I ever booted into Windows (or have a Windows install).) It either got dramatically easier to accomplish this at some point in the last year, or I’ve been incredibly stupid all this time. Just in case, here’s how it works on my Dell Inspiron 6400 running Gutsy. My video card is an NVIDIA GeForce Go 7300

  1. Plug in the external monitor or projector. The monitor may work immediately (especially if you’re repeating this step after fiddling about below), but it may be at the wrong resolution.
  2. Open “Applications -> System Tools -> NVIDIA Settings” or execute sudo nvidia-settings on the command line. This utility is provided by the nvidia-glx-new package, which you should probably have installed.
  3. Choose “X Server Display Configuration” and click “Detect Displays” at the bottom of the screen.
  4. The external monitor should appear in the Layout pane. Click on it, then click “Configure”. Choose “TwinView” (which should hopefully not say that it requires an X restart).
  5. In the “Display” box, choose “Position: Clones”. This means that you want the same display to appear on both monitors. This is what works best for me, particularly for giving presentations. Having separate displays seems to confuse applications—for example, “Presentation Mode” in Evince will “center” the slides, displaying the left half of a slide on the right half of the laptop screen and the right half of a slide on the left half of the projector. It’s probably possible to tweak this with exactly the right viewport/workspace settings (ugh), but that’s not how I roll.
  6. If the display is smaller than the default display—the display’s square will be smaller in the Layout pane and the displayed area will be cropped on the screen—click on the
    default display in the Layout pane and choose a lower resolution. 1024×768 is usually safe. The laptop display will probably look bad, but the external display should look fine.

    Be careful: any smaller than 1024×768 and the Settings applet will be too big to display on the screen. If this happens, you’ll have to navigate blind or hit Ctrl-Alt-Backspace to restart X (or don’t automatically hit OK after the resolution changes and it will revert after 15 seconds).

To remove the external monitor or projector:

  1. Unplug the monitor.
  2. Click “Detect Displays”.
  3. A message “The display device FOO has been unplugged…” will appear. Click “Remove.”
  4. Click “Quit”.

Under no circumstances should you click “Save to X Configuration File” at any point in this process. That’s just asking for trouble.

Some sequence of actions—it’s not clear which—may screw up the “X Server Display Configuration” pane. The display will
continue to function in the meanwhile, but all the above commands are inaccessible. Restarting X made it go away (for me).

[UPDATE] It seems it’s necessary to update your xorg.conf to get decent resolution on some projectors. I’m still investigating… In the meantime, this should help.

Ted Turner is a Demented Genius

Filed under: Not Tech, Waste of Time, YouTube — Chris @ 12:01 am

I now have a man-crush on Ted Turner. (I’m going to have to get in line behind Charlie Rose.) Charlie tries and tries, but Ted Turner has no truck with interrupters.

My favorite part is where they debate whether he should invite Rupert Murdoch to his birthday party. I’m not kidding! It’s starts around 19:00. At 12:45, he sings an entire verse and chorus of “My Old Kentucky Home”! And Charlie just sits there with dewy eyes, like a bleach-blonde skank being serenaded by Bret Michaels!

UPDATE: The embed seems to have died, but the video is still at the Charlie Rose website.

Blog at