Solitary waves in the nonlinear wave equation and in Gauge Theories