A while ago I posted a short greasemonkey script to make saving a Stanford class video to disk a little easier. I’ve cleaned it up a little and posted in on userscripts.org as the Stanford Video MMS Commander. Same disclaimers as before apply, namely, this script is not to be used in any way to help violate Stanford’s terms and conditions.

Stanford has a lot of their lectures online. To access them, you’ve got to have… access! That means you need to already have an SUNet ID with proper permissions. The standard way to get those permissions is to apply to Stanford, get accepted, and start paying Stanford lots of $$$.

Stanford doesn’t want these lectures to get out on the open internet. So they do a few things to try to ensure that doesn’t happen. First, part of Stanford’s terms of use is that you will not redistribute their lectures. Note that the concepts and code I’m showing you here in this post could be used to help you illegally redistribute their lectures. I do not condone any such illegal use. By using the the concepts and code in this post in any way whatsoever (including just reading this post), you agree to follow Stanford’s terms of use.. If you don’t agree to these terms, please leave now.

In addition to their terms of use, Stanford places a more practical barrier in the way of illegal redistribution of their lectures – they only distribute their lectures as streaming WMV and Sliverlight. Now this sucks for me, the legal end-user, for a number of reasons. Most importantly, this means I need a high-bandwidth connection to watch my lectures. I can’t watch them offline.

Enter MEncoder and Greasemonkey.

MEncoder is a tool to save streaming video to disk. Greasemonkey is a Firefox browser extension that allows you to run custom javascript for any particular page displayed in the browser.

To save a lecture to disk for offline viewing, the basic command you want to run is:

mencoder mms://the-streaming-video.wmv -ovc copy -oac copy -O filename_out.avi

Now the ‘path-to-streaming-video.wmv’ you need to use will be unique for your authenticated SUNet session with Stanford’s servers. You can manually find this unique path by navigating with your browser to the lecture you’re interested in, viewing the source of the page, and manually scanning for the path. Or you can install the following small and simple Greasemonkey script.

// ==UserScript==
// @name          Stanford Video MMS Path Retriever
// @copyright     2010, Mike Fogel, http://fogel.ca
// @license       This SW may not be used to violate Stanford's terms of use.
// @namespace     http://fogel.ca/greasemonkey
// @description   Adds a header containing mms path to Stanford player page.
// @include       https://myvideosu.stanford.edu/player/slplayer.aspx*
// ==/UserScript==

function get_mms_path() {
  var o = document.getElementById('WMPlayer');
  return 'mms' +  o.data.substring('http'.length);
}

function add_header(message) {
var elem = document.createElement('div');
  elem.id = 'GM_mms_path';
  elem.style.color = 'green';
  elem.innerHTML = '<h2>'+message+'</h2>';
  document.body.insertBefore(elem, document.body.firstChild);
  return elem;
}

function set_selection(hdr) {
  var range = document.createRange();
  range.selectNodeContents(hdr.firstChild);
  selection = window.getSelection();
  selection.removeAllRanges();
  selection.addRange(range);
}

function main() {
  var mms = get_mms_path();
  var hdr = add_header(mms);
  set_selection(hdr);
}

main();

The Greasemonkey script scrapes the page, finds the ‘path-to-streaming-video.wmv’, adds it in large, bright green text to the top of the page, and selects it so you can just hit ‘cntrl-c’ to copy it to your clipboard. Then over in a terminal, you can paste that path into your MEncoder command. Running the command will take a long time – in fact, as long as the lecture is. This is because MEncoder simulates a regular streaming video player to the Stanford servers. MEncoder will convert and save the streaming video according the the suffix of the output filename you specify (eg. ‘.avi’ in my above example).

I don’t have to do this every morning (thank god) but I have been doing it about once a week lately. The transit route described here is kinda the ’standard’ route – you can get creative with all the different transit agencies in between Sacramento and Palo Alto, but as far as I am able to find, no ‘creative’ route is able to beat out the ’standard’ route. Note that I’m purposefully excluding a ‘bike + transit’ option for the purposes of this DeathMatch.

All times AM, all money in USD (duh).

