What works for me is enjoying the process, not the end result, and making small incremental progress. I started blogging recently - just little pieces of code or analysis here and there - and found that a sense of making progress strongly motivates me to tackle harder problems, while sharing my progress along the way.