Scientists have developed an electric alarm that stops people from daydreaming by sounding an alert when the mind wanders.