The Route, via Transit

  • Walk, house -> bus stop: 3 min
  • SacRT, bus: 6:35 -> 6:50, $2.50
  • Amtrak, capitol corridor, Sacramento -> Richmond: 7:00 -> 8:25, $13.60 (10-ride pass)
  • Bart, Richmond -> Mlibrae: 8:42 -> 9:51, $5.31
  • Caltrain, Milbrae -> Palo Alto: 9:55 -> 10:25, $4.25
  • Stanford Shuttle: 10:30 -> 10:40, free
  • Walk, shuttle stop -> class: 3min

Direct Monetary Cost

2.50 + 13.60 + 5.31 + 4.25 = $25.66

Time Analysis

Percent Efficiency Assumptions
  • Transfers/walking: %0, including 2 min window on each side cause it takes a while to get situated on bus/train
  • Bus/shuttle: %30
  • Bart: %50
  • Caltrain: %70
  • Amtrak: %90
Effective 100% Efficiency Time

(sacrt) + (amtrak) + (bart) + (caltrain) + (stanford shuttle) =
(15 – 2*2) * 0.3 + (85 – 2*2) * 0.9 + (69 – 2*2) * 0.5 + (30 – 2*2) * 0.7 + (10 – 2*2) * 0.3 =
11 * 0.3 + 81 * 0.9 + 65 * 0.5 + 26 * 0.7 + 6 * 0.3 =
128.7 min ~= 2 hrs 9 min

Wasted Time

Total Travel Time – 100% effective efficiency time =
(4 hrs 13 min) – (2 hrs 9 min) = 2 hrs 4 min

The Route, Driving

  • Walk to car, 3 min
  • Drive @ rush hour, Sacramento -> Stanford: 2 hrs 50 mins, 124 miles (src: google maps)
  • Park car and walk to class: 15 min, $11

Direct Monetary Cost

Assumptions
  • 30 mpg
  • $3.00 per gallon for gas
  • bridge toll: $4.00
  • ignoring all other car costs – they’re not ‘direct’ (ie. you don’t pay them right then)
Calculation

124 / 30 * 3.00 + 11.00 + 4.00 = $27.40

Wasted Time

3 min + (2 hrs 50 min) + 15 min = 3 hrs 8 min

Conclusions

Taking the trip via transit rather than driving saves $1.74 (oh boy!) and 1 hour, 4 minutes of time. If we were to add in the full costs of owning an automobile (AAA estimate: ~52.2 cents/mile) then the monetary cost for driving rises to $79.73, thus implying a monetary savings of $54.07 for taking the trip via transit, rather than driving. Bam! Headshot.

Commute Mode DeathMatch Leaderboard

  • Transit: 1 (headshot)
  • Driving: 0

Coming soon: ‘biking + transit’ jumps into the rumble!

Stanford has a few warnings posted in some of their garages:

garage toxic warning

Nice of them to advertise that the parking garage isn’t a healthy place to hang out, at least not according to your lungs and your junk. But really, a few things.

  • If a parking garage deserves an air quality warning, how about a congested freeway on a hot, still day?
  • The garage is not the source of that bad health stuff. Specifically, it’s the incomplete combustion of gasoline in the 100’s of internal combustion machines sitting around in the garage. Maybe we should put the warnings directly on the source of the problem?
  • If we should be concerned about the health effects on our lungs from our cars, what about the bigger effects – like cars being the leading cause of death for Americans 35 years old and younger? Or being a vital component of our awesome 73% overweight/obese rate? Or pushing our communities and ourselves farther and farther apart – to distance scales that work well for a two-ton block of steel, but not so great for a 150 lb chunk of human?

It’s easy to see and point at air quality numbers. They can be measured empirically, their effects can be studied in laboratories, and it’s easy to say “this is bad. See proof by X.” But more often than not cause-and-effect relationships don’t end with a nice, clean number at the end. As such, it’s harder to talk about these relationships, it’s harder to reason about them. The unfortunate wrench is that sometimes, these ‘unclean’ relationships are actually the most important ones of all. Which probably explains why you never hear of a mathematician being elected to public office.

Stanford’s big on promoting ‘alternative’ transportation (read: anything but you, driving alone in your private vehicle), especially for commuting. And to Stanford’s credit, Stanford apparently has one of the lowest rates of solo-driver commuting of any major organization in the area. Which is great.

And what’s most impressive, is that this is in spite of Stanford’s parking pricing structure.

