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.

Wednesday, March 04, 2015

Mind blown

When you bite into a Thin Mint, you probably aren't wondering where it comes from. (The Girl Scouts, of course.) But wait, there are two bakers. And they make two very different Thin Mints: One is crunchier, more minty. The other is richer with a smooth chocolate coating.

Via Jeff Cuscutis at FaceGoogleMyBookPlusSpace, 6 Girl Scout cookies you thought you were getting but aren't - Los Angeles Times

Wait … what?

Mimicking C APIs in Lua

Last Sunday, the latest announcement of luaposix lead me to state the following observation on the Lua mailing list:

Sean Conner <>
Lua mailing list <>
Literal mimicking of C APIs in Lua (split from Re: [ANN] luaposix 33.3.0 released)
Sat, 28 Feb 2015 23:16:51 -0500

This isn't about luaposix per se, but this is prompting this observation about Lua wrappers for C APIs: they tend to mimic it quite literally (to the point where I think I've said this before: if I wanted to code in C, I know where to find it).

I checked, and sure enough, the Lua wrapper around syslog() was what I expected (and had found in several other syslog() wrappers for Lua)—a very thin wrapper over syslog() leading to this in Lua:

syslog.syslog(syslog.LOG_WARNING,string.format("foobar %d is at %d capacity",fooid,foocap))

I seem to be the only one who make it easy to use syslog() in Lua:

syslog('warning',"foobar %d is at %d capcaity",fooid,foocap)

I went to the trouble of making the module itself callable (but you can still call syslog.log() if you want) and handle the call to string.format() behalf of the caller because in 90% of the cases I call syslog(), I need formatted output.

It just struck me as odd that not many writers of C-based Lua modules bother to make it easy to use their modules and I was about the thought process behind it (or the lack of thought process). The best answer came from Gary Vaughan, author of luaposix:

Lua mailing list <>
Re: Literal mimicking of C APIs in Lua (split from Re: [ANN] luaposix 33.3.0 released)
Sun, 1 Mar 2015 09:02:00 +0000

It's precisely because I don't want to code in C either that the low-level API of luaposix aspires to be as thin a wrapper for the C API as possible. It's easier, faster and less error-prone to write the Luaish API on top of the thin C wrappers in Lua than it is to write the fancy stuff in C.

Not only that, this leaves the door open to replace the C bindings with an FFI binding that the Luaish layer can equally sit on top of and ultimately shipping no C code at all in luaposix… as long as a dependency on LuaJIT and/or LuaFFI is an acceptable compromise. When the low-level C code implements the user- facing API, all of this is a lot more difficult.

He's got a good point—make the C layer as thin as possible:

static int syslog_syslog(lua_State *L)
  return 0;

and leave the fancy stuff up to Lua:

local m_priority =
  emerg  = 0, emergency   = 0,
  alert  = 1,
  crit   = 2, critical    = 2,
  err    = 3, error       = 3,
  warn   = 4, warning     = 4,
  notice = 5,
  info   = 6, information = 6,
  debug  = 7

function syslog(priority,...)

But there is a flaw when he metions LuaJIT (and LuaFFI in general):

C declarations are not passed through a C pre-processor, yet. No pre-processor tokens are allowed, except for #pragma pack. Replace #define in existing C header files with enum, static const or typedef and/or pass the files through an external C pre-processor (once). Be careful not to include unneeded or redundant declarations from unrelated header files.

ffi.* API Functions

In the case of syslog(), it's not that big an issue—the levels are standardized so it's easy to supply the proper values, but it's different for a function like socket(). A thin C wrapper is trivial:

static int socket_socket(lua_State *L)
  return 2;

Not so easy is defining the values for those three parameters. The first is an arbitrary number defining the “family” the socket belongs to, ether IP, IPv6, Unix domain, etc. The second parameter further defines the socket type, whether it's a stream based socket, or you want actual packets. The last parameter can, in 99% of the cases, be 0, so we shall ignore it. In C, it's typically called like:

s = socket(AF_INET,SOCK_STREAM,0);

But the actual value of AF_INET may vary from operating system to operating system (they do—I checked a few systems to make sure) so it's not always as straightforward to skip C entirely when wrapping a C API with LuaJIT.

Overall though, the idea is sound and I do find it intriguing, but not enough to stop the approach I've been taking.

Tuesday, March 03, 2015

Seriously, if you care about your data, keep it close!

We assume everything we publish online will be preserved. But websites that pay for writing are businesses. They get sold, forgotten and broken. Eventually, someone flips the switch and pulls it all down. Hosting charges are eliminated, and domain names slip quietly back into the pool. What’s left behind once the cache clears? As I found with that pitch at the end of 2014, my writing resume is now oddly incomplete and unverifiable. Ex-editors can provide references, but I have surprisingly few examples of published work to show beyond scanned print features from my early days, so I’ve started backing up my work.

For media companies deleting their sites, legacy doesn’t matter; the work carries no intrinsic value if there is no business remaining to capitalize on it. I asked if RCRD LBL still existed on a server somewhere. It apparently does; I was invited to purchase it for next to nothing. I could pay for the hosting, flip the switch on, and all my work would return. But I’d never really look at it. Then, eventually, I would stop paying the bills, too.

Via Lobsters, All My Blogs Are Dead - The Awl

I hate to keep harping on this, but really, you can't even trust companies to archive their own website where they paid for their content!

It's also sad that Carter Maness didn't even feel it was worth the money to save his own work, which sadly, is another example of someone not caring to manage their own computer (in this case, a server with articles that prove he he was paid to write and thus, can include on his résumé).

