Applications of XAFS to nanostructures and materials science