330
votes

Have a look at this Meta post for the current status of your swag!


It's easy to look at numbers; numbers tell us that many developers have been helped by what we built. That alone is very warming and makes us feel exceptionally great about what we're doing, wouldn't it be nice to take a little time on a Friday to share some stories that the numbers can't convey?

As I mentioned here, we're going to be running some special events here on Meta to celebrate hitting 10 million questions and reflect a bit on everything we've done together; this is the first of those events.

Your mission, if you choose to accept it, is to regale us with a tale of a Stack Overflow user going way above and beyond the call of duty in order to actually teach something to someone that wanted to learn, and anyone else that desired the knowledge going forward.

This could be written from several perspectives:

  • You just happened to be around when the answer was posted, and saw them continuously expand their answer to teach the subject more effectively.

  • You wrote one of these kinds of answers - don't be shy to share your own awesomeness. Talk about the experience a little, how did you feel when the person eventually 'got it'?

  • You asked a question and someone provided an answer that gave you more than some stuff you could try in your editor, they gave you the knowledge you needed to figure it out properly for yourself.

Examples of this don't need to be nearly as epic as explaining branch prediction like a boss - it could be as simple as an answer where someone finally grasped how memory is addressed, or why a regular expression did what it was doing, or the like. Let's pick some of our 10 million moments that we're the fondest of, and allow others to share in them.

Can you get to the part about the swag, now?

Why yes. The good news is, this isn't a contest, everyone that shares something here will receive:

  • 1 Stack Overflow T shirt (Men's or Women's)
  • 1 Stack Overflow mug
  • 1 Stack Overflow padfolio and aluminum pen with the logo, and some extra pens
  • 1 Stack Overflow 'Koozie' (it keeps canned beverages frosty)
  • 5 Stack Overflow stickers

