Customizing Apache Directory Listings with .htaccess

I was clearing off my desk today when I found an article I've been meaning to scan and send to somebody -- the story of how my friends almost elected a dalmatian and squirrel to the homecoming court of the University of North Texas in 1989. The alumni magazine wrote a feature on Hector the Eagle Dog and Agnes the Squirrel's campaign, which attracted national media and made a few of the human homecoming candidates very angry.

I can never tell when a file's too big to send in email without aggravating the recipient, so I upload files to my server and email the links instead. I decided to make this process easier by creating a clippings directory where uploaded files show up automatically.

The Apache web server can publish a listing of all files in a directory, as the official Apache site does in its images subdirectory. I wanted to make my clippings page look more like the rest of my weblog, so I found a tutorial on customizing directory listing pages.

First, I created an .htaccess file in the directory and turned directory indexing on with this command:

Options +Indexes

This command only works on servers that are configured to allow users to change options. For security reasons, I turn directory listings off by default, so they only appear when I specifically configure a directory to reveal its contents.

Next, I created header and footer web pages that contain the HTML markup to display above and below the directory listing. These files are identified by two more commands in .htaccess:

HeaderName header.html
ReadmeName footer.html

These web pages are located in the clippings directory. For the final step, I added a description of PDF documents and made sure that the header and footer files are not included in the listing:

AddDescription "PDF Document" .pdf
IndexIgnore header.html footer.html

There's a lot more that can be customized in an Apache directory listing, as the tutorial demonstrates, but for my project it seemed like overkill.

Update: Alternatively, I could've checked to see if the story was already online. Auugh.

Sharing Bookmarks and Feed Lists with XML

I'm working on a programming project that requires an XML format to represent bookmarks and other collections of URIs, but before I reinvent the wheel I'd like to see if there's an existing format that meets my goals. The format should be able to hold all of the following information:

There are several potential formats that could be put to use: XBEL, the outline formats OPML and XOXO and the syndication formats RSS and Atom. Each has drawbacks, as I'll go over in upcoming posts here on Workbench.

I'm starting with XBEL, because that's the best-supported format specifically designed to hold bookmarks. XBEL was created in 1998 by members of the Python community led by Fred L. Drake Jr. XBEL 1.0 continues to be the only release, though there's occasional talk on the XBEL-Specs mailing list about developing a new version.

XBEL was designed to represent browser bookmarks and has become the native format for storing them in the Konqueror and Galeon browsers. There are add-ons that extend XBEL support to more popular browsers -- one example is SyncPlaces, a Firefox add-on that can manually import and export XBEL bookmarks.

Here's what a bookmark looks like in XBEL data produced by SyncPlaces:

<bookmark id="row123" added="2008-11-25T17:30:22.352" modified="2008-11-25T17:30:22.522" href="https://workbench.cadenhead.org/">
  <title>Workbench</title>
  <info>
    <metadata owner="Mozilla" dateadded="1227634222352963" lastmodified="1227634222522963"/>
  </info>
  <desc>Rogers Cadenhead's personal weblog</desc>
</bookmark>

Bookmarks in XBEL can be grouped into folders, which themselves can contain more folders to create a hierarchy. The format's well-designed and can be extended by namespaces or the metadata element, which in the preceding example carries Firefox-specific information.

There are several drawbacks to using XBEL. The format predates social bookmarking and lacks support for tagging bookmarks or assigning them to categories like the ones employed by the Open Directory Project.

XBEL also predates the popularity of syndication, so there's no way to identify that bookmarks are RSS or Atom feeds. You also can't establish a relationship between a web site's home page and its feed. A few years ago on XBEL-Specs I floated the idea of adding type and rel attributes to bookmarks that function like they do in Atom, which would be all that's required to publish blogrolls and feed subscription lists with the format.

XBEL can't be used for web directories, feed lists or social bookmarks without extending the format. I think all three are strong enough use cases to be part of a bookmark format's core set of elements. If I choose XBEL, most of my project's functionality won't be supported by today's XBEL tools or client libraries, which is the primary reason to adopt an existing format.

Jeff Bridges Visits the Dentist

Jeff Bridges visits the dentistThe actor Jeff Bridges passes along a fish tale I hadn't heard before, concerning a fisherman in Wichita, Kan., who saw a basketball behaving oddly in a lake:

It turned out to be a flathead catfish who had obviously tried to swallow a basketball which became stuck in its mouth!!

The fish was totally exhausted from trying to dive, but unable to because the ball would always bring him back up to the surface.

Bill tried numerous times to get the ball out, but was unsuccessful. He finally had his wife, Pam, cut the ball in order to deflate it and release the hungry catfish.

The story appears to be legit, according to About.Com's Urban Legends site.

The tale led me to Bridges' blog, which he publishes entirely in the form of doodles. His October update includes this drawing from his most recent dental cleaning, where his hygienist offered him a headlines and "pretty images + music or a dose of terror." He chose terror.

Bridges' doodles make particularly inspired use of hyperlinks, such as the one that promotes his upcoming-in-2010 film Men Who Stare at Goats. "Click goat droppings for information," he urges.

Most Expensive Magazine Subscription Ever

I subscribe to Pyramid, a roleplaying game magazine published for the past 15 years by Steve Jackson Games. The company keeps track of past orders so you can redownload issues in PDF format. I found a surprise when I checked my subscription today.

Pyramid Magazine subscription costs $23 million dollars

That's probably a bit more than I should have spent, but the deduction will make it a lot easier to pay my 2008 taxes.

NBC Cancels 'My Own Worst Enemy'

NBC has cancelled the new Christian Slater spy drama My Own Worst Enemy and the returning series Lipstick Jungle, according to Live Feed:

