<?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>while (stillAlive) Code();</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" type="application/rss+xml" href="http://feeds.feedburner.com/Fryhard" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="fryhard" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
            <title>In the beginning there was NCSA Mosaic&amp;hellip;</title>
            <category>C# .Net</category>
            <category>Mobile</category>
            <category>Random</category>
            <link>http://blog.fryhard.com/archive/2013/05/14/in-the-beginning-there-was-ncsa-mosaichellip.aspx</link>
            <description>&lt;p&gt;For those that have had to deal with “UserAgent sniffing”, &lt;a href="http://webaim.org/blog/user-agent-string-history/"&gt;this old (2008) blog post&lt;/a&gt; by Aaron Andersen should appeal. It did to me!&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;And then Google built &lt;/em&gt;&lt;a href="http://www.google.com/chrome"&gt;&lt;em&gt;Chrome&lt;/em&gt;&lt;/a&gt;&lt;em&gt;, and Chrome used Webkit, and it was like Safari, and wanted pages built for Safari, and so pretended to be Safari. And thus Chrome used WebKit, and pretended to be Safari, and WebKit pretended to be KHTML, and KHTML pretended to be Gecko, and all browsers pretended to be Mozilla, and Chrome called itself Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13, and the user agent string was a complete mess, and near useless, and everyone pretended to be everyone else, and confusion abounded.&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The above story unfortunately only gets worse with the spread of mobile devices and their lack of UserAgent standardisation. &lt;/p&gt;  &lt;p&gt;We currently make use of a Device Description Repository (DDR) to determine what type of browser or device is hitting us. Our choice of DDR was &lt;a href="http://wurfl.sourceforge.net/"&gt;WURFL&lt;/a&gt;. Unfortunately you have to pay to use it in production, but it makes my life much easier and for that reason I am happy to let the company pay for it.&lt;/p&gt;  &lt;p&gt;Regex statements like this are a thing of the “past” for me.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#408080"&gt;Regex&lt;/font&gt; iOsModelVesionRegex = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#408080"&gt;Regex&lt;/font&gt;&lt;font color="#000000"&gt;&lt;font color="#c0504d"&gt;(&lt;/font&gt;@"\(.*(?&amp;lt;model&amp;gt;(?:ip(?:hone|od|ad)))(?:[;U ])*CPU\s*(?:iPhone)*\s*(?:OS)*\s*(?&amp;lt;version&amp;gt;\d)*(?:_\d(?:_\d)*)*|\(.*(?&amp;lt;model&amp;gt;(?:ip(?:hone|od|ad)))"&lt;/font&gt;, &lt;font color="#408080"&gt;RegexOptions&lt;/font&gt;.IgnoreCase | &lt;font color="#408080"&gt;RegexOptions&lt;/font&gt;.Multiline | &lt;font color="#408080"&gt;RegexOptions&lt;/font&gt;.IgnorePatternWhitespace);&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Another option for a DDR is &lt;a href="https://deviceatlas.com/"&gt;Device Atlas&lt;/a&gt;, which performed similarly to WURFL. At the time of investigation (July 2012) they only supported mobile devices. On Average they did match UserAgents 19 times faster than WURFL, though both DDRs matched in sub-second. We believed that WURFL’s output data was better suited for our needs. So the combination of cost, data structure and addition match cases finally swung us towards WURFL.&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/32.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2013/05/14/in-the-beginning-there-was-ncsa-mosaichellip.aspx</guid>
            <pubDate>Tue, 14 May 2013 05:47:29 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2013/05/14/in-the-beginning-there-was-ncsa-mosaichellip.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/32.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/32.aspx</trackback:ping>
        </item>
        <item>
            <title>Life Hack: Dealing with digital airport boarding passes</title>
            <category>Life Hacks</category>
            <category>Thoughts</category>
            <category>Random</category>
            <link>http://blog.fryhard.com/archive/2013/05/10/life-hack-dealing-with-digital-airport-boarding-passes.aspx</link>
            <description>&lt;p&gt;&lt;strong&gt;The Answer: &lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Save your digital boarding pass to your phone and set it as your lock screen image, or just get a paper boarding pass.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;The Story:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Recently I have had to fly around South Africa and have therefore been checking into numerous flights. One of the new ‘modern’ features that has been introduces by one of South Africa’s low cost airlines is the digital boarding pass. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.fryhard.com/images/blog_fryhard_com/Windows-Live-Writer/6ca269c9c610_6FFA/Digital%20Boarding%20Pass_2.jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="Digital Boarding Pass" border="0" alt="Digital Boarding Pass" src="http://blog.fryhard.com/images/blog_fryhard_com/Windows-Live-Writer/6ca269c9c610_6FFA/Digital%20Boarding%20Pass_thumb.jpg" width="240" height="242" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;These modern marvels allow you to check in on line and request your boarding pass, all from the comfort of your couch. No more need to kill the planet and have the check in clerk print out those boarding passes that are way to big to fit into your wallet or pocket. You can walk straight to the security gate and &lt;strong&gt;if &lt;/strong&gt;they manage to scan the digital boarding pass pass enter the waiting lounge.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;‘If the manage to scan digital boarding pass‘&lt;/em&gt; &lt;/p&gt;  &lt;p&gt;Yes, this can be a difficult thing to do. The problem is that most of the security guards that need to scan the QR code have never used an iPhone or an Android. Some of them may never own one! Now given a device that has a tendency to auto rotate emails to make it ‘as convenient to read as possible’, and a user that has no experience in using said device, this is the set up for great comedy or frustration. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;You pass your phone to the security guard who then turns it upside down to scan on the scanner. In the process the phone auto rotates the image and scales it out of view. So, the scan fails… Rinse, Dry, Repeat, Repeat, Repeat, Repeat… This ended in me being let through without my boarding pass being scanned and in even more frustration for my girlfriend who was travelling with me. In her case, during the many many rotation and scanning the email was accidentally deleted. She had to go back to the desk and get a paper boarding pass.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;So what is the solution to this?&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1. Use a paper boarding pass? They are paper, this helps kill the planet, but also makes for a great bookmark on the plane and for me is truthfully more convenient.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;2. Set the digital boarding pass as your phone’s lock screen background. This way the phone will not rotate it, it is easy to get to and there is no way for the person scanning the code to tap something ‘bad’ on your phone. It also easily allows you to check your gate number and departure time!&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://blog.fryhard.com/images/blog_fryhard_com/Windows-Live-Writer/6ca269c9c610_6FFA/Digital%20Boarding%20Pass%20Lock%20Screen_2.jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="Digital Boarding Pass Lock Screen" border="0" alt="Digital Boarding Pass Lock Screen" src="http://blog.fryhard.com/images/blog_fryhard_com/Windows-Live-Writer/6ca269c9c610_6FFA/Digital%20Boarding%20Pass%20Lock%20Screen_thumb.jpg" width="238" height="420" /&gt;&lt;/a&gt;Maybe this will help solve some frustration.&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/31.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2013/05/10/life-hack-dealing-with-digital-airport-boarding-passes.aspx</guid>
            <pubDate>Fri, 10 May 2013 07:17:49 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2013/05/10/life-hack-dealing-with-digital-airport-boarding-passes.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/31.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/31.aspx</trackback:ping>
        </item>
        <item>
            <title>Visual Studio tests stuck in pending state</title>
            <category>C# .Net</category>
            <category>Bugs</category>
            <link>http://blog.fryhard.com/archive/2013/04/24/visual-studio-tests-stuck-in-pending-state.aspx</link>
            <description>&lt;ul&gt;   &lt;li&gt;Are you running Visual Studio 2012 Update 2?&lt;/li&gt;    &lt;li&gt;Are you running Resharper v7.1.2 or lower?&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Well &lt;a href="http://stackoverflow.com/questions/16045084/unit-tests-stopped-working-and-stuck-in-pending-state-vs2012"&gt;this&lt;/a&gt; stackoverflow post can help you!&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;If you're using Resharper, then there is an issue with version 7.1.2 and below in combination with Visual Studio 2012 Update 2.&lt;/p&gt;    &lt;p&gt;Jetbrains has &lt;a href="http://blogs.jetbrains.com/dotnet/2013/04/resharper-713-is-available-for-visual-studio-2012-update-2/"&gt;released a new version (7.1.3) which solved the issue&lt;/a&gt;, the latest EAP also resolved this issue.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Thanks &lt;a href="http://stackoverflow.com/users/736079/jessehouwing"&gt;jessehouwing&lt;/a&gt; for the help! If this help you go to his &lt;a href="http://stackoverflow.com/questions/16045084/unit-tests-stopped-working-and-stuck-in-pending-state-vs2012"&gt;answer&lt;/a&gt; and vote it up.&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/30.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2013/04/24/visual-studio-tests-stuck-in-pending-state.aspx</guid>
            <pubDate>Wed, 24 Apr 2013 09:59:47 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2013/04/24/visual-studio-tests-stuck-in-pending-state.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/30.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/30.aspx</trackback:ping>
        </item>
        <item>
            <title>Writing code in your own language</title>
            <category>Thoughts</category>
            <link>http://blog.fryhard.com/archive/2012/07/30/writing-code-in-your-own-language.aspx</link>
            <description>&lt;p&gt;For quite a while this question has played on my mind; &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;If you speak French, German, Mandarin or any language other than English, how do you write code? &lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Most of the programing languages that I have dealt with in my studies and career are comprised of English syntax. Not surprisingly, this felt completely natural since after all my fist language is English. For a long time it did not dwell on me what it would be like to not speak English and to program. What would a &lt;em&gt;for loop &lt;/em&gt;mean to me, and how about an &lt;em&gt;if else &lt;/em&gt;statement? Basic syntax that I take for granted may not mean anything to me in my native language.&lt;/p&gt;  &lt;p&gt;My naive mind said that this was perfectly acceptable and possibly ideal since while the different cultures of the world may have their differences at least all coders are united in a single language. This way the world would be a better place and I could even travel to another country and “speak” in code to another person even though we do not speak the same language. In the end programming languages are &lt;strong&gt;languages&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;While your mind ponders on the above, someone recently sent me a link to an interesting project called &lt;a href="http://www.babylscript.com/"&gt;Babylscript&lt;/a&gt;. I assume the name is a play on the &lt;a href="http://en.wikipedia.org/wiki/Babel_fish_(The_Hitchhiker%27s_Guide_to_the_Galaxy)#Babel_fish"&gt;Babel fish&lt;/a&gt; that was introduced to the world in the Hitchhiker’s Guide to the Galaxy.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Babylscript&lt;/strong&gt;  is a multilingual version of JavaScript. No longer do you need to write your Javascript crazies in a single language. Now you can write confusing code in a multitude of other languages too! (As you may have guessed I am not a complete fan of Javascript, though it does server a purpose.) This project allows you to to switch language in code by adding &lt;strong&gt;---fr---&lt;/strong&gt; to your code to in this example change the base language of the code to French.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;My mind boggles how bad code could become if you have a multicultural team of developers each writing in their own language.&lt;/p&gt;  &lt;p&gt;But why is this not possible? Why can the IDE not just translate the code to your chosen language as a precompile job?&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/28.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2012/07/30/writing-code-in-your-own-language.aspx</guid>
            <pubDate>Mon, 30 Jul 2012 05:32:15 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2012/07/30/writing-code-in-your-own-language.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/28.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/28.aspx</trackback:ping>
        </item>
        <item>
            <title>Select a single field's values using Castle ActiveRecord</title>
            <category>C# .Net</category>
            <category>Castle ActiveRecord</category>
            <category>Academic</category>
            <link>http://blog.fryhard.com/archive/2010/11/09/select-a-single-fields-values-using-castle-activerecord.aspx</link>
            <description>&lt;p&gt;Recently I wanted to retrieve data from a single field in one of my domain objects. This object had already been mapped using &lt;a href="http://www.castleproject.org/activerecord/"&gt;Castle ActiveRecord&lt;/a&gt;, so I didn’t really want to create another data access method to fetch this single field’s data. Here started my bungee jump down the rabbit hole to find sections of the answer on Hibernate, NHibernate and ActiveRecord sites.&lt;/p&gt;
