<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/" version="2.0">
    <channel>
        <title>FryHard</title>
        <link>http://blog.fryhard.com/Default.aspx</link>
        <description>Random Brain Farts</description>
        <language>en-ZA</language>
        <copyright>Fryhard</copyright>
        <managingEditor>bfry@fryhard.com</managingEditor>
        <generator>Subtext Version 2.0.0.43</generator>
        <image>
            <title>FryHard</title>
            <url>http://blog.fryhard.com/images/RSS2Image.gif</url>
            <link>http://blog.fryhard.com/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Fryhard" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
            <title>Selecting distinct records using Castle ActiveRecord</title>
            <category>Academic</category>
            <link>http://blog.fryhard.com/archive/2009/05/26/selecting-distinct-records-using-castle-activerecord.aspx</link>
            <description>&lt;p&gt;A while ago I jumped through the hoops of fire to find out how to select distinct records from a table using Castle ActiveRecord. Although it turned out to not be too difficult it is &lt;u&gt;not&lt;/u&gt; one of those code snippets that I keep in brain’s cache. It is for this reason that I am adding it to my blog with the hope that it may help me and others in the future.&lt;/p&gt;
&lt;p&gt;The below query will select a distinct list of companies who have employees whose name starts starts with a J.&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: #2b91af"&gt;DetachedCriteria &lt;/span&gt;distinctCriteria = &lt;span style="COLOR: #2b91af"&gt;DetachedCriteria&lt;/span&gt;.For(&lt;span style="COLOR: blue"&gt;typeof &lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;Company&lt;/span&gt;))
    .SetProjection(&lt;span style="COLOR: #2b91af"&gt;Projections&lt;/span&gt;.Distinct(&lt;span style="COLOR: #2b91af"&gt;Property&lt;/span&gt;.ForName(&lt;span style="COLOR: #a31515"&gt;"Identifier"&lt;/span&gt;)))
    .CreateCriteria(&lt;span style="COLOR: #a31515"&gt;"Employees"&lt;/span&gt;)
        .Add(&lt;span style="COLOR: #2b91af"&gt;Restrictions&lt;/span&gt;.Like(&lt;span style="COLOR: #a31515"&gt;"Title"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"j%"&lt;/span&gt;));

&lt;span style="COLOR: #2b91af"&gt;DetachedCriteria &lt;/span&gt;fullCriteria = &lt;span style="COLOR: #2b91af"&gt;DetachedCriteria&lt;/span&gt;.For(&lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;Company&lt;/span&gt;))
    .Add(&lt;span style="COLOR: #2b91af"&gt;Subqueries&lt;/span&gt;.PropertyIn(&lt;span style="COLOR: #a31515"&gt;"Identifier"&lt;/span&gt;, distinctCriteria));

&lt;span style="COLOR: #2b91af"&gt;Company&lt;/span&gt;[] result = &lt;span style="COLOR: #2b91af"&gt;ActiveRecordBase&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Company&lt;/span&gt;&amp;gt;.FindAll(fullCriteria, &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Order&lt;/span&gt;[] { &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Order&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"Title"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;) });&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;I have mocked up an &lt;a href="http://www.fryhard.com/downloads/blog/FryHard.SelectDistinct.1.0.0.0.zip"&gt;example&lt;/a&gt; that show the select as it would normally be performed which returns duplicate date. The example then shows the above select distinct query which does not return the duplicates. You can download it from &lt;a href="http://www.fryhard.com/downloads/blog/FryHard.SelectDistinct.1.0.0.0.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/19.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2009/05/26/selecting-distinct-records-using-castle-activerecord.aspx</guid>
            <pubDate>Tue, 26 May 2009 04:14:36 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2009/05/26/selecting-distinct-records-using-castle-activerecord.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/19.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/19.aspx</trackback:ping>
        </item>
        <item>
            <title>Useful C# snippets</title>
            <category>Academic</category>
            <link>http://blog.fryhard.com/archive/2009/02/28/useful-snippets.aspx</link>
            <description>I recently sat down at my computer at home, opened up Visual Studio and came to the realisation that I cannot program at home. I cannot program at home, not because I have cool games to play (everyone please check out &lt;a href="http://www.criteriongames.com/"&gt;Burnout Paradise&lt;/a&gt;, it is awesome), not because I have fun series to watch (once again, WHY did they cancel &lt;a href="http://www.henson.com/fantasy_scifi.php?content=farscape"&gt;FarScape&lt;/a&gt;), but merely because my computer at home is just not set up to program!&lt;br /&gt;
