Archive

Archive for October, 2010

Creating a GUI in Powershell

[System.Reflection.Assembly]::LoadWithPartialName(“System.windows.forms”)
$form = new-object System.Windows.Forms.form
$Form.text = “Hello World!”
$form.showdialog()

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)

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.

http://support.microsoft.com/kb/951016
http://blogs.msdn.com/b/vistacompatteam/archive/2006/09/22/766945.aspx

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.

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
{
    [NonSerialized]
    public T RawObject;

    public XmlSchema GetSchema()
    {
        return null;
    }

    public void ReadXml(XmlReader reader)
    {
        //deserialization
        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)
    {
        //serialization
        var formatter = new SoapFormatter();
        var ms = new MemoryStream();
        formatter.Serialize(ms, RawObject);
        ms.Position = 0;
        var sr = new StreamReader(ms);
        var strXml = sr.ReadToEnd();
        writer.WriteRaw(strXml);
    }
}

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

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

Connection.AuthorizedUserDisplayName;

 

Categories: Uncategorized

Default controller cannot be deleted because there are builds in progress

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

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.

Update:

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

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() {
Ares.setupSceneAssistant(this);
},
cleanup: function() {
Ares.cleanupSceneAssistant(this);
},
btnSendTap: function(inSender, event) {
// Make an Ajax call to FreebieSMS.co.uk
Mojo.Log.info(“btnSendTap invoked”);
var xref=this;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState!=4) return;
if (xmlhttp.status != 200)
{
Mojo.Controller.errorDialog(xmlhttp.responseText.split(“\n”)[0]);
Mojo.Log.info(xmlhttp.responseText);
xref.controller.get(‘btnSend’).mojo.deactivate();
// hide spinner
}
if (xmlhttp.status == 200)
{
xref.controller.showAlertDialog({
onChoose: function(value) {},
title: “Success”,
message: “SMS message sent successfully”,
choices:[
{label: “OK”, value:””},
]
});
xref.controller.get(‘btnSend’).mojo.deactivate();
}
}
// Ensure that a Destination is provided
if (this.$.tfTo.getValue().indexOf(“0044”)!=0)
{
Mojo.Controller.errorDialog(“Recipients phone number must start with 0044.”);
xref.controller.get(‘btnSend’).mojo.deactivate();
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).”);
xref.controller.get(‘btnSend’).mojo.deactivate();
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.”);
xref.controller.get(‘btnSend’).mojo.deactivate();
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”);
xref.controller.get(‘btnSend’).mojo.deactivate();
return false;
}

if (this.$.tfFrom.getValue() == this.$.tfTo.getValue())
{
Mojo.Controller.errorDialog(“You cannot send a text to yourself”);
xref.controller.get(‘btnSend’).mojo.deactivate();
return;
}
var strUrl = “http://www.freebiesms.co.uk/sendsms.asmx/SendSms?&#8221;;
strUrl += “FromName=” + this.$.tfFromName.getValue();
strUrl += “&FromNumber=” + this.$.tfFrom.getValue();
strUrl += “&ToNumber=” + this.$.tfTo.getValue();
strUrl += “&Message=” + this.$.tfMessage.getValue();
strUrl += “&locale=en-GB”;
xmlhttp.open(“GET”,strUrl,true);
xmlhttp.send();
// Show waiting spinner
}
};

Categories: Uncategorized

Sending SMS from Palm Ares in WebOS

One of my first forrays into using the Palm Ares online IDE for the Palm  pre, is to create an app that can send SMS. So, I created a basic interface, to / from / Message, and Send button.

Attaching an event to the send button is easy, just select the button, go to the events tab, then select onTap. I also named all the labels and text fields properly.

 

The WebOS code then is as follows (much of it is auto-generated, except for the onTap event)

function MainAssistant(argFromPusher) {}

MainAssistant.prototype = {
setup: function() {
Ares.setupSceneAssistant(this);
},
cleanup: function() {
Ares.cleanupSceneAssistant(this);
},
mainTap: function(inSender, event) {

},
button1Tap: function(inSender, event) {

},
btnSendTap: function(inSender, event) {
// Make an Ajax call to FreebieSMS.co.uk
this.$.lblMessage.setLabel(“btnSendTap invoked”);
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4)
{
this.$.lblMessage.setLabel(xmlhttp.responseText);
}
}

