The theory and practice of resilience