Simpler, but vulgar

Allow me to make a stronger, simpler, and far more vulgar point than this post:

Hacker News is awful. The “community” is mostly bored shitheads posting from work, or massively self-important assholes who are bitter their TODO app didn’t get into YCombinator after 15 tries. 

Twitter accounts like Shit HN Says could be 10x as content-rich if they wanted to. Most of the things posted on HN are just truly awful, in terms of a community of ostensibly technical people. 

You can see craven, callow, shallow, mean, bitter, obnoxious, stupid … the entire range of awful human interactions. Honestly, when’s the last time a HN comment really improved anything? Really made a strong contribution to your job, your hobby? 

As a community-curated link site, Hacker News has good stuff most of the time. As a place for community discussion, Hacker News is just You Tube comments with better grammar.

Translating the “Rails is DEAD!” talk to plain (?) English

So apparently a bunch of people woke up this morning and decided Rails sucks.

Let me translate some of this for you.

I’m becoming more and more certain that this means that Rails-style MVC frameworks on the server-side are going to end up being phased out in favour of leaner and meaner frameworks that better address the new needs of thick-client architecture.

Uh, yeah.

What that means is:

Part of the reason we have these monstrous frameworks is because at some point all software is just one giant if/switch around the seemingly endless list of bugs stemming from one of (client OS, client hardware, client browser, client plugins, deranged and clearly pants-on-head-stupid client workflows, and the vagaries of quantum physics.

But, because programmers think code rusts, and we love to rewrite the HELL out of it, we come up with new and exciting ways to do just that.

Much of the OP‘s complaints can be easily and succintly explained by simple things: IE6 is now dead, most browser vendors have some sort of agreement to not put us all though the same old BS browser war we went through last time. JavaScript is now a “first class” language and not an annoyance for “know-nothing” Web designers or inflicted on the company “rock stars”. Enough JavaScript exists “in the wild” that we have stable platforms to use to build apps.

So! It’s the trifecta of awesome rewrite-your-app time:

“Everyone’s settled on non-blocking IO as the only way to scale.” “Client-side tempting is where it’s at these days.” “We’ll less trouble since it’s all the same language and platform everywhere!”

Time to rewrite those apps!

Fast-forward 2 years when “I’m becoming more and more certain that this means that Node.js-style single-threaded engines with client-side logic are going to end up being phased out in favor of leaner and meaner megathreading frameworks that better address the new needs of the quantum-core architecture”.

An example of why Applescript is utterly awful and must be replaced

A while ago, I attempted to resolve the problem in Safari’s Delibar extension, wherein it can’t do what the Chrome extension can: automatically put the selected text into the ‘notes’ field.

I failed.

In part I failed because of Safari, and the way it structures extensions. Briefly, Safari uses a sort of separation-of-concerns model, so what a particular piece of an extension can access varies. Getting the selection is really hard because you need to use proxying and messaging to communicate between the current page, the extension’s “page”, and any resources.

I gave up because it sucked and wasn’t fun.

I had another thought: use Applescript to get the selection and pass it to the Delibar app itself! GENIUS!

The tl;dr here is “Delibar isn’t scriptable” so none of this matters, anyway.

Safari’s Applescript dictionary doesn’t include the term “selection”. To the best of my knowledge, you cannot use Applescript to get the selection of the current tab. Oh ….. kay.

So, the next logical step is to use JavaScript, because I know it has the ability to get the selection AND I know that there is a ‘do JavaScript’ command in AppleScript for Safari. Now we’re cooking!

Here’s the relevant bits from the dictionary:


do JavaScript (verb) Applies a string of JavaScript code to a document.


and the example:


set theResult to do JavaScript unicode text ¬ in tab


Makes sense, right? Sure. So you’d pretty much imagine that it works just like this:

tell application "Safari"
    set selectedText to (do JavaScript “window.getSelection()” in current tab of window 1)
end tell

Always returned null. Always. I then tried hundreds of combinations of more-or-less JavaScript, including:

  • adding a return
  • wrapping it in an anonymous function
  • using document instead of window
  • banging my head against the desk and cursing myself for ever having these sorts of thoughts After lots of searching, I discovered the completely obvious answer:

    do JavaScript “(”+getSelection())”

That’s a double-quote, left paren, single quote, single quote, plus, then the function and a closing quote.

Of course. Completely obvious. Note that removing the single quotes and concatenation operator doesn’t work. So “(foo())” doesn’t work, but “(”+foo())” does. I found two places that say it does work, but I can’t make it happen in the latest Lion and Safari.

How the hell do you even arrive at that as a logical place. And how do you expect regular people, ostensibly the target market for Applescript, to arrive at that conclusion?

Applescript is goddamned awful.

Safari 5.1 and “random reload”

So by now, you probably have an iPad. Right? There’s like, eleventy-billion of them sold so far, or something.

At some point you’ve probably been browsing around on the web, and then decided to play some Angry Birds, then back to web browsing. You open up Safari, and there’s the page you were reading; or at least there will be in a moment, because it just reloaded. Some times you can have a couple of “tabs” open, and visiting each in turn forces a page reload.

It’s incredibly annoying, but it makes sense: there’s precious little memory – real and virtual – and so some algorithm decides if a page should be kept in cache or flushed.

Well, Apple decided this was SO. INCREDIBLY. FUCKING. AWESOME. they decided to include it in Safari 5.1 for OS X. If I was using Lion to type this, I’d include the little shit icon/emoji.

Presumably this is some way to stop shitty JavaScripts from leaking and beachballing the entire OS. Or maybe they just thought it “just worked”.

Suffice it to say, many people aren’t happy. It’s finally gotten to me, having had a page reload in front of me while I was using it, with no other tabs open. That’s right: Safari had exactly 1 window with additional tabs and I got a page reload whilst flipping between my editor and the page o’ documentation.

Scuttlebutt is that disabling Java fixes it. I don’t know; in any event I have mission-critical services for work that require both Flash and Java, so I guess I am sort of screwed.

This brings up my eternal gripes with Firefox and Chrome: they annoy me to NO. END. As an example, I can’t get Chrome to set the icon in the Downloads folder, so whatever I last downloaded – disk image, picture, document, whatever – is the default white rectangle in my Dock. Always. That sort of makes the Downloads folder pointless (as a Dock item, anyway, in my humble but correct opinion). I tend to use it rather a lot, so having it not work is a giant poke in the eye.

There’s about 20 other things about Chrome I can’t seem to find an extension to correct. I honestly don’t see how people use it, on Mac OS X anyway, because it’s just covered in sharp edges. Is there anything more popular and yet, more warty and unpleasant?

Oh, right. Firefox. Don’t get me started: every time I open it, some extension is disabled for some reason or another. Now they’ve unveiled a plan to make that worse which is pretty great. I’ve only just figured out how to convince Firefox to stop grabbing the default client preference on my Mac – years after I’d decided Transmit was the best ever.


The point of this rant is that I’m pretty unhappy now with every browser out there. If I can’t find the switch for Safari’s “use the ungodly amounts of RAM I can buy cheaply” setting, what the hell do I do?

Friends don’t let friends create badly-informed presentations

Sometimes I find myself in a position of defending PHP and it makes me crazy. Look, I’m a Zend Certified Engineer whose day job is writing PHP, I’ve written probably millions of lines of PHP.

I wish PHP wasnt’ the best solution for our company.

But it is! Sure, I can make a series of cases for just about any language from Python to Scala, but I strongly believe that just about anyone with half a brain will agree that today PHP is the best choice for our application and our company.

So I’m in a position of simultaneously agreeing with rather a lot of anti-PHP positions and yet in a position to defend it, because so many criticisms are based on elitism (or “nerd prick waving” as I more commonly call it) or ignorance of what it’s like to work on PHP in a professional manner.

The source of my rage is this piece of shit, seemingly written as red meat for a nerd conference. Ok, fine. Still tweaked my own “I can’t believe people buy this shit” reflex.

It starts off innocently enough: by appending a specific PHP session ID to any PHP file that accepts a PHP session ID in the URL you get the PHP logo. It’s a lamentable “feature” that IIRC has been removed (or will be Real Soon Now). It’s a dumb, dumb idea that needs to go; professional tools don’t need cutesy easter eggs.

Moving on the preso quotes Rasmus on language design, some stuff he said about 10 years ago. Look, we get it: Rasmus isn’t a language designer in the way Larry Wall or Martin Ordersky is. His comments were slightly out of context, though. His point is that there’s a difference between academic and pragmatic approaches to software, not that “HAHAHA BUGS ARE TOTALLY OK”.

It then moves into the bog-standard whining about PHP – it’s got some dubious functionality, it’s got incredible inconsistency in function naming/arguments/etc.

I know that the uber-elite haxors do everything in in the standard editor and don’t need any sort of help ever, but out here in the real world, we have to keep lots of things in our head, so we use tools to help. Here’s what an incompent person like me does when faced with inconsistent function arguments:



Golly, it’s like the computer tells me what I need to type so I don’t have to care about inconsistent arguments.

I chose to use the wonderful PHPStorm IDE for that, but I get a similar effect in MacVim and BBEdit. I’m sure I can do it in Emacs, too. In fact I’m pretty sure in just about any editor worth using will help.

So shut up about this. It’s a solved problem. Unless you’re stupid, I guess.

Moving on, the authors complain about “misconfigured web servers” as a PHP problem because as everyone knows, using Django gives a magical ability to configure web servers.


Anyway it goes on like this for a while, as the authors “show their ass” as we say down home; those unfamilar with down-home Southern phrases can insert “show their incredible ignorance”. Eg, there’s “no real debugger” except for an expensive one and printing to the console; they don’t even mention the wonderful XDebug. I suppose it’s so “not real” it’s not worth mentioning? No “interactive console”? Well, yes, except for the half-a-dozen you can find on Github with no effort at all (I use phpsh, by Facebook of all people, but I’m sure it won’t meet the high standards of the authors of this preso. Even if it does use Python.).

I’m also curious about the statement “makes no difference of debug/production”, because I use that on multiple projects. I have deployed projects where to “take the site live” I change a single word. And in changing that single word it automagically knows to disable debug logging, it knows to use the production cache and not the file-local cache, and so on. Golly I must have fallen through some sort of wormhole into some alternate universe where I have the “good” version of PHP.

Near the end of the preso, these morons show their ignorance in 2 grand ways.

First, they are unable to distinguish between the model architecture of a framework and the primitive functions of the standard library. Just look at pages 29 and 30 of the preso: they seem to genuinely believe that the only way to query a database in PHP is to type $stmt->execute() all damn day, whereas in Python it’s just! One! Line!

Hey, dickheads: we have very powerful frameworks in PHP now. It’s just one line for me, too.


Oh, they try to talk about frameworks, and I guess there’s a language barrier, because they then try to claim that PHP frameworks are bad because PHP wasn’t developed with MVC in mind. Pop quiz, dickface: Python was? (I know some Python and I’ve read about its history and I’m going to go ahead and say, um, no, it wasn’t developed with MVC in mind.)

They even ask (page 31) “Why does this still feel like vanilla PHP?”. My god, the staggering ignorance here. Talk shit that Cake, Symfony, ZF and all the others are half-ass Rails clones all you want, but anyone who uses this stuff day in and day out, it isn’t “vanilla”.

But the crowning achievement of this is what’s the most offensive and amusingly ironic bit of the entire preso: glorious page 44.

“There are many good PHP developers available”

  • actually rather not the case
  • and even if it is: good developers?


You spend an entire presentation showing how little you know about the day-to-day use of PHP – you can’t even discriminate between a language and a framework, and your closer is to insult everyone?

Pure. Fucking. Genius. It’s too bad someone who knows a little about professional PHP development didn’t follow my advice: friends don’t let friends create badly-informed presentations.

Oh, and before I go: Facebook tried to switch to Python, twice, and gave up. They couldn’t scale it, they couldn’t create code fast enough. It turned out to be quicker to translate PHP to C++ than to covert to Python.

Eat a dick, ignorant Kraut morons.

Goto was a bad idea, though. I’ll give you that.

There’s a reason PHP “lives in the past”

One of the reasons PHP has a completely awful reputation is that a not-inconsequential number of its core users – people either with commit karma or enough pull to influence decisions on internals – revere backwards compatibility as the most holy thing.

Today in awful BC reverence and general WTF are you thinking? we have and the blog post, “The Plot to Kill PHP MySQL Extension“.

The summation part is pretty accurate, but then goes wildly off the rails in “The PHP 5 adoption fiasco all over again?”.

So what was wrong with PHP 5? Many details, but I think I can sum it up to not being 100.0% compatible with PHP 4. Nobody wants to change code that just works.

If by “just works” you mean any number of things – possibly host to SQL injection or XSS attacks, awkward or inefficient to maintain due to poor design, or unable to take advantage of useful features added to the language, sure.

In many cases, code that was running well in PHP 4, would still run well on PHP 5, except that it would probably throw many deprecated syntax notices that only seems to make it look like the code was wrong, despite there was nothing wrong about it.

Except there was something wrong with it: its features were deprecated. The exact why varies with feature to feature, but the bottom line is, these features are no longer desired in PHP and will be removed in the future without notice, or in general, however it used to work was wrong or bad or we just felt like changing it.


Simply put the core group is driven by consensus. There is no BDFL. Decisions are made by vote, generally based on RFCs and patches submitted to the group and stored on the wiki. Zend, “the PHP company”, has no special say in the direction of PHP (although Zeev and Andi have commit karma, as do several people who work for Zend in some capacity).

It is said that you can’t participate in Internals unless your shit-slinging arm is strong. This is true. It’s a blessing and a curse, like most open source communities. Discussions can get hot-headed and end up so far afield of what’s being discussed, the entire point is lost and it’s highly unlikely the feature/bug/whatever will get the attention it otherwise might merit. On the plus side, these arguments can sometimes produce a lot of interesting debate and thought about how people actually use software in the real world. One of the merits of PHP is it’s not driven by an academic’s desire for “purity” or a company’s desire to meet a checklist of features for sales sheets.

Yes, namespaces arrived way too late and closures are a half-ass implementation, but it more-or-less works as well as most other stuff out there, when used in a safe and sane manner.


So these features, marked as deprecated, somehow survived the shit-storm that is internals. Agree or disagree, the community came to a consensus: something is wrong, and here’s how we’re going to change it. They produced good enough code with few enough bugs, and it made it in.

The author then goes wildly off the rails:

PHP core developers wanted everybody to replace var class variable declarations with public declarations. You may ask: what was the point of that? In my opinion, none.

You’re high as a kite. Have an argument about the usefulness of visibility in methods and properties, but that’s the point.

The author then goes on to ramble about property visibility, and throws in one of my FAVORITE bugaboos from Internals:

It introduced theprivate and protected declarations, so the old var declarations should be replaced withpublic to be more consistent. Be more consistent with what? Java, I suppose. But PHP is not Java.

(Emphasis mine).

If I was in the mood to enter an Internals-like shit-slinging contest, I’d say something along the lines of, “Oh, blow it out your ass, I can name half a dozen OO languages with property and method visibility, you’re picking on Java because Java scares the peons”. Or something like that. Then I’d get banned from Internals for being a dick.

I don’t know why people on Internals (and elsewhere in the PHP community) through around Java as a hand grenade. Java has its problems – oh boy does Java have its problems – but, like PHP, the language, class libraries, the JVM, all that falls under the Java moniker, works well in lots of different ways to solve lots of different problems.

And to me, PHP is really a scripty, slightly insane servlet platform. The two share a lot of similarities, more than a lot of people are comfortable admitting.

Moving on:

So, is this PHP mysql extension deprecation really necessary. I don’t think so, but that is just my opinion. At most it will avoid the need to maintain the documentation of multiple extensions to access MySQL databases.

Yes, it has nothing to do with weaning a generation of fragile brains off the idea of

select * from foo where id=$_GET['thingee']

and using prepared statements (standard in PDO). Nope, none at all.

But wait, there’s more!

So, for the PHP developers that have old code to access MySQL databases this idea will not be beneficial at all. Once the deprecation becomes official, it will start annoying PHP developers that do not want to waste time rewriting code that always worked for many years.

It took me perhaps an hour in BBEdit to upgrade our old-ass PHP4 app to use MySQLi. PDO might take a little longer. In other words, cry me a fucking river.

So I am afraid the first PHP version that introduces this deprecation will suffer from the same adoption delay problems as PHP 5.

What, “OH NOES, I might have to change something!”?

PROTIP: using the fine PHPUnit code lets you test things. It’s really cool. But then again, it uses those scary objects and it’s strongly influenced by Java and its unit-testing practices, and as you said, PHP is not Java. So I guess good unit tests are a bad idea for PHP, too? Not using unit tests in my shop is a great way to get your ass fired.

I believe that conservatism with respect to software platforms is always a good, default stance. Don’t make changes for the changes sake, or because something happened to be fashionable enough to end up on Reddit and Hacker News. But this is a forward-thinking business and our job is to invent the future.

And for FUD’s/fuck’s sake, this discussion is not even about ending PHP’s support for MySQL as some people seem to think. We’re talking about ending the PHP4-era MySQL code in favor of the code the community has reached a consensus about as betterfasterstronger.

Engineer the future now. Yesterday’s for mice and gods. Knock it off with the BC holy writ. Get over it, PHP4 sucked.