I think the real solution would be to avoid cutting off from society.Most experienced and stable techies have wives and some kids, this helps them keep their sanity.Having to go home to a loving wife and some children really refreshes a man and brings calmness to his mind.In my experience, techies with a family tend to be mentally balanced.