All the documentation says to press two-fingers and click, but actually you must press down three fingers and then click to right-click when running Vista, Boot Camped on the new MacBook Pros (late 2008).

A couple of days ago I decided to move this blog from being hosted at Wordpress,com, to an account I have at Webhost4life.  You can add new domains to your account for only US$15 a year.

When I set the blog up at Wordpress.com, I ordered my custom domain (damianblog.com) and that is what I have been using.

Export your Wordpress.com hosted blog

The first thing I did was to export my blog from my Wordpress.com account, by logging in to Wordpress.com administration page for Damianblog, clicking on Manage, and then clicking on Export:

image

This generated an XML file which I saved on my local hard disk.

Installing Wordpress on webhost4life

Webhost4life offer a an automated installation of Wordpress using the "Php Free Plug-ins" item on the "Site Admin" tab of their control panel.  I first tried using this, however it currently installs version 2.0.3, which will not import the file I’d just exported from Wordpress.com.

After a little searching I came across this excellent page, which explains in detail what you need to do to set up the latest version of Wordpress.

It worked well for me, except for step 18 (giving NETWORK access) - I found I had to give access to IUSER_DEDI… and also IUSER_<webhost4life account name>.

I also created the zip at step 14 as ‘damianblog.zip’ and copied that to my root directory and then unzipped it, so that Wordpress was now installed under a ‘damianblog’ directory under my account root directory.

Setting up the damianblog DNS so that it points to Webhost4life

In the webhost4life control panel I went to the "Domain Name" item on the "Domains" tab in the control panel and added damianblog.com to map to the damianblog directory to which I’d installed Wordpress.

I paid my US$15, and I was given the name of two domain servers that I could now use to resolve damianblog.com.

Configuring your domain’s DNS servers to point to the webhost4life servers

In the Wordpress.com admin site I clicked on Upgrades and then on Domains (to the right of "Upgrades" and "Gifts") and saved the Customer Number shown at the bottom of the page, and then clicked on "Manage Your Domains" at the very bottom of the page.

This took me to a new page on securepaynet.net on which I entered my Customer Number that I just saved, and my password.  I clicked on damianblog.com and then clicked on "Nameservers" (the fourth tab), selected "Custom nameservers", and entered the name of the two name servers I’d been given when I set up the damianblog domain name in the Webhost4life control panel.

An hour or so later, when I pinged damianblog.com it returned my webhost4life IP address.

Panic

I went into my new Wordpress admin page on webhost4life, and clicked on Settings (on the right-hand part of the page), and made sure the Wordpress address (URL) was http://damianblog.com

I clicked on the Import link in the admin page, and imported the XML file I’d exported from the old blog hosted at Wordpress.com

I checked, and sure enough when I went to http://damianblog.com all was well.  I could relax.

As an afterthought I tried clicking on one of the links on the web that pointed to my blog.  It didn’t work.  Aggh.

It turns out that the default Permalink URL in my new blog was of the form http://damianblog.com/?p=123, whereas all my old postings hosted on Wordpress.com were of the form http://damianblog.com/2007/02/25/ajax-screencast/

I went to the Permalink section but none of the common settings were in the form I wanted (they all wanted to add ‘index.php’ to the URL).  I could configure a custom structure to be the way I wanted, but when you clicked on URLs the page was not found:

image

The solution was to create a small PHP file which handled the "URL Not Found" error and remapped the page as described here.  Just be careful when copying the PHP code from the web page because some of the single quotes are not the standard quotes that they should be.

Finally: the Simpla Theme

The new Wordpress installation did not come with the theme I’ve chosen: Simpla.  Installing it was pretty easy, I just unzipped the theme from http://ifelse.co.uk/simpla into the /wp-content/themes/ directory. 

Unfortunately none of my widgets showed on the right hand side.  I had to make a couple of small modifications to get that resolved.

Done

Now it all seems to be working properly and I can customize my installation as I wish.

Z-Wave is a home automation technology which uses a mesh network to allow devices to talk to each other. 

Some devices, such as infrared motion sensors can run for years off of batteries, since their power requirements are so low. 

Other devices that are wired-in (such as light switches) act as relays between devices, thus forming the mesh.

I’ve got a few of these devices set up now, and have ordered a load more to fully automate my home.  I’m going to be talking about the purchase experience, installation, configuration, and controlling them from software.

