It's unfortunate that these things happen in Bali, but I hope for everyone's safety. For those living in Bali, one of the best ways to be safe, among many other things, is to try to develop and maintain strong bonds with people in your community.
Because family and I live in LA, our homes in Bali are rarely occupied except for when we are there on vacation. Thus our home is an ideal target for robbers. One night a burglar broke into our house in Denpasar, but my neighbor saw it happened from across the street. She screamed, "maling" and in about a minute, a lot of people from my neighborhood went in, beat the burglars and turned them to the authorities. Nothing went missing, and a lot of people voluntarily kept a close eye on my house while we are away and the rest of the neighborhood afterwards. Thus...having a good and close relationship with your community is key to safety.
Also, if possible and if your neighbors are willing, consider forming a neighborhood watch as a deterrent to future robbers.
Again, may everyone in Bali stay safe =)
- Robin