Anomalous specific heat of dipolar spin glasses and ferroelectrics