Archive for the ‘Coding’ Category

Hire Me!

Sunday, September 11th, 2011

My job search has been concluded

I’m looking for a full-time engineering job, starting in January 2012, in San Francisco (or reachable from there with shuttle/pubtrans). 1

I work on low-level software and high-level hardware. I make the inside guts ugly so the outside product can be pretty. Then I make the inside pretty too. I’m allergic to bad design and to development cultures that don’t discourage it.

I don’t believe that “done is better than right”. I believe that doing it the right way is a worthwhile goal in itself, and anyway it’s usually the easiest and fastest way in the long run. Nobody ever lined up at 6am to buy the cheap 50% solution.

Here is my resume.

You should hire me:
… If you need someone to look simultaneously at several layers of your stack (hardware, firmware, bus, driver, application) and look for inefficiencies (“opportunities”),
… or to look simultaneously at several layers of your stack and tell you why they’re not working together.
… If a well-meaning director handed you a two-page project plan lacking details and illustrated only with a few comically simple box-and-arrow diagrams, then asked you to please “Build this. It’s just a couple of processors and an FPGA, it shouldn’t take too long, right?”
… and the hardware group laughed when you asked if they could spare an engineer this month.
… If sometimes the kernel panics with some message about skb buffer underrun and you think it’s a bug in your driver but you can’t quite track it down.
… If you’ve heard dark whispers that the C preprocessor can do ever so much more than simple inline functions, and you want a guide into the mysterious realm of generated code.
… If the local security wizard walked by your office last week, paused, scrutinized your whiteboard diagram, pointed at one ordinary-looking box, muttered “Yeah, you could get 0wned through there” to herself, and walked away. You don’t know what to do now.

Update 19:05 12 Sep: Resume and contact info added.

  1. I’ll consider the Peninsula, South Bay, or Boston, for particularly interesting prospects.

Why You Don’t Want ZFS on Mac OS X

Wednesday, March 16th, 2011

Scott told me yesterday about a company bringing Sun’s ZFS filesystem to Mac OS X, picking up where Apple left off.

To be honest, I don’t understand why someone would try porting ZFS now. What Apple offered wasn’t just a new filesystem. Users don’t care about filesystems: they are a technical detail. Instead, Apple would change Mac OS X, across the whole system, to take the best advantage of the new capabilities and guarantees ZFS offers.

“Time Machine 2″ with ZFS’s cheap easy snapshots. A new default policy to set copies=2 on important folders like ~/Documents and ~/Library/Mail – better protection for users’ data, with zero effort. Every FireWire or USB hard disk would become as smart as a Drobo. And so on. Apple would do what they always do with new technology: turn an uninteresting detail into a series of small and large fixes and features that directly improve the Mac OS X experience for all users.

Instead, this new port will be just another entry in a list of filesystems most people don’t use. The system at large won’t do anything differently to take advantage of ZFS. To get any real benefit, users will have to study ZFS and figure out how to apply it to their system. That limits it to users technically competent enough to just use Solaris or Linux.

The worst news is that this port will become a support nightmare. 10.7 will come out soon. Apple puts zero effort into maintaining compatibility for low-level system modifications. So, 10.7 will probably break ZFS. The developers will scramble to fix it. Some users will lose data in the confusion. Two years later, 10.8 will come out. It will probably break ZFS. And so on.

For those who choose ZFS on Mac OS X, the question remains: What problem are you solving? What data do you have that’s so important that you want the durability guarantees and administration capabilities of ZFS, but so unimportant that you don’t mind the unreliability and future integration worries of a filesystem your OS vendor already decided they don’t want to support?

Thanks to my Dad for the Question.

Nested Makefiles are Awful

Sunday, November 21st, 2010

I propose a new rule for software development:

A Makefile from one project should never recurse to a Makefile from a different project, unless using a subshell with a clean environment.

In other words, if you must automatically build another project, you should do it in a way indistinguishable from the way it would be built directly by a user.

This post was brought to you by uClinux-dist and Buildroot, two complicated script systems to turn code into system images.

Passwords and typing timing

Tuesday, February 24th, 2009

I type my 17-character password very fast. It’s a strictly automatic process, all muscle-memory.

The timing is very critical and synchronization problems happen a lot. There’s lots of hand-alternation; sometimes one hand is a decisecond early or late and I type a letter out of order. Sometimes I hit J instead of H because the “down” muscles are faster than the “left” muscles.

All these errors are compounded because I don’t actually know my password consciously. I’m not typing a word, I’m just activating a motor program. I don’t think “H”, I just put my finger “where it’s supposed to go next”. So all the error-correction in the cerebellum and motor cortex that I’ve built up from a decade of typing never has a chance to help.

Amusingly, I can type my ordinary and root passwords just fine under the influence of alcohol. So a complex password isn’t an IID for a computer.

