June 12, 2008

Maybe If We Ignore It, It’ll Go Away

Filed under: Uncategorized — numist @ 7:16 am
Tags: ,

I wonder when ‘people’ (a statistically significant part of the population) are going to start changing their lifestyles in order to reduce their reliance on gas. It’s not going to get any cheaper.

At least people are starting to talk about it in more interesting ways than simply complaining about it now. When it costs $100 to fill your tank (and for California that means every big car and every truck and SUV, which is most of the vehicles on the road), you start thinking about how trapped you are. We’ve been treating it like air for a really long time and no one marvels at the ability to just hop into a car and go 65 mph anymore.

Clear your head and think about it for a second, it’s actually amazing, and it’s going to get harder to do in the future. Not because we’ll run out of oil (I think the Peak Oil guys are wrong, but are looking in the right direction, a topic for another time), but because it will be prohibitively expensive. We’ll only be able to afford (as much as we cal) to use oil for freight, since without it we lose economies of scale. Eventually we’ll probably come up with energy alternatives for freight as well to make it more affordable, but the point is freight is probably the last thing requiring oil that we will give up.

Energy is a 0-sum system (what goes in is equal to what you can get out), says physics. In the case of fossil fuels, the cost was paid for over billions of years, so it appears like we get it for free. Aside from fossil fuels and atomic energy, the only inputs into the energy system that come immediately to mind are the sun (which we won’t have to worry about for a good long while) and geothermal (which is so subtle we really haven’t figured out a good way to use it). Hydrogen, biofuels, all our alternative energy solutions, they all rely on solar energy either by panel or leafy plant.

But where are we going to put the panels and/or leafy plants? Panels can go out in the desert, where no one wants to live (and where they’re most effective — didn’t that work out well!), but in the case of mobile fuel, solar energy needs to be stored (at a huge loss) into some sort of high-density storage system that is mobile. Most people think this is Hydrogen. Whether or not this is viable is outside of the scope of this article, but everyone seems to agree that biofuels are much easier than storing electrical energy into a mobile unit, being faster to produce and refill (how fast can you pour?). Unfortunately crops for biofuels are much more difficult than solar electricity generation, because these crops are also needed for food, and there is a painfully limited amount of fertile soil.

Given human population growth, we’re going to want to use as much of the fertile land for eating as we can (since no one wants to be thought of as anti-people — once population hits the top of that exponential growth curve we’re going to see crazy things. I want to think about that even less than I want to think about our energy situation), and using crops for fuel (which is in infinite demand) has horrible secondary effects on other things that need them, like feed for animals (milk, eggs, meat).

Once (actually, hopefully before) oil becomes economically unfeasible, we’re going to have to think hard about how we’re going to get our energy, because there’s no magic bullet. We need energy to live now (with so many people relying on medications and the health business to live or function, it boggles the mind), and we don’t have a long-term plan to meet even the minimum demand for survival. We don’t need people to think of solutions, because we already know the existing inputs into the energy system. What’s not known is the best way to harness the energy, how to scale to meet demand, how to implement, and then actually implementing using technology of today instead of waiting for tomorrow. This is going to cost more energy to implement than it’s going to generate for an appreciable amount of time, which means we’re going to be using oil for it, so we should be doing it sooner than later while we can afford to use oil, instead of waiting until it’s too late to use oil already. Just like the cliché about money, it takes energy to make more energy.

Well, the industrial revolution was fun while it lasted. Wonder how we’re going to transition into the next period in history. There’s a lot of different directions this could go, and I think we’ll have a pretty good idea of where we’re headed within the next decade. We shouldn’t all wait for the results, checking to see if we need to take action. Changes need to start happening now.

The energy problem is not actually hard. We don’t need huge advances in technology to do this. It becomes hard because there’s no invested interest in it (more than a magnet on your bumper and a glance at this post), and as long as people are ignoring it in hopes that it’ll blow over, it becomes harder to implement a solution, requiring more effort from them when the time comes to actually make a change.

A lot of problems are like this. At a smaller scale, this is why social drama is such a problem — it’s not a problem if it’s dealt with early, but left to grow it destroys relationships. Unfortunately, the energy problem is something we can’t put off and then live with the consequences. I mean, I suppose we’re capable of ignoring it, but the consequences are more than just losing a friendship.

Hopefully we’ll stop just talking about it and start doing things about it soon at a societal level, not just an individual level. It doesn’t matter if you’re vegan or drive a hybrid (wretched things), your house and your office still uses/wastes more than you save, and you’re kidding yourself if you think you’re saving Enough. We’re going to have to work together on this one, and make even bigger changes.


June 10, 2008

What’s Yosemite?

Filed under: Uncategorized — numist @ 4:48 am
Tags: , ,

Since folks seem to like Steve stories that don’t involve people getting fired, here’s another Steve story from way back, this time from one of the guys on the AppleScript team.

Steve is a great leader for the company not just because he’s good at finding problems Apple can solve and then selling them, but also because he’s very aware of what’s going on inside the company. Once in a while, Apple has a Beer Bash, which is when they fill Caffé Macs with buffet style food, roll out a bunch of kegs, and invite everyone to come on out and finish off their Friday afternoons over some brew, snacks, and socializing. Note that this is very different from what WWDC attendees call a Beer Bash, lacking loud music and a few thousand third-party developers.

Our hero (we’ll call him Bob, for the sake of anonymity) was on his way to his office from the Beer Bash and took the elevator up to the second floor of IL1. Before the doors closed on the elevator, Steve hopped in.

Steve likes to take an interest in people when he’s idle, which usually only happens in the elevator. (There are more Steve stories that take place in an elevator than any other location which is part of why I never took the elevator in IL1. Too scared.) Steve asked for Bob’s name and team.
Upon learning Bob worked on AppleScript, he said, “You guys need to get (cites some bug in Radar) fixed, it’s holding us back from shipping Yosemite. What are you guys doing about that?”
Bob replied, “I’m just heading to my office now to check on test results for a fix we’re working on.”
“Huh, good answer,” Steve said.
A short silence passed while Steve pondered, ended by the elevator opening at the second floor and Bob exiting (escaping?).

Bob went straight to his manager and said, “What’s Yosemite?”
“Where did you hear about that? Shut the door!”
“Steve Jobs just told me we have a bug open that’s holding back Yosemite.”
“What did you tell him?”
“That I’m just up here to check up on the test results for our fix.”
“Huh, good answer.”

Cutting Through The Crap

Filed under: Uncategorized — numist @ 4:31 am
Tags: , , , ,

So, MUS 15 at UCSD (and a lot of other courses offered by the Music department) makes tracks relevant to the course available through a web application called DAR (short for Digital Audio Reserves). It has the potential to be really nifty, but as you’ve already guessed it’s actually a huge pain. Check out the FAQ. If you don’t like Real Player (and it’s likely that you don’t), it’s possible to play the music using VLC or MPlayer, but I wanted more than that, since I can’t always be on the internet, and streams are a pain to deal with in general.

(click for bigger)

First, let’s have a look at the links on the page you see above. The link for “Spectacle to Refute All Judgements” is, and the file itself looks like:


The “mp3” file is an imposter, containing the location of an rtsp stream. As I’ve already mentioned, MPlayer can handle the stream, and I found online that the -dumpstream argument will dump the stream to disk, so running mplayer -dumpstream rtsp:// results in a 5.2MB file.

This is where we start to get ambitious, and run into two different problems. First, the file really is a dump of the stream, so it still requires a player that supports Real formats to play. Second, scripting mplayer by using mplayer -dumpstream `wget -O-` results in some strange output. After looking around unsuccessfully for a solution to the first problem, I emailed my TA. While waiting for a response, I looked at the second problem, because it didn’t seem to make sense.

The normal output from mplayer looks something like this:

numist@spinnaker:Users/numist/tmp/dar$ mplayer -dumpstream rtsp://
MPlayer 1.0rc2-4.0.1 (C) 2000-2007 MPlayer Team
CPU: Genuine Intel(R) CPU           T2500  @ 2.00GHz (Family: 6, Model: 14, Ste
pping: 8)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
115 audio & 237 video codecs

Playing rtsp://
Resolving for AF_INET6...
Couldn't resolve name for AF_INET6:
Connecting to server[]: 554...
Cache size set to 640 KBytes
realrtsp: Stream EOF detected
Core dumped ;)

Exiting... (End of file)

“Core dumped ;)”, cute.
The output from mplayer using wget to fill in the rtsp link looks like this:

