How to Fix the Duplicate Application Bug in the "Open With" Menu

Sometimes in Mac OS X Lion, right clicking a file to "Open With" displays duplicate applications. All the items in the right-click context menu work fine, but it is annoying as the application is only present on the system once. There seems to be a simple fix to this bug...
 
Fire up the Terminal application and type the following line:
 
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.
framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

 
Then relaunch the Finder with the following command:
 
killall Finder
 
You will then notice that the duplicate items are gone (check by trying the "Open With..." menu again). Map