&lt;p&gt;The solution ends up looking rather similar to my previous solution on &lt;a href="http://blog.fryhard.com/archive/2009/05/26/selecting-distinct-records-using-castle-activerecord.aspx"&gt;how to select distinct records using ActiveRecord&lt;/a&gt;, but has one or two key differences.&lt;/p&gt;
&lt;div style="FONT-FAMILY: consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 10pt"&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;DetachedCriteria&lt;/span&gt; singleFieldCriteria = &lt;span style="COLOR: #2b91af"&gt;DetachedCriteria&lt;/span&gt;.For&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Employee&lt;/span&gt;&amp;gt;()&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;   .SetProjection(&lt;span style="COLOR: #2b91af"&gt;Projections&lt;/span&gt;.ProjectionList()&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;                     .Add(&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;"MonthOfBirth"&lt;/span&gt;)), &lt;span style="COLOR: #a31515"&gt;"MonthOfBirth"&lt;/span&gt;))&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;   .SetResultTransformer(&lt;span style="COLOR: #2b91af"&gt;Transformers&lt;/span&gt;.AliasToBean&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Employee&lt;/span&gt;&amp;gt;());&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Employee&lt;/span&gt;&amp;gt; singleFieldResults = &lt;span style="COLOR: #2b91af"&gt;Employee&lt;/span&gt;.FindAll(singleFieldCriteria);&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; singleFieldResults.Select(employee =&amp;gt; employee.MonthOfBirth);&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;In the above example I am selecting all distinct Months of Birth for the list of Employees in our database. I am only interest in fetching the month of birth field and not the rest of the employee’s fields.&lt;/p&gt;
&lt;p&gt;To do this we &lt;u&gt;create a distinct projection&lt;/u&gt; on the MonthOfBirth field.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&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;"MonthOfBirth"&lt;/span&gt;))&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This time we &lt;u&gt;specify a name&lt;/u&gt; for our projection.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Add(&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;"MonthOfBirth"&lt;/span&gt;)), &lt;span style="COLOR: #a31515"&gt;"MonthOfBirth"&lt;/span&gt;))&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We also tell ActiveRecord/NHibernate that we want to &lt;u&gt;transform our results&lt;/u&gt; back into our Employee object. This maps the named projection into the field with the name of the projection. (don’t ask me why the method you need is called AliasToBean – I smell Java...)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;.SetResultTransformer(&lt;span style="COLOR: #2b91af"&gt;Transformers&lt;/span&gt;.AliasToBean&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Employee&lt;/span&gt;&amp;gt;())&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Finally we select out our results and use some Linq to get a list of the single field.&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/25.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2010/11/09/select-a-single-fields-values-using-castle-activerecord.aspx</guid>
            <pubDate>Tue, 09 Nov 2010 13:46:18 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2010/11/09/select-a-single-fields-values-using-castle-activerecord.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/25.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/25.aspx</trackback:ping>
        </item>
        <item>
            <title>Reading XLSX files using C# and EPPlus</title>
            <category>C# .Net</category>
            <category>Academic</category>
            <link>http://blog.fryhard.com/archive/2010/10/28/reading-xlsx-files-using-c-and-epplus.aspx</link>
            <description>&lt;p&gt;A while ago I blogged about a solution to &lt;a href="http://blog.fryhard.com/archive/2010/06/24/solving-ldquothe-microsoft.jet.oledb.4.0-provider-is-not-registered-on-the-local.aspx"&gt;using the Microsoft.Jet.OLEDB.4.0 provider on x64 systems&lt;/a&gt;. The goal of using Microsoft.Jet.OLEDB.4.0 was to connect to and read data out of user-loved .XLS files (Microsoft Excel &amp;lt;= 2003).&lt;/p&gt;
