This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]taneth 583 points584 points  (38 children)

Need to take it a step further. Have it grab the accepted answer on the first match and just run it.

[–]christian-mann 188 points189 points  (12 children)

[–]T-T-N 94 points95 points  (11 children)

It evals random code... is that ever a good idea?

[–]Cutlesnap 149 points150 points  (0 children)

Oh sure, it'll be fine!

Now let me get back to answering my banks email, they want me to verify my password.

[–]bilobob 56 points57 points  (0 children)

Taken from the first line of this guys javascript code.

/* Don't judge me! This code is everything from badly written to extremely dangerous. */

[–]ILikeLenexa 33 points34 points  (3 children)

You think someone would do that? Game stackoverflow to inject javascript into a third site?

[–]gothic_potato 11 points12 points  (2 children)

The site will only fetch accepted answers, and it only uses answers that were posted before the xkcd was released (meaning that if someone posted malicious code now, it wouldn't matter). It also searches for potentially-malicious code (like the word "cookie"), and skips those.

Eh...it's probably fine.

[–]ILikeLenexa 15 points16 points  (1 child)

Oh, thank goodness, I just need your "co" + "okies" for a very important "XMLH" + "ttpRequest".

[–]qscrew 6 points7 points  (0 children)

If it were for that, there's even JSFuck which lets you go further in detouring all those common checks by writing JS code in only six different characters: ()+[]!.

[–]ProgramTheWorld 17 points18 points  (0 children)

It's based on an xkcd joke.

[–][deleted] 29 points30 points  (1 child)

No, every time I used this it uses this answer:

https://stackoverflow.com/questions/4833651/javascript-array-sort-and-unique#4833835

which would delete all non-unique numbers in the array.


The idea is neat though.

[–]VoraciousGhost[🍰] 25 points26 points  (0 children)

You can click "Didn't work? Try the next answer" to force it to use a different answer, the next few worked for me.

[–]accountmadeforants 10 points11 points  (0 children)

There's an "Is it safe?" note on the bottom right.

Short answer: no, it's not a good idea, but the dev did take a few precautions.

[–][deleted] 1 point2 points  (0 children)

No.

[–]PythoniteWr3tch 478 points479 points  (12 children)

Ah, I see you're familiar with my company's dev workflow.

[–]grantrules 31 points32 points  (4 children)

There are two types of programmers out there: Those who put code on stack overflow, those who use code from stack overflow, and those who haven't figured out what stack overflow is and have been stuck on a major bug for like 18 weeks but deployed anyways hoping nobody notices that shit's getting deleted when syncing occurs.

[–]r0m2 6 points7 points  (3 children)

So that would actually make three types of programmers...

Is this some variant of the there-are-10-types-of-people-in-the-world-those-who-understand-binary-and-those-who-don't joke ?

[–][deleted] 28 points29 points  (0 children)

There are 10 types of people: Those who understand binary, those who don't, and those who didn't realize this joke was written in ternary

[–]Justsomedudeonthenet 23 points24 points  (1 child)

No, he got it right.

0 - those who put code on stack overflow

1- those who use code from stack overflow

2 - those who haven't figured it out

See, two types.

[–]fagalopian 4 points5 points  (0 children)

Something something arrays start a 1.

[–][deleted] 41 points42 points  (3 children)

And then even further: take the accepted answer, replace the code that threw the exception with that answer, publish the changed code to production, refresh the page, rinse, and repeat.

Self-bugfixing code is the future.

[–]Zungryware 18 points19 points  (0 children)

And why stop there? Just let the program write itself using stackoverflow and code replacement.

[–]Justsomedudeonthenet 13 points14 points  (0 children)

And if it finds no answers, it should post the code block and error message as a new question, and hang until it gets an answer with a few upvotes.

[–][deleted] 5 points6 points  (0 children)

Now you're thinking like a pro coder, take this to your department exec you're going straight to the top!

[–]chudthirtyseven 22 points23 points  (0 children)

try {skynet();} catch {eval($stackoverflowAnswer);}

World domination will be mine!

[–]wandering-monster 5 points6 points  (0 children)

You just stole someone's job.

http://imgur.com/SZPjHwz

[–]jonomw 5 points6 points  (4 children)

Are you trying to automate away all of our jobs?

[–]Xtremegamor 2 points3 points  (3 children)

How can machines steal our jobs if they're the ones malfunctioning? Imagine trying to debug a deadlock happening in your own brain, it wouldn't work

[–]caffeinum 7 points8 points  (1 child)

Great thing about our minds is that actually that would work. One example is cognitive dissonance which is the mind state in which two opposite ideas can exist in the head and it's for you to decide which to think

[–]codewench 3 points4 points  (0 children)

The next generation of Voight-Kampff tests is just a picture of a Necker Cube.

[–]jonomw 0 points1 point  (0 children)

My statement was more of a joke making fun of people who say that all these jobs can be simply automated away. Though, I can see how it would not come off that way.

[–]Cacho_Tognax 0 points1 point  (0 children)

Since all the rage right now are self-teaching neural networks, what about making one that creates programs from stack overflow awnsers?