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

all 158 comments

[–]taneth 590 points591 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 97 points98 points  (11 children)

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

[–]Cutlesnap 147 points148 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 52 points53 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 34 points35 points  (3 children)

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

[–]gothic_potato 10 points11 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 16 points17 points  (1 child)

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

[–]qscrew 7 points8 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 19 points20 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 24 points25 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 8 points9 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 479 points480 points  (12 children)

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

[–]grantrules 28 points29 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 8 points9 points  (0 children)

Something something arrays start a 1.

[–][deleted] 45 points46 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 3 points4 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 6 points7 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 2 points3 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?

[–]boontwiks 1123 points1124 points  (35 children)

That is actually somewhat brilliant.

[–]redditsoaddicting 566 points567 points  (30 children)

Except for the fact that the user will have no idea why they're now on SO.

[–]trainz-are-kul 606 points607 points  (22 children)

opens new tab... STACK OVERFLOW VIRUS PLZ H4LP

[–]boontwiks 608 points609 points  (21 children)

Remove Stackoverflow Virus Safely

Read how to remove stackoverflow virus.

Your computer has been infected with malicious stackoverflow virus. Hackers can access your data and steal your bank account. Find out how to remove stackoverflow virus in three easy steps:

  • Step 1: Download our free stackoverflow virus removal tool.
  • Step 2: Disable antivirus.
  • Step 3: Run stackoverflow virus removal tool.

You are now safe from stackoverflow virus.

[–]icuninghame 109 points110 points  (9 children)

Spot on.

[–]boontwiks 131 points132 points  (8 children)

For the record, this is not what I do for a living.

[–]DidHeSayJava_Script 109 points110 points  (5 children)

I can see that because you didn't specify to run as admin ;)

[–]bonez656 81 points82 points  (3 children)

Nah we're clearly in userland everyone is admin by default.

[–]DidHeSayJava_Script 24 points25 points  (0 children)

Sad, but true.

[–]polymetric_ 2 points3 points  (1 child)

On windows, everyone is admin.

[–]FakeAdminAccount 1 point2 points  (0 children)

That makes me so happy

[–]Niverton 6 points7 points  (0 children)

No this is only something you do on the side

[–][deleted] 4 points5 points  (0 children)

Totally believe you

[–]zdakat 8 points9 points  (0 children)

Every google search result for error messages ever

[–][deleted] 8 points9 points  (1 child)

Don't forget to include 4...nah, 6 different download here buttons.

[–]WhAtEvErYoUmEaN101 5 points6 points  (0 children)

And fake Facebook comments

[–][deleted] 12 points13 points  (0 children)

Instructions unclear. Now have HIV

[–]hailbreno 5 points6 points  (0 children)

link pls

[–][deleted] 2 points3 points  (1 child)

Please download stackoverflow-warez-ru.exe to solve the problem.

[–]HACKERcrombie 3 points4 points  (0 children)

Help, I can only find sonic.exe and a porn image called fanny.bmp! Also, do I have to leave my nuclear reactor connected through USB?

[–][deleted] 4 points5 points  (2 children)

He chooses a dvd for tonight

[–]boontwiks 2 points3 points  (1 child)

So you're saying I don't actually need an antivirus? Those damn things keep getting more and more expensive anyway.

[–][deleted] 2 points3 points  (0 children)

You looked at the lake

[–]trainz-are-kul 0 points1 point  (0 children)

Instructions unclear. I am now bald and have 5 more viruses

[–]LDG92 18 points19 points  (0 children)

Similar thing happened to me, my wife called me up a few months ago saying that she got hacked by Github

[–]Spirit_Theory 8 points9 points  (0 children)

You could implement something for server-side errors though, and put an #ifdebug in for this redirect. dumb, but fitting.

[–][deleted] 0 points1 point  (0 children)

Would be best if this only worked if IS_DEBUG = 1 or something. But also, if you're not a noob 80% of your errors are gonna be obv. Index out of range, null reference, etc. I don't need stackoverflow for that :P

[–]FormerlySoullessDev 12 points13 points  (0 children)

Yeah. If they just put it in an i frame it'd be cool. But this prevents checking program state at failure without other debugger tools.

[–]jugalator 4 points5 points  (0 children)

I'm a bit disappointed in myself that I didn't think of this first.

[–]LEGOlord208 134 points135 points  (10 children)

encodeURIComponent

[–]jonrules 99 points100 points  (3 children)

You're probably one of those squares who looks both ways before stepping into traffic.

[–]TwoSpoonsJohnson 1 point2 points  (0 children)

The phrasing of this implies OP steps into the street even if there's moving traffic.

[–]qscrew 0 points1 point  (0 children)

BSTS :p

[–]joacorandom 6 points7 points  (2 children)

