If you're like me, you are easily distracted by all the information that pops up on your computer. I have notifications for email, instant messages, RSS feed updates, twitter...the list could go on and on. Of course they are often things that you have to deal with or perhaps are just very interesting (unlike, say, the true task at hand).
My first attempt to deal with this was something of a failure. I would tell myself: I will block off an hour and focus on something. But of course, people who can't focus will likely not be able to do this. (I couldn't).
What I have done successfully is shrink my focus time down. I have a timer -- I use CoolTimer -- and I set it for five minutes. (People who can focus will laugh.) And I focus for that amount. If I still feel I am doing well, I add on another five minutes. If not, I allow myself to lose focus for a bit.
How long is a bit? For me, I set my non-focused time for five minutes. That way I don't become too interested in something for too long and I can get back to the task at hand.
When I am working on something interesting, focusing is easy. But for many things in life, it can be a challenge. This approach can help.