rlucas.net: The Next Generation Rotating Header Image

May, 2007:

Highway 202 North of Snoqualmie Falls Sucks Right Now

A quick note for any of you thinking of heading out to Snoqualmie Falls en moto right about now (late May 2007). The road getting there from I-90 was just fine, and indeed, at the falls there were plenty of bikers (no place to park, even!).

However, if you continue north on Highway 202 (SE Fall City-Snoqualmie Rd) after the falls, you’ll hit about a mile of twisties with heavily grooved pavement. It sucks. Be real aware of this if you’re planning to visit (or pass by) Snoqualmie Falls on your bike this summer — hills plus curves plus thick grooves make for an unpleasant if brief part of the trip.

Just How F’ed Is The U.S. Dollar? I’ll Tell You.

Here’s how F’ed the U.S. Dollar is right now. If you go for a bit of shopping in Montreal over the weekend these days, you probably pay with your credit card to try and get the best exchange rate. When you next get online and look at your credit card statement, you will be shocked to find:

the USD-CAD exchange rate is so poor right now that, after taxes, you pay more U.S. dollars for your purchase than the price tag in Canadian dollars originally said!

Cheers to our northerly neighbors, I guess. (Although it does kind of put the lie to the whining I heard from some Ontario snorkelers when in Florida, that the boat skipper ought to give them a break on account of exchange rates.)

How To Be a Biker

If you want to move longer distances than your legs (walking or biking) carry you, such as between major cities or, within our metropolises, from the mire of suburbia to the oases of interestingness, and the generally crappy mass transit options found in the U.S. aren’t compelling for your purposes, it seems that you really have no choice but to give in to car culture and become an automobile driver.

This is a shame, because obligate car culture frankly sucks. It’s wasteful not only of fuel but of resources in the cars themselves. Worse, it constricts the mind’s range by giving a low-activation-energy default pathway for transportation needs, and promotes a positive-feedback loop of car reliance (I have to drive around and find parking so that I can, er, drive some more). And that’s just the effect on the driver; obligate car culture does horrific things to neighborhoods, commercial districts, etc.

(I use the term “obligate car culture” to define a style of living and interacting that requires a car. Rich people, poor people, hippies, students, bobos, and some yuppies can escape this. But the vast numbers of Americans living in suburbs and exurbs — who can’t walk, bike, or reasonably quickly (circa q 15 minutes) get on mass transit to get to places to work, eat, shop, play, and socialize — are obligated to have access to a car or be a pariah.)

In fairness, the pluses of car driving — when everything goes right — are substantial. For a small price, you can go any distance from a few blocks to all the way across the country. Modern vehicles, even the cheapest, are amazingly reliable (if wanting in many other aspects of engineering) and capable of exceeding legal performance limits. The interstate system is a marvel and will take you within a mile of every urban center in the land.

But a car is at least a metric ton of steel, glass, and assorted crap that you’re dragging with you, despite the fact that a knowledge worker typically only needs himself, some papers, and perhaps a laptop wherever he goes for work.

But there’s another means to getting your transportation needs fulfilled. A personal, more human, and cheaper way to travel at high speeds. That way, is, of course, via motorcycle (or scooter, as the case may be).

Let’s take a look at some of the benefits of travel by motorcycle:

  • Lower capital costs. A motorcycle in good repair can be purchased for $500 to $5,000, used, whereas a decent used car will typically start at $5,000.
  • Lower insurance costs. It’s not unreasonable to expect to pay $300 a year for a relatively vast amount of coverage ($250k of liability protection, well above the legal requirements), whereas the same in a car would be a minimum of $1,000 a year.
  • Lower fuel costs. 40-60 MPG is the norm for small- to mid-sized bikes, whereas one would need to shell out for a Prius or a Smart in order to get that kind of mileage on four wheels.
  • Use of HOV (“carpool”) lanes in many states.
  • Lane-splitting (“white-lining”) in California.
  • Occasionally preferential parking. This is dodgy because sometimes you get the shaft by having to pay the full auto rate, but sometimes you get cheap spots, can sneak into smaller on-street spaces, or can downright cheat by parking in (legal, legit, off-street) nooks and crannies.