&lt;br /&gt;
I don’t have any of the cool things set up like they are at work. This as you all know is a sad situation to be in and since I started this blog to be a place where I could put useful stuff, I decided that I should start doing exactly that. (That or I am just procrastinating, because I cannot work at home!)&lt;br /&gt;
&lt;br /&gt;
Visual Studio introduced snippets quite a while ago and I have to say that in most cases I do not use them. Mostly one will see snippets in demo videos where the presenter does not show how badly he types. Though there is one personal snippet that I cannot live without as I learnt this morning. This snippet we affectionately refer to as sgs, Short Get Set.&lt;br /&gt;
Type in sgs, hit Tab and you will end up with { get; set;}. 4 key presses for 12, quite a good deal I think. Also remember developers can’t type!&lt;br /&gt;
&lt;br /&gt;
With a short amount of searching I was able to find the &lt;a href="http://msdn.microsoft.com/en-us/library/ms165394.aspx"&gt;MSDN&lt;/a&gt; page that shows you how to make a snippet, and recreated my beloved sgs. Below is the code. Save it as sgs.snippet into your \Documents\Visual Studio 2008\Code Snippets\Visual C#\ folder and the next time you type sgs and Tab it will work!&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 9pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    1&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;xml&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color: blue;"&gt;?&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    2&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CodeSnippets&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    3&lt;/span&gt; &lt;span style="color: blue;"&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CodeSnippet&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Format&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0.0&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    4&lt;/span&gt; &lt;span style="color: blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Header&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    5&lt;/span&gt; &lt;span style="color: blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Title&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;Short get set&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Title&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    6&lt;/span&gt; &lt;span style="color: blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Shortcut&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;sgs&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Shortcut&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    7&lt;/span&gt; &lt;span style="color: blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Author&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;FryHard&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Author&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    8&lt;/span&gt; &lt;span style="color: blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;HelpUrl&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;blog.fryhard.com&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;HelpUrl&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    9&lt;/span&gt; &lt;span style="color: blue;"&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Header&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   10&lt;/span&gt; &lt;span style="color: blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Snippet&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   11&lt;/span&gt; &lt;span style="color: blue;"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Code&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Language&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;CSharp&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   12&lt;/span&gt; &lt;span style="color: blue;"&gt;        &amp;lt;![CDATA[&lt;/span&gt;&lt;span style="color: gray;"&gt;{get; set;}&lt;/span&gt;&lt;span style="color: blue;"&gt;]]&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   13&lt;/span&gt; &lt;span style="color: blue;"&gt;      &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Code&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   14&lt;/span&gt; &lt;span style="color: blue;"&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Snippet&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   15&lt;/span&gt; &lt;span style="color: blue;"&gt;  &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CodeSnippet&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   16&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CodeSnippets&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;&lt;img src="http://blog.fryhard.com/aggbug/17.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2009/02/28/useful-snippets.aspx</guid>
            <pubDate>Sat, 28 Feb 2009 08:55:24 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2009/02/28/useful-snippets.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/17.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/17.aspx</trackback:ping>
        </item>
        <item>
            <title>Visual Studio: No files were found to look in. Find was stopped in progress</title>
            <category>Random</category>
            <link>http://blog.fryhard.com/archive/2008/11/28/visual-studio-no-files-were-found-to-look-in.aspx</link>
            <description>&lt;p&gt;This week seems like the week for strange errors. Luckily it is also the week for "&lt;em&gt;easy&lt;/em&gt;" fixes.&lt;/p&gt;
&lt;p&gt;When conducting a find in files (CTRL + SHIFT + F) in Visual Studio (for me this is VS 2008) the search completes in a second and returns with the results.&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p align="left"&gt;&lt;em&gt;&lt;font face="Arial"&gt;No files were found to look in.&lt;br /&gt;
&lt;/font&gt;&lt;font face="Arial"&gt;Find was stopped in progress.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p dir="ltr" align="left"&gt;Google-ing for this errors shows that it has been around for as long as it has been confusing people. &lt;a href="http://blogs.ugidotnet.org/franny/archive/2005/12/08/31303.aspx"&gt;Franny's Abode&lt;/a&gt; gave a fix way back in Visual Studio 2003!!!&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p dir="ltr" align="left"&gt;&lt;em&gt;Spin around on your chair 3 times,&lt;br /&gt;
clap your hands twice and then press...&lt;br /&gt;
&lt;strong&gt;CONTROL + SCRLK &lt;/strong&gt;(scroll lock)&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;&lt;img src="http://blog.fryhard.com/aggbug/16.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/11/28/visual-studio-no-files-were-found-to-look-in.aspx</guid>
            <pubDate>Fri, 28 Nov 2008 04:34:02 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/11/28/visual-studio-no-files-were-found-to-look-in.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/16.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/16.aspx</trackback:ping>
        </item>
        <item>
            <title>Visual Studio 2008 closes at build, Outlook 2007 Add-In</title>
            <category>Academic</category>
            <link>http://blog.fryhard.com/archive/2008/11/26/visual-studio-2008-closes-at-build-outlook-2007-add-in.aspx</link>
            <description>I am currently working on a Microsoft Outlook Add-in component to the group of applications that happily live on my back. I was given a sample application by the BA that was meant to be a basic mock that I now need to neaten up and flesh out.&lt;br /&gt;
