Monday, November 27, 2006

Bay Area Traffic Unhackable?

So, as an accidental "affluent suburbanite" here in the Tri-valley, I am lucky enough to have an hour long commute to and from work each day (note that is 2 hours total, each day). My journey begins on Interstate 580 at the 680 split, headed west out of the valley, and into the city of Hayward (10 mi, 10-15 mins), then winding through the streets of Hayward (3.5 mi, 15-20 mins) I finally make it to CA-92, which eventually goes over the bay (Hayward/San Mateo Bridge) (14 mi, 15 mins), and then on to 101 South (2 mi, 10 minutes). This cycle repeats in the opposite direction, except that the 2 mi jog North on 101 is about 15 minutes than it is headed South in the morning.

So obviously when I saw this site ( I think linked through Digg a few days ago), I was very interested in the possibilities of hacking the traffic on my daily journey in an effort to shave a few minutes off my commute, and maybe even a few points off my blood pressure.

If you don't want to read it, the very brief and admittedly poor summary of the article (ca. 1998) is: Large gaps between cars on the freeway, or "anti-traffic", consume stop-n-go waves of traffic, and allow traffic to mesh (gear or zipper-like) properly at merges. The author posits that even a single car creating a decently sized anti-traffic bubble can eliminate some nasty stop-n-go traffic waves.