The downsides are worth considering:

  • Getting creamed by some asshole in an SUV is a real possibility, and injuries in that case are certain.
  • Weather can be a downer.
  • Passenger capacity is limited to one, and then only with appropriate gear, skill, and mutual confidence.

The negatives do have some mitigating factors that should be mentioned, though.

In the case of accident and injury factors, you can self-select out of the highest-risk categories with three easy steps. First, take a course, such as the Motorcycle Safety Foundation‘s Basic RiderCourse, which qualifies you for a motorcycle endorsement to your license. This takes you out of the dangerous “self-taught” and “friend/family taught” categories, and takes you out of the “unlicensed” category (NEED CITE). Then, buy appropriate head-to-toe gear — “no skin below the chin” — including a full-face helmet. The helmet alone reduces your risks of the most grievous injuries and death substantially — but make sure it’s full-face, since post-crash analyses of helmet damage areas show that the chin bar takes damage in about a third of head-banging incidents. Really quite decent gear can be assembled for the low side of $500 — consider it a one-time spend of the first year’s car-vs-motorcycle insurance delta. Third, never drink and bike — even if you’re the type who will drive after a beer or three, change that habit for the motorcycle. Studies and anecdotes suggest dangerous impairment well below .08 % BAC for motorcycling (NEED CITE). And there — with three simple maneuvers — you’ve sliced out huge chunks of the risk of major injury or death. Perhaps not quite as safe, still, as being in that SUV, but a minimum of $25,000 cheaper and a thousand times cooler.

(Helmet damage distribution. Used without permission from flamesonmytank.co.za, who in turn used it without permission from David Hough’s Proficient Motorcycling.)

Regarding weather, you’d be amazed at how good the waterproof textile gear can be. I spent a full 8-hour day in the pouring Seattle March rains, doing low-speed exercises outdoors in an instructional course, and my Firstgear jacket kept me completely dry and entirely warm from the waist up, including protecting my cell phone from the elements. (My bottom half, in makeshift “water resistant” gear, was completely soaked.) Gore-Tex is off patent these days, and so everyone and their brother uses it or a knockoff to make waterproof, breathable materials. The technology is to the point where you can practically dress up in black tie, then slide on your waterproof gear, head out in the rain on your bike, and upon arrival, shed the wet stuff and emerge no more rumpled than you might get sitting on a crowded train or bus.

So, when it comes down to logistics, how does a carless urban yuppie type (like your humble correspondent) actually effect becoming a biker?

1. Find a Basic RiderCourse, sign up, and take it. Mine was 12 folks; about 2/3 owned bikes already, and 1/3 were complete novices. I’d been on a bike once (tearing up empty lots on a buddy’s dirtbike down in Oregon as a teenager, before flipping the thing upside down in a misguided wheelie attempt), but there were at least two folks who’d never ridden in their lives. Around Seattle, market for the unsubsidized courses is $240 for an evening of classroom work and two days of riding (state subsidies bring the cost to $100 for some dates, but those fill up fast).

2. If you’re still positive after the course, get your license endorsement. Generally you have some period of time from passing the course to presenting it at the DMV. Washington wants, I believe, $25 for the chore of endorsing your license.

3. Sketch out a feature range and price range for your bike. I recommend spending time on dealership websites to get a feel for new prices and the various available models; then, do likewise on Craigslist and eBay to get the used prices and the (different) models available. Bikes last forever if properly maintained, and it’s not unusual to find Japanese bikes from the 1970s offered for sale today. 1980s bikes are even more common. (However, surviving bikes from the ’60s and earlier become expensive collector’s pieces.)

But these are distinctly different types than one sees today. Since the late
1990s, bike manufacturers have concentrated on two kinds of street bikes: cruisers (kind of “chopper” or “Harley” lookin’ types, low seat, chrome, forward foot position) and sport bikes (“crotch rockets”, with bright colors and plastic, with a forward lean and a rearward foot position). This has pretty much meant the death of the “standard” motorcycle, though Honda still makes the Nighthawk in this category. Another victim of this change is the mid-displacement bike. It used to be that one could buy motors in 125, 250, 450, 600, 750, and 1000 cc sizes (roughly). Now, the 250 cc motors are still around on Yamaha Virago and Honda Rebels, but there’s really nothing until you get to 650-750 cc engines. This is widely viewed as a shame because a 450 cc standard bike, such as might have been common in the 1980s, is a great starter bike but is unavailable new today. (However, see below for a caveat on buying an older bike.)

4. Find a place to get your bike worked on and to park it. These two logistical hurdles are not insubstantial. A lot of the cheaper bikes you’ll find for sale are sort of DIY projects on wheels; unless you have, or want to acquire, tools, skills, time, and a work area, you’ll need to trade your treasure to someone with these things. Complicating matters, dealerships and service facilities sometimes limit the model years they will work on. This will, therefore, interplay with #3 above. (This was a factor in my decision to buy used from a dealership.) Parking, depending on your area, may require permits for on-street, or may require a parking pass. However, be sure to ask around for “boots-on-the-ground” info about motorcycle parking in your neighborhood. There are certain facilities and areas where one can park a bike for free, but these are unlikely to be publicized on the Internet for fear of overuse or loss of the privilege, so talking with local bikers, garage attendants, etc. can be rewarding.

5. Find a way to get the bike home from purchasing it. (I agree with the author of the article linked above that riding the bike home is a last resort; I did so, but it was under half a mile, early on a weekend morning.) If everything is cool, you may be able to ride home from the purchase, but you may need a trailer. The carless yuppie will note that U-Haul offers motorcycle trailers at a reasonable rate, which trailers may be attached to one’s rented truck. Alternatively, if you’re the kind of carless urban yuppie whose friends drive cargo vans or pickups, strike yourself a deal.

6. Get the gear. Full gear, no excuses. Budget $60-200 for a helmet, $80-300 for a jacket, $50-200 for pants or chaps (chaps not recommended; the not-too-squeamish can look at this for evidence), $20-60 for gloves, and $60-200 for boots. The boots are kind of negotiable; good work or hiking boots will work for starters. Otherwise, get motorcycle stuff: no football helmet, no fashion leather, no garden gloves. Ebay can be a source for very cheap entry-level stuff.

7. Inspect, negotiate, select. Look at several bikes. You might not get test rides; dealer insurance issues and private-owner reluctance are unfortunate but standard problems. Get a checklist such as the Used Motorcycle Evaluation Guide to help you walk through the inspection process. Other online buying guides can help you with this process. You should have ammo for negotiation from your online research into the models you want: make sure that among your data points you have recent comparable asking prices from e.g. Cycle Trader or Craigslist, actual closing prices from eBay, and Kelly Blue Book values. Try not to get walked on; read a book or two on negotiation. FYI, the dealer I dealt with opened with a highball for almost 30% higher than our final sales price (though our final deal included things like cash payment, additional gear purchases, etc.; these are gives you, too, can offer in exchange for a lower price). Don’t take possession right then! Finalize your deal and schedule pickup for the next possible day (Fridays are therefore good for this). Before you leave, get the VIN (Vehicle ID Number).

8. The night before. Check the VIN online; depending on the price of the bike you’re acting on, it may not be worth paying for a full Carfax-style report, but you should definitely Google around; see if anyone has posted the VIN as stolen; make sure that the make, model, and year as represented to you match up with the manufacturer’s coding scheme for the VIN.

