I don't understand, why not get one of those plug-in table top dimmers where you plug it into the wall, plug the lamp into the through-tap and there's a cord with a dimmer switch at the end?
Alternatively, you can get a dimmer switch that attaches to the lamp's cord like a regular on-cord switch, except that instead of a rocker, it has a knob that you turn with your thumb.
Either of the above solutions would have been simpler, cheaper and safer than this kludge that Peter shows us.
EDIT:
Also, those boxes are not listed for that type of portable application. The metal ones have knockouts that can break off and the plastic boxes will shatter like a phonograph record if dropped on the floor, kicked or banged.
[This message has been edited by SvenNYC (edited 05-18-2004).]