I didn’t want to "pollute" this blog with a bunch of Z-Wave information, so I’ve just started a new blog at http://www.thezwave.com/ 

I’ll be posting there as my Z-Wave experience evolves.

Attending PDC 2008

June 7th, 2008

Last year Microsoft announced the 2007 Professional Developers Conference (PDC) and I immediately booked the flights and hotel.  They then canceled the PDC.  Nevertheless I flew out to LA and had a great time spending a week immersed in technology, doing my very own “Personal” PDC, with no interruptions, spending all the hours I wanted.  It took me right back to the days before I was married, before I had kids, and I guess before I had a life.

Microsoft have just announced the 2008 PDC in LA, and I’ve signed up for it.  I’m pretty sure this one won’t get canceled.

If you are attending and feel like a chat about anything, including any of the products I’ve created such as MceFM, the ListSearch Extender, PromptSQL or J-Integra or anything else please email me at damian at atadore.com.

Over the last few months I’ve been working on an addin to Windows Media Center which lets you listen to Last.fm based off of the artists in your music collection (you can also enter arbitrary artists names etc.).

I wanted it to work when the user wasn’t running the MceFM application within Media Center, which meant creating a background application and a normal application.  That way you can listen to songs and watch your photo collection (for example).

Also, the Last.fm music streams don’t include the tags normally included in mp3 files, which let you see the track name, artist, album name, etc.  So what I did was to dynamically add these tags to the stream, which means that Media Center will shown all that information correctly.

All in all, a lot of fun to develop.  Now I just need to see if anyone cares :-)

More at http://www.mcefm.com/

WIX is an XML based installer generator, from Microsoft, now hosted in Sourceforge.

As part of an installation for a Vista based product I am creating, I needed to register an http namespace.  This is required in order to listen for incoming connections.  You can do this from the command line as described here: http://msdn2.microsoft.com/en-us/library/ms733768.aspx

I spent a day or so researching, and coding a Custom Action, which worked.  As I was in the final stages of integrating it into my WIX wxs file, I discovered a much simpler way of doing it, based on the way Microsoft Media Center applications are registered in the template code created in Visual Studio 2008 by the Windows Media Center SDK.

The first thing I did was to define a property which points to the fully qualified Netsh.exe tool:

<!-- This property uses an AppSearch to attempt to  -->
<!-- locate the file %windir\Netsh.exe              -->
<Property Id="NETSH" Secure="yes">
  <DirectorySearch Id="Netshdir" Path="[SystemFolder]">
    <FileSearch Id="Netshexe" Name="Netsh.exe" />
  </DirectorySearch>
</Property>

Then I defined a couple of properties that describe the Netsh commands to register and unregister the HTTP namespace.  You’d need to replace the port, ‘Test’ and possibly specify something else instead of ‘Users’:

<Property Id="NamespaceAddCmd"
          Value="http add urlacl url=http://+:123/Test/ user=Users"/>
<Property Id="NamespaceDelCmd"
          Value="http del urlacl url=http://+:123/Test/"/>

Next I define the custom actions used when installing and uninstalling. These are based on those used for registering MCE apps. The ‘…_Cmd’ actions set properties which are then used by the actions they target. This is because deferred actions can not access normal properties, only the CustomActionData property.  This is set by the ‘…_Cmd’ actions when they have a Property which names the custom action whose CustomActionData they target:

<CustomAction Id="CA_RegisterNamespace_Unregister_Install_Cmd"
              Property="CA_RegisterNamespace_Unregister_Install"
              Value="&quot;[NETSH]&quot; [NamespaceDelCmd]"/>
<CustomAction Id="CA_RegisterNamespace_Unregister_Uninstall_Cmd"
              Property="CA_RegisterNamespace_Unregister_Uninstall"
              Value="&quot;[NETSH]&quot; [NamespaceDelCmd]"/>
<CustomAction Id="CA_RegisterNamespace_Register_Cmd"
              Property="CA_RegisterNamespace_Register"
              Value="&quot;[NETSH]&quot; [NamespaceAddCmd]"/>
<CustomAction Id="CA_RegisterNamespace_Rollback_Cmd"
              Property="CA_RegisterNamespace_Rollback"
              Value="&quot;[NETSH]&quot; [NamespaceDelCmd]"/>

<CustomAction Id="CA_RegisterNamespace_Unregister_Install"
              BinaryKey="WixCA" DllEntry="CAQuietExec"
              Execute="deferred" Return="ignore" Impersonate="no"/>
