Archive for February, 2008

Steve Yegge is my Hero of the Month

He has some great stuff in his most recent essay:

So you can write Java code that’s object-oriented but C-like using arrays, vectors, linked lists, hashtables, and a minimal sprinkling of classes. Or you can spend years creating mountains of class hierarchies and volumes of UML in a heroic effort to tell people stories about all the great code you’re going to write someday.

Perl, Python and Ruby fail to attract many Java and C++ programmers because, well, they force you to get stuff done. It’s not very easy to drag your heels and dicker with class modeling in dynamic languages, although I suppose some people still manage. By and large these languages (like C) force you to face the computation head-on. That makes them really unpopular with metadata-addicted n00bs. It’s funny, but I used to get really pissed off at Larry Wall for calling Java programmers “babies”. It turns out the situation is a little more complicated than that… but only a little.

And Haskell, OCaml and their ilk are part of a 45-year-old static-typing movement within academia to try to force people to model everything. Programmers hate that. These languages will never, ever enjoy any substantial commercial success, for the exact same reason the Semantic Web is a failure. You can’t force people to provide metadata for everything they do. They’ll hate you.

ssh slow on Leopard.

I thought I was going crazy, but I’m not. ssh to a host the first time is super slow on leopard.

This thread on apple forums has a lot of false leads, but includes the true cause:

“Assuming you are referring to problems when ssh-ing from a Leopard box
to other systems, then the problem is probably the new behavior of the
getaddrinfo() call in Leopard. Basically, that call in Leopard now uses
the RFC-recommended practice of first issuing a DNS SRV record request
rather than an A record request, and then falling back to the A record
request if the SRV request fails; unfortunately, apparently a lot of DNS
servers don’t respond to the SRV request w/ an NXDOMAIN as they should,
and instead just drop the request, so getaddrinfo() retries the SRV
request a few times, and only after those requests time out does it try
to A request. So if ssh is using getaddrinfo() rather than
gethostbyname/getservbyname, then you it would hang like you describe
whenever you are pointing to a DNS server that doesn’t respond well to
the SRV request. (There are also reports that Leopard may generate DNS
requests w/ an invalid RR type, which might explain why the servers
being queried aren’t responding to them correctly.)

The easiest way to check if that’s your problem would be to sniff
traffic on port 53 while trying an ssh connection, and seeing if your
box is making a SRV request or an A request. (If that is in fact your
problem, you may be SOL until a patch is released, as Googling, I don’t
see any solutions other than hacking individual apps to use
gethostbyname() instead of getaddrinfo().)”

I did monitor port 53 and it is making SRV requests.

I have not yet found a good way to workaround this behavior.

Another good discussion of this is here.

This seems kinda stupid to me, since we use bind for our DNS here at work. If a vanilla bind config doesn’t answer SRV requests properly, it seems bad to build them into the default behavior of a major client (like ssh).

Update: we upgraded all our DNS servers here at work, and they all repond to SRV requests properly, and now everything works great.

How to mount AFP shares from a NAS on boot.

I finally went ahead and bought a NetGear ReadyNAS file server appliance. The thing is pretty sweet. I use it for some backups, but I also want to use it as the primary storage place for some of my larger file collections, like music or home movies.

The problem is that connecting AFS file shares via the finder doesn’t seem very reliable; they don’t always reconnect, and they are given stupid names by default.

So I added this line to my startup script:

    su billo -c 'mount_afp afp://billo:passwd@fs/billo /u/billo'

This mounts the share called “billo” from the ReadyNAS in a consistent location on my mac. Then I make symbolic links from my home directory (/Users/billo/Movies for example) to the directories in /u/billo/ (like /u/billo/Movies).

Hopefully this works.