Hard diffraction in hadron-hadron interactions and in photoproduction.