<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" 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:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Paul Mrozowski's Blog</title>
    <link>http://www.rcs-solutions.com/blog/</link>
    <description>A day in the life (of a developer)</description>
    <language>en-us</language>
    <copyright>Paul Mrozowski / RCS Solutions, Inc.</copyright>
    <lastBuildDate>Sun, 03 May 2009 22:36:28 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>paulm@rcs-solutions.com</managingEditor>
    <webMaster>paulm@rcs-solutions.com</webMaster>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/PaulMrozowski" type="application/rss+xml" /><item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=d60c48c6-ad06-4e0b-8dcc-727a2053e480</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,d60c48c6-ad06-4e0b-8dcc-727a2053e480.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,d60c48c6-ad06-4e0b-8dcc-727a2053e480.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=d60c48c6-ad06-4e0b-8dcc-727a2053e480</wfw:commentRss>
      
      <title>Southwest Fox 2009</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,d60c48c6-ad06-4e0b-8dcc-727a2053e480.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/s8RHReGQAh4/SouthwestFox2009.aspx</link>
      <pubDate>Sun, 03 May 2009 22:36:28 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
It looks like I'll be speaking at this year's Southwest Fox 2009. I'll be presenting&#xD;
two different topics: &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.swfox.net/sessions.aspx#Full_Text_Search_using_Lucene.NET" target="_blank"&gt;Full&#xD;
Text Search using Lucene.NET&lt;/a&gt; and &#xD;
&lt;br&gt;&lt;a href="http://www.swfox.net/sessions.aspx#Refactoring_Legacy_Code" target="_blank"&gt;Refactoring&#xD;
Legacy Code.&lt;/a&gt;&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I'm looking forward to catching Craig Boyd's &lt;a href="http://www.swfox.net/sessions.aspx#FLLs_and_the_Visual_FoxPro_API" target="_blank"&gt;FLLs&#xD;
and the Visual FoxPro API&lt;/a&gt; session (assuming the schedule allows it). I had debated&#xD;
whether to interface to Lucene.NET from an FLL, but ultimately decided that it didn't&#xD;
quite fit with the way I imagined it being used. Craig has a number of different FLL's&#xD;
over on his &lt;a href="http://www.sweetpotatosoftware.com/" target="_blank"&gt;site&lt;/a&gt;,&#xD;
so if you've ever wondered how to put together an FLL this should be good. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Christof Wollenhaupt's session, &lt;a href="http://www.swfox.net/sessions.aspx#Using_.NET_in_FoxPro_Applications" target="_blank"&gt;Using&#xD;
.NET in FoxPro Applications&lt;/a&gt; should also be a nice companion to my Lucene session.&#xD;
I hadn't planned on covering too much of the interop story in my session, I'll be&#xD;
focusing more on actual use. This should give you a bit more background if you're&#xD;
interested.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Refactoring is a big topic, so you might want to check out Alan Stevens's &lt;a href="http://www.swfox.net/sessions.aspx#Break_It_Down:_Dealing_With_Legacy_Code" target="_blank"&gt;Break&#xD;
It Down: Dealing With Legacy Code&lt;/a&gt; pre-con session. Then check out my session as&#xD;
a refresher and (hopefully) come away with some other ideas on how to manage legacy&#xD;
code. If you can't make the pre-con, hopefully you'll still find my session valuable.&#xD;
I plan on showing real code and some of the ways I have handled refactoring, things&#xD;
to look out for, and various refactoring techniques.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I look forward to seeing you at &lt;a href="http://www.swfox.net/register.aspx" target="_blank"&gt;Southwest&#xD;
Fox&lt;/a&gt;. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;Links&lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a title="http://www.swfox.net/sessions.aspx#Full_Text_Search_using_Lucene.NET" href="http://www.swfox.net/sessions.aspx#Full_Text_Search_using_Lucene.NET"&gt;http://www.swfox.net/sessions.aspx#Full_Text_Search_using_Lucene.NET&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://www.swfox.net/sessions.aspx#Refactoring_Legacy_Code" href="http://www.swfox.net/sessions.aspx#Refactoring_Legacy_Code"&gt;http://www.swfox.net/sessions.aspx#Refactoring_Legacy_Code&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://www.swfox.net/sessions.aspx#FLLs_and_the_Visual_FoxPro_API" href="http://www.swfox.net/sessions.aspx#FLLs_and_the_Visual_FoxPro_API"&gt;http://www.swfox.net/sessions.aspx#FLLs_and_the_Visual_FoxPro_API&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://www.swfox.net/sessions.aspx#Using_.NET_in_FoxPro_Applications" href="http://www.swfox.net/sessions.aspx#Using_.NET_in_FoxPro_Applications"&gt;http://www.swfox.net/sessions.aspx#Using_.NET_in_FoxPro_Applications&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://www.swfox.net/sessions.aspx#Break_It_Down:_Dealing_With_Legacy_Code" href="http://www.swfox.net/sessions.aspx#Break_It_Down:_Dealing_With_Legacy_Code"&gt;http://www.swfox.net/sessions.aspx#Break_It_Down:_Dealing_With_Legacy_Code&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://www.swfox.net/register.aspx" href="http://www.swfox.net/register.aspx"&gt;http://www.swfox.net/register.aspx&lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=d60c48c6-ad06-4e0b-8dcc-727a2053e480"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=s8RHReGQAh4:TKPWat9m7Ws:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=s8RHReGQAh4:TKPWat9m7Ws:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=s8RHReGQAh4:TKPWat9m7Ws:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=s8RHReGQAh4:TKPWat9m7Ws:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=s8RHReGQAh4:TKPWat9m7Ws:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=s8RHReGQAh4:TKPWat9m7Ws:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,d60c48c6-ad06-4e0b-8dcc-727a2053e480.aspx</comments>
      <category>Conference</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2009/05/03/SouthwestFox2009.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=f0ffb32b-b0e0-434c-895c-71a384f20799</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,f0ffb32b-b0e0-434c-895c-71a384f20799.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,f0ffb32b-b0e0-434c-895c-71a384f20799.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=f0ffb32b-b0e0-434c-895c-71a384f20799</wfw:commentRss>
      
      <title>What's an Interface?</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,f0ffb32b-b0e0-434c-895c-71a384f20799.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/F34EvnuumKU/WhatsAnInterface.aspx</link>
      <pubDate>Tue, 21 Apr 2009 22:38:58 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Check out my article in this month's &lt;a href="http://www.universalthread.com/ViewPageMainPage.aspx?Session=37395863654242725751383D204A2F4E456275325279766563597439693271307250673D3D" target="_blank"&gt;UT&#xD;
Magazine (April 2009)&lt;/a&gt; about interfaces in .NET. I try to explain the how's and&#xD;
why's of them, especially when coming from a loosely-typed language (such as VFP).&#xD;
Hopefully you'll find it useful.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=f0ffb32b-b0e0-434c-895c-71a384f20799"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=F34EvnuumKU:eDzw_PjgCVY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=F34EvnuumKU:eDzw_PjgCVY:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=F34EvnuumKU:eDzw_PjgCVY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=F34EvnuumKU:eDzw_PjgCVY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=F34EvnuumKU:eDzw_PjgCVY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=F34EvnuumKU:eDzw_PjgCVY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,f0ffb32b-b0e0-434c-895c-71a384f20799.aspx</comments>
      <category>.NET</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2009/04/21/WhatsAnInterface.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=039366e3-976f-400e-9c23-ccbcae3c1254</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,039366e3-976f-400e-9c23-ccbcae3c1254.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,039366e3-976f-400e-9c23-ccbcae3c1254.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=039366e3-976f-400e-9c23-ccbcae3c1254</wfw:commentRss>
      <slash:comments>9</slash:comments>
      
      <title>Updated VFP Calendar Control</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,039366e3-976f-400e-9c23-ccbcae3c1254.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/OwLyKBaRBrs/UpdatedVFPCalendarControl.aspx</link>
      <pubDate>Sat, 21 Feb 2009 22:36:05 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;style type="text/css"&gt;&#xD;
.code { background-color: #efefef; font-family:consolas,courier new; }&#xD;
&lt;/style&gt;&#xD;
        &lt;p&gt;&#xD;
I just &lt;a href="http://www.rcs-solutions.com/downloads.aspx" target="_blank"&gt;posted&lt;/a&gt; a&#xD;
new release of my calendar controls that includes a bunch of new functionality, some&#xD;
more documentation (courtesy of &lt;a href="http://www.west-wind.com/wwHelp/" target="_blank"&gt;HTML&#xD;
Help Builder&lt;/a&gt; from West Wind), along with a few more samples of how this is all&#xD;
supposed to work. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;A Bit of History &lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
This all initially started with a small calendar. I initially planned on using Microsoft's&#xD;
ActiveX calendar but realized I needed to be able to select multiple days. Their control&#xD;
really didn't quite work the way I needed it to, so I created my own. I created three&#xD;
different sizes (normal, smaller, and smallest) just because it was easy to do (they're&#xD;
all the same control) and I thought I might need it. Like any project the "hey, wouldn't&#xD;
it be cool if..." features started to grow. In some cases, I needed this functionality&#xD;
for an application anyway, so I went ahead and improved them. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="200" alt="Calendar" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/UpdatedVFPCalendarControl_DF33/Calendar_3.png" width="215" border="0"&gt;&lt;/img&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The first thing I ended up needing was a drop-down calendar. I already had the calendar&#xD;
portion, so all I needed to do was show and hide it when you clicked on a button next&#xD;
to a text box. So that's basically what I did. It worked well enough, but if the control&#xD;
happened to be at the bottom of a form it was clipped - the initial control was based&#xD;
on a container. I moved this into a form and adjusted the code a bit so it would be&#xD;
able to bleed off the form. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I needed to be able to bind to a date/time field but only display the date portion&#xD;
for data coming from SQL Server, so I named it "rcsDatetimePicker". In hindsight,&#xD;
not a great name. It gives you the impression it lets you view/edit both the date&#xD;
and time portion when in fact it doesn't. At this point I've got a bunch of code which&#xD;
depends on it so it's not being renamed (sorry). &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="223" alt="DatePicker" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/UpdatedVFPCalendarControl_DF33/DatePicker_3.png" width="218" border="0"&gt;&lt;/img&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
A common use-case for dropdown calendars is to pick a date range. I took an idea from&#xD;
a previous job where you could link two date controls to keep the start date and the&#xD;
end dates from overlapping (ex. the start date can be after the end date). So this&#xD;
was added. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I worked on another project which needed a time control (hours/minutes) so I created&#xD;
one. It seemed like a natural fit to this calendar library so it's been added in.&#xD;
The next logical idea is, "hey, I need a date/time dropdown calendar". The better&#xD;
name for this was already taken, so this was was named rcsCtrDateTimePicker. Yeah,&#xD;
not great, but I didn't have any other ideas. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/UpdatedVFPCalendarControl_DF33/DateTimePicker_2.png"&gt;&#xD;
            &lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="228" alt="DateTimePicker" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/UpdatedVFPCalendarControl_DF33/DateTimePicker_thumb.png" width="285" border="0"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Finally, I just worked on an application which needed an Outlook-style calendar (month&#xD;
view). It seemed like I already had most of the work done from my other calendar,&#xD;
so (I optimistically though) it wouldn't be a big deal to re-purpose it. It actually&#xD;
required a number of changes so it could be nicely resized, display events, etc. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
That's basically where the library is today: 3 different sized "static" calendars,&#xD;
a drop-down date w/calendar, a drop-down date/time w/calendar, a time control, plus&#xD;
a large resizable calendar that can have events displayed on it. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="449" alt="LargeCalendar" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/UpdatedVFPCalendarControl_DF33/LargeCalendar_3.png" width="501" border="0"&gt;&lt;/img&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="469" alt="LargeCalendarMoreEvents" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/UpdatedVFPCalendarControl_DF33/LargeCalendarMoreEvents_3.png" width="551" border="0"&gt;&lt;/img&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I've tried to provide a few more examples of how these controls can be used along&#xD;
with a help file. It's not as comprehensive as I'd like, but it's a decent start. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;Misc. Notes&lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
One thing that's not really covered in the help yet is related to performance of the&#xD;
large calendar when you have a lot of events on it. I ran into this during testing&#xD;
- as you add more events, the calendar navigation became slower and slower. I attempted&#xD;
to optimize this a bit but ultimately ended up modifying my application code to only&#xD;
populate events for the current month plus one month prior and one month following.&#xD;
The calendar shows days from the previous and following months, so if I didn't populate&#xD;
them they'd be missing from the calendar. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
You can hook in populating events via the RefreshEvents() event. It fires anytime&#xD;
the calendar needs to be refreshed. I'd suggest just using BINDEVENT to call a form-level&#xD;
method for this event: &#xD;
&lt;/p&gt;&#xD;
        &lt;div class="code"&gt;&#xD;
          &lt;p&gt;&#xD;
