First off, the other question is from 2011. That's not the wild days of 2008, but its still far enough back that the standards have evolved since then. Basically, don't use an old post being upvoted as evidence that similar questions are good today.

To answer the titular question, **yes** you should absolutely show code that has expected usage, any attempts you have made, etc. This shows research and effort at the very least.

Your original revision is very broad and "give me teh codez" feeling. I'm not surprised it was downvoted. Also see: http://meta.stackoverflow.com/questions/284236/why-is-can-someone-help-me-not-an-actual-question