To deal with fruit flies, take a beer or wine bottle with a neck, leave it halfway empty. The flies go in because it's sweet to them but then get drunk and can't fly out of the bottleneck and eventually die of alcohol poisoning.