<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tracy Sells</title>
	<atom:link href="http://tsells.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tsells.wordpress.com</link>
	<description>Middle Tier Software Developer</description>
	<lastBuildDate>Thu, 26 Jan 2012 16:27:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='tsells.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Tracy Sells</title>
		<link>http://tsells.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://tsells.wordpress.com/osd.xml" title="Tracy Sells" />
	<atom:link rel='hub' href='http://tsells.wordpress.com/?pushpress=hub'/>
		<item>
		<title>File and Directory Listing Utility</title>
		<link>http://tsells.wordpress.com/2012/01/26/file-and-directory-listing-utility/</link>
		<comments>http://tsells.wordpress.com/2012/01/26/file-and-directory-listing-utility/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 16:16:24 +0000</pubDate>
		<dc:creator>tsells</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Directory]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[Listing]]></category>
		<category><![CDATA[SubDirectory]]></category>
		<category><![CDATA[Utility]]></category>

		<guid isPermaLink="false">https://tsells.wordpress.com/?p=524</guid>
		<description><![CDATA[The following is a utility that you can point to a directory and list all directories, subdirectories, and files.&#160; The only requirement is that you have .net 4.0 installed. Feel free to use it. DirectoryLister.zip<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=524&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The following is a utility that you can point to a directory and list all directories, subdirectories, and files.&#160; The only requirement is that you have .net 4.0 installed.</p>
<p><a href="http://tsells.files.wordpress.com/2012/01/image6.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://tsells.files.wordpress.com/2012/01/image_thumb6.png?w=244&#038;h=139" width="244" height="139" /></a></p>
<p>Feel free to use it.</p>
<p><a href="http://tsells.com.jasmine.arvixe.com/host/Tools/DirectoryLister.zip" target="_blank">DirectoryLister.zip</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tsells.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tsells.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tsells.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tsells.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tsells.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tsells.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tsells.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tsells.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tsells.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tsells.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tsells.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tsells.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tsells.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tsells.wordpress.com/524/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=524&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tsells.wordpress.com/2012/01/26/file-and-directory-listing-utility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/164053312704d79937b37a0493d71305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tsells</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2012/01/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual Studio Current Code File Highlighter Macro</title>
		<link>http://tsells.wordpress.com/2012/01/03/visual-studio-current-code-file-highlighter-macro/</link>
		<comments>http://tsells.wordpress.com/2012/01/03/visual-studio-current-code-file-highlighter-macro/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 01:45:31 +0000</pubDate>
		<dc:creator>tsells</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Macro]]></category>
		<category><![CDATA[Solution Explorer]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>

		<guid isPermaLink="false">https://tsells.wordpress.com/?p=517</guid>
		<description><![CDATA[&#160; A special thanks to my friend Adam for discovering the following: If you are ever working in large solutions or projects with a lot of partial classes then this tip is for you.  This macro in in Visual Studio 2010 will highlight the current code file in the solution explorer that you are working [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=517&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>A special thanks to my friend Adam for discovering the following:</p>
<p>If you are ever working in large solutions or projects with a lot of partial classes then this tip is for you.  This macro in in Visual Studio 2010 will highlight the current code file in the solution explorer that you are working in.  This is helpful when you open files via short cuts / navigation, etc. without directly opening the file.</p>
<p>&nbsp;</p>
<h3>Setup</h3>
<p>&nbsp;</p>
<p>1.  Open Visual Studio</p>
<p>2.  Go to Tools – Macros – Macro Explorer (or Alt + F8)</p>
<p>3.  Right Click on MyMacros and select <em>New Module…</em></p>
<p>4.  Name the module <strong>ExplorerHelper </strong>and click <em>Add</em></p>
<p><a href="http://tsells.files.wordpress.com/2012/01/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0;" title="image" src="http://tsells.files.wordpress.com/2012/01/image_thumb.png?w=244&#038;h=139" alt="image" width="244" height="139" border="0" /></a></p>
<p>5.  Double Click on <strong>ExplorerHelper</strong> under MyMacros</p>
<p><a href="http://tsells.files.wordpress.com/2012/01/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0;" title="image" src="http://tsells.files.wordpress.com/2012/01/image_thumb1.png?w=203&#038;h=135" alt="image" width="203" height="135" border="0" /></a></p>
<p>6.  A code file will open up.  Copy and paste the following code into the module.</p>
<div id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:b86e0242-6f43-4d8d-ab4d-8d347af624bd" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:#ffffff;overflow:auto;"><span style="color:#0000ff;">Public</span><span style="color:#0000ff;">Sub</span><span style="color:#000000;"> LocateFileInSolutionExplorer() DTE.ExecuteCommand(</span><span style="color:#800000;">"</span><span style="color:#800000;">View.TrackActivityinSolutionExplorer</span><span style="color:#800000;">"</span><span style="color:#000000;">) DTE.ExecuteCommand(</span><span style="color:#800000;">"</span><span style="color:#800000;">View.TrackActivityinSolutionExplorer</span><span style="color:#800000;">"</span><span style="color:#000000;">) DTE.ExecuteCommand(</span><span style="color:#800000;">"</span><span style="color:#800000;">View.SolutionExplorer</span><span style="color:#800000;">"</span><span style="color:#000000;">) DTE.ExecuteCommand(</span><span style="color:#800000;">"</span><span style="color:#800000;">View.ViewCode</span><span style="color:#800000;">"</span><span style="color:#000000;">) </span><span style="color:#0000ff;">End Sub</span></pre>
<p>&nbsp;</p>
</div>
<p>7.  Save the file (Ctrl + S)</p>
<p>8.  Go to Tools –&gt; Options –&gt; Environment –&gt; Keyboard</p>
<p>9.  Change the Mapping scheme to default</p>
<p>10.  Under Show command containing: type macros – then select the macro we just created.</p>
<p><a href="http://tsells.files.wordpress.com/2012/01/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0;" title="image" src="http://tsells.files.wordpress.com/2012/01/image_thumb2.png?w=244&#038;h=146" alt="image" width="244" height="146" border="0" /></a></p>
<p>11.  Place the cursor in the Press shortcut keys: field and choose the keys you wish to use to launch this macro while in the code file.  In this example I am using Ctrl + Shift + Alt + F.  Once the keys are pressed – click assign to set the short cut.  Then Click ok.</p>
<p><a href="http://tsells.files.wordpress.com/2012/01/image3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0;" title="image" src="http://tsells.files.wordpress.com/2012/01/image_thumb3.png?w=244&#038;h=35" alt="image" width="244" height="35" border="0" /></a></p>
<p>&nbsp;</p>
<h3>Usage</h3>
<p>&nbsp;</p>
<p>1.  Open a solution</p>
<p>2.  Open a code file</p>
<p>3.  Collapse the solution.  You should see something like the following</p>
<p><a href="http://tsells.files.wordpress.com/2012/01/image4.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0;" title="image" src="http://tsells.files.wordpress.com/2012/01/image_thumb4.png?w=244&#038;h=97" alt="image" width="244" height="97" border="0" /></a></p>
<p>4.  Now press the short cut key combination with the cursor blinking in your code file and the solution explorer will expand and highlight your current code file.</p>
<p><a href="http://tsells.files.wordpress.com/2012/01/image5.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0;" title="image" src="http://tsells.files.wordpress.com/2012/01/image_thumb5.png?w=244&#038;h=99" alt="image" width="244" height="99" border="0" /></a></p>
<p>&nbsp;</p>
<p>If you encounter the following error <em>“Vsaenv: Cannot find one or more components.”</em> when trying to open your macro solution – here’s the fix:</p>
<p>&nbsp;</p>
<p><a href="http://download.microsoft.com/download/8/C/E/8CE18AE7-CAA8-4A4C-87CF-0C3DF772322D/VS2010RTM.htm">http://download.microsoft.com/download/8/C/E/8CE18AE7-CAA8-4A4C-87CF-0C3DF772322D/VS2010RTM.htm</a></p>
<p>Check out section 2.1.7.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tsells.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tsells.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tsells.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tsells.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tsells.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tsells.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tsells.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tsells.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tsells.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tsells.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tsells.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tsells.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tsells.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tsells.wordpress.com/517/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=517&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tsells.wordpress.com/2012/01/03/visual-studio-current-code-file-highlighter-macro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/164053312704d79937b37a0493d71305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tsells</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2012/01/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2012/01/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2012/01/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2012/01/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2012/01/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2012/01/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>ADO.Net and Extension Methods</title>
		<link>http://tsells.wordpress.com/2011/07/27/ado-net-and-extension-methods/</link>
		<comments>http://tsells.wordpress.com/2011/07/27/ado-net-and-extension-methods/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 02:13:30 +0000</pubDate>
		<dc:creator>tsells</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[ADO.Net]]></category>
		<category><![CDATA[DataTable]]></category>
		<category><![CDATA[Extension Methods]]></category>
		<category><![CDATA[Null]]></category>

		<guid isPermaLink="false">https://tsells.wordpress.com/2011/07/27/ado-net-and-extension-methods/</guid>
		<description><![CDATA[One of the most tedious things I tend to do is check for nulls on data tables and data sets when I am using them in code.&#160; This should be done whenever you receive an object as a result of a function or passed in as a parameter to a function (good coding practices).&#160; This [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=502&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the most tedious things I tend to do is check for nulls on data tables and data sets when I am using them in code.&#160; This should be done whenever you receive an object as a result of a function or passed in as a parameter to a function (good coding practices).&#160; This can be painful though.</p>
<p>This function is dangerous as the table being passed in could be null so when you try to access the Rows collection a null reference exception occurs.&#160; </p>
<p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:b03236e1-2ba4-4e76-9499-6cc2ea917294" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#0000FF;">private</span><span style="color:#000000;"> </span><span style="color:#0000FF;">static</span><span style="color:#000000;"> </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> GetDataTableCount(DataTable table)
{
  </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> count </span><span style="color:#000000;">=</span><span style="color:#000000;"> table.Rows.Count;
  </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> count;
}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</p>
<p>This next section checks for null and returns zero.&#160; It still is tedious and you have to remember to check for null.&#160; Again – this should be ingrained in your brain – but the world does have novice programmers out there that don’t do this.&#160; </p>
<p><div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:b1a0a3b4-c24d-4a40-b221-43057d4667bf" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#0000FF;">private</span><span style="color:#000000;"> </span><span style="color:#0000FF;">static</span><span style="color:#000000;"> </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> GetDataTableCount(DataTable table)
{
  </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (table </span><span style="color:#000000;">==</span><span style="color:#000000;"> </span><span style="color:#0000FF;">null</span><span style="color:#000000;">)
      </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#800080;">0</span><span style="color:#000000;">;
  </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> count </span><span style="color:#000000;">=</span><span style="color:#000000;"> table.Rows.Count;
  </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> count;
}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</p>
<p>To get around this I added a class that has extension methods for ado.net objects.&#160;&#160; The first method checks to see if it has rows.&#160; The other gets the row count and returns –1 if the table is null.&#160; </p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:6a6ba0f7-dc89-46ae-a606-72b023cb0c42" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#000000;">    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">static</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> AdoExtensions
    {
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;summary&gt;</span><span style="color:#008000;">
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> Determine if a data table has rows in it - return false if 0 rows or null
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;/summary&gt;</span><span style="color:#008000;">
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;param name="table"&gt;&lt;/param&gt;</span><span style="color:#008000;">
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;returns&gt;&lt;/returns&gt;</span><span style="color:#808080;">
</span><span style="color:#000000;">        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">static</span><span style="color:#000000;"> </span><span style="color:#0000FF;">bool</span><span style="color:#000000;"> HasRows(</span><span style="color:#0000FF;">this</span><span style="color:#000000;"> DataTable table)
        {
            </span><span style="color:#0000FF;">bool</span><span style="color:#000000;"> hasRows </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">true</span><span style="color:#000000;">;

            </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (table </span><span style="color:#000000;">==</span><span style="color:#000000;"> </span><span style="color:#0000FF;">null</span><span style="color:#000000;"> </span><span style="color:#000000;">||</span><span style="color:#000000;"> table.Rows.Count </span><span style="color:#000000;">==</span><span style="color:#000000;"> </span><span style="color:#800080;">0</span><span style="color:#000000;">)
                hasRows </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">false</span><span style="color:#000000;">;
            </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> hasRows;
        }

        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;summary&gt;</span><span style="color:#008000;">
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> Get number of rows from table - return number of rows or -1 if table null
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;/summary&gt;</span><span style="color:#008000;">
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;param name="table"&gt;&lt;/param&gt;</span><span style="color:#008000;">
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;returns&gt;&lt;/returns&gt;</span><span style="color:#808080;">
</span><span style="color:#000000;">        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">static</span><span style="color:#000000;"> </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> RowCount(</span><span style="color:#0000FF;">this</span><span style="color:#000000;"> DataTable table)
        {
            </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> rows </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">-</span><span style="color:#800080;">1</span><span style="color:#000000;">;

            </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (table </span><span style="color:#000000;">!=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">null</span><span style="color:#000000;">)
            {
                rows </span><span style="color:#000000;">=</span><span style="color:#000000;"> table.Rows.Count;
            }
            </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> rows;
        }
    }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>The usage using the RowCount Function.&#160; </p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:2c5ce9cc-cd05-4466-a1ae-b508f20abc5f" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#0000FF;">private</span><span style="color:#000000;"> </span><span style="color:#0000FF;">static</span><span style="color:#000000;"> </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> GetDataTableCount(DataTable table)
{
  </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> table.RowCount();
}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>The usage using the HasRows Function</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:f5327d63-c7b9-4675-b7c1-1168c8b87b75" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#0000FF;">private</span><span style="color:#000000;"> </span><span style="color:#0000FF;">static</span><span style="color:#000000;"> </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> GetDataTableCount(DataTable table)
{
  </span><span style="color:#0000FF;">if</span><span style="color:#000000;">(table.HasRows())
  {
      </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> table.Rows.Count;
  }
  </span><span style="color:#0000FF;">else</span><span style="color:#000000;">
  {
      </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#000000;">-</span><span style="color:#800080;">1</span><span style="color:#000000;">;
  }
}</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>&#160;</p>
<p>This is just one example of how extension methods can make your data processing layer a little more robust with automatic null checking.&#160; </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tsells.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tsells.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tsells.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tsells.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tsells.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tsells.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tsells.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tsells.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tsells.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tsells.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tsells.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tsells.wordpress.com/502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tsells.wordpress.com/502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tsells.wordpress.com/502/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=502&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tsells.wordpress.com/2011/07/27/ado-net-and-extension-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/164053312704d79937b37a0493d71305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tsells</media:title>
		</media:content>
	</item>
		<item>
		<title>How to center and right align text inside a GridViewColumn in a WPF ListView Control</title>
		<link>http://tsells.wordpress.com/2011/07/13/how-to-center-and-right-align-text-inside-a-gridviewcolumn-in-a-wpf-listview-control/</link>
		<comments>http://tsells.wordpress.com/2011/07/13/how-to-center-and-right-align-text-inside-a-gridviewcolumn-in-a-wpf-listview-control/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 17:55:54 +0000</pubDate>
		<dc:creator>tsells</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[GridView]]></category>
		<category><![CDATA[GridViewColumn]]></category>
		<category><![CDATA[ListView]]></category>
		<category><![CDATA[text alignment]]></category>

		<guid isPermaLink="false">https://tsells.wordpress.com/2011/07/13/how-to-center-and-right-align-text-inside-a-gridviewcolumn-in-a-wpf-listview-control/</guid>
		<description><![CDATA[I had some issues today getting some values inside a ListView / GridView to center and right align.&#160; Regardless of what properties I set on the columns / data templates / etc it would always remain left aligned for text blocks.&#160; &#160; To resolve you have to set the style at the list view level. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=501&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had some issues today getting some values inside a ListView / GridView to center and right align.&#160; Regardless of what properties I set on the columns / data templates / etc it would always remain left aligned for text blocks.&#160; </p>
<p>&#160;</p>
<p>To resolve you have to set the style at the list view level. Changing the horizontal content alignment to stretch allows the inner controls (text block) to align based on settings.&#160; </p>
<p>&#160;</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:c3760b3b-88a6-43f0-8190-d15e581c4f5e" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">ListView
    </span><span style="color:#FF0000;">&lt;ListView.ItemContainerStyle</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Style </span><span style="color:#FF0000;">TargetType</span><span style="color:#0000FF;">="ListViewItem"</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Setter </span><span style="color:#FF0000;">Property</span><span style="color:#0000FF;">="HorizontalContentAlignment"</span><span style="color:#FF0000;"> Value</span><span style="color:#0000FF;">="Stretch"</span><span style="color:#FF0000;"> </span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Style</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">ListView.ItemContainerStyle</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">ListView.View</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">GridView</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">GridViewColumn</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
                 </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">TextBlock </span><span style="color:#FF0000;">Text</span><span style="color:#0000FF;">="MyText"</span><span style="color:#FF0000;"> TextAlignment</span><span style="color:#0000FF;">="Center"</span><span style="color:#FF0000;"> </span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">GridViewColumn</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">GridView</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">ListView.View</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">ListView</span><span style="color:#0000FF;">&gt;</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>Thanks to <a href="http://social.msdn.microsoft.com/Forums/en/wpf/thread/1f17a5a6-c71f-4810-b8bc-e4eb2a25fa96" target="_blank">Bill Menees</a> for helping find this solution.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tsells.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tsells.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tsells.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tsells.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tsells.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tsells.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tsells.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tsells.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tsells.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tsells.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tsells.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tsells.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tsells.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tsells.wordpress.com/501/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=501&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tsells.wordpress.com/2011/07/13/how-to-center-and-right-align-text-inside-a-gridviewcolumn-in-a-wpf-listview-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/164053312704d79937b37a0493d71305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tsells</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF TreeView SelectedItemChanged event firing multiple times</title>
		<link>http://tsells.wordpress.com/2011/05/17/wpf-treeview-selecteditemchanged-event-firing-multiple-times/</link>
		<comments>http://tsells.wordpress.com/2011/05/17/wpf-treeview-selecteditemchanged-event-firing-multiple-times/#comments</comments>
		<pubDate>Tue, 17 May 2011 18:50:56 +0000</pubDate>
		<dc:creator>tsells</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Dispatcher]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Multiple]]></category>
		<category><![CDATA[SelectedItemChanged]]></category>
		<category><![CDATA[TreeView]]></category>

		<guid isPermaLink="false">https://tsells.wordpress.com/2011/05/17/wpf-treeview-selecteditemchanged-event-firing-multiple-times/</guid>
		<description><![CDATA[I had an issue today with a WPF TreeView that was very annoying and wasted half of my day with it so it deserved a blog post about it to hopefully save someone else some trouble.&#160; Basic Summary: I have a parent item and multiple children in a tree.&#160; I selected one of the child [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=492&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had an issue today with a WPF TreeView that was very annoying and wasted half of my day with it so it deserved a blog post about it to hopefully save someone else some trouble.&#160; </p>
<p><strong>Basic Summary:</strong></p>
<p>I have a parent item and multiple children in a tree.&#160; I selected one of the child items and it would revert back and select the parent. </p>
<p>Now keep in mind this is a modified Tree View to look like a data grid and there is a lot of processing that goes on behind the scenes in the SelectedItemChanged event. This only occurred when I changed the item in the tree with a mouse click.&#160; If I used the up and down arrows or did it programmatically everything was fine.&#160; </p>
<p>&#160;</p>
<p><strong>Research:</strong></p>
<p>After a couple of hours of digging I found a topic in the MSDN Forums <a href="http://social.msdn.microsoft.com/Forums/en/wpf/thread/3b4d84c8-c4fe-438b-85b5-19b1594fb646" target="_blank">here</a> that talked about how the processing is done internally.&#160; This got me to thinking that it has to be a timing issue and the processing was not completed in time.&#160; The UI Layer was calling a focus method on the tree control which I believe occurred while the Parent item still had a focus set for sub processing behind the scenes.&#160; Since this was the case the SelectedItemChanged event was being fired a second time to set the IsSelected property back to the parent object.&#160;&#160; I have not confirmed this but this led me to use the dispatcher to try and resolve.&#160; </p>
<p><strong>Solution:</strong></p>
<p>Using the dispatcher object I was able to run the code inside the selected item changed event and prevent this from occurring.&#160; After wrapping the code inside the BeginInvoke()method the event was only fired once.&#160; </p>
<p>Note the DispatcherPriority.Send parameter is the highest priority you can set for the dispatcher.&#160;&#160;&#160; </p>
<p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:a251a894-9a09-429c-b21b-8c76b751bc90" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#000000;">TreeView tv </span><span style="color:#000000;">=</span><span style="color:#000000;"> e.OriginalSource </span><span style="color:#0000FF;">as</span><span style="color:#000000;"> TreeView;
 e.Handled </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">true</span><span style="color:#000000;">;

 </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.Dispatcher.BeginInvoke(DispatcherPriority.Send, </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> Action(
     </span><span style="color:#0000FF;">delegate</span><span style="color:#000000;">
     {
            </span><span style="color:#008000;">//</span><span style="color:#008000;"> Do processing here</span><span style="color:#008000;">
</span><span style="color:#000000;">
        }));</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tsells.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tsells.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tsells.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tsells.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tsells.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tsells.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tsells.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tsells.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tsells.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tsells.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tsells.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tsells.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tsells.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tsells.wordpress.com/492/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=492&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tsells.wordpress.com/2011/05/17/wpf-treeview-selecteditemchanged-event-firing-multiple-times/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/164053312704d79937b37a0493d71305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tsells</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle 11g Release 2 and .Net Framework 4.0 and Version Checking</title>
		<link>http://tsells.wordpress.com/2011/05/12/oracle-11g-release-2-and-net-framework-4-0-and-version-checking/</link>
		<comments>http://tsells.wordpress.com/2011/05/12/oracle-11g-release-2-and-net-framework-4-0-and-version-checking/#comments</comments>
		<pubDate>Fri, 13 May 2011 03:32:04 +0000</pubDate>
		<dc:creator>tsells</dc:creator>
				<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[11g]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[726240.1]]></category>
		<category><![CDATA[ODP.NET]]></category>
		<category><![CDATA[Oracle Data Provider]]></category>
		<category><![CDATA[Version]]></category>
		<category><![CDATA[Version Check]]></category>

		<guid isPermaLink="false">https://tsells.wordpress.com/2011/05/12/oracle-11g-release-2-and-net-framework-4-0-and-version-checking/</guid>
		<description><![CDATA[I recently found out that Oracle is not supporting the .net 4.0 framework with any version of the Oracle Provider for .Net prior to 11.2.0.2.&#160; (See Oracle Data Provider for .NET (ODP) Supported Configurations [ID 726240.1] from oracle support for more details).&#160; Since the prior versions work (10.2, 11.1, 11.2.0.1) then I needed a way [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=491&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently found out that Oracle is not supporting the .net 4.0 framework with any version of the Oracle Provider for .Net prior to 11.2.0.2.&#160; (See Oracle Data Provider for .NET (ODP) Supported Configurations [ID 726240.1] from oracle support for more details).&#160; </p>
<p>Since the prior versions work (10.2, 11.1, 11.2.0.1) then I needed a way to prevent end users from using the wrong version.&#160; I searched the net and could not find any one who was able to do this so I did some digging.&#160; After some testing I came up with the following code.</p>
<p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:e2f69343-f23c-49b6-b634-03ff6cd2ab3b" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#000000;">System.Data.Common.DbProviderFactory factory </span><span style="color:#000000;">=</span><span style="color:#000000;">
                    System.Data.Common.DbProviderFactories.GetFactory(</span><span style="color:#800000;">"</span><span style="color:#800000;">Oracle.DataAccess.Client</span><span style="color:#800000;">"</span><span style="color:#000000;">);

                </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (factory </span><span style="color:#000000;">==</span><span style="color:#000000;"> </span><span style="color:#0000FF;">null</span><span style="color:#000000;">)
                    </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#0000FF;">false</span><span style="color:#000000;">;

                Type t </span><span style="color:#000000;">=</span><span style="color:#000000;"> factory.GetType();

                </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> majorversion </span><span style="color:#000000;">=</span><span style="color:#000000;"> t.Assembly.GetName().Version.Major;

                </span><span style="color:#008000;">//</span><span style="color:#008000;"> Do not allow any major versions less than 4</span><span style="color:#008000;">
</span><span style="color:#000000;">                </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (majorversion </span><span style="color:#000000;">&lt;</span><span style="color:#000000;"> </span><span style="color:#800080;">4</span><span style="color:#000000;">)
                    </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#0000FF;">false</span><span style="color:#000000;">;</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</p>
<p>This code will use the same data provider that is registered with the .net framework version you are using.&#160; This ensures you are not out of sink in your environment and allows you to inspect the version of the dll installed.&#160; For this example – I am just checking that ODP is 4.0 or higher (first release of odp for .net 4).&#160; </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tsells.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tsells.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tsells.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tsells.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tsells.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tsells.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tsells.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tsells.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tsells.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tsells.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tsells.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tsells.wordpress.com/491/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tsells.wordpress.com/491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tsells.wordpress.com/491/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=491&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tsells.wordpress.com/2011/05/12/oracle-11g-release-2-and-net-framework-4-0-and-version-checking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/164053312704d79937b37a0493d71305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tsells</media:title>
		</media:content>
	</item>
		<item>
		<title>How to setup a SQL Failover Cluster with VMware WorkStation</title>
		<link>http://tsells.wordpress.com/2011/04/22/how-to-setup-a-sql-failover-cluster-with-vmware-workstation/</link>
		<comments>http://tsells.wordpress.com/2011/04/22/how-to-setup-a-sql-failover-cluster-with-vmware-workstation/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 21:47:35 +0000</pubDate>
		<dc:creator>tsells</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Cluster]]></category>
		<category><![CDATA[Failover]]></category>
		<category><![CDATA[Virtual San]]></category>
		<category><![CDATA[VMWare]]></category>
		<category><![CDATA[WorkStation]]></category>

		<guid isPermaLink="false">https://tsells.wordpress.com/2011/04/22/how-to-setup-a-sql-failover-cluster-with-vmware-workstation/</guid>
		<description><![CDATA[I wanted to setup a SQL Cluster environment with VMware workstation just to play with it and check out some of the features.&#160;&#160; I don’t have a SAN (SCSI) setup at home so I need to virtualize that.&#160; What I do have though is a 6 core 16 GB Ram work station that is fully [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=478&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I wanted to setup a SQL Cluster environment with VMware workstation just to play with it and check out some of the features.&#160;&#160; I don’t have a SAN (SCSI) setup at home so I need to virtualize that.&#160; What I do have though is a 6 core 16 GB Ram work station that is fully capable of running this so here we go…..</p>
<p><strong>Minimum Requirements</strong></p>
<p><u>Host Machine</u></p>
<ul>
<li>Processor – 2 – 4 Cores </li>
<li>Memory&#160; &#8211; 8 GB’s </li>
</ul>
<p><u>Client Machines</u></p>
<p>Domain Controller&#160; (Required for VSAN and Clustering)</p>
<ul>
<li>1 –2 Cores </li>
<li>1 GB Ram </li>
</ul>
<p>Virtual SAN (iSCSI)</p>
<ul>
<li>1 –2 Cores </li>
<li>1 GB Ram </li>
<li>200-500 GB Virtual Hard Disk </li>
</ul>
<ul>SQL Servers (2)</ul>
<ul>
<li>2 –4 Cores </li>
<li>2 GB Ram </li>
<p> <!--EndFragment--></ul>
<ul><strong>Setup Operating Systems (Virtual Machines)</strong></ul>
<p>See my post <a href="http://tsells.wordpress.com/2011/04/22/how-to-setup-a-base-virtual-machine-for-use-in-vmware-workstation/" target="_blank">here</a> for details on how to setup a base virtual machine to make this process easier.&#160; </p>
<p>1.&#160; Setup a domain controller and create a domain (see <a href="http://tsells.wordpress.com/2009/12/16/how-to-test-windows-authentication-with-applications-and-vmware-workstation/" target="_blank">here</a> for tips on setting up the domain controller)</p>
<p>- create a domain level admin user account for usage later. Example – sqladmin</p>
<p>2.&#160; If a Virtual SAN is required – see <a href="http://tsells.wordpress.com/2011/04/22/how-to-create-a-virtual-iscsi-san-disk-with-vmware-workstation-and-server-2008-r2/" target="_blank">this post</a> for detailed steps on setting this up.</p>
<p>3.&#160; Create 1st SQL Virtual Machine </p>
<ul>
<li>Create Linked Clone</li>
<li>Add a second host only network adapter</li>
<li>Rename machine to SQL1</li>
<li>Join to Domain</li>
<li>Enable the Failover Clustering Feature (Administrative Tools – Server Manager – Features – Add Feature – Failover Clustering)</li>
<li>Install the iSCSI client software but <strong>do not</strong> create the drives yet &#8211; <a href="http://tsells.wordpress.com/2011/04/22/how-to-create-a-virtual-iscsi-san-disk-with-vmware-workstation-and-server-2008-r2/" target="_blank">details</a> </li>
</ul>
<ul>4.&#160; Create 2nd SQL Virtual Machine using the above steps</ul>
<ul>At this point all machines should be up and running. </ul>
<ul></ul>
<ul><strong>Setup the SAN Disks</strong></ul>
<ul>Reference this <a href="http://tsells.wordpress.com/2011/04/22/how-to-create-a-virtual-iscsi-san-disk-with-vmware-workstation-and-server-2008-r2/" target="_blank">post</a> for details on the steps below</ul>
<p>1.&#160; 3 Drives must be created on the iSCSI target (order is critical)</p>
<ul>
<li>5 GB drive – label Quorum</li>
<li>10 GB drive – label MSDTC</li>
<li>100 + GB Drive – label Data</li>
</ul>
<p>2.&#160; Connect each of the drives to the SQL1 Machine and format NTFS </p>
<p>3.&#160; Connect each of the drives to the SQL 2 Machine (no formatting required)</p>
<p>The disks should now be available for usage in the cluster</p>
<p>&#160;</p>
<p><strong>Setup the Cluster</strong></p>
<p>We want to test the configuration before proceeding so we can fix any changes ahead of time.&#160; </p>
<p><u>Validate the cluster</u></p>
<p>1.&#160; Launch the cluster manager (Administrative Tools – Failover Cluster Manager)</p>
<p>2.&#160; Click on Validate a Configuration</p>
<p>3.&#160; Click next&#160; &#8211; then enter the dns names of the two servers in the Select Servers Wizard</p>
<p>4.&#160; Once selected – run all of the tests and ensure they all pass.&#160; If not – you will need to address these before continuing. </p>
<p>5.&#160; Only after validating the configuration should you continue.&#160; </p>
<p><u>Setup</u></p>
<p>1.&#160; Select the two servers for the cluster</p>
<p>2.&#160; Provide an access point for the cluster (Name that it can be accessed by)</p>
<p>3.&#160; Complete the wizard.&#160; Once the cluster is created – move to the next step.</p>
<p>4.&#160; At this point the two nodes should appear in the cluster manager with a status of Up.&#160; Under the Storage section you should see all 3 drives.&#160; The first drive should by under the Quorum section with the other two drives not being used.&#160; If they are not online – right click and select &quot;bring this resource online”</p>
<p>5.&#160; Go to Services and Applications – right click and select “Configure a service or application”</p>
<p>6.&#160; Select the DTC and click next</p>
<p><a href="http://tsells.files.wordpress.com/2011/04/image8.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb8.png?w=244&#038;h=110" width="244" height="110" /></a></p>
<p>7.&#160; Give it a name, and then select the 2nd disk we created for storage.&#160; Complete the wizard.&#160; </p>
<p>At this point we are ready to install SQL Server</p>
<p><strong>Setup SQL Server</strong></p>
<p><u>SQL 1</u></p>
<p>1.&#160; Put in your SQL Server 2008 R2 disk or mount the ISO file.</p>
<p>2.&#160; Launch the installation and go to the SQL Server Installation Center.</p>
<p>3.&#160; Select Installation – New SQL Server failover cluster installation</p>
<p><a href="http://tsells.files.wordpress.com/2011/04/image9.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb9.png?w=244&#038;h=95" width="244" height="95" /></a></p>
<p>4.&#160; Ensure all of the prerequisites pass.&#160; </p>
<p>5. Walk through the wizard </p>
<ul>
<li>Select DB Features </li>
</ul>
<p><a href="http://tsells.files.wordpress.com/2011/04/image10.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb10.png?w=200&#038;h=92" width="200" height="92" /></a></p>
<ul>
<li>Set your instance configuration and your public Cluster Name</li>
</ul>
<p><a href="http://tsells.files.wordpress.com/2011/04/image11.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb11.png?w=244&#038;h=133" width="244" height="133" /></a></p>
<ul>
<li>Select your cluster disk</li>
</ul>
<p><a href="http://tsells.files.wordpress.com/2011/04/image12.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb12.png?w=244&#038;h=167" width="244" height="167" /></a></p>
<ul>
<li>Under Service Accounts – use the Domain user you created above</li>
<li>Complete the rest of the configuration based on your preferences</li>
</ul>
<ul>Once the installation is complete – you can now connect to SQL server.&#160; Time to setup the other half.&#160; </ul>
<p><u>SQL 2</u></p>
<p>1.&#160; Put in your SQL Server 2008 R2 disk or mount the ISO file.</p>
<p>2.&#160; Launch the installation and go to the SQL Server Installation Center.</p>
<p>3.&#160; Select Installation – Add note to a SQL Server failover cluster </p>
<p><a href="http://tsells.files.wordpress.com/2011/04/image13.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb13.png?w=244&#038;h=97" width="244" height="97" /></a></p>
<p>4.&#160; Walk through the steps and select the cluster to attach to from the SQL 1 setup. </p>
<p>5.&#160; Once installation is complete – you now have a failover ready.&#160; </p>
<p>SQL Server should now show up under the Services and Applications section in the Failover Cluster Manager.&#160; </p>
<p><a href="http://tsells.files.wordpress.com/2011/04/image14.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb14.png?w=244&#038;h=82" width="244" height="82" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tsells.wordpress.com/478/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tsells.wordpress.com/478/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tsells.wordpress.com/478/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tsells.wordpress.com/478/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tsells.wordpress.com/478/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tsells.wordpress.com/478/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tsells.wordpress.com/478/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tsells.wordpress.com/478/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tsells.wordpress.com/478/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tsells.wordpress.com/478/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tsells.wordpress.com/478/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tsells.wordpress.com/478/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tsells.wordpress.com/478/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tsells.wordpress.com/478/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=478&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tsells.wordpress.com/2011/04/22/how-to-setup-a-sql-failover-cluster-with-vmware-workstation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/164053312704d79937b37a0493d71305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tsells</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb13.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb14.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>How to create a Virtual ISCSI SAN Disk with VMware Workstation and Server 2008 R2</title>
		<link>http://tsells.wordpress.com/2011/04/22/how-to-create-a-virtual-iscsi-san-disk-with-vmware-workstation-and-server-2008-r2/</link>
		<comments>http://tsells.wordpress.com/2011/04/22/how-to-create-a-virtual-iscsi-san-disk-with-vmware-workstation-and-server-2008-r2/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 20:40:04 +0000</pubDate>
		<dc:creator>tsells</dc:creator>
				<category><![CDATA[SAN]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[iSCSI]]></category>
		<category><![CDATA[Virtual San]]></category>
		<category><![CDATA[VMWare]]></category>
		<category><![CDATA[WorkStation]]></category>

		<guid isPermaLink="false">https://tsells.wordpress.com/2011/04/22/how-to-create-a-virtual-iscsi-san-disk-with-vmware-workstation-and-server-2008-r2/</guid>
		<description><![CDATA[This post explains how to setup Windows 2008 R2 to be a virtual San that can be connected to from other machines.  This is helpful for providing shared storage for testing items like clustering. Note: This should NOT be used in a production environment. Setup Target 1.  Setup a base 2008 R2 VM with all [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=463&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post explains how to setup Windows 2008 R2 to be a virtual San that can be connected to from other machines.  This is helpful for providing shared storage for testing items like clustering.</p>
<p>Note: This should <strong>NOT</strong> be used in a production environment.</p>
<p><strong><span style="text-decoration:underline;">Setup Target</span></strong></p>
<p>1.  Setup a base 2008 R2 VM with all of the latest updates.  I normally have one of these on hand and create linked clones from it to save space.  See my post <a href="http://tsells.wordpress.com/2011/04/22/how-to-setup-a-base-virtual-machine-for-use-in-vmware-workstation/" target="_blank">here</a> for details on setting this up.</p>
<p>2.  If you do not have a domain controller – you must setup one up.  Again I use the base VM mentioned in Step  to create a domain controller off of.  See my post <a href="http://tsells.wordpress.com/2009/12/16/how-to-test-windows-authentication-with-applications-and-vmware-workstation/" target="_blank">here</a> on how to setup a Domain Controller with VMware without upsetting your network environment.</p>
<p>3.  Now you are ready to create the Operating system.  Create a linked clone from the base, rename the machine name (I will use VSAN for machine name), and join the machine to your domain.</p>
<p>4.  Download the Microsoft iSCSI Software Target 3.3 from the following site.</p>
<p><a title="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=45105d7f-8c6c-4666-a305-c8189062a0d0" href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=45105d7f-8c6c-4666-a305-c8189062a0d0">http://www.microsoft.com/downloads/en/details.aspx?FamilyID=45105d7f-8c6c-4666-a305-c8189062a0d0</a></p>
<p>5.  Copy iscsitarget_public.msi to the VSAN machine and launch the installer.  Follow the dialogs and perform the standard installation.</p>
<p>6.  Now launch the administrator via Administrative Tools – Microsoft iSCSI Software Target</p>
<p><a href="http://tsells.files.wordpress.com/2011/04/image5.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0;" title="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb5.png?w=240&#038;h=244" alt="image" width="240" height="244" border="0" /></a></p>
<p>7.  Right click on iSCSI targets and <strong>Create iSCSI target</strong></p>
<p>8.  Give a valid name to your Target (I’ll call this SAN1)</p>
<p>9.  On the iSCSI Initiators Identifiers screen – this can be confusing.  For the IQN you will want to give it a name that your Client machine will use.  Since we haven’t set that up yet – we have to guess (and come back later to fix if needed).  The syntax for this is as follows.</p>
<p>iqn.1991-05.com.microsoft:<em>machinename.domainname</em>.com</p>
<p>The italicized words will need to be changed to match your environment.</p>
<p>10.  Click finish to complete.</p>
<p>11.  Right click on the newly created target in the tree and create a virtual disk</p>
<p><a href="http://tsells.files.wordpress.com/2011/04/image6.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0;" title="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb6.png?w=244&#038;h=117" alt="image" width="244" height="117" border="0" /></a></p>
<p>12.  Walk through the wizard providing a file name, space (note it’s in megabytes), and description.</p>
<p>13.  Make sure to Check the ‘Enable this target storage services’ checkbox” in the SAN1 properties. Otherwise the Discover Targets doesn’t work when configuring the clients</p>
<p>At this point you now have a valid SAN disk available to your client.</p>
<p><strong><span style="text-decoration:underline;">Setup Client</span></strong></p>
<p>This can be setup on most of the newer operating systems.</p>
<p>1.  Login to the OS as an administrator</p>
<p>2.  From the download earlier – get the following file for installation</p>
<p>iscsitargetClient_public.msi</p>
<p>3.  Start the installation and follow the defaults.</p>
<p>4.  Now launch the program via Administrative Tools – iSCSI Initiator</p>
<p><a href="http://tsells.files.wordpress.com/2011/04/image7.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0;" title="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb7.png?w=244&#038;h=188" alt="image" width="244" height="188" border="0" /></a></p>
<p>5.  Go to the Discovery Tab and click Discover Portal… Type in the IP Address of the VSAN machine we created in above and click ok.</p>
<p>6.  Go to the targets Tab and click refresh.  You should see an entry in the Discovered targets list box.  If the status does not show as connected – highlight the item and click <strong>Connect.</strong></p>
<p>7.  Now go to the Volumes and Devices tab.  Click Auto Configure to automatically make the SAN drive available.</p>
<p>Now if you go into disk management you can see the drive.  Bring it online, initialize it, and create a partition to start using it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tsells.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tsells.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tsells.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tsells.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tsells.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tsells.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tsells.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tsells.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tsells.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tsells.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tsells.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tsells.wordpress.com/463/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tsells.wordpress.com/463/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tsells.wordpress.com/463/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=463&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tsells.wordpress.com/2011/04/22/how-to-create-a-virtual-iscsi-san-disk-with-vmware-workstation-and-server-2008-r2/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/164053312704d79937b37a0493d71305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tsells</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>How to setup a base Virtual Machine for use in VMware Workstation</title>
		<link>http://tsells.wordpress.com/2011/04/22/how-to-setup-a-base-virtual-machine-for-use-in-vmware-workstation/</link>
		<comments>http://tsells.wordpress.com/2011/04/22/how-to-setup-a-base-virtual-machine-for-use-in-vmware-workstation/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 20:06:24 +0000</pubDate>
		<dc:creator>tsells</dc:creator>
				<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Base Images]]></category>
		<category><![CDATA[SysPrep]]></category>
		<category><![CDATA[VMWare]]></category>
		<category><![CDATA[WorkStation]]></category>

		<guid isPermaLink="false">https://tsells.wordpress.com/2011/04/22/how-to-setup-a-base-virtual-machine-for-use-in-vmware-workstation/</guid>
		<description><![CDATA[This post discusses setting up a base Virtual Machine to allow creating multiple machines in a timely manner.&#160; Create Base Image 1.&#160; Create a new virtual machine for 2008 R2.&#160; I normally use the following base specs 1 – 2 processors 1 Gig of Ram 60 gig System Drive (Dynamically Expanding) 2.&#160; Launch the VM [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=456&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post discusses setting up a base Virtual Machine to allow creating multiple machines in a timely manner.&#160; </p>
<p><strong><u>Create Base Image</u></strong></p>
<p>1.&#160; Create a new virtual machine for 2008 R2.&#160; I normally use the following base specs</p>
<ul>
<li>1 – 2 processors</li>
<li>1 Gig of Ram</li>
<li>60 gig System Drive (Dynamically Expanding)</li>
</ul>
<p>2.&#160; Launch the VM and install Server 2008 R2</p>
<p>3.&#160; Update the VM with all of the latest patches.&#160; I normally install .net 3.5 SP1 (enable) and .net 4.0 at this point</p>
<p>4.&#160; Sys Prep the machine so when cloned – it will launch with a new SID so it can be joined to a domain without the need for major changes</p>
<ul>
<li>Launch C:\Windows\System32\sysprep\sysprep.exe</li>
<li>Set to the settings below and click ok</li>
</ul>
<p> <a href="http://tsells.files.wordpress.com/2011/04/image3.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb3.png?w=244&#038;h=186" width="244" height="186" /></a>
<p>5.&#160; The machine is now shutdown.&#160; Take a snapshot and label “sysprep”.</p>
<p>You are now ready to clone this machine to another machine</p>
<p><strong><u>Clone Machine</u></strong></p>
<p>1.&#160; Right click on the VM Tab and select Clone</p>
<p>2.&#160; Choose the snapshot created above</p>
<p><a href="http://tsells.files.wordpress.com/2011/04/image4.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0;" title="image" border="0" alt="image" src="http://tsells.files.wordpress.com/2011/04/image_thumb4.png?w=244&#038;h=212" width="244" height="212" /></a></p>
<p>3.&#160; Select your location (I like to use a sub folder inside the base VM folder for ease of use when migrating to a different machine / disk / etc).&#160; </p>
<p>4.&#160; Once the clone is complete – modify the hardware settings as needed (Number of processors, memory, etc)</p>
<p>5.&#160; Launch the machine and rename the Computer name to a desired name</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tsells.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tsells.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tsells.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tsells.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tsells.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tsells.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tsells.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tsells.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tsells.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tsells.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tsells.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tsells.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tsells.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tsells.wordpress.com/456/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=456&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tsells.wordpress.com/2011/04/22/how-to-setup-a-base-virtual-machine-for-use-in-vmware-workstation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/164053312704d79937b37a0493d71305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tsells</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://tsells.files.wordpress.com/2011/04/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF DatePicker not updating SelectedDate Property&#8211;Part 2</title>
		<link>http://tsells.wordpress.com/2011/04/20/wpf-datepicker-not-updating-selecteddate-propertypart-2/</link>
		<comments>http://tsells.wordpress.com/2011/04/20/wpf-datepicker-not-updating-selecteddate-propertypart-2/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 20:12:09 +0000</pubDate>
		<dc:creator>tsells</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[DatePicker]]></category>
		<category><![CDATA[Focus]]></category>
		<category><![CDATA[property]]></category>
		<category><![CDATA[SelectedDate]]></category>

		<guid isPermaLink="false">https://tsells.wordpress.com/2011/04/20/wpf-datepicker-not-updating-selecteddate-propertypart-2/</guid>
		<description><![CDATA[Well me last post here addressed the first issue but caused major issues with the validation and updating of dates at the appropriate times.&#160; It was more problematic than the original issue.&#160;&#160; It was time to find another solution. Summary of Issue To recap the issue – I have a DatePicker that is inside a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=451&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well me last post <a href="http://tsells.wordpress.com/2011/03/22/wpf-datepicker-not-updating-selecteddate-property/" target="_blank">here</a> addressed the first issue but caused major issues with the validation and updating of dates at the appropriate times.&#160; It was more problematic than the original issue.&#160;&#160; It was time to find another solution. </p>
<p><strong>Summary of Issue</strong></p>
<p>To recap the issue – I have a DatePicker that is inside a WPF User Control that is hosted in a C++ application that also has WinFormHost Controls in the user control. The issue occurs when typing in a date (not using the date picker).&#160; Anytime you type in a date and then directly click on the WinFormHost or the native application – the focus changed event does not fire on the WPF DatePicker which could potentially cause underlying properties to not update.&#160; This resulted in data loss and validation events not being fired.&#160; </p>
<p>I decided to inspect the source code of the date picker to see what was happening internally.&#160; In a nutshell, when the internal text box loses focus – it parses the string and sets the SelectedDate property.&#160; Now I have an alternative. </p>
<p><strong>Work Around / Hack</strong>&#160;</p>
<p>I created a method (below) that forces the property to be updated when ever this method is called.&#160; I added multiple events around the user control to intercept the mouse / keyboard events and then call this method.&#160; </p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:0a2d5f1f-f9e8-44ba-b151-5f803f058809" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#000000;">         </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;summary&gt;</span><span style="color:#008000;">
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> Forces a refresh of the date picker UI
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;/summary&gt;</span><span style="color:#808080;">
</span><span style="color:#000000;">        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> SetDatePickerProperties(</span><span style="color:#0000FF;">bool</span><span style="color:#000000;"> ignoreFocus)
        {
            </span><span style="color:#008000;">//</span><span style="color:#008000;"> This is a hack - WPF datepicker not losing focus with interops.</span><span style="color:#008000;">
</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (ignoreFocus)
            {
                </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> s1 </span><span style="color:#000000;">=</span><span style="color:#000000;"> dpEstImplDate.Text;
                DateTime</span><span style="color:#000000;">?</span><span style="color:#000000;"> d1 </span><span style="color:#000000;">=</span><span style="color:#000000;"> ParseText(s1);
                dp1Date.SelectedDate </span><span style="color:#000000;">=</span><span style="color:#000000;"> d1;
                PerformManualValidation();
            }
            </span><span style="color:#0000FF;">else</span><span style="color:#000000;">
            {
                </span><span style="color:#008000;">//</span><span style="color:#008000;"> Only perform this if date picker has focus</span><span style="color:#008000;">
</span><span style="color:#000000;">                </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (_dp1HasKeyboardFocus)
                {
                    </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> s </span><span style="color:#000000;">=</span><span style="color:#000000;"> dpEstImplDate.Text;
                    DateTime</span><span style="color:#000000;">?</span><span style="color:#000000;"> d </span><span style="color:#000000;">=</span><span style="color:#000000;"> ParseText(s);
                    dpEstImplDate.SelectedDate </span><span style="color:#000000;">=</span><span style="color:#000000;"> d;
                    PerformManualValidation();
                }
            }
        }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>&#160;</p>
<p>Below is the parsing method being used to get the date from the text box.&#160; </p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:1398389c-5bb3-4894-9bc3-e1920a7fb9e0" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;summary&gt;</span><span style="color:#008000;">
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> This method was pulled and modified from Source of WPF Toolkit
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;/summary&gt;</span><span style="color:#008000;">
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;param name="text"&gt;&lt;/param&gt;</span><span style="color:#008000;">
        </span><span style="color:#808080;">///</span><span style="color:#008000;"> </span><span style="color:#808080;">&lt;returns&gt;&lt;/returns&gt;</span><span style="color:#808080;">
</span><span style="color:#000000;">        </span><span style="color:#0000FF;">private</span><span style="color:#000000;"> DateTime</span><span style="color:#000000;">?</span><span style="color:#000000;"> ParseText(</span><span style="color:#0000FF;">string</span><span style="color:#000000;"> text)
        {
            DateTime newSelectedDate;
            </span><span style="color:#0000FF;">try</span><span style="color:#000000;">
            {
                </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (DateTime.TryParse(text, </span><span style="color:#0000FF;">out</span><span style="color:#000000;"> newSelectedDate))
                {
                    </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> newSelectedDate;
                }
            }
            </span><span style="color:#0000FF;">catch</span><span style="color:#000000;"> (Exception ex)
            {
                </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#0000FF;">null</span><span style="color:#000000;">;
            }
            </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#0000FF;">null</span><span style="color:#000000;">;
        }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>Here are some of the event handlers used to ensure the properties are always updated.&#160; I also have a mouse leave event on the main user control that performs the same functions.&#160; </p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:d8b750b2-83e3-4847-b003-8726fef528a4" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;overflow:auto;"><span style="color:#000000;">        </span><span style="color:#0000FF;">private</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> dp1Date_LostKeyboardFocus(</span><span style="color:#0000FF;">object</span><span style="color:#000000;"> sender, KeyboardFocusChangedEventArgs e)
        {
            SetDatePickerProperties();
            _dp1HasKeyboardFocus </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">false</span><span style="color:#000000;">;
        }

        </span><span style="color:#0000FF;">private</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> dp1Date_GotKeyboardFocus(</span><span style="color:#0000FF;">object</span><span style="color:#000000;"> sender, KeyboardFocusChangedEventArgs e)
        {
            _dp1HasKeyboardFocus </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">true</span><span style="color:#000000;">;
        }</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tsells.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tsells.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tsells.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tsells.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tsells.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tsells.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tsells.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tsells.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tsells.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tsells.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tsells.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tsells.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tsells.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tsells.wordpress.com/451/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tsells.wordpress.com&amp;blog=9507420&amp;post=451&amp;subd=tsells&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tsells.wordpress.com/2011/04/20/wpf-datepicker-not-updating-selecteddate-propertypart-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/164053312704d79937b37a0493d71305?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tsells</media:title>
		</media:content>
	</item>
	</channel>
</rss>