Yet for the life of me I was unable to get this project to run without it pulling down Visual Studio in the process. Many hours of searching and found an answer that for the moment is working. So I decided to replicate the information here on my site in the hopes that it will be easier to find for the next person looking for help.
&lt;h2&gt;The Back story:&lt;/h2&gt;
&lt;ul&gt;
    &lt;li&gt;1. Open Microsoft Visual Studio 2008 Team Edition running .Net 3.5 SP 1 &lt;/li&gt;
    &lt;li&gt;2. Create a new Office 2007 Add-In (File &amp;gt; New Project &amp;gt; Visual C# &amp;gt; Office &amp;gt; 2007 &amp;gt; Outlook 2007 Add-In) &lt;/li&gt;
    &lt;li&gt;3. Choose a Name for your project and select OK. &lt;/li&gt;
    &lt;li&gt;4. Select Build or Run or press F5 &lt;/li&gt;
    &lt;li&gt;5. &lt;strong&gt;BOOM&lt;/strong&gt; (well not so much a boom as a *&lt;em&gt;poof*&lt;/em&gt;). Visual Studio is gone. You are back on the desktop and you don’t even get to tell Microsoft about it! &lt;/li&gt;
    &lt;li&gt;6. Check the event view and we find a nice error that looks like this: &lt;b&gt;.NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;The Real Problem:&lt;/h2&gt;
&lt;p&gt;I finally found a solution &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/99e124d0-c5d7-49c0-b1dd-71328f9a6571/"&gt;here&lt;/a&gt;. &lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;em&gt;This is not a PowerCommands issue but rather a problem with the CLR itself where this problem manifests if assemblies are loaded in a certain order. &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Installing PowerCommands and then creating a new Outlook 2007 project causes assemblies to get loaded in a way that this problem surfaces. &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Looking at the source code for PowerCommands, we see a Reference to System.Core.dll. Attaching a debugger to the VS2008 IDE, we see the following being logged just before the crash: CLR: (C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Tools.Office.Runtime.v9.0\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Tools.Office.Runtime.v9.0.dll) Rejecting native image because dependency C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll is not native &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;This is supposed to be fixed for the next version of the CLR. &lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;The Solution:&lt;/h2&gt;
&lt;ul&gt;
    &lt;li&gt;1. Uninstall PowerCommands. &lt;/li&gt;
    &lt;li&gt;2. Remove the native image cache of the VSTO DLL (per the workaround instructions). &lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Removing the native image cache:&lt;/h2&gt;
&lt;p&gt;Delete the native image generated for VSTO.&lt;/p&gt;
&lt;p&gt;To do this, open a command prompt, navigate to the directory below, and enter the text indicated below in that directory to initiate the deletion.&lt;/p&gt;
&lt;p&gt;This removes the Native Image Cache of the VSTO DLL. It does not delete the VSTO DLL. &lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;div class="code"&gt;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727&amp;gt;ngen /delete Microsoft.VisualStudio.Tools.Office.Runtime.v9.0 &lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;The main copy of the VSTO DLL will remain untouched, so no functionality is lost, there may be a small performance penalty. Neither the engineer nor I noticed a performance hit.&lt;/p&gt;
&lt;p&gt;To re-install the VSTO DLL into the cache, run the NGEN command on the DLL. For example, here is the command to re-install. Note, you need to be in the same folder as the DLL. &lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;div class="code"&gt;ngen Microsoft.VisualStudio.Tools.Office.Runtime.v9.0.dll&lt;/div&gt;
&lt;/blockquote&gt;&lt;img src="http://blog.fryhard.com/aggbug/15.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/11/26/visual-studio-2008-closes-at-build-outlook-2007-add-in.aspx</guid>
            <pubDate>Wed, 26 Nov 2008 09:41:33 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/11/26/visual-studio-2008-closes-at-build-outlook-2007-add-in.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/15.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/15.aspx</trackback:ping>
        </item>
        <item>
            <title>New Look?</title>
            <category>Random</category>
            <link>http://blog.fryhard.com/archive/2008/11/03/new-look.aspx</link>
            <description>&lt;p&gt;&lt;font face="Arial"&gt;For those that visit my blog regularly you will notice that it's look and feel has changed. This is because I recently upgraded to &lt;a href="http://www.subtextproject.com/ "&gt;SubText 2&lt;/a&gt; and couldn't get my old skin to work. I am OK with the change since the old skin used to have some nasty errors that I kind of just ignored. I have no yet noticed any problems, but if you spot any please leave me a comment on this post.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;img height="277" alt="FryHard.com new look" width="640" align="middle" src="http://blog.fryhard.com/images/blog_fryhard_com/3/r_newLook.JPG" /&gt;&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/14.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/11/03/new-look.aspx</guid>
            <pubDate>Mon, 03 Nov 2008 04:48:42 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/11/03/new-look.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/14.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/14.aspx</trackback:ping>
        </item>
        <item>
            <title>Generator Studio available on Codeplex</title>
            <category>Academic</category>
            <category>Applications</category>
            <link>http://blog.fryhard.com/archive/2008/10/31/generator_studio_available_on_codeplex.aspx</link>
            <description>For those of you that happen to also read &lt;a href="http://www.darkside.co.za"&gt;The Darkside&lt;/a&gt; you would have noticed that he and I (more he) recently released one of our most useful tools onto &lt;a href="http://www.codeplex.com"&gt;CodePlex&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=generatorstudio"&gt;Generator Studio&lt;/a&gt; is a code generation tool that points to a database and from uses the &lt;a href="http://www.castleproject.org/others/nvelocity/index.html"&gt;Velocity Template Language &lt;/a&gt;to generate code from template files. It will allow you to easily generate &lt;a href="http://www.castleproject.org/activerecord/index.html"&gt;Castle Active Record&lt;/a&gt; ORM classes from a database. These classes will have your correct namespace and have all of the reasonably hard to remember &lt;a href="http://blog.fryhard.com/archive/2008/04/15/attributes.aspx"&gt;attributes&lt;/a&gt; set up and ready to go. Yet, this is not the soul of the tool, by manipluating the template you can easily also generate controller, WinForm, WebForm, or any other code/file.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;*NOTE*&lt;/strong&gt; The application is a work in progress that we alter as we see fit (for the better). So we would love to hear what you have to say, see templates that you may be able to contribute, or hear that our code is bad :)&lt;img src="http://blog.fryhard.com/aggbug/12.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/10/31/generator_studio_available_on_codeplex.aspx</guid>
            <pubDate>Fri, 31 Oct 2008 05:35:23 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/10/31/generator_studio_available_on_codeplex.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/12.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/12.aspx</trackback:ping>
        </item>
        <item>
            <title>Castle ActiveRecord Async data fetching</title>
            <category>Academic</category>
            <link>http://blog.fryhard.com/archive/2008/09/11/castle_activerecord_asycn_data_fetching.aspx</link>
            <description>&lt;p&gt;As I may have said before I am working on a project that makes use of Castle ActiveRecord as the ORM to map the data in the database to the objects in the application. The project, as all applications should be :P, is a windows application and this therefore lends itself to some nifty async data calls to fetch our data while not locking the UI.&lt;br /&gt;
&lt;br /&gt;
This is however were we run into a problem: It seems that a vanilla implementation of ActiveRecord is not happy when you fetch data on one thread and other related data on another thread.&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;
&lt;div class="code" style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   35&lt;/span&gt; [&lt;span style="COLOR: #2b91af"&gt;ActiveRecord&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"Company"&lt;/span&gt;, Schema = &lt;span style="COLOR: #a31515"&gt;"dbo"&lt;/span&gt;)]&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   36&lt;/span&gt;     &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Company&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;BaseObject&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   37&lt;/span&gt;     {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   38&lt;/span&gt;         [&lt;span style="COLOR: #2b91af"&gt;HasMany&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;Person&lt;/span&gt;), Table = &lt;span style="COLOR: #a31515"&gt;"Person"&lt;/span&gt;, ColumnKey = &lt;span style="COLOR: #a31515"&gt;"CompanyId"&lt;/span&gt;, Lazy = &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;, Where = &lt;span style="COLOR: #a31515"&gt;"IsDeleted=0"&lt;/span&gt;)]&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   39&lt;/span&gt;         &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;virtual&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Person&lt;/span&gt;&amp;gt; Employees { &lt;span style="COLOR: blue"&gt;get&lt;/span&gt;; &lt;span style="COLOR: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;   40&lt;/span&gt;     }&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
This is easily show (as in &lt;a href="http://www.fryhard.com/downloads/ActiveRecordAsync.zip"&gt;the example&lt;/a&gt;) by creating an object that has a list of child objects that has been marked as list. In this case we have Companies and People. Companies have many people as employees. We don’t want to fetch all employees every time that we fetch a company so we mark it as lazy.&lt;br /&gt;
&lt;br /&gt;
We will fetch the company in an async load and in the call back try and fetch the linked people. This is not really a perfect example since obviously one would rather fetch the small company object synchronously and then retrieve the large list of people asynchronously, but it works for this example.&lt;br /&gt;
&lt;br /&gt;
When trying to fetch the list of employees in the originating thread a "failed to lazily initialize a collection, no session or session was closed" is thrown. This is the problem.&lt;br /&gt;
&lt;br /&gt;
We are working on a solution to this rather annoying problem and will keep you posted when/if we find one.&lt;/p&gt;
&lt;p&gt;Looks like we have a &lt;a href="http://www.darkside.co.za/archive/2008/09/09/castle-activerecord-lazy-loading-session-scopes-again.aspx"&gt;SOLUTION&lt;/a&gt;! Well most of one, check out &lt;a href="http://www.darkside.co.za"&gt;www.darkside.co.za&lt;/a&gt; for help.&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/11.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/09/11/castle_activerecord_asycn_data_fetching.aspx</guid>
            <pubDate>Thu, 11 Sep 2008 04:50:28 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/09/11/castle_activerecord_asycn_data_fetching.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/11.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/11.aspx</trackback:ping>
        </item>
        <item>
            <title>DevExpress XtraBars separator</title>
            <category>Academic</category>
            <link>http://blog.fryhard.com/archive/2008/07/07/devexpressxtrabarsseparator.aspx</link>
            <description>&lt;p align="center"&gt;&lt;a href="http://www.devexpress.com"&gt;&lt;img alt="DevExpress" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_DevExpress.JPG" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;
    &lt;div align="center"&gt;&lt;font face="Arial"&gt;Are you using &lt;a href="http://www.devexpress.com/"&gt;DevExpress&lt;/a&gt; to make your winforms look pretty?&lt;br /&gt;
    &lt;/font&gt;&lt;/div&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;div align="center"&gt;&lt;font face="Arial"&gt;Are you using a &lt;a href="http://www.devexpress.com/Products/NET/WinForms/XtraBars/"&gt;XtraBars.Bar&lt;/a&gt; as a Toolbar?&lt;br /&gt;
    &lt;/font&gt;&lt;/div&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;div align="center"&gt;&lt;font face="Arial"&gt;Not sure how to add a separator between buttons?&lt;br /&gt;
    &lt;/font&gt;&lt;font face="Arial"&gt;&lt;br /&gt;
    &lt;strong&gt;
    &lt;h3&gt;&lt;strong&gt;&lt;u&gt;Simple!&lt;/u&gt;&lt;/strong&gt;&lt;/h3&gt;
    &lt;/strong&gt;&lt;/font&gt;&lt;/div&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;font face="Arial"&gt;
&lt;p align="left"&gt;Right click on the button that you want to create the separator before and select “Begin Group” from the context menu. This will insert a separator in front of the button.&lt;/p&gt;
&lt;p align="left"&gt;The toolbar before the group was added:&lt;br /&gt;
&lt;img alt="Toolbar at the start" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_ToolbarStart.JPG" /&gt;&lt;/p&gt;
&lt;p align="left"&gt;Select &lt;strong&gt;Begin a Group&lt;/strong&gt; from the context menu.&lt;br /&gt;
&lt;img alt="Choose the begin group option" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_ToobarMenu.JPG" /&gt;&lt;/p&gt;
&lt;p align="left"&gt;And there you have it&lt;br /&gt;
&lt;img alt="Toolbar at the end" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_ToolbarEnd.JPG" /&gt;&lt;/p&gt;
&lt;p align="left"&gt; &lt;/p&gt;
&lt;/font&gt;&lt;img src="http://blog.fryhard.com/aggbug/10.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/07/07/devexpressxtrabarsseparator.aspx</guid>
            <pubDate>Mon, 07 Jul 2008 13:07:52 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/07/07/devexpressxtrabarsseparator.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/10.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/10.aspx</trackback:ping>
        </item>
        <item>
            <title>RocketDock – Mac menu for Windows</title>
            <category>Applications</category>
            <link>http://blog.fryhard.com/archive/2008/06/02/rocketdock.aspx</link>
            <description>&lt;p align="center"&gt;&lt;font face="Arial"&gt;&lt;img height="73" alt="RocketDock" width="400" src="http://blog.fryhard.com/images/blog_fryhard_com/3/r_RocketDoc.JPG" /&gt;&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;RocketDock&lt;/strong&gt;&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;At a recent LAN I spotted a cool looking application running on a one of my friends PC’s. It turned out to be &lt;a href="http://www.rocketdock.com"&gt;RocketDock&lt;/a&gt;. This application is self described as “a peace offering from the Mac community to you”; it is the creators’ hope that by providing Windows users with a pretty interface that the OS wars will end. :) &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;The best way to describe RocketDock is as the (cool) Mac menu for Windows. It supports opaqueness, bouncy icons while applications load and is really really pretty to look at and play with. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;This application will probably not help you code better, play games better or be more productive, but on those days when you are feeling down and Windows XP is boring you to death it may just put a smile on your face.&lt;/font&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;img height="55" alt="RocketDock" width="400" src="http://blog.fryhard.com/images/blog_fryhard_com/3/r_MacMenu.JPG" /&gt;&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;The Mac menu that we all know&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/9.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/06/02/rocketdock.aspx</guid>
            <pubDate>Mon, 02 Jun 2008 06:26:27 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/06/02/rocketdock.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/9.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/9.aspx</trackback:ping>
        </item>
        <item>
            <title>Transposing Columns and Rows in Microsoft Excel</title>
            <category>Academic</category>
            <link>http://blog.fryhard.com/archive/2008/05/28/transposing_columns_rows_microsoft_excel.aspx</link>
            <description>&lt;div style="FLOAT: left"&gt;&lt;a target="_blank" href="http://blog.fryhard.com/images/blog_fryhard_com/3/o_Transpose.JPG"&gt;&lt;img alt="The transpose command in Excel 2007" src="http://blog.fryhard.com/images/blog_fryhard_com/3/t_Transpose.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Recently I have needed to invert / swap / transpose the data I had represented as columns into data represented as rows. The data as in most cases was a table stored in Microsoft Excel. Finding the answer (the first time) took a few Googles through the web (the second and third time was a lot easier).&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;I was expecting there to be a menu option hidden somewhere under Format or Data or some other obscure place, but it turns out that this function has been provided in the copy paste functionality of Excel.&lt;br /&gt;
