Don’t install Perl in “Program Files”

The Perl module HTML::TableExtract looks good for extracting table data from HTML tables.

I just need to install Perl to try it out. On Windows, I have a choice between Strawberry Perl and Active Perl.

Strawberry Perl actively forbids you from installing it in a directory whose full path contains “spaces or non-ASCII” characters. Try to override the default C:\strawberry with a more Windows-friendly C:\Program Files\Strawberry Perl to see an error like this:

"Stawberry Perl (64-bit) cannot be installed in a directory with spaces or non-ASCII characters.

After scoffing at this and installing ActivePerl, I now understand why Strawberry Perl was so defensive.

ActivePerl installed to C:\Program Files\ActivePerl with no complaint. Everything was going totally smoothly, until the time came to install the killer app using cpan.

Set up gcc environment - gcc.exe (rubenvb-4.5.4) 4.5.4
Checking if your kit is complete...
Looks good
Unable to find a perl 5 (by these names: C:\Program Files\ActivePerl\bin\perl.ex
e perl.exe perl5.exe perl5.16.1.exe miniperl.exe, in these dirs: . C:\Program Fi
les\ActivePerl\site\bin C:\Program Files\ActivePerl\bin C:\Windows\System32 C:\W
indows C:\Windows\System32\Wbem C:\Windows\System32\WindowsPowershell\v1.0 C:\Pr
ogram Files\TortoiseHg C:\Program Files\TortoiseSVN\bin C:\Program Files\Java\jd
k1.7.0_09\bin C:\Program Files\Python27 C:\Program Files\ActivePerl\bin)
Writing Makefile for HTML-TableExtract
Writing MYMETA.yml and MYMETA.json
dmake.exe:  Error: -- `C:\Program' not found, and can't be made
  MSISK/HTML-TableExtract-2.11.tar.gz
  C:\PROGRA~1\ACTIVE~1\site\bin\dmake.exe -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible

Strawberry Perl tried to protect me from what could have been a frustrating evening, but made itself look lame instead of calling out dmake as a flaky tool.

I’m going to try again with ActivePerl.

Advertisements

Remove “Choose an operating system” from startup

I want Windows Server 2012 to start quickly when I boot.

When I turn on my computer I see a screen like this:

Choose an operating system to start, or press tab to select a tool:
(Use the arrow keys to highlight your choice, then press ENTER.)

Windows Server 2012
Continue with install process

Windows Server 2012 starts automatically after 30 seconds. If I don’t want to wait that long I have to press enter.

If I choose Continue with install process, I see a screen like this:

Windows failed to start. A recent hardware or software change might be the cause.
1. Insert your Windows installation disc and restart your computer.
2. Choose language settings, and then chick “Next.”
3. Click “Repair your computer.”

If you do not have this disc, contact your system administrator or computer manufacturer for assistance.

This is all that’s left of almost installing Debian on my laptop. I thought this would be gone when the Windows Server 2012 installer formatted my hard drive, but I guess the boot record is stored in a special place that survives the format.

The rest of this post describes how to remove the screen and start Windows automatically.

Start Command Prompt as Administrator and run bcedit.

C:\Windows\system32>bcdedit

Windows Boot Manager
——————–
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
bootshutdowndisabled    Yes
default                 {current}
resumeobject            {c63af640-219a-11e2-b236-83f141b7b624}
displayorder            {current}
                        {30071991-e553-11df-bc3e-a35baee11a34}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
——————-
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows Server 2012
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {7561fe3c-2159-11e2-93e8-0c60761e3c34}
recoveryenabled         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \Windows
resumeobject            {c63af640-219a-11e2-b236-83f141b7b624}
nx                      OptOut

Real-mode Boot Sector
———————
identifier              {30071991-e553-11df-bc3e-a35baee11a34}
device                  partition=C:
path                    \g2ldr.mbr
description             Continue with install process

Type bcdedit /? to get information about all the options available.

Type bcdedit /? /delete to get more information about deleting an entry.

To delete the Continue with install process entry, type bcdedit /delete {30071991-e553-11df-bc3e-a35baee11a34}.

C:\Windows\system32>bcdedit /delete {30071991-e553-11df-bc3e-a35baee11a34}
The operation completed successfully.

Type bcdedit again to confirm.

C:\Windows\system32>bcdedit

Windows Boot Manager
——————–
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
bootshutdowndisabled    Yes
default                 {current}
resumeobject            {c63af640-219a-11e2-b236-83f141b7b624}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
——————-
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows Server 2012
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {7561fe3c-2159-11e2-93e8-0c60761e3c34}
recoveryenabled         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \Windows
resumeobject            {c63af640-219a-11e2-b236-83f141b7b624}
nx                      OptOut

The output shows Windows Server 2012 as the only entry.

Restart the computer to go through the boot process again.

The computer should now boot Windows without a prompt.

Path Editor

At some point in your career as a developer or an administrator, you’re going to care about the value of the Path environment variable.

For most people, it looks like this:

Edit System Variable Interface

The default tool for manipulating the variable is painful to use. It forces you to manipulate the value as a string, it performs no validation on the input, and it won’t even show you the whole value you’re working with.

I shouldn’t have to manipulate the Path as a string just because it’s serialized as one. Logically, the Path object is a sequence of directories.

With Redfern Place’s Path Editor, you can edit the Windows Path environment variable with an interface that better reflects the logical model.

For me, the Path looks like this:

Path Editor Interface

To insert a new item, context-click below the existing list entries and click ‘Insert New Item’:

Insert_New_Item

Type in the new expression to add to the path:

Type Item Name

Here, I’m adding Java binaries to my Path by using the JAVA_HOME environment variable I defined earlier. Because I’ve referred to the value of another environment variable by name, the shell will evaluate the Path variable at execution time to derive the true absolute path.

This means if I change JAVA_HOME because I change my version of Java, then I just have to update JAVA_HOME and the Path is updated for free!

Path Editor validates my input and shows me a green tick:

New_Directory_is_Valid

So I know I did it right.

Hit ‘Save to Registry’ (it can take a few seconds to finish saving), open a new Command Prompt, and type ‘java’ to test:

C:\Users\Iain>java -version
java version “1.7.0_09”
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

Success!