Projections and idempotents with fixed diagonal