Friday 30 November 2012

Stack Overflow is populated by @rseholes (#1 of what could end up being a series...)

G'day

RANT ALERT! (and language some people will find unpleasant).
Since I started this blog, I've had a link over on the right-hand side of the page encouraging people to help out other ColdFusion developers on the ColdFusion channel on Stack Overflow (and on the Adobe ColdFusion forums). I stand by my sentiment that it's important to help people, but I've about had a gutsful of Stack Overflow. Not the concept - it's admirable - but the "gimme-a-little-power-and-I-become-a-nazi" fvckwits who try to find meaning in their pathetic little lives by demonstrating how they have a tiny tiny tiny amount of authority over other people, and by god, they will exercise it.


Overnight (for me, anyhow), someone posted a question there asking for some help converting some PHP code to CFML.  Fair enough.  However some nazis at Stack Overflow have closed the question due to it being:
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form.

Stop Press
I obviously rattled the right cages, because the ticket has been reopened. I recommend reading the comments both on this blog article as well as the ones on the question on Stack Overflow.  I'd like to thank some cooler heads at Stack Overflow for seeing reason (or my version of it!) in this matter. And cheers to everyone that has put their oar in here too.  I've got a coupla comments to respond to, which I'll get on to later this evening.  I think this is a win for "helping people".

I'm sorry, but if you find the question to be the case, you're a muppet.  The intent of the question is very very clear. It's not vague, it's not incomplete, it's not overly broad, and it's not rhetorical.  It is none of those things.  Well here's the question in full, and you can decide for yourself:

This is the current PHP, not sure how to begin to convert to Coldfusion. I need to post this on my coldfusion server.


<?php
/**
 * Saves POST input as an XML file and returns a JSON response
 */

$xmlString;

if (isset($_POST['xmlString'])){
$filename  = $_POST['xmlFilename'];
$xmlString = stripslashes($_POST['xmlString']);

$newFile = "_data/".$filename.".edit.xml";

//write new data to the file, along with the old data 
$handle = fopen("../".$newFile, "w"); 
if (fwrite($handle, $xmlString) === false) { 
    echo "{error:\"Couldn't write to file.\"}";  
} 
else {
    //echo "{filename:\"".$newFile."\"}";
    echo "success:::$newFile:::$xmlString";
}
    fclose($handle);    
}
?>
So, let's revisit the grounds for closing this question:

It's difficult to tell what's being asked here

No, it's really not. The guy wants help converting PHP to CFML. It's really clear.

This question is ambiguous

That's tautological given the previous point. And it's still inaccurate.

Vague

It's not vague at all. It asks a simple, clear question, and provides all the info necessary to answer it.

Incomplete

Well I think that's up to the person asking the question. As far as I can tell, it's complete.

Overly broad

This is just a stupid assertion in the context.

Rhetorical

Well it's not.

Cannot be reasonably answered in its current form

Of course it  can be, as I am going to go on to demonstrate (to the best of my PHP and googling ability).

Now I know those criteria are all just part of a boilerplate response, but given not a single one of them is accurate, applying the boilerplate is even more stupid. If like a majority of them were correct, then fair enough to close the ticket with that boilerplate, but not one of them is accurate.

I despair for people who prefer wielding this sort of "power" (guys, it's really not a power: it is no achievement to acquire sufficient "points" on Stack Overflow to have the ability to close tickets) than just helping out.  But do you know what? I think none of these people who voted for closure actually were capable of helping, because as far as I can tell, none of them know ColdFusion. I had a superficial glance at their profiles, and ColdFusion is not "above the fold" on their list of tags they have "participation" in. This means they don't actually even have the qualifications to decide if the question is a reasonable one or not.  What a bunch of sad losers.



Anyway, I'm going to try to answer the guy's question to the best of my ability. I don't know PHP very well, but I can infer stuff and I can google stuff. If I get stuff wrong, can you please correct me.

  • I'm guessing isset() is the same as structKeyExists();
  • $_POST variables are the same as FORM-scoped variables;
  • stripshashes() unescapes the backslashes that escape quotes within a string;
  • . (dot) is the string-concatenation operator, like & in CFML;
  • fopen() opens a file, and the "w" argument opens it for writing. So like the equivalent usage of fileOpen() in CFML.
  • fwrite() writes to said file.
  • === false bit checks to see if there was a file-write error, which has no direct equivalent in, CFML, so I guess the analogy would be to put a try/catch around the file ops (which one should always do anyhow).
  • echo() is the equivalent of writeOutput() (or just <cfoutput>);
  • fclose() is the same as fileClose().
That's about it: I think the rest of it is self-explanatory. I don't think it is helpful to give the person the actual code, but if someone wants to do a conversion and flick it to me, I'll add it in.

One thing I will say is that it was pretty easy to (correctly ~) guess all this stuff, or google it.  I just googled "php fopen", "php dot operator" etc (mostly to just get the link to the docs). So the original person could have helped themselves there.

But they took the time to ask the question, so wouldn't it be nice if we could just help these people out, rather than simply slam the door in their faces.

Hopefully the person posting the question isn't just frightened away from Stack Overflow now, but I would not blame them if they were. And I hope they see this answer.

And I feel really sorry for those types of people who would rather assert their "power" on Stack Overflow rather than just help.

... actually no I don't. They're just twats.

Righto.

--
Adam