That all starts with being able to recognize those emotions in the moment. If you can’t change the past, then why are you putting energy into getting angry over it? In your dog example, you’re going to have to clean it either way so stop to think about what’s more valuable to you - moving forward and learning for next time or using your energy to get angry.
There’s nothing wrong with getting angry. Anger is a useful emotion. Use it to your benefit rather than to your detriment.