Author Archives: Alexander John

About Alexander John

I am an IT Professional and Web Developer living and working in the United Kingdom. I describe myself as an IT generalist as I have worked in a wide variety of IT and web fields and technologies. Whilst I am Microsoft Certified Professional (MCP), I utilise a wide variety of technologies including Linux and Android in day-to-day work. I am a founder and director of a SME orientated Web service company Calzada Media Limited where my daily workload varies from web development through to IT infrastructure management.

WebsitePanel and MySQL 5.5 Configuration Error

If you try and configure the MySQL 5 service in WebsitePanel 1.2.1 you may get the following error message:

System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.IO.FileNotFoundException: Could not load file or assembly 'MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.

This error is down to WebsitePanel looking for a specific version ( of the MySQL .Net Connector.  In all likelihood, you will have installed either a later version (at the time of writing it is 6.5.4).

Thankfully, this is error is easy to fix and only requires modifying a couple of configuration files.  Add the following code snippet at the end of the web.config files before the closing </configuration> tag for both WebsitePanel’s server and portal components (the default paths are c:\websitepanel\server and c:\websitepanel\portal respectively):

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" />
<bindingRedirect oldVersion="" newVersion="" />

If you are using a version of the .Net Connector later than, then do amend the bindingRedirect newVersion property.

Detecting mobile browser in ASP.Net

Detecting mobile browsers can be a bit of pain.  Whilst it is relatively easy to get browser information through the User Agent string, it is not such a simple task to identify the client device type.  There is no defined property within the user agent field that says I’m a mobile device.  User Agent values differ widely between devices and browsers, so it is necessary to use some less than elegant detection code.

I recently added this detection functionality to the Camino CMS Framework, and Calzada’s preferred method is using regular expressions.  After some playing, we came up with the following regex:

(?i)(android(?:.+mobile)|applewebkit.+(?:\(KHTML, like Gecko){1}|avantgo|blackberry|blazer|docomo|elaine|fennec|htc|kindle|lge|linux.+armv|mmp|mms(?:.+midp){1}|mobile|mot(?:.+midp){1}|nintendo.+(?:3ds|wii)|nokia|nook|opera(?:.+mini|.+mobi){1}|palm|polaris|phone|ppc|psp|samsung|sec|sony|symbian|tablet|up\.browser|vodafone|wap|webos|windows(?:.+ce|.+mobile){1}|xda|xiino

A simplified ASP.Net detection code would look something like this:

Function IsMobileBrowser() As Boolean
Dim regex As New Text.RegularExpressions.Regex("(?i)(android(?:.+mobile)|applewebkit.+(?:\(KHTML, like Gecko){1}|" & _
"avantgo|blackberry|blazer|docomo|elaine|fennec|htc|kindle|lge|linux.+armv|mmp|mms(?:.+midp){1}|mobile|mot(?:.+midp){1}|" & _
"nintendo.+(?:3ds|wii)|nokia|nook|opera(?:.+mini|.+mobi){1}|palm|polaris|phone|ppc|psp|samsung|sec|sony|symbian|tablet|" & _
"up\.browser|vodafone|wap|webos|windows(?:.+ce|.+mobile){1}|xda|xiino", Text.RegularExpressions.RegexOptions.IgnoreCase)
Return regex.IsMatch(HttpContext.Current.Request.ServerVariables("http_user_agent").ToString)
End Function

There are a couple of key points to bear in mind with this method:

  1. It is not perfect.  No matter how you tailor and tweak the regular expression, you are inevitably going to get some false positives and false negatives.
  2. This is not a write and forget function.  As the number of mobile devices and manufacturers proliferate, the accuracy of the regular expression will diminish.  To compensate, it is necessary to regularly review, test and update where required.  To ensure that this is done, this process has been added this to the Camino development lifecycle.
  3. Not all mobiles or mobile users may wish to use mobile variant of a website.  Do bear in mind that some tablets have a sufficiently large screen to view the normal version of a website.
I am aware that this is not an elegant nor wholly accurate solution, and there are plenty of programmers out there that will view it as a kludge, but in many ways it is a product of its’ ingredients.  Until such time when all browsers will provide a property that simply states I’m running on a mobile device, then this will have to do.

Starting off with WebsitePanel

There are a whole gamut of hosting control panels available.  I have used quite a few of them, and to be fair, none have really satisfied the criteria of being easy to use, powerful and responsive.  The only one that I have vaguely liked to date is Helm 3.  The less that said about Helm 4, the better.

Now, I will accept that I am being a little unfair with the last criteria.  A substantial proportion of a control panel’s response time is taken up by calls on other services, often based on separate hardware.  When you take this into consideration, Hosting Control Panels (HCPs) do succeed in corralling together and presenting management capabilities for multiple services (often from differing providers) in a single interface.  What very few have done is present an interface that is easy to use both from an administrative and end-user perspective.

And this is the critical point.  HCPs are primarily for use by end-users, not administrators, but this is something that is still regrettably not addressed by developers.  End-users often have a poor level of technical literacy, and very few are prepared to wade through tiered menu levels following obscure technobabble.  They just want to create an e-mail account.  Why can’t they just log in and get presented with an Add E-mail Account link?

At Calzada, we are determined to make life simpler for our hosting customers, and admittedly, ourselves.  A good HCP will not only make life easier for our customers, but potentially reduce the number of control panel related support queries.  Therefore, the choice of hosting control panel was critical.  I also have to admit that price is also a controlling factor.  We are a small company, and cannot realistically justify some of the prices being charged for the likes of Plesk and cPanel/WHM.

Unlike in *nix world, open source Windows HCPs are a rarity.  The only real choices are zPanel or WebsitePanel.  After some testing, we opted for the latter as WebsitePanel supported a wider variety of applications than zPanel, and did appear to be more mature.

WebsitePanel is not perfect and there is undoubtedly room for improvement in some areas.  We have experienced a number of glitches that have required workarounds – more posts to come on these – but the overall experience has been fairly good.  The installation program worked like a dream and was noticeably quicker than some of its’ commercial competitors.  I have to admit to warming to WebsitePanel; it does what it is expected to do and it is fairly easy to use for both administrative and end-user purposes.






IIS FastCGI Fatal Error: Allocated memory size exhausted

Traditionally IIS and PHP have not mixed particularly well.  Things have gotten a lot better since the arrival of FastCGI and the Web Platform Installer, but there are still occasions when something occurs which flummoxes an ASP.Net guy like myself.

I recently moved this blog onto a Windows 2008 R2 server running IIS 7.5.  I’ll admit that I wasn’t really expecting any problems as I had already moved a MyBB forum onto the same server without any problems.  My normal level of IT paranoia had taken a leave of absence as I made the assumption that MyBB would be a far more demanding PHP application than WordPress, so there shouldn’t be any issues.

You know what they say about assumptions?  After all the data and files had been migrated I fired up my browser and initially got a blank page in return.  By default, FastCGI PHP does not return error messages – it is after all running on a production server.  So I dropped the following code into the top of the wp-config.php to manually enable errors.


This duly returned the following error message:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 261904 bytes) in C:\inetpub\HostingSpaces\alexanderjohn\\wwwroot\wp-includes\functions.php on line 2109

Now, any quick Google search on this will immediately return a series of results all recommending the solution being to increase the memory_limit value in the php.ini from 128MB as the likely source is probably memory leaks in PHP.  This did seem a little counter intuitive – does WordPress really need that much memory?  I duly increase it several times, and each time I got a variation on the above error – all that changed was the Allowed memory size value increased to match the memory_limit value.

My next step was to check the various application pool settings.  They were all fine, and the site still refused to work with a new, dedicated pool.

Realistically, this only left WordPress as the culprit.  I duly downloaded the latest version and performed a manual upgrade.  Still no luck.

I then stripped out all the additional plugins and themes that were installed, and Hey Presto!, there was life.

I don’t know which plugin caused the problem as I have taken this opportunity to re-evaluate every plugin I was using.  This is something that I hadn’t done in a while, and to be honest, was well overdue.

As for the root core cause.  I would suspect that this down to some form of infinite loop.  If it is so, I am amazed that some developers are still adding iterations without some form of safety net.  At Calzada, it is actually part of our coding practice that any loop that has the potential of going infinite has some form of safety net.  At the end of the day, it is very hard to look professional to a customer when a product fails because of a very simple coding error.

MySQL Powershell Backup Script

This is easily one of my most commonly used Powershell scripts, and a variation on it runs on my servers at least once a day.  It is essentially a very simple script: it contacts a specified MySQL server and then generates a .SQL backup files for each database found.  It prefixes each backup filename with the day name (monday, tuesday etc.) so if you run it on daily basis, it gives you a seven day backup rotation for your databases.

As always, the use of this script and the accompanying files is done entirely at your own risk. No guarantee either direct or indirect is implied regarding the security, stability, reliability, impact or performance of this script.

The zip file includes copies of mysqldump.exe and that you may require.  For details on how to configure and use the script, please see below.

Download the script (ZIP file)


There are a few items you will need to configure before you can use the script in anger.  All of the configuration options are presented at the top of the script, so you don’t need to delve into the main chunk of code.

Backup Store Folder

This is where the MySQL backup files will be placed.  Please enter the path here, but do not include any trailing ‘\’

MySQL User Account

You will require a MySQL user account that has SHOW DATABASES, SELECT, LOCK TABLES and RELOAD permissions.  It is also highly advised – especially if performing backups from a remote machine – that this user’s permissions are also limit to readonly.

mysqldump Path

mysqldump is the application that actually creates the backup file.  It is typically installed with MySQL, but if you are running the script remotely or don’t know the file’s location, mysqldump.exe is included in the ZIP file.

MySQL .Net Connector

The script requires the MySQL .Net Connector driver.  This can either be installed, or you can directly load the DLL file.

Using the connector

  1. Download and install the connector from
  2. Uncomment Line 38 of the script.  This should say system.reflection.assembly]::LoadWithPartialName(“MySql.Data”)
Loading the library directly (the default method)
If you don’t wish to install the .Net driver, you can directly load the DLL file instead.  The required DLL file is included as part of the ZIP file.
  1. Uncomment line 43 of the script.  This should say Add-Type -Path “C:\Data\Backups\MySQL\MySql.Data.dll”
  2. Amend the path of line 43 to point to the location of the DLL file

Running the script

You can either run the script manually (through Powershell), or automate it through Task Scheduler.  To make life a little easier I tend to create a batch file containing the Powershell command and then invoke the batch file through the task scheduler.

The general format of the command to include in the batch file is

%windir%\System32\WindowsPowerShell\v1.0\powershell.exe “c:\backups\Generic7DayBackup.ps1”


This is by design a very simple script.  If you have any suggestions on how to improve it, please let me know by posting a comment.


Setting up a forum – not as easy as you might think

Several of years ago, when working for a now defunct company, a customer wanted to add a forum to his website.  That’s easy the boss said, and a colleague duly installed one of the many free to use forums.  As we weren’t managing the forum beyond the installation of the software, we paid little or no heed to the initial configuration of the forum.  As a casual forum visitor, I guess I assumed that starting up a forum would just as easy as using it.

I was wrong.  In the last couple of weeks, Calzada Media has been working towards the launch of a new online forum for the local cricket community called LegStump.  LegStump is all about building online cricket communities between the grass roots supporters and players: the local village and community teams who play cricket for simple enjoyment.

It would have been easy to upload any forum software and then configure it on the hoof.  Such an approach doesn’t mean you’re doing anything especially wrong but you are lining yourself for some potentially big problems in the future.

So, we took the other road and took our time applying the normal Calzada project management processes.  Only when we were happy with a version of the forum running on our development servers, did we even consider moving it into the live environment.

With our experience fresh in the memory, here are our recommendations for those, like us, starting our with their first forum:

Choose your forum software wisely

This will be your biggest and most important choice.  Once you have deployed a forum, migrating to a different software package is a challenging prospect, not only for you, but also for your members.

Based on our experience, we advise:

  • Be aware of your limitations and knowledge – For example, don’t use a Perl based forum if you have never used Perl.
  • Taken into consideration the hosting platform upon which you will run your forum.  If you already have web hosting, then bear in mind your package’s functionality and capabilities.  If you don’t have hosting, you do need to consider potential hosting costs.
  • Look for a consistent and high quality user experience for all grades of members.
  • Can the forum software be extended?  Are there a good range of modifications, plugins and themes available?
  • How easy and capable are the forum’s management capabilities?

Whatever software you choose, be sure to evaluate the software prior to deployment.  With LegStump, there were a number of forums we liked but it was through testing and evaluation we narrowed down our choice to MyBB.

Prepare and publish your rules, guidelines and legal notices

This is an area that often overlooked.  Without stated rules and guidelines, you run the very real risk of losing control of the discussions and content on your forum.  You should not only clearly define your forum’s rules and guidelines, but also place them at a location where everyone including non-members can read them.

At LegStump, we currently operate under four principal legal documents:

It is also worth noting that these rules and guidelines apply to all users irrespective of their roles or positions within the forum.


The wrong design or theme will drive members away as quickly as the improper choice of forum software.  You chosen design should:

  • Reflect the tone of your forum’s content
  • Be easy on the eye – no big clashes of colour
  • Not unduly affect the performance of the software

Enhance the capabilities of your forum with plugins 

Do check out the range of modifications or plugins that are available for your chosen forum software.  You may be surprised just what are available and how they will enhance your forum.

With LegStump, we have utilised nearly 10 mods to improve both the user experience and also management capabilities.


Happy New Year

A day late, but Happy New Year and best wishes for the year ahead.

2011 was a year of great change across the globe and anxiety for many (especially for us folks in Europe!).  Some commentators have suggested that it is a year to forget.  I disagree.  In many ways we should be thankful that 2011 is over, but we should not forget the events that defined it.

The Tsunami in Japan whose effect will be felt for future generations.  The Arab Spring where successive totalitarian governments were toppled like Dominoes.  The killing of Osama Bin Laden.  The continuing Euro crisis that will almost certainly never be resolved fully – I smell a Heath Robinson half-baked euro-bodge-solution in the coming months.  These are just some of the events that have profoundly reshaped the world we live in.  I suspect that in the future, 2011 will be viewed as the turning point where the world truly started to become less West-centric.  The economic emergence of the BRIC nations at the time of the decline of the European block has all but ensured that this scenario will come true.

Every year has defining events.  2011 stands out due to the sheer and almost incessant number of events, spread out across the world affecting a significant proportion of the global population.

Here’s to hoping that 2012 will be a great year.

A new location, a new name

We’ve moved!  And just to add some extra confusion, we’ve changed our name as well! Well, at least this blog has.

First, the change of location.  As I’m now doing work for companies other than Whiteleaf Networks, I’ve moved this personal blog outside of its’ domain and nominal purview*.  Although future posts may touch on work done with Whiteleaf Networks or any other company, they will neither be official or approved.

Changing the name is mostly about appearance and perception.  The original name of CrossNotes was a vague pun on the origin of the name Whiteleaf Networks (if you don’t know, above the village of Whiteleaf there is a large cross cut into the chalk hillside).  However, it does give the impression that I’m always slightly miffed at the world or life in general (which I don’t think I am).  Also, as this blog is becoming a little more personal, it does make sense to stick my name at the top.

So what is to come?  I’ll be expanding the subject matter to include web design & development and perhaps a few more esoteric topics.  I do have some IT posts in the works including an updated version of a powershell script to automate the backups of Hyper-V Virtual Machines.

* For the purposes of transparency, this blog/domain is still hosted by Whiteleaf Networks

Configuring RAID1 on LG N2A2 NAS

I recently purchased an LG N2A2 2 Bay NAS to use as my primary disk to disk backup solution.  As per LG’s recommendation – a big shiny sticker on the box – I upgraded the firmware to the latest version before using the NAS in anger.  This new firmware (6674) has a far improved interface and capabilities than than provided with the firmware shipped with the NAS.  The downside is that all of the online help documentation is in Korean.

As my knowledge of Korean is non-existent, working out how to configure the NAS’ disks to RAID1  required more than a little help from Google Translator.  Detailed below is how I configured RAID1.  As usual, this information is provided “AS IS” and you use it at entirely your own risk.

Caution: ensure you backup all data on the NAS prior to performing this task.  This process will irretrievably wipe all existing data you may have stored on the NAS.

1. Log into the web management interface of the NAS using the admin username and password (by default this is ‘admin’ and ‘admin’).

2. On the homepage of the web interface, click on the Volume option.  If it is not present, go to the Configuration section via the links on the left of the page to find it.

3. If your NAS volumes have never been altered from their as shipped state, the volumes list should contain two separate volume (see screenshot 1).

NAS RAID Screenshot 1

Screenshot 1

To configure RAID1, both of these volumes must be deleted.  Click on the Delete button next to each volume to do this.  You will be prompted to confirm the deletion (see screenshot 2).  Enter the admin password and click on *OK* to confirm the volume deletion.  Once deleted, a confirmation message will appear (see screenshot 3).

Screenshot 2

Screenshot 2

Screenshot 3

Screenshot 3

4. Once both volumes have been deleted, the volumes list just show the two unused disks (see screenshot 4).  To start creating the RAID1 volume, click on the Create New Volume button.

Screenshot 4

Screenshot 4

5. The next dialog will list the available unused disks.  Click/select both Disk 1 and Disk 2.  By default, the option RAID1: data protection/duplication structure should automatically be selected under 2. Select a volume formation type, if not, select it (see screenshot 5).

Screenshot 5

Screenshot 5

6. The create new volume dialog is actually larger than its’ containing window.  To proceed, scroll down using the scroll bar on the right and click on the Create Volume button to start the RAID1 creation process (see screenshot 6).

Screenshot 6

Screenshot 6

7. The creation process will now begin.  A small dialog will appear showing the progess of the volume creation (see screenshot 7).  Once completed, this dialog will update to display an OK button.  Click on this button to continue.

Screenshot 7

Screenshot 7

8. You will not be returned to the volume listings which will show a single volume comprising of two disks in RAID1 formation (see screenshot 8).

NAS Screenshot 8

Screenshot 8

Important: The volume is not yet ready for use.

Please note the status message of Volume is being created. (Creating Raid) 0% in screenshot 8.  The new volume is still being configured for RAID.  Only start writing data once this status value changes to normal  (see screenshot 9).  This process may take several hours, and the status message does not dynamically update.  You will need to close the Volume window and then re-open it to get an up-to-date status message.

NAS RAID Screenshot 9

Screenshot 9


Getting HDMI sound working on an ASUS ATI/AMD 4350

When I built my HTPC earlier this year, I replaced the elderly graphics card within the old chassis I was using with an ASUS 4350.  I don’t pretend to be anywhere near an expert on graphics cards, but the limited research I did led me to believe that this card would be ideal.  Relatively cheap, passively cooled and delivered full HD via HDMI.

What I did not know then, but what I discovered following installation, is that this card does not output sound via HDMI without some driver jiggery-pokery.  You would see a message similar to this one in the Sound properties dialog within Windows.

In short, neither the supplier driver nor the updated Catalyst drivers from AMD/ATI include the relevant Realtek audio driver.  The solution is relatively simple: you download and install the latest HDMI audio driver from Realtek.

This is what I did earlier this year and my HTPC worked without a hitch until I mistakenly updated the AMD/ATI Catalyst drivers through Microsoft Update which promptly broke it.  Needless to say, I hadn’t written down how to get this working so I had to find out all over again from scratch.

Disclaimer: It is not generally recommended to download and install drivers directly from OEMs.  Your first port of call should be the company that manufacturered the product you are using (in this case ASUS).  If you follow these steps, you are doing so entirely at your own risk.

  1. (Optional) Head over to AMD and grab the latest Catalyst drivers for the card (
  2. Go to Realtek’ High Definition downloads site (
  3. Check/tick the option Iaccept to the above and then click on the Next button.
  4. Scroll down the list ofWindows drivers until you find the entry ATI HDMI Audio Device (it will be in red text).  Click on one of the three download links to the right to download the driver.
    • There are a couple of possible gotchas when downloading
      1. Last time I tried, none of the US download locations worked.  The links just redirected back to step 2 above
      2. The downloads are FTP transactions that can take upto several minutes to stat.  So don’t worry if nothing happens immediately.
  5. Once downloaded, install the driver.  You should be prompted to restart your computer once completed, if not, do so anyway.
  6. Upon restart, sound may still appear to be disabled.  The trick here  is to pull out the HDMI connection and then replace it.  Once this is done, the HDMI sound connection should be detected and work.


The moral of this particular story:  Sometimes, it is necessary to document things you do with your home systems.