2008/04/26

Scripts for the "Labels" links in my sidebar

There is probably some good pre-fab way to get Blogger to publish links to your blog labels (when you host the content on your own site), but I did not find anything official. Because I have infinite time to waste on web development, I wrote my own scripts instead of using someone else's. I figure I'd share these scripts, so that everyone else can look at them then decide to write their own, too. You can see the finished result in my sidebar on the right, in the Labels section.

There are 3 steps:

  1. Get the labels and make html (bash script)
  2. Make the resulting html embeddable in a webpage (javascript)
  3. Modify my blogger template

It was pretty easy to fetch all the labeled content, using the ls command in the labels/ directory (I am running my webserver on a GNU/Linux system). Then I massaged the output until I had line breaking, label separators, and number-of-posts per label. I put these steps together in my label_lister bash script, because I didn't want to use php (or similar) to access my filesystem. It might be useful to look at the raw output from my labels_lister script. Of course I had to enable cgi scripts in my apache config.

The next step was harder: getting the bash script's output into my blogger-generated index.html file. I chose not to use Server Side Includes to embed the labels html into the blogger-generated index.html file, because I thought I would have to enable SSI for all .html files and that was discouraged by the apache manual.

Instead, I used XMLHttp with javascript. I've done this in greasemonkey scripts in the past, which hides browser implementation details and some other stuff I did not previously realize. Still, the javascript was not too hard. Here is my script: get_labels.js.

Finally, I modified my blogger template. In the blogger template's head, I sourced my javascript:

<script type="text/javascript" src="http://notes.komarix.org/js/get_labels.js"></script>

Then I added one extra CSS class in the template's head:

#sidebar div {
  margin:0 0 1.5em;
  padding:0 0 1.5em;
  border-bottom:1px dotted #ccc;
  }

Finally, I added my Labels section to the sidebar, below the links section, and above previous posts section:

  <MainOrArchivePage>
  <h2 class="sidebar-title">Labels</h2>
  <a href="/">(click here to undo label selection)</a><br /><br />
  <div id='labelsList' class='sidebar-div'>
    <ul>
      <li><a href="/labels/yoga.html">Yoga</a></li>
    </ul>
    <script>getLabelItems(document.getElementById('labelsList'));</script>
  </div>
  </MainOrArchivePage>

And that's it. Possibly more work than it was worth, except that I refreshed my memory on javascript and cgi details, and learned a little bit of new stuff. If I were doing it over, I'd probably start with the bash script and tell apache to do SSI for all .html files. I doubt the server load would be that large, especially for my blog. =-)

Labels:

2007/04/02

Thule Rack and Yakima Bike Carrier on 2000 VW Golf IV 5-door

This certainly isn't the topic that inspired this blog, but I probably ought to get this stuff down in print somewhere. We installed a Thule rack on our 2000 VW Golf IV (5-door) today. The instructions looked simple, there were only two steps. That should have been our first clue that Thule's directions omitted important information. The second clue was that we shouldn't have needed to fetch the deadblow mallet to complete the installation.

Once we gave up on Thule's directions and universal application of brute force (save one exception), things went fairly well. Here's what I can remember. Unfortunately, I have no photos.

Regarding Thule's step 1:

  • Go ahead and attach the rubber pads to the base of the "towers" (the things the crossbars go through), but don't stick those little wedges in yet (the wedges set the angle between the tower and the tower's base). I don't care what Thule says, they're wrong. If you stick those wedges in and continue to step 2, you'll probably find it very hard to insert the crossbars. The crossbars should slide in somewhat easily, if you follow the steps below that Thule forgot to include.
  • On the side of the tower that would face the middle of the roof, slightly above the tower's base, there's a couple pieces of interesting plastic. The lower, wider piece has teeth in a sawtooth pattern, though you might not be able to see that. The other, narrow piece looks a little like a lever or release clip of some kind. Squeeze those pieces together, lifting the lower piece's teeth above the metal slot (you'll figure it out). This allows you to pull those plastic pieces out a bit, which rotates a metal piece a bit in the middle of the tower. This will create a little extra space for the crossbar to slide through. Let's call this metal piece in the middle the "nut-gizmo", since it has a threaded hole in it.
  • In step 2, you'll insert the crossbar. Before you do that, put the plastic housing over the towers. Then slide the bar through two towers. Put the towers over the clips (see step 2 to make sense of that), and center the crossbar.
  • Now you can put the little wedge thing in.
  • Finally, put the screw through the oval hole in the clip, into the "nut-gizmo" we mentioned earlier (don't forget the little plastic part that goes on the screw first, and pay attention to its orientation). As you tighten the screw using the attached plastic handle, you'll be pulling the nut-gizmo back in to its original position. You might have to push down on the lower, wide plastic part with the teeth to lock it into position (though the screw does that as well).
  • When centering the crossbars, this info might be useful: We used the 50" crossbar. On the front crossbar, we had about 105mm extending beyond the towers (I think, but I don't remember the front measurement so well). For the rear crossbar, we had about 135mm extending beyond the towers.

Regarding Thule's step 2:

  • The 2000 VW Golf has nice little posts that the rack hardware attaches to. The directions for this are fine, except they don't warn you that you'll need a mallet to get the Thule adapter clip over the top of the post (this is the exception to the no-brute-force rule).
  • The posts come in pairs, two front and two back, and are located somewhere above the front door and above the rear door. You'll use the "inside" posts that are closest together. Thule explains this well-enough.
  • The distance of 180mm from windshield to the inside-front post, and 700mm between the inside-front post and inside-rear post are completely wrong, at least for my Golf IV. Perhaps not coincidentally, 700mm is the minimum distance between the front and rear support. I guess they meant to say "at least 700mm".
The Yakima Viper bike carriers went on easily. A lot of Yakima and Thule gear have been designed to work with each other's racks, which is definitely good for us users. The one thing I don't like about the Viper carrier is the rear strap. With the narrow-ish road tire on my wife's mountain bike, it was very hard to ratchet the strap down tight, and even hard to get it to release. It seems Yakima simply choose too stiff of strap. On the upside, Yakima had about 13 very detailed steps for the bike carrier, in contrast to Thule's crappy directions.

In case you wonder why I bought a Yakima carrier for a Thule rack, it's because I like the square crossbars that Thule used, and I liked the toolless install on the Yakima Viper carrier. Thule's Echelon carrier *might* be toolless, but they don't say that in their catalog, and my local REI didn't have one in stock. Yakima says their round crossbars are stronger, and I suppose they are more aerodynamic, but neither of those is likely to be important. My car roof hold at most 185 pounds (including the rack and bike carriers), and I'm sure that Thule's square bars are more than adequate. On the other hand, stuff I clamp to a single square crossbar won't rotate, e.g. the Thule "load stop" (Thule part 503, listend under "Boat Mounts and Accessories" for no apparent reason).

Thule (which seems to be pronounced Tool-ie) has some sort of online instructions. I didn't find those until I was writing this blog, and I don't think they're mentioned on the paper instructions. Even had I found them earlier, they don't seem to work with Firefox 1.5.10 on GNU/Linux, so Thule's fancy online instructions wouldn't have helped me.

One last bit of info we didn't find online anywhere: Thule and Yakima's locks are *not* interchangeable. Thule's locks include the lock core and the part that actually does the locking. Yakima's locks are just the core, with a little pin that sticks out. Yakima's lockable equipment has a receptacle for the little pin, and the rotating foot that does the locking is attached to that receptacle.

All in all, my wife and I spent two hours attaching our new rack and carrier. I'm looking forward to spending time using it, instead of spending time attaching it.

Labels: