Video: Speed-Vest in Action!

August 23rd, 2008

Welcome, Teh Internetz. Thanks for the sudden bump of interest in the Speed-Vest. Since our original posting over a year ago, the vest has undergone testing in both MPH and KPH, traveled from Minneapolis to Portland to Vancouver and back, been damaged in a disco and reborn on the workbench. If you’re in Seattle next month, come check out the 2008 Pro Walk/Pro Bike Conference, where Brady will have the Speed-Vest on display.

Here’s some video of the Speed-Vest in action. That’s me stunt-riding, with Brady on steady-cam. You can also find it, with other updates at the newly-relaunched speedvest.com.

(music by The Golden Greats!)


The Shining $PATH

March 21st, 2008

The search-path algorithm for UNIX is broken, and has been broken for a long time.

$PATH is fine for specifying bin directories; in fact, there ought to be just one $PATH per host, which all processes can inherit, rather than users having to set such things in their dotfiles. $PATH isn’t obsolete, but it needs help.

The problem is with interpreting the order of the PATH variable. The historic algorithm, implemented by the first exec() and its descendants, is to search each of the dirs in $PATH, in the order in which they appear, until a file matching the provided command name is found, and then exec that file. It’s a simple algorithm: fast, easy to implement … but it’s also the cause of a whole genre of UNIX aggravations.

Now that we live in The Future, and our computers are smart, here’s my vote for a better algorithm: first match the command name against pattern keys in the list of key-value pairs in the $PATH_HINTS variable; if nothing is found, default to standard UNIX behaviour.

The PATH_HINTS variable would map patterns to bin directories, like so:

mysql.*=/usr/local/mysql/bin;php$=/usr/bin;php4=/usr/old/bin

This expresses something like: if i’m executing “mysql” or “mysqldump” or “mysqladmin”, look for it in /usr/local/mysql/bin. If i’m executing “php”, look in /usr/bin — but if i’m “php4″, run it from /usr/old/bin; for “php5″ or “php6″ or “php2000″, follow the search path like you usually would.

I’m using regular expressions here; someone might be able to convince me that file-glob matching patterns are better, perhaps for performance reasons … but if you’re really concerned about exec performance, provide a complete path to the file you want to execute. Duh.

My system has three copies of mysql installed, and I need the second one … which lives in /Applications/MAMP/Library/bin, if you can believe it. (UNIX veterans are cringing, of course.) I don’t want to re-order my PATH just for that, because re-ordering my PATH could have unintended consequences, especially as regards the three versions of Perl on my system. (And yes, I have my reasons, and they’re good reasons.)


Set my iPhone free!

January 25th, 2008

Usually, if I can think of some software, the Internet has already written it. So here’s a list of the things an iPhone could do with the right 3rd-party applications — legal and otherwise:

  • Stream music from a computer running iTunes (or any DAAP server), optionally save it to my iPhone.
    • Google’s iPhone Remote can get you to the files & let you stream them, but the interface is crude & the security issues need to be addressed.
    • WeBot is fairly slick for over-the-internet access of music files, though it looks like maybe I must route the music through their servers even if I’m within range of my mac. But it might do the trick for my home song server. Still not really DAAP compatible, tho.
  • Stream music from someone else’s iPhone (a DAAP server), and/or let two iPhone users connect and swap songs manually.
  • Stream music from an iPhone to an AirPort Express via AirTunes.
  • Record audio.
  • Share pictures, audio, or any other kind of file between iPhones.
  • Stream internet radio via playlist files, or any other standard now in use.
    • – Seeqpod does something in this space — they send a quicktime audio file that knocks iPhone Safari into video-playing mode, so you get all the controls. It works, but Seeqpod also does a bunch of other meddling that gets in the way. Even worse, they seem to be missing a lot of the best stations, including many which already netcast. KFJC, KUSF, KPSU, KCMU … college radio, basically, is absent.
    • i’m amazed that Live365 doesn’t have an iPhone version of their site.
    • Other people must be working on this.
  • Remote-control iTunes on a Mac or PC, or some other server software that streams to an AirPort.
    • – Signal does this, although it’s fairly clunky
  • Make internet phone calls over a wi-fi connection for free.
  • Trace the iPhone’s location through the day, and create a time/location map using Google tools.
  • Attach a photo and an audio caption to a pin on a map, and upload that data to an online mapping community.
  • Option to save any web-embedded MP3/AAC/video files I view.
  • Sync via Bluetooth.
  • Use the built-in accellerometer as a pedometer, counting my steps.
  • iChat — free live chat, instead of expensive SMS.
  • Free SMS via internet anyway! End the farce of SMS charges!
  • A calculator with all the math functions, not just the four easy ones.

