When things are not going my way, I often complain and criticize others to myself. I realize this is not a helpful dialog even with myself. The real answer if things are not going your way is to ask, "So what do you want to do about it?" If I really work on answering that question and then taking action based on the answer, I can really make a difference.
Often I dwell so much on my previous mistakes, that I really get down on myself. Logically I know that giving myself a hard time does not help. I wonder often why I do it.
Taking action is the real key to improving the situation, rather berating myself. I also use the term improving the situation rather than solving the problem. Sometimes solutions take longer than making improvements. I often ask myself and others "What is the next step?" Looking forward and not back, can be very helpful and encouraging.