Hurry up and wait

One thing about testing a regression test is that there's quite a bit of “hurry up and wait”—I add a check, run the test and wait. Then investigate the output and either make a note of a potential problem (either in the configuration of the test data or a possible bug in one of a number of components) or adjust the check (“hmmm … on second thought, it should really be this”) and rerun the test.

Fortunately, the regression test for “Project: Sippy-Cup” (runs for maybe half an hour) isn't as long as the regression test for “Project: Wolowizard” (about 4½ hours).

Monday, March 02, 2015

Hey! You can actually make out the lyrics in this version

[Music is playing]

♫With the lights out, it's less dangerous
Here we are now, entertain us
I feel stupid and contagious
Here we are now, entertain us …♫

“Who is that?”


“Um … Frank Sinatra?”


♫I'm worse at what I do best
And for this gift I feel blessed
Our little group has always been
And always will until the end
Hello, hello, hello, hello … ♫

“It's a cover version of a Nirvana song.”

“I don't think it's Tony Bennett ‥ ”


“Then who?”

Paul Anka.”

“Huh. The album is ‘Rock Swings.’ I might have to get that …”

Sunday, March 01, 2015

My, the days seem to fly right on by

You may have noticed that I've been blogging rather frequently over the past few months. In fact, I've been trying to blog at least one entry per day this year and I've been pretty good at maintaining that level. But I must apologize for missing February 29th and 30th—those days just slip right by me for some reason.

Ah well …

Saturday, February 28, 2015

A two inch cutting board on a table saw

Now that Bunny's brother has received his gift, I can talk about it. This past Monday on a whim, Bunny made this tiny cutting board:

[Under 2″ in each direction—told you it was small]

The thing was, she made this with her table saw! You know, this huge monsterous thing with a 12″ or 14″ circular blade o'death spinning at a bazillion revolutions per second? Yeah, she made this teeny little cutting board with that.

But she made it to test out the capabilities of a new piece of equipment she bought—the Micro Jig GR-100 GRR-Ripper. It's a pretty amazing device used to push wood around and through the many spinning blades o'death that lurk in the wood shop (in our case, the garage). We've seen it used enough times (yes, we watch Steve Ramsey every week) that Bunny felt it might be worth getting.

And yes, it was worth getting. The demonstration videos that come with it are astounding (most impressive to me was cutting dados in a dowel). In fact, she was so impressed that she got a GRRR-Ripperfor her brother, and sent along the cutting board as an example of the type of work possible when using it.

Friday, February 27, 2015

Saving Private Data

We tell ourselves “once on the internet, always on the internet,” like maintaining content is a trivial thing. But it isn’t a trivial thing — at any time, the company that you rely on to keep your content for free could change their policies, or get bought out and change their policies, or decide they want to go public and change their policies, or simply go under and take your content with them.

The longevity of data requires more intent than this. My advice is to seriously consider migrating to a self-hosted site if you can. If you can’t make sure you export your data with some regularity.

Through some oh-so-very “Not Safe For Work” links (unless, of course, you work in the “adult industry,” in which case, the links are probably sfe) via Flutterby, Google Takes Back Adult Ban | /Slantist

If you consider your data important (and I think you should) and you are using a company to store (or manage) your data, then you must assume it can go away in an instant. No, really, the Internet is littered with dead companies that promised to keep your data “safe.” And you should keep you eye on the ones still alive, for there's no guarentee they'll be around tomorrow.

You might want to peruse The Archive Team while they're still around for more on this topic. Your data will thank you for it.

Thursday, February 26, 2015

More unintentional conspiracies

Giving most people a “general purpose computer” these days is giving them enough rope to hang themselves. That’s why people that have never learned computers (or did and hate them) like iPads so much. It’s extremely difficult to mess anything up, and you don’t have to worry about antivirus and updating java and flash and all this other crap. Apps are sandboxed, privacy is taken seriously, background apps (spyware) can’t track you, etc.

As someone concerned with security, I’ll gladly tell people to switch from a virus-laden Windows laptop to an iPad or Chromebook.

As someone concerned with privacy, I’m conflicted in offering those suggestions because the security comes from proprietary app stores and review teams, trusting all your data to be stored by the GOOG, not having the ability to run your own code, etc.

Maybe it’s just as simple as: there is not one solution for everyone. Let the majority of people that have no interest in running their own code use iPads and Chromebooks. For developers and people that know enough to take precautions, keep using Macbooks and Thinkpads and whatever.

A story about Jessica | Lobsters

This is a comment on A Story About Jessica, and is presented here just as another data point about giving up control over our own computers.

I feel the earth, move, under my feet

It's a bit disconcerting when the office is shaking. It would be one thing if I worked in The Los Angeles Office of The Corporation, but I'm don't—I work in The Ft. Lauderdale (as in Florida) Office of The Corporation (and besides, we don't have an office in Los Angeles).

I'm not alone in this—I asked around and yes, other people felt it too. It wasn't a violent “up and down and oh my God we're all going to die!” type of shaking, more of a “I can just make out this vibration in the floor; the building isn't going to collapse on us, is it?” type of vibration.

The only consolation (and it's not much) is that this isn't the first time this has happened.

And no one can explain why

Update later today

My friend and fellow cow-orker B mentioned on GoogleMyFacePlusSpaceBook that the shaking was caused by frieght trains going by. It makes sense, seeing how there's a railroad right next to the building.

Obligatory Picture

[Don't hate me for my sock monkey headphones.]

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

Listed on BlogShares