It works when you plug it directly into the wall but no other time?
First off, it seems to be a stagepin plug, how are you plugging that into the wall? Is this an edison outlet and your using an adaptor? Are you plugging directly into a
dimmer? Are you sure that the power is on when your testing this on the cable?
To troubleshoot, I'd try checking the plug, since you may have kinked it one way that got it to work, but the cables are otherwise stripped or loose. In the cap, again, check for loose cables. To deal with the carbon buildup in the socket where you put the lamp, try using a pipe cleaner (go steal one from a pre-k kid).