When somebody says that "NN is teh stupid" they always mean definition #1. However, "stupid" is also most usually the first ad hominem used by someone who has just been completely pwned - which leads us to definition #2.
Stupid people often forget to Scroll up. Don't let this happen to you; always keep your finger on that cute little nubbin on your mouse.
However, it can also be used as a noun as in "Hey, shut up stupid!" But this is only done by euphemismfags.
Learning to differentiate between the two first mentioned is largely a matter of context, and a waste of time.