Robert McLaws: FunWithCoding.NET

Public Shared Function BrainDump(ByVal dotNet As String) As [Value]


<script type="text/javascript"><!-- google_ad_client = "pub-4330602465258980"; google_hints = "ASP.NET, VB.NET, C#, C#.NET, WindowsForms, .NET Framework, VS2005, Visual Studio, XAML, WinFX, Windows Workflow, WPF, WCF, Atlas, NetFX3, Visual Studio Orcas"; google_ad_width = 120; google_ad_height = 240; google_ad_format = "120x240_as"; google_ad_type = "text_image"; google_ad_channel ="4997399242"; google_color_border = "B6C9E7"; google_color_bg = "EFEFEF"; google_color_link = "0000FF"; google_color_text = "000000"; google_color_url = "002C99"; //--></script> <script type="text/javascript" src=""> </script>

You should feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever. That said, I will most likely only delete abusive, profane, rude, or annonymous comments, so keep it polite, please.


Cool .NET Articles

My .NET Tools

My Articles

My MSKB Articles

Some Useful TFS Customization Resources

Over the last few days, I've been trying to get my TFS system upgraded with some customizations that members of my team have requested. TFS is a very well-designed system, but unfortunately the out-of-the-box process of customizing your processes leaves a little to be desired.

It took me a couple hours of tinkering, but I figured out how to add some new statuses to the MSF for Agile templates, as well as new fields and UI for tracking the steps to reproduce a bug. I'll be posting those modifications in a bit, but in the meantime, I've assembled some of the resources that I found helpful on my Custom TFS templating journey. I hope they're useful.

And some other cool TFS Stuff:

I'm stepping up the use of TFS on my team for project management, so as I come across more resources that I find useful, I'll post them.

Work With .NET Projects From a Network Share

I've tried a couple different methods from a bunch of different websites, and none of them worked. The only thing that worked for me was this post from the Microsoft Knowledge Base. It is the only place on the internet that gives the proper caspol command for issuing Full Trust to a network share. It is:

Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on

Note the 4 slashes after the "file" and then the 2 backslashes for the full network path. Trust me, it will save you a lot of headaches.

Posted: Mar 22 2007, 12:03 AM by interscape | with 3 comment(s)
Filed under: ,
Expression Web Doesn't Do Non-GAC'd 3rd Party Controls

This is just ridiculous. First Expression web is not for developers, then it goes great with Visual Studio (which is for developers), and now they don't do custom controls that aren't signed and installed in the GAC. What the hell? Did Microsoft have ANY idea what kind of deployment NIGHTMARE that would be? What if the people on your team are writing their own controls that are updated frequently. You mean that the designer has to know enough about the GAC to be constantly pulling the BINs from source control and copy them to the Windows\Assembly folder? Have they not ever dealt with Assembly Hell before?

I'd really like to see what other component vendors and developers have to say about this. Seriously, I don't know what MS is smoking over there, but this whole Expression Web thing is really starting to feel half-assed. I never thought the DevDiv could botch something this badly.

Posted: Dec 13 2006, 07:19 PM by interscape | with 1 comment(s)
Filed under: ,
VSTE for DB Professionals MSDN Download Tip

I don't know if this has been posted about yet, but as an FYI to you MSDN subscribers out there, here's an installation tip. There are two downloads for "VSTE for DB Professionals": A 3.2GB full version and a 19MB "trial" version. The naming is a little confusing, but you can install the "trial" version on a fully-licensed VSTS install, and you'll get the full version of VSTEDB.

That will save you from downloading the full 3.2GB install... like I stared to.


ASP.NET: Authenticated but not Authorized

Does anyone know if there is a built-in way to trigger the Membership/Roles/FormsAuth system to redirect to a separate page if the current user is authenticated, but not authorized to view the current page? Right now I'm handling Application.Authenticate and checking UrlAuthorizationModule.CheckUrlAccessForPrincipal, but I'm not sure that's the best way, and it's not as clean as I'd like. Thanks!

Posted: Dec 04 2006, 01:13 AM by interscape | with 1 comment(s)
Filed under:
Are You Building Cool Solutions with Vista & Office?

I'm helping Microsoft coordinate some launch efforts in the Southwest US. So if you live and work in one of the following areas:

  • Las Vegas
  • Utah
  • Colorado
  • Arizona
  • New Mexico

... and are building cool solutions on Office 2007, Windows Vista, or .NET 3.0, please read this post.

Microsoft, Yahoo Adopt Google Sitemaps is reporting that later today, Microsoft and Yahoo will announce that they are adopting the Sitemaps 0.90 format, formerly known as Google Sitemaps. Now, Community Server users can submit their existing Google Sitemaps feeds to be indexed by the other two top search engine players as well.

This is definitely the best thing to happen to search since OpenSearch.

.NET 3.0 has RTMed!

I've posted the details over at Time to build cool stuff with WPF!

Get Initials from a String in VB.NET

So I've been in way over my head lately, converting a massive spaghetti-code Classic ASP application to .NET 2.0. Recently my client supplied with one of those Intro-to-Programming exam questions that was kinda fun, so I thought I'd post the answer here.

He needed to pull a person's initials out of a string, and he needed to handle either "LastName, FirstName" or "FirstName LastName".

Now, you can't just strip out all the capital letters, because Scottish guys like me will throw a wrench in that logic. So the easies way to do it is to split the string with a space character, and grab the first letter from each resulting string.

So here is the result, with a few test cases called from a test webpage for good measure. Hope you like:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Response.Write(GetInitialsFromString("Robert McLaws") & "<br />")
        Response.Write(GetInitialsFromString("Bill Gates") & "<br />")
        Response.Write(GetInitialsFromString("Robert W. McLaws") & "<br />")
        Response.Write(GetInitialsFromString("McLaws, Robert") & "<br />")
        Response.Write(GetInitialsFromString("McLaws, Robert W.") & "<br />")
    End Sub

    Public Function GetInitialsFromString(ByVal fullName As String) As String
        If fullName.Contains(",") Then
            fullName = NormalizeName(fullName)
        End If
        Dim nameArray As String() = fullName.Split(" ")
        Dim initials As String = String.Empty
        For Each name As String In nameArray
            initials += name.Chars(0)
        Return initials.ToUpper()
    End Function

    Public Function NormalizeName(ByVal fullName As String) As String
        Dim name As String() = fullName.Split(",")
        Return String.Format("{0} {1}", Trim(name(1)), Trim(name(0)))
    End Function

So if anyone ever needs to do this... there you go :). It's also a useful function for person-related .NET objects, so you can grab the initials by calling PersonObject.Initials instead of having to do it manually.

Leaving VB Developers in the Cold with XNA Express

Do you know VB and want to write games for Windows Vista and the Xbox 360? Sorry, you're SOL... XNA Studio Express is not for you. Didn't you know, man? Real games are made in C#.

What a load of crap.

More Posts Next page »