<feed xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
    <title>David Douglass</title>
    <link rel="self" type="application/xml" href="http://geekswithblogs.net/.NETonMyMind/Atom.aspx" />
    <subtitle type="html">.NET on My Mind</subtitle>
    <id>http://geekswithblogs.net/.NETonMyMind/Default.aspx</id>
    <author>
        <name>David Douglass</name>
        <uri>http://geekswithblogs.net/.NETonMyMind/Default.aspx</uri>
    </author>
    <generator uri="http://subtextproject.com" version="Subtext Version 0.0.0.0">Subtext</generator>
    <updated>2010-07-06T06:38:43Z</updated>
    <entry>
        <title>Windows Daily Reset</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/.NETonMyMind/archive/2010/07/04/140759.aspx" />
        <id>http://geekswithblogs.net/.NETonMyMind/archive/2010/07/04/140759.aspx</id>
        <published>2010-07-04T12:35:13-04:00:00</published>
        <updated>2010-07-06T06:38:43Z</updated>
        <content type="html">&lt;p&gt;What I’ve seen in most corporate environments is that PCs are up all the time; at the end of the day people either just log off or lock the machine.  You can take advantage of this to reset Windows every night for best performance the next day.  I’ve found three things make for a useful reset:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;defragmenting the hard drives &lt;/li&gt;    &lt;li&gt;booting the machine &lt;/li&gt;    &lt;li&gt;defragmenting the system files that are skipped in step 1 &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;This can be done by modifying the ScheduledDefrag task that comes with later versions of Windows or creating such as task in XP and 2003.  In Vista, you’ll find Microsoft’s task in the Scheduled Tasks snap-in at Task Scheduler Library –&amp;gt; Microsoft –&amp;gt; Windows –&amp;gt; Defrag –&amp;gt; ScheduledDefrag.  The first step is to change it to a daily schedule and make sure it’s enabled:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_thumb.png" width="598" height="517" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Next, the action Microsoft supplies should be changed.  Microsoft’s action is &lt;font size="2" face="Courier New"&gt;"%windir%\system32\defrag.exe –c –i"&lt;/font&gt; (Vista).  -c is for all drives, but what is –i?  It’s undocumented but defrag is happy to accept it.  In testing, it seemed to cause defrag to run much slower, and my guess it’s i for idle, in other words, run only when the machine is idle.  So, I’d like to change the action to &lt;font size="2" face="Courier New"&gt;"%windir%\system32\defrag.exe –c –v &amp;gt; c:\Logs\defrag.log 2&amp;gt;&amp;amp;1"&lt;/font&gt;, but that doesn’t work because the scheduler calls CreateProcess, which doesn’t interpret the redirection request.  If you run the command using the shell the redirection will work.  In that case &lt;em&gt;Program/script&lt;/em&gt; is set to &lt;font size="2" face="Courier New"&gt;CMD&lt;/font&gt; &lt;em&gt;Add arguments (optional)&lt;/em&gt; is set to &lt;font size="2" face="Courier New"&gt;"/c %windir%\system32\defrag.exe g: -v &amp;gt; c:\Logs\defrag.log 2&amp;gt;&amp;amp;1"&lt;/font&gt; (without the quotes).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_thumb_5.png" width="496" height="533" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;While this works, it’s not my preferred  solution since all actions will require this clumsy setup with &lt;font face="Courier New"&gt;CMD.&lt;/font&gt;  Instead, write a DOS script with all the work, in which case redirection works as it should:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_thumb_6.png" width="502" height="540" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We’ll take a look at the DOS script after a couple of more adjustment to Microsoft’s task.  Waiting for the machine to go idle is unnecessary, so remove that:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_thumb_3.png" width="608" height="457" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Having the task run as soon as possible if the scheduled time is missed is unnecessary and causes it to run on boot or after resuming from hibernation.  Clear &lt;em&gt;Run task as soon as possible after a scheduled start is missed&lt;/em&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_9.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_thumb_1.png" width="611" height="459" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The script simply does the defrag and a reboot:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;date /t      &lt;br /&gt;time /t       &lt;br /&gt;%windir%\system32\defrag.exe -c -v       &lt;br /&gt;date /t       &lt;br /&gt;time /t       &lt;br /&gt;shutdown /r /d P:4:1 /t 300 /c "daily automated reboot"&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The shutdown command says to restart the machine (/r), that this is a planned shutdown (/d P:4:1), to wait 300 seconds before performing the shutdown (/t 300), and to enter a comment in the event log (/c “daily automated reboot”).  If you happen to be logged in when this runs, you be informed that a shutdown is about to take place.  At that point you have 300 seconds to abort the shutdown by running the DOS command &lt;font size="2" face="Courier New"&gt;shutdown –a&lt;/font&gt;.&lt;/p&gt;  &lt;p&gt;The steps above cover defragging the drives and rebooting the machine, but some files won’t be defragged because Windows is using them when defrag runs.  To defrag those, you need to defragment as part of the boot process.  For 32 bit systems, I recommend &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb897426.aspx" target="_blank"&gt;Sysinternals PageDefrag&lt;/a&gt;.  Download the program, run it, and make sure &lt;em&gt;Defragment every boot&lt;/em&gt; is selected:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_thumb_7.png" width="557" height="447" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Unfortunately, PageDefrag doesn’t work on 64 bit systems.  In that case I recommend &lt;a href="http://ultradefrag.sourceforge.net/" target="_blank"&gt;UltraDefrag&lt;/a&gt;.  UltraDefrag is a general purpose defragmenter (like Microsoft’s defrag) and also does boot time defragmentation (on 32 or 64 bit systems).  After downloading UltraDefrag, run the GUI console, call up the settings, and check &lt;em&gt;Enable:&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_18.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/.NETonMyMind/WindowsLiveWriter/WindowsDailyReset_7E64/image_thumb_8.png" width="482" height="235" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The script that ships with UltraDefrag assumes that your operating system is on the C drive; if not, press the script button and change the drive.  See &lt;a href="http://ultradefrag.sourceforge.net/handbook/Boot.html" target="_blank"&gt;http://ultradefrag.sourceforge.net/handbook/Boot.html&lt;/a&gt; for more information&lt;/p&gt;  &lt;p&gt;Speaking of UltraDefrag, you may want to consider using it in place of Microsoft’s defrag.  The net is full of talk that defrag isn’t very good at what it does and that UltraDefrag and &lt;a href="http://www.mydefrag.com/" target="_blank"&gt;MyDefrag&lt;/a&gt; are better choices.&lt;/p&gt;&lt;img src="http://geekswithblogs.net/.NETonMyMind/aggbug/140759.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/.NETonMyMind/comments/140759.aspx</wfw:comment>
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/.NETonMyMind/comments/commentRss/140759.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/.NETonMyMind/services/trackbacks/140759.aspx</trackback:ping>
    </entry>
    <entry>
        <title>The Easy Way to Run a DOS Batch Script</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/.NETonMyMind/archive/2010/07/03/140752.aspx" />
        <id>http://geekswithblogs.net/.NETonMyMind/archive/2010/07/03/140752.aspx</id>
        <published>2010-07-03T18:14:01-04:00:00</published>
        <updated>2010-07-03T18:14:01Z</updated>
        <content type="html">&lt;p&gt;You can run a DOS batch script from Windows explorer by double clicking on it, but the output scrolls by and then the window disappears.  What if you need to see the output?  The best thing to do is create a shortcut to the script that captures the output.  For example, given a script test.bat in C:\Program Files\Test, the target of the shortcut should be:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;"C:\Program Files\Test\test.bat" &amp;gt; test.txt 2&amp;gt;&amp;amp;1 &amp;amp; test.txt&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Trebuchet MS"&gt;The &lt;font face="Courier New"&gt;"&amp;gt; test.txt"&lt;/font&gt; sends the output to a file; the &lt;font size="2" face="Courier New"&gt;"2&amp;gt;&amp;amp;1"&lt;/font&gt; sends any error messages to wherever the non errors messages are going (test.txt in our case); and the &lt;font size="2" face="Courier New"&gt;"&amp;amp; test.txt"&lt;/font&gt; launches test.txt as a command once the DOS script completes.  The net effect is that you can double click on the shortcut, the DOS script will run, and the output will be displayed using Notepad or whatever .txt is mapped to.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;A variation on this is to use || (2 pipe bars) in place of the last ampersand, in which case the output file is launched only if the script returns an error code.&lt;/p&gt;&lt;img src="http://geekswithblogs.net/.NETonMyMind/aggbug/140752.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/.NETonMyMind/comments/140752.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/.NETonMyMind/comments/commentRss/140752.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/.NETonMyMind/services/trackbacks/140752.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Not Playing Nice Together</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/.NETonMyMind/archive/2010/03/14/138510.aspx" />
        <id>http://geekswithblogs.net/.NETonMyMind/archive/2010/03/14/138510.aspx</id>
        <published>2010-03-14T14:10:24-04:00:00</published>
        <updated>2010-03-14T14:10:24Z</updated>
        <content type="html">&lt;p&gt;One of the things I’ve noticed is that two industry trends are not playing nice together, those trends being multi-core CPUs and massive hard drives.  It’s not a problem if you keep your cores busy with compute intensive work, but for software developers the beauty of multi-core CPUs (along with gobs of RAM and a 64 bit OS) is virtualization.  But when you have only one hard drive (who needs another when it holds 2 TB of data?) you wind up with a serious hard drive bottleneck.  A solid state drive would definitely help, and might even be a complete solution, but the cost is ridiculous.  Two TB of solid state storage will set you back around $7,000!  A spinning 2 TB drive is only $150.&lt;/p&gt;  &lt;p&gt;I see a couple of solutions for this.  One is the mainframe concept of near and far storage: put the stuff that will be heavily access on a solid state drive and the rest on a spinning drive.  Another solution is multiple spinning drives.  Instead of a single 2 TB drive, get four 500 GB drives.  In total, the four 500 GB drives will cost about $100 more than the single 2 TB drive.  You’ll need to be smart about what drive you place things on so that the load is spread evenly.  Another option, for better performance, would be four 10,000 RPM 300 GB drives, but that would cost about $800 more than the singe 2 TB drive and would deliver only 1.2 TB of space.&lt;/p&gt;  &lt;p&gt;All pricing based on &lt;a href="http://www.microcenter.com/index.html" target="_blank"&gt;Microcenter&lt;/a&gt; as of March 14, 2010.&lt;/p&gt;&lt;img src="http://geekswithblogs.net/.NETonMyMind/aggbug/138510.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/.NETonMyMind/comments/138510.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/.NETonMyMind/comments/commentRss/138510.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/.NETonMyMind/services/trackbacks/138510.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Be Prepared</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/.NETonMyMind/archive/2010/02/25/138188.aspx" />
        <id>http://geekswithblogs.net/.NETonMyMind/archive/2010/02/25/138188.aspx</id>
        <published>2010-02-25T20:32:42-05:00:00</published>
        <updated>2010-02-25T20:32:42Z</updated>
        <content type="html">&lt;p&gt;&lt;img src="http://www.normanrockwellvt.com/BoyScouts/b039.gif" /&gt;&lt;/p&gt;  &lt;p&gt;Your machine is dead.  Now what?  I keep these bootable CDs on hand, just in case:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="http://www.grc.com/spinrite.htm" target="_blank"&gt;SpinRite&lt;/a&gt;.  This program has saved me several times.  Fixes unusable disks that cause systems to hang.  Worth $90 the first time you use it.  &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.ubcd4win.com/" target="_blank"&gt;Ultimate Boot CD for Windows&lt;/a&gt;.  This will allow you to boot a dead system from a CD and copy all the important stuff to an external hard drive (plug the hard drive in before booting).  There are also a lot of system utilities on the CD to help with repair.  Free but requires a Windows XP license.&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.microsoft.com/windows/enterprise/products/mdop/dart.aspx" target="_blank"&gt;Microsoft Diagnostics and Recovery Toolset&lt;/a&gt; is similar in concept to Ultimate Boot CD for Windows but is from Microsoft.  Unfortunately, Microsoft restricts distribution to customers who have purchased &lt;a href="http://www.microsoft.com/licensing/software-assurance/default.aspx" target="_blank"&gt;Software Assurance&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.acronis.com/homecomputing/products/trueimage/" target="_blank"&gt;Acronis True Image Home&lt;/a&gt; boot disk.  Boot from CD and backup to external hard drive.  Program also performs regular backups from Windows.  $50 list.&lt;/li&gt;    &lt;li&gt;Memory testers.  These exercise the system’s memory and report on any problems found.  All free.  &lt;a href="http://www.memtest86.com/" target="_blank"&gt;Memtest86&lt;/a&gt;, &lt;a href="http://www.memtest.org/" target="_blank"&gt;memtest86+&lt;/a&gt;, &lt;a href="http://technet.microsoft.com/en-us/magazine/2008.09.utilityspotlight.aspx" target="_blank"&gt;Windows Memory Diagnostic&lt;/a&gt;.&lt;/li&gt; &lt;/ol&gt;&lt;img src="http://geekswithblogs.net/.NETonMyMind/aggbug/138188.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/.NETonMyMind/comments/138188.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/.NETonMyMind/comments/commentRss/138188.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/.NETonMyMind/services/trackbacks/138188.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Round &amp;amp; Round with Enums</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/.NETonMyMind/archive/2010/02/25/138184.aspx" />
        <id>http://geekswithblogs.net/.NETonMyMind/archive/2010/02/25/138184.aspx</id>
        <published>2010-02-25T19:02:10-05:00:00</published>
        <updated>2010-02-25T19:02:10Z</updated>
        <content type="html">&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/sbbt4032(VS.100).aspx" target="_blank"&gt;Enumerated constants in C#&lt;/a&gt; can be represented 3 different ways:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;as a C# program constant&lt;/li&gt;    &lt;li&gt;as a number (typically int)&lt;/li&gt;    &lt;li&gt;as a string spelled identically to the C# constant&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Here a sample program demonstrating how to convert between any of these formats.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:13e8d7a7-f7ab-4352-b4b4-2fb66c6b9632" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000FF;"&gt;using&lt;/span&gt;&lt;span style="color: #000000;"&gt; System;