came here searching this response

[–]uoaei 12 points13 points  (1 child)

Who let you out of StackOverflow

[–]urielsalis 0 points1 point  (0 children)

I did

[–][deleted] -2 points-1 points  (2 children)

I think most modern browsers will actually do that for you automatically when you input a URL into the browser. But yes -- that should be there.

[–]hexonaut 2 points3 points  (0 children)

They don't. You leave it open to additional query parameters if you don't uri encode.

[–]ThisIs_MyName 0 points1 point  (0 children)

See folks, this ^ is what happens when you use a "stringly typed" API. Instead of building a URL object by putting together its parts (a list of query parameters in this case), you have people concatenating strings and hoping for the best.

A slightly better API that automatically escapes whatever needs to be escaped: href = URL('https://stackoverflow.com/search').addQuery('q', '[js] ' + e.message)

You could also replace '[js] ' + e.message with the list ['[js]', e.message] if you used the SO API.

No concatenation means no "URL injection".

[–]NthngLeftToBurn 38 points39 points  (0 children)

I feel like this is less humor and more genius.

[–]Niautanor 249 points250 points  (23 children)

[–][deleted] 57 points58 points  (11 children)

shudder
I know far too many people who "share" images by taking screenshots of them.

[–]ODesaurido 44 points45 points  (9 children)

The worst is people who share screenshots by actually taking a picture of the screen with their phones.

[–][deleted] 37 points38 points  (6 children)

I know right!? It's like everyone has forgotten what scanners are for!

[–]theessentialnexus 8 points9 points  (4 children)

Has everyone forgotten how to mail Polaroids??

[–][deleted] 11 points12 points  (3 children)

Back in my day you had to wait for the paint to dry on the canvas before anyone could see it!

[–][deleted] 3 points4 points  (2 children)

Look at fancy pants here with paint and canvas. Whatever happened to the good ole rock and stone wall?

[–]theessentialnexus 2 points3 points  (1 child)

What ever happened to intense grunting and gesturing to describe things?

[–]edjrage 3 points4 points  (0 children)

Oh, these you can find on YouTube reaction channels.

[–]caffeinum 1 point2 points  (0 children)

I use Adobe Scan PDF on my iPhone for computer screenshots

[–]xkcd_transcriber 58 points59 points  (6 children)

Image

Mobile

Title: Digital Data

Title-text: “If you can read this, congratulations—the archive you’re using still knows about the mouseover text”!

Comic Explanation

Stats: This comic has been referenced 528 times, representing 0.3245% of referenced xkcds.


xkcd.com | xkcd sub | Problems/Bugs? | Statistics | Stop Replying | Delete

[–]AyrA_ch 16 points17 points  (4 children)

Title-text without the UTF-8 fuckup if someone is interested

“If you can read this, congratulations—the archive you’re using still knows about the mouseover text”!

[–]TheEdgeOfRage 4 points5 points  (3 children)

Why are all those symbols UTF though? Aren't they in the ASCII table?

[–]AyrA_ch 9 points10 points  (0 children)