In addition to this, we will contact the author of the answer that you mention and offer them the following:

  • 1 Stack Overflow T-shirt (Men's or Women's)
  • 1 Stack Overflow Ruled Notebook (acid free, high-quality paper, I'm not mentioning any brands because we have several and it depends on availability)
  • An autographed copy of "Smart & Gets Things Done" by Joel Spolsky.

Rules:

  • Answers must be at least two paragraphs and link to the answer on the main site you're talking about. You need to tell the story, with as much detail as you can. Put emphasis on what was learned, why it can be hard to teach, how someone could possibly have so much patience, etc.

  • If you're the author of the answer, you get both prizes.

  • Submission deadline is September 4, 2015

  • Allow 6 - 8 weeks for delivery after the submission deadline

88
  • 36
    Actually, I need a coaster to go with my SO mug. Do you guys happen to have any of those?
    – BoltClock Mod
    Commented Aug 21, 2015 at 14:45
  • 31
    If "teach" becomes a trigger word on Stack Overflow, we're screwed.
    – user50049
    Commented Aug 21, 2015 at 14:57
  • 14
    Has Mystical gotten swag for the branch prediction answer yet?
    – durron597
    Commented Aug 21, 2015 at 18:06
  • 40
    billions of developers Wait, really? That means at least 13% of all the people in the world are developers who have been helped by Stack Overflow. That doesn't seem correct Commented Aug 24, 2015 at 1:51
  • 13
    What do downvotes in this thread actually mean? Lousy answer or lousy story about the answer?
    – PM 77-1
    Commented Aug 27, 2015 at 17:57
  • 35
    Sept 5: wheres my email to fill out the form and get my SWAG? Commented Sep 5, 2015 at 18:21
  • 27
    Am I the only one who came here several times after 4th of Sept ? Commented Sep 7, 2015 at 12:19
  • 20
    are we supposed to recieve a email? :,(
    – CptEric
    Commented Sep 8, 2015 at 17:49
  • 23
    I'll be contacting the initial round (folks that wrote something here) tomorrow, and then those that you've nominated through writing about them near the middle of the week. Hang tight!
    – user50049
    Commented Sep 13, 2015 at 14:27
  • 32
    Just askin: who all (did not) get a mail (yet)? 1. me. Commented Sep 15, 2015 at 17:32
  • 11
    A mail with a confirmation will be nice. The suspense is killing me.
    – Haris
    Commented Sep 17, 2015 at 0:45
  • 23
    Sorry about that, something exploded while I was sitting on it. Mail going out on 9/18 for everyone that answered here, and on 9/22 - 9/25 for mail going to the folks that wrote the awesome answers you linked (it's a more manual process, hence a few days to get it together).
    – user50049
    Commented Sep 17, 2015 at 15:39
  • 11
    Emails sent! If you feel like you should have gotten one but didn't, let me know (after checking your spam folders, and connecting your computers directly to your modems after turning them off and on again).
    – user50049
    Commented Sep 18, 2015 at 15:25
  • 14
    @Tim your "Instructions for the locationally challenged" have made my day better, hilarious.
    – CubeJockey
    Commented Sep 18, 2015 at 15:28
  • 13
    @TimPost Just a suggestion (not to be interpreted as a complaint), but perhaps it is a good idea to update this thread/question with the current state of things. Commented Nov 16, 2015 at 12:47

237 Answers 237

1 2
3
4 5
8
6
votes

The Question

Is there an actual example where inline is detrimental to the performance of a C program? by Viclib.

The Answer

https://stackoverflow.com/a/24453267/2615940 by Art.

The Story

The question itself is great because it is questioning the status quo. As technological innovators, we should always be asking ourselves, "Does this rule of thumb still apply?" When technology advances, so must our practices. Things have moved so quickly, that we still have people actively working in the industry that were around during the time of punchcards. On one hand, it's a good thing: our industry is full of great minds that have tremendous amounts of hard-earned lessons and experience. But it occasionally comes at the cost of innovation when out-of-date wisdom is applied unquestioningly.

As evidenced by the answer, the idea that inlining C functions can have a performance impact is still very much applicable. Art supported his answer with actual industry experience, citing a single commit he made 10 years ago that showed this particular bit of passed-down programmer wisdom to be true. Not only am I impressed that he could remember and find the commit (I can't remember commits from a week ago), it showed a concrete connection between what we do here and how it can have a real impact on others' work. My favorite questions are ones that ask "Why?", but they can occasionally be esoteric and disconnected from any real application. This question and answer is an excellent example of the very real implications of asking why something is the way it is.

6
votes

Are variables declared with let or const not hoisted in ES6?

This question was asked not that long ago, but I ran into this when experimenting with ES6. The question itself is a decent question, but the meat is really in the answer by @Bergi. This answer really goes above and beyond to explain what is happening, where other answers may have also answered the question, but not nearly as in-depth. This user always expends as much effort as necessary to answer the question as fully as possible.

I always enjoy reading posts by this user because, well... I always end up learning something new. Whether it is gaining a better understanding of something that I already knew of, or finding something I have never heard of before, it is always educational.

4
  • 1
    Wow, thanks! I nearly was thinking about nominating myself for one of these :-) I have not yet gotten to score a really popular (with hundreths of votes) answer, but I'm always trying to give people a detailed and deep understanding of the concept in question. I'm never sure whether I am not too technical, but apparently a few people like it ;-)
    – Bergi
    Commented Aug 22, 2015 at 22:48
  • 1
    Honestly, I love reading your answers, and when I see you commenting on a post, I'm always waiting for your next answer. You are a prime example of a user who goes above and beyond on a regular basis to make sure that not only will the OP understand the topic as much as possible, but to make sure that future users will as well.
    – user4639281
    Commented Aug 23, 2015 at 3:05
  • @Bergi I was just checking out this question in Data Explorer to see if the great users of [javascript] got nominated and I am pleased to see that you did :) (I ended up nominating Rob W for his great work in [google-chrome-extension], but you were a close second, and I'm delighted to see that you got one.)
    – apsillers
    Commented Sep 21, 2015 at 17:54
  • @apsillers: Thanks :-) Felix Kling, TJ Crowder, Zirak and Benjamin Gruenbaum got their share as well (Benjamin even twice :-D)
    – Bergi
    Commented Sep 21, 2015 at 18:09
6
votes

Object copied to second property via reference persists even after original property deleted?

I wrote this answer (sorry but no specific self promotion or anything :P) without really knowing what the answer is. I was forever confused about the following:

Everybody says that JavaScript has no references. We can still do this:
var el = document.getElementById(...);
el.style = ...;
// same call to document.getElementById returned the updated object
// is this some magic?!?

Strings are immutable in JavaScript!
var s = "foo";
s = "bar"; // isn't this mutation??

Although I had settled myself with thinking that "objects are just special", I never really understood what happens in reality.

Then that question appeared and I knew it was related. So I read the first answer to that question, and started experimenting in the console. Suddenly I got it. Yes ofcourse, variables are just placeholders for values! Then it hit me: "oh so this is what they mean by immutability!" And a lots of "aahs" and "oohs" followed. That 15 minutes of research cleared so much to me. Thanks a lot to the original asker of that question for making me do the research and not sit back with unsatisfied curiosity.

I thought I should put this as diagrams to hopefully help future visitors. That was my first answer which got 10+ votes, and is now at a 50+ score.

I have learned a lot from Stackoverflow, thanks guys!

6
votes

2 years back when I became active on this site it was impossible for me to write I instead of i in SO question as a young newbie but SO teach me to update myself according to industry standard. I have not been part of this for long. At the beginning when I started using SO and was just wandering here to there to gain something without even knowing that there was anything like reputation until I got the first green +5 on my first question. Can I install created Java program on My PC? which is quite a silly question but I got a very simple link which helped me to create a jar.

The Jon Skeet answer of What is the difference between a variable, object and a reference?

The most inspiring moment was above answer of Jon Skeet for me, where he was getting continuous up votes, and as a viewer I was just watching the vote counter. It's not all about up votes but the extraordinary explanation of the very simple question. For me he is a great teacher and inspiration.

Because he explained in the answer about the difference of variable, Object and reference and as an example he used paper.

Jon's answers are like suspense stories, every answer will reveal something unusual for you every time you read.

From that moment I dig into some(in hundreds) answers from Jon's profile and found a huge list which I have noted and spending time every day to read at least one of them. I must thank him for this and want to thank him for all mind blowing answers.


I felt good when I got a nice answer badge for the answer to the following question void… params meaning in java function declaration

This answer did not get immediate up votes but slowly it reached to 10 that made me firm believer of good, complete and perfect answer.

That moment was just a spark for my mind to collaborate in this very interesting platform where every single professional get in touch with newbie and even solve problems of newbie or even more answer Why? and How? to the question which are sometimes not readable, sometimes not formatted properly, but as an answering team they work in a way such that the OP can surely learn something no matter if his question is closed or marked as duplicated or off topic.

I have seen many conversations in the comment section which contains discussion of OP and other SO user about the closed off topic question. Where some user was still helping OP to solve problem in comments that was fantastic and example of good patience for me at least.


This is what I have learned from stackoverflow :

  • Answer accurately but instantly
  • Read and Write carefully
  • Support the best
  • Earn reputation with respect
  • Respect and accept the down vote
  • Google > Read Docs/Books > Try more > Debug > Try more > Try one more time > Ask on SO
  • Do not pay much attention to Jon Skeet's reputation it will demotivate you and on the next moment motivate you
  • Don't just blindly believe, prove
1
  • 2
    "Don't just blindly believe, prove". Yes yes. ++ Less magic. There is no magic, just someone else's code. I love this answer.
    – RubberDuck
    Commented Aug 22, 2015 at 10:54
6
votes

This is not my question - or answer - but I'm presenting it here because it is a special kind of questions.

Why does Gmail use eval?

As the title might suggest, it is one of the very hard to answer questions; to answer it you should at least have an insight into the code of gmail. When I first saw the question I thought that it was impossible to answer such question and that it will be closed in a while (I had no close reason in mind so I just waited). Several answers, back then, were very low quality including wild guesses and answers that do not directly relate to the problem (most of them are deleted now).

After a while, I was shocked that somebody was not only able to answer the question, but actually provided a very detailed and concise answer. The revision history shows how much effort he has done to search for the information.

This was one of the moment where I learned something; not just from the technical side but from many other sides as well. This is what makes StackOverflow different than many other sites and this is why I keep coming back!

6
votes

How I learned Android until become an expert

StackOverflow was (and is!) very important to me. StackOverflow not only help me in a lot of situations given me the correct answers to a crazy problems that make me more crazy, it tech me how to program in Android.

Five years ago I had the amazing luck to select an Android project in my first company. It wasn't very interesting but ey! is in Android and looks good! I haven't someone to tech me, the information in internet wasn't very good and I needed to learn! How can I learn Android!?!?! And the answer was StackOverflowI enter and start to read questions and answer and try to answer questions. Really I learned a lot only with this!

Years later I become an expert in Android. Well I am not the best one but I am working in one of the best and with more future startup here in Spain. And the best one, I have and answer with more than 150 upvotes :D :D :D

Question: How to use Holo.Light theme, and fall back to 'Light' on pre-honeycomb devices?
My Answer: Link

I really proud of that answer :)

Thanks StackOverflow!!

6
votes

How does it feel while answering(having a meagre 2k reputation at that time and being just passed junior year in my college) a question asked by a person holding more than 26k (worth of ~1600 answers in the same field Java) !

Talking about the feeling and the way I clarified OP's doubt...

Clarification of the fact

Question :- Different compilation error when final local variable is used with while loop

Answer :- It's somewhat peculiar to blow one's own trumpet, but this answer given by me raised my confidence to an unprecedented level. It might be a very ordinary answer for many, but, for me, it was only because of this answer which changed my thinking, my confidence, my feeling and an overall me. The OP took 2-3 days before accepting my answer.

Story :-

I was very careful while adding answers and always ensured that I answer only beginner level questions early in my days when I had joined SO (May-June 2014). I was pretty much excited to answer questions those days and used to stay online on SO for 10+ hours of a day, either learning(reading) or posting or asking(rare though). I also used to feel that I was late in joining SO and should have done in my freshman year in the college. But, It is never too late to change the way you think.

Then came this day after 4 months(~approximately) that I saw a question asked by user Braj, who was holding more than 26k at that time. I thoroughly went through his profile and my fear started haunting me before touching the keyboard. No one had even left any comment though there were probably 25-30 views at the time I saw the question(after 10 minutes of posting of the question).

Firstly, I did a careful analysis of what OP was facing. Then, it struck me that it was not so difficult problem and I should give it a try with a belief that I could, at any point of time, withdraw answering(discard my draft).

After a while I started writing an answer, there came an answer by an author with nearly similar reputation as mine. My nerves were wrenching at that point of time and my blood pressure was at the peak. As I was in the midway somewhere, I paused for a while, and took a deep breath.

I clicked on the 1 new answer to this question and without even reading that, I immediately checked the profile of the answerer. I might have even turned unconscious, but, anyhow held myself. Finally after checking answerer's profile, I took a deep breath. His answer prodded me into completing my answer.

The moment didn't end here. It took me some time to help OP understand what both of us had written. Other answerer wrote a short, but correct answer without any detailed explanation. I extended in my answer to cover every point in detail and added necessary quote(from Wikipedia) so that OP could understand significantly. I felt that If you could make a higher reputation person understand a good concept with a clear description and enough time, you are obviously having qualities of a great developer. Though OP took some time grasping it, but, after 2-3 days finally accepted my answer.

That very day pumped blood in my body with a new spirit, and this SO experience helped me acquire the much needed valour in this field.


Apart from this, I am very much thankful to Stack Overflow team and the noble developers present here who are contributing with their utmost dedication and helping people like me become an asset to the Earth. Thanks all for their presence here and "Hearty Congratulations" for crossing the milestone of 10m questions.

(Hailing from a non-native English speaking country, I might have not expressed certain words/phrases clearly. Please improve the answer wherever you feel it should. Thanks in Advance.)

6
votes

Canvas Rotating Star Field

I’ve only been an active part of the Stack Overflow community for about 2 months, so here is my favorite question from that time, which was answered eloquently and completely by @Kaganar with multiple code examples and live demos across multiple edits. His awesome answer is only sitting at +8 right now, and the thread only has 320 views, but hopefully posting here will get him some more of the attention he deserves.

The basic gist of the question is that @Alain-Jacomet-Forte was trying to create a 3D animated star field in JavaScript, and had a 2D version working, but was struggling with some of the math needed in order to get it to work. @Kaganar stepped in and wrote a complete working demo implementing the matrix math using an extra library. Then, he edited his answer to add another example with keyboard controls. The original poster @Alain-Jacomet-Forte then asked him a question in the comments about how he would go about doing 3D in general, and whether he would always recommend using matrices. @Kaganar stepped up again, editing a helpful and insightful 4-paragraph+ response to that question into his answer.

@Kaganar ended up not just providing code for the OP to use, but ended up using his answer to teach OP some of what he can expect when creating 3D effects in the browser. His answer went way above and beyond helping out the OP, not just providing a code dump but teaching him best practices for doing that sort of thing. This is why I wanted to share it!

Here is a gif of @Kaganar's answer - it's not as pretty as the actual demo (the gif is rather low framerate), but hopefully it will give you an idea of the neat answer that he posted:

enter image description here

Kudos to @Kaganar for the fantastic response. It makes me feel a bit bad that one of my 60-second answers where I point out that the HTML5 picture element exists has more upvotes than his multi-paragraph, multi-example response to this question (his answer probably took at least an hour to write, after all the edits.) Hopefully by linking his answer here some more people will visit his post, appreciate the awesomeness of his examples, give him some more well-deserved votes, and show him some more attention for his exceptional answer!

If Stack Overflow had a /r/bestof, I would definitely nominate @Kaganar’s post!

6
votes

I would like to share the history behind my answer to 'For' loop inconsistencies in R.

While I was digging through the doc as I'm not a expert there was three answer talking about operators precedence but none fixing or talking about the OP's problem.

So I took some time to write a complete answer with a quote and link from the documentation about operator precedence and a fixed version of the OP's code, there was some discussion in comments too which lead to improving the code.

6
votes

I'm an idiot

In June of 2013 I was a junior in College. It was the second year of programming for me and I was killing it. Good grades, smartest kid in class, and in an awesome internship. It was also about the time I started participating on Stack Overflow after being a passive observer for some time. Things, as usual, started out great; I had good questions and answers, was skyrocketing in rep, and was happy. And then it hit me. My first downvote.

It was pretty shocking to me. It was my first "failure". Someone down voted my answer? How could this be? I'm so smart! Turns out, not so much. It was the first in a long (and still ongoing) string of total failures that would teach me that most of the time I didn't have the best idea, and that the best ideas came from collaboration. Shortly thereafter I tried to build a regex engine from scratch in Java.... that didn't last long

Stack Overflow continues to teach me how I should always see whats out there before moving forward, because 99/100 times sometime has already done it, and done it better, or at least correctly :).

6
votes

By far, without a doubt, this is for me the best answer out there:

How do I use extern to share variables between source files in C?

(And the corresponding question)

Jonathan Leffler has the most extraordinary, in-depth, insightful answers about C that I've ever seen (not only C, but also bash, Linux/UNIX in general, sed, awk, perl, etc.).

I think this specific answer is outstanding and deserves to be mentioned here for several reasons:

  • He really did hit the high notes here. It definitely qualifies as going way above and beyond the call of duty in order to actually teach something to someone. The details outlined in the answer, combined with the level of knowledge and practical experience make it spectacular.
  • More than anything, even though it took me a while to fully understand it, this was the only answer that finally made me understand what tentative definitions in C are all about, how they compare with other (more idiomatic) methods to define and use global variables, and how we should structure the code to take advantage of this information. It's not just an answer about how to use extern to share variables; it's essentially a book that teaches a lot of important theory behind the use of global variables annotated with advice coming from an experienced and stellar programmer. FOR FREE!
  • The answer was improved over time, and several mechanisms are in place to make sure that the examples compile and work as expected. This was the first (and probably the last) time I saw someone using version control to keep the answer updated and compilable. See for yourself. Someone who goes through all that trouble and work to offer the community such a brilliant answer can only be obsessed with actually teaching and sharing knowledge rather than giving you some stuff to try in your editor.
  • Critics are always addressed and gracefully acknowledged. Comments such as this one or this one can easily be demotivating after the effort it took to elaborate this answer, but Jonathan always acknowledges and addresses issues kindly and thoroughly. In this particular example, it led him to add "checkpoints" throughout the answer to let beginners know when they should stop reading.

This is how I see StackOverflow: as a community of experts interacting with each other to generate the best content. We need more people like Jonathan. Over the course of time, I have learned so much with StackOverflow, and it has helped me so much, that I can only keep contributing to this great community, in the hope that some day my producer-to-consumer ratio approaches (or even goes beyond) 1.

Thank you StackOverflow!

6
votes

This answer really made me understand main the design principles of the go programming language, and the reasoning behind the changes. (something that I had never seen before). I had spent days trying to understand the language, and was close to giving up and returning to the pythonic realms I came from, when I got frustrated enough with panic that I wrote a question on SO and put my head in my hands, trying to calm down.

I didn't really expect a good answer, and I remember having a fight with people casting close votes (thinking that the question was subjective) when VonC stepped in and really turned the question around by writing a great answer. Instead of just pointing out that the language designers made it that way, he managed to dig up the fact that panic once took multiple arguments, as I thought it should do, and their reasoning behind changing it. Turns out, panic is a way more rare occurrence than an exception.

6
votes

I don't post a question unless I'm really stuck on something, and I remember one time I was. I had a test-suite running against an Angular app in Jasmine 1.3 but once I updated to 2.0 it started breaking.

I could not understand why.

I knew roughly what was going on based on the error message (the $digest cycle can be a fickle beast) but I was thrown off by the fact that things were going smoothly in the Jasmine 1.x async syntax. I was close to solving it by figuring out that I could use setTimeout to delay exiting the spec but remained confused since my assert passed.

My question remained unanswered for 2 months and I had almost forgotten about it untill someone else came across it and asked if I had figured it out. I had not.

The answerer dived into the depths of Angular determined to solve the problem (and unlike me obviously refused to accept the setTimeout fate) and the next day posted a well written and well researched answer.

It's always a good feeling when you get a notification on a months old post to get some feedback by another person who ran into your exact problem, and it's extra warm and fuzzy when they went to lengths to find a solution, and that solution in turn helped several other people, something that's evident from the comments on the answer itself.

So, yeah, thank you SO for being SO and thank you deitch for removing a massive code smell from my test-suite.

6
votes

Cluster analysis in R: determine the optimal number of clusters

The question was a fairly open-ended one, because there is no single definition for "optimal" number of clusters. Adding more clusters will continue to reduce the total within-cluster variance.

The answer provides eight distinct approaches, each complete with reproducible code blocks and graphics. It is without a doubt the most thoroughly documented and illustrated answer I have come across, and it was very useful to me in my work.

6
votes

The day I was blown away by an answerer's tenacity

With a single question and 192 answers, I'm far more used to helping others than being helped. However, my one question received a response that blew all of my own answers out of the water, and it is this that I'd like to put forward as an example of going beyond the call of duty.

Back in my second year of university, I was fiddling around with some more exotic joins in relational databases. I'd long found and digested the types of joins available, detailed by endless Venn diagrams and examples, however I was really struggling with this particular problem. As I was genuinely stumped and couldn't find any helpful material online, I thought it would be a good candidate for my first SO question.

Little did I realise, Sebastian Meine would step in with one of the most comprehensive answers I've ever seen on the site. I came back to find he'd put my example into SQL Fiddle, and provided a step-by-step guide to solving my problem, starting with a basic query and modifying it in stages it to come up with the finished solution, including the results produced at each step of the way. Not only this, but when I pointed out my table had no primary key, instead of giving up, Sebastian provided a second version of his answer for tables without one. He also pointed out pitfalls and provided further avenues to explore.

I was floored by the sheer willingness to help. Even when I threw him the primary key curved ball, he left his existing answer intact so others could also benefit. Sebastian doesn't know it, but he taught me that the reasoning is just as useful as the final answer. There is an important distinction between an explanation and a solution. I now spend much more time fleshing out my responses in the hope that others will benefit in the same way I did.

6
votes

vim, switching between files rapidly using vanilla Vim (no plugins)

I happened to see this come through, and, being a novice vim hater, decided to watch it for a while. When this answer came up, it converted me to vim - I'd tried it before but didn't like exiting it and running ls and then opening another file. This changed that.

Continuous editing? Check.

There isn't much in the way of questions from the OP, because the answer already answered them all. This comment pretty much sums it up:

This might be the single greatest answer ever. – Badger Apr 10 at 9:38

1
  • Points are pointless… this is why I'm on SO.
    – romainl
    Commented Mar 14, 2016 at 19:42
6
votes

When I finally understood that "Memoization" was not "Memorization" with a typo

I has been dabbling in Python for a few weeks when I decided to use it to solve a deceptively simple puzzle. A single word was hidden in a several thousand character long string. The puzzle writers provided the basic algorithm to extract the string as well as some samples with solutions for shorter strings, so I figured it would be a great problem to cut my teeth on. I would just implement their recursive algorithm, test it against the sample problems, then run it against the long string and call it a day, right? Not really, no.

It was easy enough (with some SO searches to resolve minor bugs, of course) to get my code to handle the smaller samples. I threw those into nosetests as a basic regression, then passed in the huge string. Nothing happened. My Python module was chugging along on its merry way, but I was getting no output. I killed the process, added some print() lines to see if anything was actually happening, and tried again. It seemed to be progressing, so I figured I would just give it more time. I removed the extra print() lines and left it running over lunch. I came back after lunch and it was still not done yet.

So I dove into Google and Stack Overflow, trying to find the root of my performance problems. Some blog posts advocated rewriting it in C. That seemed to be more trouble that it was worth, especially to solve this "simple" puzzle. I spent the rest of my afternoon applying small performance tweaks that I found here and there, none of them seemed to make much of a difference. I left it running on my work machine overnight, crossing my fingers that it might just need several more hours to finally finish.

But after getting home, I could not get this problem off my mind. I fired up my home machine and dove into it again. I used Valgrind for the very first time and identified that my program was spending the majority of its time in a single spot in the main recursive function. My online research kept telling me to "memoize it", but I had no idea what the hell they were talking about. I tried reading through several definitions and blog entries... none of it made sense.

Then I found this gem, jason's answer to "What is memoization and how can I use it in Python?".

It finally clicked. I applied it and the performance improved drastically. Another optimization and the puzzle was solved. But while I don't remember the puzzle that well, the knowledge of how memoization works and when memoization makes sense to apply has stuck with me, and I owe that to @jason's fabulous answer.

6
votes

That Breakthrough Moment

What does actual machine code look like at various points?

Some of my favourite moments come when I am able to describe a concept in a simple way that causes someone to think about it completely differently. I don't often explain a concept well, but every once in a while the pieces fall together in my head, and I can show someone how easily they really fit together.

This question is an example of that. As programmers, we're often reminded of a mysterious realm known as "machine code". Machine code is one of those concepts that is often explained half-heartedly, and it's hard to understand without actually having to learn basic proficiency in it.

The OP was clearly struggling with the concept of code that exists outside of a text editor. Luckily for me, this was one of those times where the question answered itself in my head, and all I had to do was write it down. When the OP realized that the answer was simpler than they had imagined, it cleared up all of those vague analogies and preconceived ideas. To quote the OP, it was "a revelation".

It's so gratifying to see that I am able to not only add to a person's knowledge, but to bring clarity to it as well. I've come to realize teaching knowledge is useless without structure and organization to that knowledge. In the words of Albert Einstein:

Any fool can know. The point is to understand.

And of course, when you see someone grasp a concept because of you, it's great to know that you yourself have mastered that concept.

If you can't explain it simply, you don't understand it well enough.

I gotta stop quoting Einstein, but he's hit the nail on the head. Again.


This was but one episode of my never-ending quest to destroy the evil monster Overthinking, and bring simplicity to the world.

6
votes

My story is about a little hidden corner of stackoverflow which can be found under the domain chat.stackoverflow.com. The PHP chat channel to be precise.

I was having serious issues juggling with IP addresses and subnets in PHP. I needed to know which IP address ranges could be added safely to a system without causing overlap, while taking subnets into consideration.

I was totally stumped on how to deal with this problem and had little clue on how to proceed, which eventually led me to post the question on stackoverflow here:

Testing if a network in cidr notation overlaps another network

The question remained open for a little while with little viewers and no answers and I was keen to proceed with my work, so I ended up dropping my question in the PHP Chat channel. (Not "just like that", mind. Be civil there, dont just drop questions because you want special attention)

The people in the PHP chat channel were exceptionaly helpful. They asked for the required details and this guy called DaveRandom ( Hi Dave! ) took it upon himself to provide me with an exceptional answer.

This specific answer is memorable to me, since it not only led to the solution of my problem, but it also taught me the simple fact that there is always new stuff to learn. The approach he took to solve the problem was well beyond my skill level at the time. No matter how much we know, there is always so much more to learn.

0
6
votes

"That ain't possible" is an answer as well.

(And the benefits of letting the problem rest for a while.)

Roughtly 4 years ago, I was determined to basically change how JavaScript's square brackets work.

This was back when I was still learning JS, and just trying out different little projects, like implementing a "doubly linked list", manually.

Whilst trying to figure out how to override something like this, I learned quite a bit about array manipulation, getters / setters, stuff like that. But those brackets kept bugging me.

Eventually (after biting into the issue for way too long), I came to the conclusion that it's simply not possible.

This applies to any programming issue:

What you want to do may actually be impossible.

If you can't come to a solution, do something else for a while. Work on a different part of your application, have a chat with your co-workers...

Basically, don't let tunnel vision get you. This is a problem I've ran into plenty of times: Some kind of feature is challenging to implement, so you start to focus on in, getting stuck on one problem after another just to get your new awesome thing to work.

However, you don't have to do it all yourself. There is no shame in asking (for example) co-workers or other students for help if you're stuck at a problem. What also helps is to simply do something else for a while. Eventually, you'll have an "epiphany". Even if the conclusion is that what you're trying to do simply can't work.


Another thing I love about SO is that the community keeps showing it's appreciation for your answers, long after you've last been active on them. A couple of my highest voted answers(123) still get votes every now and then, even though they may not bee "accepted", and the question's long dead (yet apparently, very much alive).

6
  • Someone had to propose a self-answered question :-) Commented Aug 25, 2015 at 15:41
  • I'm can't possibly be the first... Am I?
    – Cerbrus
    Commented Aug 25, 2015 at 15:42
  • Well, can't say I've read them all, but not noticed one. Since one swag goes to the question, and one to the answer, I think it's a cool move :-) Commented Aug 25, 2015 at 15:45
  • 1
    "I'm can't"... Geez, I can't believe I wrote that o.O
    – Cerbrus
    Commented Aug 26, 2015 at 5:48
  • 1
    @BillWoodger No swag goes to the question asker, unfortunately. Commented Aug 26, 2015 at 15:18
  • @KevinBrown I misread that. Thanks. I've had enough of Joel Spolsky's writing, here: stackoverflow.com/a/4342263/1927206. I asked him to remove his answer, and he suggested I do better. His non-answer and bad practice has outscored my answer 7:3 even since then :-) Commented Aug 26, 2015 at 15:41
6
votes

My little story didn't get much attention; it's a small nitpick that a single developer had with his editor geany.

This little bug was weird; nothing could help on Google. So I went onto a quest to the dark side of the internet: IRC. This is where I could find the developers of geany. Oh joy! They were delightfully helpful. They quickly gave me a possible solution. However, this solution didn't work, because geany had a bug. OP found a bug in a wildly used and battle-tested editor. Damnit!

After some grepping through the source, the exact cause of the bug was found, and an issue was opened on the issue tracker of geany. A workaround was quickly found, and the bug turned out to be not such a bug. But it's still a bug. Weird software standards and the likes.

This little story still taught me several things:

  • The POSIX standard actually defines grep options! And GNU grep/BSD grep don't have the same options. Better use grep --version next time I get a hop onto a new computer.
  • Open source communities are awesome.
  • Open source code means that we could find the bug, find its cause, and find a fix. We could've fixed it too! but the workaround was good enough
  • StackOverflow makes it possible to unite developers of all kinds around the world.

PS: link to answer, in case that wasn't clear: https://stackoverflow.com/a/29033957/851498

6
votes