&lt;p&gt;Jumping forward in technology (Microsoft Excel &amp;gt;= 2007) we now have to deal with reading .XLSX files (&lt;a href="http://en.wikipedia.org/wiki/XLSX"&gt;Office Open XML&lt;/a&gt;). These files follow the Office Open XML standard and are meant to be easier to read. One would think that since they are just zip files containing the guts of the document they would be easy (and possibly fun) to read, based to my experience so far, not so much.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Enter &lt;a href="http://epplus.codeplex.com/"&gt;EPPlus&lt;/a&gt; a helpful &lt;em&gt;“.net library that reads and writes Excel 2007 files using the Office Open Xml format (xlsx)”. &lt;/em&gt;With minimal tinkering I was able to read the .xlsx document, that my users wanted to specify the data in, process it and save it to a database.&lt;/p&gt;
&lt;p&gt;The EPPlus project is hosted on &lt;a href="http://www.codeplex.com/"&gt;CodePlex&lt;/a&gt; and seems to be well supported.&lt;/p&gt;
&lt;p&gt;Here is how you can use the EPPlus library:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;1. You will need to add a reference to EPPlus dll (download it from the CodePlex site).&lt;/p&gt;
&lt;p&gt;2. You will need to reference OfficeOpenXml (A namespace in the EPPlus dll).&lt;/p&gt;
&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; OfficeOpenXml;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;3. Then simply read the file and work through the workbook and worksheets&lt;/p&gt;
&lt;div style="FONT-FAMILY: consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 10pt"&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: green"&gt;// Get the file we are going to process&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; existingFile = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;FileInfo&lt;/span&gt;(filePath); &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: green"&gt;// Open and read the XlSX file.&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; (&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; package = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ExcelPackage&lt;/span&gt;(existingFile))&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;{&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: green"&gt;// Get the work book in the file&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: #2b91af"&gt;ExcelWorkbook&lt;/span&gt; workBook = package.Workbook;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (workBook != &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;    {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (workBook.Worksheets.Count &amp;gt; 0)&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;        {&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: green"&gt;// Get the first worksheet&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: #2b91af"&gt;ExcelWorksheet&lt;/span&gt; currentWorksheet = workBook.Worksheets.First();&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: green"&gt;// read some data&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;            &lt;span style="COLOR: blue"&gt;object&lt;/span&gt; col1Header = currentWorksheet.Cells[0, 1].Value;&lt;/p&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Should you feel a need to see some code in action take a look at the &lt;a href="http://www.fryhard.com/downloads/blog/FryHard.EPPlusDemo.1.0.0.0.zip"&gt;quick example&lt;/a&gt; I threw together, you can download it from &lt;a href="http://www.fryhard.com/downloads/blog/FryHard.EPPlusDemo.1.0.0.0.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For those that have got this far and are interested in where the data comes from... head over the most excellent &lt;a href="http://xkcd.com/369/"&gt;XKCD&lt;/a&gt; and do no work for the rest of the day. :)&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/24.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2010/10/28/reading-xlsx-files-using-c-and-epplus.aspx</guid>
            <pubDate>Thu, 28 Oct 2010 04:23:31 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2010/10/28/reading-xlsx-files-using-c-and-epplus.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/24.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/24.aspx</trackback:ping>
        </item>
        <item>
            <title>ClickOnce uninstall string</title>
            <category>C# .Net</category>
            <link>http://blog.fryhard.com/archive/2010/06/25/clickonce-uninstall-string.aspx</link>
            <description>&lt;p&gt;This is another quick reminder (mainly for myself) post that would have been helpful if I had made it the first time I had to solve the problem of uninstalling “invisible” ClickOnce applications.&lt;/p&gt;
