If the dogs are showing no interest in you, then the best thing to do is ignore them. What you're doing by not looking at, facing or watching them is sending out a communication that you're indifferent to their presence, and you don't really want anything to do with them. I personally think a whistle or another noisemaking device is a better option than hurling things at them.
If a dog approaches you, don't freak out, run, scream, make eye contact, kick or anything like that. You're just begging to be attacked because you're confronting the dog. If you present your side and stand quietly without making eye contact, you're allowing the dog to engage in it's usual ritual of collecting information. Most dogs don't want to attack, they just want to determine whether or not you're a threat. The less interesting you are, the less interested they'll be.