Get rid of illegal constructions, slums, encroachments i.e. anything which is not supposed to be where it is. Streamline cities, their administrations, their policing and their development. If the police don't have to deal with the above evils they will be most probably be dealing with crimes, criminals, anti-social elements, gangsters and gang members, organized mafia. This mean they will have more time for surveillance and intelligence gathering. This will definitely help in preventing such attacks from happening.