I'll give another plug for Scrivener[1], which is really a great tool. All of the editions that I have in the major online bookstores come straight out of Scrivener (though I obviously used an image editor for the covers).
I wanted to also mention out awesome Leanpub[2] is. Write your files in Markdown (and they support code snippets well... definitely a service that works well for software topics), save them in Dropbox. Press a couple of buttons in your browser and you've got PDF, mobi and epub. And, you can sell right away and keep 90% - 50 cents. They make it easy to publish early in the process and keep readers up to date as you complete the work.
One bonus that's not as obvious: Leanpub also makes distribution to a sample audience easy. You can generate coupon codes trivially.
I'm planning to go straight to Leanpub with my next technical work.
[1]: http://www.literatureandlatte.com/scrivener.php [2]: http://leanpub.com/