A new generalization of the Ostrowski inequality and applications