Footprints in the snow of a warped mind

Tuesday, August 17, 2010

Where to find me

Flickr Icon  Twitter Icon  Linked In Icon  FaceBook Icon  Windows Live Alerts Butterfly  RSS 2.0 

The Site Doctor is Hiring!

Enjoy what you read here?
Think you can do better?
Join our team and get paid
up-to £35,000.
Apply now.

Tag Cloud

AJAX (4) Analysis (3) ASP (6) ASP.Net (59) Error Reporting (4) Web Service (2) WSDL (1) Atlas (2) Azure (1) Born In The Barn (1) Business (95) Business Start-up Advice (37) Client (17) Expanding Your Business (24) Recruitment (1) C# (25) Canoeing (4) Canoe Racing (5) Cheshire Ring Race (5) Racing (2) Training (4) Christmas (1) CIMA (1) Cisco (1) 7970G (1) CMS (1) Code Management (1) Cohorts (4) Commerce4Umbraco (1) Content (1) Content Management (1) Content Management System (1) CSS (4) dasBlog (5) DDD (2) DDDSW (1) Design (12) Icons (1) Development (28) Domain Names (1) eCommerce (13) Email (1) Employment (2) Festive Sparkle (1) General (39) Christmas (6) Fun and Games (11) Internet (22) Random (46) RX-8 (8) Git (2) Google (1) Google AdWords (1) Google Analytics (1) Hacking (1) Helpful Script (3) Home Cinema (2) Hosting (2) HTML (3) IIS (11) iPhone (1) JavaScript (5) jQuery (2) LINQPad (1) Marketing (6) Email (1) Multipack (1) MVC (3) Networking (3) Nintendo (1) Nuget (1) OS Commerce (1) Payment (1) Photography (1) PHP (1) Plugin (1) PowerShell (3) Presentation (1) Press Release (1) Productivity (3) Random Thought (1) Script (2) Security (2) SEO (6) Server Maintenance (7) Server Management (12) Social Media (2) Social Networking (3) Experiment (1) Software (11) Office (5) Visual Studio (14) Windows (6) Vista (1) Source Control (2) SQL (13) SQL Server (19) Starting Something New (2) Statistics (2) Stored Procedure (1) Sublime Text 2 (1) SVN (1) TeaCommerce (1) Testing (2) The Cloud (1) The Site Doctor (140) Turnover Challenge (1) Twitter (3) uCommerce (21) Umbraco (38) 2009 (1) 2011 (1) Useful Script (6) Virtual Machine (1) Web Development (72) WebDD (33) Wii (1) Windows Azure (1) XSLT (1)

Blog Archive


<August 2010>

Blog Archive

Various Links


Blogs I Read

[Feed] Google Blog
Official Google Webmaster Central Blog
[Feed] Matt Cutts
Gadgets, Google, and SEO
[Feed] Ol' Deano's Blog
My mate Dean's blog on my space, equally as random as mine but not off on as much of a tangent!
[Feed] Sam's Blog
Sam is one of my younger brothers studying Product Design and Manufacture at Loughborough, this is his blog :) Enjoy!

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

newtelligence dasBlog 2.2.8279.16125

Send mail to the author(s) Email Me (Tim Gaunt)

© 2015 Tim Gaunt.