&lt;br /&gt;
All you need to do is copy your data (make sure you select all of it) and then use the &lt;strong&gt;Paste -&amp;gt; Transpose&lt;/strong&gt; function to paste it over the old data or into a new sheet.&lt;/p&gt;
&lt;p align="center"&gt;&lt;img alt="Original data set" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_OriginalData.JPG" /&gt;&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;The Original data set&lt;br /&gt;
&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;img alt="Original data set" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_FinalData.JPG" /&gt;&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;The Final data set&lt;br /&gt;
&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/8.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/05/28/transposing_columns_rows_microsoft_excel.aspx</guid>
            <pubDate>Wed, 28 May 2008 05:11:19 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/05/28/transposing_columns_rows_microsoft_excel.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/8.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/8.aspx</trackback:ping>
        </item>
        <item>
            <title>StackOverFlow</title>
            <category>Thoughts</category>
            <link>http://blog.fryhard.com/archive/2008/04/19/stackoverflow.aspx</link>
            <description>&lt;a href="http://www.stackoverflow.com"&gt;&lt;img alt="www.stackoverflow.com" src="http://blog.stackoverflow.com/wp-content/uploads/stackoverflow-logo-250.png" /&gt;&lt;/a&gt;&lt;br /&gt;
A quick post to mention the next developer helping, knowledge base, Q&amp;amp;A website.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.stackoverflow.com"&gt;www.stackoverflow.com&lt;/a&gt;&lt;span style="FONT-WEIGHT: bold"&gt; &lt;/span&gt;is being created as a joint venture by &lt;a href="http://www.joelonsoftware.com"&gt;Joel Spolsky&lt;/a&gt; and &lt;a href="http://www.codinghorror.com"&gt;Jeff Atwood&lt;/a&gt; and I have a feeling that it will finally do the job right! No more paying to see an answer. No more rants posted by 12 year old script jockeys. No more irritating adverts. No more flame wars against microsoft mid answer (well maybe some).&lt;br /&gt;
&lt;br /&gt;
This site will be done properly! They are currently talking about &lt;span style="FONT-STYLE: italic"&gt;paper prototyping &lt;/span&gt;the site in the announcement conversation that is available for download from the site. &lt;br /&gt;
&lt;br /&gt;
Paper Prototyping! Good Design! Clever People! Yes Please!&lt;img src="http://blog.fryhard.com/aggbug/7.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/04/19/stackoverflow.aspx</guid>
            <pubDate>Sat, 19 Apr 2008 17:04:10 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/04/19/stackoverflow.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/7.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/7.aspx</trackback:ping>
        </item>
        <item>
            <title>Launchy: Replacing [Windows]+R?</title>
            <category>Applications</category>
            <link>http://blog.fryhard.com/archive/2008/04/18/launchy.aspx</link>
            <description>&lt;p align="center"&gt;&lt;img height="133" alt="The Launchy window" width="489" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_newlaunchy.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;For as long as I can remember (well maybe not quite) I have made use of the run functionality within windows. For the most part you able to run the command/ program/ URL that you want to by simply pressing &lt;strong&gt;Windows key and R&lt;/strong&gt; and then typing what you want to do.&lt;/p&gt;
