PHP setlocale depends on underlying system (XAMPP on Windows)

I’m maintaining a few websites, so I have a local webserver running to do testing and debugging. Until recently, I was using IIS on my Windows laptop. However, I ditched IIS a while ago, replacing it with XAMPP. This is much closer to the environment that’s running the websites (e.g. I can use .htaccess directly, rather than converting it to a web.config file).

This all worked fine, except for setlocale in PHP. I wanted to use Dutch (Belgian), but I could not get
setlocale(LC_ALL, 'nl_BE');
to work on my local machine.

I searched the web, but did not find any useful information. So I looked at the PHP setlocale helpinfo again, and noticed the Tip in the NotesWindows users will find useful information about locale strings at Microsoft’s MSDN website.

After checking, it turned out that Microsoft decided to go for another “standard”, so ‘nl_BE’ was not recognized. To use Dutch on Windows, I needed
setlocale(LC_ALL, 'nld_nld');

Oh well…

Removing more annoying context menus

In addition to an earlier article on removing annoying context menus in Windows:

  • Removing “Move to Dropbox“:
    regsvr32 /u "C:\Users\[username]\AppData\Roaming\Dropbox\bin\DropboxExt.22.dll"
  • Removing “SnagIt” context menu:
    regsvr32 /u "C:\Program Files (x86)\TechSmith\SnagIt 11\SnagItShellExt.dll"

Windows Media Player is also pretty stubborn. To get rid of “Add to Windows Media Player list”, “Play with Windows Media Player” and “Shop for music online”, you need to remove the following registry keys:
HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Audio\shell\Enqueue
HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Audio\shell\Play
HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Image\shell\Enqueue
HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Image\shell\Play
HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Video\shell\Enqueue
HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Video\shell\Play
HKEY_CLASSES_ROOT\SystemFileAssociations\audio\shell\Enqueue
HKEY_CLASSES_ROOT\SystemFileAssociations\audio\shell\Play
HKEY_CLASSES_ROOT\SystemFileAssociations\video\shell\Enqueue
HKEY_CLASSES_ROOT\SystemFileAssociations\video\shell\Play
HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Audio\shellex\ContextMenuHandlers\WMPShopMusic

Display a thumbnail of Word and PowerPoint files in Windows Explorer

I like to see a thumbnail of the first page of a Word document or the title slide of a PowerPoint slide deck in Windows Explorer.

With Microsoft Word, you can check the Save Thumbnail checkbox in the Save As dialog box to create the thumbnail:
word_save_thumbnail

In Microsoft PowerPoint, this feature is a bit more hidden. You can find it in the Advanced Properties: Click File > Info, click on the Properties heading on the right-hand side and click Advanced Properties:
ppt_properties
In the dialog box, click on the Summary tab. There you can check Save preview picture:
ppt_advanced_properties_summary
Now save the file and the thumbnail will be visible in Windows Explorer.