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.

Saturday, August 01, 2015

I've seen some bad C code in my time, but never anything like this!

Man, I'm glad I learned ANSI C instead of K&R C, if only to avoid egregious code like:


#define bitblt(s, r, d, p, c)	(*((void(*)())0x430d6))(s, r, d, p, c)

Via Reddit, Rob Pike on Twitter

I shudder to think of the toolchain where casting an integer to a function address is easier than linking to the function.

Sunday, August 02, 2015

But at least South of the Border, South Carolina, is still south of the border

Dr. Frederick G. Berlinger built a house in what he thought was Polk County, N.C. The clarified [state] line puts most of the house in South Carolina. Some of it, apparently, was always there.

Via Hacker News, How the Carolinas Fixed Their Blurred Lines - NYTimes.com

I knew there were disputes over state boundaries throughout our history (such as the Walton War that took place in current day Transylvania County; and here's another article about it that contains a map of the area under question). But I didn't realize that there were still issues with state boundaries today.

Monday, August 03, 2015

Everything you wanted to know about making bassoon reeds but didn't want to ask

I did not expect a half-hour video on making a bassoon reed (link via Hacker News as a comment to an article about bassoon players being an endangered species). Nor did I expect a bassoon reed to be so finicky to make.

Tuesday, August 04, 2015

It's jury duty! What's the worst that can happen? I mean, besides being arrested?

Oh wonderful! In the snail mail box were five of the most dreaded words in these modern United States: JUROR SUMMONS—DO NOT DISCARD

Sigh.

I can only hope it goes better than the last time.


Oh my! Amazon dropping support for a legacy link!

For a moment there, I thought my post about jury duty finally broke the Amazon targeted advertising—all I was getting was a generic public service announcement about eating the hungry or something like that, with no link. Just bland text.

But no, all that happened is that Amazon stopped supporting a URL I've been using for the past nine years (which, to be frank, is odd behavior with Amazon; they're usually pretty good about supporting legacy links). It just took a bit longer than I expected to find the updated URL and now my self-targeted Amazon advertisements are working again.

Whew!

Update on Thursday, August 6th at 12:40 am

Amazon finally notified me of the change

Wednesday, August 05, 2015

It's like a slow but very roomy airplane with good service

It's 2:00 pm and I'm here in the Hart Memorial Central Library in Kissimmee, Florida with some time to kill. Why I'm in the Hart Memorial Central Library is a story unto itself.

A week and a half ago, my friend Tom Lanahan, a train aficionado, invited me to ride along with him on the Georgia 300, a private rail car that is currently attached to end of the Silver Meteor and heading south. The only catch was that I needed to be in Kissimmee at 1:26 pm today in order to catch the train as it headed south.

I didn't miss the train—it's currently running two hours late, where as the north bound Silver Meteor, the train I took to Kissimmee, was on time, arriving in Kissimmee at 1:06 pm on the nose.

Thus, I have some time to kill.