&lt;p&gt;One of my users just ran into the situation where&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;The ClickOnce application was not in the “Add Remove programs” window &lt;/li&gt;
    &lt;li&gt;The ClickOnce application was no longer in Outlook’s Trust Center Add-ins window (The application in question is an Outlook add-in) &lt;/li&gt;
    &lt;li&gt;Trying to reinstall the application from the installation URL returned something to the effect of “The latest version of this customization is already installed” &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To solve this we needed to remove the “invisible” ClickOnce application so I opted to try and use the &lt;strong&gt;uninstall&lt;/strong&gt; string that I had heard of previously.&lt;/p&gt;
&lt;p&gt;As per this &lt;a href="http://stackoverflow.com/questions/1266858/uninstall-click-once-clients"&gt;stackoverflow question&lt;/a&gt; the uninstall string can be found in your registry in the &lt;strong&gt;HKEY_CURRENT_USERS\Software\Microsoft\Windows\CurrentVersion\Uninstall\[random string associated with your app]\UninstallString&lt;/strong&gt; value.&lt;/p&gt;
&lt;p&gt;Since the application in question is an Outlook add-in the uninstall string looks something to the effect of:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;C:\Program Files\Common Files\Microsoft Shared\VSTO\[Current Version]\VSTOInstaller.exe /Uninstall [Application Install URL]&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For normal, non Outlook add-ins the string will look something like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;rundll32.exe dfshim.dll,ShArpMaintain [Published application file], Culture=neutral, PublicKeyToken=[Application Token], processorArchitecture=msil&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;&lt;img src="http://blog.fryhard.com/aggbug/23.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2010/06/25/clickonce-uninstall-string.aspx</guid>
            <pubDate>Fri, 25 Jun 2010 07:25:56 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2010/06/25/clickonce-uninstall-string.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/23.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/23.aspx</trackback:ping>
        </item>
        <item>
            <title>Solving &amp;ldquo;The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine&amp;rdquo; problem</title>
            <category>C# .Net</category>
            <link>http://blog.fryhard.com/archive/2010/06/24/solving-ldquothe-microsoft.jet.oledb.4.0-provider-is-not-registered-on-the-local.aspx</link>
            <description>&lt;p&gt;Yes, I know the solution to this problem may be easy to find (just &lt;a href="http://www.google.com/search?q=The+%27Microsoft.Jet.OLEDB.4.0%27+provider+is+not+registered+on+the+local+machine"&gt;Google&lt;/a&gt; the exact error), but as a developer I try and optimise most things that I do (well, except my circum-verbose writing style), so I am just going to “re-index” it here to make it easier to find (for me).&lt;/p&gt;
