Basics of X-ray Diffraction and Its Applications