&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;using&lt;/span&gt;&lt;span style="color: #000000;"&gt; System.Collections.Generic;
&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;using&lt;/span&gt;&lt;span style="color: #000000;"&gt; System.Text;

&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;namespace&lt;/span&gt;&lt;span style="color: #000000;"&gt; ConsoleApplication2 {
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;enum&lt;/span&gt;&lt;span style="color: #000000;"&gt; Color {
        red,
        white,
        blue
    }

    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;class&lt;/span&gt;&lt;span style="color: #000000;"&gt; Program {
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;static&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;void&lt;/span&gt;&lt;span style="color: #000000;"&gt; Main(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;string&lt;/span&gt;&lt;span style="color: #000000;"&gt;[] args) {
            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;string&lt;/span&gt;&lt;span style="color: #000000;"&gt; toString, fromString &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;red&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;;
            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; toInt, fromInt &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800080;"&gt;1&lt;/span&gt;&lt;span style="color: #000000;"&gt;;
            Color toColor, fromColor &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; Color.blue;

            &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt;    string to enum&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #000000;"&gt;            toColor &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; (Color) Enum.Parse(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;typeof&lt;/span&gt;&lt;span style="color: #000000;"&gt;(Color), fromString);

            &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt;    string to int&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #000000;"&gt;            toInt &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; (&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt;) (Color) Enum.Parse(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;typeof&lt;/span&gt;&lt;span style="color: #000000;"&gt;(Color), fromString);

            &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt;    int to enum&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #000000;"&gt;            toColor &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; (Color) fromInt;

            &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt;    int to string&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #000000;"&gt;            toString &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; ((Color) fromInt).ToString();

            &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt;    enum to string&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #000000;"&gt;            toString &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; fromColor.ToString();

            &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt;    enum to int&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #000000;"&gt;            toInt &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; (&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt;) fromColor;

            Console.ReadLine();
        }
    }
}
&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;&lt;img src="http://geekswithblogs.net/.NETonMyMind/aggbug/138184.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/.NETonMyMind/comments/138184.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/.NETonMyMind/comments/commentRss/138184.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/.NETonMyMind/services/trackbacks/138184.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Dropbox Does it Right</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/.NETonMyMind/archive/2010/02/25/138182.aspx" />
        <id>http://geekswithblogs.net/.NETonMyMind/archive/2010/02/25/138182.aspx</id>
        <published>2010-02-25T18:27:35-05:00:00</published>
        <updated>2010-02-25T18:27:35Z</updated>
        <content type="html">&lt;p&gt;I sent my kid off to college this fall and it didn’t require a soothsayer to know that she wouldn’t do any backups and at the end of the semester her hard drive would crap out.  After an emergency repair with the magnificent &lt;a href="http://www.grc.com/sroverview.htm" target="_blank"&gt;SpinRite&lt;/a&gt;, I started looking into personal cloud based backups.  &lt;a href="http://www.dropbox.com/" target="_blank"&gt;Dropbox&lt;/a&gt; was the only solution that did it all just right.  After installing Dropbox you designate a folder to watch (your dropbox).  Then just do your work, saving it in your dropbox.  Every time a changed file is closed it gets backed up to the cloud.  Nice touches include an file icon overlay to indicate backup status and a tray icon that shows overall backup status.  Need your stuff?  Go to the Dropbox web site and download it or use another computer with Dropbox installed.  You can get 2 gigabytes of space for free.  What’s not to like?&lt;/p&gt;&lt;img src="http://geekswithblogs.net/.NETonMyMind/aggbug/138182.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/.NETonMyMind/comments/138182.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/.NETonMyMind/comments/commentRss/138182.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/.NETonMyMind/services/trackbacks/138182.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Speaking at the Fairfield / Westchester Code Camp</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/.NETonMyMind/archive/2009/11/03/135982.aspx" />
        <id>http://geekswithblogs.net/.NETonMyMind/archive/2009/11/03/135982.aspx</id>
        <published>2009-11-03T21:08:27-05:00:00</published>
        <updated>2009-11-03T21:08:27Z</updated>
        <content type="html">&lt;p&gt;This Saturday, November 7, the &lt;a href="http://www.fairfieldwestchester.net/" target="_blank"&gt;Fairfield / Westchester .NET User Group&lt;/a&gt; is hosting the 3rd annual &lt;a href="http://fairfieldwestchester.net/Code-Camp.aspx" target="_blank"&gt;Fairfield / Westchester Code Camp&lt;/a&gt; at the &lt;a href="http://citi.uconn.edu/citi_home.asp" target="_blank"&gt;Connecticut Information Technology Institute&lt;/a&gt; in &lt;a href="http://citi.uconn.edu/content_pages/about_travel_new.asp" target="_blank"&gt;Stamford, CT&lt;/a&gt;.  I’ll be speaking on New Debugging Features in Visual Studio 2010.  Hope to see you there!&lt;/p&gt;&lt;img src="http://geekswithblogs.net/.NETonMyMind/aggbug/135982.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/.NETonMyMind/comments/135982.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/.NETonMyMind/comments/commentRss/135982.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/.NETonMyMind/services/trackbacks/135982.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Fixing Your Windows Explorer Shortcut</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/.NETonMyMind/archive/2009/03/01/129759.aspx" />
        <id>http://geekswithblogs.net/.NETonMyMind/archive/2009/03/01/129759.aspx</id>
        <published>2009-03-01T12:24:12-05:00:00</published>
        <updated>2009-03-02T19:23:39Z</updated>
        <content type="html">&lt;p&gt;I’m sure you’ve noticed that Windows Explorer thinks that everything you care about is in My Documents.  If you’re like me that isn’t true; important stuff is in the C drive, network shares, external storage, etc.  Wouldn’t it be nice if Windows Explorer opened showing all the devices on the computer?  Change your Windows Explorer shortcut as below and it will.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" size="2"&gt;%SystemRoot%\explorer.exe /e,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}&lt;/font&gt;&lt;/p&gt;&lt;img src="http://geekswithblogs.net/.NETonMyMind/aggbug/129759.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/.NETonMyMind/comments/129759.aspx</wfw:comment>
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/.NETonMyMind/comments/commentRss/129759.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/.NETonMyMind/services/trackbacks/129759.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Microsoft Should Just Give Up on Search</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/.NETonMyMind/archive/2009/03/01/129758.aspx" />
        <id>http://geekswithblogs.net/.NETonMyMind/archive/2009/03/01/129758.aspx</id>
        <published>2009-03-01T11:20:42-05:00:00</published>
        <updated>2009-03-01T11:20:42Z</updated>
        <content type="html">&lt;p&gt;So I’m doing a little coding using reflection and the following exception is raised:&lt;/p&gt;  &lt;p&gt;It is illegal to reflect on the custom attributes of a Type loaded via ReflectionOnlyGetType (see Assembly.ReflectionOnly) -- use CustomAttributeData instead.&lt;/p&gt;  &lt;p&gt;I don’t get it so I pump the error message into Microsoft’s Live Search.  Live Search comes back with:&lt;/p&gt;  &lt;p&gt;We did not find any results for &lt;strong&gt;It is illegal to reflect on the custom attributes of a Type loaded via ReflectionOnlyGetType (see Assembly.ReflectionOnly) -- use CustomAttributeData instead.&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Not believing this for even 1 nanosecond, I run the same query using Google.  Google’s first hit points me to &lt;a href="http://blogs.msdn.com/kaevans/archive/2005/10/24/484186.aspx" target="_blank"&gt;Kirk Evens’ MSDN blog&lt;/a&gt; where the exact messages appears in the entry!&lt;/p&gt;&lt;img src="http://geekswithblogs.net/.NETonMyMind/aggbug/129758.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/.NETonMyMind/comments/129758.aspx</wfw:comment>
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/.NETonMyMind/comments/commentRss/129758.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/.NETonMyMind/services/trackbacks/129758.aspx</trackback:ping>
    </entry>
    <entry>
        <title>I&amp;rsquo;m Speaking at Code Camp NYC</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/.NETonMyMind/archive/2009/01/07/128449.aspx" />
        <id>http://geekswithblogs.net/.NETonMyMind/archive/2009/01/07/128449.aspx</id>
        <published>2009-01-07T06:35:13-05:00:00</published>
        <updated>2009-01-07T06:35:46Z</updated>
        <content type="html">&lt;p&gt;I’m Speaking at Code Camp NYC (&lt;a href="http://nyc.codecamp.us/" target="_blank"&gt;http://nyc.codecamp.us/&lt;/a&gt;) this Saturday, January 10 on &lt;a href="http://cid-c3a729d382d8ce56.skydrive.live.com/self.aspx/Presentation%20Slide%20Decks/Virtualization%20for%20Developers.pptx" target="_blank"&gt;Virtualization for Developers&lt;/a&gt;.  You can register for the code camp at &lt;a href="https://www.clicktoattend.com/invitation.aspx?code=134146" target="_blank"&gt;https://www.clicktoattend.com/invitation.aspx?code=134146&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Hope to see you there!&lt;/p&gt;&lt;img src="http://geekswithblogs.net/.NETonMyMind/aggbug/128449.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/.NETonMyMind/comments/128449.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/.NETonMyMind/comments/commentRss/128449.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/.NETonMyMind/services/trackbacks/128449.aspx</trackback:ping>
    </entry>
</feed>
