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.

Tuesday, September 18, 2018

This is why I tend towards writing my own code libraries

Six years ago I had the need to fetch an image via HTTP as part of testing “Project: Lumbergh.” At the time, I thought You know what? Why don't I use libcurl? It's installed. It's supposedly easy to use. It'll save me the hour or so it'll take me to write the code to connect to the server, send the request and read the reply.

It still took about an hour, mainly to figure out how to use the darned library. But it worked.

And then I went to test on Solaris (which is what production runs on) and well …

r2839 | spc | 2012-07-11 14:22:27 -0400 (Wed, 11 Jul 2012) | 8 lines


It's amazing what isn't installed on Solaris.

And yes, I do use curl for testing. Easy (if insanely large) library to use to snarf down web requests.

I had to download libcurl and check it into the repository because it's not on Solaris.

And then I had to figure out the special ./configure options to get it compiled under Solaris.

And then I had to wait for ./configure and make to run (and on Solaris, this is a S—L——O———W————P—————P——————R———————O————————C—————————E——————————S—————————————S).

And then I had to figure out how to integrate this into the build system for Solaris.

And for something that was supposed to be “easy to use” turned out to be not so easy. Nor quick. And has been a thorn in my side these past six years.

Seven years ago I wrote a Lua module to generate hashes. Instead of pulling the code from various RFCs, I thought I would link to OpenSSL, since it already included the code for the various hashes, and who knows—it might even be optimized.

This only took a few moments to implement and was rather easy.

Until Apple decided to deprecate the use of OpenSSL on Mac OS-X and later remove OpenSSL in their latest offerings.

I use said Lua module at work.

We mostly develop under Mac OS-X.


This has become a thorn in my side over the past few years. The issue came up two weeks ago when my fellow cow-orker TS, decided to update his Mac OS-X laptop and the build broke. And it came up today because my other fellow cow-orker TS-II (same initials—go figure) did some update or other on his Mac OS-X laptop and the build broke, but in a different way (wow—to think that each version of Mac OS-X is a special snowflake).

Two libraries, used to avoid the whole “Not Invented Here Syndrome” and to speed up development.

In both cases, it has not speed up development. It has slowed down development as I've had to find more and more ways to keep using these infernal libraries.

I guess I'll spend a few hours ripping out libcurl and OpenSSL and replacing it with code I've written to speed things up around here.

Sunday, September 16, 2018

Before the Pink Panther there was Peter Gunn

Bunny has been binge watching “Peter Gunn” and I have to say, the music is fantastic! The only other TV shows that had as jazzy a score were “Twin Peaks” and “Cowboy Bebop.” I wish more shows used a jazz sound track, it's fun just to listen to the music.

Tuesday, September 11, 2018

Some notes on project names at The Ft. Lauderdale Office Of The Corporation

I was asked about the projects I've mentioned on the blog by a fellow cow-orker, D, and I thought I should summarize them.

First is “Project: Wolowizard.” This used to refer to the entire suite of programs my team (that is, the team I work on, not the team I manage—I'm not a mangager) is responsible for.

Then I wrote “Project: Sippy-Cup to interface with the new hipster hotness. This ended up calling into the same backend as “Project: Wolowizard.” So now it seems silly to consider the backend as part of “Project: Wolowizard” when it's used by two different front ends (the other frontend interfaces with The Protocol Stack From Hell). I'm now going to refer to the common backend as “Project: Lumbergh” (it makes sense if you know the actual name of the program).

And that leaves “Project: America-­On-­Line-­Instant-­Messenger,” the latest program to be written. My fellow cow-orker T gave it its initial name, but no one, not even he, really liked the name. After some discussion it was renamed, and thus I'm giving it a new name here in the blog—“Project: Cleese” (which again, makes total sense if you know the new name and the context in which it was named).

There are some other programs we're responsible for, but as they are rarely touched I'm not going to bother mentioning them. It's mostly legacy stuff anyway and they will most likely go away when The Protocol Stack From Hell is sent back from whence it came (and believe me, it can't happen soon enough).

A view from the Ft. Lauderdale Office of the Corporation

The building was trembling. This isn't unusual as there's a railroad running along side the building. But what was unusual was the lack of a train. Then a loud thud and finally silence. A few of us looked out the window.

