first, find a job you enjoy -- the tech job market is good enough now where you can afford to be selective (at least in the valley/other tech hubs) -- ideally, something that you would find exciting enough to do even if you weren't getting paid, as the cliche goes.
second, i think it's common for developers to get the equivalent of writers' block when the upcoming task is large and/or poorly defined. some things that have helped with this:
- tricking yourself to take on little pieces of the bigger project (google 'structured procrastination' and hamming's article on productivity); carving out explicit "next steps" (without dependencies) that you can start on now
- writing down a plan or specs to at least get things on paper/into your editor to bring clarity to a jumble of random thoughts
- reducing distractions; putting on headphones (esp. noise cancelling); stopping multitasking
http://www.joelonsoftware.com/articles/fog0000000022.html ; also, turning off AIM (or putting up an away message plus hide windows) and your mail client's new-email popup/toaster massively cuts down interruptions
- using rescuetime (to assess the damage and/or feel guilty about screwing around :)), noprocrast on news.yc or just making a commitment to yourself to wean yourself off of news/blog sugar
lots of people have written about productivity; http://blog.pmarca.com/2007/06/the_pmarca_guid.html and http://www.paulgraham.com/hamming.html are good starting points.
but ironically it's tempting to waste a lot of time "preparing" yourself to be really productive or trying to come up with the perfect system. i think there are natural ebbs and flows in levels of productivity; a lot of the battle is detecting when you're slumping and instead of beating yourself up, try to trick yourself into making that period as short as possible.