I’m looking forward to the SDK release in February.


You need to restart your comptuer.

November 8th, 2007

An irksome and aggravating linguistic trend, a popular mistake, has now spread so wide through English-speaking culture that it’s included in the firmware of my MacBook Pro.

“You need to restart your computer.”

Whether you are a programmer explaining how I should cope with your system’s collapse, or a bureaucrat describing how best I should waddle through the maze of your forms, or anyone else attempting to enforce petty personal rules, one thing is certain: I don’t need this. I don’t need to fill out your form 2319-A. I don’t need to put down my video camera in your store. And I definitely do not need to restart the computer that moments ago held my unsaved work.

These needs are your needs. Not mine. I’m not the needy person in this relationship. My needs are simple: for things to work, for people to speak English correctly, and for certain individuals — really, just a handful of them — to fuck off. And those off-fucking people have needs too, I’m sure. I don’t think it would be healthy for me to project my off-fucking needs onto them, when they are so needy already. They don’t need to fuck off and die. I need for them to fuck off and die, and decompose, and be forgotten, and perhaps implode. That’s different.

The correct phrasing therefore is: “Your computer needs you to restart it.”


named pipelines in unix

August 28th, 2007

while using a collection of filter and mungers and sorters to extract statistics from the apache logfiles in the traditional manner, it occurred to me that we really need a shell that’s able to create a thing called a ‘named pipeline’.

this is similar to, but not the same as, a named pipe. to wit: suppose my webserver’s filesystem is 80% full due to immense logfiles, and i am sifting those files for data. first, i have to combine them:

cat file1 fil2 file3 | sort | grep | munge > output

.. except actually file2 has got a bunch of crud from a previous egrep in it, and needs special treatment, so:

cut -d: -f2- file2 > file2.fixed
cat file1 file2.fixed file3 | sort | grep | munge > output

… only there’s not enough space on my filesystem for a second copy of most of the contents of file2, and anyway i’m only looking for a tiny percentage of that file.

what to do? well, named pipes are a handy unix-ism for this situation:

mknod file2.fixed p
cut -d: -f2- file2 > file2.fixed
cat file1 file2.fixed file3 | sort | grep | munge > output

that solves my space problem. only, i’m still re-running my sort over and over — kind of figuring it out as i go — and whenever i need to run it again, i have to re-start that stupid cut command. feh. what i need is the power of bash:

mknod file2.fixed p
(while true; do; cut -d: -f2- file2 > file2.fixed ; done) &
cat file1 file2.fixed file3 | sort | grep | munge > output

… which will re-start the command every time the pipe is opened for reading. that’s about what i want. only, instead of typing all this mess:

mknod foo p
(while true; do; cmd | cmd | cmd | cmd > p; done)&

i’d much rather just type this:

cmd | cmd | cmd | cmd |% p

when i type that special |% notation, the shell should first create the named pipe, then spawn a process to execute the pipeline into the named pipe, restarting it as necessary for as long as the shell is running and the named pipe exists.

in addition, it ought to have a mechanism for quietly halting when the named pipe is deleted, and maybe for automatically restarting such pipelines when they are found abandoned by a previous shell. and someone ought to be able to figure out what’s coming down that pipe without having to suck on it — i.e. there needs be a mechanism to inspect which commands are hooked to what pipes.

in short, the resulting named pipe ‘p’ is more than just a pipe, it’s a predefined pipeline that can be started and read from any time, but that consumes minimal resources until it is called upon. hence ‘named pipeline’.

(of course we’re consuming some memory here, with all those commands standing around blocking for output. but perhaps our clever implementation will avoid executing the commands until such time as their output is requested.)

if i was smarter or less lazy i might hack that %| syntax into the source of bash. but instead, i’m going to write a utility called ‘plumb’, maybe like so:

plumb p ‘cmd|cmd|sort|grep|etc’ # to create and start a pipeline
plumb p # to inspect
replumb p # to restart

sadly, the commands must be single-quoted, or the pipes escaped somehow, in order for this to work in the shell. but it’ll do for now.

making named-pipeline creation trivial allows me to construct what would otherwise be an unwiedly-long unix pipeline as a series of small, easily joined & inspected fittings. i can set up a large pile of sub-processes, each ready to filter the data another step, none of them consuming file space in the process of doing so, and with these craft my ultimate super-grep one step at a time.

plumb file2.fixed ‘cut -f2- -d: file2′
plumb sorted ‘cat file1 file2.fixed file3 | sort -u’
plumb sifted_a ‘egrep a sorted’
plumb sifted_b ‘egrep b sorted’
plumb formated ‘prettyfy sifted_a sifted_b’
plumb beer ‘mail -s “today’s traffic report” myboss@myjob < formatted’

what’s brilliant is, if i inspect ‘formatted’ and find an error introduced by ‘file2′, i can edit ‘file2′ to fix it, and ‘formatted’ will reflect the change without additional work or resource-consumption — an implementation of functional programming in plumbing, basically — thereby enabling:

00 17 * * * cat beer > /dev/mykle


Speed-Vest!

June 18th, 2007

 

 

 

The SPEED-VEST is a bicycle safety device and advocacy tool which displays the wearer’s current speed on their back in easy-to-read lighted numerals. It improves rider conspicuity while legitimizing bicycle speeds on the roadway. Originally conceived by Brady Clark and engineered by Mykle Hansen, it just won the Hub Bike Shop’s Bike Gadget Contest in Minneapolis, MN.

The system consists of a wheel speed sensor, a wearable numeric display and a small computer that does the thinking. The computer is an Arduino: an open-source embedded computing platform powered by an Amtel microcontroller. It runs for 6 hours on a 9 volt battery, and is about this big:

in the palm of my hand.

 

The numeric display is made from electro-luminescent wire, supplied to us by CooLight.com. El-wire glows brightly when supplied with a very small amount of high voltage, high-frequency current. It’s cheap, flexible and fairly durable. One AA battery can power the SpeedVest display for up to 6 hours.

... and it's pretty.

 

This project was my first foray into microcontrollers. Not knowing much about electronics, I imitated this circuit closely; however the Arduino platform, suggested by the members of Dorkbot PDX, was much easier to use than I had imagined and quickly became my new favorite computer.

(video)

 

I wouldn’t call the project arduous, but the most time-consuming aspect was probably soldering the circuit together on the Arduino’s prototyping daughterboard. Next time, I’m going to learn how to make my own printed circuit board.

soldering, soldering, soldering ...

 

Meanwhile, Brady designed a template for the el-wire digits, based on the digits in old Nixie tubes. It seemed appropriate — it’s almost the same technology, really. Since I had 12 pins to play with, and since you can only overlap so much el-wire, we put five digits on the right and seven on the left:

the stacked numbers template

 

We mounted the el-wire on a piece of black denim, taping on the template as a guide, using a technology the Coollight.com folks hipped us to: the Buttoneer. I don’t know how well it works for re-attaching buttons, but it’s great for this.

the buttoneer at work

 

We achieved sharp corners by running the wire behind the denim through a hole, and then back through to the front at another angle.

the view from behind

 

In order to display the SpeedVest for judging at the Gadget contest, we needed a mannequin. So, we borrowed another great piece of Internet advice. Witness below the birth of the creature known as “Packing Tape Brady”, made possible through the assistance of super-assistant Heather Anderson:

We were up most of the night before the event deadline: debugging code, writing up handouts, fixing bad solder, screen-printing text onto reflective backing, velcro-ing everything together, and arguing about the relative artistic worth of the digits zero and seven. The next morning, we got it all together and brought it to the Bell Museum with about 15 minutes to spare.

 

(Somehow we neglected to get a picture of it working — but it worked!)

Despite some excellent other entries (including the zoobombariffic Superman Bike!), we were tickled pink when the judges at the Bike-In presented Brady and myself with a $150 gift certificate from the sponsoring bike shop, the HUB bike co-op of Minneapolis. And what a gift certificate! This beautiful hand-drawn check would have been prize enough, even if it hadn’t been financially negotiable.

words don't do it justice.

 

The Speed-Vest will be undergoing speed trials in Portland, Oregon at an undisclosed test track this Sunday night. If you are interested in bringing the Speed-Vest to your town or event, or just want more info, please drop us a line:
info @ speed vest . com


daemontools suck!

June 4th, 2007

(updated 6/20/2007 to be less rambling and more fair.)

msl runs on free software. one of our main sources of free software has been Daniel J. Bernstein, the obsessively secure author of our favorite MTA, qmail, and our favorite domain name server, djbdns.

if you follow djb’s instructions for installing djbdns, you’ll be led almost automatically to install the third major piece of djb technology, daemontools. daemontools is djb’s answer to various bugs and complaints with time-tested Unix components such as init and inetd. it includes a system for running daemons and other always-available services under Unix.

you can read what’s good about daemontools here. to read what sucks about daemontools, you’ve come to the right place.

things that suck about daemontools:

1) needing to be in a certain directory to run the command? user-interface error of the first degree.

