I made a change today (will appear in a new build in the next few days) so MC will use a different data format for USB-UIRT IR emitter data learned and fired. It is supposed to be more reliable.
That said, I actually found out why I was having trouble getting MC to learn the codes. I spent half a day a couple of days ago trying to get MC to learn IR code without success, until I replaced the batteries in the remote control. The lesson learned: IR code learning requires strong signal from the remote control. Even if the remote control can control your set top box with a set of weak batteries, you should make sure you have good batteries when you attempt IR code learning.
Regarding the issue of the code being repeated multiple times when it is blasted, I could not find anything that we did wrong. I communicated with Jon Rhees (the maker of the device) via email about the developer API. Everything seems to be straight forward. After the codes were learned successfully with a new set of batteries, the issue is rarely seen. On very rare occasions, I got repeated blast when the emitter is placed too close to the receiver window of the STB. So my guess is maybe the signal gets reflected back from the receiver and then reflected again by the emitter toward the receiver. Another possibility is that weak signal during learning caused the incorrect code to be recorded.
So here are my suggestions:
Make sure you use a new set of batteries. When doing learning, place the remote control 1 to 4 inches from the device receiver window.
Make sure you do not put the emitter too close after all codes are learned - it should be at least a foot away, and there are not other objects that may act as reflectors in the area. And experiment with positioning of the emitter.