var strUrl = “http://www.freebiesms.co.uk/sendsms.asmx/SendSms?&#8221;;
strUrl += “FromName=” + this.$.tfFromName.getValue();
strUrl += “&FromNumber=” + this.$.tfFrom.getValue();
strUrl += “&ToNumber=” + this.$.tfTo.getValue();
strUrl += “&Message=Hello+From+ARES”;
strUrl += “&locale=en-GB”;
this.$.lblMessage.setLabel(“strUrl created”);
xmlhttp.open(“GET”,strUrl,true);
xmlhttp.send();
this.$.lblMessage.setLabel(“AJAX called”);
}
};

 

The full project, as it stands can be downloaded from

https://sites.google.com/site/freesmsuk/Home/palm-ares-sms

Once it’s more complete, then I’ll post it on my SMS blog

 

 

Categories: Uncategorized

The joys of installing TFS

The core infrastructure for Team Foundation Server was configured successfully. However, there was a problem or delay during the creation of your initial Team Project Collection. Launch the Team Foundation Administration Console, and review the current status on the Team Project Collection node.

Important Information:
You must create at least one team project collection before you can use the features of Team Foundation Server. You can create a team project collection by using the New Team Project Collection Wizard from the Team Foundation Administration Console. For more information, see this topic on the Microsoft Web site: How to: Create a Team Project Collection.
Before you run the New Team Project Collection Wizard, you should open the configuration log and then review and correct any errors and warnings about the failure.

Warning    TF205018: An error occurred when attempting to save the mapping from the SharePoint Web application to Team Foundation Server. The SharePoint Web application is: http://fiach/. The error is: TF250067: No connection could be made to Team Foundation Server at the following address: http://fiach:8080/tfs. Either the specified URL does not point to a server that is running Team Foundation Server, the server is not available, or the service account for SharePoint Products does not have sufficient permissions on that server. The service account for SharePoint Products might not have been added to the required group in Team Foundation Server. For more information, see the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkId=161206)..
Warning    [2010-10-07 10:58:40Z] Servicing step Configure SharePoint Settings failed. (ServicingOperation: Install; Step group: Install.TfsSharePoint)
Warning    TF255271: The team project collection could not be created. The number of steps before the completion of project creation is: 120. The number of steps completed before the failure was 0.
Information    During the process of configuring SharePoint Products for use with Team Foundation Server, a new IIS Application Pool was created for the following Web site: ‘localhost’. If you had applications running on that Web site, they might have been affected.
Information    Firewall exception added for port 8080
Information    The time allowed for Windows services to start was increased from 30 seconds to 600 seconds. This affects all Windows services on this server. (The registry value set is HKLM\SYSTEM\CurrentControlSet\Control\!ServicesPipeTimeout.)
Information    Firewall exception added for port 17012
Information    Firewall exception added for port 80

TF250034: An access grant could not be found between Team Foundation Server and the SharePoint Web application that you specified. The Team Foundation Server ID is: 4bc24d2f-64ca-49b8-b1c0-c251bacee4d9. The SharePoint Web application is: http://fiach/sites/Test. You must grant access for the Web application in the Team Foundation Administration Console.

[2010-10-07 11:16:57Z][Error] TF252031: A SharePoint site could not be created for the team project collection. The following error occurred: TF250034: An access grant could not be found between Team Foundation Server and the SharePoint Web application that you specified. The Team Foundation Server ID is: 4bc24d2f-64ca-49b8-b1c0-c251bacee4d9. The SharePoint Web application is: http://fiach/sites/Test. You must grant access for the Web application in the Team Foundation Administration Console.

