Archive for January 2010

 
 

What Programmers Should Know About DNS

I’m not an expert about DNS, but I learned a few things over the years by talking to people like Spider, and have noticed that there are a lot of misconceptions among programmers. Here’s a quick brain dump:

  • DNS is distributed and fault-tolerant. It’s not very likely to fail.
  • In order to be faster, DNS queries are cached by your ISP and your computer. If you don’t want your DNS name to be cached because you want to point it to another IP very quickly, you can set the TTL to one second.
  • Most ISPs have crappy DNS servers.
  • DNS supports different record types. The record type you resolve when surfing the internet is an A record. Mail servers, on the other hand, ask for MX records. There are a lot of different record types.
  • DNS names can be specific, as in www.example.com, or wildcard, as in *.example.com. If no specific name is found for a DNS query, then you get the results for the longest matching wildcard.
  • A DNS query can return many IP addresses for a single name. This can be used for load-balancing, by having a web server return a bunch of IPs in random order for a single domain name, in which case your browser will try to connect to them one at a time until it succeeds.
  • A DNS query for SRV record can return a list of other DNS names and ports. This gives you a layer of indirection that can be used to hardcode a DNS name in your client program, which can then be used at run-time to figure out the real server and port to which it will connect. This is why you don’t have to enter the server address in Skype, Yahoo Messenger or Windows Messenger.

Good Windows SSH Client

I like my SSH clients to be console applications, not GUI programs, so that I can script them easily. I’ve been using OpenSSH for Windows for a while now, and while it works, it has one major problem: its support for public key authentication is broken on Vista+. (Don’t ask.)

I recently found CopSSH. It’s basically a continuation of OpenSSH for Windows which hasn’t seen new builds since 2004. And while CopSSH is a server-oriented release (cannot install just the client), if you install it and then delete the service and the user account it creates, what you are left with is a perfectly good SSH client.

The only major drawback I found is that it looks for your settings directory (.ssh) in it’s install location instead of your user profile folder, but since I’m the only user of my computer that’s easily fixed with a single symbolic link.

Crafting Subtle & Realistic User Interfaces

Awesome post from Mike Rundle about how to design visual elements for your programs. I like the fact that he breaks things down so that even esthetically-challenged programmers like me can replicate these visual tricks.

Java GIT Performance

Beating a dead horse here, but here’s another text about about the woes of data structures done in a language without value types. If I were Sun I’d swallow my pride and start copying features from other languages and runtimes. They have an absolutely awesome JIT compiler and a very good garbage collector, but it’s time to come out of hibernation and start evolving both the runtime and the language.