Shawn Weisfeld

I find when I talk to myself nobody listens. - Shawn Weisfeld
posts - 365, comments - 180, trackbacks - 34

My Links


Shawn Weisfeld's Facebook profile

The views expressed in this blog are mine and mine alone, not that of my employer, Microsoft, or anyone else’s. No warrantee is given for the quality of any material on this site.


Post Categories

January 2008 Entries

.NET SecureStrings

After the last ONETUG meeting a member came up to me and told me that SecureStrings did not work in .NET. As always I take this as a challenge, and sure enough the proof is in the code.     1         //Sample borrowed from     2         static void Main(string[] args)     3         {     4             Console.WriteLine("Please enter your password");     5             SecureString password = GetPassword();     6      7             Console.WriteLine("Your password was");     8             PrintPassword(password);     9     10             Console.WriteLine("Press any key to quit");    11             Console.ReadKey();    12         }    13     14         /// <summary>    15         /// Read a password from the console into a SecureString    16         /// </summary>    17        ...

posted @ Thursday, January 31, 2008 8:56 PM | Feedback (0) | Filed Under [ C# ]

Reflect on dll from the disk

Got a question after my reflection talk I gave to the User Group last week. The attendee wanted to load a dll from the disk and reflect on it. The assembly class has a LoadFile method that makes this easy as pie. Here is a code sample. //Read the dll from the disk Assembly assembly = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + "Microsoft.Practices.ObjectBuilder.dll"); //Print out some information about it ...

posted @ Thursday, January 31, 2008 2:00 AM | Feedback (0) | Filed Under [ C# ]

Orlando VS2008 Installfest

Back in November we did the Orlando VS2008 Installfest, and I have got to commend Microsoft for this forward looking opportunity. With the release of any new product there are always barriers to migration. The largest revolve around incompatibilities with older applications, or in the case of Visual Studio the tedious task of upgrading all of ones source code to the newest toolset. While the conversions wizards that have been shipping with VS.NET for a while help with this task depending on the size of your project this is an arduous task. While code migration and potential incompatibilities drives much...

posted @ Tuesday, January 22, 2008 1:34 PM | Feedback (0) | Filed Under [ .NET Microsoft ]

Pivot/Cross Tab Queries in SQL Server

There are many ways to turn rows of data into columns in SQL Server, I figured I would outline some of them and talk about some of the pro/cons of each. Sample 1: Using the SQL Server 2005 PIVOT operator. This is a great feature of SQL Server 2005 but has 2 obvious limitations. First it requires you to know the items you are going to pivot over (you can get around this limitation by using dynamic SQL). Second it requires you to have SQL Server 2005.--Sample 1SELECT CustomerID, [1996] AS year1996, [1997] AS year1997, [1998] AS year1998FROM ( SELECT CustomerID,...

posted @ Monday, January 21, 2008 1:55 PM | Feedback (1) | Filed Under [ SQL ]

Is this really me?

This was given to me by one of my co-workers. . .

posted @ Tuesday, January 15, 2008 7:39 PM | Feedback (0) | Filed Under [ Funny ]

Using the CCR for web service calls

So I figured I would see how the CCR compared the traditional .NET 2.0 Web Service model so I threw together this demo application. The interesting thing is that while I wired up the async call back events first, most of the CCR results arrived first. Web Service     1         [WebMethod]     2         public string Echo(string message, int sleep)     3         {     4             System.Threading.Thread.Sleep(sleep);     5             return message;     6         } Test Harness     1         static void Main(string[] args)     2         {     3             int sleeptime = 100;     4      5             //Call using traditional sequential model     6             Console.WriteLine("traditional sequential test");     7             for (int i =...

posted @ Tuesday, January 8, 2008 12:59 PM | Feedback (0) | Filed Under [ C# ]

Using the CCR for Line of Business Applications

For fun I have been playing around with Microsoft Robotics studio ( for a long time now and I have listened to Microsoft’s George Chrysanthakopoulos tell us how cool the CCR was in just about every webcast. Well I have decided to see if I can use the CCR in a regular business application and eliminate some of the pains of writing multithreaded code. To that end I started with a simple problem, calculating Fibonacci numbers, and like any good developer I started with an easy to implement sequential algorithm. Now that I could sequentially calculate the numbers I wanted to...

posted @ Tuesday, January 8, 2008 12:09 PM | Feedback (0) | Filed Under [ .NET C# Robotics ]

Powered by: