Short of removing all traces of food from the kitchen (unfeasible) or resorting to fly tape (ugly), we lit upon this technique for getting rid of the things:
• Get a wide-mouthed jar out of the recycling, and put about an inch of vinegar or wine (red works best) in it.
• Curve a piece of paper into a funnel with a half-inch opening at the small end, taping it to secure the shape.
• Stick the funnel in the jar.
Voila! Flies are indeed drawn to vinegar, and they'll fly in, gorge themselves, and then can't manage to fly back out. We think there are worse ways for a fly to perish, and we're happy that this solution takes so little time and space.
(Edited from a post originally published 08.24.07)