What Was I Thinking?

Follies & Foils of .NET Development
posts - 95 , comments - 352 , trackbacks - 0

January 2008 Entries

QuickTip: Good-Bye WinZip, Hello 7 Zip (and JZip).
My work laptop is a fairly beefy machine. Dual Core Intel T7800 with 4 GBs of ram, running Vista Ultimate 32-bit. Some firmware and OS limitations limit my effective memory addressing to 3.26 GB, but still this machine is no slouch. I could never figure out what about my configuration caused seemingly simple operations like extracting the contents of a zipped file to take SO LONG. I fiddled with this setting and that setting but to no avail. Finally I got fed up and turned to the all-knowing Google. ......

Posted On Sunday, January 27, 2008 10:04 PM | Comments (6) | Filed Under [ General Geekiness ]

Persisting Workflows using the NetDataContract Serializer
I'm currently working on a WCF/WF project where we've replaced .NET's DataContractSerializer default with the NetDataContractSerializer. The following is from the MSDN help file: The NetDataContractSerializer differs from the DataContractSerializer in one important way: the NetDataContractSerializer includes CLR type information in the serialized XML, whereas the DataContractSerializer does not. Therefore, the NetDataContractSerializer can be used only if both the serializing and deserializing ends ......

Posted On Saturday, January 26, 2008 2:54 PM | Comments (0) | Filed Under [ Windows Workflow Foundation ]

.NET 3.5 Certification Exam Beta is Still Available
Microsoft has extended the deadline for the .NET 3.5 technologies certification exam betas. There are certification tests available for WCF, WPF and Windows Workflow. You can take the exams for free, if you pass they will count towards your overall MS certification. Interested? Read more about it here ......

Posted On Friday, January 25, 2008 1:57 PM | Comments (6) | Filed Under [ Windows Workflow Foundation Visual Studio ]

HowTo: Set up your project for Window's Workflow (C# style)
Any C# project can contain Workflow definitions. They're just code file and/or XAML files. The trick is getting Visual Studio to recognize the project as supporting worfklows for design-time support and compilation. To enable a project for Windows Workflow,: Open the project in visual studio. If you're using source control check out the project file so it becomes writable In the Solution Explorer, right click and select Unload Project . The project tree will disappear from the solution explorer and ......

Posted On Saturday, January 19, 2008 11:31 AM | Comments (4) | Filed Under [ Windows Workflow Foundation Visual Studio ]

XMLSerialization - Solving the "Type Not Statically Known" exception
.NET's XMLSerializer can be pretty stupid. It refuses to serialize an object if its properties are of a derived type. Consider the following example: [Serializable]public classPerson{ public stringFirstName { get; set; } public stringLastName { get; set; }}[Serializable]public classSalesReceipt{ publicPersonCustomer { get; set; }}[Serializable]public classEmployee:Person{ publicDateTime DateOfHire { get; set; }}public classtrythis{ public voidmain() { Employee employee = newEmployee{ DateOfHire = ......

Posted On Thursday, January 17, 2008 1:07 AM | Comments (4) | Filed Under [ Visual Studio ]

QuickTip: How to determine if a type implements an interface
This is the functional equivalent of a "type is anothertype" but for interfaces: public static bool TypeImplementsInterface(Type type, Type interfaceType) { string interfaceFullName = interfaceType.FullName; return type.GetInterface(interface... != null; } ......

Posted On Wednesday, January 16, 2008 3:37 PM | Comments (3) | Filed Under [ Visual Studio ]

How to Serialize an Interface using the XMLSerializer
The short answer is you can't. At least not without some trickery and giving the serializer some help, and even then it's not pretty. Here's the plain-jane implementation. Note: The following snippet WILL NOT WORK public interface IWorker { string WorkerName { get; set; } } [Serializable] public class ImplementedWorker:IWorker { #region IWorker Members public string WorkerName { get; set; } #endregion } [Serializable] public class WorkToDo { public IWorker Worker; } public void Tryme() { WorkToDo ......

Posted On Wednesday, January 16, 2008 10:17 AM | Comments (10) | Filed Under [ Visual Studio ]

UberOptions - Filling the hole in Logitech Mouse Configuration
I recently upgraded my mouse and keyboard to the Logitech Wave wireless combo. The keyboard is taking a bit of getting used to (odd location and sizing of the delete, home, and end keys) and the wave design of the keyboards is... different. Overall though I am very pleased with the hardware. The mouse seems responsive and the keyboard is packed with loads of "doohickey" keys for launching media players, my favorite applications, pictures, even Windows media center (which I had never run before getting ......

Posted On Tuesday, January 15, 2008 6:01 PM | Comments (17) | Filed Under [ General Geekiness ]

Working with Thread.Abort()
This is an adaptation of the code from the MSDN help file. I prefer it to calling Thread.Abort() as a first chance approach for terminating a thread. A word of caution: It looks as though the ThreadAbortException skips over any finalization code that might occur inside of the executing thread. For example, the background threaded code was using an IDisposable resource (like a reader/writer), I don't believe the finalizer gets called on the resource, leaving it open. In my example, I've added a flag ......

Posted On Tuesday, January 15, 2008 5:37 PM | Comments (0) | Filed Under [ Visual Studio ]

QuickTip: Resize All Your ListView Columns with a single Keystroke.

Just when you think you know all you can know about something..  Ctrl+Plus (on the number pad) will auto resize your ListView columns.  Go ahead, try it!  You know you want to.

Posted On Tuesday, January 15, 2008 5:14 PM | Comments (0) | Filed Under [ Visual Studio General Geekiness ]

Resource String Editing Made Easy
I'm working on a project that involves building a library of string resources. Some of these resource values are small, consisting of a sentence or two, other resources are actually embedded XSL's, and can be quite lengthy. Visual Studio's built-in resource editor might suffice for other resource types, but is painfully inadequate for a large resource strings. My experience with the Visual Studio editor involves waiting 45-70 seconds for the initial data grid of strings to load, and another 30 seconds ......

Posted On Sunday, January 13, 2008 9:42 PM | Comments (5) | Filed Under [ Visual Studio ]

Powered by: