The problem is, this question itself include a partial answer in the form of some bad code. So the first thing everyone who is redirected to this question sees is a bunch of code that looks much like an answer, but which they are best off ignoring. On top of this some of the answers naturally comment on this code, thus including information that is not relevant to the general topic.
In general I request that no question is ever marked as a duplicate of a question that is significantly more complicated, provoke more complicated responses, or in other ways generate unnecessary noise. The result of such a duplication mark is a worse experience for those seeking an answer to the simple question.
Ilmari Karonen has now heavily edited the question in order to make it a better duplicate hub. Is this a practice with any precedence? If so are there any further guidelines for its application? If not, what does everyone think about it?
Also this question has been closed as duplicate of a quite different question. Did any of the closers bother to read and comprehend what I wrote?