There are times when writing code where nothing wants to work and/or you just can’t get past a hurdle. My advice to you: Step Away from the Computer!
More than likely, you’re doing something really lame but you’re not going to figure it out until you take a breather. If you’re like me, you’ll probably run the problem through your head a hundred times after you step away and that’s OK. Just make sure to physically step away and do something else – like sleep – before trying to tackle the problem again. Another option is to run the problem past one of your colleagues who may or may not be able to help you but just speaking out the problem may help you to solve it on your own.
I ran into this today and followed the latter advice. While explaining my problem to a PM sitting next to me (which of course required me to explain the problem in more detail), I noticed a clue that I missed that eventually led me to the answer. I don’t want to bore you with the details of the problem or the clue but understand that “- 8″ does not equal “+ 8″.
In short, my problem turned out to be PEBCaK (look it up) situation. <sigh>