1. Read as much as you can before travelling. Some forums such as tripadvisor or lonelyplanet is really useful.
2. Do as the locals do: Study at what local women are wearing. Do they have their shoulders covered? Are they sunbathing? Avoid drawing unwelcome attention to yourself.
3. Plan your itinerary each day and make sure you know how to get there and back.