I believe the secret is to try again. It's what I do. If I can't do something, I have a go, knowing it will probably not work the first time. Then I try something different. And something different again. And I keep going. The benefit of this is that, along the way, I may have tried many different things and techniques that I end up learning more about a piece of software or a programming language without necessarily realising it at the time. So, often, though it may feel as if I put in two days' worth of effort to get one thing working, I've also picked up a bunch of stuff that makes my next task, and the task after that, so much simpler and quicker to do.
I know it feels difficult now, but if you persist, you will be glad you did.