9. Get insured. You can sign up for insurance online. I used Progressive to get a quote that ran $330 annually. At that price (and given my good experience with Progressive in the past), it wasn’t worth shopping around for a 10% discount. YMMV. A modern insurance company should let you not only sign up, but add a specific vehicle (by VIN) and print out insurance ID cards, all online and within minutes. (Again, YMMV: Progressive’s lack of sucking may not be representative of all insurers.)

10. Take delivery. Use good practices if buying from a private party, such as a written bill of sale. If you must ride it home, ride real safe! Once home, make sure that you’ve got all the state paperwork underway and, if you’re going to ride before getting back any tokens from the government that you need fully to be legal, try carrying copies of what you sent in, to try and get sympathy from any possible cop stops until you become “official.”

11. Practice slow and easy for starters. Even if you live in a dense urban environment on a steep hill (like your correspondent), you can find a block to circle around so as to get a feel for the bike. Please, and this is important, please just ride like a total pussy for the first couple days and several hours. It’s important to remember that you’re already 10x more badass than anyone else who’s not a biker at this point, so just slow it down, and do exactly like you learned in class. Don’t worry about delaying or slowing down motorists while riding around your neighborhood, or about seeming odd for running the same route ten times — naysayers can kiss your ass. There are no bonus points for scraping off someone’s side-view mirror an hour into owning your new ride (except for the extra caution karma that you will then enjoy for quite some time…).

12. Use a checklist like the one at (NEED CITE) to step up your riding over the next several days and weeks. Take graduated steps out of your comfort zone. Don’t stick to parking lots; you’ve got to push yourself to expand your skills and confidence. As you grow, continue to read, perhaps starting with David Hough’s “Proficient Motorcycling.”

Here are some other tips:

1. If you’re busy, start this process in the late winter (early spring if you’ve got time to move through it rapidly). As spring moves in and the rains stop, sales pick up, and with the extra demand so go prices. This is also true for things like occupancy at the classes, lines at the DMV, etc. If you’re ahead of the curve, you’ll be riding with less time and capital outlay. Plus, taking the MSF class in absolutely dismal weather (large swaths of our riding range were covered in multiple inches of water, and it rained for about 12 of 16 hours) means the first time the weather turns sour during a ride, you’re not experiencing something new.

2. If you’ve heard that “everyone lays it down in the first year of riding,” think again. My riding instructor reports that he has never, in 20 years of riding, laid it down. Is he phenomenally skilled or just lucky? Probably a mix of both. But if you follow this guide (and / or other good info sources) there’s no reason why you can’t be the same way. On the other hand, w
earing All The Gear, All The Time (ATGATT — not, as it might seem out of context, some sort of six-base-pair polymorphism conferring hereditary safety-mindedness but an acronym for volitional safe behavior) is your way of hedging that bet.

3. Take the time to research the concepts of “countersteering” (not “counterweighting”) and “high side” vs. “low side.” The topics are too involved for me to delve into here, but suffice it to say that countersteering (push right, lean right, go right) is the only way to turn your bike above about 10 MPH, and a low side is a relatively “nice” crash where the rider goes down low (usually below / behind the bike) while a high side is the perilous case when the rider goes over the bike, sometimes to be followed by the bike itself! Neither topic is covered very well in the Basic RiderCourse, and in one case, my instructor gave bad info about countersteering due to a terminological error.

An estimate of the time and money spent on this:

Internet research on safety

20 hrs

Internet research on bikes

20 hrs

Basic RiderCourse

18 hrs

Shopping for bikes

6 hrs

Negotiation

1 hr

Total

65 hrs

Bike (with tax, title, etc.)

$3,800

Insurance

$300

Gear

$600

Basic RiderCourse

$240

Settling with guy whose mirror I smashed

$500

Repairing my damage from the smash

$200

Total

$5,640

Yes, that comment about smashing off a guy’s rear-view mirror is from real life. Sucked to be me.

