A stupid question is one for which the effort you put into asking it is greater than the effort you put into trying to answer it on your own. That's a pretty low bar, and I think your question is well over it.
We all have facepalm moments; as long as someone else is likely to have the same moment, and you've described your problem clearly enough that this person will be able to find it, I don't think there's much wrong with it being on SO.
Others may disagree, of course. It's tough to keep a rein on the low-quality questions on SO these days. Sometimes not-particularly-bad questions get swept up in a moment of frustration or haste. Is that fair? No, but it's easy enough to correct. And, since you got your solution, which (I think) is simple enough to remember without having to refer back to this question, I'd suggest that you just let it go if other members decide to vote it off the island.
In short, you shouldn't refrain from posting a problem as long as you can describe it well and have tried to solve it on your own.
if(false)
”) then it should probably be closed. If other people think it really is stupid, they may downvote it, but that’s a separate issue. And wouldn’t it be hard to refrain from posting a stupid question if you don’t know it’s stupid until it’s answered? (If you did know it was stupid before it was answered, I’m eager to see this question.) – Ry- Jul 20 '13 at 19:02