[We might want to get Reba McEntire and Michael Gross on the phone in case this happens again.]

There, in a freshly dug trench that didn't exist moments earlier, was a dead graboid. It must have slammed into the foundation of I-95, which runs along the other side of the building.

Friday, August 24, 2018

Some musings on a fable of software engineers

[You might want to read this first. –Editor] [Really? –Sean] [Really. Or don't. But don't say I didn't warn you. –Editor] [Sigh. –Sean]

I was reading The Codeless Code: Case 41 Garbage (link via Lobsters) and my initial thought was that the head monk might not have much experience with source control. I know I only first started using source control back in 2000 (CVS) and not to control multiple versions but to allow an easy method to update the code from a remote location. Before the use of source control, I found myself commenting out code to keep it “just in case.”

These days, I no longer keep commented out code (erm … um … okay, I should probably just remove the code and convert the information into a real comment) but the thought did strike me that, okay, I remove the code but I have to remember the code existed at one point. Or a maintainer will have to be cognizant enough to search the history looking for deleted code that could be useful. There's very little indication of code that's been removed.

Just a thought.

Musings on the intersectionality of trigger warnings and spoiler warnings

I was reading XXX XXXXXXXX­X XXXXX XXXX XX XXXXXXX [Hold it right there! You need a trigger warning for that link! –Editor] [Sigh. Fine. –Sean]

(TRIGGER WARNING: X­XXXXXXXX­X XXXXXXX XXXXXXX) [STOP! SPOILER! Where's the spoiler warning? –Editor] {Seriously? I was trying to give a trigger warning, and now you want a spoiler warning as well? –Sean] [Yes. We can't just go X­XXXXXXX X XXXXX XXXXXX! –Editor] [Isn't that a spoiler as well? You can't say that if I can't say XX­XXXXXXXX­ XXXXXXX XXXXXXX –Sean] [… –Editor] [Well? –Sean] [Deep subject. But yes, you are correct. Carry on. –Editor]

SPOILER WARNING: The following trigger warning contains a spoiler for …

[Okay, so how I am supposed to do this? I need to both give a spoiler warning and a trigger warning for the page, but the trigger warning contains a spoiler. If you don't want to get spoiled, you could potentially get triggered. But if I give the trigger warning, those who hate spoilers will have the story ruined! What now, high and mighty editor? –Sean]

[Well, you are well and truly X­XXXXX! –Editor]

[Trigger warning for the foul language, you XXX­XXXX! –Sean]

Thursday, August 23, 2018

The sad thing is, it's not so bad it's amusingly bad, it's just bad

JC, a fellow cow-orker, casually said he was going to throw out an Android tablet as it was garbage. It worked, but apparently was so bad that it wasn't worth keeping. I was curious. So I asked him if I could have it instead.


I think I should ask for my money back.

How much of the badness is due to Android and how much of it is due to this being the Mi Traveler10Q8B I don't know. I think I'm willing to give Android the benefit of a doubt, seeing how it can be modified by the OEM to fit their needs, so I'm attributing all the badness to the Mi Traveler10Q8B.

And it's baaaaaaaaaaad!

Weight-wise, it's about the same as my iPad, but boy does it feel cheap. The screen is cheap plastic. The case is cheap plastic. It feels like I can pry it apart, although it's a sealed case and extensive probing doesn't reveal any obvious seams. It just feels … cheap!

It took me a bit to figure out how to turn the unit on. There are two switches on one edge (top? Bottom? Hard to say), both identical. One turns the unit on and off. the other one is the “Home” button.

Using it, It seems slugish as I'm using it. I've never been fond of Android (having been spoiled by the iPhone) but this thing is just painful to use. The interface is confusing (and again, I'm not sure how much of this is Android and how much of this is the Mi Traveler changing things up to “add value”) and the tentacles of Google are very much evident here—no I do not want to use the Google Butt Cloud thank you very much. Then there's the YouTube app. Why does it need my contacts, location, use of the camera and microphone and the ability to send an SMS? Bad Google! No cookie for you!

And now we get to the camera.

It's bad. It's really bad.

My iPhone takes better pictures. So does the iPad.

In fact, to get a picture as bad as the Mi Traveler, I had to crank the quality of the image down to 10%, and even then, I still think the picture is better than the one from the Mi Traveler.

It might be fun to hack on though.

Now … where did I put my pick-axe?

Wednesday, August 22, 2018

I don't need no steeeenking debugger

I was still having troubles with lldb accepting breakpoints; the breakpoints were just not being hit. Thinking about the issue, it seemed to me that the code might be requesting a too large amount of memory and an easy eay to do that is to track all allocations made by Lua. It was easy enough to test:

static void *l_alloc(void *ud,void *ptr,size_t osize,size_t nsize)

  fprintf(stderr,"osize=%zu nsize=%zu\n",osize,nsize);

  if (nsize == 0)
    return NULL;
    return realloc(ptr,nsize);

int main(int argc,char *argv[])
  /* ... */

  L = lua_newstate(l_alloc,NULL);

  /* ... */
  return 0;

Then it was a simple matter of running the program and check each allocation:

osize=0 nsize=64
osize=0 nsize=40
osize=0 nsize=64
osize=0 nsize=0
osize=0 nsize=64
osize=0 nsize=16
osize=0 nsize=64
osize=0 nsize=0
osize=0 nsize=160
osize=0 nsize=148
osize=0 nsize=64
osize=0 nsize=16
osize=16 nsize=32
osize=0 nsize=16
osize=0 nsize=64
osize=0 nsize=18446744073709551600


Okay, force a core dump we can examine:

static void *l_alloc(void *ud,void *ptr,size_t osize,size_t nsize)

  if (nsize > 10uL * 1024uL * 1024uL)
    abort(); /* dump core! */

  if (nsize == 0)
    return NULL;
    return realloc(ptr,nsize);

And the problem is immedately resolved.

The Linux version used epoll() for events, while for whatever reason I don't remember, the Mac OS-X version used select() [Yes, I know that's a Linux reference and not a Mac OS-X reference, but the call is the same between the two systems, and I couldn't find a version of the Mac OS-X page online. —Sean], and that code path was … a bit problematic.

The fix was easy—use poll() for events. With that change, the code worked fine on Mac OS-X (not that we use Mac OS-X in production, but it makes it easy to test in development if it works on the Mac).

Tuesday, August 21, 2018

Not anyone should be allowed to run a debugger

I'm working on “Project: America-­On-­Line-­Instant-­Messenger” (hey, don't judge me—it has nothing to to with AOL, it's more a pun on the project name than anything else). I've got a major portion of it running, but it's exhibiting some odd behavior—it runs fine on Linux, but fails rather quickly on Mac OS-X with “not enough memory.”

Problem one—I'm used to using gdb, but Mac OS-X uses lldb. Sigh. I did find a type of Rosetta Stone that shows similar commands in both gdb and lldb, so that issue is solved.

I was then able to track down the message to a source file in LPeg, but when I set a breakpoint on the line in question, it never got triggered. Puzzling, but I was not able to solve the issue by the time I had to leave work.

So now I'm home and I have an idea to scan more than just the .c files. It's a simple matter to log into my Mac workstation at work to see if that's the issue. I start looking, and lo, I find the message in two more locations, hidden behind a #define in a header file. I narrow it down to just one location (the other location pre-loading the string into the Lua VM).

First, the lldb commands are bit more verbose than those of gdb. Second, no matter what I do, all I get is:

(lldb) target create "XXXXXX­XXX"
Current executable set to 'XXXXX­XXXX' (x86_64).
(lldb) process launch -- config.lua
error: process exited with status -1 (lost connection)

Nothing I do works.

Then I remember—when I first ran lldb at the office, this modal dialog box popped up asking for my password in order to debug a program I wrote, running under my account. My initial reaction is, Smooth going, Apple! Way to protect me from myself! But then I realize this is probably to prevent rogue programs trying to attach to running programs to do nefarious things without my knowledge.

It's bad enough I have to jump through hoops to get the computer to run my own written programs. Now this?


It really does seem at times as if the general purpose computer is a dinosaur looking up at the sky, wondering, “What is that?”

Obligatory Picture

[It's a study in contrasts—digital camera contrasts]

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-2018 by Sean Conner. All Rights Reserved.