&lt;p&gt;Then came Windows Vista with its new fancy type and filter start bar (. &lt;/p&gt;
&lt;p align="center"&gt;&lt;img height="95" alt="Vista start bar" width="406" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_VistaStartBar.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;You are able to pop open the start bar and type what you want, be it a program, file, email or previous command that you have run and it will display in a list above the search so that you can choose what you want to run.&lt;/p&gt;
&lt;p&gt;My foray into the use of Windows Vista was cut short with me moving jobs and I am now back to [Windows]+R and Windows XP. Though, in the space of the last week, I have heard of the applicaiton &lt;a href="http://www.launchy.net/"&gt;Launchy&lt;/a&gt; twice. So I downloaded it and can now say that I am hooked.&lt;/p&gt;
&lt;p&gt;By simply pressing &lt;strong&gt;[Alt]+[Space]&lt;/strong&gt; the Launchy window pops up and you are able to type what you want to do and let it suggest programs. From here it is a simple [Enter] and you are running your program.&lt;/p&gt;
&lt;p&gt;Congratulations to the creators of a great free app.&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/6.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/04/18/launchy.aspx</guid>
            <pubDate>Fri, 18 Apr 2008 09:53:45 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/04/18/launchy.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/6.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/6.aspx</trackback:ping>
        </item>
        <item>
            <title>Attributing: Fancily dressed Classes</title>
            <category>Academic</category>
            <link>http://blog.fryhard.com/archive/2008/04/15/attributes.aspx</link>
            <description>&lt;span style="font-weight: bold;"&gt;Creating Attribute Classes in C# .Net&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Recently I have found the need to add attributes to a class. The plan was to reflect a child form’s attribute’s properties from the base from and in this way gain access to the forms display name and the name of the data type that the form would be displaying. By doing this we would not need to force each child form to implement a pointless interface to provide this detail. It turned out that attributes were easy to make, easier to use and provided a wealth of functionality.&lt;br /&gt;
&lt;br /&gt;
This "mini" post will hopefully introduce you to attributes and provide you with a slightly better understanding of what they actually do.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold; text-decoration: underline;"&gt;[Section (“Start”)]&lt;/span&gt;&lt;br /&gt;
So I guess we need to start by introducing attributes and explaining what they are. It turns out that attributes are classes. Yes, those funny little [] things on top of your classes and methods are for lack of a better explanation, instances of attribute classes. By declaring &lt;span style="font-style: italic;"&gt;[Naming("Window Location Capture")]&lt;/span&gt; we are creating an instance of the Naming attribute class and passing the string “Window Location Capture” to its single parameter constructor.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold; text-decoration: underline;"&gt;[Section (“Well know Attributes”)]&lt;/span&gt;&lt;br /&gt;
To realise that these attribute classes affect our every day programming lives think of the UI code that you use when creating a custom control. In order to set up the controls behavior in the properties window we decorate our control’s properties with &lt;span style="font-style: italic;"&gt;[Browsable(true)]&lt;/span&gt; and/or &lt;span style="font-style: italic;"&gt;[Category("Foo Category")]  &lt;/span&gt;and/or &lt;span style="font-style: italic;"&gt;[Description("Foo")]&lt;/span&gt;. Doing so allows us to specify that the property must be displayed in the property box. That it must fall under the category called Foo Category and that it must display “Foo” as the description for this category.&lt;br /&gt;
&lt;br /&gt;
The above were all property attributes, that being they can only be applied to properties. A well knows class attribute is the &lt;span style="font-style: italic;"&gt;[Serializable]&lt;/span&gt; attribute. You will notice that this attribute takes no parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold; text-decoration: underline;"&gt;[Section (“Enough with the basics”)]&lt;/span&gt;&lt;br /&gt;
Right, so on with how to make your own attribute.&lt;br /&gt;
&lt;br /&gt;
Doing this is rather easy and involve three basic steps.&lt;br /&gt;
1.    &lt;br /&gt;
&lt;div class="Code"&gt; &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red43\green145\blue175;}??\fs20 [\cf3 AttributeUsage\cf0 (\cf3 AttributeTargets\cf0 .Class)]}
--&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    &lt;/span&gt; [&lt;span style="color: rgb(43, 145, 175);"&gt;AttributeUsage&lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;AttributeTargets&lt;/span&gt;.Class)]&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
Deciding what type of attribute you want to create: Assembly, Class, Constructor, Delegate, Enum, Event, Field, GenericParameter, Interface, Method, Module, Parameter, Property, ReturnValue or Struct.&lt;br /&gt;
I will not even try and give you an example of each, but rather let you choose and research which you want to use.&lt;br /&gt;
&lt;br /&gt;
2.    &lt;br /&gt;
&lt;div class="Code"&gt; &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 public\cf0  \cf1 class\cf0  \cf4 Naming\cf0  : \cf4 Attribute}
--&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Naming&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;Attribute&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
Inherit the Attribute class.&lt;br /&gt;
&lt;br /&gt;
3.&lt;br /&gt;
&lt;div class="Code"&gt; &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;}??\fs20 \cf1 public\cf0  \cf1 string\cf0  DisplayName \{ \cf1 get\cf0 ; \cf1 set\cf0 ; \}}
--&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; DisplayName { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
Add you properties and set up the constructor.&lt;br /&gt;
&lt;br /&gt;
That’s it. You now have an attribute class that can be applied to whatever you decided you wanted to apply it to.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold; text-decoration: underline;"&gt;[Section  (“Reading your attributes”)]&lt;/span&gt;&lt;br /&gt;
So everyone is now thinking great! We have attributes on all our methods, now what do we do. Well to make use of these attributes we need to use reflection. By reflecting the class or property that we are looking for we can query if attributes have been applied. If attributes have been applied we can retrieve them and gain access to their properties.&lt;br /&gt;
&lt;br /&gt;
We get the type that we are working with. In this case we are working form a base form and accessing the attributes on the child class.&lt;br /&gt;
&lt;div class="Code"&gt; &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red43\green145\blue175;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue255;}??\fs20 \cf1 Type\cf0  t = \cf4 this\cf0 .GetType();}
--&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Type&lt;/span&gt; t = &lt;span style="color: blue;"&gt;this&lt;/span&gt;.GetType();&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Having retrieve the type of the child class we check if the specific attribute has been applied to the class.                &lt;br /&gt;
&lt;div class="Code"&gt; &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 if\cf0  (\cf4 Attribute\cf0 .IsDefined(t, \cf1 typeof\cf0 (\cf4 Naming\cf0 )))}
--&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;Attribute&lt;/span&gt;.IsDefined(t, &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;Naming&lt;/span&gt;)))&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
If the attribute has been applied we can gain access to an instance of that attribute.&lt;br /&gt;
&lt;div class="Code"&gt; &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red43\green145\blue175;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue255;}??\fs20 \cf1 Naming\cf0  myAttrib = (\cf1 Naming\cf0 )\cf1 Attribute\cf0 .GetCustomAttribute(t, \cf4 typeof\cf0 (\cf1 Naming\cf0 ));}
--&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Naming&lt;/span&gt; myAttrib = (&lt;span style="color: rgb(43, 145, 175);"&gt;Naming&lt;/span&gt;)&lt;span style="color: rgb(43, 145, 175);"&gt;Attribute&lt;/span&gt;.GetCustomAttribute(t, &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;Naming&lt;/span&gt;));&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we can gain access to the properties of this attribute.&lt;br /&gt;
&lt;div class="Code"&gt; &lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red163\green21\blue21;}??\fs20 \cf1 this\cf0 .Text = \cf4 "Attribute Example | "\cf0  + NamingAttrib.DisplayName;}
--&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   &lt;/span&gt;&lt;span style="color: blue;"&gt;this&lt;/span&gt;.Text = &lt;span style="color: rgb(163, 21, 21);"&gt;"Attribute Example | "&lt;/span&gt; + NamingAttrib.DisplayName;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold; text-decoration: underline;"&gt;[Section  (“Further examples”)]&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I have mocked together &lt;a href="http://www.fryhard.com/downloads/attributeexample.zip"&gt;some code&lt;/a&gt; that displays some the principles that I have talked about. Hopefully you will be able to find enough information to work out how you can use attributes.&lt;br /&gt;
&lt;br /&gt;
There is also a write up on attributes over at MSDN &lt;a href="http://msdn2.microsoft.com/en-us/library/aa288059(VS.71).aspx"&gt;http://msdn2.microsoft.com/en-us/library/aa288059(VS.71).aspx&lt;/a&gt;&lt;img src="http://blog.fryhard.com/aggbug/5.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/04/15/attributes.aspx</guid>
            <pubDate>Tue, 15 Apr 2008 15:18:38 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/04/15/attributes.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/5.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/5.aspx</trackback:ping>
        </item>
        <item>
            <title>The Nokia Morph</title>
            <category>Random</category>
            <link>http://blog.fryhard.com/archive/2008/03/19/nokia_morph.aspx</link>
            <description>&lt;div style="float: left;"&gt; &lt;img alt="Morph from Treasure Planet" src="http://blog.fryhard.com/images/blog_fryhard_com/3/t_Morpie.jpg" /&gt; &lt;/div&gt;
