Guns and Books: Legitimacy, Revolt and Technological Change in the Ottoman Empire