Matt Brubeck: Planet Matt

Code: mbrubeck started watching cgyarvin/urbit

Posted in Code on January 31, 2010 04:20 AM

urbit's description:
Urbit: an operating function

Bookmarks: Prezi - The zooming presentation editor

Posted in Bookmarks on January 22, 2010 04:28 PM

Instead of "slideshows," uses a single canvas with slick zooming and panning.

Code: mbrubeck created repository mynock

Posted in Code on January 20, 2010 05:21 AM

New repository is at mbrubeck/mynock

Asides: @bernard_ben Got an Android phone? I like SeattleBusBot (by co-worker @joulespersecond), Google Sky Map, Google Voice, and Toddler Lock.

Posted in Asides on January 19, 2010 03:16 PM

@bernard_ben Got an Android phone? I like SeattleBusBot (by co-worker @joulespersecond), Google Sky Map, Google Voice, and Toddler Lock.

Code: mbrubeck opened issue 52 on ry/node

Posted in Code on January 18, 2010 05:59 PM

[patch] dns API docs are out of date

Bookmarks: Khan Academy

Posted in Bookmarks on January 17, 2010 05:22 PM

Short educational videos "covering everything from basic arithmetic and algebra to differential equations, physics, chemistry, biology and finance."

Asides: Atomic Robo is a must-read for anyone who likes Girl Genius or Penny Arcade (I'm looking at you, @bernard_ben): http://doiop.com/atomic

Posted in Asides on January 17, 2010 04:04 AM

Atomic Robo is a must-read for anyone who likes Girl Genius or Penny Arcade (I'm looking at you, @bernard_ben): http://doiop.com/atomic

Bookmarks: Pausing JavaScript with async.js - Elijah Grey

Posted in Bookmarks on January 13, 2010 10:27 PM

"async.js is a library that aims to make it so you don’t have to mess with callbacks when making applications in JavaScript 1.7 or higher by using the yield statement to pause function execution."

Code: mbrubeck forked ry/node

Posted in Code on January 13, 2010 05:37 PM

Forked repository is at mbrubeck/node

Weblog: Finding domain names with Node.js

Posted in Weblog on January 13, 2010 08:00 AM

I'm working on some ideas for finance or news software that deliberately updates infrequently, so it doesn't reward me for reloading it constantly. I came up with the name "microhertz" to describe the idea. (1 microhertz ≈ once every eleven and a half days.)

As usual when I think of a project name, I did some DNS searches. Unfortunately "microhertz.com" is not available (but "microhertz.org" is). Then I went off on a tangent and got curious about which other SI units are available as domain names.

This was the perfect opportunity to try node.js so I could use its asynchronous DNS library to run dozens of lookups in parallel. I grabbed a list of units and prefixes from NIST and wrote the following script:

var dns = require("dns"), sys = require('sys');

var prefixes = ["yotta", "zetta", "exa", "peta", "tera", "giga", "mega",
  "kilo", "hecto", "deka", "deci", "centi", "milli", "micro", "nano",
  "pico", "femto", "atto", "zepto", "yocto"];

var units = ["meter", "gram", "second", "ampere", "kelvin", "mole",
  "candela", "radian", "steradian", "hertz", "newton", "pascal", "joule",
  "watt", "colomb", "volt", "farad", "ohm", "siemens", "weber", "henry",
  "lumen", "lux", "becquerel", "gray", "sievert", "katal"];

for (var i=0; i<prefixes.length; i++) {
  for (var j=0; j<units.length; j++) {
    checkAvailable(prefixes[i] + units[j] + ".com", sys.puts);
  }
}

function checkAvailable(name, callback) {
  dns.resolve4(name).addErrback(function(e) {
    if (e.errno == dns.NXDOMAIN) callback(name);
  })
}

Out of 540 possible .com names, I found 376 that are available (and 10 more that produced temporary DNS errors, which I haven't investigated). Here are a few interesting ones, with some commentary:

  • exasecond.com – 32 billion years
  • petasecond.com – 32 million years
  • petawatt.com – can be produced for femtoseconds by powerful lasers
  • terapascal.com
  • gigakelvin.com – possible temperature of picosecond flashes in sonoluminescence
  • giganewton.com – 225 million pounds force
  • gigafarad.com
  • kilosecond.com – 16 minutes 40 seconds
  • kilokelvin.com – 1340 degrees Fahrenheit
  • centiohm.com
  • millifarad.com
  • microkelvin.com
  • picohertz.com – once every 31,689 years
  • picojoule.com
  • femtogram.com – mass of a single virus
  • yoctogram.com – a hydrogen atom weighs 1.66 yoctograms
  • zeptomole.com – 602 molecules

To get the complete list, just copy the script above to a file, and run it like this: node listnames.js

Along the way I discovered that the API documentation for Node's dns module was out-of-date. This is fixed in my GitHub fork, and I've sent a pull request to the author Ryan Dahl.

Code: mbrubeck created repository outline-grep

Posted in Code on January 13, 2010 04:34 AM

New repository is at mbrubeck/outline-grep

Weblog: Weekend hack: Outline grep

Posted in Weblog on January 12, 2010 08:00 AM

I keep almost all of my notes and to-do lists in plain text files, so I can edit and search them with Vim, grep, and other standard Unix tools. I often indent lines in these files to create a simple outline structure, and use the autoindent and foldmethod=indent options to make Vim into a simple outliner.

To get useful output when searching through these outline-structured files, I wrote a simple grep replacement. Given a text file with a Python-style indentation structure, ogrep searches the file for a regular expression. It prints matching lines, with their "parent" lines as context. For example, if input.txt looks like this:

2009-01-01
  New Year's Day!
    No work today.
    Visit with family.
2009-01-02
  Grocery store and library.
2009-01-03
  Stay home.
2009-01-04
  Back to work.
    Remember to set an alarm.

then ogrep work input.txt will produce the following output:

2009-01-01
  New Year's Day!
    No work today.
2009-01-04
  Back to work.

You can download ogrep from the outline-grep repository on GitHub, or just read the literate Haskell file. The code is almost trivial (40 lines of code, plus imports and comments); I'm publishing it just in case anyone else has a use for it, and because some of my friends were curious about how I'm using Haskell. I've now written a few "real-world" Haskell programs (compleat was the first). I'm finding Haskell very well suited to such programs, though this particular one would be equally easy in a language like Perl, Python, or Ruby.

This is a one-off tool to fill a gap in my workflow; there are no configuration options or useful error messages. It would be fairly easy to extend it, though. For example, an option to include children (as well as parents) of matching lines might be handy. I recently realized that ogrep often works for searching through source code too, which may generate some more unexpected use cases.

Bookmarks: Overtime by Charles Stross

Posted in Bookmarks on December 23, 2009 03:27 PM

A new Laundry story, free from Tor.com.

Code: mbrubeck started watching snoyberg/yesod

Posted in Code on December 21, 2009 08:08 PM

yesod's description:
A Restful front controller built on Hack.

Code: mbrubeck started watching cpennington/compleat

Posted in Code on December 21, 2009 05:17 PM

compleat's description:
Generate command-line completions from simple usage descriptions.

Bookmarks: The Origins of Pattern Theory, The Future of the Theory, And The Generation of a Living World

Posted in Bookmarks on December 09, 2009 05:40 PM

"I'm addressing a room full of people, a whole football field full of people. I don't know hardly anything about what all of you do. So – please be nice to me." Christopher Alexander's OOPSLA keynote.

Bookmarks: Does every startup need a Steve Jobs?

Posted in Bookmarks on December 07, 2009 05:52 PM

"All products ultimately come from an epic struggle between three perspectives: Desirability, Feasibility, and Viability."

Bookmarks: The Virtue of a Manager

Posted in Bookmarks on November 25, 2009 02:37 AM

"A prime virtue of a manager is the ability to take pride in someone else’s work."

Code: mbrubeck started watching visionmedia/express

Posted in Code on November 19, 2009 07:41 PM

express's description:
Sinatra-like JavaScript node.js web development framework -- insanely fast, insanely sexy

Bookmarks: papert: logo in the browser

Posted in Bookmarks on November 17, 2009 03:42 PM

A complete Logo implementation, with turtle graphics, lists, and user-defined functions.

Code: mbrubeck started watching plasticboy/vim-markdown

Posted in Code on November 17, 2009 04:05 AM

vim-markdown's description:
Markdown Vim Mode

Bookmarks: The Go Programming Language

Posted in Bookmarks on November 11, 2009 12:42 AM

An experimental systems language, from Rob Pike and Ken Thompson and other Googlers.

Journal: 3

Posted in Journal on November 10, 2009 04:45 PM (comments)

It's been a while since I posted a personal update here. Sarah and Eleanor and I have been in a nice routine for a while now, so it usually feels like there's nothing new to report. Unlike last year, we haven't moved or changed jobs (or changed jobs again). Eleanor is now in the long steady climb through toddlerhood, so her milestones and breakthroughs are not as frequent as they were. But over a year, things do add up.

Eleanor turned three last month. This fall she started going to a nearby co-op preschool, four hours a week. She chatters constantly, and likes singing and rhyming. She has started drawing specific things, like people, flowers, and cookies. She likes taking baths but not having her hair washed. For Halloween Eleanor was a monkey and I was the man with the yellow hat. (Sarah was a firefighter, which also fit the Curious George theme.) She enjoys sharing her Halloween candy with us.

Eleanor still spends one day a week at my mom's house while Sarah and I are at work. When Sarah's school started this September, I moved to a four-day work week so I can stay home with Eleanor on Sarah's other work day. This continues a pattern: When Eleanor was born, I worked four-day weeks for a few months at Amazon after Sarah went back to work; before that at GoTech I worked four-day weeks to spend more time on side projects.

I'm still working at Kiha and we're still in stealth mode. The work itself has changed quite a bit, not surprisingly. I feel much more productive than just one or two years ago, thanks to improved sleep at home and a focus on habit- and skill-building at work. I've also started doing more studying and programming outside of work again. My recent side project Compleat got a nice reception on Hacker News and Reddit a couple of weeks ago. I did put a lot of work into that write-up, hoping for more people to read and share it.

That was also the first post at my new weblog. I'll post programming-related articles there instead of LiveJournal or my old Advogato diary, so please subscribe if you want to know what I'm working on. Or if you are subscribed to Planet Matt then you'll see my blog posts along with all my other feeds.

Bookmarks: eclim

Posted in Bookmarks on November 10, 2009 06:16 AM

"The primary goal of eclim is to bring Eclipse functionality to the Vim editor."

Weblog: Android 2.0 ships with V8 JavaScript engine

Posted in Weblog on November 06, 2009 08:00 AM

Google has not yet released most of the Android 2.0 source code, but they did publish source for a very small number of components, including a WebKit snapshot. I was excited to see that the snapshot includes Google's V8 virtual machine. (Previous Android releases used Safari's JavaScriptCore/"SquirrelFish Extreme" VM.) But without the rest of the source tree, there was no way to build and run this on a real Android phone. The SDK includes a binary image that runs only in the qemu-based emulator.

Today I got to try out a Motorola Droid. Here's how its browser compares to Android 1.6 on my HTC Dream (Android Dev Phone / T-Mobile G1) in the V8 Benchmark Suite:

Test Dream (1.6) Droid (2.0) Change
Richards 13.5 15.6 16%
DeltaBlue 5.23 12.9 147%
Crypto 13.2 10.9 -17%
RayTrace 10.9 80.1 635%
EarleyBoyer 23.5 74.7 218%
RegExp did not complete 16.5
Splay did not complete did not complete

Some tests (Richards, Crypto) see little or no improvement, while others (DeltaBlue, RayTrace, EarleyBoyer) are dramatically faster. Just for comparison, let's run the same benchmark on Safari 4 (JavaScriptCore) and a Chromium 4 nightly build (V8) on a Mac Pro:

Test Safari 4 Chromium 4 Change
Richards 4103 4640 13%
DeltaBlue 3171 4418 39%
Crypto 3331 3643 9%
RayTrace 3509 6662 90%
EarleyBoyer 4737 7643 61%
RegExp 1268 1187 -6%
Splay 1198 7290 509%

The precise ratios are different, but the same tests that showed the most improvement from Android 1.6 to 2.0 also show the most improvement from Safari to Chrome. Based on this plus the source code snapshot, I'm pretty sure that Android 2.0 is indeed using V8.

This is exciting news. It makes Droid the first shipping product I know that uses V8 on an ARM processor, although V8 has included an ARM JIT compiler for some time now. [Correction: Palm Pre was first; see the comments below.] For mobile web developers like me, it means we're one step closer to having desktop-quality rich web applications on low-power handheld devices.

Android still lags behind the iPhone in at least one important way for web developers: CSS animation. The iPhone (and Safari on the desktop) provides hardware acceleration for CSS transforms, like this falling leaves demo. On Android, CSS animation is done in software, making it much, much slower. (Even outside the browser, Android's Skia 2D graphics API lacks hardware acceleration. OpenGL is the only way to for Android developers to take advantage of the GPU.) Accelerated animation would really make it possible to write interactive web pages that match the smoothness and responsiveness of native apps.

Final thought: Although the Motorola Droid is still 100 times slower than Chromium on a Mac Pro, it's already faster at some benchmarks than IE8 or Firefox 2 on desktop hardware from just a few years ago.