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.
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'tfoo()
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 4Unless 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 owncreate_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 eeeeeeeeeeeeeeeeeeee—
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.