I used to suffer from this massively, but recently it's got a little better. Two things that helped a lot were to learn to take a break form the code before I got bored with it (getting a real job helped with that), and the other was to work on projects where I see and be encouraged by the effects of my coding - graphics, or projects with very clearly defined goals.
____________________
Jeremy
I didn't believe in evil until I dated it.