BINDEVENT(This.ctrCalendar, "RefreshEvents", This, "RefreshEvents")  &#xD;
&lt;/p&gt;&#xD;
        &lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
You can determine the current month by looking at the iCurrentYear/iCurrentMonth properties. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;Getting Started&lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I'd suggest playing around with the samples and digging through the help file to get&#xD;
started. The examples cover most of the basic functionality (try clicking on everything&#xD;
and hovering over things, resizing, etc.) and the help file explains some of the class&#xD;
structure. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Let me know what you think. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;Links&lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a title="http://www.west-wind.com/wwHelp/" href="http://www.west-wind.com/wwHelp/"&gt;http://www.west-wind.com/wwHelp/&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a href="http://www.rcs-solutions.com/downloads.aspx"&gt;http://www.rcs-solutions.com/downloads.aspx&lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=039366e3-976f-400e-9c23-ccbcae3c1254"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=OwLyKBaRBrs:VDFkBmg3DdM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=OwLyKBaRBrs:VDFkBmg3DdM:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=OwLyKBaRBrs:VDFkBmg3DdM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=OwLyKBaRBrs:VDFkBmg3DdM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=OwLyKBaRBrs:VDFkBmg3DdM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=OwLyKBaRBrs:VDFkBmg3DdM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,039366e3-976f-400e-9c23-ccbcae3c1254.aspx</comments>
      <category>VFP</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2009/02/21/UpdatedVFPCalendarControl.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=f3bf9f27-a137-414b-a849-14aa5342b6c2</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,f3bf9f27-a137-414b-a849-14aa5342b6c2.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,f3bf9f27-a137-414b-a849-14aa5342b6c2.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=f3bf9f27-a137-414b-a849-14aa5342b6c2</wfw:commentRss>
      
      <title>Collapsing Comments Update</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,f3bf9f27-a137-414b-a849-14aa5342b6c2.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/tKwinAhkCJA/CollapsingCommentsUpdate.aspx</link>
      <pubDate>Sat, 14 Feb 2009 17:39:48 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I just uploaded an &lt;a href="http://www.rcs-solutions.com/downloads.aspx" target="_blank"&gt;update&lt;/a&gt; for&#xD;
the collapsing comments plug-in for CodeRush/Refactor! I noticed after updating to&#xD;
the latest version (3.2.3) that it suddenly stopped working. After a bunch of digging,&#xD;
and going back and forth with &lt;a href="http://twitter.com/rorybecker" target="_blank"&gt;Rory&#xD;
Becker&lt;/a&gt; on twitter. He suggested I take a look at manually loading the plug-in&#xD;
via the new Plug-in Manager (DevExpress &amp;gt; Options &amp;gt; Core &amp;gt; Plug-in Manager).&#xD;
I noticed that my plug-in (which is written as a refactoring) had it's Load Type set&#xD;
as "Demand", but most of the other ones were set as "Idle". After a bit of digging&#xD;
I figured out how to change this in my code - it's an attribute in AssemblyInfo. Making&#xD;
this change and recompiling seemed to fix the issue.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;Links:&lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a title="http://www.rcs-solutions.com/downloads.aspx" href="http://www.rcs-solutions.com/downloads.aspx"&gt;http://www.rcs-solutions.com/downloads.aspx&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a href="http://twitter.com/rorybecker"&gt;http://twitter.com/rorybecker&lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=f3bf9f27-a137-414b-a849-14aa5342b6c2"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=tKwinAhkCJA:AyvcLhsmc6k:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=tKwinAhkCJA:AyvcLhsmc6k:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=tKwinAhkCJA:AyvcLhsmc6k:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=tKwinAhkCJA:AyvcLhsmc6k:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=tKwinAhkCJA:AyvcLhsmc6k:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=tKwinAhkCJA:AyvcLhsmc6k:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,f3bf9f27-a137-414b-a849-14aa5342b6c2.aspx</comments>
      <category>CodeRush</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2009/02/14/CollapsingCommentsUpdate.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=0a4cbbbe-dd11-4aac-92fc-fecdabab49b6</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,0a4cbbbe-dd11-4aac-92fc-fecdabab49b6.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,0a4cbbbe-dd11-4aac-92fc-fecdabab49b6.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=0a4cbbbe-dd11-4aac-92fc-fecdabab49b6</wfw:commentRss>
      <slash:comments>2</slash:comments>
      
      <title>Query for Birthdays</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,0a4cbbbe-dd11-4aac-92fc-fecdabab49b6.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/k7SC10hTs_A/QueryForBirthdays.aspx</link>
      <pubDate>Sat, 07 Feb 2009 20:22:48 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;style type="text/css"&gt;&#xD;