This is the first time I've taken Amtrak and it wasn't a bad experience. The seats are wide, there's plenty of leg room (oh my God the leg room!) and the one-way ticket wasn't expensive at all (one way, since I'll be taking a private rail car back to Chez Boca). Lunch, while a bit on the expensive side (of course—they have a captive audience) was surprisingly good.

And I can't complain about the service. It's been excellent all along.

But there is one thing I can complain about


The Write Train

Last year, Amtrak offered a residency program for writers, where Amtrak would provide a free round-trip ticket to qualifying writers. A type of “working vacation” if you will, where there is no distraction except for the clack-clack-clack of train wheels on rail as the train criss-crosses the continent. It sounds wonderful in theory.

In theory.

I gave some thought to signing up, but I'm not a writer, nor an aspiring writer (even if I play one on the Intarwebs). I figured I would forgo the chance for a free train ride and let someone more deserving have a shot.

Yeah, like with 16,000 applicants I ever stood a chance of going.

Now we get to practice.

Calling the train ride “bumpy” is incorrect. It's not bumpy. It's not a constant “up-and-down” motion but more a “left-right” motion. I would call it “swishy.” It's a very swishy ride.

It's so swishy that it's damn near impossible to write! My typing rate was about a quarter normal and the use of the backspace key was at an all time high.

How in the world is anyone expected to write?

That is my biggest complaint about the trip so far. I had this intention of writing during the trip to Kissimmee but it proved a fruitless endeavour. It was just too damn swishy to write.

The other issue was the cell phone coverage. The Silver Meteor doesn't have wi-fi, but that's okay because I can use my cell phone as a hot spot. Or I would had the cell coverage been decent, and it wasn't.

What the XXXX, Verizon‽ I thought you were supposed to have like the best coverage of all celular carriers. Hello? Hello?

Hmm … I guess they can't hear me.

Anyway …

Three swishy hours later and all I have to show for it are nearly incoherent notes filled with typos. There is no way you can expect to actually write on a train trip.


Notes from a library in downtown Kissimmee

The guy sitting across the table from me at the library is falling asleep. His nose is about to hit the table, and he's snoring loudly.


The Georgia 300

Ah, the Georgia 300.

[This is my picture of the Georgia 300.  There are many like it, but this one is mine.]

This is how you travel. From the Georgia 300 platform at the rear of the car:

[So this is what the view from a whistle stop campaign looks like.]

to the dining room near the front:

[Don't let the multiple dining utensils frighten you—just remember the order of use is always start with the outside and work your way in.]

and everything in between the two:

[The best seat in the house—I mean car.] [There's nothing quite like lounging in a well appointed den moving at 60 mph.] [Three staterooms to the right, and the dining room at the far end.  There's quite a bit packed into a 74′ train car.]

A person could certainly get spoiled traveling this way. How can you not like the custom China plates?

[Don't worry—George has you covered.] [Original dinner ware from the Georgia Railroad.]

Or even the China cabinet?

[I would expect to see something like this at Biltmore, not on a train.]

On the down side, it's not cheap.

And four hours is not nearly enough time to enjoy the ride. Four days is more like it (and yes, I'm totally jealous of Tom).


Really Amtrak? Really? You using that slogan?

One thing I didn't mention on my train ride to Kissimmee was this:

[Loose lips sink trains or something like that]

This is apparently a thing.

Did no one at Amtrak know this is a famous line from a satirical movie about a distopic, totalitarian bureaucratic government attempting to fight terrorists and freelance heating engineers?

Sigh.

Still … it beats flying.

Thursday, August 06, 2015

Oh, now you tell me about it

From
Amazon Associates <XXXXXXXX@amazon.com>
To
Sean Conner <XXXXXXXXXXX@conman.org>
Subject
Associates Ad Unit Migration Notice
Date
Wed, 5 Aug 2015 21:13:47 +0000

Hello,

As previously communicated, we have been making changes to our technology platform that require you to replace some of the older product links, banners, and widgets currently hosted on your website.

Effective August 1, 2015, legacy product links were replaced with a public service announcement banner that will no longer send referring traffic to Amazon. You can now identify legacy product links, banners, and widgets that require updating by the presence of the public service announcement “Let’s Fight Hunger Together”. No further action is required if you have already made the requested changes.

Starting September 1, 2015, these legacy advertising units will no longer render, thereby either creating a broken link or the ad unit not appearing on your website.

Please use the following link to obtain more information and view the FAQs: https://­affiliate-­program.­amazon.com/­gp/­associates/­help/t401

Should you have additional questions, visit the following page to contact Customer Service: https://­affiliate-­program.­amazon.­com/­gp/­associates/­contact

The Amazon Associates Team

Oh … you don't sayWhy did you send this four days after the change?

Friday, August 07, 2015

Google, I think we need a little talk …

So I came across “What Colour are your bits?” for the nth time, and I thought I might link to it, but I want to make sure I haven't linked to it before. So I do what I usually do and try a Google search. Nothing comes up. But hold on—it's “colour,” not “color” so let me try that and even less comes up.

By now, I'm sure I have linked to that article before. A somewhat-­quick-­but-­not-­entirely-­quick search locally on my server revealed that yes, I did link to that article.

Okay Google, what gives? You index everything pretty much instantaneously. I use you pretty much all the time to search my blog. And you can't find a single entry with an exact phrase? Are you just having a bad day?

And now I'm curious—what if I tried … oh … I don't know … BING?

Well, I didn't expect this—first result, exactly what I wanted to find. Well, Google?

Saturday, August 08, 2015

Alas, poor Yorick now has company

Bunny arrived home today and for a gift, she gave me Mort:

[Technically, I think this is a crystal skull, although it's a bit smaller and more opaque than the more well known examples.]

And now Yorick will have someone to keep him company.

[Admit it, you are jealous of Yorick's fez, aren't you?  I know Mort is jealous of Yorick's fez, but he shouldn't be---it's just a paper cup (don't tell Yorick).]

Sunday, August 09, 2015

It does seem that no good deed goes unpunished

Growing up in rural Idaho, Gravity Payments CEO Dan Price remembers learning that one’s values are most sacred.

“My dad would ask me a question…He’d say, ‘How much money is your integrity worth?’ His point was there’s no amount of money that he would be willing to sell his integrity for. And that was ingrained in me at a very, very young age.”

Fast forward to today, the 30-year-old CEO is staying true to those principles. Just last week he announced he’d be taking a $930,000 pay cut to help afford raising the minimum wage at his Seattle-based credit card processing company to $70,000. This means that out of the 120 employees, 70 will be getting raises and 30 will see their incomes double.

Minimum Wage Increase: Gravity Payments CEO Dan Price Pays Every Employee $70,000

When I first heard about Dan Price raising all his employees' pay, I was like, more power to him! It's a private company and he can do what he wants. Personally, at the time, I felt it was great idea. And here is someone willing to put his money where his mouth was.

But like all ideas, there are unfortunately unintended consequences. And boy, were they big.

But even as Dan adjusted to life as a rebel hero and basked in his newfound popularity among third graders and single women, he quickly learned that whether he liked it or not, he had waded waist deep into the minimum wage debate and he would soon discover a few very hard lessons about the unintended consequences of hiking the pay floor.

First, some employees felt it wasn’t fair to indiscriminately give everyone a raise. That is, some felt Gravity should at least pay lip service to the notion that there's a connection between higher pay and performance and because the new pay plan didn't seem to acknowledge that link, the company lost some workers.

Next, Gravity began to lose some of its long-standing customers and while the across-the-board pay raise won the company more than enough new business to make up the difference, the new accounts won’t be immediately accretive and in the meantime, Gravity has had to hire more people to service the new accounts and thanks to the new salary floor, all of those new employees will eventually have to be paid $70,000.

Finally, Dan is now being sued by his older brother and as it turns out, Maisey McMaster had not included a "provision for legal fees in case my brother sues us" line item in the new budget, which means that ultimately, Gravity may have a hard time staying in business.

CEO Hikes Minimum Wage To $70K, Capitalist Tragicomedy Ensues | Zero Hedge

If there's one lesson to learn in all this, it's l'enfer est plein de bonnes volontés et désirs. If there's another lessons to learn, it's make sure you own the company before doing any harebrained schemes!

Monday, August 10, 2015

Oh by the way, they're rebooting King's Quest

I fondly remember playing King's Quest as a kid (and in fact, I think I still have the original game for my IBM PCjr). The hardest puzzle in the game that neither I nor my friend Bill Lefler could solve was the gnome's name (we ended up having to cheat and look at the answer to get past that puzzle). But the one thing this video of a playthrough (link via Shamus Young) does not show is the screen being drawn (a “feature” of the PCjr version), which is pretty neat the first thousand times you see it, but gets old afterwards. A side effect of that “feature,” though, is that any objects that could be manipulated (or were otherwise significant) would suddenly “pop” into existence once the screen was done drawing.

Ah, this video is more like it (when watching it, notice how the rock just “pops” into existence over the hole). There was also a mode (activated by a key combination—and it's been way too long for me to memeber what it was) that would cause the drawing to go even slower (I suppose it was for debugging purposes). Again, fun to watch for the first hundred times or so.

Tuesday, August 11, 2015

You have to make sure the vanilla is bone dry

About a week and a half ago, I used a vanilla bean when making some ice cream (yeah yeah, when the Bunny's away the carrots will play or something like that). I've seen on various television shows that you can dry the used vanilla bean and place it in sugar for a week or so to make vanilla sugar.

Hey, why not?

After I was done with the vanilla bean, I dried it off and shoved it into a contain of sugar in the spice cabinet. Only, I don't think I got it dry enough:

[It's a vanilla bean!  A VANILLA BEAN I say!  Not some arachnid horror from the cocaine fields of Columbia]

But the sugar smells wonderful.

Wednesday, August 12, 2015

A sign of the times

One challenge Gallego faces is translating metaphorical concepts from songs without compromising the whimsical nature of the lyrics. To navigate these intricacies, Gallego will often employ what she calls “indicating verbs:” she’ll mix two signs concurrently — one with her hands, and the other through her movement — to get an idea across.

For instance, in “Baby Got Back,” Sir Mix A Lot pontificates, “My anaconda don’t want none unless you got some buns. When signing “anaconda,” Gallego combines the hand sign for “snake” with a sweeping motion that connotes she is referring to a penis. “I’m signing the snake, but visually, it looks like a big schlong,” she says, “and the audience gets it.”

Similarly, Gallego can’t just flash the sign for “butt” (literally, a simple finger point to the exterior); she has to symbolize that Sir Mix A Lot is referring to particularly voluptuous posteriors. Instead, she draws the shape — a gigantic, large-bootied silhouette — with her hands in the air. “You have to add action and movement to express his true lyric,” she says.

Gallego rarely signs the exact words a performer is saying. Instead, she’ll relate the concepts behind the lyrics. This is because literal interpretations more often than not confuse people (ie. for the phrase, “bear with me,” some interpreters flash the sign for the animal).

The Sign Language Interpreter of the Rappers

I would have never thought this was a real thing. I find it fascinating to watch (warning—you might not want to play this while at work due to language—but it's being signed, so you shouldn't really need the volume, should you? As an alternative, try watching a classic Michael Jackson song being signed).

Thursday, August 13, 2015

Notes on an overheard three-way conversation at a pseudo-Frenchesque bistro

A small restaurant in an unassuming strip mall along the road, devoid of any paying customers. Loud accordion music is playing over cheap speakers. The door opens …

“Ah, welcome to Prétentieux Bistro Français. You may zeet eenywhere you like! Perhaps monsieur et madame would like theez table, no?”

The table is small, small enough that it might make a single diner uncomfortable with anything other than a single hors-d'œuvre and a small glass of wine.

“That's a bit too small.”

“Le sigh. 'Ow about theez one?”

It's slightly larger. A single diner could eat here. Two, but only if they keep to the hors-d'œuvres.

“I like that one.”

“But of course! Ze best table! Pourquoi pas?”

“I have this coupon for the Faux Prétentieux Bistro Français—”

“That is nous.”

“You changed your name?”

“Our owner, he is, 'ow you zay, ‘capricieux?’”

“Whimsical.”

Oui. Is that not what I zaid?”

“…”

“Eenyway, 'ere is ze dinnar menu. Theez is our zummer menu, you get an hors-d'œuvres, an entrée, and le dessert.”

The diners are each handed a cheaply laminated sheet of paper, listing a few appetizers, even less entrees, and a “you have to ask us if we have anything made today” dessert menu.

“Okay, I'll take the Soup Du Jour and a salad—”

“Non non non non non! Un hors-d'œuvres!”

“But the coupon I have is for a free salad … ”

“Theez is our zummer menu, you get un hors-d'œuvres, un entrée, and le dessert.”

“But I also want the free salad.”

Theez is our zummer menu, you get un hors-d'œuvres, un entrée, and le dessert.”

Salad!

“Le sigh. Un instant … ”

The diners are left to ponder the summer menu for a few minutes.

“You can geet the zalad if you order from our other menu, 'ere. As you can zee, we have ze zame trois dinnar special, only more expenzive, as it is ala cart!”

“I see.”

“I come back een a few moments zo you can make your choice.”

That was interesting.”

“You know, I think I'd rather eat at the Scottish place. Let's go …”

“Sounds good to me.”

Friday, August 14, 2015

Implementing a switch statement in Lua

From time to time, the lack of a switch statement in Lua comes up on the Lua mailing list.

Over the years I've been using Lua, I only missed switch when I first started, as I was trying to write Lua like it was C. But over time, I've come to realize that a switch statement isn't really needed that often, not with first class functions. A minimal implementation is just three lines of code:

function switch(key,case,otherwise)
  return (key[case] or otherwise or function() return nil end)(case,key)
end

Which allows you to do something like:

switch(i,
  {
    [true]     = function() print("i is true") end,
    [10]       = function() print("i is is 10")  end,
    ['foobar'] = function() print("i is 'foobar') end,
    [print]    = function() prnit("i is the function print()") end,
  },
  function() print("i is not something I recognize") end
)

It's about the same syntactical overhead as the switch statement in C or Java. The reason I pass the case table to each function is to allow a C-style “fallthrough” case, like:

switch(i,
  {
    [1] = function() flag = true end,
    [2] = function(case) case[1]() print(flag) end,
  },
  function() print "Unknown!" end
)

Notice how when i is 2, we execute the case for then i is 1, and print flag (also, the indices are superfluous—I just included them to be explicit). Also note how this can be used in an expression context—something that can not be said for C (or C++, or Java or … ).

Is this the best solution? Hard to say. It is the shortest, but it isn't that tolerant of of errors. But because it's so easy to implement, it can be adapted to just about any style you want.

Saturday, August 15, 2015

Snippits of an overheard conversation while driving to dinner

“Hmm … the on-ramps to I-95 are going to be closed.”

“They are?”

“Didn't you see the sign?”

“What sign?”

“You know, the big, 10′ electronic sign that flashes messages you see in construction zones?”

“Really? I didn't notice.”

“Sigh.”

“You know—”

“Yes, you aren't a trained observer.”

“Exactly.”

“Closed from 10 PM to 7 AM.”

“Doesn't affect me.”

“It could.”

“It's not 10 PM yet.”

“So you just ignore it.”

“Yup.”

“And when you want to get to I-95 and the on-ramps are closed?”

“Then I can't get onto I-95 from Yamato. Then I'll try driving to Congress and I-95, and find that on-ramp closed. So then I'll drive up to Linton, get stuck in horrible traffic because everybody that's trying to get on from Yamato or Congress are heading to Linton to get on. And because I'm stuck in horrible traffic, I'll be late to jury duty. And because I'm late to jury duty, I'll be arrested and slammed into jail. All because I have cable television.”

“Pbth­pbth­pbth­pbth­pbth­pbth­pbth­pbth.”

Sunday, August 16, 2015

It's not quite impressive when you know you can buy it at Amazon

I came across Jamie Raven's first performance on Britain's Got Talent, and I must say, the animated card trick (really, I can't describe it—you should see it for yourself) was very impressive. But, this being on YouTube at a nice resolution, it's all too easy to go through the trick frame-by-frame and figure out how it's done.

Yes, Bunny and I went through the trick frame-by-frame, and by carefully (mild spoilers here) noting what we could and could not see, it became apparent how he did the trick.

But it gets even less impressive when you realize you can buy the trick on Amazon.

His previous trick in that video, that of turning several £50 notes into sketches of the judges, in front of them, by waving the bills back and forth, is still impressive but only by the fact that I don't know how he did it.

This seems to be a trend with his tricks on Britain's Got Talent. On his last appearance on that show, for his first trick, he pulls out a deck of cards, asks Simon Cowell to name a card, then fans out the deck face up, with the card that Simon Cowell named, face down. Assuming Simon isn't in on the trick, it's mindblowing (much like his turning £50 notes into drawings).

But I found his final trick (pulling a signed card out of a lemon) obvious (nothing in his hands, indeed!). It's a nice trick, but really (mild spoiler), he takes a few seconds too long doing what should be a quick move.

Monday, August 17, 2015

Why can't you backup, then download?

My iPad is low of charge, so I plug it into the Mac as I usually do in such situations. As soon as I do, iTunes pops up this message:

There are purchased items on the iPad “Sean Conner's iPad” that have not been transferred to your iTunes library. You should transfer these items to your iTunes library before updating this iPad. Are you sure you want to continue?

The “Cancel” button is highlighted, but I do have the option to hit the “Continue” button.

Sigh.

How hard could it be to do this?

There are purchased items on the iPad “Sean Conner's iPad” that have not been transferred to your iTunes library. This iPad will automatically be backed up before it is updated. Are you sure you want to continue?

Because that is most likely what I want to do.

Usually when this happens, I hit “Cancel,” then backup the iPad, unplug it, then plug it back in to get the new iPad software to download.

Or, short of that, why can't I backup the iPad while the new version of iOS downloads? I only have 36 minutes left (out of a 42-minute download) that that's plenty of time to backup the iPad. But noooooooooooooooo! It is incapable of doing this.

I thought Apple was better than this.

Update later today …

iTunes did a backup of the iPad anyway. What a poorly written warning.

Tuesday, August 18, 2015

We can link modules into a program with a linker, so where's the tool to link programs into a system?

I'm at work, and I'm looking at all the components that comprise “Project: Wolowizard” and how tedious it is to configure everything properly to work. Then I look at “Project: Sippy-Cup” and all the compoents and how tedious it is to configure everything properly to work. And then I had an odd thought.

Back when I was coding on an 8-bit computer with 16K of memory, if my program got too big (and I'm talking assembly language here) I could break it up into individual files, but I had to manage, by hand, all the memory addresses of each file and function. For example, one file might start assembling at address 4,096, function FOO might start at address 5,133, and the end of that file might be at address 6,218. That meant the next file had to start at address 6,219 (which meant making sure to tell the assembler that) and that I had to define the address of FOO in the second file as being 5,133.

Later on, when I had a computer running a real operating system (well, it was MS-DOS, which some claim isn't an operating system, but a non-reentrant interrupt handler with delusions of being a real operating system but I digress) I could take individual files, compile (or assemble) them separately and not care what addresses were what, leaving that up to another program to link everything together into a single program (it's called a “linker”). No longer did I have to worry about what address function FOO would start—that was taken care of by other bits of software. I could even include bits of output produced by other programmers (called libraries—bits of precompiled code ready to be linked into a program) automatically.

What I'm missing now is the linker for “Project: Wolowizard” or “Project: Sippy-Cup” as a whole. The piece of software that will take the various programs (each of which are comprised of multiple files compiled and then linked together into an executable) and “link” them up (in this case, configure all the components) for me automatically.

I'm wondering if it's even possible for such a tool in the general sense to exist.

Wednesday, August 19, 2015

Shaun the Sheep Movie

What a wonderful movie. Shaun the Sheep just wants a day off from the daily grind of farm life, but an accident sends the Farmer into the Big City and it's up to Shaun and the rest of the flock to rescue him while avoiding the Animal Control Officer. It's just a delightful film without one word of dialog (not that dialog is even needed in this movie).


The oddest trailer I've ever seen

Of course there were trailers, and I saw the oddest trailer I've ever seen. It was for an animated film movie (because Bunny and I were waiting to watch an animated film movie) so nothing odd there. But it was in Spanish.

I've never seen a trailer for a foreign film movie that wasn't in English.

But it gets odder.

It was subtitled!

Okay, yes, it makes sense for a film movie in a foreign language to be subtitled. But this wasn't a film movie—this was the trailer for a film movie. And not just for a film movie, but an animated film movie!

Granted, I've seen subtitled animated films movies before but they weren't exactly aimed at mainstream American audiences but direct imports, usually from Japan, but I suppose some could exist from elsewhere in the world.

Odder still, the voice over, you know, the typical trailer voice over that typically begins “In a world about a land with time,” that type of voice over, was in English!

So Bunny and I saw a trailer for a sub-titled Spanish animated film movie with an English voice over.

About chickens and eggs.

I got nothing.

Thursday, August 20, 2015

“This is not the jury summons you are looking for.”

Beep boop beep boop beep boob beep beep boop boop.

Ring.

Ring.

“Welcome to the Palm Beach County Courthouse. If you are calling for jury duty, please press one—”

Beep.

“Please enter the nine digit juror number on your summons … now.”

Beep boop beep boop beep boop beep boop beep.

“You entered XXX XXXX XXX XXX XXXXX XXX XXX XXX XXX. If that was correct, press one—”

Beep.

“Please hold while I access your information … you are excused from juror duty and no further action is required from you at this time.”

Yippee!


They certainly picked the right actor to play a very young Darth Vader

Sorry for that “Phantom Menace clip in the previous post, but I did find something interesting when I was searching for it:

In today’s flashback to the ’90s news, former child star Jake Lloyd, the Turbo-Man fanatic from the Arnold Schwarzenegger Christmas movie Jingle All The Way and the infamous first Star Wars prequel The Phantom Menace, was arrested on charges including resisting arrest and failing to stop for a police officer in South Carolina this weekend. Police saw Lloyd speeding, and began to follow him, but rather than slow down, Lloyd sped up and according to TMZ eventually reached 117 miles per hour as he led police on a chase that ended with Lloyd crashing into a tree.

The Real-Life Fall of Anakin Skywalker: Jake Lloyd’s Journey From ‘Star Wars’ to the Slammer - The Daily Beast

It's the picture that sells this—that yes, I can see that kid becoming Darth Vader.

Friday, August 21, 2015

I think there's a quote by Martin Niemöller that also might apply

Twenty years from now,

It doesn’t have to be this way. But to change course, we need to ask some hard questions and make some difficult decisions.

Here, too, the message was clear. You need our permission to operate in this world. If you step over the line we draw, if you automate, if you download too fast, if you type something weird in the URL bar on your browser, and we don’t like it, or we don’t like you, then we will get you.

In the future will we re-secure the Freedom to Tinker? That means Congress forgoing the tough-on-cybercrime hand waving it engages in every year — annual proposals, to make prison sentences more severe under the CFAA, as if any of the suspected perpetrators of the scores of major breaches of the past two or three years — China, North Korea, who knows who else — would be deterred by such a thing. These proposals just scare the good guys, they don’t stop the attackers.

We’d have to declare that users own and can modify the software we buy and download — despite software licenses and the Digital Millennium Copyright Act (DMCA).

This is going to be increasingly important. Over the next 20 years software will be embedded in everything, from refrigerators to cars to medical devices.

Without the Freedom to Tinker, the right to reverse engineer these products, we will be living in a world of opaque black boxes. We don’t know what they do, and you’ll be punished for peeking inside.

Via Lobsters, The End of the Internet Dream? — Backchannel — Medium

The general public just don't care about this stuff. And for some reason, this thought keeps going through my head: you can lead a horse to water, but you can't make it drink.

Saturday, August 22, 2015

How to fold your mind around imaginary math

The article How To Fold A Julia Fractal (link via Hacker News) isn't just about the Julia set and their relationship to the Mandelbrot set, but also an explanation of imaginary numbers. Even if you aren't that into math, the interactive visualizations of how imaginary numbers, Julia sets and Mandelbrot sets work is well worth checking out. This stuff almost makes sense now.

Sunday, August 23, 2015

This is not your grandfather's Theremin

Wow!

There's a Moog version of the Theremin. And it's being demonstrated by Kydia Kavina, the protégé of Léon Theremin, inventor of the Theremin.

Way cool!

Just as cool is Lydia Kavina playing the theme to Dr. Who on what looks to be a more traditional Theremin (along with some other very odd looking instruments).

Monday, August 24, 2015

There are no such things as bugs, only undocumented features

I found a very cool list of epic debugging stories (link via Hacker News). These stories are way more epic than my most epic bug, like the random memory corruption caused by a bad timing signal or the inability of email to be delivered past 500 miles (my personal favorite story).

Tuesday, August 25, 2015

A better way to implement system()

I am very surprised I haven't covered today's topic before, but try as I might, I don't think I have. Weird!

Anyway, twenty years ago when I was attending college, I designed and implemented my own programming language. Oh, it wasn't for a class (although I did use it for a class project—more on this below) nor for work (although I did use it for work at the time) but for my own curiosity (basically, how a typical Forth was implemented).

And perhaps the most unique aspect of my language came about because of a class project to implement a Unix shell. There were two options—the first was to do simple command line parsing and environment variable substitution (for example, where the environment variable $HOME would be swapped out for its value) and file redirection as a solo project, or do that, plus some programming constructs like conditional statements or loops as a group project. Well, I already had the programming constructs in the form of my language so I had already done the majority of the group project. All that was left was to parse and execute Unix commands. It took all of two hours to add and it pretty much worked right the first time.

Now, my language was based loosely on Forth but with an object oriented flavor. The built-in types, like integers, strings, floats, were underneath objects and I managed to shoehorn in polymorphism so that operators like “+” and “/” would work across types. It was in this environment that I decided to make Unix commands first-class. I think it was a brilliant design and it allowed me the ability to sling commands that one could not do from the command line (even today). The big one was redirection of stderr. Modern Unix shells will allow you to redirect stderr to a file:

GenericUnixPrompt% make 2>/tmp/errors.txt

and you can, kind of, pipe it to another command:

GenericUnixPrompt% make 2>&1 | more

but that includes all the normal output as well. There are times when I would like just stderr piped to a command, but there is no real way to do that.

But you could, rather easily, in my language. Well, “easily” being a relative term, but still, I could arbitrarily redirect stderr to a complex pipeline of commands while at the same time redirect stdout to another complex pipeline of commands, where each of those commands could redirect stdout and stderr as well.

Twenty years later and it's this article (link via Hacker News) that got me thinking about my language (seeing how I'm the sole maintainer, sole developer and not even sole active user) and about the unique ability to treat Unix commands like any other value in the program. And I realized that I could probably do the same using Lua.

A few hours later and I have a near working “proof-of-concept” (in that it creates the proper structures but doesn't actually execute anything yet):

cmd = "logfile"
    +  C("escanlog","--refer")^{}
    / (C('diff','-','expected')^{} / "escanlog-error" + "escanlog-out")
    +  C("sort")^{} / "/dev/null"
    +  C("uniq","-c")^{}
    +  C("sort","-rn")^{}
    + "/tmp/output"
cmd()

It would be hard to translate this into an actual command line, seeing how you can't really pipe stderr. Breaking this all down, the function C() creates a Unix command object; the first parameter is the program, all the rest become command line objects. The “^” is normally the exponent operator, but here, I'm using it do define which environment variables I want set for the command and here, it's an empty environment. For example, if I want todays date in Swedish, I could do:

cmd = C("date","+%c")^{ LANG="se_NO" }
cmd()

This is something you can do at the command line, but it gets unwieldy for a large number of environment variables or even a different environment variable per command. And since this environment blob is just a regular Lua table, you can set up a custom environment as a variable and reference it that way.

The sequence

cmd = "logfile" + C("grep","foobar")

will change stdin to be the file logfile. But this:

cmd = C("ls","-l") + "list.txt"

will cause stdout to be written to the file list.txt. So generally speaking, “+” will redirect stdin or stdout, depending upon where it appears (in this case, “+” is non-commutative). This will even work when redirecting stdout to another command:

cmd = C("ls","-l") + C("tr","a-z","A-Z")

Redirecting stderr is done by using “/” and it works similarly do “+”—if a string is specified, treat that as a filename and redirect stderr to that file, otherwise redirect stderr to a command (where it becomes stdin). And it wouldn't be hard to extend this to support resource limits per command as well.

The odd choice of operators is due to the limited choice available for Lua 5.1—Lua 5.3 has more operators to choose from, but to be useful, I limited myself to what's available for Lua 5.1.

I'm actually surprised something like this hasn't been done before (or if it has, I'm not aware of it).

Wednesday, August 26, 2015

Debugging only gets harder with the passing of time

The story resurfaced this week in connection with the Germanwings crash. The standard causes of plane crashes, as Steve Coast explained, have been largely eliminated by the imposition of sensible rules or engineering fixes. Windows no longer crack at the corners. Doors no longer blow out. What remains are the oblique, non-obvious problems. ‘As we find more rules to fix more things we are encountering tail events. We fixed all the main reasons aircraft crash a long time ago… So, we are left with the less and less probable events.’ The world’s problems will, in short, get weirder. The seemingly sensible fixes we now add to the rule book will now increasingly run into unintended consequences: you can install impenetrable cockpit doors on the assumption that they will protect pilots from terrorists, only to find that they also prevent the captain (and passengers) from regaining the cockpit.

Why plane crashes are getting weirder – and if we’re lucky, other problems will too » The Spectator

I never thought of this, but it's obvious in hind-sight—all the easy problems have been fixed and what we're left with is weird interactions that lead to computer programs that occasionally crash only on Wednesdays.

Thursday, August 27, 2015

At the computers of craziness

I throw together things until it works then I move on. The real programmers will say "yeah it works but you're leaking memory everywhere. Perhaps we should fix that." I'll just restart apache every 10 requests.

Rasmus Lerdorf

I am not a fan of PHP for a variety of reasons, and it doesn't help that the author of PHP says the scariest things a programmer can say and people still use his stuff.

True story: back in 1997 or 1998, Smirk came up to me with two thick printouts and asked me for my opinion. The printouts were manuals for two different HTML processors, one called MetaHTML and the other one PHP. Even back then, I had an uneasy feeling about PHP and said we should go with MetaHTML (the website no longer exists and good luck trying to search for “MetaHTML”).

But little did I realize the eldritch horrors lurking in the depths of R'lyeh PHP:

And if that's too simple, then just make the condition random:

class FooClass {
}
$foo = new FooClass();
$foo->bar = "qux";
$thing = "bar";
$qux = "th";
$grault = "ing";
$corge = "gnu";

echo $foo->${${$foo->bar}.${(rand(0, 9)<5)?grault:''}}, "\n";

Yeah this will print qux half the time, and crash the other half. Want to add equality tests? knock yourself out:

($foo->${${$foo->bar}.((${pouet}.${machin}===$pouet.${machin})?${machin}:${$pouet.$machin})});

And that's where the second realization hits: you know how foo is just a string right? Then wouldn't foo() be "a string with parens"?

Well it happens that no:

function foo() { return "foo"; }

echo "foo"();

$ php test.php
Parse error: syntax error, unexpected '(', expecting ',' or ';' in test.php on line 4

Unless you put the string in a variable itself:

function foo() { return "foo"; }
$bar = "foo";
echo $bar();

this will print foo. That's actually what PHP's own create_function does. And yes, I can see the dread in your eyes already.

Your fears are real.

Via Hacker News, masklinn comments on Today I learned about PHP variable variables; "variable variable takes the value of a variable and treats that as the name of a variable". Also, variable.

Run now! Look not at this page! Spare your sanity! Aiiiee­eeeeeee­eeeeee­eeeeeee­eeeeee­eeee­eee—


As long as the trucks aren't named Christine, we should be fine, right?

This past Sunday, Bunny and I were talking to my friend Tom Lanahan (the friend that invited me for a little train ride) about self-driving vehicles when I mentioned the tests that are underway in Nevada involving self-driving trucks. Tom was skeptical it would ever come to that, if only due to liability and felt that we were still years away from it happening.

Yeah …

The first autonomous vehicles to hit US highways will not be Google or Apple cars, but self-driving trucks – and they will be riding roads in Florida by the end of the year.

The self-driving construction vehicles, fitted with special rear-end crash barriers and lights, have been successfully demonstrated, driving using GPS waypoints and following a lead car, mimicking its path, braking and speed.

The specialised crash trucks are fitted with large signs to warn road users of the presence of workers and are used to protect construction crews resurfacing roads, painting lines, inspecting bridges or installing traffic signals.

Via Bob Anstett on FaceGoogleMyTwitterPlusSpaceBook, Self-driving ‘crash’ trucks to hit Florida highways this year | Technology | The Guardian

… it's a thing.

Friday, August 28, 2015

Reason #NaN I hate PHP

Quick, what does the following PHP code print out?

<?php
for ($i = 'a' ; $i <= 'z' ; $i++)
	echo "$i\n";

Non-PHP programmers might say “the letters from ‘a’ to ‘z’ of course!” But sadly, no. It does not just print the letters from ‘a’ to ‘z’. Nope. It prints way more than you expect (link via Hacker News).

I realize that picking on PHP is like shooting dead fish in a barrel with a double barrel shotgun but I find it never gets too old.

Saturday, August 29, 2015

The Man From U.N.C.L.E.

Bunny's brother informed us that “The Man From U.N.C.L.E. was worth seeing and that was enough to convince her to go. Me? I've never seen the television show so I was going into this movie cold, having no idea what exactly to expect.

It was a very fun movie. I think the producers were smart in keeping it set to the 60s and not attempting to modernize the storyline at all. The cinematography was good, and the use of split-screen gave the film a unique look (and to me, gave it more of a “60” vibe). The use of flashbacks (in some cases, flashing back to a scene that happened less than a minute earlier) I felt was a bit excessive (like the audience can't figure out what might have happened) but overall, it was a solid, lighthearted action spy flick set in the 60s that didn't take itself too seriously, nor was it an outright parody like Austin Powers.

On the down side, about the only thing it had in common with the television series (according to Bunny—remember, I never saw it) were the names. In fact, the term U.N.C.L.E. doesn't even come up until the last line of the movie. But if there are sequels, I for one, wouldn't mind seeing them.

Sunday, August 30, 2015

Kernighan, Ritchie and Lovecraft, oh my!

C functions may be used recursively; that is, a function may call itself either directly or indirectly. Uninquiring souls may take this as just another peculiarity of those C folk, of whose ways their neighbours speak little to outsiders but much among themselves.

Keener news-followers, however, wondered at the events of the winter of 1927-28, the abnormally large number of calls placed upon the stack, the swiftness with which that list was sorted, the disturbing lack of heap allocation throughout the proceedings, and the secrecy surrounding the affair.

People in the nearby towns had talked about C for nearly a century, and nothing new could be wilder or more hideous than what they had whispered and hinted years before. Many things had taught them secrecy, and there was now no need to exert pressure on them.

Via Reddit, The C Programming Language: 4.10

Speaking of eldritch code

Monday, August 31, 2015

The days when assembly was required

From about the mid-80s to the mid-90s, I pretty much programmed exclusively in assembly langauge. Along the way, I learned the 6809, (my favorite of the 8-bit CPUs), x86, 68000 (my favorite of the 32-bit CPUs), VAX and MIPS assembly languages, and I can recognize (and could probably program in if I had to) the 6502, 8080, Z80 and SPARC. I don't program much (if any) in assembly anymore. The CPUs have gotten too complex, the optimization rules too arcane and numerous and porting programs just gets tedious in assembly (they're practically a rewrite). Besides, compilers are getting better and better over time, negating the use of assembly except for absolute performance (when C or Fortran won't cut it).

But I still like assembly language, and I find these assembly gems (link via Hacker News) fun to read, even if they aren't that useful these days.

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: http://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

http://boston.conman.org/2000/08/01

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