Archive for October, 2010

Creating a GUI in Powershell

October 29, 2010 Leave a comment

$form = new-object System.Windows.Forms.form
$Form.text = “Hello World!”

There you go, a bit of powershell script that shows a graphical user interface… Not elegant, but possible.

Categories: Uncategorized

401 Not Authorized For MSDEPLOY‏ (msdeployAgentService)

October 29, 2010 16 comments

When you get this error from msdeploy:

“Error: The remote server returned an error: (401) Unauthorized.”

you need to give the remote user elevated rights to get authorization.

To disable UAC remote restrictions, follow these steps:

  1. Click Start, click Run, type regedit, and then press ENTER.
  2. Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
  3. If the LocalAccountTokenFilterPolicy registry entry does not exist, follow these steps:
    1. On the Edit menu, point to New, and then click DWORD Value.
    2. Type LocalAccountTokenFilterPolicy, and then press ENTER.
  4. Right-click LocalAccountTokenFilterPolicy, and then click Modify.
  5. In the Value data box, type 1, and then click OK.
  6. Exit Registry Editor.
Categories: Uncategorized

Cannot serialize member because it implements IDictionary.

October 29, 2010 Leave a comment

If you ever get an error like Cannot serialize member x of type T, because it implements IDictionary. or something similar whenever you try to return an serialize object with xmlserializer.

Note: This isn’t suitable for webservice use, since the schema is lost.

using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Soap;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

/// <summary>
/// A Web-service friendly version of the  object
/// </summary>
public class XmlSerializable<T> : IXmlSerializable
    public T RawObject;

    public XmlSchema GetSchema()
        return null;

    public void ReadXml(XmlReader reader)
        var formatter = new SoapFormatter();
        var strXML = reader.ReadInnerXml();
        var msXML = new MemoryStream(Encoding.Default.GetBytes(strXML));
        RawObject = (T)formatter.Deserialize(msXML);

    public void WriteXml(XmlWriter writer)
        var formatter = new SoapFormatter();
        var ms = new MemoryStream();
        formatter.Serialize(ms, RawObject);
        ms.Position = 0;
        var sr = new StreamReader(ms);
        var strXml = sr.ReadToEnd();

Then,  instead of returning T, returns XmlSerializable<T>, and the client accesses the RawObject member of this class to read the return value.

Categories: Uncategorized

Customizing Tem Web Access for TFS2010

October 28, 2010 Leave a comment

Here are a few tips that I’ve learnt on how to customize Team Web Access for TFS2010

  • To Add a new page:

using Microsoft.TeamFoundation.WebAccess.UI;

then inherit from WebAccessPage

Then use  the MasterPageFile=”~/UI/Masters/Content.master”


  • To Select a tab within the page use:

ActiveTab = “Some Tab Name“;

  • To Get the logged in username



Categories: Uncategorized

Default controller cannot be deleted because there are builds in progress

October 27, 2010 2 comments

If you’re working with TFS 2010, and you get this message “default controller cannot be deleted because there are builds in progress” when trying to remove a build controller, you should of course check first to see if you can stop the build through the interface, but you can force the issue by running this query in the TFS_DefaultCollection database

update tbl_BuildQueue set status=16

This sets all builds to a status of cancelled.

Or if you prefer, do a select from tbl_buildQueue, and find any one that has a status of 1 (in progress) or 2 (Queueud).

Here are all the statuses

0 – None

1 – In progress

2 – Queued

4- Postboned

8 – Completed

16 – Cancelled





Categories: Uncategorized

How page load times can affect conversion rates

October 14, 2010 Leave a comment

I spotted that over the last two weeks my conversion rate had dropped from 21% to 18%, meaning that on average 3% less people were actually using my website after they came to it.

For me, conversion rate either stayed within a +/- 1% range unless the site crashed completely, when it would drop to 0%. A slow decline in conversion rate was very unusual. Note that conversion rates have nothing to do with visitor numbers, so whether this applied to 100 ot 1,000 users, it’s always the same.

One thing that had happened about a month ago, was that my Users database exceded the 4GB limit of SQL express, and was unfortunately lost in a failed backup-restore procedure, the new Users database was hastily constructed to get the site back up and running quickly.

At the start, no problems occurred, but since there is now 1.3 Million rows in the users table, lookups became increasingly slow. A single update took 10 seconds to complete, and the front page performs one update, therefore slowing the front page by 10 seconds.

To my mind, 10 seconds is too long to wait for a web page, and 3% of people must have got tired, and left the site before using it.

So, I went into the database, ran an sp_help on the users table, and found no index on the ID column, which lookups were being perfomed, so

create index idxUsersId on users (id)

Sped up the update from 10 seconds to under 1 second, and the front page now loads in 1.09 seconds, rather than 10.


The following day, conversion rates have risen back to 21.63%, the second-highest all month, and recorded traffic increased by 500 users.



Categories: Uncategorized

Running an App from Ares to a real Palm Pre

October 9, 2010 Leave a comment

How cool is this, there is an “easter egg” in the palm pre, if you type upupdowndownleftrightleftrightbastart you enter developer mode

Which allows you run apps direct from Palm ares to the palm pre via a USB cable.

I’ve also updated my app, so that it can run in multiple orientations, has validation, and responds properly once the AJAX call returns…

Palm App store awaits


function MainAssistant(argFromPusher) {}

MainAssistant.prototype = {
setup: function() {
cleanup: function() {
btnSendTap: function(inSender, event) {
// Make an Ajax call to“btnSendTap invoked”);
var xref=this;
xmlhttp=new XMLHttpRequest();
if (xmlhttp.readyState!=4) return;
if (xmlhttp.status != 200)
// hide spinner
if (xmlhttp.status == 200)
onChoose: function(value) {},
title: “Success”,
message: “SMS message sent successfully”,
{label: “OK”, value:””},
// Ensure that a Destination is provided
if (this.$.tfTo.getValue().indexOf(“0044”)!=0)
Mojo.Controller.errorDialog(“Recipients phone number must start with 0044.”);
return false;
// Ensure From-Mobile number is international format
if (this.$.tfFrom.getValue().indexOf(“00”)!=0)
Mojo.Controller.errorDialog(“Your phone number must begin with an international prefix (0044 for UK).”);
return false;

// Ensure names are filled in
if (this.$.tfFromName.getValue().length<3 || this.$.tfFromName.getValue().length>11)
Mojo.Controller.errorDialog(“Your name must be between 3 and 11 letters long.”);
return false;

// Ensure message is not blank
if (this.$.tfMessage.getValue().length==0)
Mojo.Controller.errorDialog(“Your message is blank. Please type a message in the box provided”);
return false;

if (this.$.tfFrom.getValue() == this.$.tfTo.getValue())
Mojo.Controller.errorDialog(“You cannot send a text to yourself”);
var strUrl = “;;
strUrl += “FromName=” + this.$.tfFromName.getValue();
strUrl += “&FromNumber=” + this.$.tfFrom.getValue();
strUrl += “&ToNumber=” + this.$.tfTo.getValue();
strUrl += “&Message=” + this.$.tfMessage.getValue();
strUrl += “&locale=en-GB”;“GET”,strUrl,true);
// Show waiting spinner

Categories: Uncategorized