Parking pricing? Who cares? Well, turns out this is one very key knob (some would argue that it’s the best knob) we have to help push us away from foreign oil, global warming, childhood asthma, chronic obesity and all those other happy products of our big bad-ass car culture.

To understand how Stanford’s parking pricing is such a powerful knob that is currently twisted the wrong way, it helps to look at a more-or-less typical case study. Let’s consider a hypothetical commuter, call her… “Jane Student” and let’s say like many Stanford students, she chooses to live up in San Francisco and commute down, for reasons like quality of life, culture, etc. Let’s say Jane has a car, but plans on taking the local commuter rail, Caltrain, about half the time.

At Stanford, there are two primary ‘zones’ for commuter parking: ‘A’ and ‘C’. ‘A’ is the good, close lots and costs about 2.5 times what ‘C’ does. You generally only find metered spots adjacent to the ‘A’ lots. Everything that holds true for ‘A’ also holds true for ‘C’, so for simplicity, we’re going to assume Jane doesn’t want to park a bus ride away from class, so we’re only going to consider ‘A’.

Now, to pay for her parking, Jane has three options:

  • Metered parking: $1.50 an hour
  • Daily permit: $11
  • Monthly permit: $60.50

When Jane sits down to consider this situation, the first thing she does is figure out what’s cheapest for her. Well, Jane is on campus usually about 7 hours a day. If she were to drive everyday (20 days a month), then her options cost per month:

  • Metered parking: 1.50*7*20 = $210
  • Daily permit: 11*20 = $220
  • Monthly permit: $60.50

Whoa! $60 versus $220? That’s quite a difference. But now Jane knows she’d rather take the train some days. So how many days a month would she have to drive to make the monthly permit worth it? Well, 60.50/11 = 5.5 and 60.50/1.50/7 = 5.76. So if Jane drives 6 or more days a month, it’s worth it for her to get a monthly permit. Since Jane plans on doing about 50-50 train/car, she goes ahead and buys a monthly permit.

Now, let’s consider Jane’s decision making process each morning when she’s choosing whether to take the local commuter rail, Caltrain, or drive alone.

Costs to take Caltrain:

  • Bike to Station: 15 min, Train: 45 min, Bike to Class: 15 min => 30 min of exercise, and 45 min of semi-productive time
  • Two Caltrain 3-zone tickets: 2 * 6 = $12

Costs to drive alone:

  • Walk to car: 5 min, Drive: 45 min, Walk to class: 10 min => 15 min of light exercise, 45 min of wasted time
  • Gas each way is 40 miles at 30 mpg and gas is now $2.00 a gallon => 2 * 40 / 30 * 2 = $5.33

(Note that medium and long-term costs like insurance, depreciation, health, environmental etc do not factor into Jane’s daily decision making process. Medium and long-term costs and benefits will factor into Jane’s medium and long-term decisions, but will be, generally, inconsequential for her short-term decision making.)

Wow, not only does it take longer for Jane to take the train, but it costs her more! This means Jane’s default behavior will be to drive. We can expect Jane’s commute to be dominated by solo driving with sprinkled Caltrain.

FAIL. That’s not what Jane wants, that’s not what Stanford wants, and that certainly isn’t what our community as a whole wants.

Let’s consider what would happen if Stanford implemented a different parking pricing structure. The following could be implemented with zero costly infrastructure change.

Proposed:

  • Metered Parking: $1.25 an hour
  • Daily permit: $8
  • Monthly permit: $125

Now, the following holds true for our wonderful Jane:

  • A daily permit is only worth it if you’re planning on parking 7 hours or longer that day.
  • A monthly permit is only worth it if you’re planning on parking 16 days or more that month.

All of a sudden the bar to buying a monthly permit is much higher. So Jane, who expects to go for a 50-50 mode share, now will no longer buy a monthly permit. She’ll buy a series of daily permits to use whenever she chooses to drive. Now, let’s consider Jane’s new decision making process each morning when deciding to take the train or drive alone.

Costs to take Caltrain (no change from above):

  • Bike to Station: 15 min, Ride: 45 min, Bike to Class: 15 min => 30 min of exercise, and 45 min of semi-productive time
  • Two Caltrain 3-zone tickets: 2 * 6 = $12

