A recent answer I posted provides precisely what the OP was looking for and yet it has been downvoted, which I do not fully understand.
I reckon the question shows a clear lack of research and implementation effort and "SO is not a coding writing service" (to quote one of the comments). But at the same time, providing an answer was no trouble at all; quite the contrary, as I enjoy coding.
Now, abstracting from this particular case, should a good answer to a bad question be downvoted?
- This meta question leads me to believe that most would agree bad-question-answerers should not be punished.
- Neither on this meta post nor on this one or this one was I able to discern a "downvote good answers" guideline. As a matter of fact, the accepted answer on the latter post advises not to.
- Finally, on another post the community seems to agree one should not advise on an off-topic question.
On balance, maybe I shouldn't have advised, but rather than downvoting a good answer, isn't the appropriate approach to simply downvote/flag the question and let the community/experienced users take care of it?