January 2008 Entries
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 http://blogs.msdn.com/shawnfa/archive/2004/05/27/143254.aspx
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 ...
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
...
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...
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,...
This was given to me by one of my co-workers. . .
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 =...
For fun I have been playing around with Microsoft Robotics studio (http://microsoft.com/robotics) 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...