You could do this for about half the price I paid, if you’re willing to cut some corners and do a lot of the maintenance-type stuff on an older bike yourself (and not crash). You could also easily spend twice or even three times this (there were some people in my class who were bragging about financing $16,000 worth of purchases from the Harley dealership; good for them, I guess).

Printing From Mac OS X Without Going Bankrupt

One thing about buying a new(ish) MacBook Pro loaded with Tiger: they really aren’t cutting a lot of corners. This includes in the area of resource usage (see e.g. memory usage, as you buy another gig of RAM). This, of course, is done in the name of an “Insanely Great” user experience, and mostly, it works.

One difference from Windows is that the Mac, when printing, defaults to the best mode possible on our big office multifunction color laser printer; in this case, it’s fully glossy color. Those of you who’ve ever had to buy toner for such a printer are now wincing: it is damn expensive.

In Windows, it seemed, I had to opt in to print in color. I’d like to run the same sort of system on my Mac.

Well, as it happens, this is one sad case where the Mac requires you to know more about how the OS works than does Windows. Specifically, we want to use a feature of “Quartz” (the graphical engine) to convert colors to greyscale before sending them to the printer. Do it like this:

  1. Open a print dialog with command-P.
  2. It should show a box with pulldowns at top for “Printer” and “Presets”
    1. Make sure you’re working with the Printer in question.
    2. You’re probably using Standard Presets — that’s fine for now.
  3. In the middle is a third pulldown that says “Copies & Pages.”
    1. Choose it and change to “ColorSync.”
    2. Set a “Quartz Filter” to greyscale or black & white (maybe test each to see what works best).
  4. When satisfied, go up to “Presets” and save your settings under a name like “dreary grey.”
  5. Keep this selected and it should now show up as your default settings for this printer.

Ruby’s ActiveRecord Makes Dropping to Raw SQL a Royal Pain (Probably on Purpose)

The opinionated programmers behind Rails have generally done a good job. (There are couple of FUBARs in their bag of tricks, such as the boneheaded choice to use pluralized table names (in some places) and use automagical pluralization code to try and mediate between the singular and plural.)

There’s another item I’d like to bring up, however, and that’s the fact that ActiveRecord intentionally cripples your ability to do raw SQL queries. This is, I’m sure, done to discourage raw SQL hacking in favor of using the ActiveRecord objects (which, for small numbers of objects, is admittedly a superior way to do many things, because of concerns for clarity, maintainability, etc.).

However, sometimes you need SQL, dammit. Especially when you’re doing a correlation between, say, different tags that describe business plans, and the people that link those business plans together, plus the number of times that such tags appear, there’s just no sense in pulling thousands of records into memory, instantiating Ruby objects, and improperly reimplementing basic CS sorting algorithms to link them up. You’ve got all that sitting right there in your RDBMS.

ActiveRecord lets you do something like this:

BusinessPlan.find_by_sql(    [      'SELECT s2.id FROM (COMPLICATED_SUBSELECT) AS s2',      var1, var2, var3    ] )  

Which will run the complicated SQL and replace the bind vars (question marks) in the raw SQL with var1, var2, var3, etc., and give you a bunch of BusinessPlan objects that it’s instantiated off those IDs. Easy enough.

But what if you need not merely to get the objects, but to get some other important info (say, COUNT(something)) out? You’re shit out of luck with ActiveRecord. The .connection.select_all method returns you an array of record hashes, but it requires fully-baked SQL (no bind vars).

  • You could manually construct the SQL and manually quote each bind variable into its place, but avoiding that kind of retarded scut work is exactly why you’re using Rails in the first place.
  • You could try and get the DBI handle that underlies ActiveRecord (does it?), but it’s very unclear as to how or if you can do that. If you call .connection.raw_connection you get a PGConn object (for PostgreSQL), not a DBI handle.
  • You could open up your own new DBI handle, which involves recapitulating the Rails initialization code for ripping the config values and rewriting connection-pooling code, which is bad for all sorts of reasons, not least of which is that you’re already f’ing connected to the DB!

