Archive for December, 2009

Tools – Roy Osherove – Regulazy!

Just found an awesome tool allowing Regex noob’s such as myself, to build up Regex patterns, using only the sample data that you wish to match- go download Regulazy here!

Tools – Roy Osherove – Team Leadership, Agile Development & .NET – Speaking, Consulting, Training and Tools.

No Comments

How to run SQL Profiler against local SQL Express instances

I’m building a project using entity framework and wanted to ensure it wasn’t going mental and spamming the database with more queries than it should- this requires SQL Profiler, but i didn’t know how to connect it to my local instance of sql (I had just added an MDB file to the app’s app_data folder, so it was running via local sql express)

Turns out it’s easy- you just connect to .\SQLEXPRESS database and then execute this query against the master database;

SELECT
owning_principal_name,
instance_pipe_name
FROM
sys.dm_os_child_instances

From the results you will be able fish out the “named pipe” that you can just put into the server name box when connecting with profiler.

Sql Profiler connection dialogue

Sql Profiler connection dialogue

via Brad Wilson: Profiling SQL Server Express User Instances.

, ,

No Comments

Properties getting “k__BackingField” appended to their name in the WSDL file

I was finding k__backingField was being appended to all my object properties when exposed via my a WCF service, in the WSDL.  The solution it turns out was simple- just had to make my class a [DataContract] and mark the properties as [DataMember].

via WCF Data Contracts and “k__BackingField” Property Naming – Nathan Bridgewater.

No Comments

Making your WCF Service compatible with legacy .net 1.1 applications

I’m building an error tracking service which all our future web project will report to, so we can track and tag all our various systems problems from one place- this is currently done with email which is a bit of a nightmare!

According to Microsoft, traditional ASMX web services are now considered “Legacy technology” (!) so I thought I would buite the bullet and build the new services using WCF.

This was fairly painless until I tried to consume the web service in some old .net 1.1 web apps- when trying to add the web reference I received this error message;

Web ReferenceslocalhostReference.map(1): Custom tool warning: DiscoCodeGenerator unable to initialize code generator.  No code generated.

I found a great article over on the MSDN – and all it takes is a small change to the web.config, fiddling with, my old friend, the httpBindings.

I had to swap out the default bindings put in by .net;

        <endpoint address="" binding="wsHttpBinding" contract="HachetteErrorTracker.IErrorLog">
					<identity>
						<dns value="localhost"/>
					</identity>
				</endpoint>

For this one;

<endpoint
           address=""
           binding="basicHttpBinding" bindingNamespace="http://errortracker.localhost/"
           contract="HachetteErrorTracker.IErrorLog"
        />

How to: Configure WCF Service to Interoperate with ASP.NET Web Service Clients.

No Comments

Giving Umbraco custom tree’s children!

This was something i was looking for for a while- turns out it is buried deep in their forums;

As shown in their own example (I’ve reblogged here incase the page ever moves or dissapears!!)

Turns out it’s just a case of setting the “source” property of the XmlTreeNode.

public override void Render(ref XmlTree tree)
{
           
            Dictionary.DictionaryItem[] tmp;
        //this.id is set when the tree.aspx creates this object. 
        //It is the nodeID that is passed in via the tree service parameters (i.e. the query string)
        //this checks if the id is the StartNodeID (root node), if it’s not then this will 
        //look up the child nodes for the current dictionary item.
            if (this.id == this.StartNodeID)
                tmp = Dictionary.getTopMostItems;
            else
                tmp = new Dictionary.DictionaryItem(this.id).Children;

            foreach (Dictionary.DictionaryItem di in tmp)
            {
             XmlTreeNode xNode = XmlTreeNode.Create(this);
             xNode.NodeID = di.id.ToString();
             xNode.Text = di.key;
             xNode.Action = string.Format("javascript:openDictionaryItem({0});", di.id);
             xNode.Icon = "settingDataType.gif";
             xNode.OpenIcon = "settingDataType.gif";
             //if there is no children, then set the source to an empty string
//this will ensure that there is no expand button for this node when it is 
//rendered. Otherwise, set the source to the tree service url by using
//the BaseTree’s GetTreeServiceUrl method
             xNode.Source = di.hasChildren ? this.GetTreeServiceUrl(di.id) : "";
             tree.Add(xNode);
            }
}

3 Comments

Whats the definitive maximum size of an email address?

I’ve written lots of app’s which store email addresses, and usually go for a nvarchar(100) to store them, but thought I would find out once and for all, what the actual maximum size was- just out of curiousity.

Having googled around, I came across a couple of lengthy posts on the matter (here and here), quoting figures from various standard (which seemed to point at 320 character), then corrections to those standards by members of ICANN based on the SMTP spec and so on and so forth…

After much trawling, it seems the official answer is : 254 characters (256 including the standard <> brackets around the address)

, ,

2 Comments