&lt;div style="float: right;"&gt; &lt;img alt="Nokia Morph in phone mode" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_Morph_Phone_Mode.jpg" /&gt;&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;The Morph in "Phone mode"&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
Whenever I hear the word morph I always think of Morph or Morphie (not moffie for our Afrikaans readers) from the movie Treasure Planet. This little guy was able to change into any shape that he felt like changing into. Though the change was governed by his size. I.e. he (or would it be it) could not change into something the size of Godzilla.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It seems that Nokia (one of my least favorite cell phone manufacturers) also enjoyed the movie, paired up with the bright kids at Cambridge and are working on a morphing cell phone that makes use of all the nifty abilities that &lt;span style="font-weight: bold;"&gt;nano-technology&lt;/span&gt; provides.&lt;br /&gt;
&lt;br /&gt;
I am impressed. If a phone like the one they propose exists I would buy it, &lt;span style="font-weight: bold;"&gt;now!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Take a look at the cool designs that they have proposed and if that is not enough for you to salivate over, you can head over to the &lt;a href="http://www.nokia.com/A4852062"&gt;Nokia Morph’s site&lt;/a&gt; and &lt;a href="http://nds3.nokia.com/NOKIA_COM_1/About_Nokia/Research/Demos/Morph/video/morph_concept_small.mov"&gt;watch&lt;/a&gt; a short skit on the possibly features.&lt;br /&gt;
&lt;br /&gt;
All I can say at the moment is: “&lt;span style="font-style: italic;"&gt;I am still not buying your silly phones, but make this one and I will be there in a heartbeat! Go Nokia go!&lt;/span&gt;”&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&lt;img src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_Morph_Wrist_Mode.jpg" alt="Nokia Morph in wrist mode" /&gt;&lt;br /&gt;
&lt;span style="font-style: italic;"&gt; The Morph in "Wrist Mode"&lt;/span&gt;&lt;/div&gt;&lt;img src="http://blog.fryhard.com/aggbug/4.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/03/19/nokia_morph.aspx</guid>
            <pubDate>Wed, 19 Mar 2008 09:04:08 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/03/19/nokia_morph.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/4.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/4.aspx</trackback:ping>
        </item>
        <item>
            <title>Women implement the Factory Method Pattern???</title>
            <category>Academic</category>
            <link>http://blog.fryhard.com/archive/2008/03/13/women-implement-the-factory-method-pattern.aspx</link>
            <description>&lt;div style="float: right;"&gt;&lt;img alt="Advanced Technology" src="http://imgs.xkcd.com/comics/advanced_technology.png" /&gt; &lt;/div&gt;
