When is it the duty of a citizen to resist their government?

When is it the duty of a citizen to resist their government? What methods should be used in this resistance? How far should the resistance go, and when should a citizen (or citizens) compromise?