Periodic flat resolutions and periodicity in group (co)homology