&lt;div style="text-align: left;"&gt;The other day while trawling the archive of the web comic &lt;a href="http://xkcd.com"&gt;xkcd&lt;/a&gt; (My thanks go out to &lt;a href="http://singe.za.net"&gt;singe&lt;/a&gt; for showing me the light. It is GOOD!) I happened upon the comic that is the inspiration for this post. &lt;br /&gt;
&lt;br /&gt;
Now before I get started, I have to mention that a while ago I studied Design Patterns, but I brushed then off as silly nuisance. Back then they were nothing more that people writing about obvious facts that any/everyone knows and seemed more general knowledge. What I have recently noticed is that that is EXACTLY what they are. &lt;span style="font-weight: bold;"&gt;Design patterns common problems with solutions that can be used over and over again to solve them&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
Back to the subject at hand: The web comic expresses a man’s (who must be a geek) unbelief and fascination of how a woman has a factory for creating more of herself. For those that have not noticed, this is along the lines of the&lt;span style="font-style: italic;"&gt; Factory Method Pattern&lt;/span&gt;, and that it the subject of this post.&lt;br /&gt;
&lt;h3&gt;Factory Method Pattern&lt;/h3&gt;
&lt;span style="font-style: italic;"&gt; The factory method pattern allows classes to defer instantiation to their subclass.&lt;/span&gt;&lt;br /&gt;
In the basic form, the factory method pattern involves a creator and a product. The product is an abstract representation of a group of products while the creator is the base class of a possible creator hierarchy. A user asks the creator for an instance of a product and the creator will return it as a product. Rather confused? Not to worry? Remember, we are talking about the factory method pattern. What do factories do? They create stuff? Some pretty black pictures may help.&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&lt;img alt="Basic Example" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_Structure.png" /&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
As we can see from the above the Creator creates instances of Product. The user does not need to worry about how the concreteproduct is created or what type of product it is since the concretecreator will return the concreteproduct via its interface. The words polymorphasism spring to mind. The creator similarly reliese on the concretecreators to create the correct concreteproject. Each conctretecreator is responsible for its own conctreteproduct.&lt;br /&gt;
&lt;br /&gt;
As I said at the beginning this is only the vanilla flavor of the factor method patter. Derivatives allow for the creator to return a default instance of the product and more excitingly for the creator to be told what type of product it should create.&lt;br /&gt;
As I typed that last sentence I could see a big switch statement appear in my mind.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div class="Code"&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;switch &lt;/span&gt;(productType)&lt;br /&gt;
{&lt;br /&gt;
&lt;div style="margin-left: 40px;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;case &lt;/span&gt;ConcreteProduct1:&lt;br /&gt;
&lt;/div&gt;
&lt;div style="margin-left: 40px;"&gt;
&lt;div style="margin-left: 40px;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return &lt;/span&gt;(&lt;span style="color: rgb(153, 204, 255);"&gt;Product&lt;/span&gt;) &lt;span style="color: rgb(0, 0, 255);"&gt;new &lt;/span&gt;&lt;span style="color: rgb(153, 204, 255);"&gt;ConcreteProduct1&lt;/span&gt;();&lt;br /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;break&lt;/span&gt;;&lt;br /&gt;
&lt;/div&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;case &lt;/span&gt;ConcreteProduct2:&lt;br /&gt;
&lt;div style="margin-left: 40px;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return &lt;/span&gt;(&lt;span style="color: rgb(153, 204, 255);"&gt;Product&lt;/span&gt;) &lt;span style="color: rgb(0, 0, 255);"&gt;new &lt;/span&gt;&lt;span style="color: rgb(153, 204, 255);"&gt;ConcreteProduct2&lt;/span&gt;();&lt;br /&gt;
&lt;/div&gt;
&lt;div style="margin-left: 40px;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;break&lt;/span&gt;;&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
... &lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
But this is silly code that we would have written back in 2002 or before. Thanks to .Net (and other frameworks :)) we have funky things like Generic Types and Reflection. Using these we can do some rather funky things like create and instance of a class from a passed class type and return it as an interface that passed class implements.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="Code"&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public static class&lt;/span&gt; &lt;span style="color: rgb(153, 204, 255);"&gt;Creator&lt;/span&gt;&lt;br /&gt;
{&lt;br /&gt;
&lt;div style="margin-left: 40px;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public static&lt;/span&gt; I Create&amp;lt;I,C&amp;gt;() &lt;br /&gt;
&lt;/div&gt;
&lt;div style="margin-left: 160px;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;where &lt;/span&gt;I : &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style="margin-left: 160px;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;where &lt;/span&gt;C : &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;,I&lt;br /&gt;
&lt;/div&gt;
&lt;div style="margin-left: 40px;"&gt;{&lt;br /&gt;
&lt;div style="margin-left: 40px;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return &lt;/span&gt;(I) &lt;span style="color: rgb(153, 204, 255);"&gt;Activator&lt;/span&gt;.CreateInstance(&lt;span style="color: rgb(0, 0, 255);"&gt;typeof &lt;/span&gt;(C));&lt;br /&gt;
&lt;/div&gt;
}&lt;br /&gt;
&lt;/div&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style="text-align: center;"&gt;&lt;img alt="More Enhanced Example" src="http://blog.fryhard.com/images/blog_fryhard_com/3/o_Sructure_new.png" /&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
What we now have is a single creator class that can create an instance of any class and return it as an interface that that class implements. I have to admit that this code is rather staggering (WOW) for me (says something about what I have been writing in the past). I have to credit &lt;a href="http://www.darkside.co.za"&gt;DarkSide&lt;/a&gt; for its creation.&lt;br /&gt;
&lt;br /&gt;
Hopefully this has helped you build an idea of what factory classes are all about. If not, or you think that I may have missed something let me know.&lt;br /&gt;
&lt;br /&gt;
Oh... if you are interested take a look at &lt;a href="http://www.fryhard.com/downloads/FactoryPattern.zip"&gt;this (FactoryPattern.zip) code example&lt;/a&gt; as a supliment for the above discussion.&lt;img src="http://blog.fryhard.com/aggbug/3.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2008/03/13/women-implement-the-factory-method-pattern.aspx</guid>
            <pubDate>Thu, 13 Mar 2008 17:01:17 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2008/03/13/women-implement-the-factory-method-pattern.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/3.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/3.aspx</trackback:ping>
        </item>
    </channel>
</rss>
