Hyperplane arrangements and applications