I looked to see if this is a duplicate on Meta, seems like it isn't, so sorry if it is, but I have seen too many questions tonight asking "Can you write code for me that does ..." or "I require code that does this ...". I checked the Ask Question page and I don't see anything clear that tells users that SO isn't a site where you ask others to write code for you. Is there any way we could get the message across that you should post what you tried (or try something) before asking for someone on SO to just do it for you? Maybe a popup that appears when the question contains words that seem to be indicative of straight asking for code.
Were you signed in when you clicked "Ask Question"? If so, you won't see the same information that someone new to the community would see. Try logging out first, then click "Ask Question".
The fact is, StackExchange does put up lots of barriers, safety nets, FAQ links, guidelines, and other material designed to save the original poster from the embarrassment of posting something that is off topic, not constructive, or not a real question, long before that individual even has a chance to type the first keystroke in that question box.
New users who click Ask Question see a modified version of the How to Ask page prior to advancement to the question box.
New users are encouraged to search for the answer as well, and there is a search box on the page just for this purpose.
Additionally, there is information about the importance of being specific and relevant:
Additionally, there is a checkbox at the bottom that says
Therefore, I have to agree with Jeff. If you get past this page, you've read the FAQ, you've looked around the site at other questions, you see the enormity of the question box in comparison to your one or two line question, then you probably won't get a lot of sympathy from the community.
I try to be patient with newbies, as we all were new at one point, but the type of questions you describe are asked by people who take a lot of patience to deal with. My advice is to give them the benefit of the doubt, be polite, and simply ask for clarification. Sometimes it just takes someone asking for code for the original poster to realize the importance of including this material and responding appropriately.
Aside from that, if they don't respond in a timely manner, downvote, vote to close as Not a Real Question (not Not Constructive), and move on.
You have votes. Use them. Downvote these sorts of no-effort "gimme teh codez" questions. This is a signal to the user, and to the system, that these sorts of questions are unwanted.
Remember that downvotes on questions cost zero rep (whereas downvotes on answers cost -1 rep to you.)