<CustomAction Id="CA_RegisterNamespace_Unregister_Uninstall"
              BinaryKey="WixCA" DllEntry="CAQuietExec"
              Execute="deferred" Return="ignore" Impersonate="no"/>
<CustomAction Id="CA_RegisterNamespace_Register"
              BinaryKey="WixCA" DllEntry="CAQuietExec"
              Execute="deferred" Return="check" Impersonate="no"/>
<CustomAction Id="CA_RegisterNamespace_Rollback"
              BinaryKey="WixCA" DllEntry="CAQuietExec"
              Execute="rollback" Return="ignore" Impersonate="no"/>

Finally, these are the custom actions used in the InstallExecuteSequence:

<Custom Action=CA_RegisterNamespace_Unregister_Install_Cmd
        After=CostFinalize>
  <![CDATA[
NOT REMOVE]]>
</
Custom>
<
Custom Action=CA_RegisterNamespace_Unregister_Uninstall_Cmd
        After=CA_RegisterNamespace_Unregister_Install_Cmd>
  <![CDATA[
REMOVE AND ($Registration.xml = 2)]]>
</
Custom>
<
Custom Action=CA_RegisterNamespace_Register_Cmd
        After=CA_RegisterNamespace_Unregister_Uninstall_Cmd>
  <![CDATA[
NOT REMOVE]]>
</
Custom>
<
Custom Action=CA_RegisterNamespace_Rollback_Cmd
        After=CA_RegisterNamespace_Register_Cmd>
  <![CDATA[
NOT REMOVE]]>
</
Custom>

<Custom Action=CA_RegisterNamespace_Unregister_Uninstall
        Before=RemoveFiles>
  <![CDATA[
REMOVE AND ($Registration.xml = 2)]]>
</
Custom>

<Custom Action=CA_RegisterNamespace_Rollback
        After=InstallFiles>
  <![CDATA[
NOT REMOVE]]>
</
Custom>
<
Custom Action=CA_RegisterNamespace_Unregister_Install
        After=CA_RegisterNamespace_Rollback>
  <![CDATA[
NOT REMOVE]]>
</
Custom>
<
Custom Action=CA_RegisterNamespace_Register
        After=CA_RegisterNamespace_Unregister_Install>
  <![CDATA[
NOT REMOVE]]>
</
Custom>

Just in case it is of use to anyone, here is the custom action I coded up, although it is not needed with the above code:

#include <windows.h>
#include <msi.h>
#include <msiquery.h>
#include <Http.h>
#include <Sddl.h>

#pragma comment(linker, "/EXPORT:ReserveNamespace=_ReserveNamespace@4")
#pragma comment(linker, "/EXPORT:ReleaseNamespace=_ReleaseNamespace@4")

#define BUF_LEN 256

#define LOG true

