Synthesis of Micro- and Mesoporous Carbon Foams with Nanodispersed Metals for Adsorption and Catalysis Applications