Stability of shallow and deep foundations