The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Sunday, Debtember 05, 2010


I'm waiting in the emergency room as Bunny's thumb is being looked at. Tip, people: be careful when using a mandolin (the slicer, not the musical instrument)—they're sharp!

More details as they happen.

Emergency Part Deux

Bunny just came out to get her coat, and informed me that she may have to get a tetanus shot (ouch). It just depends on if she got one when she broke her arm a few years ago; the hospital is looking up the records now.

Emergency, Part Drei

Bunny got the tetatus shot, the doctor just arrived, looked at her thumb, and just ran off to get the Superglue (no, really—that's what it was designed for initially).

Emergency Part Quatro

Well, the doctor came back with a tube of Superglue, applied a few layers over Bunny's thumb, and now we wait to be discharged.

The crisis is over.

Emergency Part Fem

We're back. We're fine. Bunny is in the garage with a mallet making sure the mandolin won't hurt anyone in the future.

Monday, Debtember 06, 2010

The sane library for decoding DNS packets

Every so often over the past twenty years or so, I've had the need to make DNS queries other than the standard A type; you know, like MX records, or PTR records, but the standard calls available under Unix are lacking. And each time I've investigated other DNS resolving libraries, they've been horrendously complex while at the same time, only resolving a few record types.

So when my attention turned once again towards DNS, I decided that the best course of action was to buckle down and write my own library, which I did over this past Thanksgiving holiday weekend.

My approach to the problem I think is unique. At least, compared to all the other DNS resolving libraries I glanced over, it's unique. First off, I pretty much ignored the actual network aspect. Sure, I have a simple routine to send a query to a DNS server, but the code is dumb and frankly, not terribly efficient, seeing how it opens up a new socket for each request. Also, it only handles UDP based requests, and pretty much assumes there will be no network errors that drop the request (which as far as I can tell, hasn't actually happened).

Instead, I concentrated on the actual protocol aspect of the problem, decoding raw packets into something useful, and taking something useful and encoding it into a raw packet. I tackled encoding first, and it's an elegent solution—you fill in a structure with appropriate data and call an encoding routine which does all the dirty work.

dns_question_t domain; /* what we're asking about */
dns_query_t    query;  /* the "form" we fill out */
dns_packet_t   request[DNS_BUFFER_UDP]; /* the encoded query */
size_t         reqsize;
dns_rcode_t    rc;  = ""; /* only fully qualified domains name */
domain.type  = RR_LOC;        /* let's see where this is located */
domain.class = CLASS_IN;        = random(); /* randomize the ID for security */
query.query     = true;     /* yes, this is a query */
query.rd        = true;     /* we're asking for a recursive lookup */
query.opcode    = OP_QUERY; /* obviously */
query.qdcount   = 1;        /* we're asking one question */
query.questions = &domain;  /* about this domain */

reqsize = sizeof(request);
rc      = dns_encode(request,&reqsize,&query);

if (rc != RCODE_OKAY)
  /* Houston, we have a problem! */

Once encoded, we can send it off via the network to a DNS server. Now, you may think that's quite a bit of code to make a single query, and yes, it is. And yes, it may seem silly to mark the query as a query, and have to specify the actual operation code as a query, but there are a few other types of operations one can specify and besides, this beats the pants of setting up queries in all the other DNS resolving libraries.

And this approach to filling out a structure, then calling an explicit encoding routine is not something I've seen elsewhere. At best, you might get a library that lets you fill out a structure (but most likely, it's a particular call for a particular record type) but then you call this “all-dancing, all-singing” function that does the encoding, sending, retransmissions on lost packets, decoding and returns a single answer. My way, sure, there's a step for encoding, but it allows you to handle the networking portion as it fits into your application.

Anyway, on the backend, once you've received the binary blob back from the DNS server, you simply call one function to decode the whole thing:

dns_packet_t   reply[DNS_BUFFER_UDP];
size_t         replysize;
dns_decoded_t  decoded[DNS_DECODEBUF_4K];
size_t         decodesize;
dns_query_t   *result;

/* reply contains the packet; replysize is the amount of data */

decodesize = sizeof(decoded);
rc         = dns_decode(decoded,&decodesize,reply,replysize);

if (rc != RCODE_OKAY)
  /* Houston, we have another problem! */

/* Using the above query for the LOC resource record */

result = (dns_query_t *)decoded;

