I keep it simple and use the Pomodoro technique:
- 25 min non stop work (try e.ggtimer.com for a timer to keep track)
- 5 min off (free time)
- After 3 or so pomodoro's, reward yourself with a 15-20 minute break and repeat
This technique has been very effective in everything from writing my master's thesis (which I hated) to learning web dev frameworks (such as RoR).