On a darkly humorous note, many years from now, this may be an excellent stroke diagnostic. If I can’t type my password without concentrating, it’s time to call the paramedics.

Dumb Things are Happening with Comments

Sunday, November 23rd, 2008

I get a lot of spam comments on the blog here. You don’t see them, because I mark them as spam, a few hundred every week. They’re roughly uniformly distributed across all my posts. If fewer posts are open, I get fewer comments. So I want to minimize the number of comments I have to deal with.

I’m trying to use Mark Kenny’s Extended Comment Options plugin to automatically close comments on old posts. I used this plugin a long time ago, and it was great. But now, in WP 2.6, it seems to do exactly the inverse of what it says on the box: it closes my most recent posts and opens the oldest ones.

I don’t understand. Isn’t this just
UPDATE `wp_posts` SET `comment_status` = 'closed' WHERE `ID` IN (SELECT `ID` FROM `wp_posts` WHERE `post_status` = 'publish' AND `post_type` = 'post' ORDER BY `post_date_gmt` DESC) LIMIT 0,10

(Okay, it’s not quite that simple, because MySQL doesn’t do ORDER BY or LIMIT in subqueries… But it’s close! Temporary table?)

Has anybody got a good solution to this, better than a cron job to run that query?

Meanwhile, apologies to everyone who wanted to comment but couldn’t.

Chrome’s User-Agent string

Tuesday, September 2nd, 2008

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13

It upsets me how many product names other than Chrome are in there just because stupid JS tries to guess what the browser can do. Next time, we need a new way to detect browser capabilities. I suggest we detect the actual capabilities, not try to guess based on who shipped what feature first in 1997.

It’d be cool if the browser vendor cartel got together one day and decided all User-Agent strings would be simple again, like “Chrome/0.2.149.27 (Windows NT 5.1; en-US)”. And any jankety-ass copy and paste image rollover script from 1997 that breaks if the string doesn’t start with “IE” or “Mozilla” can get stuffed.

How to compute the size of a tar archive before you tar it

Tuesday, September 2nd, 2008

Suppose you have a tree of files and directories, and you want to pack them up into a tar archive. Here is how to find the size of the resulting archive. This is useful if you want to stream an archive out to a browser, but want to send the correct Content-Length header first.

  1. let F = number of files in the tree
  2. let D = number of directories in the tree, counting the root
  3. if there are any non-ordinary files, stop here. results undefined.
  4. let S = 0, H = 0
  5. for each f in F, S += ceil(size(f)/512.0)*512, H += 512 – that’s the size of f rounded up to 512-byte blocks
  6. for each d in D, H += 512
  7. for each p in (F D), if the full path and name of p (as stored in the archive) is greater than 100 characters, H += 1024
  8. The size of the archive is S + H + 1024 bytes of zero-fill at the end of the tar
  9. Round up to (tar blocking factor) * 512 byte records. GNU tar defaults to blocking factor 20. Blocking factor 1 makes the math easier ;)

No, you cannot use ‘du’. I have tried.

Update! Added #7.

I love unix

Tuesday, May 13th, 2008

Extract the revision histories of the classes Rushi and I collaborated on out of his school repo, compress them, pipe them over the network onto my laptop, and uncompress. I was on the verge of adding the svnadmin load that would pull it into my repo, but I got lazy.

RSi:/home/svn$ svnadmin dump school | svndumpfilter --drop-empty-revs --renumber-revs include /CSE131A /CSE131B /CSE120 | gzip | ssh jauricchio@128.54.57.118 gunzip \> rushidump

Yeah yeah, DVCS, hg and git and whatever, I know…

Computer Languages and Facial Hair

Tuesday, May 6th, 2008

Why are some programming languages more popular than others? If Java is so lame and (Haskell, Obj-C, Erlang, Smalltalk, whatever) is so great, why is one of them the most used language and nobody’s heard of the other?

Tamir Khason has the answer: Computer Languages and Facial Hair.

Via … somebody. Forgot who. Maybe it was Sam Larbi?

Add an ssh key to another user on a different system without logging in

Tuesday, April 15th, 2008

Scott liked my terminal style from yesterday, so I’ll reprise it.


heian:<<<umi-misc/pubkeys$ ssh cse125@neathat.com -p 14522 sudo ls \>/dev/null
[sudo] password for cse125: (echoed, which is unfortunate)
heian:<<<umi-misc/pubkeys$ cat djc_hmac_rsa.pub | ssh cse125@neathat.com -p 14522 sudo su -c \'cat \>\> ~djc/.ssh/authorized_keys\'
heian:<<<umi-misc/pubkeys$

Now DJ can use his key on that server.

The sudo ls is to enter the password and get the sudo authorization ticket. We can’t enter the password with the cat, because ssh sees its stdin isn’t a terminal and refuses to allocate a tty. A stupid workaround would be (echo "mypassword"; cat ... ); | ssh ..., but I like the two-phase solution more, for some reason.