November 2007 - Posts

Address Validation/Normalization Using Virtual Earth

So everyone loves the snazzy demo of Virtual Earth where they in a few lines of HTML and JavaScript draw a map (http://dev.live.com/virtualearth/sdk/). But what about doing some hard stuff, what if you want to  "validate" the addresses in your address book to ensure that they are correct. Well Virtual Earth can help you here also. They have a suite of web services (http://msdn2.microsoft.com/en-us/library/aa286513.aspx) that you can do all kinds of stuff with. In my case I want to throw it a string that could be an address and get what it thinks the most likely "real" address is for that string.

Lets say for example I had the address "400 orange orlando, fl 32810" as you can see I don't know what type of street it is (RD, LN, etc.) and I also don't have the extended zip code. Well with a few lines of code I can pass that address to Virtual Earth and they will give me back a list of possible choices.

FYI at the time of writing this post they are re-branding this service, changing its name from MapPoint Web Service to Virtual Earth so you might need to use the old name if searching for more information on this topic.

Step 1: go to https://mappoint-css.live.com/CSCV3 and sign up for a developer account. This will take a while since they need to provision your account.

Step 2: go to the verify credentials screen in the VE admin console where you created your account and test your password to ensure that everything has been setup and is working. (DONT FORGET THIS STEP!!!)

Step 3: using the WSDL URL from that screen create a web service reference in your .NET application

Step 4: Write the code! Here you can see that I new up a instance of my service and pass it some credentials. Then I create an address object with the address that I want to "validate". I then put that address object into an address specification that tell VE to look in North America for that address. Finally I call the service to get the results and iterate over them printing them to the console.

FindServiceSoap findService = new FindServiceSoap();
findService.Credentials = new System.Net.NetworkCredential("Web Service Account ID", "Password");

Address myAddress = new Address();
myAddress.FormattedAddress = "400 orange orlando, fl 32810";

FindAddressSpecification findAddressSpec = new FindAddressSpecification();
findAddressSpec.InputAddress = myAddress;
findAddressSpec.DataSourceName = "MapPoint.NA";

FindResults foundAddressResults = findService.FindAddress(findAddressSpec);

foreach (FindResult fr in foundAddressResults.Results)
{
    Console.WriteLine(fr.FoundLocation.Address.FormattedAddress); 
}
Posted by sweisfeld | with no comments
Filed under: ,

Technical Debt

After working with Andy Warren on SQL Saturday, I decided to add his blog (http://blogs.sqlservercentral.com/blogs/andy_warren) to my reading list, and look what I read. He has a great link (http://blogs.sqlservercentral.com/blogs/andy_warren/archive/2007/11/05/3154.aspx) to a blog entry by Steve McConnell (http://blogs.construx.com/blogs/stevemcc/archive/2007/11/01/technical-debt-2.aspx) on what Technical Debt is and how IT can explain it to their management. Well since I do blog on http://drowningintechnicaldebt.com and I am tired of people asking me what it is now they can just read all about it. No really Steve does a great job and you have got to read his post.

Posted by sweisfeld | with no comments

Orlando SQL Saturday 2007 & .NET SQL CLR

Yesterday was the first ever SQL Saturday, mad props to Andy Warren from End2End Training (http://www.endtoendtraining.com/) for all his work organizing this event. Over 200 people showed up to hear about some SQL server goodness. Andy defiantly raised the bar when it comes to these events and we at ONETUG (http://onetug.net/) are definitely going to have to kick it up a notch for our 3rd annual CodeCamp in March 2008.

Well not wanting to miss this event I put together a presentation on the SQL CLR (hey I cannot do a presentation not in C#). In the presentation we took a whirl wind tour of all the different types of CLR objects in SQL Server 2005. I have attached the presentation here with all the code samples here 2007_11_10_SQL_CLR.zip

I cannot wait till SQL Saturday Tampa and Jacksonville.

Posted by sweisfeld | with no comments
Filed under: ,