if (result->ancount == 0)
  /* no answers */

  "Latitude:  %3d %2d %2d %s\n"
  "Longitude: %3d %2d %2d %s\n"
  "Altitude:  %ld\n",
  result->answers[0].loc.latitude.nw ? "N" : "S",
  result->answers[0].loc.longitude.nw ? "W" : "E",

Yes, it really is that simple, and yes, I support LOC records, along with 29 other DNS record types (out of 59 defined DNS record types). So I'm fully decoding half the record types. Which sounds horrible (“only 50%?”) until you compare it to the other DNS resolving libraries, which typically only handle around half a dozen records, if that. Even more remarkable is the amount of code it takes to do all this:

Lines of Code to decode DNS records
Library Lines of code Records decoded
c-ares1452 7
udns 872 6
adns 155813
djbdns1276 5

(I should also mention that the 1,321 lines for spcdns include the encoding routine; line counts for all the other libraries exclude such code; I'm too lazy to separate out the encoding routine in my code since it's all in one file.)

How was I able to get such densities of code? Well, aside from good code reuse (really! Nine records are decoded by one routine; another twelve by just three routines) perhaps it was just the different approach I took to the whole problem.

Another feature of the code is its lack of memory allocation. Yup, the decoding routine does not once call malloc(); nope, all the memory it uses is passed to it (in the example above, it's the dns_decoded_t decoded[DNS_DECODEBUF_4K] line). I've found through testing that a 4K buffer was enough to decode any UDP-based result. And by giving the decode routine a block of memory to work with, not only can it avoid a potentially expensive malloc() call, it also avoids fragmenting memory and keeping the memory cache more coherent (when Mark saw an earlier version he expressed concern about alignment issues, as at the time, I was passing in a character buffer; I reworked the code such that the dns_decoded_t type forced the memory alignment, but because an application may be making queries via TCP, which means they can be bigger, I didn't want to hardcode a size into the type; it would either be too big, thus wasting memory, or too small, which makes it useless; the way I have it now, with the array, you can adjust the memory to fit the situation).

And from that, the code itself is thread safe; there are no globals used, unlike some other protocol stacks I've been forced to use, so there should be absolutely no issues with incorporating the library into an application.

Oh, and I almost forgot the Lua bindings I made for the library. After all, a protocol stack should make things easy, right?

Update on Saturday, October 26th, 2013

I was brought to my attention (thank you, Richard E. Brown) that I should link to the source code so that it's easier to find.

So linked.

Tuesday, Debtember 07, 2010

The Bureaucratic Sinkhole known as the DMV

I find it odd that Florida law requires you to update your driver's license within ten (10) days of moving, yet to get a new driver's license you must provide two (2) proofs of residential address which can include bills, but it's doubtful anyone can get a bill to a new address in less than ten (10) days since moving in. Hmmmm …

It's silliness like this that make me avoid bureaucratic institutions as much as possible (well, that, and the tedious long waits and my own tendencies towards procrastination). But seeing how my driver's license is set to expire in January of 2011, and an inability to extend it online left me little choice but to head on down to the local DMV office.

[Mom always said I looked like a Cuban refugee in this shot]

Last month, I set up an appointment for today at 10:50 am (the earliest datewise in all of Lower Sheol, and the only timeslot for today), so at a most ungodly hour Bunny and I headed out to the Pompano Beach office. To ensure I appeased the bureaucratic gods I brought along my Social Security card (original), birth certificate (old enough to be an original notiarized copy of), car insurance bill (with the current address), bank statement (with the current address), voter's registration card (with the current address) and current car registration (with the current address on it). I almost went to the bank to pull out some cash, but given the ungodly hour, decided against it (and frankly, I forgot to to so yesterday).

We arrived about fifteen minutes before the appointment to a packed DMV office. Ten minutes in line, we were given a number (A1051/b) and told to wait.

Thank God I set the appointment, because it only took fifty minutes (and two blue screens of death on the Windows-run “now serving ticket #X” display) to get called to the back for my picture.

Five minutes later, I have my picture taken (only thing changed from the previous picture—a thicker beard) and pull out my debit card only to have the clerk tsk-tsk-tsk at me.

“We don't accept Visa,” said the clerk, “but we do accept MasterCard, Discover and American Express.”

Sigh. I knew I should have gone to the bank.

Update on Monday, November 10th, 2014

It has come to my attention that some of the links provided above do not go to the “Official Florida DMV” which may cause some confusion. I am sorry about that, but the “Official Site” does not appear to have the same information that is easily locatable.

You have been warned.

Some musings on decentralized DNS

Less than twenty-four hours since I released my DNS resolver library and I'm getting requests for Ruby bindings.


While I suspect I can write Ruby bindings, it might help if I actually, you know, knew the language first. It might be something to do over this holiday season.

Also, as a joke, I was asked if I could work on that distributed DNS replacement thing, but I think I'll pass on that.

It's not as if DNS isn't already distributed—it is, but there is a central authority overseeing domain names that also help manage the servers that run the top level of DNS—the so called root servers. So it's probably more accurate to say the project is a “decentralized DNS replacement thing” and therein lies the problem—how are naming conflicts resolved?

With the current system, it's “first come, first served” when it comes to names (way back in 1998, I tried registring, but found out that Time Magazine got there first—and they still own it; I then tried, but there was a hard drive manufactorer that owned that name; now it looks like bookseller owns that domain) and if there are conflicts, ICANN will step in to mediate the issue.

But in a decentralized DNS system, how is this handled? I want the .area51 TLD, but (hypothetically speaking here) so does Bob Lazar. Who wins? How is this resolved? The government?

That's the cause of this attempt to decentalize DNS. The courts? Golden rule there (“he who has the gold, makes the rules” although it could be said that's the case now).

It's more of a political (or maybe social) issue than a technical issue, and thus, I don't see it going anywhere any time soon.

Thursday, Debtember 09, 2010


Being that Bunny's brother is in town (from Bremerton, Washington and that it's also Bunny's mom's birthday, we figured we would try a restaurant we saw on “The Best Thing I Ever Ate”, seeing how it was in Boca Raton: Rosarios Ristorante.

It's not quite “if you have to ask, you can't afford it,” but it's close and the service wasn't quite what we were expecting, but the food … oh the food. The garlic toast (featured on “The Best Thing I Ever Ate”) was good with an assertive garlic taste to it. That pretty much dissappeared immediately. The Eggplant Rollatini appetizer I had was the best eggplant dish I've had (not that I've had many, mind you); tender without being mushy and the eggplant taste was mild and not bitter at all.

While I enjoyed the Veal Contadina (I found the tomato, garlic and basil salad a nice cool counter point to the warm veal cutlets), Bunny's Veal Marsala was easily the best dinner served us and in retrospect, I think we all would have ordered it had we known. But that's not to say the other dishes were bad, they were all very good; it's just that the Veal Marsala was out of this world.

I was the only one to order dessert, and the Chocolate Mousse Cake was incredible—it wasn't overly sweet and it had a very mild chocolate taste to it, but even so, it was so good we ordered an extra piece to take home. Apparently the coffee (an Italian coffee) was excellent, but since I don't care for coffee, I'll have to take Bunny and her brother's testimony on this.

One other interesting note—I think Bunny, her brother and I were easily the youngest diners there tonight.

Lego—is there nothing it can't do?

[A fully functional replica of the Antikythera Mechanism is built OUT OF LEGO]


Very cool!

I want one!

Saturday, Debtember 18, 2010

“Tron Legacy”

Jeff, Bunny and I went to see “Tron Legacy,” the sequel to Disney's 1982 film “Tron.

I'll say this right now—the film is just as cheesy as the original, but I'm still glad I saw it in the theater. The plot is predictable—Kevin Flynn (Jeff Bridges) makes an incredible discovery in the computer he helped to liberate (in “Tron”) and rebuilt, but one of his helper programs—the very one he wrote, CLU, staged a coup, killed TRON (the program written by Kevin's friend Alan Bradley (Bruce Boxleitner) that helped Flynn in the original movie) and trapped Flynn in the computer. Twenty years later, Flynn's son Sam (Garrett Hedlund) gets a message from his father and when he goes to investigate, gets sucked into the computer and with the help of his father and another program, Quorra (Olivia Wilde) leads yet another revolution to free the computer for the users.

The real draw for this movie (and much like the original) is in the computer imagery and music. The visuals are absolutely stunning and the re-imaging of the iconic … um … icons, from Tron are beautiful, and that may prove to be its ultimate downfall in time. You see, in “Tron,” it was obvious that the animations were done via computer—they're pretty much the iconic look for “computer graphics” and strangely enough, for being almost thirty years old, stand up incredibly well. The imagery for “Tron Legacy” though, is too realistic (exhaust vents on the Recognizers? Really?) and solid looking. Gorgeous, yes, but this is meant to exist inside a computer; does it really need to look … well … realistic?

But on this quibble, time will tell.

Disney also had a tough task in making Jeff Bridges look young (for the opening scenes of the film, and a few flashbacks), and here, I think they failed overall, as the younger Kevin Flynn tended to fall right inside the Uncanny Valley. As CLU it would make sense that his likeness would fall into the Uncanny Valley, but given that none of the other “computer programs” fell there, it just made the “young” Jeff Bridges really disturbing to look at, unlike, say, Olivia Wilde or Beau Garrett, who, I must say, looked absolutely stunning in their Tron costumes.

For a fan of Tron, it's worth seeing. To see stunning visuals, it's worth seeing. For an incredible story and acting … um … not so much. Still a fun film, though.

Sunday, Debtember 19, 2010

Them ol' Lake Lumina Blues

Last night I said I'd drive to the movies.

Only I didn't end up driving. Jeff did.

And therein lies a tale.

As I was pulling out of the driveway, turning the steering wheel suddenly felt a lot like pulling on a brick wall. Obviously the power steering was no longer power steering and there was no way I was driving to the theater (even if it was about two miles away). I was barely able to shove the brick wall steering wheel the other way to get the car back up into the driveway.

Anyway, today being The Game Day™, my friends and I huddled around Lake Lumina, looking into the engine block for reasons why the power steering wasn't.

“That doesn't look good,” said Tom. I looked to where he was pointing.

[This flywheel should be over this belt]

[Actually, in the graphic above, where it says “flywheel” it should say “pully” as that's what the mechanic called it—Sean]

One of the many flywheels driven by the one large serpentine belt winding its way along the side of the engine had shifted a few inches away from the belt. “No, that doesn't look good,” I said.

I pushed on the flywheel pully, seeing if it would push back into position, but it wasn't budging, much like the steering wheel wasn't budging. After looking up the Blue Book value for my car, the consensus was I might want to drag Lake Lumina behind the shed (or in this case, it might be eaiser to drag the shed in front of Lake Lumina), put it out of its misery and start visiting some automobile dealerships.


“I Want A Dog For Christmas, Charlie Brown”

Bunny and I caught “I Want a Dog for Christmas, Charlie Brown” on television and I must say, this is one Peanuts holiday special I've never seen before.

It was … odd. Developed after Charles Schulz died, it's a collection of comic strips that have been animated and strung into a somewhat coherent story of Rerun (the younger brother of Lucy and Linus) and his desire to get a dog for Christmas. And yes, it's just barely coherent with much of the film (it was an hour long, which was about 30 minutes too long in my opinion) feeling like a collection of gags, which, yes, it is a collection of gags.

And unlike “A Charlie Brown Christmas, I don't think this one needs to be seen more than once.

Tuesday, Debtember 21, 2010

An end to the Eternal September?

Okay, now this is odd.

About half a dozen people get notified via email when I post here (it's a feature I dropped three years ago) and I noticed that just now, notifications to AOL are bouncing, not because AOL is rejecting my email (a typical occurance) but … well …

<>: Host or domain name not found. Name service error for type=A: Host found but no data record of requested type

A few checks, and yes, AOL has no way of receiving email from the outside world at this time.

Could this be the actual end of the Eternal September? (sorry Dad) Or is this just a momentary glitch where heads might end up rolling?

Update a few hours later …

It seems that AOL got its act together and fixed the MX problem. Alas, the Eternal September continues …

Now I understand how I must sound to non-technical people

Good news! There's no need for a new car! Bunny had the car towed to her preferred mechanic, he took one look at the problem, said it was simply “the harmonic balancing stabalizer disintegrated due to prolonged exposure to entropic forces, thus causing the drive belt pully to slide laterally away from the internal combustion containment chambers, setting up wild oscillations in the drive belt which stressed the recharging subsystem causing it to improperly function. Shouldn't take more than two, three hours to fix” (or something like that).

“Make it so,” said Bunny (or something like that).

And thus, three hours later, I was there, picking up my car. It also cost less than I expected, given the seriousness of the situation my friends thought the car experienced.


Wednesday, Debtember 22, 2010

How a Japanese cookie lead to 110 Powerball winners and, by the way, we learn who General Tso was and why we love his chicken so much

Game Day Dinner on Sunday was Chinese take-out food (you know, a tradition for the holiday season). While ordering, the topic of General Tso's Chicken came up, because the menu for the local Chinese restaurant was written in Engrish and came out as General Tao's Chicken.

I normally wouldn't even bother mentioning this, but I just now came across this fantastic talk on General Tso's Chicken (who is also making a documentary about General Tso's Chicken) that goes into not only the history of this classic dish, but makes the point that it is a thoroughly American dish (created by a Taiwanese chef in 1970s New York City).

Oh, about the title? That's also covered in the talk, which reminded me a bit of Connections, that wonderful television series by James Burke.

“True Grit” or “The Dude vs. The Duke”

Bunny and I went to see “True Grit” tonight. I've never seen the original “True Grit,” so I have nothing against which to compare it. All I know is that the original starred John “The Duke” Wayne, and there's a scene where he rides a horse, reins in his mouth and a gun in each hand.

In fact, the only reason I went to see this film was as a Christmas gift to Bunny, who really wanted to see it. Normally, westerns aren't my thing, and remakes less so, as Hollywood is creatively bankrupt, as I'm wont to say.

Only thing was, if Hollywood is creatively bankrupt and is solely going to do remakes, more of this please! This was wonderful! No romanticism here of the Old West. No beautiful people either. It took a few seconds for me to recognize Matt Damon, Barry Pepper is completely unrecognizable (and ugly to boot), Hailee Steinfeld is so plain she's just a shade from being homely, and Jeff Bridges looks about 70 in the role of Rooster Cogburn.

In fact, Jeff Bridges was great in this role as an old, cantakerous, drunk and mean marshall in this film. While he wasn't The Duke, neither was he The Dude (thankfully). The acting overall was great, and it would be a shame if Hailee Steinfeld doesn't get a nomination for leading actress. In fact, the entire theather broke out cheering in one of her scenes (although to divulge more would be a spoiler). I also haven't seen a movie this intense since “Reservoir Dogs.”

Another striking aspect of this film is the dialog—the very formal, Victorian (with a Texas twang) pattern of speech that apparently was in the original book the movie was based upon. And as Bunny remarked, no swear words at all (the PG-13 rating comes from the violence, not the langauge).

The story is straight-forward though; Mattie Ross (Hailee Steinfeld) hires Rooster Cogburn (Jeff Bridges) to track down Tom Cheney (Josh Brolin) who killed her father and fled town. Mattie insists on accompanying Cogburn on the trip to Indian Territory to make sure she gets her money's worth. Cogburn is intent on not letting her come along. But she does anyway.

Now, not having seen the original, I can't say if this version is better, but it was very good, enough to watch it again.

Saturday, Debtember 25, 2010

Merry Christmas and all that jazz

It was a quiet, laid back day today. Many presents were exchanged (and the “Most Amusing Present” goes to my friend Hoade who sent me I Could Tell You But Then You Would Have To Be Destroyed By Me: Emblems From The Pentagon's Black World, which are military patches for top secret projects and yes, Area 51 is referenced quite often, although the most amusing patch (to me) is a blank black patch, with the text, in black on black letters along the top “IF I TELL YOU” and in black on black letters cross the bottom, “I HAVE TO KILL YOU”—I tell you, it's comedy gold) and much food was eaten.

This evening, Bunny, her mom and I then drove around to look at the various souls spending what's left of their money in electrical bills.

[A million points of light]

Very pretty, but very expensive no doubt. Not even the cities are doing anything this extravagant this year.

Other than that, I wish all my readers a Merry Christmas and a Happy New Year!

Wednesday, Debtember 29, 2010

Fifty inches of impressionistic inflatable ink

It didn't make “Most Amusing Present,” but it's still darned amusing—my dad got me “The Scream.”

Okay, he didn't give me the actual painting, nor a reprint, but an inflatable Scream:

[Macaulay Culkin posed for this, I just know it]

Fifty inches of impressionistic inflatable ink. And given where the valve was, his expression makes quite a bit of sense (same for Otto the autopilot now that I think about it).

So now he lives at The Ft. Lauderdale Office of The Corporation where we could definitely use some non-corporate propaganda art to liven up the space.

Obligatory Picture

[The future's so bright, I gotta wear shades]

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site:, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2024 by Sean Conner. All Rights Reserved.