Ninja Nichols

The discipline of programming

The certificate’s private key could not be accessed.

Parser Error Message: ID1024: The configuration property value is not valid.

PropertyName: serviceCertificate

Error: ID1039: The certificate's private key could not be accessed. Ensure the access control list (ACL) on the certificate's private key grants access to the application pool user.

After redeploying one of our IIS applications, we suddenly started getting this error message. We verified that the fingerprint matched the expected certificate and that the Application Pool setting “Load User Profile” was set to true.

The fix was to allow the AppPool user (NETWORK SERVICE) to read the certificate private key).

  1. Open the MMC snap-in by running mmc.exe.
  2. Select File -> Add/remove snap-in. Select Certificates and click “Add”.
  3. Select “Computer Account”. Click Finish. Click Next.
  4. Drill down to Personal -> Certificates.
  5. Right-click your certificate and select All Tasks -> Manage private keys.
  6. Add NETWORK SERVICE and give it “read” privileges.

Clone Windows Server 2008 KVM Virtual Machine

I recently needed to make several copies of an already configured Windows Server 2008 virtual machine. We are using the Linux KVM hypervisor library libvirt. These are the steps I took:

  1. Run Sysprep on the existing Windows Server 2008 to clear out any unique info such as IP address and hostname that might cause interference later.
    1. Run C:WindowsSystem32SysprepSysprep.exe
    2. Select “System Out-of-Box Experience (OOBE)”
    3. Check “Generalize” and select “Shut Down” from the drop down.
  2. Once the machine has shut down, clone the virtual machine:
    1. Run the command:
      virt-clone --original Server1 --name Server2 --file /var/lib/libvirt/images/Server2.img

      where --original is the name of the virtual machine to be cloned (You can get the list of names by running virsh list --all), --name is the name of the new virtual machine and --file is clone image to be created.

  3. Rinse and repeat as needed.
  4. Start the clones and give them computer names and IP addresses.

IIS Manager stuck minimized in Taskbar

I found myself in an odd predicament earlier when I couldn’t get the IIS Manager on one of our Windows Server 2008 R2 boxes to open. When I tried to open it, the IIS icon showed in the taskbar but clicking on it had no effect. I tried just about everything to restore it, even restarting the box to no avail.

The fix for me was to run Inetmgr.exe /reset which resets your IIS preferences, including window size and placement.

Re-enable screen brightness Fn keys

My Fn brightness suddenly stopped working on my Thinkpad T510. I traced the problem back to the Nvidia section of my xorg.conf file. After the following small edit, the brightness keys worked again.

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    Option         "RegistryDwords" "EnableBrightnessControl=1"
EndSection

Change ‘fee’ value for ACM Latex Paper

Recently I submitted a paper to an ACM Conference. When I was reviewing the final draft I noticed that the fee value in the copyright block was incorrect. For example, in the block below the fee is automatically set to $5.00 but the Conference I’m submitting to has a fee of $10.00.

Permission to make digital or hard copies of all or part of this work for
personal or classroom use is granted without fee provided that copies are
not made or distributed for profit or commercial advantage and that copies
bear this notice and the full citation on the first page. To copy otherwise, to
republish, to post on servers or to redistribute to lists, requires prior specific
permission and/or a fee.

ICIMCS’11, August 5-7, 2011, Chengdu, Sichuan, China
Copyright 2011 ACM 978-1-4503-0918-9/11/08 ...$5.00.

It looks like this value is hard coded into the sig-alternate.cls file. Just go in and modify it like so:

globalcopyrightetc{Copyright thecopyrtyr ACM theacmcopyr ...$10.00}

Export high resolution images from PowerPoint

PowerPoint makes it easy to produce professional looking graphics quickly. Sometimes I need to export high quality versions of those slides. By default, PowerPoint limits exports to a resolution of 96 DPI (by comparison, many printers use 300 DPI). However, it is possible to change the default DPI by creating a registry entry.

For Office 2007, browser to
HKEY_CURRENT_USERSoftwareMicrosoftOffice12.0PowerPointOptions

And create a new DWORD value called ExportBitmapResolution. Finally set the value to the DPI you want, e.g., 300.

Now you can export high quality slides by saving them as images.

Instructions for Office 2003 and a list of DPI values and their corresponding image sizes is available at http://support.microsoft.com/kb/827745

OCS Inventory (Where do I put cacert.pem?)

OCS Inventory is an inventory management system that can keep track of the machines connected to the network. It also features a package deployment system that can be used to run commands, install programs or copy files to the machines in the network.

There are a number of guides out there on how to set up the deployment system, but the problem I had is that they all tell you to copy your cacert.pem file in the “OCS Inventory Agent installation directory”. I thought that should be /etc/ocsinventory-agent/ but it’s not.

The directory where you should put it actually depends on the hostname of the OCS Inventory Server. Lets assume that my server is called “jones” and that I would access the control panel at http://jones/ocsreports. Then the location where I should copy the cacert.pem file on the computers running the OCS Agent would be /var/lib/ocsinventory-agent/http:__jones_ocsinventory/cacert.pem".

Get VIM to use 256-bit color theme

All this time I’ve been stuck using vim in 8-bit color because I thought my terminal emulator couldn’t support any higher. Turns out all I needed to do was let VIM know that I wanted pretty colors.

Step 1: Make sure you have a VIM color scheme that supports 256 color. I like the wombat256 theme.

Step 2: Tell VIM that you want 256 color by adding this line to your ~/.vimrc file:

set t_Co = 256

Step 3 (optional): Depending on your terminal emulator, you may need to also add this line to your ~/.bashrc file:

export TERM="xterm-256color"

Multiple copies of program in “Open With” dialog

Why are there 20 copies of Photoshop?!

Sometimes duplicate copies of the same program seem to mysteriously show up in the “Open With” dialog. The problem seems to be worse for Windows programs installed with Wine.

The reason there are so many duplicate entries in the “Open With” dialog is due to the way file associates are handled in Wine. Every time a new program is installed in Windows, it has the opportunity to register itself as the handler program for a particular file type. This behavior is also present in Wine.

Each file handler is stored as a .desktop file in ~/.local/share/applications.

Sometimes though, Wine will create a new entry for each and every file type associated with a program. Take MS Excel for example, I have a distinct entry for .xls, .xlsx, .xlsm, .xltm, and .xlsb. These are just for Microsoft’s own variants of their Excel spreadsheet format and each one creates a new entry in the Open With dialog!

At this point, there are two options.

  1. Try to combine several entries together by allowing each one to handle several file types. This is accomplished by editing the “MimeType=” line in the .desktop file. The general format is “MimeType=catagory1/type1; catagory2/type2;” where “catagory1/type1” is something like “text/csv”.
  2. The above method seemed like too much work, so I opted for the second choice. Copy all the file type entries that you don’t need to another directory. I moved all but the essential entires to ~/.local/share/applications-old.

After a little cleaning up my “Open With” dialog looks much better.

My New OpenBox Desktop

OpenBox is a minimalistic desktop window manager which can be run with or instead of Gnome or KDE. The whole environment is very customizable with nearly everything being controlled by a few scripts and XML documents.

Wallpaper: Arch gray
Icons: Elegant-AwOken (part of Elegant Gnome Pack)
OpenBox window decoration: 1977 OpenBox
GTK theme: Elegant GTK
Vim theme: wombat
Conky: .conkyrc plus power consumption script
Tint2: .tint2rc