Where there's a lot of people you should always expect the casual jerk or childish individual or attention whore or troll to show up. I don't think there's a method, a scientifically proved strategy, a technology to prevent this from happening. After all programmers are (almost always= people, also, and people tend to be quite diverse in behavior, communication skills, patience to bear the stupid, self-consciousness, sense of opportunity and even common sense. Being an heterogeneous group is something that might probably enrich everyone involved.
There shall be, nonetheless, a system to slow down the annoying people. Downvoting and closing question and answers might work - provided that the vast majority of the participants are well-behaved, responsible adults. If this is not the case... well, then everyone who feels offended would better bail out, because there's no value in attending a community where these tenets are widely disregarded.
The chance is that if the subject around which the community gathered in the beginning is quite selective in itself then a natural selection will occurr in the long term. I mean: if someone is REALLY interested in programming after a while he/she will calm down, ask more intelligent answers, give more ponderate answer, more polite comments...