Diuretic effect of caffeine and alcohol

I’m wondering just what the diuretic effect of caffeine and alcohol are. If I drink a beer or a coffee is all the water present in the beverage excreted? Is all the water plus some in my system excreted? Can I drink a certain amount of water along with a beer or coffee to offset the loss?

AIUI, the diuretic effect caused by the amount of caffeine in a glass of soda or mug of coffee is more than adequately offset by the water already in the beverage.

http://boards.straightdope.com/sdmb/showthread.php?p=3089802&highlight=caffiene+diuretic#post3089802

http://boards.straightdope.com/sdmb/showthread.php?p=6576295&highlight=caffiene+diuretic#post6576295

If it’s true that those who regularly consume alcohol become immune to its diuretic effect then is it untrue that hangovers are partly the result of dehydration?