<?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>John Plummer . com</title>
	<atom:link href="http://www.johnplummer.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.johnplummer.com</link>
	<description>Stuff I want to remember</description>
	<lastBuildDate>Wed, 27 Jan 2010 18:32:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple WCF Service Host</title>
		<link>http://www.johnplummer.com/code/simple-wcf-service-host.html</link>
		<comments>http://www.johnplummer.com/code/simple-wcf-service-host.html#comments</comments>
		<pubDate>Fri, 22 Jan 2010 18:52:35 +0000</pubDate>
		<dc:creator>John Plummer</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.johnplummer.com/uncategorized/simple-wcf-service-host.html</guid>
		<description><![CDATA[app.config
The configuration for a simple http WCF host is:
&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62;
&#60;configuration&#62;
  &#60;appSettings&#62;
  &#60;/appSettings&#62;

  &#60;system.serviceModel&#62;
    &#60;services&#62;
      &#60;service name=&#34;AssemblyNamespace.ServiceImplementation&#34;
               behaviorConfiguration=&#34;ServiceBehavior&#34;&#62;
        &#60;endpoint address=&#34;ServiceName&#34;
   [...]]]></description>
			<content:encoded><![CDATA[<h2>app.config</h2>
<p>The configuration for a simple http WCF host is:</p>
<pre class="brush: xml;">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;configuration&gt;
  &lt;appSettings&gt;
  &lt;/appSettings&gt;

  &lt;system.serviceModel&gt;
    &lt;services&gt;
      &lt;service name=&quot;AssemblyNamespace.ServiceImplementation&quot;
               behaviorConfiguration=&quot;ServiceBehavior&quot;&gt;
        &lt;endpoint address=&quot;ServiceName&quot;
                  binding=&quot;basicHttpBinding&quot;
                  contract=&quot;AssemblyNamespace.ServiceContractInterface&quot; /&gt;

        &lt;endpoint address=&quot;mex&quot;
                  binding=&quot;mexHttpBinding&quot;
                  contract=&quot;IMetadataExchange&quot; /&gt;

        &lt;host&gt;
          &lt;baseAddresses&gt;
            &lt;add baseAddress=&quot;http://HostName:Port/&quot;/&gt;
          &lt;/baseAddresses&gt;
        &lt;/host&gt;
      &lt;/service&gt;
    &lt;/services&gt;

    &lt;behaviors&gt;
      &lt;serviceBehaviors&gt;
        &lt;behavior name=&quot;ServiceBehavior&quot;&gt;
          &lt;serviceMetadata httpGetEnabled=&quot;true&quot;/&gt;
        &lt;/behavior&gt;
      &lt;/serviceBehaviors&gt;
    &lt;/behaviors&gt;

  &lt;/system.serviceModel&gt;
&lt;/configuration&gt;</pre>
<p><font face="Courier New"></font></p>
<p>An example:</p>
<pre class="brush: xml;">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;configuration&gt;
  &lt;appSettings&gt;
  &lt;/appSettings&gt;

  &lt;system.serviceModel&gt;
    &lt;services&gt;
      &lt;service name=&quot;TestService.CalculatorService&quot;
               behaviorConfiguration=&quot;CalculatorServiceBehavior&quot;&gt;
        &lt;endpoint address=&quot;CalculatorService&quot;
                  binding=&quot;basicHttpBinding&quot;
                  contract=&quot;TestService.ICalculator&quot; /&gt;

        &lt;endpoint address=&quot;mex&quot;
                  binding=&quot;mexHttpBinding&quot;
                  contract=&quot;IMetadataExchange&quot; /&gt;

        &lt;host&gt;
          &lt;baseAddresses&gt;
            &lt;add baseAddress=&quot;http://localhost:8000/&quot;/&gt;
          &lt;/baseAddresses&gt;
        &lt;/host&gt;
      &lt;/service&gt;
    &lt;/services&gt;

    &lt;behaviors&gt;
      &lt;serviceBehaviors&gt;
        &lt;behavior name=&quot;CalculatorServiceBehavior&quot;&gt;
          &lt;serviceMetadata httpGetEnabled=&quot;true&quot;/&gt;
        &lt;/behavior&gt;
      &lt;/serviceBehaviors&gt;
    &lt;/behaviors&gt;

  &lt;/system.serviceModel&gt;
&lt;/configuration&gt;</pre>
<h2>The Service</h2>
<p>Define the service in an interface</p>
<pre class="brush: csharp;">using System.ServiceModel;

namespace TestService
{
    [ServiceContract]
    public interface ICalculator
    {
        #region Instance Methods

        [OperationContract]
        double Add(double n1, double n2);

        [OperationContract]
        double Divide(double n1, double n2);

        [OperationContract]
        double Multiply(double n1, double n2);

        [OperationContract]
        double Subtract(double n1, double n2);

        #endregion
    }
}</pre>
<p>Then implement the interface</p>
<pre class="brush: csharp;">using System;

namespace TestService
{
    public class CalculatorService : ICalculator
    {
        #region ICalculator Members

        public double Add(double n1, double n2) {
            double result = n1 + n2;
            Console.WriteLine(&quot;Received Add({0},{1})&quot;, n1, n2);
            Console.WriteLine(&quot;Return: {0}&quot;, result);
            return result;
        }

        public double Divide(double n1, double n2) {
            double result = n1/n2;
            Console.WriteLine(&quot;Received Divide({0},{1})&quot;, n1, n2);
            Console.WriteLine(&quot;Return: {0}&quot;, result);
            return result;
        }

        public double Multiply(double n1, double n2) {
            double result = n1*n2;
            Console.WriteLine(&quot;Received Multiply({0},{1})&quot;, n1, n2);
            Console.WriteLine(&quot;Return: {0}&quot;, result);
            return result;
        }

        public double Subtract(double n1, double n2) {
            double result = n1 - n2;
            Console.WriteLine(&quot;Received Subtract({0},{1})&quot;, n1, n2);
            Console.WriteLine(&quot;Return: {0}&quot;, result);
            return result;
        }

        #endregion
    }
}</pre>
<h2>The Host</h2>
<p>Lastly create a host for the service</p>
<pre class="brush: csharp;">using System;
using System.ServiceModel;

namespace TestService
{
    internal class Program
    {
        #region Class Methods

        private static void Main() {
            using (ServiceHost serviceHost = new ServiceHost(typeof (CalculatorService))) {
                serviceHost.Open();

                Console.WriteLine(&quot;The calculator service is ready.&quot;);
                Console.WriteLine(&quot;Press &lt;ENTER&gt; to terminate service.&quot;);
                Console.WriteLine();
                Console.ReadLine();
            }
        }

        #endregion
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.johnplummer.com/code/simple-wcf-service-host.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Subversion on Windows</title>
		<link>http://www.johnplummer.com/tools/installing-subversion-on-windows.html</link>
		<comments>http://www.johnplummer.com/tools/installing-subversion-on-windows.html#comments</comments>
		<pubDate>Sun, 13 Jul 2008 19:50:10 +0000</pubDate>
		<dc:creator>John Plummer</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://www.johnplummer.com/vista/installing-subversion-on-windows.html</guid>
		<description><![CDATA[My requirements are to host the repository on a windows machine, mostly for access from the LAN but also to be accessible over the Internet. The server is running Vista but the install and set up process should be similar on other versions of windows.
Currently there are two relevant builds of Subversion, one based on [...]]]></description>
			<content:encoded><![CDATA[<p>My requirements are to host the repository on a windows machine, mostly for access from the LAN but also to be accessible over the Internet. The server is running Vista but the install and set up process should be similar on other versions of windows.</p>
<p>Currently there are two relevant builds of Subversion, one based on apache 2.0 and one based on 2.2. I am going to install Apache 2.2 and the corresponding Subversion build.</p>
<p><a href="http://www.johnplummer.com/vista/installing-apache-http-server-on-windows.html">Install the Apache HTTP server</a>.</p>
<p>Download and run the latest subversion build (currently svn-1.4.6-setup.exe) from <a href="http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100&amp;expandFolder=8100&amp;folderID=91">http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100&amp;expandFolder=8100&amp;folderID=91</a></p>
<p>Copy the file&nbsp;mod_dav_svn.so from C:\Program Files\Subversion\bin to C:\Program Files\Apache Software Foundation\Apache2.2\modules.</p>
<p>Open the Apache configuration file (&lsquo;Start &gt; All Programs &gt; Apache HTTP Server 2.2 &gt; Configure Apache Server &gt; Edit the Apache httpd.conf Configuration File&rsquo;) and find the line &lsquo;#LoadModule dav_module modules/mod_dav.so&rsquo;.</p>
<p>Remove the &lsquo;#&rsquo; from the front of that line then add the line &lsquo;LoadModule dav_svn_module modules/mod_dav_svn.so&rsquo; below it. Save the file and restart the service to confirm everything is working as it should.</p>
<p>Create the directory where you want to store the repositories (e.g. D:\Svn).</p>
<p>Go back to the Apache configuration file and at the end of the file add:</p>
<p>&lt;Location /Svn&gt;<br />&nbsp;&nbsp;&nbsp; DAV svn<br />&nbsp;&nbsp;&nbsp; SVNListParentPath on<br />&nbsp;&nbsp;&nbsp; SVNParentPath D:\Svn<br />&lt;/Location&gt;</p>
<p>Save the changes then&nbsp;restart the Apache service for them to take effect.</p>
<p>You should now be able to browse to <a href="http://localhost:81/Svn/">http://localhost:81/Svn/</a> and see a page with zero repositories.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnplummer.com/tools/installing-subversion-on-windows.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Apache HTTP Server on Windows</title>
		<link>http://www.johnplummer.com/tools/installing-apache-http-server-on-windows.html</link>
		<comments>http://www.johnplummer.com/tools/installing-apache-http-server-on-windows.html#comments</comments>
		<pubDate>Mon, 07 Jul 2008 21:05:02 +0000</pubDate>
		<dc:creator>John Plummer</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://www.johnplummer.com/vista/installing-apache-http-server-on-windows.html</guid>
		<description><![CDATA[I am setting up a machine to host Subversion. My preference is to use Apache as the HTTP server. The server is running Vista but the install and set up process should be similar on other versions of windows.
DownloadThe latest Apache build (currently apache_2.2.9-win32-x86-no_ssl-r2.msi) from http://httpd.apache.org/download.cgi
Install ApacheRun the installer and follow the instructions. Enter the [...]]]></description>
			<content:encoded><![CDATA[<p>I am setting up a machine to host Subversion. My preference is to use Apache as the HTTP server. The server is running Vista but the install and set up process should be similar on other versions of windows.</p>
<p><strong>Download</strong><br />The latest Apache build (currently apache_2.2.9-win32-x86-no_ssl-r2.msi) from <a href="http://httpd.apache.org/download.cgi">http://httpd.apache.org/download.cgi</a></p>
<p><strong>Install Apache<br /></strong>Run the installer and follow the instructions. Enter the server name under &lsquo;Network Domain&rsquo; and &lsquo;Server Name&rsquo;, enter an email address and leave &lsquo;for All Users&rsquo; selected.<br /><img alt="ApacheInstall" src="http://www.johnplummer.com/wp-content/uploads/2008/07/apacheinstall.png" border="0" /></p>
<p>Navigate to <a href="http://localhost/">http://localhost/</a> and you should see the text &lsquo;It works!&rsquo;.</p>
<p>I prefer to run IIS on port 80 and Apache on 81. If you already have IIS installed and running you may not have got the &lsquo;It works!&rsquo; page but rather an IIS page when running the test above.</p>
<p><strong>Change to Port 81</strong><br />&#8216;Start &gt; All Programs &gt; Apache HTTP Server 2.2 &gt; Configure Apache Server &gt; Edit the Apache httpd.conf Configuration File&#8217;</p>
<p>Search for&nbsp; &#8216;Listen 80&#8242; and replace with &#8216;Listen 81&#8242;</p>
<p>Save the conf file and restart the service from the services console then browse to <a href="http://localhost:81/">http://localhost:81/</a> to confirm it works.</p>
<p><strong>Create a Password File</strong><br />Open a command prompt at C:\Program Files\Apache Software Foundation\Apache2.2.</p>
<p>Create a password file by entering &#8216;bin\htpasswd -c passwd <em>username</em>&#8216;&nbsp;and enter and confirm the password when prompted.</p>
<p>Add any further users with &#8216;bin\htpasswd passwd <em>username</em>&#8216;.</p>
<p>Edit the Apache httpd.conf configuration file and change:</p>
<p>&lt;Directory /&gt;<br />&nbsp;&nbsp;&nbsp; Options FollowSymLinks<br />&nbsp;&nbsp;&nbsp; AllowOverride None<br />&nbsp;&nbsp;&nbsp; Order deny,allow<br />&nbsp;&nbsp;&nbsp; Deny from all<br />&lt;/Directory&gt;</p>
<p>To:</p>
<p>&lt;Directory /&gt;<br />&nbsp;&nbsp;&nbsp; Options FollowSymLinks<br />&nbsp;&nbsp;&nbsp; AllowOverride None<br />&nbsp;&nbsp;&nbsp; Order deny,allow<br />&nbsp;&nbsp;&nbsp; Deny from all<br />&nbsp;&nbsp;&nbsp; AuthType Basic<br />&nbsp;&nbsp;&nbsp; AuthName &#8220;Subversion Repositories&#8221;<br />&nbsp;&nbsp;&nbsp; AuthUserFile passwd<br />&nbsp;&nbsp;&nbsp; Require valid-user<br />&lt;/Directory&gt;</p>
<p>Restart the Apache 2.2 service and confirm you are asked for a username and password when you navigate to <a href="http://localhost:81/">http://localhost:81/</a>.</p>
<p>You may need to amend your firewall to allow connections from port 81.<br /><img alt="ApacheWindowsFirewall" src="http://www.johnplummer.com/wp-content/uploads/2008/07/apachewindowsfirewall.png" border="0" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnplummer.com/tools/installing-apache-http-server-on-windows.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vista &#8220;Windows Complete PC Restore&#8221; fails with &#8220;No valid backup locations could be found&#8221;</title>
		<link>http://www.johnplummer.com/vista/vista-windows-complete-pc-restore-fails-with-no-valid-backup-locations-could-be-found.html</link>
		<comments>http://www.johnplummer.com/vista/vista-windows-complete-pc-restore-fails-with-no-valid-backup-locations-could-be-found.html#comments</comments>
		<pubDate>Wed, 02 Jul 2008 20:35:04 +0000</pubDate>
		<dc:creator>John Plummer</dc:creator>
				<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://www.johnplummer.com/vista/vista-windows-complete-pc-restore-fails-with-no-valid-backup-locations-could-be-found.html</guid>
		<description><![CDATA[There is an issue with Vista complete PC back up and restore if you are restoring to a clean system from more than one&#160;DVD or CD. It appears that the catalogue is stored on the last disc in the back up set but this appears to be undocumented.
This means when you run your Windows Complete [...]]]></description>
			<content:encoded><![CDATA[<p>There is an issue with Vista complete PC back up and restore if you are restoring to a clean system from more than one&nbsp;DVD or CD. It appears that the catalogue is stored on the last disc in the back up set but this appears to be undocumented.</p>
<p>This means when you run your Windows Complete PC Restore, either from Vista or by choosing repair your computer during an installation, and insert the first disk of the back up when asked to insert the backup media you get the message &ldquo;No valid backup locations could be found&rdquo; which initially is just a bit worrying.</p>
<p>If you insert the last disk of the backup set, the catalogue is found and you can choose the backup and the backup options you want. When the backup starts you will be asked to insert the first disk.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnplummer.com/vista/vista-windows-complete-pc-restore-fails-with-no-valid-backup-locations-could-be-found.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Thread Safe Singleton</title>
		<link>http://www.johnplummer.com/code/simple-thread-safe-singleton.html</link>
		<comments>http://www.johnplummer.com/code/simple-thread-safe-singleton.html#comments</comments>
		<pubDate>Sat, 14 Jul 2007 14:56:04 +0000</pubDate>
		<dc:creator>John Plummer</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.johnplummer.com/csharp/simple-thread-safe-singleton.html</guid>
		<description><![CDATA[This is simple but should work:
public sealed class Singleton{&#160;&#160;&#160;private static Singleton _instance = new Singleton();
&#160;&#160;&#160;private Singleton()&#160;{ }
&#160;&#160;&#160;public static Singleton Instance&#160;&#160;&#160;{&#160;&#160;&#160;&#160;&#160;&#160;get&#160;&#160;&#160;&#160;&#160;&#160;{&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return _instance;&#160;&#160;&#160;&#160;&#160;&#160;}&#160;&#160;&#160;}}
As the CLR synchronises static constructors it is thread safe. Also static constructors are not called until the types is accessed to you have lazy instantiation (use nesting if there are other static methods).
]]></description>
			<content:encoded><![CDATA[<p>This is simple but should work:</p>
<p>public sealed class Singleton<br />{<br />&nbsp;&nbsp;&nbsp;private static Singleton _instance = new Singleton();</p>
<p>&nbsp;&nbsp;&nbsp;private Singleton()&nbsp;{ }</p>
<p>&nbsp;&nbsp;&nbsp;public static Singleton Instance<br />&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;get<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return _instance;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;}<br />}</p>
<p>As the CLR synchronises static constructors it is thread safe. Also static constructors are not called until the types is accessed to you have lazy instantiation (use nesting if there are other static methods).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnplummer.com/code/simple-thread-safe-singleton.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Run this program as program as an administrator</title>
		<link>http://www.johnplummer.com/visual-studio/run-this-program-as-program-as-an-administrator.html</link>
		<comments>http://www.johnplummer.com/visual-studio/run-this-program-as-program-as-an-administrator.html#comments</comments>
		<pubDate>Fri, 29 Jun 2007 17:00:54 +0000</pubDate>
		<dc:creator>John Plummer</dc:creator>
				<category><![CDATA[Vista]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.johnplummer.com/vista/run-this-program-as-program-as-an-administrator.html</guid>
		<description><![CDATA[Vista will try and run most programs without admin rights even if you are signed on as an admin. Some programs such as Visual Studio need admin rights so it is worth setting them to always run as administrator.
Confusingly, looking at a shortcut&#8217;s properties, the compatibility tab has an option to &#8220;Run this program as [...]]]></description>
			<content:encoded><![CDATA[<p>Vista will try and run most programs without admin rights even if you are signed on as an admin. Some programs such as Visual Studio need admin rights so it is worth setting them to always run as administrator.</p>
<p>Confusingly, looking at a shortcut&rsquo;s properties, the compatibility tab has an option to &ldquo;Run this program as an administrator&rdquo;. This option is greyed out:</p>
<p><img alt="Shortcut Compatibility Tab" src="http://www.johnplummer.com/wp-content/uploads/2007/06/shortcutcompatibilitytab.gif" border="0" /></p>
<p>To set the shortcut to run as administrator go to the shortcut tab &gt; click on Advanced&hellip; &gt; check Run as administrator:</p>
<p><img alt="Shortcut Advanced Properties" src="http://www.johnplummer.com/wp-content/uploads/2007/06/shortcutadvancedproperties.gif" border="0" /></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnplummer.com/visual-studio/run-this-program-as-program-as-an-administrator.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Macro to Set Outlook&#8217;s Master Category List</title>
		<link>http://www.johnplummer.com/tools/macro-to-set-outlooks-master-category-list.html</link>
		<comments>http://www.johnplummer.com/tools/macro-to-set-outlooks-master-category-list.html#comments</comments>
		<pubDate>Sun, 24 Jun 2007 08:31:13 +0000</pubDate>
		<dc:creator>John Plummer</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.johnplummer.com/tools/macro-to-set-outlooks-master-category-list.html</guid>
		<description><![CDATA[I upgrade, move, or reinstall the OS on my PCs fairly often so setting a master category list with a macro is useful:
Public Sub ResetCategories()
&#160;&#160;&#160; DeleteAllCategories&#160;&#160;&#160; &#160;&#160;&#160; CreateCategory &#8220;! goals&#8221;, 1, 0&#160;&#160;&#160; CreateCategory &#8220;! objectives&#8221;, 2, 0&#160;&#160;&#160; CreateCategory &#8220;! projects&#8221;, 3, 0&#160;&#160;&#160; CreateCategory &#8220;@ anywhere&#8221;, 4, 0&#160;&#160;&#160; CreateCategory &#8220;@ computer&#8221;, 5, 0&#160;&#160;&#160; CreateCategory &#8220;@ email&#8221;, [...]]]></description>
			<content:encoded><![CDATA[<p>I upgrade, move, or reinstall the OS on my PCs fairly often so setting a master category list with a macro is useful:</p>
<p>Public Sub ResetCategories()</p>
<p>&nbsp;&nbsp;&nbsp; DeleteAllCategories<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;! goals&#8221;, 1, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;! objectives&#8221;, 2, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;! projects&#8221;, 3, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;@ anywhere&#8221;, 4, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;@ computer&#8221;, 5, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;@ email&#8221;, 6, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;@ errands&#8221;, 7, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;@ home&#8221;, 8, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;@ office&#8221;, 9, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;@ phone&#8221;, 10, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;1:1&#8243;, 11, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;2 inbox&#8221;, 23, 1<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;2 someday maybe&#8221;, 24, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;2 waiting for&#8221;, 19, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;meeting&#8221;, 22, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;holiday&#8221;, 17, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;social&#8221;, 18, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;STS&#8221;, 20, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;travelling&#8221;, 21, 0<br />&nbsp;&nbsp;&nbsp; CreateCategory &#8220;cards&#8221;, 25, 0<br />&nbsp;&nbsp;&nbsp; <br />End Sub</p>
<p>Private Sub DeleteAllCategories()<br />&nbsp;&nbsp;&nbsp; Dim objNameSpace As NameSpace<br />&nbsp;&nbsp;&nbsp; Dim objCategory As Category<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; Set objNameSpace = Application.GetNamespace(&#8220;MAPI&#8221;)<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; If objNameSpace.Categories.Count &gt; 0 Then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For Each objCategory In objNameSpace.Categories<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; objNameSpace.Categories.Remove (objCategory.CategoryID)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; End If<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; Set objCategory = Nothing<br />&nbsp;&nbsp;&nbsp; Set objNameSpace = Nothing<br />&nbsp;&nbsp;&nbsp; <br />End Sub</p>
<p>Private Sub CreateCategory(strCategoryName As String, intColor As Integer, intKey As Integer)<br />&nbsp;&nbsp;&nbsp; Dim objNameSpace As NameSpace<br />&nbsp;&nbsp;&nbsp; Dim objCategory As Category<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; Set objNameSpace = Application.GetNamespace(&#8220;MAPI&#8221;)<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; If intColor &gt; 25 Then intColor = -1<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; objNameSpace.Categories.Add strCategoryName, intColor, intKey<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; Set objCategory = Nothing<br />&nbsp;&nbsp;&nbsp; Set objNameSpace = Nothing<br />&nbsp;&nbsp;&nbsp; <br />End Sub</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnplummer.com/tools/macro-to-set-outlooks-master-category-list.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Outlook Item to Task Macro</title>
		<link>http://www.johnplummer.com/tools/outlook-item-to-task-macro.html</link>
		<comments>http://www.johnplummer.com/tools/outlook-item-to-task-macro.html#comments</comments>
		<pubDate>Fri, 22 Jun 2007 19:23:30 +0000</pubDate>
		<dc:creator>John Plummer</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.johnplummer.com/tools/outlook-item-to-task-macro.html</guid>
		<description><![CDATA[The following macros convert outlook items to tasks with different categories. Based on this blog post&#160;which in turn is based on this one.

The item body is copied to the task body and the item itself is added as an attachment.
If multiple items are selected, multiple tasks will be created.
Created tasks are left open for editing.
I [...]]]></description>
			<content:encoded><![CDATA[<p>The following macros convert outlook items to tasks with different categories. Based on <a href="http://blogs.technet.com/kclemson/archive/2004/01/31/65586.aspx" target="_blank">this blog post</a>&nbsp;which in turn is based on <a href="http://blogs.msdn.com/johnrdurant/archive/2004/01/30/65039.aspx" target="_blank">this one</a>.</p>
<ul>
<li>The item body is copied to the task body and the item itself is added as an attachment.</li>
<li>If multiple items are selected, multiple tasks will be created.</li>
<li>Created tasks are left open for editing.</li>
<li>I am in two minds about deleting the item after the task is created and have decided against it at the moment.</li>
<li>It appears that OL 2007 does not allow shortcut keys to be assigned to macros <img src="http://www.johnplummer.com/wp-content/uploads/2007/06/smile9.gif" />.</li>
</ul>
<p>Public Sub CreateInboxTaskFromItem()<br />&nbsp;&nbsp;&nbsp; CreateCatagorisedTaskFromItem (&#8220;2 inbox&#8221;)<br />End Sub</p>
<p>Public Sub CreateWaitingTaskFromItem()<br />&nbsp;&nbsp;&nbsp; CreateCatagorisedTaskFromItem (&#8220;2 waiting for&#8221;)<br />End Sub</p>
<p>Public Sub CreateSomedayTaskFromItem()<br />&nbsp;&nbsp;&nbsp; CreateCatagorisedTaskFromItem (&#8220;2 someday maybe&#8221;)<br />End Sub</p>
<p>Public Sub CreateTaskFromItem()<br />&nbsp;&nbsp;&nbsp; CreateCatagorisedTaskFromItem (&#8220;&#8221;)<br />End Sub</p>
<p>Private Sub CreateCatagorisedTaskFromItem(catagory As String)</p>
<p>&nbsp; Dim olTask As Outlook.TaskItem<br />&nbsp; Dim olItem As Object<br />&nbsp; Dim olExp As Outlook.Explorer<br />&nbsp; Dim fldCurrent As Outlook.MAPIFolder<br />&nbsp; Dim olApp As Outlook.Application<br />&nbsp;<br />&nbsp; Set olApp = Outlook.CreateObject(&#8220;Outlook.Application&#8221;)<br />&nbsp; Set olExp = olApp.ActiveExplorer<br />&nbsp; Set fldCurrent = olExp.CurrentFolder<br />&nbsp;<br />&nbsp; Dim cntSelection As Integer<br />&nbsp; cntSelection = olExp.Selection.Count<br />&nbsp;<br />&nbsp; For i = 1 To cntSelection<br />&nbsp;&nbsp;&nbsp; Set olTask = olApp.CreateItem(olTaskItem)<br />&nbsp;&nbsp;&nbsp; Set olItem = olExp.Selection.Item(i)<br />&nbsp;&nbsp;&nbsp; olTask.Attachments.Add olItem<br />&nbsp;&nbsp;&nbsp; olTask.Body = olTask.Body + olItem.Body<br />&nbsp;&nbsp;&nbsp; If catagory = &#8220;2 waiting for&#8221; Then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; olTask.Subject = olItem.SenderName &amp; &#8220;: &#8221; &amp; olItem.Subject<br />&nbsp;&nbsp;&nbsp; Else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; olTask.Subject = olItem.Subject<br />&nbsp;&nbsp;&nbsp; End If<br />&nbsp;&nbsp;&nbsp; olTask.Categories = catagory<br />&nbsp;&nbsp;&nbsp; &#8216;olItem.Delete<br />&nbsp;&nbsp;&nbsp; olTask.Display<br />&nbsp;&nbsp;&nbsp; olTask.Save<br />&nbsp; Next<br />&nbsp;<br />End Sub</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnplummer.com/tools/outlook-item-to-task-macro.html/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Vista Install Blank Screen</title>
		<link>http://www.johnplummer.com/vista/vista-install-blank-screen.html</link>
		<comments>http://www.johnplummer.com/vista/vista-install-blank-screen.html#comments</comments>
		<pubDate>Wed, 20 Jun 2007 19:27:41 +0000</pubDate>
		<dc:creator>John Plummer</dc:creator>
				<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://www.johnplummer.com/vista/vista-install-blank-screen.html</guid>
		<description><![CDATA[Trying to install Vista on a machine and getting a blank screen after one of the reboots?
This could be caused by an incompatible display driver. I solved this problem by:

Reboot the machine and hit F8 to get the Windows boot menu.
Select Safe Mode with Networking.
Vista will boot then will complain that it cannot continue with [...]]]></description>
			<content:encoded><![CDATA[<p>Trying to install Vista on a machine and getting a blank screen after one of the reboots?</p>
<p>This could be caused by an incompatible display driver. I solved this problem by:</p>
<ol>
<li>Reboot the machine and hit F8 to get the Windows boot menu.</li>
<li>Select Safe Mode with Networking.</li>
<li>Vista will boot then will complain that it cannot continue with the installation in Safe Mode. <strong>Do not hit OK!</strong></li>
<li>Press Shift + F10 to get a command window.</li>
<li>Run Device Manager by entering &#8216;devmgmt.msc&#8217;.</li>
<li>Right click the video card and select Update Driver.</li>
<li>Choose &#8216;Select a Driver&#8217;.</li>
<li>Select &#8216;Choose from a list&#8217;.</li>
<li>Click on the generic VGA driver and hit Next to install it.</li>
<li>Close the wizard, close the Device Manager, close the command prompt.</li>
<li>Click OK on the installation message and Vista will reboot.</li>
<li>Finish the install, create a restore point, then install the correct video driver.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.johnplummer.com/vista/vista-install-blank-screen.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Use InternalsVisibleTo</title>
		<link>http://www.johnplummer.com/code/how-to-use-internalsvisibleto.html</link>
		<comments>http://www.johnplummer.com/code/how-to-use-internalsvisibleto.html#comments</comments>
		<pubDate>Mon, 18 Jun 2007 08:22:16 +0000</pubDate>
		<dc:creator>John Plummer</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.johnplummer.com/visual-studio/how-to-use-internalsvisibleto.html</guid>
		<description><![CDATA[VS2005 defaults new classes to internal rather than public (although it appears that Orcas defaults to public). This is good as it reduces the public interface of your assembly and it encourages you to actually think about whether a class needs to be public.
You can allow other assemblies access to your internal types and members [...]]]></description>
			<content:encoded><![CDATA[<p>VS2005 defaults new classes to internal rather than public (although it appears that Orcas defaults to public). This is good as it reduces the public interface of your assembly and it encourages you to actually think about whether a class needs to be public.</p>
<p>You can allow other assemblies access to your internal types and members though, by using the InternalsVisibleTo attribute. This is especially useful for allowing your test assembly to access your internal classes.</p>
<p>This attribute can only be applied to <a href="http://www.johnplummer.com/visual-studio/how-to-give-an-assembly-a-strong-name.html">strongly named assemblies</a>.</p>
<p>[assembly:InternalsVisibleTo("TestAssembly, PublicKey=<EM>TestAssembly&rsquo;s public key</EM>")]</p>
<p>The attribute requires the assembly name and the public key. To retrieve the public key use sn.exe. Open a visual studio command prompt and enter:</p>
<p>sn.exe -Tp <em>AssemblyPath</em></p>
<p>Alternatively if you use an alternate file explorer you could <a href="http://www.johnplummer.com/tools/user-commands-in-xplorer2.html">set up a macro</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnplummer.com/code/how-to-use-internalsvisibleto.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
