Rodolfo Castro had two hits — one night after an embarrassing smartphone faux pas — to help the Pirates beat the Diamondbacks.