Electronic properties of semiconductor surfaces and metal/semiconductor interfaces