NBC's expectation for the return of Lipstick was modest, but Enemy was considered an important show. A spy thriller with a grown-up budget inspired by the Bourne movies, Enemy received NBC's coveted post-Heroes time period. That valuable Monday hour of scheduling real estate has become less worthwhile in recent weeks, however, as Heroes shed viewers -- weakening the lead-in for Enemy and hastening its decline.

I tried My Own Worst Enemy a few times and thought it was fun to see Slater argue with himself in video voicemail, but the series made some odd decisions, like casting pudgy comic Mike O'Malley as an international superspy. Television's Jonathan Bourne convinced me to put it on my TV Death Pool, where I ranked it the ninth-most likely cancellation.

I tried most of the new shows this TV season, giving up on everything but Fringe and Life on Mars. The latter series is a surreal cop show in which Jason O'Mara plays Sam Tyler, a modern New York police detective thrown back into the '70s, where he works cases old school with Harvey Keitel, Michael Imperioli and Gretchen Mol. (It appears that Tyler's in either a coma or purgatory -- there are occasional discontinuities, like when he spots a clubgoer wearing a Nirvana T-shirt at a time when Kurt Cobain would've been six years old.) The cast is unbelievably good, and the series keep finding great music in a decade where I thought none could be found.

Here's a sample episode's soundtrack, as described by Drake Lelane, who writes a regular music on TV feature for Film.Com:

  1. "Wild in the Streets," Garland Jeffreys
  2. "Ice Ice Baby," Vanilla Ice
  3. "I'm Gonna Keep on Loving You," Cool Blues
  4. "Come on and Gettit," Marion Black
  5. "He Keeps You," Boscoe
  6. "Anywhere in Glory," The Mighty Indiana Travelers
  7. "Everybody is a Star," Sly & the Family Stone
  8. "Black and White," Three Dog Night

"Ice Ice Baby" snuck into the episode when Det. Tyler used it to impress gun-toting black nationalists who kidnapped him. As Lelane observes, "only in 1973 would laying down the rhymes of Vanilla Ice's 'Ice Ice Baby' be considered cool."

Mike Masnick: Newspapers Have Become Souvenirs

The morning after Election Day, I had to make four stops before I found a store that still had a copy of the New York Times, beating a spry older woman by seconds. She was not happy, but her plaintive "I was going to buy that" fell on deaf ears. The unifying spirit of the moment did not mean I was handing over the last copy of the paper of record. Hit the bricks, grandma!

Like some newspaper editors I saw quoted in the media, I took heart in the mad dash for papers taking place all over the nation. I thought it was a sign that even in these disintermediating times, people still need the paper. Mike Masnick of Techdirt posted a crushing takedown of this premise:

... it sounds as though many newspaper publishers got exactly the wrong lesson from this. Some publishers celebrated the rush to buy newspapers as evidence that newspapers were still relevant and that in "big events" people still turned to print papers. Except, that's not true. Publishers who believe that are deluding themselves. People got the actual news from the internet and TV. The newspapers just represent a souvenir of the event -- not the place to turn to for news about it.

The copy of the Times I bought Wednesday morning still sits on my desk unread. I got the news online.

Sarah Palin's Long Road to the White House

One night, Schmidt and Salter went to her hotel room to brief her. After a minute, Palin sailed into the room wearing nothing but a towel, with another on her wet hair. She told them to chat with her laconic husband, Todd. "I'll be just a minute," she said. Salter tried to strike up a conversation. He knew that Todd was half native Alaskan and a championship snow-machine racer.

"So what's the difference between a snowmobile and a snow machine, anyway?" Salter asked. "They're the same thing," Todd replied. "Right, so why not call it a snowmobile?" Salter joshed. "Because it's a snow machine," came the reply.

Later, Schmidt and Salter went outside so that Salter could have a cigarette. "So how about the Eskimo? Is he on the level?" Schmidt asked. Salter just shrugged and took another drag.

-- Newsweek, "Secrets of the 2008 Campaign"

There's a ferocious campaign being undertaken on right-wing blogs to blacklist campaign aides for John McCain who are trashing the reputation of Sarah Palin in media interviews. Erick Erickson, the founder of RedState.Com, calls this campaign Operation Leper:

We intend to constantly remind the base about these people, monitor who they are working for, and, when 2012 rolls around, see which candidates hire them. Naturally then, you'll see us go to war against those candidates. ...

We are rooting for Sarah Palin. Don't make us add you to our list. Do you really want to be next to Kathleen Parker in the leper colony?

If this effort is motivated by a desire to see Palin in the White House in four or eight years, I think her supporters have a much larger task ahead of them than they realize. Even if she softens her reputation as a sharp-elbowed social conservative and establishes her credibility as a presidential aspirant, Palin finds herself in a country that has been brutal on politicians who lose a presidential race as the second banana.

In the history of the U.S., only one unsuccessful vice presidential candidate has gone on to become president. Franklin D. Roosevelt, who was then Assistant Secretary of the Navy, lost the 1920 election as the running mate of Democratic presidential candidate James Cox. Republican Warren Harding won the race in a Republican landslide. Twelve years later, Roosevelt was elected president.

In the intervening 12 years, Roosevelt practiced law and remained active in Democratic Party politics, giving nominating speeches for fellow New Yorker Alfred E. Smith at the 1924 and 1928 national conventions. He was elected New York's governor in 1928 and re-elected in 1930 before running for president. Palin and Roosevelt share a gubernatorial job from which to launch a presidential run, but New York was the largest state in the nation when he led the state. Alaska's smaller than 46 states and Puerto Rico.

Most losing vice presidential candidates couldn't even get their own party's nomination for president later. John Edwards and Joe Lieberman tried and failed, and I suspect that would be the outcome of a future Palin presidential run, no matter how well she masters the continents.