WTF? If you read the code for the find_by_sql method, you’ll see:

def find_by_sql(sql)   connection.select_all(     sanitize_sql(sql),      "#{name} Load"   ).collect! { |record| instantiate(record) } end  

Given this, you might think: “aha, I’ll just use a similar method and pass to sanitize_sql an array with my SQL and bind vars, then pass that on to select_all. No can do. sanitize_sql is a protected method.

So, here’s my encapsulation-breaking, OO-unfriendly, scofflaw workaround to let you have access to what you should already get: a decent bit of code for binding SQL parameters:

(In helpers/application_helper.rb)

arb = ActiveRecord::Base def arb.sanitize_fucking_sql(*args)   sanitize_sql(*args) end  

Now, you can happily go about your business and, when necessary, call ActiveRecord.sanitize_fucking_sql(...) to get ‘er done. No special-purpose DB connections, no wrangling thousands of objects in memory.

Caveats:

  1. I suck at Ruby, I know. There’s a more elegant way to add a public method to a class, but that works and I understand it.
  2. Eventually, this will break. But it will probably be a long time and the, er, unique method signature I suggest should be easily globally replaced.

Making Subversion Set Reasonable Default Properties Like Keyword Substitution

(Programmers: skip down to the Meat section below.)

If you are so bored as to actually have read all the articles on this blog, you may have noticed that the “Id: lucas blah blah blah” string that shows up at the bottom of the articles. This is an interpolated keyword, put in by the revision control system, that shows in the text of the document when it was last committed to revision control.

Subversion (svn) is a revision control system — probably the leading such system for new deployments (I am not counting Microsoft-land, where old, proprietary systems still abound). It’s most familiar as the replacement for the venerable CVS, which used to do replacement more or less automatically. But a stock Subversion install won’t do keyword replacement unless you do a “property setting,” or propset, on a file-by-file basis (this is to prevent clobbering a file that happens to have the magical string in it).

Therefore, you have to remember to do something like this to your new files:

svn propset svn:keywords Id myfile.txt  

This tells svn to set the “svn:keywords” property to “Id,” meaning it will replace instances of $Word: $ with the ID string (when “Word” is “Id”).

However, this is a pain, and although you could conceivably script this action as a hook upon new additions to svn, there’s an easier way.

Meat

Find your local ~/.subversion/config file and edit it. Set the following:

[miscellany] enable-auto-props=yes  [auto-props] *.txt=svn:keywords=Id  

(The default config file has a bunch of examples commented out for you to base your settings on, but the above is the minimal set to get textfiles set with keyword substitution for the “Id” keyword.)

The Housing Bubble and General Financial Depravity

Yesterday the Seattle Times brought us this gem:

… the couple — with no savings and about $20,000 in credit-card debt — shopped for a mortgage to buy their 1,200-square-foot house in Tukwila last year, they heard the same thing from lenders and in a home-buying class they attended: Forget it.

“You basically had to be Scot free, no massive credit debt, which we had, and to have money in the bank, which we didn’t,” said Swartz, 31. “How do people buy houses in America anymore?”

In a nutshell, the country is going to hell in a handbasket. When people are so poisoned with the mindset of entitlement that they literally can’t comprehend why having no cash and a negative $20k net worth doesn’t qualify one to incur a quarter million in debt, well, it’s hard to believe that these are the attitudes and values that built the greatest economy in the world.

Hurrah for Kwiki

… and for Jeremy Smith. Thanks to Jeremy’s hack on top of Ingy’s quickie wiki, we can now get proper behavior inside of table cells.

In a nutshell, Kwiki didn’t handle things like italics inside of a table. This should fix it. Previous posts that used the stock Kwiki should be fixed now.

Now, to remedy blockquotes …