Now, this seems pretty obvious when you sit and read it, but try imagining what its actually like out there on the Freeways. What's that? Imagination broken? Well, lets see if we can give it a kickstart. Imagine your going home from work on a late fall day like today; its 6:00pm, rush hour. It's dark and chilly outside. You make your way to the freeway. You fight your way out off the on-ramp into the far right lane, you get out of the merge, and eventually (if you're not driving on 101), your speed picks up to about 55-60 mph. That's all well and good, except that there are tons of people on the road, all wanting to change lanes, all wanting desperately to go 70, when traffic is still moving less than the speed limit. You're a mere few feet from the bumper of the guy in front of you, he's the same from the guy in front of him. Likewise, is the guy behind you; his headlights barely show in your rear-view mirror. Suddenly, a brake light goes on several cars ahead of you, the guy behind the breaking car, taken by surprise in the middle of his cell phone call hits his brakes, same with the guy behind him, and so on and so on, each car having to break more than the one ahead of it. Finally, you hit your brakes hard to avoid the stopped/stopping traffic in front of you, as you look up in your rear-view praying desparately that the guy behind you was paying attention, has good brakes, or at least has insurance. Then all of a sudden, traffic is back moving at the sub-speed limit rate it was before, as if nothing happened. You're puzzled, and cautious knowing this can't be right. You give yourself some room between you and the guy behind you. Suddenly, you start noticing every asshole with a BMW, Lexus, or Mercedes using your cushion space as a bounce point to get around a slow car in the lane next to you. You get pissed: "How dare they!?", you accelerate a bit more until you're right behind the guy in front of you again. Suddenly, several cars ahead of you, brake lights go on......

Yeah, you get the point. That's what its like to drive in the Bay Area, presuming your lucky enough to avoid a car accident, the errant hilariously-out-of-place-debris in the number 2 lane, or the World's Longest Parking Lot. So, on Monday, I decided I would not be one of these typical drivers. I'd stifle the competitive driver in me, I'd create my anti-traffic bubbles, and ride the fortunes of smooth traffic all the way into work!

Aww, sometimes I'm so naively enthused it's cute. I'm like a 16 year old eagerly awaiting his first tax return thinking about all the things I can do with that return money.

I've tried, really I have. Both to and from work, I've taken extra precaution to keep my anti-traffic gaps in front of me. I've tried making them moderate (6 car lengths), and bigger (1/4 mile), but alas, it doesn't seem to work. Those spaces quickly fill up with other cars, despite what our author claims:

"But what about the adjacent lane? Won't they all fill my empty space? Nope. A few do change lanes, then they rush to the end of the empty space. This filters out the aggressive drivers from the adjacent lane, letting them move to my lane at the end of my space, and leaving sane ones next to my empty space. They don't change lanes. They don't care that there's a huge empty space growing and shrinking right beside them. They form a big plug, and aggressive drivers behind them cannot get to my big empty space."
The above may hold true in Seattle, but I'm afraid it does not hold true in the congested Bay Area. There are simply too many cars, too little lanes, too many junctions, that it is impossible to maintain any meaningful "anti-traffic" gap. Instead, these gaps are just traffic sinks. Cars are attracted to them, and nature continues to abhor its vaccuum. It's too bad too, because the author isn't smoking crack; he's on to something. The anti-traffic bubbles really do work in areas where the flow of traffic is somewhat constant, like on the San Mateo bridge where you have roughly 10 miles of freeway with no exits or onramps; just straight away. I've readily observed the anti-traffic phenomenon at work here. You see, the western-most span of this bridge is a high-rise which allows for shipping traffic in the bay to pass under it. When you're coming down the high rise headed East, you get a nice look at the remaining 7 miles of flat span ahead of you. During rush hour at night, you can easily identify many of these stop-n-go waves off in the distance. If you then get yourself a nice anti-traffic bubble, you can ride the rest of the bridge without ever having to brake, despite the car ahead of you doing so.

But so what? It was a smooth ride, but you know you could have made it over the bridge 2 minutes quicker if you'd just lane-hopped and kept bumper to bumper with the rest of the traffic. And did it really help anyone out behind you? Maybe, but you know that they're all tail-gating each other, so its just a matter of time before new waves are created behind you. So in reality, for me at least, this just made the commute a bit longer, but a bit less harrowing, which isn't necessarily a bad thing. It's definitely reminded me how much better it is to not drive at warp speed sandwiched in between cars, but it really hasn't made my commute quicker, or have any meaningful impact on anyone else's commute. Bottom line: the efficacy of this method is inversely proportional to the traffic saturation; therefore, when all possible traffic space is occupied, this method is 0% effective.

So, does this mean that Bay Area traffic is unhackable? Not necessarily, it just means that the anti-traffic bubble approach doesn't work well in such a highly congested area (something I believe the author touches on). Instead, I'll have to look for other ways to hack traffic. For now, I'm stuck with alternative routing, (e.g., taking El Camino Real instead of 101) until something better comes along.

Sunday, November 26, 2006

New toy

Well, I finally decided it was time to get a mobile internet device. I
went with the sidekick3 from t-mobile as they offer the best rate plan:
unlimited for 29.99/mo. So far I like the device much better than the
blackberry I previously carries at my old job.

--
posted from sidekick

Friday, November 24, 2006

Happy Thanksgiving.

The Thanksgiving weather has been beautiful here in the bay area, as this picture should illustrate. This is a shot of San Francisco and the Western span of the Bay Bridge taken from Vista Point (just off the Golden Gate) just after 2:00pm on Thanksgiving. It's been pretty chilly at night and in the morning, but we've had 60 degree days. I'm definitely not used to this sort of weather around Thanksgiving!

Obviously, since this is California this weather isn't too surprising. However, my shopping experience on Black Friday was. I had to do some shopping for both Talitha's birthday and our anniversary (1 year and we're both still alive!). I found an decently close parking spot in front of Nordstrom's at the mall. I managed to stop and pick up one of her presents and stop at the [packed] Apple store and get out of there in less than a half an hour. Target wasn't any busier, so I got in an out of there rather quick.

On top of all that, we got our Christmas tree, and Talitha and her niece Sierra got it all decorated. It looks great! I'll have to put up a picture if I get a chance this weekend.

Also saw "Borat" today. Long story short: Funny movie, but not as funny as I expected after all the hype. It's still worth seeing, though I wouldn't trip over yourself to see it at the movie theater.

Friday, November 17, 2006

Capitalism at its ...sigh...

So what's more surprising:
1. People who have the cash/credit to buy one or more PS3s for ~$600 a pop, also have the ability to waste two days waiting inline outside a store to buy them..
2. That there are people willing to buy these things at an incredible markup on eBay?

To be honest, I'm surprised that Sony and its retailers just don't cut out the middle man, and just offer the damn things for around $2,000, which is apparently about what they are going for on eBay. Yes People will pay strangers on the intarweb $2,000 for a first rev gaming system, when they could just wait six months for the larger supply and pay $600. Oh well, no one gets hurt, right? [ As I read this, KRON-4 news was doing a report about a "stampede" at a store in Wisconsin where a man had his jaw broken when he was slammed into a light poll in a parking lot while waiting to buy one of these units.]

Edit: This article discusses some good old fashioned teenage violence, and also sums up some other PS3-related violence including two different robberies.

Monday, November 13, 2006

Decorating Python

I thought I might throw together a quick example on what Python decorators are and how to use them, since I usually use them with CherryPy and I forgot exactly how they worked since I last used them.

Python decorators simply allow you to wrap a function call with one or more function calls. The idea is that you can write a decorator to modify (i.e., decorate) the behavior of many like functions. For example, in CherryPy I use a decorator on exposed class methods to wrap pages of content with an HTML header and footer.

For the purposes of this post, lets take a simple example.

def print_hello(name):
print "Hello, ", name

def print_goodbye(name):
print "Goodbye, ", name

print_hello("Matt")
print_goodbye("Matt")
This outputs:
Hello, Matt
Simple, right?

Okay, so maybe we want to gussy up our function, say by surrounding both print statements with a string of twenty dashes. We could modify each function like:
def print_goodbye2(name):
print "-" * 20
print "Goodbye, ", name
print "-" * 20

print_goodbye2("Matt")
Producing:
--------------------
Goodbye, Matt
--------------------
Of course to do this, we have to change both functions. What if we want to write the dash-output code and apply it to each function? This is where we can use a decorator!

In the following code, we create a decorator function called add_lines. It takes a function as an argument (the function its decorating), and returns a function _decor, which takes the arguments passed to the function it is decorating.
Inside the _decor closure, we print a dashed line, call the decorated function (with its expected arguments), and print another dashed line. Then, we define our functions print_hello and print_goodbye and we put @add_lines before both funtion definitions. This tells Python that we are using add_lines to decorate the following function.
def add_lines(fn):

def _decor(*args):
print "-" * 20
fn(*args)
print "-" * 20

return _decor
#end add_lines

@add_lines
def print_hello(name):
print "Hello, ", name

@add_lines
def print_goodbye(name):
print "Goodbye, ", name

print_hello("Matt")
print_goodbye("Matt")
The result of calling our decorated functions is:
--------------------
Hello, Matt
--------------------
--------------------
Goodbye, Matt
--------------------
So, when you call print_hello or print_goodbye you are effectively calling add_lines which in turn calls the original function.

You can also pass arguments to decorators using an additional closure:
def add_char_lines(char):     #function with expected arguments
def _wrap(fn): #closure that receives the decorated function
def _decor(*args): #closure that receives the decorated function's args
print char * 20
fn(*args)
print char * 20
return _decor
return _wrap
#end add_char_lines

@add_char_lines("*")
def print_hello(name):
print "Hello, ", name

print_hello("Matt")
Produces:
********************
Hello, Matt
********************
Finally, you can also apply multiple decorators to a function. The following works, even if it is an unlikely example:
def add_lines(fn):

def _decor(*args):
print "-" * 20
fn(*args)
print "-" * 20

return _decor
#end add_lines

def lower(fn):
def _decor(*args):
nargs = []
for arg in args:
if type(arg) == type(""):
nargs.append(arg.lower())
fn(*nargs)
return _decor
#end lower

@add_lines
@lower
def print_string(a_string):
print "STRING: ", a_string

print_string("A STRING")
Which produces:
--------------------
STRING: a string
--------------------
The Python wiki takes a much more in-depth look at decorators.

Yo mamma's teeth so yellow.. she spits butter!


Welp, my MacBook top-case finally started to discolor. It didn't show until about last month, and now its slowly getting worse. Functionally, this causes me no problems, and its only really noticeable at the right angle or lighting condition (had to futz with the camera to get a picture where you could notice it). However, I am irritated that I paid a good price for this laptop and its starting to look like nicotine-stained teeth - you know, that shitty dingy yellow. Unfortunately, everytime I've gone by the local Apple store, the "geniuses" are busy helping other customers, that I've not been able to get an answer to my question: "What's the turn-around time to get this fixed?" Honestly, I rely too much on this laptop to drop it off whenever, so I'll have to wait until we go on vacation or I buy a new desktop before I take it in.

Friday, November 10, 2006

The garbage men who empty our trash bins every Tuesday and Friday, do so with the swiftness and efficiency of a cat burglar.... By cat burglar, I mean a 250lb mans man learning how to perform leaping ballet moves in a china shop all while nursing a severe inner ear infection.

There's also somone with a 1997 Camry which is _always_ parked next to one set of trash bins. It has a car alarm tuned so sensitive, its been rumored to detect earthquakes well into the Pacific Ocean. Anyways, it has become the emergency back-up alarm clock, because the garbage men without a doubt set that shitty car's alarm off constantly while emptying the trash - and its almost always 7:45 when they do it.

Bleh. Time to make the donuts.

Thursday, November 02, 2006

Yeeeuck haw

Talitha and I were going to meet her former research advisor for drinks, as he was visiting the area. We decided to stop and get dinner at an unamed steakhouse, as it was the only restaurant nearby. I did not have a good experience. The atmosphere was.. well, cramped and a bit stuffy. You had the feeling that you were the cattle being herded into stalls for feeding. The food was, okay. I would rate it closed to Applebee's, except for the veggies. Applebee's has better veggies and salad, in my opinion.

There were a few things that I learned about the cowboy experience, which I can use if I ever open a similar restaurant.
  1. Clean dishes aren't required; in fact they're forbidden. Do you really think that Tex has the time to clean off his mess kit when he's out there rasslin' broncos? I don't think so. If Tex can eat off of the remains of previous meals, so can your customers! If they complain, just bring them new dishes...with different food particles stuck to them!
  2. Part of the cowboy code requires that if another cowboy is celebrating his birthday, all of the other cowboys have to come out and chant happy birthday at the top of their lungs. Sounds a little gimicky, right? Wrong. They end it with a whooping "YEEEHAW". Authentic.
  3. Use "Pardner" a lot, and give "cowboy" lingo lessons at odd places all over the menu. This gives the visitor the impression he/she is having a nice old ranch hand (think Sam Elliott's character from the Big Lebowski) going over the menu. It's also a good education - did you know that "Firewater" is an acceptable term for "Whiskey"? I don't know what this "Whiskey" thing is, but it sounds dangerous. I'm glad the cowboys have to handle it.

Time to make the donuts!