Principles and Applications of Magnetic Cooling