A new generalization of the ostrowski inequality and applications