Being up front that you're fair but strict. It is important to be upfront about the rules and consequent in enforcing them. People may rouse a ruckus when their favoritefavourite troll is banished, but they forget about it in a week and instillinstil in other new users the "history" and that rules are enforced without mercy. People who blatantly ignore the rules need to have consequences as an enforcement method. This also needs to be communicated to the core of the community so they can warn newbies of the consequences.
For Stack Overflow I could imagine monthly statistics of how many users were banned/disciplined for which reasons. Add a badge after visiting these stats for x times in a row. This way people will be motivated and will hopefully take initiative for correcting/helping people, warning them about what consequensesconsequences certain behaviours will have.
Be supportive of eachothereach other, wetherwhether you're new or old. Try to teach your skills to the new ones without hitting them over the head too much. It's better to guide a newbie gradually into the community than to overflow them with all the "unwritten" rules and expectations. People have to grow into it. Have to notice for themselves how hard it is to answer a question without a code sample, have to experience that it hinders their own score growth.
Until a user reaches a score of (throwing up a ball here, could be a bit off, maybe its 500, maybe its 2000)1000 1000 points don't put too much expectations on them, under a thousand points they are usually just here to get their "quick" fix and are not fully intergrainedinter-grained in the "SO community" after a certain amount of points people start to want more to with the community. They start to explore meta maybe, reading a few blog posts, start correcting people with what they learned to other new users.
An example could be a question titled "How to hide a divdiv
with jQuery". This usually gets closed within 30 seconds as a duplicate of a question, leaving people responding in comments how to apply that question to OP's problem because OP lacks the fundementalfundamental knowledge how to apply the duplicate to his situation.
I would rather vote for an option that when a question is closed as a duplicate that the option exists to open one wiki answer that answers the question for OP's situation for those that wish to help OP. I would also make the closed message different, to something along the line of "This answer has been marked as a duplicate answer. A community wiki answer is possible to provide a solution to OP's specific case"
This discourages help vampires because there's no "reward" and gives community members who have to drive to help to actualy present a useful answer for the OP. This will cause the OP to return to the site because OP got the answer needed, will give OP the chance to grow into the community as a whole.
Experienced users should also take the time to teach the new users how to use their site. Explain where their answer came from, how they found it and how they re-applied the answer from another question to this use case. Allow the new user to connect the dots. Teach them about the programming concepts required and link to relevant documentation points. New users really lack the experience on how to navigate this site, where to find the resources needed and usually they are so inexperienced in their skill area that they cannot see how to apply a solution from a different set of problems in their use case because they haven't learned how to apply the different concepts yet. We need to help them become better problem solvers, to enrich their lives with the new skills that will make it practically uneccesaryunnecessary to ask new questions because they can apply the knowledegeknowledge hidden in older questions to their own problems, giving them "real" reasons to upvote questions and answers.
Be gentle, be loving. Do upon others as you'd like others to do upon you. Do you like a curt answer that solves your problem but doesn't explain the underlying steps? Do you like it when people post a comment about the bad quality of your question without giving helpful hints? New users need to be held by the hand, guided to the process and given a lot of leeway to improve. Remember, the "community" doesn't exist for them yet as an important concept, only their problem. They need room to learn to grow and adapt. Imagine as a foreigner going to a different country and needing to learn the customs there. There are so many small rules and expectations. Newcomers are usually forgiven a lot of mistakes, but as you stay longer, more expectations are put upon the foreigner. It's never from the get go that they need to know all the rules, they're allowed to grown into it, pulled to the side and explained softly what they did wrong or should correct in their behaviour so people can grow into the correct behaviour.
I think it should also be made easier to start a private "chat" with a user to be able to correct/teach the user personally about what exactly went wrong in asking the question and how to modify it(without solving the question problem in chat) I could imagine this a privelegeprivilege to be given to people with the strunkStrunk & whiteWhite badge and/or other relevant moderation badges, since these are people who seem to put site quality first and have show inclanationinclination of wanting to improve the site.