2) no command-line help? no man pages? no coherence to any well-known online documentation system. clearly, djb hates them all and plans to write something better, but he hasn’t yet, but he’s suggesting people use his software blind, without docs. not a problem if you have a web browser. i didn’t. my whole network was down due to dns failures, and i had console-only access to a server with no x-window interface, just a single screen. this made bugs #1 and #2 extremely severe bugs; like putting a bag over my head and shackling my leg to a tree.

apparently DJB endorses HTML docs over man pages; he says web browsers are more evolved than ROFF readers, although one of those standards is twenty years older than the other.

if the interface to the software is command-line, then the interface to the documentation should be too. if ’svc –help’ just listed the cryptic argument options of svc, i’d be an hour younger.

3) assumes a lot of low-level knowledge of unix file management. it requires shell commands for administration, instead of its own administration interface. djb says this is easier to automate;
editing config files is hard to automate. perhaps so. but if it’s so easy to automate, why isn’t it automatic?

4) envdir falls over with a confusing, useless error message when a directory is accidentally created in an env directory. since daemontools invites, requires even, users to be creating both files and directories within its labarinthine directory structures, it should tolerate exactly this kind of user error, and explain its own errors clearly and humbly.

5) then there’s the difficult to search nature of his documentation itself, but clearly that’s not his strong point. i mean, i enjoy the terseness and the smugness, but it’s just not welcoming to the reader. his headings in the djbdns section are a random list of thoughts.

6 ) his departure from unix logging is pointless. put your logs in a file, in a log directory. rotate that log however you like. give it a human readable name, not some hex code. likewise, put the date in a human-readable form. i have no problem with being y10k compliant, but do it in a human-readable way. log files are read by humans. nobody wants to go hunt for a special log file decoder ring just to read djb’s log files, esp given bugs like #4 (unclear error messages.)

tho i must admit i was stoned at the time. but what i’m looking for is an error message like:

“envdir is trying to read all the files in DIR, but one of those files is a directory, which is not allowed, and, though perhaps i should just try to ignore this problem as best i can, i refuse to do so on principle. ergo, i must die. farewell.”

9) in general: djb desires that sysadmins twiddle around in his maze, but his maze is full of twisty, turny passages, all different. the advantages of a single configuration file become painfully obvious; humans navigate documents more easily than filesystems.

he demands that they learn a new command for every single way they used to do something before. the ui compatability with initscripts or any other comparable system is nil.

really the ideal interface to manage a daemontools/djbdns/qmail installation is a windows file explorer. and that just ain’t right. bind has horrible config files, but just a few of them.

(now, having said all that, i really don’t mean to be complaining about daniel j. bernstein. he’s a great guy. my complaint is with this sofware. alas, his personality and his software are so deeply related in my mind that i began with technical complaints and now i have all but accused djb of plotting to kill my cat. sorry. sometimes i just get upset.)

just about all of these complaints come down to a central user interface problem: daemontools hasn’t got one. this is a classic example of what unix-haters hate about unix. the integration of the technology with the user is left as an exercise for the user. what’s odd to me is that qmail and djbdns are both, along with their other advantages, much easier for a sysadmin to grok, configure and live with than the respective dinosaurs they set out to slay. (sendmail and bind, respectively.) their UIs are chief among my reasons for using them.

however, the technologies that daemontools hope to usurp (initscripts. inittab, inetd, etc.) aren’t dinosaurs at all — they’ve been evolving as UNIX has evolved, and these days can answer most of djb’s complaints about them.


Lightbar!

May 26th, 2006

msl, 23.com and Chetland Studios presented …

LIGHTBAR

… and it was good. pictures and detritus here.

kudos to our majestic visitors the Solar Royalty, our musical guests the Golden Greats, and all the fabulous people.

Structurally it was a central load-bearing tower of three extension ladders, guyed to three points to form a tetrahedron, over which we draped a square poly-tarp. The interior was surprisingly hospitable in all kinds of rain and cold. We didn’t get to try it against severe wind — it probably would have collapsed. Not up to BRC standards, but successful nonetheless. The centerpoint, where the weight of the tarp plus tension is borne on a 1-foot-square point, began to fray in that way poly-tarps do. Even really expensive ones.

Add power, sound system, video games, furniture, a bar, a band, a dress code, and about 3000 watts of light; stir. Pour all over your friends, their friends, and 50 strange furry people on bicycles.

COSTS: Total cost of construction: $200 (for a fucking tarp, ouch). It took about 30 dude-hours to erect and 15 dude-hours to tear down. We kicked in a couple hundred bucks for champage and snacks. Various other costs absorbed by my absorbent friends. (THANKS!)

Next year: central heating; extension cords instead of real romex (what was I thinking?); some kind of lawn protection; a circular clip around the weight-bearing center, to spread the load; and i think we’ll keep it up for a couple weeks.