Cardiff eased their relegation worries with a hard-fought 2-1 win over Derby County