numist@spinnaker:Users/numist/tmp/dar$ mplayer -dumpstream `wget http://earth.u -O-`
--2008-06-09 20:53:32--
Connecting to||:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 50 /x-pn-realaudio
Saving to: `STDOUT'

100%[======================================>] 50          --.-K/s   in 0s      

2008-06-09 20:53:32 (483 KB/s) - `-' saved [50/50]

MPlayer 1.0rc2-4.0.1 (C) 2000-2007 MPlayer Team
CPU: Genuine Intel(R) CPU           T2500  @ 2.00GHz (Family: 6, Model: 14, Ste
pping: 8)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
115 audio & 237 video codecs

.laying rtsp://
Resolving for AF_INET6...
Couldn't resolve name for AF_INET6:
Connecting to server[]: 554...
realrtsp: got message from server:
23;This server is not configured to play the data type you requested. Please co
ntact the Real Server Administrator for assistance.
rtsp_session: session can not be established.
Resolving for AF_INET6...
Couldn't resolve name for AF_INET6:
Connecting to server[]: 554...
http_read_response read 0 (i.e. EOF).
No stream found to handle url rtsp://

Exiting... (End of file)

There is some weird output going on here, and it’s not creating any files on disk.
I spent a while staring at this until I noticed the line .laying rtsp:// That period at the beginning is not a typo, it’s what gives away the problem: the file that wget grabs uses DOS line endings. Of course! Stripping the \r fixes the problem and allows mplayer to get the stream without you having to save the “.mp3” file to disk and grabbing the rtsp link inside by hand.

At this point, my music TA emailed me back, and said something astonishing:

Well, you can download the stream container file (the suspicious 1k mp3 files that are linked on DAR), open that as a text file, and voila find the address to the bona fide rtsp:// audio stream. Then mplayer can be used via CLI to save the stream as a wav, mp3, or whatever else (with a command like: mplayer -cache 10 -ao pcm -aofile stream.wav rtsp://blah.rm). Or apparently you can use either Flashget (a standalone app) or Flashgot (a Firefox extension), either of which can take that same rtsp:// address and save it directly to your box. I’ve never used either of those, so you’ll have to use “the google.”

I really hope you’re able to work something out. Yes, DAR sucks donkey balls. But the university is unfortunately unwilling to budge on using Real’s crap-in-a-can system. Oh, well. If all else fails, call the music library. They’re usually fairly adept at working these issues out. But if you’re having problems with it, I’m not sure how much more help they can be.

Astonishment. I sit there for a few moments very impressed and completely humbled. -aofile is deprecated in the latest mplayer, but this new information led me to -ao pcm:file="filename", which causes mplayer to dump the stream to a wav file.

At this point I had enough information to make a (very dumb) scriptlet to get the streams. I could have cleaned it up and made it a lot more intelligent, but I’m a bit short on time and don’t have a reason to. Final result:

filename="01 Jason Forrest - A Spectacle to Refute All Judgements"
wget -q $url -O- > link
dos2unix link
mplayer -cache 1024 -vc dummy -vo null -ao pcm:file="$filename" `cat link`
lame --alt-preset standard "$filename" && rm "$filename"
rm link
echo "Finished encoding $filename" | growlnotify -a Terminal "DAR: Finished"

If you’re not familiar with the commands in here:

  • wget janks files over http. If you have a command line, you probably have wget.
  • dos2unix converts files with DOS line endings into files with UNIX line endings (\r -> \n). It’s probably not on your system by default.
  • mplayer is a media player (and more!). If you’re on Linux you might already have it, if you’re on OS X you’ll need to install it yourself either from their site or via MacPorts
  • lame is an mp3 encoder. I use it because disk space is cheap, but not that cheap. The scriptlet uses --alt-preset standard for it’s quality setting because there’s no point in wasting extra bits using --alt-preset extreme since the wav was generated from a previously compressed file anyway. If anything, we don’t want to hear the artifacts being added. This is probably not on your system by default.
  • growlnotify is a command-line interface to Growl. If you don’t know if you have growlnotify installed into your path, then it’s not installed into your path. You should install it though, it’s really handy.

I’m sure folks have had this problem before me, and I’m equally sure people will have problems using DAR after I’m gone. Hopefully one of them will see this.

Blog at