Curiosity makes the best questions and answers.

Most SO questions are about code that doesn't work. Standard answers get into explaining why it doesn't work, and how the best solution(s) looks like.

Yet when you are asking about code that works but uses concepts or techniques which you don't understand, that often makes an outstanding stellar question. And
How does Bluebird's util.toFastProperties function make an object's properties “fast”?
is definitely one of those, showing genuine curiosity about this obscure piece of code.

But the really cool thing that the answer is very much in the same spirit. Benjamin Gruenbaum went far beyond a simple answer that could have stated the reason for the performance improvement in a single paragraph. But no, instead he did give us an informative explanation of the difference between dictionary and fast mode, with tons of links that detail the subject even further. He goes on to explain the code line by line.
And then, he shows the same curiosity that the asker exhibited:

[…] shows us that this optimization indeed works in v8. However - it would be nice to see how.

As he says, we have walked the path from the code Petka wrote to the bare metal - wich was very nice indeed!

In the end, he does not forget to put up the obligatory warning against premature optimisation. Could we expect anything more from this answer? I say no.


Unfortunately, this meta post asks us only to tell a single story. There would be many others we could tell about Benjamin. His dedication to the tag has earned him the first gold badge in that tag. He goes beyond only answering questions quickly and accurately, he does create canonical questions such as How do I convert an existing callback API to promises? or What is the explicit promise construction antipattern and how do I avoid it? and does not forget to answer them in detail. Apparently I'm not bad at this myself, but he still constantly most often outscores me. He totally deserves this swag!

6
votes

A long time ago, before I even had an account on Stack Overflow I was looking for help for a Java problem I've had. So the first result on Google was, obviously, Stack Overflow. So I've checked the answer and saw, that it's possible to upvote an answer. Curious about what the highest voted answers in the Java section were, I've clicked on the Votes-tab and found this question:

Why is subtracting these two times (in 1927) giving a strange result?

I've read that question and thought at first:

Nobody would or could answer that question, because nobody ever could have had the same problem and knows the answer to that problem.

But I did not expect Jon Skeet. His answer was short, but understandable and explained why that happened.

I was so excited at that moment that somebody takes the time and tries to help somebody at such an unusual problem for free (well, eventually he will get some upvotes).

So sometime later, I did this find the most upvoted question thing again and checked the question again. Now with even more upvotes. But not just with more upvotes, but also with some edits from Jon Skeet. He updated his answer to be correct again, because some timezones changed. These edits made me smile, because I found it awesome, that someone takes responsibility for his answer, even over one year has passed and updates it, to keep it useful.

This q/a is just one of many, many awesome answers on this site. So many people do such an amazing job on Stack Overflow by helping others for free and updating their answers, etc. to save their coding-bros time. Keep up the awesome work.

6
votes

How to return the response from an asynchronous call?

Asynchronous behavior is something that can be very confusing to newer programmers--or simply those new to JavaScript. Add to this, JavaScript libraries with utility functions that make it even less obvious that asynchronous calls are even being made and you end up with tons of people who just can't wrap their heads around the topic.

There was a time when it seemed like half of the JavaScript questions I opened turned out to be someone confused by AJAX. Many of the questions got specific answers that addressed the problem in the code, but they did not explain the concept in a way that the asker went away with a new understanding. Felix's thorough answer changed this.

Even more than the 1650+ score of the answer, I think the most telling number that illustrates the usefulness of the answer (and related question) is the nearly 3200 linked questions. Such a thorough answer to a commonly misunderstood concept is invaluable.

4
  • Oh dang, I wanted to nominate him as well :-) Do you think he'd get twice the swag if I tell a story about him and his invaluable canonical Access / process (nested) objects, arrays or JSON?
    – Bergi
    Commented Aug 23, 2015 at 12:52
  • @Bergi Couldn't hurt. Commented Aug 23, 2015 at 20:42
  • Oh my, I didn't even know about this meta post. FWIW, I never received any swag :P Thank you for deeming this q&a worthy :) Commented Dec 19, 2015 at 3:32
  • @FelixKling Hah, me either! Commented Dec 19, 2015 at 17:44
5
votes

It's been 3 years since I wrote it, but I very much enjoyed writing the answer to this question:

How do x86 page tables work?

I enjoyed answering this answer because I knew first-hand how confusing it was to understand, since I had personally struggled with implementing x86 virtual memory on a toy operating system that I had written sometime before that. I had refused to even look at GRUB or any other prewritten tools to help me bootstrap the system; therefore, I had stared and played around for hours, on many days, at the Bochs emulator's inline disassembler in order to understand how the paging process worked and how the page tables mapped the virtual addresses to physical addresses. So when I finally got it working, I felt quite triumphant (I felt like a kernel programmer!) and awaited the opportunity to explain it to someone on StackOverflow to help them avoid going through the pains that I went through. I tried to explain x86 paging as succinctly as I possibly could -- I personally love succinct answers -- but while including enough detail to address all the points of confusion that had personally bothered me. So when I found the opportunity, I gladly took it. :)

Part of the reason that it is so painful for many people to learn and implement virtual memory (and specifically, paging) is that it's hard to wrap your head around self-referencing data structures. Traditionally, page tables are initialized so as to map their own virtual addresses to themselves, but when you're first learning this, that makes it difficult to keep track of when you're working with physical addresses and when you're working with virtual addresses. If you mess up along the way, your code will simply crash, and you'll be left wondering what's wrong. And considering how painful assembly is (especially in a boot environment!) it's not surprising understanding how to actually make things work is hard.

