Official Forum Flame Form

<lol> This is hilarious! 🙂 Here is a simple check off list for flaming forums. I’m not a flamer, but I’ve got to try using this sometime when it would be appropriate. The checks are from its original post. Official Forum Flame ============================================== Dear: [ ] Clueless Newbie [X] Loser [ ] Spammer [ ] Nerd [ ] Vet [X] Other: Troll You Are Being Flamed Because [ ] You bumped a thread from the last page. [ ] You started an off-topic thread. [ ] You posted a “YOU ALL SUCK” message. [ ] You don’t know which forum … Continue reading Official Forum Flame Form

Reverse Enum Lookup

Sometimes you may have the string name of an enumeration identifier, and want its enum type. For example, you write a enum identifier as a string to a file and want to read it back and obtain the original enumeration type. This takes place when you serialize a class to an XML file and deserialize it back using XmlSerializer. private enum Direction {North, South, East, West}; private Direction ParseDirection(string name) { return (Direction) Enum.Parse(typeof(Direction), name, true); }

Obtaining Indented XML as a String

Using XmlDocument.Save(string file) produces a file with nicely indented elements. XmlDocument.OuterXml returns a string without any formatting. If you want a nicely formatted string (to display to the user, write to console, etc), without directly writing to a file, you must use the XmlTextWriter. The using statements in the method makes sure the resorces are disposed of sooner than later. Here is the code to return a string of formatted XML from an XmlDocument. Download Example Code (requires Visual Studio 2005) using System.IO; using System.Xml; public static string FormatXML(XmlDocument doc) { // Create a stream buffer that can be read … Continue reading Obtaining Indented XML as a String

Creating Quick Tests in C#

Update on 5/2/07:  This post has nothing to do with Unit Testing (it was written before I was aware of unit testing) but has to do with write little bits of code to try new stuff out.  It is also only for VS03.  For the current version (VS05), see this post: CoadNet VS Project Templates, Quick Code + Console App for C# in VS05 CoadTools Quick Test C# Project Template (setup .msi) for Visual Studio .NET 2003 IntroductionVery often I need to test a tidbit of code, do some research on a class, etc. In fact, I was creating several … Continue reading Creating Quick Tests in C#

Property Event Pattern

IntroductionSince the advent of .NET, one of my most frequent and useful patterns is using an event to notify change in state. Applying this pattern has reduced overall code, improved reliability, and made maintenance and expansion easier. Why? The ContextWithout events, spaghetti code occurs real quickly when one method changes state that other code is dependant on without notifying that the change is made. This is one of the most frequent causes of coding errors (bugs) in mid-to-large applications that I have seen. Events go a long way in solve this issue. This should be obvious with public properties that … Continue reading Property Event Pattern

.Text Upgrade on MVP Site

Susan Bradley just updated (6/11/04) msmvps.com to .Text v0.95.2004.102. We’re still working out the kinks, but it is coming along! So if your agregate news reader shows double post entries (like my RSS Bandit), you know why. If you’re using RSS Bandit, just follow these steps to restore normality. Close RSS Bandit Edit “C:\Documents and Settings\[UserName]\Application Data\RssBandit\feedlist.xml” Search for “msmvps.com/coad” Delete all elements inside of the “stories-recently-viewed” element. Delete the Cache\msmvps.com* (or Cache\www.msmvps.com*) files. Load RSS Bandit, it will automatically download and recache the posts.

Associating a File Extension and Context Menus with an Application in the Registry

You can easily assign a file extension to open with your application in the registry. Verbal DescriptionThe extension is added as a key under “HKEY_CLASSES_ROOT” with the (default) value set to the file’s type (a string arbitrarily assigned by yourself). Then you add a key with the file’s type also to “HKEY_CLASSES_ROOT” with its (default) value set to the file’s type description (that is shown in Exporer). Under the same key, add they keys “shell/open/command” with the (default) value being the program to execute. Use “%1” with the quotes to pass the file’s name to your app. You can also … Continue reading Associating a File Extension and Context Menus with an Application in the Registry

Ultra-Portable Laptop

OverviewI have received many inquiries in airports, conferences, classes, meetings, etc when I pull out my laptop and it is smaller than even the thinnest paper notebooks on the table. I’ve seen too many people not carry or use their portable computer because it was inconvenient, this defeats the purpose of a laptop. Even with my last Sony VAIO V505, which was only 4 lbs, I still found that I would leave it behind because it just wasn’t easy enough. Not so with this little system, it goes everywhere with me. This has been one of my most enjoyable, useful, … Continue reading Ultra-Portable Laptop

Favorite Bloggers

News/Blog ReadingRSS Bandit is a great aggregate news reader. It is writting entirely in C#, is easy to use, works like a charm, and is even open source so you can see how various components have been implemented. To add feeds, just right-click in IE on an XML or RSS icon in the blog (or the RSS links below) and choose “Subscribe in default aggregator”. Favorite Bloggars (To Date) Here is a list of the blogs I am currently subscribed to. As my list is modified over time I’ll repost this list of active bloggers. These are really great posters! … Continue reading Favorite Bloggers