After a long 14 day I drifted off to sleep on the subway. I had a dream in SQL about trying to figure out the best way to set up the moment with a girl I liked so I could go in for a kiss. For some reason, it involved alot of table joins and sub-queries. When I woke up, I realized I had the solution to the de-duplication problem I had been working on all day!
Dream consists of looking through code... then suddenly notice something in my dream-code that isn't quite right and fix it. If I wake up I know it was a dream but am left wondering if it's a bug in real life...
Twice it has been. Brains are weird.
http://en.wikipedia.org/wiki/August_Kekul%C3%A9#The_ouroboro...
There are many other similar stories of various kinds of technical problems being solved during sleep and/or while dreaming.