<?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/"
	>

<channel>
	<title>Neal's Blog</title>
	<atom:link href="http://www.applicationgroup.com/blog/index.php?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.applicationgroup.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 31 Oct 2011 17:38:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Windows 7 to SQL 2000 Slow</title>
		<link>http://www.applicationgroup.com/blog/?p=31</link>
		<comments>http://www.applicationgroup.com/blog/?p=31#comments</comments>
		<pubDate>Mon, 31 Oct 2011 17:38:32 +0000</pubDate>
		<dc:creator>Neal</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.applicationgroup.com/blog/?p=31</guid>
		<description><![CDATA[I&#8217;ve had a problem that when accessing data on a SQL 2000 server from a Windows 7 PC the data access was very slow.  I also noted that connecting to the sql server via RDP from Windows 7 was also very slow.
I&#8217;ve been battling this problem for months.  I&#8217;ve found several suggestions to resolve the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a problem that when accessing data on a SQL 2000 server from a Windows 7 PC the data access was very slow.  I also noted that connecting to the sql server via RDP from Windows 7 was also very slow.</p>
<p>I&#8217;ve been battling this problem for months.  I&#8217;ve found several suggestions to resolve the issue.  Connecting by IP address rather than name, disabling LLMNR, putting the SQL server in the HOSTS file, which of course should have the same effect as using the IP address.  None of these worked.  I finally started looking at why the RDP would be slow instead of looking at it from the SQL side.  I quickly ran across this post:  <a href="http://everydaynerd.com/microsoft/windows-7-slow-remote-desktop-rdp-fix">http://everydaynerd.com/microsoft/windows-7-slow-remote-desktop-rdp-fix</a> and tried it.  The results were immediate. </p>
<p>The solution (at least for me) was to disable TCP Autotuning.  To do this go to command prompt with as the administrator.</p>
<p>Click on Start -&gt; All Programs -&gt;Accessories</p>
<p>Right Click Command Promt</p>
<p>Click Run As Administrator</p>
<p>Type <strong>netsh interface tcp set global autotuninglevel = disabled</strong></p>
<p>You should receive and <strong>Ok.</strong> message</p>
<p>To verify that the change was successful type <strong>netsh interface tcp show global</strong></p>
<p>You should see that Redceive Window Atuo-Tuning Level is disabled.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.applicationgroup.com/blog/?feed=rss2&amp;p=31</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sorting Lists in c#</title>
		<link>http://www.applicationgroup.com/blog/?p=21</link>
		<comments>http://www.applicationgroup.com/blog/?p=21#comments</comments>
		<pubDate>Thu, 21 Oct 2010 14:34:21 +0000</pubDate>
		<dc:creator>Neal</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.applicationgroup.com/blog/?p=21</guid>
		<description><![CDATA[Here is a simple bit of code to sort lists in c# when the list is for a class with multiple properties.  The List object atcually has sorting built into it and if you are using List&#60;string&#62; or List&#60;int&#62; this will work great for you.  Just load up your list and use code like myList.Sort().  [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a simple bit of code to sort lists in c# when the list is for a class with multiple properties.  The List object atcually has sorting built into it and if you are using List&lt;string&gt; or List&lt;int&gt; this will work great for you.  Just load up your list and use code like myList.Sort().  For example:</p>
<blockquote><p> List&lt;string&gt; myList = new List&lt;string&gt;();<br />
myList.Add(&#8220;C&#8221;);<br />
myList.Add(&#8220;B&#8221;);<br />
myList.Add(&#8220;Z&#8221;);<br />
myList.Add(&#8220;A&#8221;);<br />
myList.Sort();<br />
foreach (string str in myList)<br />
{<br />
    Console.WriteLine(str);<br />
}</p></blockquote>
<p> The above code will output the letters in alphabetical order.  But what if your list is for a custom class rather than for a standard data type.  Then we have to use some of the more advanced features of the List.Sort Method.  So lets say we have a class, in this case called ContactInfo, which has seveal properties to hold information about contacts. </p>
<blockquote><p>class ContactInfo<br />
{<br />
    public string LastName{ get; set; }<br />
    public string FirstName { get; set; }<br />
    public string MiddleInitial { get; set; }<br />
    public string Phone { get; set; }<br />
    public string EMail { get; set; }<br />
} </p></blockquote>
<p>Now we create a list so that we can work with several contacts.</p>
<blockquote><p>List&lt;ContactInfo&gt; ContactList = new List&lt;ContactInfo&gt;();</p></blockquote>
<p> Now we add information to the List.  This would generally be done with a database call rather than hand coded information of course.</p>
<blockquote><p>ContactInfo ci = new ContactInfo();<br />
    ci.FirstName = &#8220;John&#8221;;<br />
    ci.LastName = &#8220;Doe&#8221;;<br />
    ci.MiddleInitial = &#8220;C&#8221;;<br />
    ci.Phone = &#8220;555-1212&#8243;;<br />
    ci.EMail = &#8220;John.Doe@SomeDomain.com&#8221;;<br />
    ContactList.Add(ci);<br />
    ci = new ContactInfo();<br />
    ci.LastName = &#8220;Smith&#8221;;<br />
    ci.FirstName = &#8220;Jane&#8221;;<br />
    ci.MiddleInitial = &#8220;F&#8221;;<br />
    ci.Phone = &#8220;111-2222&#8243;;<br />
    ci.EMail = &#8220;jsmith@anotherdomain.com&#8221;;<br />
    ContactList.Add(ci);<br />
  // &#8230; Add as many contacts as you like</p></blockquote>
<p>So now to the sorting:</p>
<blockquote><p>// Sort By Last name<br />
ContactList.Sort(delegate(ContactInfo c1, ContactInfo c2) { return c1.LastName.CompareTo(c2.LastName); });</p>
<p>// Sort by Phone Number<br />
ContactList.Sort(delegate(ContactInfo c1, ContactInfo c2) { return c1.Phone.CompareTo(c2.Phone); });</p></blockquote>
<p>You can obviously use this method for any parameter of the custom class the list is based on.  This allows you to use your list in a listbox or other container and sort the data as you choose on the fly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.applicationgroup.com/blog/?feed=rss2&amp;p=21</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maintaining Form Position when closing and reopening in a multi-monitor environment</title>
		<link>http://www.applicationgroup.com/blog/?p=9</link>
		<comments>http://www.applicationgroup.com/blog/?p=9#comments</comments>
		<pubDate>Fri, 17 Oct 2008 22:15:27 +0000</pubDate>
		<dc:creator>Neal</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.applicationgroup.com/blog/?p=9</guid>
		<description><![CDATA[I&#8217;ve been working on a small application recently and decided to include in the ability for the application to remember its position when closed and then when reloaded to appear is the same position.  I&#8217;ve run into a few problems with programs that do this is the past.  Specifically when resolution is changed or monitor [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a small application recently and decided to include in the ability for the application to remember its position when closed and then when reloaded to appear is the same position.  I&#8217;ve run into a few problems with programs that do this is the past.  Specifically when resolution is changed or monitor configuration is changed.  For example my laptop may be connected to a secondary monitor at work, but not at home.  If I am running the application on the secondary monitor and close it, then when I&#8217;m at home and try to start the application it appears off the screen and I have to right click the task bar for the app, choose move, and then use my arrow keys to move it to a visible location.</p>
<p>I decided that I didn&#8217;t want my application to have this problem, but I still wanted to be able to save the position.  I searched the Internet for anything that would work and found many ways to save the position, but none of them seemed to take multiple monitors into account or more precisely an inconsistent monitor setup).  So after many tries I finally came up with a method that worked.  In this method I am storing the position in an INI file, but it could be stored in the registry or an XML file as easily.</p>
<p>I easily found code that would allow me to specify which screen to start on, but using that code, the coordinate reference assumes that 0,0 is the top left of the specified monitor.  When getting the coordinates of the form I could find nothing that would give me the coordinates based on the monitor in use.  Every method I found gave coordinates based on 0,0 being the top left of the primary monitor.  So if I positioned the form in the middle of my left monitor and exited I would store an X position of -600 (600 pixels to the left of the primary monitor), but when loading the form I need to tell it to move 424 pixes to the right from its origin on the secondary monitor.  All very confusing.</p>
<p>The key was to determine the bounds of the monitor used.  This uses the same coordinates referenced in the forms location so a 1024&#215;768 monitor to the left of the primary monitor (also 1024&#215;768) would have it&#8217;s upper left corner be -1024,0.  We can subtract the Bounds coordinates from the saved coordinates to find the coordinates relative to the top left corner of the monitor used.  I also check to verify that the position stored is within the bounds of the selected monitor, and if not display the form in the upper left corner of the selected monitor.  This way the form is never displayed in a position where it can not be seen.</p>
<p>Another problem with the code I found for specifying which screen to start on was that it did not verify the existence of that screen before trying to change to it.  So if a monitor was disconnected you would end up with an error.  Storing the selected monitor wound up being a bit more of a challenge than expected.  The property Screen.DisplayName pads the end of the string with a number of hidden characters.  Trimming off the extra characters solved my problems with this section, but it was annoying to track down.</p>
<p>I hope this helps anyone else who might be trying to achieve the same effect.</p>
<p style="PADDING-LEFT: 30px"><strong>The following code goes in the Form_Load procedure<br />
</strong><span style="font-size: x-small; color: #008000;"><span style="font-size: x-small; color: #008000;">&#8216; Multi Monitor Aware &#8211; Restore Postition to last Used<br />
</span></span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Dim</span></span><span style="font-size: x-small;"> posScreen </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">As</span></span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Integer<br />
</span></span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Dim</span></span><span style="font-size: x-small;"> posX </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">As</span></span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Integer<br />
</span></span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Dim</span></span><span style="font-size: x-small;"> posY </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">As</span></span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Integer<br />
Dim <span style="color: #000000;">screen <span style="color: #0000ff;">As</span><span style="font-size: x-small;"> Screen</span></span><br />
</span></span><span style="font-size: x-small; color: #008000;"><span style="font-size: x-small; color: #008000;">&#8216; Read the previous screen used from the INI file<br />
</span></span><span style="font-size: x-small;">posScreen = Val(ReadIni(File, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;Main&#8221;</span></span><span style="font-size: x-small;">, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;PosScreen&#8221;</span></span><span style="font-size: x-small;">))<br />
screen = screen.AllScreens(0)<br />
</span><span style="font-size: x-small; color: #008000;"><span style="font-size: x-small; color: #008000;">&#8216; Verify the Specified screen exists, if so then use it<br />
</span></span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">If</span></span><span style="font-size: x-small;"> screen.AllScreens.Length &gt; posScreen + 1 </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Then<br />
</span></span><span style="font-size: x-small;"> screen = screen.AllScreens(0)<br />
</span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Else<br />
</span></span><span style="font-size: x-small;"> screen = screen.AllScreens(posScreen)<br />
</span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">End</span></span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">If<br />
<span style="color: #008000;">&#8216; Read the Position from the INI File<br />
</span></span></span><span style="font-size: x-small;">posX = Val(ReadIni(File, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;Main&#8221;</span></span><span style="font-size: x-small;">, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;PosX&#8221;</span></span><span style="font-size: x-small;">))<br />
posY = Val(ReadIni(File, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;Main&#8221;</span></span><span style="font-size: x-small;">, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;PosY&#8221;</span></span><span style="font-size: x-small;">))<br />
</span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Dim</span></span><span style="font-size: x-small;"> pt </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">As</span></span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">New</span></span><span style="font-size: x-small;"> Point(posX, posY)<br />
</span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">If</span></span><span style="font-size: x-small;"> screen.Bounds().Contains(pt) </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Then<br />
</span></span><span style="font-size: x-small;">pt.X = posX &#8211; screen.Bounds().X<br />
pt.Y = posY &#8211; screen.Bounds().Y<br />
</span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Else<br />
</span></span><span style="font-size: x-small;">pt.X = 0<br />
pt.Y = 0<br />
</span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">End</span></span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">If<br />
</span></span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Me</span></span><span style="font-size: x-small;">.StartPosition = FormStartPosition.Manual<br />
</span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Me</span></span><span style="font-size: x-small;">.Location = screen.Bounds.Location + pt</span></p>
<p style="PADDING-LEFT: 30px"><span style="font-size: x-small;"><strong>The following code goes in the Form_FormClosing procedure<br />
</strong><span style="font-size: x-small; color: #008000;"><span style="font-size: x-small; color: #008000;">&#8216; Save Screen Position<br />
</span></span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">For</span></span><span style="font-size: x-small;"> i </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">As</span></span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Integer</span></span><span style="font-size: x-small;"> = 0 </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">To<br />
</span></span><span style="font-size: x-small;"> screen.AllScreens().Length &#8211; 1<br />
</span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;"> If</span></span><span style="font-size: x-small;"> stringtoasc(screen.AllScreens(i).DeviceName.ToString) _<br />
= stringtoasc(screen.FromControl(</span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Me</span></span><span style="font-size: x-small;">).DeviceName.ToString) </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Then<br />
</span></span><span style="font-size: x-small;"> WriteIni(File, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;Main&#8221;</span></span><span style="font-size: x-small;">, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;PosScreen&#8221;</span></span><span style="font-size: x-small;">, i)<br />
</span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;"> End</span></span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">If<br />
</span></span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Next<br />
</span></span><span style="font-size: x-small;">WriteIni(File, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;Main&#8221;</span></span><span style="font-size: x-small;">, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;PosX&#8221;</span></span><span style="font-size: x-small;">, </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Me</span></span><span style="font-size: x-small;">.Location.X)<br />
WriteIni(File, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;Main&#8221;</span></span><span style="font-size: x-small;">, </span><span style="font-size: x-small; color: #a31515;"><span style="font-size: x-small; color: #a31515;">&#8220;PosY&#8221;</span></span><span style="font-size: x-small;">, </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">Me</span></span><span style="font-size: x-small;">.Location.Y)<br />
</span></span></p>
<p><span style="font-size: x-small;"><span style="font-size: x-small;">*Note the ReadINI and WriteINI functions are in a module not shown here.  As they are not really a major part of the issue with positioning the form.  If anyone would like to see the related code I will be happy to post it, however there are several variations available by searching the Internet.</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.applicationgroup.com/blog/?feed=rss2&amp;p=9</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Copy a large number of small files</title>
		<link>http://www.applicationgroup.com/blog/?p=3</link>
		<comments>http://www.applicationgroup.com/blog/?p=3#comments</comments>
		<pubDate>Fri, 29 Aug 2008 16:01:06 +0000</pubDate>
		<dc:creator>Neal</dc:creator>
				<category><![CDATA[General Info]]></category>

		<guid isPermaLink="false">http://www.applicationgroup.com/blog/?p=3</guid>
		<description><![CDATA[I&#8217;ve recently come up with the need to copy a huge number of small files from one system to another.  Basically we are backing up about 20 million files that total a little under 10 terabytes.  So how is the best way to do this?  I first tried just setting up an extra gigabit ethernet [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently come up with the need to copy a huge number of small files from one system to another.  Basically we are backing up about 20 million files that total a little under 10 terabytes.  So how is the best way to do this?  I first tried just setting up an extra gigabit ethernet adapted in each server and using a cross-over cable started copying with Microsoft&#8217;s Robocopy program.  If you&#8217;re not familiar with this it is available in the Windows 2003 resource kit and is a bit like xcopy with a lot more features.  My problem is that it just seemed to be going very slowly, taking about 2.5 days to copy 1 terabyte.  Perhaps that is as fast as it should be, I don&#8217;t know, but it was sure slower than I expected. </p>
<p>I suppose I should explain the hardware involved to give the full picture.  The older server is a Pentium 4 server running Windows 2003.  The system has an external drive array with 16 drives.  The external drive system is configured as 4 RAID 5&#8217;s each about 1.5 TB.  This array is connected to the server via a SCSI adapter. </p>
<p>The new server is a Xeon Quad Core also running Windows 2003 and has 24 driver bays internal to the server chasis.  The drives in the new server are configures with the first 16 drives as a RAID 60 (two 8 drive raid 6&#8217;s striped together for better performance) this provides about 11.2 TB, a 6 drive RAID 5 (4.5 TB) and 2 drives in a RAID 1 for the O/S.  The reason for the odd splitting is that I used two RAID controllers to connect all of the drives, a 16 port and an 8 port.  All of the drives in both systems are SATA II.</p>
<p>I decided to take the network cards out of the loop assuming that this was where my bottleneck was, although I never saw network utilization on the cards in question going above 10%.  I moved the SCSI card from the old server to the new and attached the external drive array to the new server.  This I assumed would give me a much faster transfer.  Unfortunately this has not been the case.  After 20 hours of copying only 650 GB have transferred to the new system. </p>
<p>I&#8217;ve started testing some utilities that claim to improve copy speed (teracopy, fastcopy, totalcopy) and will post the results of the results of these tests here.  In the mean time it&#8217;s slow going.  Comments or suggestions?</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Update:</p>
<p>Well I tried a few of the copy programs I mentioned above.  I finally wound up using FastCopy.  There is one confusing part in that program depeding on if you include a trailing \ or not will affect what is copied, but this is documented as a feature, not a bug and overall the program did an excellent job.  One very nice feature of it is to queue copy jobs so that they will start one after the other.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.applicationgroup.com/blog/?feed=rss2&amp;p=3</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

