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.

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! Aiiieeeeeeeeeeeeeee­ 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.

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

https://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-2024 by Sean Conner. All Rights Reserved.