Costs to drive alone:

  • Walk to car: 5 min, Drive: 45 min, Walk to class: 10 min => 15 min of light exercise, 45 min of wasted time
  • Gas each way is 40 miles at 30 mpg and gas is now $2.00 a gallon => 2 * 40 / 30 * 2 = $5.33
  • Parking: $8

Bam. Jane’s total direct, tangible cost to drive alone each morning is now $13.33 – higher than the $12 it costs for Jane to take Caltrain. That, coupled with the benefit of reclaimed time Caltrain affords Jane changes Jane’s default behavior. Jane’s default behavior is now to take Caltrain. We can expect Jane will generally take the train, and occasionally drive.

Given that Stanford’s all about going green, this is puzzling. Thoughts? Anybody from Stanford Parking and Transportation out there with any deeper insight into this situation?

I’ve spent the last 6 months passively scouting (bike) commute routes up and down the Peninsula, in preparation for my upcoming move back to San Francisco and continued work/study at Stanford. I know I’m not alone in this – there’s a fair number of people who live in the city these days and commute down to the Silicon Valley, and a fair number of them are cyclists, and a fair number of those cyclists would bike to work occasionally if there was a decent route. So let’s find (build?) a route!

Unfortunately, I don’t believe there is a silver bullet of a route to find. This is the best I’ve came up with thus far… it’s reasonable. Most of the route I’d rate at a 3 (out of 5) or better in terms of cyclist safety. Excluding the intersection of Ceasar Chavez, Potrero, Bayshore and 101. That’s bunk.  That gets a 2.

There’s one part of the route that google maps can’t really handle. Along San Andreas Lake and the Lower Crystal Springs Reservoir, there’s an awesome mixed use path.  The path does have a 15mph bike speed limit – but the alternative is to add a couple hundred feet of climbing along with a short (but legal) stretch on 280.  Ouch.

So, this route took me 2:17 today without commute bags, which would probably add another 20 lbs and 20 minutes.  Doing this commute by car is generally 40-50 minutes, depending on the traffic.  Add another 10 minutes on each side of that for parking.  I guess to be fair, we should add 15 minutes of bike prep time, and 30 minutes for shower time at the far end.  So ~1 hour by car, ~3 hours by bike.

Any ideas for improving that get-out-of-SF part?  Or any other part of the ride for that matter?  The MTC has a set of ideas, but those are more long-term big picture ideas. I’m looking for a fast, safe route now… or as close to that ideal as possible.

Good thing, because those eucalyptus were really causing a problem.

nature in a box

tree in a box

upgrade nature!

This is a symptom of deep, powerful problems within Stanford, and in the big picture, within our society as a whole.

The fact that Stanford is replacing nature with nature because one’s been deemed one more ‘natural’ than the other isn’t the problem.  The fact that Stanford is paying $$$$$($?) per tree for this upgrade isn’t the problem, as Stanford has $$$$$$$$$$$ (yes, 11 digits there) lying around.  In fact, the problem is not even that the money spent on each tree could instead give one of the 10,000 people living off the street just around the corner a place to call home.

The problem is that we, as a culture, as a people, are A-OK with this disparity of wealth, this wasteful opulence, this dehumanization of those in need… directly in front of our faces, our doorstops.  Not to mention the other 3 billion who are kept out of place, out of mind.  The problem starts with those in power, those making the decisions, those who choose to push that 21.6 billion dollars toward million dollar landscaping upgrades – but it extends down to you and me, who drive by the problem every day, and turn a blind eye.  This indifference, this willful indirection, ingrained in the most powerful people on the planet is neither acceptable, justifiable, nor in the long term – sustainable.

We can, and we must, do better.

Written by Takeo Rivera and directed by Rachel Anderson, R&L is a collective story of eight women and men struggling to find a sense of identity in 21st century Asian America. Passionate, sincere, emotional and damn funny – a great performance by the crew and a powerful story to boot. Well done!

R&L

R&L scene ~1

R&L getting deep

R&L you guys rock

Director Extraordinaire, the one and only, Rachel Anderson:

Rachel Anderson, Director extraordinaire

Gates came to Stanford this week to ’share his vision’ of all things tech, and how that will change the world, and how it should change the world. Given that I’m spending a significant amount of time in a building that bears his name and using urinals his money paid for, and that he’s currently the world’s richest person (excluding monarchs and dictators and all those good people) I thought I should hear him talk. Apparently so did the rest of the campus. It was a packed house.

