I have a suugestion that, whenever someone give a piece of demo code or some solutions on this site, the author should always state:
Sounds like a small deal, but this helps. Some time, I do see pieces of code which are obviously not tested. I am not saying one can not post non-tested code, there might time-restriction etc. But it is better to let the readers be aware of this.