The OP seemed very satisfied with my answer, and it made me so glad that the knowledge I'd gained through the throwaway OS I'd written was finally transferred to someone else. Just a few days ago, someone asked more questions about it and I tried to explain things, but I'm not sure how that went (as of this writing, I hadn't received a final reply from them) but I think I was still able to help. I'm hoping it will be valuable to those struggling to get the details right and not knowing where to refer to for a concise source of the information.

5
votes

The question:

Default method returns true for a while, and then returns false? (Possible JVM bug) (hi skiwi )

The answer:

https://stackoverflow.com/a/22096371/1305253 by rolfl

The background

Stack overflow is a valuable reference source for solutions to challenging situations. The goal is to provide lasting information and to help people through time.

Unfortunately, times change, and sometimes they change quickly. Information gets old, and problems get fixed.

Still, this little issue was rediscovered in a new way by a Java 8 programmer and the answer became a dialog, and joint discovery.

This is just to say that the community, the discussion, and the combined discovery became a valuable reference, even if for just a short while, as the underlying bug in Java was resolved.

In addition, the problem and solution spanned multiple sites (Hi Code Review ) and used not only the question, the answer, and comment features of Stack Exchange, but also the chat. It pooled all the resources, and the result is a win.

5
votes

One day in 2013 I asked a SQL question that had been plaguing me for days. How to get average of the 'middle' values in a group? By this point in time I had been working with SQL in some form or another for a very long time. I thought I knew everything I could do with SQL. It turns out my very informal education in SQL had been sorely lacking. I didn't know window functions existed, and they were the basic building blocks I needed for my solution.

I received several great solutions to the problem. The one I selected as "the answer" was absolutely consise and beautiful code. But, without Roman Pekar's https://stackoverflow.com/users/1744834/roman-pekar answer it would have been lost on me. He (with some prodding by another user) explained the concepts and turned a light on for me.

I am amazed at how often I use SQL window functions now, and the lengths I went to in server side code before I knew about them. I upvoted his answer and thanked him, but looking back that doesn't seem adequate. That was just one of the many "aha" moments I've had on SO, but when I saw this question, it was the one that popped immediately into my head, 2 years later.

5
votes

Solutions vs SO Answers

I was going through my answers to see if any had a story worth sharing. I found one. It just wasn't mine.

The question: Does the Yii CActiveRecord class have a first() method?

The Story

I usually answer questions for the and tags. There are a lot of questions that can usually be answered in a few lines of code or paragraphs.

andrunix asked this question, about whether Yii had a feature similar to one in Rails. I answered it in one sentence and a single line of code to which the OP commented:

This is exactly what I wanted.

The answer: https://stackoverflow.com/a/14781150/428543

Along came Willem Renzema who started by explaining to the OP why Yii did not have a first() function a la Rails. He then proceeded to write a functioning first() function that the OP could use a la Rails, and then explained how to integrate it and finished his answer with an example of how to use the method. I pointed out that his code wouldn't break if composite primary keys and he updated the code to throw an exception to handle this, despite the fact that my 125 character answer had been accepted at the time.

I was pretty new to Yii and to answering questions back then. This answer taught me something new about Yii and acted as an example on how answers should be a more than just the solution to the problem.

5
votes

Creating range in JavaScript - strange syntax

The question asks for an explanation for the following line of code (which acts like range(5) would:

Array.apply(null, { length: 5 }).map(Number.call, Number);

The code there has a bunch of fairly complicated parts if you don't already know / use JavaScript, and I doubt it's self-explanatory to anyone. There are a bunch of things to understand here and Zirak's answer breaks the code up into all the pieces you need so anyone can follow along.

Just following along is not all he's helping you do, though. He takes you through the process he himself probably followed to confirm his understanding of it, which lets you learn how to learn things on your own instead of teaching you that one particular thing.

Things I learned:

  • That Zirak is a smart mofo
  • Stepping through code is very useful
  • That Zirak has an angelic voice
  • A bunch of fascinating JS that I'll probably never want to use again
  • That the specification is less inaccessible with Zirak around to link you to things
5
votes

StackOverflow got me to start one of the most fun side projects I've done in the past year

18 months ago, the tile puzzle game 2048 got really popular and a lot of people started playing it. It didn't take long before people started asking how to beat the game automatically. Back in March '14, I saw the question and the top answer at the time. That's a great answer, and @ovolve deserves tons of credit for his first (and only!) answer explaining in detail what he did.

But, seeing that his AI didn't reliably win 2048, I resolved I could do better. Just on the basis of the public "challenge" which had been posted as a StackOverflow question, I worked for a week straight to develop my own AI bot and open-sourced it, explaining in detail how the AI worked. In many ways it was the first major AI project I've ever done, and I learned an incredible amount from doing it. It was huge fun watching my pet bot beat my (puny human) high score in a matter of seconds, and the thrill of improving it and watching the results kept me going.

What's even better, though, is the amount of further development this would go on to spur. Shortly after I open-sourced it, I started getting pull requests and emails from all over the world with ideas, fixes, patches, and even new algorithms for improving the bot. People were using the code to study AI algorithms, were extending it for class projects, and just hacking it to run faster, better, stronger. Today, 18 months later, it's surpassed any expectations I ever had for it originally; it is by far my most popular and widely distributed open-source project, and I hear a Taiwanese university even used it as a benchmark for their own 2048 AI bot tournament.

All-in-all, just by answering this single question on StackOverflow, I got to go on an epic learning experience and develop a cool piece of software :)

1 2
3
4 5
8