Synthesis of radioactive elements in novae and supernovae and their use as a diagnostic tool