<?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>Shawson&#039;s Code Blog</title>
	<atom:link href="http://codeblog.shawson.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeblog.shawson.co.uk</link>
	<description>development notes for my failing memory</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:00:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Import &amp; Export break points in Visual Studio 2010</title>
		<link>http://codeblog.shawson.co.uk/import-export-break-points-in-visual-studio-2010/</link>
		<comments>http://codeblog.shawson.co.uk/import-export-break-points-in-visual-studio-2010/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 12:13:59 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1318</guid>
		<description><![CDATA[&#8220;This will change your life&#8221; &#8230; reassured my colleague Mr Carmicheal. Basically it&#8217;s possible in VS2010 (Pro, Premium or Ultimate) to Import &#038; Export sets of break points for projects, handy if you have pieces of code you often have to step through for some reason or another. The original article can be found here: [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/where-did-my-immidiate-window-go/' rel='bookmark' title='Where did my Immidiate window go!?'>Where did my Immidiate window go!?</a></li>
<li><a href='http://codeblog.shawson.co.uk/quickly-find-open-a-file-in-visual-studio/' rel='bookmark' title='Quickly Find/ Open a file in Visual Studio'>Quickly Find/ Open a file in Visual Studio</a></li>
<li><a href='http://codeblog.shawson.co.uk/referencing-custom-properties-on-a-master-page-from-the-child-page/' rel='bookmark' title='Referencing custom properties on a Master page from the Child page'>Referencing custom properties on a Master page from the Child page</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<blockquote><p>&#8220;This will change your life&#8221;</p></blockquote>
<p>&#8230; reassured my colleague Mr Carmicheal.</p>
<p>Basically it&#8217;s possible in VS2010 (Pro, Premium or Ultimate) to Import &#038; Export sets of break points for projects, handy if you have pieces of code you often have to step through for some reason or another.</p>
<p>The original article can be found here: <a href="http://msdn.microsoft.com/en-us/library/dd293657.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/dd293657.aspx</a></p>
<p>In case that page goes AWOL as MSDN pages often do, this is what it said;</p>
<blockquote><p>To export all breakpoints that match the current search criteria</p>
<ol>
<li>In the Breakpoints window toolbar, click the Export all breakpoints matching current search criteria icon.<br/>
<p>    	The Save As dialog box appears.</li>
<li>In the Save As dialog box, type a name in the File name box.<br/>
<p>    	This is the name of the XML file that will contain the exported breakpoints.</li>
<li>Note the folder path shown at the top of the dialog box. To save the XML file to a different location, change the folder path shown in that box, or click Browse Folders to browse for a new location.</li>
<li>Click Save.</li>
</ol>
<p>To export selected breakpoints</p>
<ol>
<li>In the Breakpoints window, select the breakpoints you want to export.<br/>
<p>    To select multiple breakpoints, hold down the CTRL key and click additional breakpoints.</li>
<li>Right-click in the breakpoints list, and choose Export selected.<br/>
<p>    The Save As dialog box appears.</li>
<li>In the Save As dialog box, type a name in the File name box.<br/>
<p>    This is the name of the XML file that will contain the exported breakpoints.</li>
<li> The folder path is shown at the top of the dialog box. To save the XML file to a different location, change the folder path shown in that box, or click Browse Folders to browse for a new location.</li>
<li>Click Save.</li>
</ol>
<p>To import breakpoints</p>
<ol>
<li>In the Breakpoints window toolbar, click the Import breakpoints from a file icon.
<p>    The Open dialog box appears.</li>
<li> In the Open dialog box, browse to the directory where your file is located, and then type the file name or select the file from the file list.</li>
<li>Click OK.</li>
</ol>
</blockquote>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/where-did-my-immidiate-window-go/' rel='bookmark' title='Where did my Immidiate window go!?'>Where did my Immidiate window go!?</a></li>
<li><a href='http://codeblog.shawson.co.uk/quickly-find-open-a-file-in-visual-studio/' rel='bookmark' title='Quickly Find/ Open a file in Visual Studio'>Quickly Find/ Open a file in Visual Studio</a></li>
<li><a href='http://codeblog.shawson.co.uk/referencing-custom-properties-on-a-master-page-from-the-child-page/' rel='bookmark' title='Referencing custom properties on a Master page from the Child page'>Referencing custom properties on a Master page from the Child page</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/import-export-break-points-in-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick &amp; Tiny jQuery Drop Down Menus</title>
		<link>http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/</link>
		<comments>http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 12:25:16 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1311</guid>
		<description><![CDATA[The Code: $(document).ready(function () { // Shawsons&#039; Teeny-Tiny Drop Downs! $(&#039;.drop-down-menu li ul&#039;).hide().mouseleave(function () { $(this).hide(); }); $(&#039;.drop-down-menu&#62;li&#62;a&#039;).mouseenter(function () { $(&#039;ul&#039;, $(this).parent().parent()).hide(); $(&#039;ul&#039;, $(this).parent()).show(); }).mouseleave(function (o) { if ($(this).parent().has($(o.relatedTarget)).length &#60; 1) { $(&#039;ul&#039;, $(this).parent()).hide(); } }); }); The Markup: &#60;ul class=&#34;drop-down-menu&#34;&#62; &#60;li&#62;Available Actions : &#60;/li&#62; &#60;li&#62;&#60;a href=&#34;&#34;&#62;Menu 1&#60;/a&#62; &#60;ul&#62; &#60;li&#62;&#60;a href=&#34;a.htm&#34;&#62;a&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;b.htm&#34;&#62;b&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;c.htm&#34;&#62;c&#60;/a&#62;&#60;/li&#62; [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/oo-inheritance-with-javascript/' rel='bookmark' title='OO &amp; Inheritance with Javascript'>OO &#038; Inheritance with Javascript</a></li>
<li><a href='http://codeblog.shawson.co.uk/processingjs-box2d-physics/' rel='bookmark' title='Processingjs &amp; Box2d Physics!'>Processingjs &#038; Box2d Physics!</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>The Code:</p>
<pre class="brush: javascript">
$(document).ready(function () { // Shawsons&#039; Teeny-Tiny Drop Downs!
    $(&#039;.drop-down-menu li ul&#039;).hide().mouseleave(function () {
        $(this).hide();
    });
    $(&#039;.drop-down-menu&gt;li&gt;a&#039;).mouseenter(function () {
        $(&#039;ul&#039;, $(this).parent().parent()).hide();
        $(&#039;ul&#039;, $(this).parent()).show();
    }).mouseleave(function (o) {
        if ($(this).parent().has($(o.relatedTarget)).length &lt; 1) {
            $(&#039;ul&#039;, $(this).parent()).hide();
        }
    });
});
</pre>
<p>The Markup:</p>
<pre class="brush: html">
&lt;ul class=&quot;drop-down-menu&quot;&gt;
        &lt;li&gt;Available Actions : &lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&quot;&gt;Menu 1&lt;/a&gt;
            &lt;ul&gt;
                &lt;li&gt;&lt;a href=&quot;a.htm&quot;&gt;a&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;b.htm&quot;&gt;b&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;c.htm&quot;&gt;c&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&quot;&gt;Menu 2&lt;/a&gt;
            &lt;ul&gt;
                &lt;li&gt;&lt;a href=&quot;d.htm&quot;&gt;d&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;e.htm&quot;&gt;e&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;f.htm&quot;&gt;f&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
</pre>
<p>Some CSS:</p>
<pre class="brush: css">
.drop-down-menu { display:block; }
.drop-down-menu li { float:left; padding: 8px; }
.drop-down-menu li a { padding:8px; }
.drop-down-menu li ul
{
    position:absolute;
    background-color:#fff;
    border: 1px solid #999;
    border-radius: 0px 7px 7px 7px; -moz-border-radius:0px 7px 7px 7px; -webkit-border-radius:0px 7px 7px 7px;
    padding:5px;
}
.drop-down-menu li ul li { float:none; }
.drop-down-menu li ul li a { color:#000; }
.drop-down-menu li ul li:hover { background-color:#F68833; }
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/oo-inheritance-with-javascript/' rel='bookmark' title='OO &amp; Inheritance with Javascript'>OO &#038; Inheritance with Javascript</a></li>
<li><a href='http://codeblog.shawson.co.uk/processingjs-box2d-physics/' rel='bookmark' title='Processingjs &amp; Box2d Physics!'>Processingjs &#038; Box2d Physics!</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Conditional logic in ListView ItemTemplate with DataBinder.Eval</title>
		<link>http://codeblog.shawson.co.uk/conditional-logic-in-listview-itemtemplate-with-databinder-eval/</link>
		<comments>http://codeblog.shawson.co.uk/conditional-logic-in-listview-itemtemplate-with-databinder-eval/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 10:16:55 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[C#.net]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1304</guid>
		<description><![CDATA[Embarrasingly simple, but something I always seem to forget, and then never blog! I needed to show a tick in a repeater when a row value was -1: Simple! In MVC, with the razor syntax and strongly typed views I&#8217;ve grown to love, this is a pinch o&#8217; the proverbial piss- In WebForms rreviously I [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/how-to-display-hierarchical-data-by-using-nested-repeater-controls-and-visual-c-net/' rel='bookmark' title='How To Display Hierarchical Data Using Nested Repeater Controls and Visual C# .NET'>How To Display Hierarchical Data Using Nested Repeater Controls and Visual C# .NET</a></li>
<li><a href='http://codeblog.shawson.co.uk/aspnet-nested-listview-controls-with-all-edit-functionality-working/' rel='bookmark' title='Asp.net nested ListView control&#8217;s, with edit functionality- example'>Asp.net nested ListView control&#8217;s, with edit functionality- example</a></li>
<li><a href='http://codeblog.shawson.co.uk/c-dynamic-keyword-and-how-you-can-use-it-to-help-tdd/' rel='bookmark' title='C# Dynamic keyword, and how you can use it to help TDD!'>C# Dynamic keyword, and how you can use it to help TDD!</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Embarrasingly simple, but something I always seem to forget, and then never blog!  I needed to show a tick in a repeater when a row value was -1: Simple!  In MVC, with the razor syntax and strongly typed views I&#8217;ve grown to love, this is a pinch o&#8217; the proverbial piss- In WebForms rreviously I often resort to setting up an ItemDataBound event handler which hides or shows an image, but to be honest I could not be bothered- this seems such overkill for something as simple as this.  Anyway, after some faffing I reminded myself the easiest method is to use an &#8216;in-line if&#8217; in the ItemTemplate, like so;</p>
<pre class="brush: html">
&lt;ItemTemplate&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;%# Eval(&quot;CarReg&quot;) %&gt;&lt;/td&gt;
            ...
            &lt;td&gt;
                &lt;%# (DataBinder.Eval(Container.DataItem, &quot;NewRepeat&quot;) != null &amp;&amp; DataBinder.Eval(Container.DataItem, &quot;NewRepeat&quot;).Equals(-1) ? &quot;&lt;img src=\&quot;../images/tick.png\&quot; alt=\&quot;tick\&quot; /&gt;&quot; : &quot;&lt;img src=\&quot;../images/cross.png\&quot; alt=\&quot;cross\&quot; /&quot;)%&gt;
            &lt;/td&gt;
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/how-to-display-hierarchical-data-by-using-nested-repeater-controls-and-visual-c-net/' rel='bookmark' title='How To Display Hierarchical Data Using Nested Repeater Controls and Visual C# .NET'>How To Display Hierarchical Data Using Nested Repeater Controls and Visual C# .NET</a></li>
<li><a href='http://codeblog.shawson.co.uk/aspnet-nested-listview-controls-with-all-edit-functionality-working/' rel='bookmark' title='Asp.net nested ListView control&#8217;s, with edit functionality- example'>Asp.net nested ListView control&#8217;s, with edit functionality- example</a></li>
<li><a href='http://codeblog.shawson.co.uk/c-dynamic-keyword-and-how-you-can-use-it-to-help-tdd/' rel='bookmark' title='C# Dynamic keyword, and how you can use it to help TDD!'>C# Dynamic keyword, and how you can use it to help TDD!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/conditional-logic-in-listview-itemtemplate-with-databinder-eval/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nodejs debugging with node-inspector on windows</title>
		<link>http://codeblog.shawson.co.uk/nodejs-debugging-with-node-inspector-on-windows/</link>
		<comments>http://codeblog.shawson.co.uk/nodejs-debugging-with-node-inspector-on-windows/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 21:16:01 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[nodejs]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1298</guid>
		<description><![CDATA[I recently started learning nodejs- the recommended debugging tool seems to be node-inspector. You can grab and install this using npm (the command line node package manager- like nuget for node), making it available to all your projects; npm install -g node-inspector Once npm has worked it&#8217;as magic, you start node inspector by simply typing [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I recently started learning nodejs- the <a href="http://nodejs.org/docs/latest/api/appendix_1.html">recommended debugging tool</a> seems to be node-inspector.  You can grab and install this using npm (the command line node package manager- like nuget for node), making it available to all your projects;</p>
<p><code>npm install -g node-inspector</code></p>
<p>Once npm has worked it&#8217;as magic, you start node inspector by simply typing node-inspector into the command line- then start your project in node, with the debug flag;</p>
<p><code>node --debug myfile.js</code></p>
<p>If all runs as planned, you can then hit the browser on http://localhost:8080/debug?port=5858, <a href="https://github.com/dannycoates/node-inspector">as mentioned in the docs</a>.</p>
<p>However when I started node-inspector I received an error;<br />
<code>C:\Users\Shawson>node-inspector<br />
   info  - socket.io started<br />
   warn  - error raised: Error: listen EACCES</code></p>
<p>After some fiddling, I found that changing the default port from 8080 to something else (I chose 124 at random) fixed this issue- I just then had to use the url http://localhost:124/debug?port=5858.  This is because I foolishly forgot I have an instance of IIS on my local box which uses this port- a handy find though as I couldn&#8217;t find any help online fixing this issue.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/nodejs-debugging-with-node-inspector-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IIS 7 Permissions &#8211; Application Pool Identity User Accounts</title>
		<link>http://codeblog.shawson.co.uk/iis-7-permissions-application-pool-identity-user-accounts/</link>
		<comments>http://codeblog.shawson.co.uk/iis-7-permissions-application-pool-identity-user-accounts/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 13:10:34 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1290</guid>
		<description><![CDATA[In IIS7- when using app pools which use the app pool identity, you can find the user account (for use with ACL) in the &#8220;IIS AppPool&#8221; domain- so you can reference the app pool accounts with IIS AppPool\&#60;app pool name&#62; More info can be found here; http://learn.iis.net/page.aspx/624/application-pool-identities/ Related posts:Permissions problems with WordPress on PHP5/IIS7 (Windows [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/permissions-problems-with-wordpress-on-php5iis7-windows-server-2008-sp2-with-fastcgi/' rel='bookmark' title='Permissions problems with WordPress on PHP5/IIS7 (Windows Server 2008 SP2) with FastCGI'>Permissions problems with WordPress on PHP5/IIS7 (Windows Server 2008 SP2) with FastCGI</a></li>
<li><a href='http://codeblog.shawson.co.uk/multiple-domains-to-reduce-site-loading-times/' rel='bookmark' title='Multiple domains to reduce site loading times'>Multiple domains to reduce site loading times</a></li>
<li><a href='http://codeblog.shawson.co.uk/my-shiny-new-blog/' rel='bookmark' title='My shiny new blog'>My shiny new blog</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>In IIS7- when using app pools which use the app pool identity, you can find the user account (for use with ACL) in the &#8220;IIS AppPool&#8221; domain- so you can reference the app pool accounts with IIS AppPool\&lt;app pool name&gt;</p>
<p>More info can be found here; <a href="http://learn.iis.net/page.aspx/624/application-pool-identities/">http://learn.iis.net/page.aspx/624/application-pool-identities/</a></p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/permissions-problems-with-wordpress-on-php5iis7-windows-server-2008-sp2-with-fastcgi/' rel='bookmark' title='Permissions problems with WordPress on PHP5/IIS7 (Windows Server 2008 SP2) with FastCGI'>Permissions problems with WordPress on PHP5/IIS7 (Windows Server 2008 SP2) with FastCGI</a></li>
<li><a href='http://codeblog.shawson.co.uk/multiple-domains-to-reduce-site-loading-times/' rel='bookmark' title='Multiple domains to reduce site loading times'>Multiple domains to reduce site loading times</a></li>
<li><a href='http://codeblog.shawson.co.uk/my-shiny-new-blog/' rel='bookmark' title='My shiny new blog'>My shiny new blog</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/iis-7-permissions-application-pool-identity-user-accounts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grabbing data from the registry on a remote machine using dot net and WMI</title>
		<link>http://codeblog.shawson.co.uk/grabbing-data-from-the-registry-on-a-remote-machine-using-dot-net-and-wmi/</link>
		<comments>http://codeblog.shawson.co.uk/grabbing-data-from-the-registry-on-a-remote-machine-using-dot-net-and-wmi/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 13:24:57 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#.net]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1281</guid>
		<description><![CDATA[I recently had to write an app which, given a computer name, would grab their telephone extension from a registry key (For the purpose of the code example below, I just grab the CommonFilesDir key from the windows node. There&#8217;s a couple of ways you can achieve this- either using RegistryKey.OpenRemoteBaseKey which gave me a [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/using-urlencode-urldecode-and-other-http-functions-from-a-non-web-file/' rel='bookmark' title='Using URLEncode, URLDecode and other Http functions from a non Web file'>Using URLEncode, URLDecode and other Http functions from a non Web file</a></li>
<li><a href='http://codeblog.shawson.co.uk/wcf-404-3-errors/' rel='bookmark' title='WCF 404.3 Errors'>WCF 404.3 Errors</a></li>
<li><a href='http://codeblog.shawson.co.uk/making-your-wcf-service-compatible-with-legacy-net-1-1-applications/' rel='bookmark' title='Making your WCF Service compatible with legacy .net 1.1 applications'>Making your WCF Service compatible with legacy .net 1.1 applications</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I recently had to write an app which, given a computer name, would grab their telephone extension from a registry key (For the purpose of the code example below, I just grab the CommonFilesDir key from the windows node.  There&#8217;s a couple of ways you can achieve this- either using <a href="http://msdn.microsoft.com/en-us/library/8zha3xws.aspx">RegistryKey.OpenRemoteBaseKey</a> which gave me a whole bunch of permissions issues, plus you need the remote registry and remote administration services active on the server/client OR you can use the Windows Management Instrumentation (WMI) service.  I took this route, as it&#8217;s a service which is active by default on all of our machines on the domain, and it was easier to get the permissions right.  </p>
<p>Before I paste the code, a GOTCHA to beware of, straight from the MSDN <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa392722(v=vs.85).aspx">here</a>;</p>
<blockquote><p>The registry provider is hosted in LocalService—not the LocalSystem. Therefore, obtaining information remotely from the subtree HKEY_CURRENT_USER is not possible</p></blockquote>
<pre class="brush: csharp">
ConnectionOptions options = new ConnectionOptions();
options.Impersonation = ImpersonationLevel.Impersonate;
options.EnablePrivileges = true;
options.Username = &quot;&lt;domain_admin_username&gt;&quot;;
options.Password = &quot;&lt;domain_admin_password&gt;&quot;;

// http://msdn.microsoft.com/en-us/library/system.management.managementscope.aspx
ManagementScope ms = new ManagementScope(&quot;\\\\&lt;computer name&gt;\\root\\default&quot;, options);          

ms.Connect();

// http://msdn.microsoft.com/en-us/library/windows/desktop/aa390788(v=vs.85).aspx
ManagementClass mc = new ManagementClass(&quot;stdRegProv&quot;);
mc.Scope = ms;

ManagementBaseObject inParams = mc.GetMethodParameters(&quot;GetStringValue&quot;);
// there are other methods for grabbing other reg types- see
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa393664(v=VS.85).aspx

inParams[&quot;hDefKey&quot;] = RegHive.HKEY_LOCAL_MACHINE;
inParams[&quot;sSubKeyName&quot;] = &quot;SOFTWARE\\Microsoft\\Windows\\CurrentVersion&quot;;
inParams[&quot;sValueName&quot;] = &quot;CommonFilesDir&quot;;

ManagementBaseObject outParams =
        mc.InvokeMethod(&quot;GetStringValue&quot;, inParams, null);

if (outParams[&quot;ReturnValue&quot;].ToString() == &quot;0&quot;)
{
    Console.WriteLine(outParams[&quot;sValue&quot;]);
}
else
{
    Console.WriteLine(&quot;Error &quot; + outParams[&quot;ReturnValue&quot;] + &quot; please refer to http://msdn.microsoft.com/en-us/library/ms681382%28v=3Dvs.85%29.aspx&quot;);
}

Console.ReadLine();
</pre>
<p>This code requires this enum..</p>
<pre class="brush: csharp">
public enum RegHive : uint
{
  HKEY_CLASSES_ROOT = 0x80000000,
  HKEY_CURRENT_USER = 0x80000001,
  HKEY_LOCAL_MACHINE = 0x80000002,
  HKEY_USERS = 0x80000003,
  HKEY_CURRENT_CONFIG = 0x80000005
}
</pre>
<p>If you receive a COM error back &#8220;The RPC server is unavailable&#8221;, make sure the target machine&#8217;s firewall isn&#8217;t blocking the call- this will open the port;<br />
<code>netsh firewall set service RemoteAdmin</code></p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/using-urlencode-urldecode-and-other-http-functions-from-a-non-web-file/' rel='bookmark' title='Using URLEncode, URLDecode and other Http functions from a non Web file'>Using URLEncode, URLDecode and other Http functions from a non Web file</a></li>
<li><a href='http://codeblog.shawson.co.uk/wcf-404-3-errors/' rel='bookmark' title='WCF 404.3 Errors'>WCF 404.3 Errors</a></li>
<li><a href='http://codeblog.shawson.co.uk/making-your-wcf-service-compatible-with-legacy-net-1-1-applications/' rel='bookmark' title='Making your WCF Service compatible with legacy .net 1.1 applications'>Making your WCF Service compatible with legacy .net 1.1 applications</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/grabbing-data-from-the-registry-on-a-remote-machine-using-dot-net-and-wmi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grouped pagination links function in JavaScript</title>
		<link>http://codeblog.shawson.co.uk/grouped-pagination-links-function-in-javascript/</link>
		<comments>http://codeblog.shawson.co.uk/grouped-pagination-links-function-in-javascript/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 09:28:17 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1276</guid>
		<description><![CDATA[I just created a JavaScript port of an awesome bit of pagination code I first used years and years ago while working in Classic ASP, originally written by Dave Child who I was working with at the time. The original can be found on this site here. It&#8217;s an awesome script when you have 100&#8242;s [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/javascript-profiling-in-ie7/' rel='bookmark' title='Javascript profiling in IE7&#8230;'>Javascript profiling in IE7&#8230;</a></li>
<li><a href='http://codeblog.shawson.co.uk/work-starts-on-my-webgl-game/' rel='bookmark' title='Work Starts on my WebGL Game!'>Work Starts on my WebGL Game!</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I just created a  JavaScript port of an awesome bit of pagination code I first used years and years ago while working in Classic ASP, originally written by <a href="http://www.addedbytes.com/" target="_blank">Dave Child</a> who I was working with at the time.  The <a href="http://www.addedbytes.com/lab/vbscript-pagination/" title="VBScript Grouped Pagination Links on AddedBytes.com" target="_blank">original can be found on this site here</a>.</p>
<p>It&#8217;s an awesome script when you have 100&#8242;s of pages of data (which probably suggests you need to implement some good filtering and search features to save your poor users..) and presents the links like so..</p>
<p>    « Prev 1 2 3 &#8230; 7 [8] 9 &#8230; 208 209 210 Next »</p>
<pre class="brush: javascript">
function BuildGroupedPagination(current_page, total_pages, base_url, seperator)
{
	var url = base_url;
	var strPages = &quot;&quot;;
	var intMaxPages = 0;
	var intMinPages = 0;
	var intPaginI = 0;

    if (typeof(seperator) == &#039;undefined&#039;)
    {
        seperator = &quot; &quot;;
    }

	if (total_pages &gt; 10)
	{
		if (total_pages &gt; 3)
		{
			intMaxPages = 3;
		}
		else
		{
			intMaxPages = total_pages;
		} 

		for (intPaginI = 1; intPaginI &lt;= intMaxPages; intPaginI++)
		{

			if (intPaginI == current_page)
			{
				strPages += &quot;&lt;strong&gt;[&quot; + intPaginI + &quot;]&lt;/strong&gt;&quot;;
			}
			else
			{
				strPages += &quot;&lt;a href=\&quot;&quot; + url + intPaginI + &quot;\&quot;&gt;&quot; + intPaginI + &quot;&lt;/a&gt;&quot;;
			} 

			if (intPaginI &lt; intMaxPages)
			{
				strPages += seperator;
			}
		} 

		if (total_pages &gt; 3)
		{
			if ((current_page &gt; 1) &amp;&amp; (current_page &lt; total_pages))
			{
				if (current_page &gt; 5)
				{
					strPages += &quot; ... &quot;;
				}
				else
				{
					strPages += seperator;
				} 

				if (current_page &gt; 4)
				{
					intMinPages = current_page;
				}
				else
				{
					intMinPages = 5;
				} 

				if (current_page &lt; total_pages - 4)
				{
					intMaxPages = current_page;
				}
				else
				{
					intMaxPages = total_pages - 4;
				} 

				for (intPaginI = intMinPages - 1 ; intPaginI &lt;= intMaxPages + 1; intPaginI++)
				{
					if (intPaginI == current_page)
					{
						strPages += &quot;&lt;strong&gt;[&quot; + intPaginI + &quot;]&lt;/strong&gt;&quot;;
					}
					else
					{
						strPages += &quot;&lt;a href=\&quot;&quot; + url + intPaginI + &quot;\&quot;&gt;&quot; + intPaginI + &quot;&lt;/a&gt;&quot;;
					}

					if (intPaginI &lt; intMaxPages + 1)
					{
						strPages += seperator;
					}
				}

				if (current_page &lt; total_pages - 4)
				{
					strPages += &quot; ... &quot;;
				}
				else
				{
					strPages += seperator;
				}
			}
			else
			{
				strPages += &quot; ... &quot;;
			} 

			for (intPaginI = total_pages - 2; intPaginI &lt;= total_pages; intPaginI++) {
				if (intPaginI == current_page) {
					strPages += &quot;&lt;strong&gt;[&quot; + intPaginI + &quot;]&lt;/strong&gt;&quot;;
				}
				else {
					strPages += &quot;&lt;a href=\&quot;&quot; + url + intPaginI + &quot;\&quot;&gt;&quot; + intPaginI + &quot;&lt;/a&gt;&quot;;
				} 

				if (intPaginI &lt; total_pages) {
					strPages += seperator;
				}
			}
		}
	}
	else
	{
		for (intPaginI = 1; intPaginI &lt;= total_pages; intPaginI++)
		{
			if (intPaginI == current_page)
			{
				strPages += &quot;&lt;strong&gt;&quot; + intPaginI + &quot;&lt;/strong&gt;&quot;;
			}
			else
			{
				strPages += &quot;&lt;a href=\&quot;&quot; + url + intPaginI + &quot;\&quot;&gt;&quot; + intPaginI + &quot;&lt;/a&gt;&quot;;
			} 

			if (intPaginI &lt; total_pages)
			{
				strPages += seperator;
			}
		}
	}
	return strPages;
}
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/javascript-profiling-in-ie7/' rel='bookmark' title='Javascript profiling in IE7&#8230;'>Javascript profiling in IE7&#8230;</a></li>
<li><a href='http://codeblog.shawson.co.uk/work-starts-on-my-webgl-game/' rel='bookmark' title='Work Starts on my WebGL Game!'>Work Starts on my WebGL Game!</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/grouped-pagination-links-function-in-javascript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Windows Firewall ports for SQL Server 2008</title>
		<link>http://codeblog.shawson.co.uk/open-windows-firewall-ports-for-sql-server-2008/</link>
		<comments>http://codeblog.shawson.co.uk/open-windows-firewall-ports-for-sql-server-2008/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 15:23:12 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1274</guid>
		<description><![CDATA[http://support.microsoft.com/kb/968872 As noted in the article, you can run this batch file; @echo ========= SQL Server Ports =================== @echo Enabling SQLServer default instance port 1433 netsh firewall set portopening TCP 1433 "SQLServer" @echo Enabling Dedicated Admin Connection port 1434 netsh firewall set portopening TCP 1434 "SQL Admin Connection" @echo Enabling conventional SQL Server Service Broker [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/' rel='bookmark' title='Command line to delete every file older than 30 days'>Command line to delete every file older than 30 days</a></li>
<li><a href='http://codeblog.shawson.co.uk/how-to-run-sql-profiler-against-local-sql-express-instances/' rel='bookmark' title='How to run SQL Profiler against local SQL Express instances'>How to run SQL Profiler against local SQL Express instances</a></li>
<li><a href='http://codeblog.shawson.co.uk/aspnet-role-membership-providers-under-iis7-doesnt-work/' rel='bookmark' title='ASP.Net Role &amp; Membership Providers (Under IIS7) &#8211; DOESN&#8217;T Work!'>ASP.Net Role &#038; Membership Providers (Under IIS7) &#8211; DOESN&#8217;T Work!</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><a href="http://support.microsoft.com/kb/968872">http://support.microsoft.com/kb/968872</a></p>
<p>As noted in the article, you can run this batch file;</p>
<pre>
@echo =========  SQL Server Ports  ===================
@echo Enabling SQLServer default instance port 1433
netsh firewall set portopening TCP 1433 "SQLServer"
@echo Enabling Dedicated Admin Connection port 1434
netsh firewall set portopening TCP 1434 "SQL Admin Connection"
@echo Enabling conventional SQL Server Service Broker port 4022
netsh firewall set portopening TCP 4022 "SQL Service Broker"
@echo Enabling Transact-SQL Debugger/RPC port 135
netsh firewall set portopening TCP 135 "SQL Debugger/RPC"
@echo =========  Analysis Services Ports  ==============
@echo Enabling SSAS Default Instance port 2383
netsh firewall set portopening TCP 2383 "Analysis Services"
@echo Enabling SQL Server Browser Service port 2382
netsh firewall set portopening TCP 2382 "SQL Browser"
@echo =========  Misc Applications  ==============
@echo Enabling HTTP port 80
netsh firewall set portopening TCP 80 "HTTP"
@echo Enabling SSL port 443
netsh firewall set portopening TCP 443 "SSL"
@echo Enabling port for SQL Server Browser Service's 'Browse' Button
netsh firewall set portopening UDP 1434 "SQL Browser"
@echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK)
netsh firewall set multicastbroadcastresponse ENABLE
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/' rel='bookmark' title='Command line to delete every file older than 30 days'>Command line to delete every file older than 30 days</a></li>
<li><a href='http://codeblog.shawson.co.uk/how-to-run-sql-profiler-against-local-sql-express-instances/' rel='bookmark' title='How to run SQL Profiler against local SQL Express instances'>How to run SQL Profiler against local SQL Express instances</a></li>
<li><a href='http://codeblog.shawson.co.uk/aspnet-role-membership-providers-under-iis7-doesnt-work/' rel='bookmark' title='ASP.Net Role &amp; Membership Providers (Under IIS7) &#8211; DOESN&#8217;T Work!'>ASP.Net Role &#038; Membership Providers (Under IIS7) &#8211; DOESN&#8217;T Work!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/open-windows-firewall-ports-for-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Executing sql statements from the command line (SQL Server 2008 R2 Express)</title>
		<link>http://codeblog.shawson.co.uk/executing-sql-statements-from-the-command-line-sql-server-2008-r2-express/</link>
		<comments>http://codeblog.shawson.co.uk/executing-sql-statements-from-the-command-line-sql-server-2008-r2-express/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 09:46:16 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1269</guid>
		<description><![CDATA[One of the things I&#8217;ve always liked about MySql is its easy to use command line interface. Microsoft Enterprise Manager was always pretty good, and of course SQL Management Studio, so I rarly have to interface with MSSQL using the command line, but when I did, I always used osql. As of SQL 2008 this [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/cross-server-queries-in-sql-server/' rel='bookmark' title='Cross server queries in SQL Server'>Cross server queries in SQL Server</a></li>
<li><a href='http://codeblog.shawson.co.uk/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
<li><a href='http://codeblog.shawson.co.uk/ssis-dts-packages-violating-referential-integrity/' rel='bookmark' title='SSIS / DTS packages violating referential integrity'>SSIS / DTS packages violating referential integrity</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>One of the things I&#8217;ve always liked about MySql is its easy to use command line interface.  Microsoft Enterprise Manager was always pretty good, and of course SQL Management Studio, so I rarly have to interface with MSSQL using the command line, but when I did, I always used osql.  As of SQL 2008 this was replaced by sqlcmd which is very similar to the mysql command line implementation.  Basic usage is;</p>
<pre class="brush: sql">
sqlcmd -S server_name\instance_name -U sa -P your_password
</pre>
<p>You can then type directly into the console, executing a &#8220;GO&#8221; after each statement to run.  I recently used this to enable remote connections on a new install of sql express, like so;</p>
<pre>
1> exec sys.sp_configure N'remote access', N'1'
2> GO
Configuration option 'remote access' changed from 0 to 1. Run the RECONFIGURE statement to install.
1> RECONFIGURE WITH OVERRIDE
2> GO
1> exit
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/cross-server-queries-in-sql-server/' rel='bookmark' title='Cross server queries in SQL Server'>Cross server queries in SQL Server</a></li>
<li><a href='http://codeblog.shawson.co.uk/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
<li><a href='http://codeblog.shawson.co.uk/ssis-dts-packages-violating-referential-integrity/' rel='bookmark' title='SSIS / DTS packages violating referential integrity'>SSIS / DTS packages violating referential integrity</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/executing-sql-statements-from-the-command-line-sql-server-2008-r2-express/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IIS Express hanging when launched from visual studio</title>
		<link>http://codeblog.shawson.co.uk/iis-express-hanging-when-launched-from-visual-studio/</link>
		<comments>http://codeblog.shawson.co.uk/iis-express-hanging-when-launched-from-visual-studio/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 08:50:41 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[URL Rewriting]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1265</guid>
		<description><![CDATA[I recently built up a new machine at work and grabbed all my latest projects out of SVN only to find that one of them no longer seemed to start. Since checkout I hadn&#8217;t changed any code, got a clean build, but when the browser window opened it just hung, with no error. I eventually [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/iis7-urlrewrite-outbound-links-with-compression-enabled/' rel='bookmark' title='IIS7 UrlRewrite Outbound links with Compression Enabled'>IIS7 UrlRewrite Outbound links with Compression Enabled</a></li>
<li><a href='http://codeblog.shawson.co.uk/helicon-isapi-rewrite-error-section-isapi_rewrite-not-found/' rel='bookmark' title='Helicon ISAPI Rewrite rules ignored &#8211; You must save the rewrite file with ANSI encoding- NOT UTF8!!'>Helicon ISAPI Rewrite rules ignored &#8211; You must save the rewrite file with ANSI encoding- NOT UTF8!!</a></li>
<li><a href='http://codeblog.shawson.co.uk/machine-key-generator/' rel='bookmark' title='Machine Key Generator'>Machine Key Generator</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I recently built up a new machine at work and grabbed all my latest projects out of SVN only to find that one of them no longer seemed to start.</p>
<p>Since checkout I hadn&#8217;t changed any code, got a clean build, but when the browser window opened it just hung, with no error.  </p>
<p>I eventually found this was because I was using the UrlRewrite module on the site (with the rules in the web.config file) but had forgotten to install this component on my IIS on the new machine.  An error message would have been nice!</p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/iis7-urlrewrite-outbound-links-with-compression-enabled/' rel='bookmark' title='IIS7 UrlRewrite Outbound links with Compression Enabled'>IIS7 UrlRewrite Outbound links with Compression Enabled</a></li>
<li><a href='http://codeblog.shawson.co.uk/helicon-isapi-rewrite-error-section-isapi_rewrite-not-found/' rel='bookmark' title='Helicon ISAPI Rewrite rules ignored &#8211; You must save the rewrite file with ANSI encoding- NOT UTF8!!'>Helicon ISAPI Rewrite rules ignored &#8211; You must save the rewrite file with ANSI encoding- NOT UTF8!!</a></li>
<li><a href='http://codeblog.shawson.co.uk/machine-key-generator/' rel='bookmark' title='Machine Key Generator'>Machine Key Generator</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/iis-express-hanging-when-launched-from-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

