Understanding ego depletion and willpower are incredibly important skills for any knowledge worker. A book like http://www.amazon.com/The-Willpower-Instinct-Self-Control-Ma... will help a programmer perform better work than a book on compilers.
Interesting, I wonder if this is the same as when you have a song stuck (looping) in your head. I've been told that listening to the whole song will make it unstuck.
To idiomize this great point: Willpower is a hammer, not a shield.