We present some recent developments in Hamiltonian PDE. The linear theory solves an old spectral problem on boundedness of L-infinity norm of eigenfunctions of the Schroedinger operator on the 2-torus. The nonlinear theory constructs KAM solutions and proves almost global existence for supercritical NLS on the d-torus (d arbitrary).