re: piracy: I just released my latest Leanpub book (Haskell Tutorial and Cookbook) 2 weeks ago, and I put a Creative Commons 'share with attribution, no modifications, no commercial reuse' license, and I explicitly tell people that it is legal to share the PDF, ePub, and Mobi files with their friends, and they have my best wishes if they do so.
I have written a number of books and the payout in increased networking with people who are into the same tech as I am, increased consulting business, etc. is awesome. I also make decent passive income from writing, but that is a secondary objective.