This summer a friend was annoyed that she couldn't get pictures at the beach because her camera always fogged up, so I thought I'd address this issue. It has a simple solution: plan ahead. Yeah, yeah, and patience doesn't hurt either.
For this picture, I walked directly out of the air conditioning into the steamy, humid air, pointed and shot. The temperature difference will fog the camera up every time. It'll happen going from hot to cold as well.
The trick is to leave your camera out in the atmosphere where you plan on taking pictures for a while before you start. For the 2nd shot I left the camera out on the balcony for about 10 minutes and everything defogged. The length of time needed is directly proportional to the difference in the temperatures. Sometimes it could take as long as 30 minutes but not usually.
Application to writing? When you sit down to write, plan ahead. Do whatever research you need before you write. It may help lift the fog of how a scene should go. It may even give you some ideas you hadn't thought of. In writing a scene about a catatonic person, it was nice for me to know that they can do more than just lie still in a bed. There was a lot more scope for the imagination.