Chiral unitary approach to meson-meson and meson-baryon interactions and nuclear applications