TF252031: A SharePoint site could not be created for the team project collection. The following error occurred: TF250034: An access grant could not be found between Team Foundation Server and the SharePoint Web application that you specified. The Team Foundation Server ID is: 4bc24d2f-64ca-49b8-b1c0-c251bacee4d9. The SharePoint Web application is: http://fiach/sites/Test. You must grant access for the Web application in the Team Foundation Administration Console.
[Info   @11:17:20.073] [2010-10-07 11:16:57Z][Informational] Microsoft.TeamFoundation.TeamFoundationServerException: TF252031: A SharePoint site could not be created for the team project collection. The following error occurred: TF250034: An access grant could not be found between Team Foundation Server and the SharePoint Web application that you specified. The Team Foundation Server ID is: 4bc24d2f-64ca-49b8-b1c0-c251bacee4d9. The SharePoint Web application is: http://fiach/sites/Test. You must grant access for the Web application in the Team Foundation Administration Console. —> Microsoft.TeamFoundation.TeamFoundationServerException: TF250034: An access grant could not be found between Team Foundation Server and the SharePoint Web application that you specified. The Team Foundation Server ID is: 4bc24d2f-64ca-49b8-b1c0-c251bacee4d9. The SharePoint Web application is: http://fiach/sites/Test. You must grant access for the Web application in the Team Foundation Administration Console. —> System.Web.Services.Protocols.SoapException: TF250034: An access grant could not be found between Team Foundation Server and the SharePoint Web application that you specified. The Team Foundation Server ID is: 4bc24d2f-64ca-49b8-b1c0-c251bacee4d9. The SharePoint Web application is: http://fiach/sites/Test. You must grant access for the Web application in the Team Foundation Administration Console.
— End of inner exception stack trace —
at Microsoft.TeamFoundation.Client.SharePoint.SharePointTeamFoundationIntegrationService.HandleException(Exception e)
at Microsoft.TeamFoundation.Client.SharePoint.SharePointTeamFoundationIntegrationService.CheckUrl(String absolutePath, CheckUrlOptions options, Guid configurationServerId, Guid projectCollectionId)
at Microsoft.TeamFoundation.Client.SharePoint.WssUtilities.CheckUrl(ICredentials credentials, Uri adminUrl, Uri siteUrl, CheckUrlOptions options, Guid configurationServerId, Guid projectCollectionId)
at Microsoft.TeamFoundation.Server.Servicing.TFCollection.SharePointStepPerformer.CheckCreateSite(TeamFoundationRequestContext requestContext, Uri adminUri, Uri siteUri)
— End of inner exception stack trace —
at Microsoft.TeamFoundation.Server.Servicing.TFCollection.SharePointStepPerformer.CheckCreateSite(TeamFoundationRequestContext requestContext, Uri adminUri, Uri siteUri)
at Microsoft.TeamFoundation.Server.Servicing.TFCollection.SharePointStepPerformer.ConfigureSharePoint(String stepData, ServicingContext servicingContext, Boolean validateOnly)
at Microsoft.TeamFoundation.Framework.Server.TeamFoundationStepPerformerBase.Microsoft.TeamFoundation.Framework.Server.IStepPerformer.ValidateStep(String servicingOperation, String stepType, String stepData, ServicingContext servicingContext)
at Microsoft.TeamFoundation.Framework.Server.ServicingStepDriver.PerformServicingStep(ServicingStep step, ServicingContext servicingContext, ServicingStepGroup group, ServicingOperation servicingOperation, Boolean validateOnly)
[Info   @11:17:20.073] [2010-10-07 11:16:57Z] Servicing step Configure SharePoint Settings failed. (ServicingOperation: Install; Step group: Install.TfsSharePoint)
[Info   @11:17:20.073] [2010-10-07 11:16:57Z][Informational] Clearing dictionary, removing all items.
[Error  @11:17:20.073] The servicing operation failed.

Categories: Uncategorized

Rarely shown due to low quality score

I spotted this text appearing in Google Adwords “Rarely shown due to low quality score”, and tried to uncover why ads were not displaying in Google’s main search.

Displaying·ads right now?
No
  • This keyword isn’t triggering ads to appear on Google right now.
Loading…
Quality score

1/10
  • Keyword relevance: No problems
  • Landing page quality: Poor
  • Landing page load time: No problems
Google lists the following problems with Landing pages;
  • usefulness and relevance of information provided on the page
  • ease of navigation for the user
  • page loading times
  • how many links are on the page
  • how links are used on the page
I can’t yet profess to know exactly what was wrong with the page, but this is what I changed, and I’ll see if it makes a difference;
1. It said “Copyright 2004” rather than “Copyright 2010” – Google could use this to see the site was not updated recently.
2. A few hidden links on the page, which I removed
3. A broken image
4. Removed affiliate links
Interestingly, I think that these page quality score factors could also be used in Google’s organic results… perhaps?
Categories: Uncategorized