Practice, Practice, Practice! That is how i did it anyway. Usually i let myself feel angry or sad for a minute or two, then i look at the situation. Was there something i could have done to prevent it? was it entirely by coincidence? Is there something to be learned from the experience? That usually helps me calm down and move on.
Just keep at it, you'll be a pro in no time! analyzing the situation helps me, maybe yours is different.