Compressive Detection and Estimation with Applications to Cognitive Radio and Radar