US President Barack Obama denounces the "despicable" attacks in Dallas in which snipers shot dead five police officers during a protest against police shootings of black men.