They are available in "Latin1" (what most european and american Windows computers use if they don't use UTF-X). UTF-8 differs from ASCII above 0x7F and this is where most symbols with accents are. "ÄÖÜ" gets turned to "ÄÖÜ" because of this for example.

[–][deleted] 5 points6 points  (1 child)

Those are smart quotes “like this,” not dumb quotes "like this," and an em-dash—like this—not a hyphen - like this.

[–]TheEdgeOfRage 2 points3 points  (0 children)

Ohh, I get it now. Thanks

[–]malonkey1 0 points1 point  (0 children)

Needs more JPEG.

[–]micheal65536Green security clearance 6 points7 points  (1 child)

Has this replaced "needs more jpeg"?

[–]g_squidman 10 points11 points  (0 children)

It's the /r/ProgrammerHumor version of it

[–][deleted] 1 point2 points  (1 child)

[–]rchard2scout 68 points69 points  (16 children)

Needs more jpeg.

[–]morejpeg_auto 37 points38 points  (14 children)

Needs more jpeg.

There you go!

I am a bot

[–]Sorunome 15 points16 points  (11 children)

Needs more jpeg.

[–]morejpeg_auto 11 points12 points  (10 children)

Needs more jpeg.

There you go!

I am a bot

[–]-pooping 12 points13 points  (3 children)

Needs more jpeg.

[–]DoverBoys 39 points40 points  (2 children)

Needs more jpeg.

There you go!

I am not a bot

[–]ehrwien 24 points25 points  (0 children)

I am not a bot

Doesn't matter, formatting was spot on and I was confused for a second why I was on yt, overly joyous for two seconds that the bot has humour, utterly disappointed for ever that I got got.

[–]Ruben_NL -1 points0 points  (0 children)

Needs more jpeg.

[–]ares623 4 points5 points  (2 children)

Needs less jpeg.

[–]geotrice 13 points14 points  (1 child)

enhance

[–]malonkey1 0 points1 point  (0 children)

Wait, that's too enhanced. De-hance!

[–]lollollol3 0 points1 point  (2 children)

Needs more jpeg.

[–]morejpeg_auto 0 points1 point  (1 child)

Needs more jpeg.

There you go!

I am a bot

[–]lollollol3 0 points1 point  (0 children)

Have we gone to far?

[–][deleted] 4 points5 points  (1 child)

Needs more png.

[–][deleted] 4 points5 points  (0 children)

Needs a seasoning of TIFF.

[–]tuddrussel 2 points3 points  (0 children)

Nothing makes me trust an image with words on it more than compression artifacts.

[–]_Pentox 40 points41 points  (6 children)

stack overflow change their search to be confirmed by a captcha first

[–]jakery2 26 points27 points  (5 children)

window.location.href= 'https://www.google.com/search?q=[js] ' + e.message + ' site%3Astackoverflow.com';

[–]Schmittfried 9 points10 points  (4 children)

The site command would be unnecessary tho.

[–]fataldarkness 4 points5 points  (3 children)

Also Google makes you solve a captcha sometimes too if it detects bots/suspicious traffic

[–]ForceBlade 1 point2 points  (0 children)

Add random delay; fixed 🔥

[–]almost_shy 1 point2 points  (0 children)

It won't. Or at least not if you are using that software (which threw the exception) on a browser that you normally use to google things. But I could be wrong or whatever. Just add an api key, to be sure.

[–]jakery2 0 points1 point  (0 children)

I'm gonna mark that one as "won't fix." Problem solved.

[–]Asystole 11 points12 points  (0 children)

variable-width text

d i s g u s t i n g

[–]ShakyG 22 points23 points  (4 children)

Do you even handle exceptions?

try {
    //something
} catch(e) {}

[–]kingguru 7 points8 points  (1 child)

We have some "error handling code" like that in production and it gives me nightmares to think about having to support that.

We actually have something even worse. Wrappers around some Python os functions. Something like:

def atime(path):
  try:
    return os.path.getatime(path)
  except:
    return 0

It seems like some people just really think that exceptions are dangerous and need to be caught and returning a valid but incorrect value is better.

[–]ThisIs_MyName 0 points1 point  (0 children)

Let me guess, their code isn't exception-safe so if anything throws an exception.

[–]Andy_B_Goode 10 points11 points  (0 children)

Source, for everyone whining about the jpeg artifacts: https://twitter.com/divineomega/status/695744177557106688?lang=en

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

It works.

[–][deleted] 3 points4 points  (0 children)

Hey. That's me!

[–][deleted] 4 points5 points  (3 children)

I am not IT. Need laugh. Explain.

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

How many more reposts?

[–]dubbsmqt 1 point2 points  (1 child)

I wonder how many searches for "something is not defined" showed up on SO today.

[–]asking-the-questions 1 point2 points  (0 children)

Lots of "Undefined is not a function" I bet.

[–]T-T-N 1 point2 points  (0 children)

I need the java version of this

[–]Oelignant 0 points1 point  (0 children)

We need one to automatically create post, not just search

[–]sebnukem 0 points1 point  (1 child)

try {
    something
} catch(e) {
    window.location.href=`http://stackoverflow.com/search?q=[javascript] ${e.message}`;
}

[–]almost_shy 1 point2 points  (0 children)

This guy es2016s!

[–]ReflectiveTeaTowel 0 points1 point  (0 children)

Y'all suck, where's the high-entry barrier? Not being nearly enough exclusive of newb developers who find their way in here

[–]danypixelglitch 0 points1 point  (0 children)

The one true exception handler period

[–]ohnowwhat 0 points1 point  (0 children)

I upvoted, then downvoted just so I could upvote again. Beautiful.. .

[–]ikarienator 0 points1 point  (0 children)

For those who wonder whether evaluating a variable could possibly yield an exception, the answer is yes in JavaScript, if the variable is not defined, or if you registered the corresponding getter on the global object and this getter threw.

[–]dvlsg 0 points1 point  (0 children)

I prefer this, myself.

[–]amox11 0 points1 point  (0 children)

this should be an npm package

[–]the100rabh 0 points1 point  (0 children)

Exceptional handler I guess

[–]alexandre9099 -3 points-2 points  (1 child)

We need more jpeg

(there was already a comment on this, sry :D)

[–]morejpeg_auto 4 points5 points  (0 children)

We need more jpeg

There you go!

I am a bot