UINT ReserveOrReleaseNamespace (MSIHANDLE hInstall, bool reserve) {
    HWND parentWindow = GetForegroundWindow();

    if(LOG) MessageBox(parentWindow, L"Called", L"ReserveOrReleaseNamespace", MB_OK);

    bool scheduled = MsiGetMode(hInstall, MSIRUNMODE_SCHEDULED);
    bool rollback = MsiGetMode(hInstall, MSIRUNMODE_ROLLBACK);
    bool commit = MsiGetMode(hInstall, MSIRUNMODE_COMMIT);

    if(LOG) MessageBox(parentWindow, scheduled ? L"True" : L"False",
        L"ReserveOrReleaseNamespace is MSIRUNMODE_SCHEDULED", MB_OK);
    if(LOG) MessageBox(parentWindow, rollback ? L"True" : L"False",
        L"ReserveOrReleaseNamespace is MSIRUNMODE_ROLLBACK", MB_OK);
    if(LOG) MessageBox(parentWindow, commit ? L"True" : L"False",
        L"ReserveOrReleaseNamespace is MSIRUNMODE_COMMIT", MB_OK);

    // Initialize HTTP
    HTTPAPI_VERSION httpApiVersion = HTTPAPI_VERSION_1;
    HRESULT error = HttpInitialize(httpApiVersion, HTTP_INITIALIZE_CONFIG, 0);
    if(error != S_OK) return error;

    // Get the custom action data
    // (only thing we can pass to deferred custom actions)
    wchar_t customActionData[BUF_LEN] = L"";
    DWORD customActionDataLen = BUF_LEN;

    MsiGetProperty (hInstall, L"CustomActionData", customActionData,
        &customActionDataLen);
    if(LOG) MessageBox(parentWindow, customActionData,
        L"ReserveOrReleaseNamespace CustomActionData is", MB_OK);

    wchar_t* semicolon = wcschr(customActionData, ';');
    if(!semicolon) {
        MessageBox(parentWindow,
            L"MceFM Namespace Reservation failed because the CustomActionData was incorrect",
            L"MceFM Namespace Reservation", MB_OK);
        return E_FAIL;
    }

    // Extract the user and URL
    wchar_t* user = customActionData;
    wchar_t* url = semicolon + 1;

    *semicolon = '';

    if(LOG) MessageBox(parentWindow, url, L"ReserveOrReleaseNamespace NR_URL is", MB_OK);
    if(LOG) MessageBox(parentWindow, user, L"ReserveOrReleaseNamespace NR_USER is", MB_OK);

    // Convert the user to a SID
    PSID pSID;
    DWORD sidSize = SECURITY_MAX_SID_SIZE;
    pSID = LocalAlloc(LMEM_FIXED, sidSize);
    WCHAR domainName[BUF_LEN];
    DWORD domainNameLen = BUF_LEN;
    SID_NAME_USE sidNameUse;
    BOOL worked = LookupAccountName(NULL, user, pSID, &sidSize, domainName,
        &domainNameLen, &sidNameUse);
    if(!worked) {
        error = GetLastError();
        if(LOG) MessageBox(parentWindow, L"LookupAccountName failed",
            L"ReserveOrReleaseNamespace", MB_OK);
        return error;
    }

    // Convert the SID to a string
    LPTSTR stringSid;
    worked = ConvertSidToStringSid(pSID, &stringSid);
    if(!worked) {
        error = GetLastError();
        if(LOG) MessageBox(parentWindow, L"ConvertSidToStringSid failed",
            L"ReserveOrReleaseNamespace", MB_OK);
        LocalFree(pSID);
        return error;
    }

    // Build a security descriptor in the required format
    WCHAR securityDescriptor[BUF_LEN];
    wsprintf(securityDescriptor, L"D:(A;;GX;;;%s)", stringSid);

    // Set up the config info (url and security descriptor)
    HTTP_SERVICE_CONFIG_URLACL_SET configInfo;
    configInfo.KeyDesc.pUrlPrefix = url;
    configInfo.ParamDesc.pStringSecurityDescriptor =  securityDescriptor;

    if(reserve) {
        // Add the namespace reservation
        error = HttpSetServiceConfiguration(0, HttpServiceConfigUrlAclInfo,
            &configInfo, sizeof(HTTP_SERVICE_CONFIG_URLACL_SET), NULL);
        if(error != S_OK) {
            if(LOG) MessageBox(parentWindow, L"HttpSetServiceConfiguration failed",
                L"ReserveOrReleaseNamespace", MB_OK);
        }
    } else {
        // Remove the namespace reservation
        error = HttpDeleteServiceConfiguration(0,  HttpServiceConfigUrlAclInfo,
            &configInfo, sizeof(HTTP_SERVICE_CONFIG_URLACL_SET), NULL);
        if(error != S_OK) {
            if(LOG) MessageBox(parentWindow, L"HttpDeleteServiceConfiguration failed",
                L"ReserveOrReleaseNamespace", MB_OK);
        }
    }
    LocalFree(pSID);
    LocalFree(stringSid);

    return error;
}

extern "C" UINT __stdcall ReserveNamespace (MSIHANDLE hInstall) {
    return ReserveOrReleaseNamespace(hInstall, true);
}

extern "C" UINT __stdcall ReleaseNamespace (MSIHANDLE hInstall) {
    return ReserveOrReleaseNamespace(hInstall, false);
}

Doug Reilly

December 25th, 2006

When I created this blog I decided to make it entirely technical.  No personal comments about what I was doing, etc.

I’ve decided to make an exception.

Last year I created a small software product, and as a result I was briefly in contact with Doug.  He asked me a series of questions and the resulting interview was published on-line.  He seemed like a nice chap, but I thought no more of it.

Next time I heard of him was in an excellent piece he wrote about how to deal with customers/clients/employers when you have cancer.  Solid, sound, practical advice.

He died yesterday.  I for one want to mark his passing.  The world is poorer for his absence.