Aspects of inhibiting corrosion of metals by anodic or cathodic protection