Hey Bill!

bill gate$

Bill had some good stuff to say… He has a great perspective on where the tech industry’s came from in the last 30 years – the schism between hardware and software, primarily. And how revolutionary the idea of a ‘personal computer’ was. His vision of where computing is going was much more corporate and business centric than others I’ve heard recently. Video conferencing, distance learning, increasing worker productivity. Heh, and he still believes in the tablet pc… the “replacement for paper” as he put it. Cute Bill…. it’s a laptop – with a rotating touchscreen. Revolutionary! I can only dream of what’s next.

Bill, the reality is:

  1. The home PC has evolved into an internet terminal. That’s it. Heavy word processing, gaming – no. We do that at work, or we do it on a specialized console.
  2. You don’t need a desktop or a laptop to use an internet terminal. You need a phone.
  3. The cell phone already has over 50% global market penetration. The PC, as we know it, will never come close to this.
  4. In the next 5 years, we will see mainstream phones quickly take over the feature set that currently compels the average consumer to blow 2k on a new desktop or laptop.
  5. In 10 years, you’ll get home, insert your phone into a dock next to your 48″ LCD, sit down with your wireless keyboard, and check your email and geek out. You wil not have a desktop machine, or laptop, or tablet PC, or anything with more computing resources than necessary to a) retrieve information from a remote server and b) display it.
  6. In 10 years, your phone won’t be running windows. And Microsoft will still be building huge In-The-Box software for an increasingly smaller and smaller market of the largest and slowest companies around.

The interesting question to ask is – in 10 years, what will your phone be running? How much will it look like a phone versus… a watch? or an armband? or sunglasses?

Bill took some questions, but most of them were leading questions about philanthropy… thinly veiled questions of the form “Problem X has caused 20 million billion puppies to die. What are you doing to fix it? oh, by the way, I’m from the Fix Problem X Foundation.” I’m of the opinion that while philanthropy does have vital short-term benefits, any long term solution we find to our global-scale problems will be devised from and implemented in the currently dominate democratic/capitalistic model that has proven to suck less than any other idea thus far.

bill gate$ and stanford president

The dude on the left is the President of Stanford University, who I’m going to give the benefit of the doubt to, and not say that he came off as a total tool, even though he did. How can you be a tool if you’re already The Man? Chicken and the egg v2: what came first – the tool or The Man?

The Tour de CA ditched San Francisco this year and moved down the peninsula, much like uh, me. I fixed up my bike and got out with my roomies for my first ride since my ‘encounter’ with the reality of living and riding in suburbia 5 weeks ago.

The Prologue this year was in Palo Alto/Stanford: a 2 mile sprint from downtown, straight up Palm Drive and around the loop in the center of campus, then back a few hundred yards to a quick finish. The winning times (including the victorious World Time Trial Champion) hit just under 4 minutes – which, as you may realize if you too finished the 4th grade, is an average of a little over 30 mph. On a slight uphill. Damn.

I can’t say I prefer this setting for the Prologue compared to that of years past: watching Levi Leipheimer power like an f-ing blitzkrieg up the wall of a hill from the Ferry Building to the very top of Telegraph Hill, surrounded by fans packed in 5 deep shoulder to shoulder cheering him hoarse. I don’t think there’s that much adrenaline or testosterone in all of the Silicon Valley put together. But, you can’t just keep the tour static year-to-year… so this wasn’t a bad choice all things considered. But you know what I’d like to see? A straight shot 2 mile sprint across the Golden Gate. Now that, that would be hot. Imagine those photos! The Euro press would go paparazzi over that.

But, back to reality. Look out, here he comes….

He's coming...

Holy schnikes!

he's going fast!

Gone already? I feel like we hardly even got a chance to get to know each other.

Rider gone already

Maybe I can elbow my way up to the finish line… or maybe not.

finish line, from somwhere not at the finish line

I met some damn fancy bikes hanging out there… mass measured with 2 digits after the decimal point, value measured with 5 digits before. But for some reason, there was one special one that really just stood out of the crowd for me. Cause..

He’s racing and pacing and plotting the course,
He’s fighting and biting and riding on his horse.
He’s going the distance.
He’s going for speed.
He’s going the distance.

damn, gina.