I've noticed a habit of mine recently. I have a tendancy to open up a web browser and/or and email client when I first log into my home or work computer. I do this out of habit, just like a check the mailbox for new mail when I get home from work. The email thing is not such a big deal because I usually just delete the junk mail and take care of the few items that actually need my attention. The web browser on the other hand can be quite the menace. The web browser coupled with and RSS aggregator such as www.netvibes.com can be a real productivity killer. Before I'm really aware of it, I'm reading some blog on libertarian economic thought or browsing through www.techbargains.com drooling over a new piece of hardware.
So What can I/you do about this?
Open up the IDE first. I'm assuming you're using an IDE (Integrated Development Environment) but you could also be using VI or Emacs or Excel. The point is that you should open up the IDE first and just start working on something or anything really just to get started. I find that once I get started on a task I've won half the battle. Once I'm really working on a task I slip into concentration mode and can focus on a problem and I'm usally very stalwart in searching for the solution.
Have your essentials near at hand. You want to have your cup of water|joe|soda full and within reach before you put on your headphones and slip into the zone. Once I've got my glass of water and my headphones are on I'm safe. I can usually code for at least a few hours like this before I need a bathroom break.
Make sure to read Part 2 about staying in the zone which is almost more difficult, especially if you have non-coders in your work environment.