Sign In

    # Tuesday, August 17, 2010

    Getting started with uCommerce

    Tuesday, August 17, 2010 5:49:45 PM (GMT Daylight Time, UTC+01:00)

    ucommerce-logo-symbol[1]I thought seeing as uCommerce is now an actual product I would start to overview an install/configuration of uCommerce assuming no prior knowledge of uCommerce. Firstly, let me start of by saying that once you've got your head around uCommerce and some of it's complexities, you'll find it a fantastic product that makes creating a new ecommerce website as easy as setting up a standard Umbraco website. It is still missing a few features, but you can easily work around these with a bit of custom XSLT/C#.

    Ok, back to setting up your first uCommerce website. I've grouped these into what I feel are logical sections but if I've missed something, please let me know.

    1. Install the uCommerce Package

    If you've not already done so, go to the uCommerce Download page and download the uCommerce package (at time of writing, I'm using and then download the uCommerce Store package (currently

    Install the uCommerce package as you do any other package in Umbraco. Once installed you'll be able to install the store package.

    Assuming all your permissions on your Umbraco install are correct, refresh your browser and you should have a new section "Commerce". If they're not right, you'll be told to add a few web.config settings.

    2. Wire up the catalog

    This is the step that I didn’t “do” when we first got started and it turns out it’s one of the most important steps as it joins the uCommerce catalog to the front end.

    1. Go to your Umbraco "Content" section
    2. Right click on the page you would like to be the store's "home" page (in the example store, this would be "Shop")
    3. Click "Manage hostnames" (see figure below)
      Manage Hostnames Context Menu
    4. Enter your hostname (the domain name the site runs on) in the "Domain" box and then choose the default language for the website
      Manage Hostnames screen
    5. Click "Add new Domain" and then "Close this window"
    6. Click the "Commerce" section button (in the bottom left)
    7. Click the little arrow to the left of "Product Catalog"
    8. Left click the relevant catalog (if you've installed the store package this will be "uCommerce")
    9. Select your new domain from the "Host name" drop down list
      Manage Hostnames screen
    10. Click the save disk button in the top left

    3. Setup Your Product Definitions

    A “Product Definition” is uCommerce’s concept of document types, it allows you to add additional information to the product. If you’re using the uCommerce starter store, you’ll get a couple of product definitions out of the box –software and support. At the moment, you can't add additional properties through the uCommerce back end (i.e. if you wanted to add additional information such as Meta Keywords/Descriptions etc -I'll cover how we got around this in a later post) but there are a number of default the category/product properties (I've put their XML reference in brackets where relevant):

    uCommerce Category Properties

    • Image (@image)
    • Display Name (@displayName)
    • Description (@description)

    The default XML looks like this:

    <category parentCategoryId="" parentCategoryName="" index="0" id="67" name="Software" displayName="Software" displayOnSite="True" description="" image="" />

    uCommerce Product Properties

    • SKU (@sku)
    • Internal name
    • Display on web site (@displayOnSite)
    • Allow ordering (@allowOrdering)
    • Thumbnail (@thumbnailImage)
    • Primary image (@primaryImage)
    • Display name (@displayName)
    • Short description (@shortDescription)
    • Long description (@longDescription)

    The default XML looks like this (the variants are not standard but are there because they're setup as part of the store package):

    <product index="0" sku="100-000-001" displayName="uCommerce 1.0 RTM" shortDescription="uCommerce is a full featured e-commerce platform with content management features powered by Umbraco. Everything you need to build a killer e-commerce solution for your clients!" longDescription="uCommerce is fully integrated with the content management system Umbraco, which provides not only the frontend renderendering enabling you to create beautifully designed stores, but also the back office capabilities where you configure and cuztomize the store to your liking.&#xD;&#xA;&#xD;&#xA;uCommerce_ foundations provide the basis for an e-commerce solution. Each foundation addresses a specific need for providing a full e-commerce solution to your clients. foundations in the box include a Catalog Foundation, a Transactions Foundation, and an Analytics Foundation.&#xD;&#xA;&#xD;&#xA;Each of the foundations within uCommerce_ are fully configurable right in Umbraco. No need to switch between a multitude of tools to manage your stores. It's all available as you would expect in one convenient location." thumbnailImage="1097" primaryImage="1097" allowOrdering="True" isVariant="False" displayOnSite="True" hasVariants="True" price="3495.0000" currency="EUR">
        <product index="0" sku="100-000-001" displayName="Developer Edition" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="001" price="0.0000" currency="EUR" Downloadable="on" License="Dev" />
        <product index="1" sku="100-000-001" displayName="30 Days Evaluation" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="002" price="3495.0000" currency="EUR" Downloadable="on" License="Eval" />
        <product index="2" sku="100-000-001" displayName="Go-Live" shortDescription="" longDescription="" thumbnailImage="0" primaryImage="0" allowOrdering="False" isVariant="True" displayOnSite="False" hasVariants="False" variantSku="003" price="3495.0000" currency="EUR" Downloadable="on" License="Live" />

    Adding additional product properties is simple.

    1. Click the "Commerce" section button
    2. Navigate to: Settings --> Catalog --> Product Definitions
    3. Choose the product definition you would like to edit (or create a new one in the same way that you would with Umbraco document types)
    4. Right click the product definition you need to add extra properties to and click "Create"
    5. Type in a name for your new property i.e. Size
    6. Choose the Data Type for the property (if you need something that's not listed see "Creating your own Data Type" below):
      • ShortText -A textbox
      • LongText -A text area
      • Number -Beleive it or not, a numeric value
      • Boolean -A checkbox
      • Image -A media selector
    7. Click the "Create" button
    8. You can now choose a few additional options for the new property including how it should be shown to the user and whether it's Multilingual.
      • Name -the text used as the label in the uCommerce product editor (it's also the name of the attribute on the XML that will contain it's value)
      • Data Type -the type of control to render in the uCommerce product editor
      • Multilingual -whether the control should be shown on the "Common" tab of the uCommerce product editor or the language specific tab
      • Display On Web Site -A flag that's sent out in the XML so you can decide whether or not to show it on the website
      • Variant Property -Whether this should appear as a table column heading under the "Variants" tab (I'll go into variants more in a later post)
        Note: Do not set Multilingual and Variant property to both true as at the moment, it won't be shown in the uCommerce product editor -you've been warned!
      • Render in Editor -Whether the control should be shown in the uCommerce product editor screen or hidden from the administrator (i.e. for data you want to use internally only and should be editable)
    9. Finally you'll need to enter in a Display Name for the various languages. This is what's shown to the user if you dynamically pull through the various properties on the product details page.

    4. Creating Your Own Data Type

    Now, you may be thinking that using that set of data types is a little limiting for something like "Size" or "Colour" and you might want to display something a little more flexible to the user -such as a drop down list. This is easy enough:

    1. Right click the "Data Types" node
    2. Enter a name i.e. "Size"
    3. Choose the definition for the Data Type (for size we will use "Enum")
    4. Save and Refresh the "Data Types" node
    5. Right click your new Data Type and click Create
    6. Enter your Option's value i.e. "Small"
    7. Repeat 5-6 until all your options are set i.e. add "Medium" and "Large"

    Note: At the moment, the enum values cannot be re-ordered through the UI so make sure you add them in the order you want them in the editor!

    5. Load Your Catalog

    Once you've finished creating your various product types, it's time to create your catalog. Creating categories and products within uCommerce is as simple as creating pages in Umbraco. Using the same right click menu concept you can create nested categories as deep as your catalog requires. You can add products and categories at any level by choosing either the "Category" or "Product" radio button and choosing your product type.

    6. You're Done!

    Assuming you've followed the steps above, you should now have a (fairly basic) store setup. Go to your site's homepage and click the "uCommerce" menu item and voila, your categories and products should be listed.

    Not getting the categories you were expecting? Perform the helpful xsl “copy-of” trick within either the "RootCategories[XSLT].xslt" file or "Category[XSLT].xslt" file:

    <pre><xsl:copy-of select="$categories" /></pre>

    and then have a look at the output:

    <errors><error>No product catalog group found supporting the current URL.</error></errors>

    If you're getting the above error, currently (and this may be a misunderstanding/changed later) you have to have the catalog and catalogue group names the same –in the example site, they’re both “uCommerce”.

    As I think the concept store offered with Software/Support isn't particularly real-world, I'm going to work on creating a basic store that you can use to better understand uCommerce and it's intricacies.

    Check back soon as I'll be posting an overview of the checkout process, the various XSLT files and integrating payment gateways into uCommerce (initially SagePay, PayPoint, WorldPay and PayPal).


    Don't forget to follow me on Twitter.

    # Thursday, August 12, 2010

    Using Linq and Extension Methods to chunk large data sets

    Thursday, August 12, 2010 9:32:44 AM (GMT Daylight Time, UTC+01:00)

    Ever needed to take a large list and split it into smaller subsets of data for processing? Well this is the Extension Method for you. Tonight we had to split a small dataset (500 items) into even smaller sets of 10 so the provider’s web service wouldn’t timeout.

    Seeing as I was going to miss out on my evening, I thought I’d see if I could do it a little differently using Linq and this is what I came up with:

    /// <summary>
    /// Simple method to chunk a source IEnumerable into smaller (more manageable) lists
    /// </summary>
    /// <param name="source">The large IEnumerable to split</param>
    /// <param name="chunkSize">The maximum number of items each subset should contain</param>
    /// <returns>An IEnumerable of the original source IEnumerable in bite size chunks</returns>
    public static IEnumerable<IEnumerable<TSource>> ChunkData<TSource>(this IEnumerable<TSource> source, int chunkSize)
        for (int i = 0; i < source.Count(); i += chunkSize)
            yield return source.Skip(i).Take(chunkSize);

    It should extend any IEnumerable and allow you to split it into smaller chunks which you can then process to your heart’s content.

    Here’s a quick example of it in use:

    var list = new List<string>() { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9", "Item 10" };
    Console.WriteLine("Original list is {0} items", list.Count);
    var chunked = list.ChunkData(3);
    Console.WriteLine("Returned the data in {0} subsets", chunked.Count());
    int i = 1;
    foreach (var subset in chunked)
        Console.WriteLine("{0} items are in subset #{1}", subset.Count(), i++);
        int si = 1;
        foreach (var s in subset)
            Console.WriteLine("\t\tItem #{0}: {1}", si++, s);

    And this will output

    Original list is 10 items
    Returned the data in 4 subsets
    3 items are in subset #1
    		Item #1: Item 1
    		Item #2: Item 2
    		Item #3: Item 3
    3 items are in subset #2
    		Item #1: Item 4
    		Item #2: Item 5
    		Item #3: Item 6
    3 items are in subset #3
    		Item #1: Item 7
    		Item #2: Item 8
    		Item #3: Item 9
    1 items are in subset #4
    		Item #1: Item 10

    2 lines of code to do all that work -Neat


    Don't forget to follow me on Twitter.

    # Monday, July 12, 2010

    Automatically add a show and hide link to any object with jQuery

    Monday, July 12, 2010 8:09:58 PM (GMT Daylight Time, UTC+01:00)

    jquery-logo_png[1]There are plenty of tutorials around that show you how to show or hide a div with jQuery, you can find a load on Google but I wanted something that was re-usable throughout our projects so I created the addShowHideLink jQuery plugin.

    We’ve been using it across a few projects including Crisis Cover for a while now and it’s catered for all our needs. Let me know if there’s any other options you want added.

    I’ve not published any of our plug-ins before so forgive me if there are some obvious errors but I figured someone else would find it useful.

    What does it do?

    Simple: It hides the specified object and adds a link that shows the object when clicked. It also swaps the show text to the specified hide text automatically.

    How do I use it?

    I’ve kept it as simple as possible but have hopefully given it enough functionality to suit your needs.

    Basic Usage


    Used with options

    		linkClass: 'showHideLnk',
    		paraClass: 'showHide',
    		openClass: 'showHideOpen',
    		showText: 'Show Advanced Options',
    		hideText: 'Hide Advanced Options',
    		linkActions: function(){
    			alert('The link was clicked');


    How do I get it?

    I’ve uploaded a more complete example to: http://blogs.thesitedoctor.co.uk/tim/Plugins/addShowHideLink/ so you can get a quick idea of what it does.

    You can download the plug-in here.

    Thanks to Trevor Morris for his jQuery skeleton starter framework.


    Don't forget to follow me on Twitter.

    # Wednesday, June 30, 2010

    Helo command rejected: need fully-qualified hostname when sending emails

    Wednesday, June 30, 2010 4:20:08 PM (GMT Daylight Time, UTC+01:00)

    Simple tip this afternoon. You may have got the following error when sending emails through ASP.Net’s built in mail server before:

    From: postmaster@YourWebserversName [mailto:postmaster@YourWebserversName] 
    Sent: 25 June 2010 13:22
    To: sender@sendingdomainname.com
    Subject: Delivery Status Notification (Failure)
    This is an automatically generated Delivery Status Notification.
    Delivery to the following recipients failed.
    Reporting-MTA: dns;YourWebserversName
    Received-From-MTA: dns;YourWebserversName
    Arrival-Date: Fri, 25 Jun 2010 13:21:30 +0100
    Final-Recipient: rfc822;recipient@recievingdomainname.com
    Action: failed
    Status: 5.5.0
    Diagnostic-Code: smtp;504 <YourWebserversName>: Helo command rejected: need fully-qualified hostname


    The fix is easy:

    1. Open IIS
    2. View the properties of you Default SMTP Virtual Server
    3. Go to the “Delivery” tab
    4. Click the “Advanced” button (in the bottom right corner)
    5. Under “Fully-qualified domain name” enter a domain name that points to the server
    6. Click Ok until you’re back to IIS

    Don't forget to follow me on Twitter.

    # Thursday, June 17, 2010

    Set Umbraco Folder Permissions with Powershell

    Thursday, June 17, 2010 2:47:22 PM (GMT Daylight Time, UTC+01:00)

    powershell2xa4[1] If you're not configuring Umbraco through a web installer, you've had your installs in place for years and never checked the permissions or whoever set the permissions up was lazy and gave IIS write access to the entire folder, there will come a time when you want to restrict modify access to just those user(s) who should have access.

    You can find a (pretty) complete list of the files/folders that the Umbraco install should have access to here but assigning them across 101 different installs is a PITA . Thanks to a helpful PowerShell script to set folder permissions from PowerShell.nu you can easily automate the process.

    For those of you not familiar with PowerShell (like me) complete instructions are below. For the rest, here's the command:

    Get-ChildItem -path ##PATH TO YOUR INSTALL## 
    | Where { $_.name -eq "Bin" -or $_.name -eq "Config" -or $_.name -eq "Css" -or $_.name -eq "Data" -or $_.name -eq "Masterpages" -or $_.name -eq "Media" -or $_.name -eq "Scripts" -or $_.name -eq "Umbraco" -or $_.name -eq "Umbraco_client" -or $_.name -eq "UserControls" -or $_.name -eq "Xslt" } 
    | ForEach {./SetFolderPermission.ps1 -path $_.Fullname -Access "NETWORK SERVICE" -Permission Modify}



    1. Save the SetFolderPermission.ps1 script to your server
    2. Open your PowerShell console (I think it's installed by default if not, you can download PowerShell here)
    3. Copy the above PowerShell command into notepad
    4. Update "##PATH TO YOUR INSTALL##" to your Umbraco install
    5. If your IIS install doesn't use NETWORK SERVICE as the default user, update it to your user
    6. Make sure it's all on a single line
    7. Copy/Paste/Run in PowerShell


    If you're uber lazy and just have a web folder of Umbraco installs you can set the path to the folder of Umbraco installs and use:

    Get-ChildItem -path ##PATH TO YOUR FOLDER## -recurse
    | Where { $_.name -eq "Bin" -or $_.name -eq "Config" -or $_.name -eq "Css" -or $_.name -eq "Data" -or $_.name -eq "Masterpages" -or $_.name -eq "Media" -or $_.name -eq "Scripts" -or $_.name -eq "Umbraco" -or $_.name -eq "Umbraco_client" -or $_.name -eq "UserControls" -or $_.name -eq "Xslt" } 
    | ForEach {./SetFolderPermission.ps1 -path $_.Fullname -Access "NETWORK SERVICE" -Permission Modify}


    I've not tried this mind you and can't recommend it but hey, it's there if you want it ;)


    Don't forget to follow me on Twitter.

    # Wednesday, April 21, 2010

    Stop jQuery.hide() showing the elements on page load

    Wednesday, April 21, 2010 10:30:25 PM (GMT Daylight Time, UTC+01:00)

    This is a great little tip that Andy Higgs shared with me a couple of months ago while we were developing Crisis Cover. If you write jQuery that hides the div when the user has JavaScript enabled, you can avoid the divs all being shown while the page loads by simply adding a class to the body of the page using jQuery and hide it using CSS like so:

    <!-- Reference to jQuery here -->
    <!-- This should be the first bit of code and don't wait until the page has loaded -->
    <script type="text/javascript">$('body').addClass('js');</script>
    <!-- The rest of your code here -->
    <div class="jsHide">
    	<p>This paragraph is hidden if the user has JavaScript enabled.</p>


    Then you just need to add the css:

    .js .jsHide

    Your divs will now be hidden until you show them with JavaScript. Nice, simple solution to an ever annoying problem.

    Note: For my demo to work you'll need to include jQuery

    Update: As pointed out by Petr below and Andy Higgs/Trevor Morris, it would be better to target using JavaScript without jQuery and target the body for maximum flexibility (note the space at the front in case there is already a class):

    <script type="text/javascript">document.getElementsByTagName('html')[0].className+=' js'</script>

    Don't forget to follow me on Twitter.

    # Sunday, April 18, 2010

    Error 11: An error occurred when merging assemblies: ILMerge.Merge: ERROR!!: Duplicate type 'xyz' found in assembly 'App_Web_rh2sxhkc'. aspnet_merge

    Sunday, April 18, 2010 12:47:20 PM (GMT Daylight Time, UTC+01:00)

    You may have come across this error once or twice while deploying your project if you develop using Web Deployment Projects. It's usually caused when you copy and paste a page and forget to update both the page declaration and code behind file.

    But the website builds!?!

    You don't usually get the ILMerge error until you build the web deployment project because when you build a website directly, it doesn't compile all the code into a single assembly so the class names are seen as different. Part of the web deployment process is to compile all the websites code into a single assembly hence the duplicate references.

    What's the solution?

    It's surprisingly simple, all you need to do is open up the offending aspx and aspx.cs files and update two lines:

    1. In the code behind file, rename the partial class. By default Visual Studio will name the class FolderName_Pagename which should result in a unique name

    2. The page declaration (first line of the page) in the aspx file. You have to make sure that both the Inherits attribute and CodeBehind reference are correct.

    Tip: To avoid confusing yourself, open the files independently using the solution browser because if you open the aspx and press F7 to switch to the code behind file before updating the page declaration, you'll end up editing the page you copied rather than the copy.


    Don't forget to follow me on Twitter.

    # Wednesday, April 14, 2010

    The Umbraco 1 question questionnaire results

    Wednesday, April 14, 2010 7:18:47 PM (GMT Daylight Time, UTC+01:00)

    A while ago I posted a quick one question questionnaire to gauge how much people were charging for the "average" Umbraco install. This was partially to settle an internal debate but also for an post I've not had time to post yet so in the meantime I'll post the results.

    Having a quick look at the results you'll see that 64% of the people that answered (around 100) charge £2,500 or less for a "standard" install with a whopping 96% of people charging less than £10,000. I'll explain how this can be used for pricing your Umbraco packages soon!


    Don't forget to follow me on Twitter.