.code { background-color: #efefef; font-family:consolas,courier new; }&#xD;
&lt;/style&gt;&#xD;
        &lt;p&gt;&#xD;
I just finished up a report which generates a list of customers whose birthdays fall&#xD;
within a specified date range. I wrote a simple query which did essentially:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;br&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;div class="code"&gt;DECLARE @startDate datetime&lt;br&gt;&#xD;
DECLARE @endDate datetime&lt;br&gt;&#xD;
SET @startDate = '2009-2-15'&lt;br&gt;&#xD;
SET @endDate = '2009-3-14'&lt;br&gt;&lt;br&gt;&#xD;
SELECT c.iid,&lt;br&gt;&#xD;
        c.FirstName,&lt;br&gt;&#xD;
        c.LastName,&lt;br&gt;&#xD;
        c.BirthDate,&lt;br&gt;&#xD;
        c.Address1,&lt;br&gt;&#xD;
        c.Address2,&lt;br&gt;&#xD;
        c.City,&lt;br&gt;&#xD;
        c.State,&lt;br&gt;&#xD;
        c.ZipCode&lt;br&gt;&#xD;
   FROM Customers c&lt;br&gt;&#xD;
  WHERE c.BirthDate BETWEEN @startDate AND @endDate&#xD;
&lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;br&gt;&#xD;
Of course, that didn't work. That is, unless our customers happened to actually just&#xD;
been born (as of when I wrote this they wouldn't have been even born yet). Hmm....My&#xD;
first thought was maybe joining this to a date table to get the month and day split&#xD;
apart but that idea falls apart pretty quickly so I dismissed it. I'll come back to&#xD;
this idea in a second. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The other simple way to do this is to convert the date to a day of the year, so January&#xD;
1st is 1, Jan. 2nd is 2, December 31st is 365. SQL Server includes a nice DATEPART()&#xD;
function to make this easy - you can specify that you want the day of the year with&#xD;
it. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
So my query was rewritten as: &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;div class="code"&gt;&#xD;
SELECT c.iid,&lt;br&gt;&#xD;
        c.FirstName,&lt;br&gt;&#xD;
        c.LastName,&lt;br&gt;&#xD;
        c.BirthDate,&lt;br&gt;&#xD;
        c.Address1,&lt;br&gt;&#xD;
        c.Address2,&lt;br&gt;&#xD;
        c.City,&lt;br&gt;&#xD;
        c.State,&lt;br&gt;&#xD;
        c.ZipCode&lt;br&gt;&#xD;
   FROM Customers c&lt;br&gt;&#xD;
  WHERE DATEPART(dayofyear, c.BirthDate) &#xD;
&lt;br&gt;&#xD;
BETWEEN DATEPART(dayofyear, @startDate) AND DATEPART(dayofyear, @endDate)&#xD;
&lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;br&gt;&#xD;
While this one works it's a bit slow. That's not so surprising since it has to use&#xD;
DATEPART on the rows to generate the day of the year in the WHERE clause. My actual&#xD;
code filters the customers a bit more but it was still a fair number of records. Ultimately,&#xD;
since this a summary/reporting table that gets populated and updated nightly I just&#xD;
added another (integer) column to store the precalculated day of the year number. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Surprisingly, this version isn't that much faster - maybe 15% or so. Apparently DATEPART&#xD;
is pretty quick. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
It wasn't until after making these changes that I realized I could have added a day&#xD;
of the year column to my date table, done a join then used this column in my WHERE&#xD;
clause. That actually would have been easier if it had occurred to me sooner. I'm&#xD;
guessing performance is probably equivalent, especially since adding the column directly&#xD;
in the table didn't have a huge impact on the speed of the query.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=0a4cbbbe-dd11-4aac-92fc-fecdabab49b6"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=k7SC10hTs_A:LAS7pb0kbcg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=k7SC10hTs_A:LAS7pb0kbcg:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=k7SC10hTs_A:LAS7pb0kbcg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=k7SC10hTs_A:LAS7pb0kbcg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=k7SC10hTs_A:LAS7pb0kbcg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=k7SC10hTs_A:LAS7pb0kbcg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,0a4cbbbe-dd11-4aac-92fc-fecdabab49b6.aspx</comments>
      <category>SQL</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2009/02/07/QueryForBirthdays.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=a3630b61-fca5-458f-a0b8-b0c59f856ad2</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,a3630b61-fca5-458f-a0b8-b0c59f856ad2.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,a3630b61-fca5-458f-a0b8-b0c59f856ad2.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a3630b61-fca5-458f-a0b8-b0c59f856ad2</wfw:commentRss>
      <slash:comments>4</slash:comments>
      
      <title>How to Change the CodeRush Refactor Key</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,a3630b61-fca5-458f-a0b8-b0c59f856ad2.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/8hUR8m4BFxI/HowToChangeTheCodeRushRefactorKey.aspx</link>
      <pubDate>Sat, 17 Jan 2009 01:17:22 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I've been using CR/R! for a while and one of the simplest changes I've made that makes&#xD;
using it a bit easier is redefining the "Refactor" key - that's the key which causes&#xD;
the refactoring options to pop-up. I've switched mine to just use ` from its default&#xD;
of Ctrl+` - one keypress (it's not like I use the dumb key for much of anything else).&#xD;
There are some many options in CR/R! it's not always easy to find this. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
To set it: &#xD;
&lt;/p&gt;&#xD;
        &lt;ul&gt;&#xD;
          &lt;li&gt;&#xD;
DevExpress &amp;gt; Options&lt;/li&gt;&#xD;
          &lt;li&gt;&#xD;
From the side menu select "IDE", then "Shortcuts"&lt;/li&gt;&#xD;
          &lt;li&gt;&#xD;
In the list you should see "Refactor!", underneath that is the key bound to Refactor.&lt;/li&gt;&#xD;
          &lt;li&gt;&#xD;
Click on it and on the right hand side change they key binding to whatever you'd like.&lt;/li&gt;&#xD;
          &lt;li&gt;&#xD;
Hit Apply. &#xD;
&lt;/li&gt;&#xD;
        &lt;/ul&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="547" alt="RefactorKey" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/HowtoChangetheCodeRushRefactorKey_11D4F/RefactorKey_3.png" width="1030" border="0"&gt;&lt;/img&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
That all that's needed. &#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=a3630b61-fca5-458f-a0b8-b0c59f856ad2"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=8hUR8m4BFxI:dYzAnFNdW6Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=8hUR8m4BFxI:dYzAnFNdW6Q:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=8hUR8m4BFxI:dYzAnFNdW6Q:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=8hUR8m4BFxI:dYzAnFNdW6Q:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=8hUR8m4BFxI:dYzAnFNdW6Q:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=8hUR8m4BFxI:dYzAnFNdW6Q:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,a3630b61-fca5-458f-a0b8-b0c59f856ad2.aspx</comments>
      <category>CodeRush</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2009/01/17/HowToChangeTheCodeRushRefactorKey.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=32a4ffa4-0389-4b6c-94a3-3f637f5cac89</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,32a4ffa4-0389-4b6c-94a3-3f637f5cac89.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,32a4ffa4-0389-4b6c-94a3-3f637f5cac89.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=32a4ffa4-0389-4b6c-94a3-3f637f5cac89</wfw:commentRss>
      <slash:comments>3</slash:comments>
      
      <title>Convert DataTable to CSV via Extension Method</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,32a4ffa4-0389-4b6c-94a3-3f637f5cac89.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/e2dBYX12dfM/ConvertDataTableToCSVViaExtensionMethod.aspx</link>
      <pubDate>Thu, 15 Jan 2009 01:57:00 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;style type="text/css"&gt;&#xD;
.code { background-color: #efefef; font-family:consolas,courier new; }&#xD;
&lt;/style&gt;&#xD;
Extension methods were added as a new compiler feature in .NET 3.5. More specifically,&#xD;
that means you can use VS 2008 to use an extension method and then use VS's multi-targeting&#xD;
to run it under .NET 2.0. They're basically a means of tacking on methods onto existing&#xD;
classes or interfaces w/o actually needed to subclass or modify an interface. It's&#xD;
used extensively by (and added because of) LINQ. The methods aren't really part of&#xD;
the class, but the way you use them (and the way they appear in intellisense) make&#xD;
them feel like they're now part of the class. They're essentially static methods scoped&#xD;
to a specific interface or class. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I've been playing around with them a bit and ran into a case where I thought they'd&#xD;
be kind of a cool fit. I've needed to be able to convert a datatable into a comma-delimited&#xD;
file (CSV) so it can easily be opening in something like Excel, or pretty much anything&#xD;
that understands CSV files. I could create a separate class to do this, but it seems&#xD;
like this should be part of the DataTable class. To write an extension method you&#xD;
basically create a static method in a static class and prefix the first parameter&#xD;
with "this". Yep, that's about it. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I wanted it to basically work like this: &#xD;
&lt;/p&gt;&#xD;
        &lt;div class="code"&gt;DataTable table = myBizObj.DataSet.Tables["SomeTable"]; &#xD;
&lt;br&gt;&#xD;
string csv = table.ToCSV(); &#xD;
&lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
Creating the CSV is pretty straightforward - I loop through the column headers to&#xD;
generate the first header row, then I loop through each row in the table, then each&#xD;
item in the ItemArray of the row. I specifically decided to use quotes as delimiters&#xD;
around everything to keep it simple - the rules as to when you can/should include&#xD;
quotes for a CSV are pretty complicated. The only thing I do is escape out embedded&#xD;
quotes in the data by doubling them, ex. " becomes "". As soon as I had it working,&#xD;
I decided to create a few more overloads to let me control whether a header row was&#xD;
required, and the actual delimiter used (ex. instead of comma you could change it&#xD;
to a | pipe for example). Their is some example code in the XML help at the top of&#xD;
the class. In addition, I'm actually using this for a web page so it might be helpful&#xD;
to see what that code looks like: &#xD;
&lt;/p&gt;&#xD;
        &lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;string&lt;/span&gt; results = act.DataSet.Tables[tableName].ToCSV();&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;string&lt;/span&gt; mimeType = RCSSolutions.Web.&lt;span style="color: #2b91af"&gt;Utility&lt;/span&gt;.DetermineMimeType(&lt;span style="background: #e5e5e5"&gt;"csv"&lt;/span&gt;);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
Response.ContentType = mimeType;&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
Response.AddHeader(&lt;span style="background: #e5e5e5"&gt;"Content-Length"&lt;/span&gt;, results.Length.ToString());&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
Response.AddHeader(&lt;span style="background: #e5e5e5"&gt;"Content-disposition"&lt;/span&gt;,&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                  &#xD;
s&lt;span style="color: blue"&gt;tring&lt;/span&gt;.Format(&lt;span style="background: #e5e5e5"&gt;"attachment;filename={0}"&lt;/span&gt;, &lt;span style="background: #e5e5e5"&gt;"DelimitedList.CSV"&lt;/span&gt;));&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
Response.Write(results);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
Response.End();&#xD;
&lt;/p&gt;&#xD;
        &lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
I'm calling out to another helper class which returns the mime type - in this case,&#xD;
all it does is return "application/csv". The above code basically pops open a dialog&#xD;
box with the file name filled in the browser on the client side. &#xD;
&lt;/p&gt;&#xD;
        &lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;using&lt;/span&gt; System;&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;using&lt;/span&gt; System.Collections.Generic;&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;using&lt;/span&gt; System.Data;&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;using&lt;/span&gt; System.Linq;&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;using&lt;/span&gt; System.Text;&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;namespace&lt;/span&gt; RCSSolutions.Utility&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
{&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;para&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;Various&#xD;
extension methods.&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/para&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; Sample&#xD;
of using ToCSV&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;example&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; DataTable&#xD;
table = dv.Table;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; //&#xD;
Assumes table is a DataTable&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; string&#xD;
result = table.ToCSV(true);&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; System.IO.File.WriteAllText(@"C:\sample.csv",&#xD;
result);&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; System.Diagnostics.Process&#xD;
proc = new System.Diagnostics.Process();&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; proc.StartInfo.FileName&#xD;
= @"C:\sample.csv";&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; proc.StartInfo.UseShellExecute&#xD;
= true;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; proc.Start();&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/example&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: blue"&gt;public&lt;/span&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt;&lt;span style="color: blue"&gt;class&lt;/span&gt;&lt;span style="color: #2b91af"&gt;Extensions&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    {        &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; Converts&#xD;
the passed in data table to a CSV-style string.       &lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param&#xD;
name="table"&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;Table to convert&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;Resulting&#xD;
CSV-style string&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: blue"&gt;public&lt;/span&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; ToCSV(&lt;span style="color: blue"&gt;this&lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataTable&lt;/span&gt; table)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        {&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;return&lt;/span&gt; ToCSV(table, &lt;span style="background: #e5e5e5"&gt;","&lt;/span&gt;, &lt;span style="color: blue"&gt;true&lt;/span&gt;);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        }&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; Converts&#xD;
the passed in data table to a CSV-style string.&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param&#xD;
name="table"&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;Table to convert&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param&#xD;
name="includeHeader"&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;true - include headers&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;br/&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; false&#xD;
- do not include header column&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;Resulting&#xD;
CSV-style string&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: blue"&gt;public&lt;/span&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; ToCSV(&lt;span style="color: blue"&gt;this&lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataTable&lt;/span&gt; table, &lt;span style="color: blue"&gt;bool&lt;/span&gt; includeHeader)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        {&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;return&lt;/span&gt; ToCSV(table, &lt;span style="background: #e5e5e5"&gt;","&lt;/span&gt;,&#xD;
includeHeader);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        }&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; Converts&#xD;
the passed in data table to a CSV-style string.&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param&#xD;
name="table"&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;Table to convert&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param&#xD;
name="delimiter"&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;Delimiter used to separate&#xD;
fields&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param&#xD;
name="includeHeader"&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;true - include headers&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;br/&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; false&#xD;
- do not include header column&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;Resulting&#xD;
CSV-style string&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: blue"&gt;public&lt;/span&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; ToCSV(&lt;span style="color: blue"&gt;this&lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataTable&lt;/span&gt; table, &lt;span style="color: blue"&gt;string&lt;/span&gt; delimiter, &lt;span style="color: blue"&gt;bool&lt;/span&gt; includeHeader)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        {&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: #2b91af"&gt;StringBuilder&lt;/span&gt; result&#xD;
= &lt;span style="color: blue"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af"&gt;StringBuilder&lt;/span&gt;();&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;if&lt;/span&gt; (includeHeader)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            {&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;DataColumn&lt;/span&gt; column &lt;span style="color: blue"&gt;in&lt;/span&gt; table.Columns)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
               &#xD;
{&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                   &#xD;
result.Append(column.ColumnName);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                   &#xD;
result.Append(delimiter);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
               &#xD;
}&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
               &#xD;
result.Remove(--result.Length, 0);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
               &#xD;
result.Append(&lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.NewLine);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            }&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;DataRow&lt;/span&gt; row &lt;span style="color: blue"&gt;in&lt;/span&gt; table.Rows)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            {&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;object&lt;/span&gt; item &lt;span style="color: blue"&gt;in&lt;/span&gt; row.ItemArray)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
               &#xD;
{&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                    &lt;span style="color: blue"&gt;if&lt;/span&gt; (item &lt;span style="color: blue"&gt;is&lt;/span&gt; System.&lt;span style="color: #2b91af"&gt;DBNull&lt;/span&gt;)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                       &#xD;
result.Append(delimiter);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                    &lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                   &#xD;
{&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                        &lt;span style="color: blue"&gt;string&lt;/span&gt; itemAsString&#xD;
= item.ToString();&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                        &lt;span style="background: #ffffbf"&gt;//&#xD;
Double up all embedded double quotes&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                       &#xD;
itemAsString = itemAsString.Replace(&lt;span style="background: #e5e5e5"&gt;"\""&lt;/span&gt;, &lt;span style="background: #e5e5e5"&gt;"\"\""&lt;/span&gt;);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                        &lt;span style="background: #ffffbf"&gt;//&#xD;
To keep things simple, always delimit with double-quotes&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                        &lt;span style="background: #ffffbf"&gt;//&#xD;
so we don't have to determine in which cases they're necessary&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                        &lt;span style="background: #ffffbf"&gt;//&#xD;
and which cases they're not.&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                       &#xD;
itemAsString = &lt;span style="background: #e5e5e5"&gt;"\""&lt;/span&gt; + itemAsString + &lt;span style="background: #e5e5e5"&gt;"\""&lt;/span&gt;;&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                       &#xD;
result.Append(itemAsString + delimiter);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                   &#xD;
}&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
               &#xD;
}&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
               &#xD;
result.Remove(--result.Length, 0);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
               &#xD;
result.Append(&lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.NewLine);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            }&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;return&lt;/span&gt; result.ToString();&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        }&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    }&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
}&#xD;
&lt;/p&gt;&#xD;
        &lt;/div&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=32a4ffa4-0389-4b6c-94a3-3f637f5cac89"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=e2dBYX12dfM:U2g_NLQBwoI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=e2dBYX12dfM:U2g_NLQBwoI:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=e2dBYX12dfM:U2g_NLQBwoI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=e2dBYX12dfM:U2g_NLQBwoI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=e2dBYX12dfM:U2g_NLQBwoI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=e2dBYX12dfM:U2g_NLQBwoI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,32a4ffa4-0389-4b6c-94a3-3f637f5cac89.aspx</comments>
      <category>.NET</category>
      <category>C#</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2009/01/15/ConvertDataTableToCSVViaExtensionMethod.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=2e821787-88b3-4afc-8080-e91872cd3106</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,2e821787-88b3-4afc-8080-e91872cd3106.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,2e821787-88b3-4afc-8080-e91872cd3106.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=2e821787-88b3-4afc-8080-e91872cd3106</wfw:commentRss>
      
      <title>Don't Clog the Tubes</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,2e821787-88b3-4afc-8080-e91872cd3106.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/G0ZZr6xMw2c/DontClogTheTubes.aspx</link>
      <pubDate>Wed, 24 Dec 2008 03:12:17 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I was trolling &lt;a href="http://digg.com" target="_blank"&gt;Digg&lt;/a&gt; tonight and ran&#xD;
across &lt;a href="http://news.cnet.com/8301-13772_3-10125016-52.html?part=rss" target="_blank"&gt;this&#xD;
article&lt;/a&gt; about finding rare songs on &lt;a href="http://www.youtube.com" target="_blank"&gt;YouTube&lt;/a&gt;.&#xD;
I hadn't really thought about it but I had found some great &lt;a href="http://www.youtube.com/watch?v=M_bvT-DGcWw" target="_blank"&gt;Pink&#xD;
Floyd&lt;/a&gt; videos on there a while back. I've had a song (not Pink Floyd) knocking&#xD;
around in my brain for a while that I was never able to identify; all I could remember&#xD;
was "suckerpunch". So I typed "suckerpunch song" into the search on YouTube and bang, &lt;a href="http://www.youtube.com/watch?v=plBna98XZNQ" target="_blank"&gt;there&#xD;
it was&lt;/a&gt;. Actually, after hearing this again (besides realizing it was from around&#xD;
1993) was how much this sounded like Nine Inch Nails, &lt;a href="http://www.youtube.com/watch?v=U2LwEQFK3qc" target="_blank"&gt;March&#xD;
of the Pigs&lt;/a&gt; (released around the same time). OK, it doesn't quite match up as&#xD;
well as it did in my head (or as well as &lt;a href="http://www.youtube.com/watch?v=7xNQZHuAQJ8" target="_blank"&gt;this&lt;/a&gt;),&#xD;
but whatever. It's got the same sort of feel.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
That got me thinking about when I saw Pink Floyd at the Pontiac Silverdome; I was&#xD;
trying to figure out &lt;a href="http://ourworld.compuserve.com/homepages/PFArchives/tourdate.htm" target="_blank"&gt;what&#xD;
year I went&lt;/a&gt;. This, of course, got me thinking about the first concert I ever saw: &lt;a href="http://www.maidenfans.com/imc/index.php?url=tour06_sit/dates06_sit&amp;amp;link=tours&amp;amp;lang=deu" target="_blank"&gt;Iron&#xD;
Maiden at Joe Louis Arena&lt;/a&gt;. That led me back to &lt;a href="http://www.youtube.com/watch?v=AUOpUqni0_g" target="_blank"&gt;YouTube&lt;/a&gt;.&#xD;
And &lt;a href="http://www.youtube.com/watch?v=e39D8VBQ4sw" target="_blank"&gt;Guitar Hero&lt;/a&gt;.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The internets is cool. And a huge waste of time. But mostly cool.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;Links:&lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://digg.com"&gt;http://digg.com&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://news.cnet.com/8301-13772_3-10125016-52.html?part=rss" href="http://news.cnet.com/8301-13772_3-10125016-52.html?part=rss"&gt;http://news.cnet.com/8301-13772_3-10125016-52.html?part=rss&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://www.youtube.com" href="http://www.youtube.com"&gt;http://www.youtube.com&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a href="http://www.youtube.com/watch?v=M_bvT-DGcWw" target="_blank"&gt;http://www.youtube.com/watch?v=M_bvT-DGcWw&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://www.youtube.com/watch?v=plBna98XZNQ" href="http://www.youtube.com/watch?v=plBna98XZNQ"&gt;http://www.youtube.com/watch?v=plBna98XZNQ&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a href="http://www.youtube.com/watch?v=U2LwEQFK3qc" target="_blank"&gt;http://www.youtube.com/watch?v=U2LwEQFK3qc&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a href="http://www.youtube.com/watch?v=7xNQZHuAQJ8" target="_blank"&gt;http://www.youtube.com/watch?v=7xNQZHuAQJ8&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://ourworld.compuserve.com/homepages/PFArchives/tourdate.htm" href="http://ourworld.compuserve.com/homepages/PFArchives/tourdate.htm"&gt;http://ourworld.compuserve.com/homepages/PFArchives/tourdate.htm&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://www.maidenfans.com/imc/index.php?url=tour06_sit/dates06_sit&amp;amp;link=tours&amp;amp;lang=deu" href="http://www.maidenfans.com/imc/index.php?url=tour06_sit/dates06_sit&amp;amp;link=tours&amp;amp;lang=deu"&gt;http://www.maidenfans.com/imc/index.php?url=tour06_sit/dates06_sit&amp;amp;link=tours&amp;amp;lang=deu&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a href="http://www.youtube.com/watch?v=AUOpUqni0_g" target="_blank"&gt;http://www.youtube.com/watch?v=AUOpUqni0_g&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a href="http://www.youtube.com/watch?v=e39D8VBQ4sw" target="_blank"&gt;http://www.youtube.com/watch?v=e39D8VBQ4sw&lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;Bonus Track&lt;/strong&gt; (just because this is a great song):&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.youtube.com/watch?v=k5JkHBC5lDs" target="_blank"&gt;http://www.youtube.com/watch?v=k5JkHBC5lDs&lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=2e821787-88b3-4afc-8080-e91872cd3106"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=G0ZZr6xMw2c:0jCNBfsW5d4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=G0ZZr6xMw2c:0jCNBfsW5d4:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=G0ZZr6xMw2c:0jCNBfsW5d4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=G0ZZr6xMw2c:0jCNBfsW5d4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=G0ZZr6xMw2c:0jCNBfsW5d4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=G0ZZr6xMw2c:0jCNBfsW5d4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,2e821787-88b3-4afc-8080-e91872cd3106.aspx</comments>
      <category>Other</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2008/12/24/DontClogTheTubes.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=46c2ad44-1dcb-4363-b727-050ee2494dfb</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,46c2ad44-1dcb-4363-b727-050ee2494dfb.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,46c2ad44-1dcb-4363-b727-050ee2494dfb.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=46c2ad44-1dcb-4363-b727-050ee2494dfb</wfw:commentRss>
      
      <title>LINQ Queries - XML and the Filesystem</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,46c2ad44-1dcb-4363-b727-050ee2494dfb.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/kv529qp-o1I/LINQQueriesXMLAndTheFilesystem.aspx</link>
      <pubDate>Sun, 30 Nov 2008 18:46:11 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;style type="text/css"&gt;&#xD;
.code { background-color: #efefef; font-family:consolas,courier new; }&#xD;
&lt;/style&gt;&#xD;
        &lt;p&gt;&#xD;
I recently added a maintenance form to our website which allows a user to add and&#xD;
delete entries to a list of banner ads stored in a simple XML file. Previously we've&#xD;
just been maintaining them manually by editing the XML directly and copying the associated&#xD;
banner images into a folder on the website. When you delete an ad, I decided to NOT&#xD;
delete the associated image since they may be reused (and I wanted to avoid forcing&#xD;
the user to upload the image again). However, we'd still like to periodically clean&#xD;
out this folder and "archive" the images so they're not cluttering up the selection&#xD;
screen.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I basically needed some code which would get me a list of files in the banner images&#xD;
folder which were not referenced in my banner XML file. It can be kind of clunky to&#xD;
iterate through XML but they've made it much easier with the introduction of LINQ.&#xD;
I fired up LINQPad (which, BTW, is an AWESOME free tool for testing out LINQ code)&#xD;
and tried out a few ideas. As a side note, it looks like Intellisense is now available&#xD;
if you purchase a copy of LINQPad.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.linqpad.net/"&gt;http://www.linqpad.net/&lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I started with querying the filesystem to get a list of files:&#xD;
&lt;/p&gt;&#xD;
   &#xD;
&lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;DirectoryInfo&lt;/span&gt; info = &lt;span style="color: blue"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af"&gt;DirectoryInfo&lt;/span&gt;(&lt;span style="color: #a31515"&gt;@"X:\inetpub\wwwroot\images\banner"&lt;/span&gt;);&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;FileInfo&lt;/span&gt;[] files = info.GetFiles();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
files.Dump();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&#xD;
.Dump() is an extension method available in LINQPad which dumps out the results of&#xD;
the query (we haven't actually used LINQ yet to do anything). &#xD;
&lt;/p&gt;&lt;p&gt;&#xD;
Here's what it looks like: &#xD;
&lt;/p&gt;&lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="308" alt="FileInfoLinq" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/LINQQueriesXMLandtheFilesystem_C03C/FileInfoLinq_3.png" width="780" border="0"&gt;&lt;/img&gt;&lt;/p&gt;&lt;p&gt;&#xD;
You might notice that Directory contains a DirectyInfo element. If you click on the&#xD;
down arrow it will expand out these values as well. &#xD;
&lt;/p&gt;&lt;p&gt;&#xD;
So I now had a list of files, I wanted to then get a list of images referenced in&#xD;
my banner file. Here's the format of the XML file:&#xD;
&lt;/p&gt;&lt;pre&gt;&lt;p&gt;&#xD;
&amp;lt;News&amp;gt;    &#xD;
&lt;br&gt;&#xD;
   &amp;lt;NewsItem&amp;gt;&lt;br&gt;&#xD;
       &amp;lt;Title&amp;gt;Supertooth3-banner.gif&amp;lt;/Title&amp;gt;&lt;br&gt;&#xD;
       &amp;lt;Image&amp;gt;/images/banner/Supertooth3-banner.gif&amp;lt;/Image&amp;gt;&lt;br&gt;&#xD;
       &amp;lt;Height&amp;gt;183&amp;lt;/Height&amp;gt;&lt;br&gt;&#xD;
       &amp;lt;Link&amp;gt;/PortalView.aspx?navto=/Supertooth3-banner.gif&amp;lt;/Link&amp;gt;&lt;br&gt;&#xD;
       &amp;lt;Date&amp;gt;July, 19th, 2003&amp;lt;/Date&amp;gt;&lt;br&gt;&#xD;
       &amp;lt;Target&amp;gt;&amp;lt;/Target&amp;gt;&lt;br&gt;&#xD;
   &amp;lt;/NewsItem&amp;gt;    &#xD;
&lt;/p&gt;&lt;p&gt;&#xD;
   &#xD;
&lt;/p&gt;&lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;/pre&gt;&lt;p&gt;&#xD;
I haven't really been using Title for anything besides the name of the image file,&#xD;
so I was able to take a bit of a shortcut here and use it for my comparison. To pull&#xD;
out the list of images used in the XML, I wrote this query: &#xD;
&lt;/p&gt;&lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;XDocument&lt;/span&gt; doc = System.Xml.Linq.&lt;span style="color: #2b91af"&gt;XDocument&lt;/span&gt;.Load(&lt;span style="color: #a31515"&gt;@"X:\inetpub\wwwroot\adv.xml"&lt;/span&gt;);&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
doc.Dump();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; news = &lt;span style="color: blue"&gt;from&lt;/span&gt; item &lt;span style="color: blue"&gt;in&lt;/span&gt; doc.Descendants(&lt;span style="background: #e5e5e5"&gt;"Title"&lt;/span&gt;)&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
           &lt;span style="color: blue"&gt;orderby&lt;/span&gt; item.Value&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
           &lt;span style="color: blue"&gt;select&lt;/span&gt; item.Value;&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
news.Dump();&#xD;
&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p&gt;&#xD;
Which produces this: &#xD;
&lt;/p&gt;&lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="221" alt="XmlTitlesLinq" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/LINQQueriesXMLandtheFilesystem_C03C/XmlTitlesLinq_3.png" width="267" border="0"&gt;&lt;/img&gt;&lt;/p&gt;&lt;p&gt;&#xD;
I noticed that the banner images folder contained a bunch of other files that I really&#xD;
didn't want to consider for filtering, so I needed to narrow my query to files that&#xD;
had specific extensions. C# doesn't really have a direct equivalent for INLIST, but&#xD;
we can do this a slightly different way for the same effect. &#xD;
&lt;/p&gt;&lt;p&gt;&#xD;
First I define an array of valid extensions, then (inside the where clause of the&#xD;
LINQ query) I check to see if this list of file types contains the filetype of the&#xD;
file I'm currently evaluating. It's a bit backwards, but it's simple and it works. &#xD;
&lt;/p&gt;&lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt;[] fileTypes = { &lt;span style="background: #e5e5e5"&gt;".jpg"&lt;/span&gt;, &lt;span style="background: #e5e5e5"&gt;".gif"&lt;/span&gt;, &lt;span style="background: #e5e5e5"&gt;".png"&lt;/span&gt; };&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; imgFiles = &lt;span style="color: blue"&gt;from&lt;/span&gt; file &lt;span style="color: blue"&gt;in&lt;/span&gt; files&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
               &lt;span style="color: blue"&gt;where&lt;/span&gt; (fileTypes.Contains(file.Extension))&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
               &lt;span style="color: blue"&gt;orderby&lt;/span&gt; file.Name&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
               &lt;span style="color: blue"&gt;select&lt;/span&gt; file.Name;&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
imgFiles.Dump();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&#xD;
Now I've got a list of files from my XML and a list of files from the banner images&#xD;
folder. I want to get a list of files from the banner images folder that aren't in&#xD;
the XML list. I do this via a final query: &#xD;
&lt;/p&gt;&lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; extra = &lt;span style="color: blue"&gt;from&lt;/span&gt; singleFile &lt;span style="color: blue"&gt;in&lt;/span&gt; imgFiles&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;where&lt;/span&gt; !(news.Contains(singleFile))&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;select&lt;/span&gt; singleFile;&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
extra.Dump();    &#xD;
&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&#xD;
This returns my extra files. Now I can just use this list to move my images into an&#xD;
archive folder periodically. &#xD;
&lt;/p&gt;&lt;p&gt;&#xD;
If I put it all together, I end up with this:&#xD;
&lt;/p&gt;&lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;&lt;/span&gt; &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;XDocument&lt;/span&gt; doc = System.Xml.Linq.&lt;span style="color: #2b91af"&gt;XDocument&lt;/span&gt;.Load(&lt;span style="color: #a31515"&gt;@"X:\inetpub\wwwroot\adv.xml"&lt;/span&gt;);&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;DirectoryInfo&lt;/span&gt; info = &lt;span style="color: blue"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af"&gt;DirectoryInfo&lt;/span&gt;(&lt;span style="color: #a31515"&gt;@"X:\inetpub\wwwroot\images\banner"&lt;/span&gt;);&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;FileInfo&lt;/span&gt;[] files = info.GetFiles();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
doc.Dump();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
files.Dump();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; news = &lt;span style="color: blue"&gt;from&lt;/span&gt; item &lt;span style="color: blue"&gt;in&lt;/span&gt; doc.Descendants(&lt;span style="background: #e5e5e5"&gt;"Title"&lt;/span&gt;)&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
           &lt;span style="color: blue"&gt;orderby&lt;/span&gt; item.Value&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
           &lt;span style="color: blue"&gt;select&lt;/span&gt; item.Value;&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
news.Dump();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt;[] fileTypes = { &lt;span style="background: #e5e5e5"&gt;".jpg"&lt;/span&gt;, &lt;span style="background: #e5e5e5"&gt;".gif"&lt;/span&gt;, &lt;span style="background: #e5e5e5"&gt;".png"&lt;/span&gt; };&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; imgFiles = &lt;span style="color: blue"&gt;from&lt;/span&gt; file &lt;span style="color: blue"&gt;in&lt;/span&gt; files&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
               &lt;span style="color: blue"&gt;where&lt;/span&gt; (fileTypes.Contains(file.Extension))&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
               &lt;span style="color: blue"&gt;orderby&lt;/span&gt; file.Name&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
               &lt;span style="color: blue"&gt;select&lt;/span&gt; file.Name;&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
imgFiles.Dump();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; extra = &lt;span style="color: blue"&gt;from&lt;/span&gt; singleFile &lt;span style="color: blue"&gt;in&lt;/span&gt; imgFiles&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;where&lt;/span&gt; !(news.Contains(singleFile))&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;select&lt;/span&gt; singleFile;&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
extra.Dump();    &#xD;
&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.linqpad.net/"&gt;http://www.linqpad.net/&lt;/a&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=46c2ad44-1dcb-4363-b727-050ee2494dfb"&gt;&lt;/img&gt;&lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=kv529qp-o1I:bqKeR0L1kz4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=kv529qp-o1I:bqKeR0L1kz4:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=kv529qp-o1I:bqKeR0L1kz4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=kv529qp-o1I:bqKeR0L1kz4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=kv529qp-o1I:bqKeR0L1kz4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=kv529qp-o1I:bqKeR0L1kz4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,46c2ad44-1dcb-4363-b727-050ee2494dfb.aspx</comments>
      <category>.NET</category>
      <category>C#</category>
      <category>LINQ</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2008/11/30/LINQQueriesXMLAndTheFilesystem.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=3a94f39a-2646-427e-8d72-7922ec1356b8</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,3a94f39a-2646-427e-8d72-7922ec1356b8.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,3a94f39a-2646-427e-8d72-7922ec1356b8.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3a94f39a-2646-427e-8d72-7922ec1356b8</wfw:commentRss>
      
      <title>Visual Studio Templates</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,3a94f39a-2646-427e-8d72-7922ec1356b8.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/vPpwgj3q9xs/VisualStudioTemplates.aspx</link>
      <pubDate>Thu, 27 Nov 2008 01:50:46 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I thought this was an interesting question that has come up a couple of times in the&#xD;
last few days over on the Universal Thread. In VFP you can create a subclass of a&#xD;
form, customize it, then configure VFP to use this subclass as the "template" for&#xD;
any new forms you create (by going into Tools &amp;gt; Options &amp;gt; Forms and setting&#xD;
the base class). &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The question was, how do I do this in .NET? &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
It's pretty easy - create your form and add any controls, methods, properties, etc.&#xD;
that you want. Then go to File &amp;gt; Export Template. An Export Template Wizard will&#xD;
open. Change the selection to an "Item template" and click Next. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="452" alt="Export Template Wizard" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/VisualStudioTemplates_124CD/ExportTemplate_3.png" width="580" border="0"&gt;&lt;/img&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
  &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
On the next screen put a checkmark next to the item(s) you want included in the template.&#xD;
If you have other dependencies (like external classes) you can also select them here.&#xD;
Then click Next again. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="244" alt="Export Template Wizard Select Item to Export" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/VisualStudioTemplates_124CD/ExportTemplateWizard2_3.png" width="224" border="0"&gt;&lt;/img&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Now you can select any external references you want to include. For example, if you&#xD;
created a project which includes a set of base controls that you used on your form,&#xD;
you may want to select them here (so when you use this template these references will&#xD;
automatically get added to your project). Click Next. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="225" alt="Export Template Wizard Select Item References" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/VisualStudioTemplates_124CD/ExportTemplateWizard3_3.png" width="283" border="0"&gt;&lt;/img&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Finally you can select an icon that is associate with this template, enter the template&#xD;
name, description, and it's output location. I'd suggest leaving the "Automatically&#xD;
import the template into Visual Studio" option checked. If you don't like the output&#xD;
location, unfortunately you can't change it here. You have to change it via Tools&#xD;
&amp;gt; Options &amp;gt; Projects and Solutions. Finally click Finish. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="332" alt="Export Template Wizard Select Template Options" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/VisualStudioTemplates_124CD/ExportTemplateWizard4_3.png" width="589" border="0"&gt;&lt;/img&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
At this point, when you do an "Add New Item" you should be able to scroll to the bottom&#xD;
of the templates and see "My Templates" - the new template you created should exist&#xD;
there. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Although I showed this for a WinForms application, this can actually be used with&#xD;
any class (and for ASP.NET applications). For example, I have a base business object&#xD;
class I use. Every time I create a new one I just select a template based on a subclass&#xD;
of it to create the new one. &#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=3a94f39a-2646-427e-8d72-7922ec1356b8"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=vPpwgj3q9xs:hfWrxfi6Nlw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=vPpwgj3q9xs:hfWrxfi6Nlw:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=vPpwgj3q9xs:hfWrxfi6Nlw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=vPpwgj3q9xs:hfWrxfi6Nlw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=vPpwgj3q9xs:hfWrxfi6Nlw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=vPpwgj3q9xs:hfWrxfi6Nlw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,3a94f39a-2646-427e-8d72-7922ec1356b8.aspx</comments>
      <category>.NET</category>
      <category>Visual Studio</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2008/11/27/VisualStudioTemplates.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=0a733f71-4d24-4cc6-9896-de948f7656e4</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,0a733f71-4d24-4cc6-9896-de948f7656e4.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,0a733f71-4d24-4cc6-9896-de948f7656e4.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=0a733f71-4d24-4cc6-9896-de948f7656e4</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>Sys.InvalidOperationException: A control is already associated with the element.</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,0a733f71-4d24-4cc6-9896-de948f7656e4.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/lZbD8LF4j5c/SysInvalidOperationExceptionAControlIsAlreadyAssociatedWithTheElement.aspx</link>
      <pubDate>Wed, 26 Nov 2008 01:33:27 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I received this error on a page which had previously been working. That morning I&#xD;
had updated our site, so I was expecting some issues, but this error doesn't really&#xD;
tell you much. We have a maintenance screen which displays a list of records in a&#xD;
grid. When you click on an edit link the grid converts into an "in place" editor (a&#xD;
UI metaphor I thought I'd like when I initially put the form together but which, as&#xD;
it turns out, I really hate). &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
A user had reported that when they clicked on a button which saves this record that&#xD;
it wasn't closing and updating the list. We are using Telerik web controls for most&#xD;
of the site so I figured it had to do with them since I updated a number of pages,&#xD;
including our master page, to start using the RAD AJAX version of the controls instead&#xD;
of their previous version. It seems this error was being caused because I had added&#xD;
an instance of the RadAjaxManager control to the master page, and I already had an&#xD;
instance of a AjaxManager (older version) on the content page itself. Both managers&#xD;
were conflicting with one another, which caused this error. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
All I needed to change was the "RadAjaxManager" markup code to a "RadAjaxManagerProxy"&#xD;
and that resolved this particular error. &#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=0a733f71-4d24-4cc6-9896-de948f7656e4"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=lZbD8LF4j5c:SY-bEjrk5o4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=lZbD8LF4j5c:SY-bEjrk5o4:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=lZbD8LF4j5c:SY-bEjrk5o4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=lZbD8LF4j5c:SY-bEjrk5o4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=lZbD8LF4j5c:SY-bEjrk5o4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=lZbD8LF4j5c:SY-bEjrk5o4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,0a733f71-4d24-4cc6-9896-de948f7656e4.aspx</comments>
      <category>ASP.NET</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2008/11/26/SysInvalidOperationExceptionAControlIsAlreadyAssociatedWithTheElement.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=c23600a0-e40f-4dfd-bca0-97ff439440f6</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,c23600a0-e40f-4dfd-bca0-97ff439440f6.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,c23600a0-e40f-4dfd-bca0-97ff439440f6.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c23600a0-e40f-4dfd-bca0-97ff439440f6</wfw:commentRss>
      
      <title>This is Secure?</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,c23600a0-e40f-4dfd-bca0-97ff439440f6.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/LQbouWAiPRE/ThisIsSecure.aspx</link>
      <pubDate>Sat, 08 Nov 2008 15:19:36 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I needed to sign back up for online access to one of my bank accounts. I used to have&#xD;
this all automated through Quicken but at some point it broke and I never seemed to&#xD;
get around to fixing it. I couldn't remember the account password so I requested it&#xD;
to be changed. They had a cool step where they had me select which phone number I&#xD;
had registered with the account would be called. As soon as I hit "Next" they (well,&#xD;
their automated system) was calling. They wanted me to confirm the fact that I was&#xD;
expecting the call and to enter a code which was shown on the screen. As soon as I&#xD;
did that it allowed me to continue on to change my password.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
That was pretty cool - a pretty painless way of ensuring I'm really who I say I am.&#xD;
Imagine how disappointed I was when I started typing in my new password:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/ThisisSecure_9134/BankPass_2.png"&gt;&#xD;
            &lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="444" alt="Bank Password" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/ThisisSecure_9134/BankPass_thumb.png" width="778" border="0"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Really? No special characters and I'm limited to 12 characters for access to my bank&#xD;
account? (sigh). My &lt;a href="http://www.linkedin.com/" target="_blank"&gt;LinkedIn&lt;/a&gt; account&#xD;
has a more secure password than this. Lame.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=c23600a0-e40f-4dfd-bca0-97ff439440f6"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=LQbouWAiPRE:H0OsdzP9Vec:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=LQbouWAiPRE:H0OsdzP9Vec:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=LQbouWAiPRE:H0OsdzP9Vec:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=LQbouWAiPRE:H0OsdzP9Vec:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=LQbouWAiPRE:H0OsdzP9Vec:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=LQbouWAiPRE:H0OsdzP9Vec:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,c23600a0-e40f-4dfd-bca0-97ff439440f6.aspx</comments>
      <category>Soapbox</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2008/11/08/ThisIsSecure.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=104bb1f4-147b-4c34-8685-67b82482b6cc</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,104bb1f4-147b-4c34-8685-67b82482b6cc.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,104bb1f4-147b-4c34-8685-67b82482b6cc.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=104bb1f4-147b-4c34-8685-67b82482b6cc</wfw:commentRss>
      <slash:comments>5</slash:comments>
      
      <title>Custom Authentication and Encryption with WCF</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,104bb1f4-147b-4c34-8685-67b82482b6cc.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/71xYvfgHUlo/CustomAuthenticationAndEncryptionWithWCF.aspx</link>
      <pubDate>Thu, 06 Nov 2008 02:35:49 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;style type="text/css"&gt;&#xD;
.code { background-color: #efefef; font-family:consolas,courier new; }&#xD;
&lt;/style&gt;&#xD;
        &lt;p&gt;&#xD;
I'm working on an application which is going to use WCF heavily for communications&#xD;
between a client side application and a server-based service application. One aspect&#xD;
of the application that I've been ignoring during testing was WCF authentication.&#xD;
During testing the application has been running on my local network. I had enabled&#xD;
connection based authentication (ex.SSL) and it is using TCP as it's binding since&#xD;
I do a lot of callback messaging. In the back of my mind I realized that when it's&#xD;
deployed the client will be on a different network, communicating over the internet,&#xD;
so there may be some issues with the current security model. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
A week ago I finally got around to looking at it and it completely breaks when the&#xD;
client isn't local, since it was using Windows authentication to do it's authentication.&#xD;
Microsoft has a nice manual which walks through the various ways of configuring security&#xD;
in WCF, which you should choose (and why) under various scenarios. &lt;a href="http://msdn.microsoft.com/en-us/library/aa480545.aspx " target="_blank"&gt;Scenarios,&#xD;
Patterns, and Implementation Guidance for Web Services Enhancements&lt;/a&gt; (WSE) 3.0&#xD;
from their patterns &amp;amp; practices team. Based on a number of factors, it suggested&#xD;
I use SSL along with message based security. I'm not going to be hosting this in IIS,&#xD;
so HTTPS wasn't an option for the SSL connection. I also wasn't using Windows authentication&#xD;
and didn't want to deal with some of the issues of the other credential types (IssuedToken,&#xD;
Digest, etc.). So I decided on UserName. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I now had two things to fix - first, I needed to implement my own UserName authentication&#xD;
scheme (again, I like making my life hard so I wasn't using the default authentication&#xD;
provider in ASP.NET that used SQL Server). This turns out to be pretty simple by inheriting&#xD;
from the UserNamePasswordValidator class in the System.IndentityMode.Selectors namespace&#xD;
and overriding the Validate method: &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;span style="color: blue"&gt;using&lt;/span&gt; System;&lt;br&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System.IdentityModel.Selectors;&lt;br&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System.IdentityModel.Tokens;&lt;br&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System.Linq;&lt;br&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System.Text; &#xD;
&lt;/p&gt;&#xD;
        &lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;namespace&lt;/span&gt; MySampleApp.Server&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
{&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; This&#xD;
class is responsible for validating the username/password&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; used&#xD;
by the connecting WCF client.&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;remarks&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;para&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; The&#xD;
server is configured to use this class in the Service Behavior&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; serviceCredentials&#xD;
section of the config file. &lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; CustomUserNamePasswordValidatorType&#xD;
is set to SampleValidator&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt; UseNamePasswordValidationMode&#xD;
is set to Custom&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/para&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;developer&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;Paul&#xD;
Mrozowski&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/developer&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;created&amp;gt;&lt;/span&gt;&lt;span style="background: #ffffbf"&gt;10/13/2008&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/created&amp;gt;&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &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;SampleValidator&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;UserNamePasswordValidator&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    {&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: blue"&gt;public&lt;/span&gt;&lt;span style="color: blue"&gt;override&lt;/span&gt;&lt;span style="color: blue"&gt;void&lt;/span&gt; Validate(&lt;span style="color: blue"&gt;string&lt;/span&gt; userName, &lt;span style="color: blue"&gt;string&lt;/span&gt; password)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        {&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="background: #ffffbf"&gt;//&#xD;
TODO: Finish, this is just here to test out the idea.&lt;/span&gt;&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;if&lt;/span&gt; (userName&#xD;
!= &lt;span style="background: #e5e5e5"&gt;"user"&lt;/span&gt; || password != &lt;span style="background: #e5e5e5"&gt;"pass"&lt;/span&gt;)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
                &lt;span style="color: blue"&gt;throw&lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af"&gt;SecurityTokenException&lt;/span&gt;(&lt;span style="background: #e5e5e5"&gt;"Unknown&#xD;
user."&lt;/span&gt;);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        }&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    }&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
}&#xD;
&lt;/p&gt;&#xD;
        &lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
If the passed in username/password is invalid, throw an exception. Easy. I added this&#xD;
new class to my server project, then modified the app.config file to let WCF know&#xD;
to use this for authentication. &#xD;
&lt;/p&gt;&#xD;
        &lt;pre class="code"&gt;&amp;lt;bindings&amp;gt;&#xD;
      &amp;lt;nettcpbinding&amp;gt;&#xD;
          &amp;lt;binding name="StandardServerBinding" maxbuffersize="8192000" &#xD;
              maxreceivedmessagesize="8192000" listenbacklog="5000" maxconnections="1000"&amp;gt; &#xD;
              &amp;lt;readerquotas maxdepth="24" maxstringcontentlength="8192000" maxarraylength="8192000" &#xD;
               maxbytesperread="8192000" maxnametablecharcount="8192000" /&amp;gt;&#xD;
              &amp;lt;reliablesession inactivitytimeout="01:00:00" /&amp;gt;&#xD;
              &amp;lt;security mode="Message"&amp;gt;                  &#xD;
                  &amp;lt;message clientcredentialtype="UserName" /&amp;gt;&#xD;
              &amp;lt;/security&amp;gt;&#xD;
          &amp;lt;/binding&amp;gt;&#xD;
      &amp;lt;/nettcpbinding&amp;gt;&#xD;
  &amp;lt;/bindings&amp;gt;&#xD;
        &amp;lt;behaviors&amp;gt;&#xD;
            &amp;lt;servicebehaviors&amp;gt;&#xD;
                &amp;lt;behavior name="RegisterBehavior"&amp;gt;					&#xD;
                    &amp;lt;servicedebug includeexceptiondetailinfaults="true" /&amp;gt;&#xD;
                    &amp;lt;servicemetadata /&amp;gt;&#xD;
                    &amp;lt;servicethrottling maxconcurrentcalls="48" maxconcurrentsessions="5000" &#xD;
                      maxconcurrentinstances="5000" /&amp;gt;&#xD;
                    &amp;lt;servicecredentials&amp;gt;&#xD;
                        &amp;lt;usernameauthentication usernamepasswordvalidationmode="Custom" &#xD;
          customusernamepasswordvalidatortype="MySampleApp.Server.SampleValidator,MySampleApp.Server" &#xD;
                          cachelogontokens="true" cachedlogontokenlifetime="01:00:00" /&amp;gt;&#xD;
                    &amp;lt;/servicecredentials&amp;gt;					&#xD;
                &amp;lt;/behavior&amp;gt;&#xD;
                &amp;lt;behavior name="ThrottlingBehavior"&amp;gt;&#xD;
                    &amp;lt;servicethrottling maxconcurrentcalls="48" maxconcurrentsessions="5000" &#xD;
                        maxconcurrentinstances="5000" /&amp;gt;&#xD;
                &amp;lt;/behavior&amp;gt;&#xD;
            &amp;lt;/servicebehaviors&amp;gt;&#xD;
        &amp;lt;/behaviors&amp;gt;		&#xD;
        &amp;lt;services&amp;gt;&#xD;
            &amp;lt;service name="MySampleApp.ServerProcess" behaviorconfiguration="RegisterBehavior"&amp;gt;&#xD;
                &amp;lt;endpoint name="PrimaryEndpoint" contract="MySampleApp.Server.Contracts.IServer" &#xD;
                   binding="netTcpBinding" address="net.tcp://localhost" &#xD;
                   bindingconfiguration="StandardServerBinding" /&amp;gt;&#xD;
                &amp;lt;endpoint name="MEXEndpoint" contract="IMetadataExchange" &#xD;
                   binding="mexHttpBinding" address="http://localhost/MEX/" bindingconfiguration="" /&amp;gt;&#xD;
            &amp;lt;/service&amp;gt;&#xD;
        &amp;lt;/services&amp;gt;&#xD;
&lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
You add a &amp;lt;serviceCreditials\userNameAuthentication section to the ServiceBehavior&#xD;
and specify a Custom userNamePasswodValidationMode. I tell it to use the full name&#xD;
of the class, the second part of that after the comma tells it which assembly it's&#xD;
located in. In the netTcpBinding you can see that I've enabled security on the message,&#xD;
and told it to use the UserName authentication type.&#xD;
&lt;/p&gt;&#xD;
        &lt;pre class="code"&gt;        &amp;lt;bindings&amp;gt;&#xD;
            &amp;lt;netTcpBinding&amp;gt;&#xD;
                &amp;lt;binding name="NewBinding0" maxBufferSize="8192000" maxReceivedMessageSize="8192000"&amp;gt;&#xD;
                    &amp;lt;readerQuotas maxDepth="24" maxStringContentLength="8192000"&#xD;
                        maxArrayLength="8192000" maxBytesPerRead="8192000" maxNameTableCharCount="8192000" /&amp;gt;&#xD;
                    &amp;lt;reliableSession inactivityTimeout="01:00:00" /&amp;gt;&#xD;
                    &amp;lt;security mode="Message"&amp;gt;&#xD;
                        &amp;lt;transport clientCredentialType="None" protectionLevel="None" /&amp;gt;&#xD;
                        &amp;lt;message clientCredentialType="UserName" /&amp;gt;&#xD;
                    &amp;lt;/security&amp;gt;&#xD;
                &amp;lt;/binding&amp;gt;&#xD;
            &amp;lt;/netTcpBinding&amp;gt;&#xD;
&lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
I've set the security mode to Message and clientCredentialType to UserName as well.&#xD;
Now I needed to somehow get my client application to pass the user name and password.&#xD;
I had used Visual Studio and let it build my client proxy, so I thought I'd be able&#xD;
to set this immediately after I created the proxy, ex: &#xD;
&lt;/p&gt;&#xD;
        &lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: #2b91af"&gt;InstanceContext&lt;/span&gt; context = &lt;span style="color: blue"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af"&gt;InstanceContext&lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.m_client = &lt;span style="color: blue"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af"&gt;ServerClient&lt;/span&gt;(context);&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.m_client.ClientCredentials.UserName.UserName&#xD;
= &lt;span style="background: #e5e5e5"&gt;"user"&lt;/span&gt;;&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.m_client.ClientCredentials.UserName.Password&#xD;
= &lt;span style="background: #e5e5e5"&gt;"pass"&lt;/span&gt;;&#xD;
&lt;/p&gt;&#xD;
        &lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
Unfortunately, that doesn't work - I was getting "Object is read only" when I attempted&#xD;
to do this. From some searching I was able to find out that this can occur when the&#xD;
connection has already been opened, but in my case I hadn't done that yet. I spent&#xD;
a bunch of time trying to figure out why it wouldn't work and finally ended up putting&#xD;
the code inside of the proxy class VS had generated by editing the constructor and&#xD;
setting things up there. &#xD;
&lt;/p&gt;&#xD;
        &lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
            &lt;span style="color: blue"&gt;public&lt;/span&gt; ServerClient(System.ServiceModel.&lt;span style="color: #2b91af"&gt;InstanceContext&lt;/span&gt; callbackInstance)&#xD;
: &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: blue"&gt;base&lt;/span&gt;(callbackInstance)&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
{        &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: blue"&gt;base&lt;/span&gt;.ClientCredentials.UserName.UserName&#xD;
= &lt;span style="background: #e5e5e5"&gt;"user"&lt;/span&gt;;&#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: blue"&gt;base&lt;/span&gt;.ClientCredentials.UserName.Password&#xD;
= &lt;span style="background: #e5e5e5"&gt;"pass"&lt;/span&gt;;       &#xD;
&lt;/p&gt;&#xD;
          &lt;p style="margin: 0px"&gt;&#xD;
}&#xD;
&lt;/p&gt;&#xD;
        &lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
At this point, I thought I was all set to go. I fired things up and it immediately&#xD;
faulted the connection. I opened up the WCF Service Configuration Editor (C:\Program&#xD;
Files\Microsoft SDKs\Windows\v6.0A\bin\svcconfigeditor.exe) and enabled tracing on&#xD;
both the server and client and re-ran things so I could capture a trace. Once that&#xD;
was done I opened up the WCF Svc Trace Log Viewer (which is part of the Windows SDK,&#xD;
mine is located at: C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SvcTraceViewer.exe).&#xD;
After looking through the log, it appeared to be failing with a "The security protocol&#xD;
cannot secure the outgoing message" error. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Again, I did a bunch of searching, reading, and testing and finally realized that&#xD;
it wanted to encrypt the connection but couldn't. I mentioned earlier that I decided&#xD;
to use SSL for the connection, but when I was working on this I didn't realize that&#xD;
it didn't magically decide how to do that. It looked like I could use an X509 certificate&#xD;
to enable encryption, but I wasn't at all thrilled with the prospect of trying to&#xD;
get that cert. install on client machines. From the couple of times I've seen it needed,&#xD;
it never seems to run particularly smoothly (when it works, it just works, but when&#xD;
it fails, you have no idea why it's failing). So I essentially wanted to be able to&#xD;
load my cert. at runtime instead of loading it into the Windows cert. store. I could&#xD;
buy a real cert., but for this app. it just wasn't necessary. VS includes some tools&#xD;
for self-signing certificates so I looked into that instead. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
If you open a Visual Studio command prompt (hiding in the Visual Studio Tools subdirectory&#xD;
of Visual Studio on the Start menu), it sets up the pathing so you can use the various&#xD;
command line tools. The first thing I needed to do was create a key for the server: &#xD;
&lt;/p&gt;&#xD;
        &lt;pre class="code"&gt;makecert -r -pe -n "CN=RCS Solutions, Inc." -b 01/01/2008 -e 12/31/2099 -sky exchange &lt;/pre&gt;&#xD;
Where:&lt;br&gt;&#xD;
Server.cer -sv Server.pvk Server.cer - the certificate (public key) &#xD;
&lt;br&gt;&#xD;
Server.pvk - the private key &#xD;
&lt;p&gt;&#xD;
When it runs, it prompts for a password used to encrypt the private key. You can leave&#xD;
it blank, but it's suggested you fill it in (so I did). &#xD;
&lt;/p&gt;&lt;p&gt;&#xD;
Next I decided to merge the public and private key into a single file with a PFX extension.&#xD;
It requires you to re-enter the password you used to encrypt the private key (or pass&#xD;
in in the command line, which is what I did). &#xD;
&lt;/p&gt;&lt;pre class="code"&gt;pvk2pfx.exe -pvk Server.pvk -spc Server.cer -pfx Server.pfx -pi mycertpassword&lt;/pre&gt;&lt;p&gt;&#xD;
At this point I added all three files to my project. I also needed to get my proxy&#xD;
to use this cert. Since it's not a real certificate (meaning there isn't a chain of&#xD;
trust established between my cert at some known/trusted provider) I had to disable&#xD;
certificate validation. Yeah, pretty secure stuff ;-) &#xD;
&lt;g&gt;&lt;/g&gt;&lt;/p&gt;&lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;          &#xD;
ServiceHost&lt;/span&gt; host = &lt;span style="color: blue"&gt;null&lt;/span&gt;;&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
           &lt;span style="color: blue"&gt;try&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
           {&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
               &lt;span style="background: #ffffbf"&gt;//&#xD;
Specifically not calling Dispose() on host since it also calls Close and if we've&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
               &lt;span style="background: #ffffbf"&gt;//&#xD;
disposed after calling Close that will cause errors.&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
              &#xD;
host = &lt;span style="color: blue"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af"&gt;ServiceHost&lt;/span&gt;(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ServerProcess&lt;/span&gt;));&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
               &lt;span style="color: blue"&gt;string&lt;/span&gt; dir&#xD;
= System.IO.&lt;span style="color: #2b91af"&gt;Directory&lt;/span&gt;.GetCurrentDirectory();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
               &lt;span style="color: #2b91af"&gt;X509Certificate2&lt;/span&gt; cert&#xD;
= &lt;span style="color: blue"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af"&gt;X509Certificate2&lt;/span&gt;(dir&#xD;
+ &lt;span style="background: #e5e5e5"&gt;"\\Server.pfx"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;@"mycertpassword"&lt;/span&gt;);&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
              &#xD;
host.Credentials.ClientCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.&lt;span style="color: #2b91af"&gt;X509CertificateValidationMode&lt;/span&gt;.None;                                &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
              &#xD;
host.Credentials.ServiceCertificate.Certificate = cert;&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
              &#xD;
host.Open();&#xD;
&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p&gt;&#xD;
I repeated the above sequence for my client, creating it's own public/private key.&#xD;
I added the same code to configure the cert, except I put it in the pre-generated&#xD;
proxy constructor. &#xD;
&lt;/p&gt;&lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas, courier new"&gt;&lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; ServerClient(System.ServiceModel.&lt;span style="color: #2b91af"&gt;InstanceContext&lt;/span&gt; callbackInstance)&#xD;
: &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
        &lt;span style="color: blue"&gt;base&lt;/span&gt;(callbackInstance)&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
{        &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: blue"&gt;base&lt;/span&gt;.ClientCredentials.UserName.UserName&#xD;
= &lt;span style="background: #e5e5e5"&gt;"1"&lt;/span&gt;;&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: blue"&gt;base&lt;/span&gt;.ClientCredentials.UserName.Password&#xD;
= &lt;span style="background: #e5e5e5"&gt;"2"&lt;/span&gt;;&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="background: #ffffbf"&gt;// TODO: Fill in with correct&#xD;
credentials&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: blue"&gt;string&lt;/span&gt; dir = System.IO.&lt;span style="color: #2b91af"&gt;Directory&lt;/span&gt;.GetCurrentDirectory();&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: #2b91af"&gt;X509Certificate2&lt;/span&gt; cert = &lt;span style="color: blue"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af"&gt;X509Certificate2&lt;/span&gt;(dir&#xD;
+ &lt;span style="background: #e5e5e5"&gt;"\\Client.pfx"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;@"mycertpassword"&lt;/span&gt;);&#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: blue"&gt;base&lt;/span&gt;.ClientCredentials.ClientCertificate.Certificate&#xD;
= cert;        &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
    &lt;span style="color: blue"&gt;base&lt;/span&gt;.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode&#xD;
= System.ServiceModel.Security.&lt;span style="color: #2b91af"&gt;X509CertificateValidationMode&lt;/span&gt;.None;          &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p style="margin: 0px"&gt;&#xD;
}&#xD;
&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&lt;p&gt;&#xD;
I thought I was good to go, so I started everything back up. It failed with the same&#xD;
error as before. Yet more searching revealed that I needed to include a copy of the&#xD;
server's certificate inside of the client's app.config (I have no idea why, it seems&#xD;
like it should happen automatically as part of it's public key exchange). The problem&#xD;
was getting it in the format it required. I tried a few of the various ways that were&#xD;
suggested, but didn't have much luck with them. I finally regenerated the client side&#xD;
proxy using the svcutil command line app. and pointing it to a MEX (Metadata EXchange)&#xD;
endpoint and it magically created the certificate value I needed. I cut and pasted&#xD;
that code into my production proxy. &#xD;
&lt;/p&gt;&lt;pre class="code"&gt;       &amp;lt;client&amp;gt;&#xD;
            &amp;lt;endpoint address="net.tcp://localhost/" binding="netTcpBinding"&#xD;
                bindingConfiguration="PrimaryEndpoint" contract="Server" name="PrimaryEndpoint"&amp;gt;&#xD;
                &amp;lt;identity&amp;gt;&#xD;
			&amp;lt;certificate encodedValue="AwAAAA(long value removed)" /&amp;gt;                    &#xD;
                &amp;lt;/identity&amp;gt;&#xD;
            &amp;lt;/endpoint&amp;gt;&#xD;
&lt;/pre&gt;&lt;p&gt;&#xD;
When I restarted everything it was finally able to open a connection. I still need&#xD;
to figure out how to get my WCF service and IIS to share the same port, but I'm making&#xD;
some progress at least. &#xD;
&lt;/p&gt;&lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=104bb1f4-147b-4c34-8685-67b82482b6cc"&gt;&lt;/img&gt;&lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=71xYvfgHUlo:HRmvJePgXhU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=71xYvfgHUlo:HRmvJePgXhU:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=71xYvfgHUlo:HRmvJePgXhU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=71xYvfgHUlo:HRmvJePgXhU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=71xYvfgHUlo:HRmvJePgXhU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=71xYvfgHUlo:HRmvJePgXhU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,104bb1f4-147b-4c34-8685-67b82482b6cc.aspx</comments>
      <category>WCF</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2008/11/06/CustomAuthenticationAndEncryptionWithWCF.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=d05d8e4d-fc2b-484d-a8ae-c1c87207ae21</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,d05d8e4d-fc2b-484d-a8ae-c1c87207ae21.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,d05d8e4d-fc2b-484d-a8ae-c1c87207ae21.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=d05d8e4d-fc2b-484d-a8ae-c1c87207ae21</wfw:commentRss>
      
      <title>PDC</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,d05d8e4d-fc2b-484d-a8ae-c1c87207ae21.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/3uQyyCPtMTA/PDC.aspx</link>
      <pubDate>Tue, 28 Oct 2008 23:38:29 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
In case you missed it, it looks like Microsoft is making videos of the PDC sessions&#xD;
available on the &lt;a href="http://www.microsoftpdc.com/" target="_blank"&gt;Microsoft&#xD;
PDC&lt;/a&gt; site available within 24 hours of them occurring, which is pretty cool. It's&#xD;
not particularly easy to figure out where the heck the videos are hiding. They are&#xD;
being posted on the &lt;a href="http://channel9.msdn.com" target="_blank"&gt;Channel 9&lt;/a&gt; site&#xD;
but it's the same thing - good luck finding them all (at least it wasn't clear to&#xD;
me on how to find them). &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
However, if you go to the &lt;a href="http://sessions.microsoftpdc.com/public/timeline.aspx" target="_blank"&gt;agenda&#xD;
timeline&lt;/a&gt; page you can click on a session. At the bottom there is a "View Session&#xD;
Details" link - click on that to view the session. They have one camera view on the&#xD;
speaker, the other on the slides.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Check it out.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;Links:&lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.microsoftpdc.com"&gt;http://www.microsoftpdc.com&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="http://channel9.msdn.com" href="http://channel9.msdn.com"&gt;http://channel9.msdn.com&lt;/a&gt;&#xD;
          &lt;br&gt;&#xD;
          &lt;a title="https://sessions.microsoftpdc.com/public/timeline.aspx" href="http://sessions.microsoftpdc.com/public/timeline.aspx"&gt;http://sessions.microsoftpdc.com/public/timeline.aspx&lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=d05d8e4d-fc2b-484d-a8ae-c1c87207ae21"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=3uQyyCPtMTA:PXFHsaAj-Qk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=3uQyyCPtMTA:PXFHsaAj-Qk:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=3uQyyCPtMTA:PXFHsaAj-Qk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=3uQyyCPtMTA:PXFHsaAj-Qk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=3uQyyCPtMTA:PXFHsaAj-Qk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=3uQyyCPtMTA:PXFHsaAj-Qk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,d05d8e4d-fc2b-484d-a8ae-c1c87207ae21.aspx</comments>
      <category>Conference</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2008/10/28/PDC.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=6125e056-c961-41c1-9710-74242e9130f7</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,6125e056-c961-41c1-9710-74242e9130f7.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,6125e056-c961-41c1-9710-74242e9130f7.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6125e056-c961-41c1-9710-74242e9130f7</wfw:commentRss>
      
      <title>Moving TempDB, a Cautionary Tale</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,6125e056-c961-41c1-9710-74242e9130f7.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/MAnJoo5GBV8/MovingTempDBACautionaryTale.aspx</link>
      <pubDate>Tue, 28 Oct 2008 23:30:06 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I posted some info last night about how to &lt;a href="http://www.rcs-solutions.com/blog/2008/10/27/MovingSQLDatabasesToANewDrive.aspx" target="_blank"&gt;move&#xD;
the TempDB database in SQL Server&lt;/a&gt;. That morning I had made the changes and just&#xD;
needed to restart SQL Server for the changes to take effect. This morning I restarted&#xD;
the SQL Server service and after it restarted, tried to log into our website (since&#xD;
it's the main interface to the data in SQL). I received a network connection error&#xD;
from ASP.NET which wasn't surprising, so I reset IIS (IISRESET from a DOS prompt).&#xD;
After it restarted, which only took 10 seconds or so, I tried hitting the site again.&#xD;
And nothing. The page sat there attempting to connect and finally timed out. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Uh oh, not good. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I still had Management Studio open so I tried a few test queries, which seemed to&#xD;
work OK. I opened up the Activity Monitor and didn't see any connections from ASP.NET.&#xD;
OK, so SQL Server is probably denying the connection or blocking for some reason.&#xD;
I took in a look in the new tempdb location and SQL had recreated the mdf/ldf files&#xD;
like I expected, so what's up? &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I opened up the Event Viewer and saw a number of entries about the various databases&#xD;
starting up, which was good. Hey, what's that "Failure Audit" entry? &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/MovingTempDBaCautionaryTale_11237/sqleventlog_2.png"&gt;&#xD;
            &lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="379" alt="sqleventlog" src="http://www.rcs-solutions.com/blog/content/binary/WindowsLiveWriter/MovingTempDBaCautionaryTale_11237/sqleventlog_thumb.png" width="729" border="0"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
"Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. [CLIENT: 192.168.1.8]". &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Hmmm...192.168.1.8 is the web server. What user does SQL Server run under? I opened&#xD;
up Services, found "SQL Server" and double clicked on it. Then I went to the "Log&#xD;
on" tab. It runs under NT AUTHORITY\NetworkService. Could it be??? I opened Explorer&#xD;
and right-clicked on the folder where tempdb was located and selected "Sharing and&#xD;
Security" then went to the Security tab. Sure enough, "NETWORK SERVICE" wasn't listed.&#xD;
I went ahead and added it to the folder level then test the site again. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Success! &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
What was really strange about this was that most of our SQL databases are (and have&#xD;
been) located in this same folder. I'm guessing the permissions for those was set&#xD;
on the file level, which is why they've been working OK. The other weird thing was&#xD;
that it was even able to create the tempdb files at all. &#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=6125e056-c961-41c1-9710-74242e9130f7"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=MAnJoo5GBV8:BAN4eM4KqhM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=MAnJoo5GBV8:BAN4eM4KqhM:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=MAnJoo5GBV8:BAN4eM4KqhM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=MAnJoo5GBV8:BAN4eM4KqhM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=MAnJoo5GBV8:BAN4eM4KqhM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=MAnJoo5GBV8:BAN4eM4KqhM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,6125e056-c961-41c1-9710-74242e9130f7.aspx</comments>
      <category>SQL</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2008/10/28/MovingTempDBACautionaryTale.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=e7f23582-a725-4c54-ab94-459639862255</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,e7f23582-a725-4c54-ab94-459639862255.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,e7f23582-a725-4c54-ab94-459639862255.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=e7f23582-a725-4c54-ab94-459639862255</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>Moving SQL Databases to a New Drive</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,e7f23582-a725-4c54-ab94-459639862255.aspx</guid>
      <link>http://feedproxy.google.com/~r/PaulMrozowski/~3/hDC8h5Jz1Oc/MovingSQLDatabasesToANewDrive.aspx</link>
      <pubDate>Mon, 27 Oct 2008 23:34:56 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;style type="text/css"&gt;&#xD;
.code { background-color: #efefef; font-family:consolas,courier new; }&#xD;
&lt;/style&gt;&#xD;
        &lt;p&gt;&#xD;
I run across this from time to time and can never remember the specifics, so I figured&#xD;
I'd document it here: &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;To move a SQL database from one drive to another drive (or just move it to&#xD;
a new folder):&lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Inside of Microsoft SQL Management Studio execute this script (of course, replace&#xD;
"NameOfDatabase" with the real database name): &#xD;
&lt;/p&gt;&#xD;
        &lt;div class="code"&gt;  USE master&lt;br&gt;&#xD;
  GO&lt;br&gt;&#xD;
  sp_detach_db 'NameOfDatabase'&lt;br&gt;&#xD;
  GO &#xD;
&lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
Copy the database (usually NameOfDatabase.MDF and NameOfDatabase_log.LDF, assuming&#xD;
they haven't been renamed) to the new location.&lt;br&gt;&lt;br&gt;&#xD;
  &lt;em&gt;NOTE: The paths are relative to the server SQL Server is running on. &lt;/em&gt;&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;div class="code"&gt;  USE master&lt;br&gt;&#xD;
  GO&lt;br&gt;&#xD;
  sp_attach_db 'NameOfDatabase', 'E:\SQLServerDataFolder\NameOfDatabase.mdf',&#xD;
'E:\SQLServerDataFolder\NameOfDatabase_log.ldf'&lt;br&gt;&#xD;
  GO &#xD;
&lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;To move the TempDB system database to a new location: &lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;div class="code"&gt;USE master&lt;br&gt;&#xD;
  GO&lt;br&gt;&#xD;
  ALTER DATABASE tempdb modify file (name = tempdev, filename = 'E:\SQLServerDataFolder\tempdb.mdf')&lt;br&gt;&#xD;
  GO&lt;br&gt;&#xD;
  ALTER DATABASE tempdb modify file (name = templog, filename = 'E:\SQLServerDataFolder\templog.mdf') &#xD;
&lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
Restart SQL Server for the changes to take effect. One it's restarted you can delete&#xD;
the tempdb.mdf and templog.mdf from the old location. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Some instructions for shrinking the tempdb database: &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://support.microsoft.com/kb/307487" target="_blank"&gt;http://support.microsoft.com/kb/307487&lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=e7f23582-a725-4c54-ab94-459639862255"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=hDC8h5Jz1Oc:N2FX4ax3nCs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=hDC8h5Jz1Oc:N2FX4ax3nCs:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=hDC8h5Jz1Oc:N2FX4ax3nCs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=hDC8h5Jz1Oc:N2FX4ax3nCs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PaulMrozowski?a=hDC8h5Jz1Oc:N2FX4ax3nCs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PaulMrozowski?i=hDC8h5Jz1Oc:N2FX4ax3nCs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,e7f23582-a725-4c54-ab94-459639862255.aspx</comments>
      <category>SQL</category>
    <feedburner:origLink>http://www.rcs-solutions.com/blog/2008/10/27/MovingSQLDatabasesToANewDrive.aspx</feedburner:origLink></item>
  </channel>
</rss>