&lt;p&gt;If you are using OLEDB to read .XLS files into your application then in the end you are using the 'Microsoft.Jet.OLEDB.4.0' provider. The problem comes in when you try and develop on a x64 system.&lt;/p&gt;
&lt;p&gt;At this point you will end up with this error: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;So... &lt;u&gt;The solution&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Simply change your project to build as a 32 bit (x86) application and all will work fine.&lt;/p&gt;
&lt;p&gt;Should this not solve your problem... &lt;a href="http://www.google.com/search?q=The+%27Microsoft.Jet.OLEDB.4.0%27+provider+is+not+registered+on+the+local+machine"&gt;do some reading&lt;/a&gt; :)&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/22.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2010/06/24/solving-ldquothe-microsoft.jet.oledb.4.0-provider-is-not-registered-on-the-local.aspx</guid>
            <pubDate>Thu, 24 Jun 2010 07:33:05 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2010/06/24/solving-ldquothe-microsoft.jet.oledb.4.0-provider-is-not-registered-on-the-local.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/22.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/22.aspx</trackback:ping>
        </item>
        <item>
            <title>Visual Studio 2008 crash after window docking change and debug stop - Revisited</title>
            <category>Applications</category>
            <link>http://blog.fryhard.com/archive/2009/11/10/visual-studio-2008-crash-after-window-docking-change-and-debug.aspx</link>
            <description>&lt;p&gt;A while ago I published what I thought was a fix for fixing the Visual Studio 2008 bug that occurs when stopping debug after having moved the Solution Explorer, Output windows debug windows. &lt;a href="http://blog.fryhard.com/archive/2008/11/26/visual-studio-2008-closes-at-build-outlook-2007-add-in.aspx"&gt;Visual Studio 2008 closes at build, Outlook 2007 Add-In&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;After having just re-installed my machine I attempted to fix this same problem with my documented fix, but alas it did not work. It turns out that the Visual Studio Shell Team has released a Hotfix for this issue, and &lt;strong&gt;it works!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Details on this fix can be found here on &lt;a href="http://code.msdn.microsoft.com/KB960075"&gt;Code.MSDN&lt;/a&gt; or &lt;a href="http://support.microsoft.com/kb/960075"&gt;Microsoft support&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Hope it helps.&lt;/p&gt;&lt;img src="http://blog.fryhard.com/aggbug/21.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Fryhard</dc:creator>
            <guid>http://blog.fryhard.com/archive/2009/11/10/visual-studio-2008-crash-after-window-docking-change-and-debug.aspx</guid>
            <pubDate>Tue, 10 Nov 2009 05:00:46 GMT</pubDate>
            <comments>http://blog.fryhard.com/archive/2009/11/10/visual-studio-2008-crash-after-window-docking-change-and-debug.aspx#feedback</comments>
            <wfw:commentRss>http://blog.fryhard.com/comments/commentRss/21.aspx</wfw:commentRss>
            <trackback:ping>http://blog.fryhard.com/services/trackbacks/21.aspx</trackback:ping>
        </item>
        <item>
            <title>Selecting distinct records using Castle ActiveRecord</title>
            <category>Academic</category>
            <category>Castle ActiveRecord</category>
            <category>C# .Net</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>
    </channel>
</rss>
