<?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>richard-slater.co.uk</title>
	<atom:link href="http://www.richard-slater.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.richard-slater.co.uk</link>
	<description>Jesus, Life, Programming and Systems Administration</description>
	<lastBuildDate>Mon, 02 Jan 2012 10:07:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Connect to VPN with Windows 7</title>
		<link>http://www.richard-slater.co.uk/archives/2011/07/11/connect-to-vpn-with-windows-7/</link>
		<comments>http://www.richard-slater.co.uk/archives/2011/07/11/connect-to-vpn-with-windows-7/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 16:30:05 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=961</guid>
		<description><![CDATA[Windows 7 and Windows Server 2008 R2 has some great new ways of connecting your road warriors and teleworkers to your network. For most of us Systems Administration types Routing and Remote Access is still the most common way of achieving this connectivity without DirectAccess. Because I have written this documentation up twice now for [...]]]></description>
			<content:encoded><![CDATA[<p>Windows 7 and Windows Server 2008 R2 has some <a href="http://technet.microsoft.com/en-us/network/dd420463">great new ways</a> of connecting your road warriors and teleworkers to your network. For most of us Systems Administration types Routing and Remote Access is still the most common way of achieving this connectivity without DirectAccess. Because I have written this documentation up twice now for two separate companies I thought it would be worth writing it a third time and placing it in the public domain for reference in the future.</p>
<p>The documentation assumes that the VPN End Point is Windows Server Routing and Remote Access, however the instructions work for a number of other vendors VPN end points.</p>
<p>What you will need:</p>
<ul>
<li>Windows 7.</li>
<li>A workplace with a compatible VPN End Point.</li>
<li>Your account enabled to use the VPN.</li>
<li>The IP address of your VPN End Point.</li>
<li>Your Username, Password and Domain.</li>
</ul>
<p><strong>1. Click the &#8220;Networking&#8221; tray icon</strong></p>
<p>It is a monitor with a network cable to the left of it, although quite understandably some users see it as a &#8220;monitor and a fork&#8221;:</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-01.png"><img class="aligncenter size-full wp-image-951" title="Windows7-VPN-01" src="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-01.png" alt="" width="252" height="39" /></a></p>
<p><strong>2. Go to Network and Sharing Center</strong></p>
<p>It is the link at the bottom of the popup you see after clicking the Networking tray icon.</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-02.png"><img class="aligncenter size-full wp-image-952" title="Windows7-VPN-02" src="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-02.png" alt="" width="310" height="190" /></a></p>
<p><strong>3. Click &#8220;Connect to a network&#8221;</strong></p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-03.png"><img src="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-03-300x230.png" alt="" title="Windows7-VPN-03" width="300" height="230" class="aligncenter size-medium wp-image-953" /></a></p>
<p><strong>4. Click &#8220;Connect to a workplace&#8221;</strong></p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-04.png"><img src="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-04-300x223.png" alt="" title="Windows7-VPN-04" width="300" height="223" class="aligncenter size-medium wp-image-954" /></a></p>
<p><strong>5. Click &#8220;Use my Internet connection (VPN)&#8221;</strong></p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-05.png"><img src="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-05-300x223.png" alt="" title="Windows7-VPN-05" width="300" height="223" class="aligncenter size-medium wp-image-955" /></a></p>
<p><strong>6. Enter your settings then click Next</strong></p>
<p>The &#8220;Internet address&#8221; is the four part IP address of your work place, your friendly help desk or company intranet should be able to provide this information. The destination name is purely a useful name for you to refer to your connection as I would suggest the name of your company.</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-06.png"><img src="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-06-300x223.png" alt="" title="Windows7-VPN-06" width="300" height="223" class="aligncenter size-medium wp-image-956" /></a></p>
<p><strong>7. Enter your Login details then click Next</strong></p>
<p>Chances are these Login details are going to be the same details you login to the computer with. Whilst the domain is labelled as optional it may be required for your workplace, again your IT Helpdesk or Intranet should be able to provide this to you.</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-07.png"><img src="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-07-300x223.png" alt="" title="Windows7-VPN-07" width="300" height="223" class="aligncenter size-medium wp-image-957" /></a></p>
<p><strong>8. Wait</strong></p>
<p>This bit can take a while, the VPN Client will connect to your workplace VPN send your login details then setup the connection.</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-08.png"><img src="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-08-300x223.png" alt="" title="Windows7-VPN-08" width="300" height="223" class="aligncenter size-medium wp-image-958" /></a></p>
<p><strong>9. Your Done!</strong></p>
<p>You may find that anything that was connected such as MSN Messenger has disconnected, it should eventually connect again however it will be done through your workplaces internet connection so beware what you are doing. You shouldn&#8217;t do what you shouldn&#8217;t do, get over it.</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-09..png"><img src="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-09.-300x223.png" alt="" title="Windows7-VPN-09." width="300" height="223" class="aligncenter size-medium wp-image-959" /></a></p>
<p><strong>10. Remember to disconnect (and how to reconnect)</strong></p>
<p>Remember that &#8220;Monitor and Fork&#8221; icon in the bottom right hand corner of your screen, if you click that you will be able to see that your new VPN connection is connected. Once you are done you can disconnect by clicking the connection then clicking &#8220;Disconnect&#8221;. You can reconnect in the future in a similar way, click the &#8220;Monitor and Fork&#8221; select the connection then click &#8220;Connect&#8221;.</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-10.png"><img src="http://www.richard-slater.co.uk/wp-content/uploads/2011/07/Windows7-VPN-10-224x300.png" alt="" title="Windows7-VPN-10" width="224" height="300" class="aligncenter size-medium wp-image-960" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2011/07/11/connect-to-vpn-with-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Orchard Placement ID Strings Must Match</title>
		<link>http://www.richard-slater.co.uk/archives/2011/05/31/orchard-placement-id-strings-must-match/</link>
		<comments>http://www.richard-slater.co.uk/archives/2011/05/31/orchard-placement-id-strings-must-match/#comments</comments>
		<pubDate>Tue, 31 May 2011 19:12:04 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=943</guid>
		<description><![CDATA[I spent far too long trying to fix a error while developing an Orchard Module. To explain further Orchard CMS derives a lot of its flexibility by representing content in highly abstracted terms called shapes, these shapes are dispatched by the module that wishes to output content then rendered at the end. In between these [...]]]></description>
			<content:encoded><![CDATA[<p>I spent far too long trying to fix a error while developing an Orchard Module. To explain further Orchard CMS derives a lot of its flexibility by representing content in highly abstracted terms called shapes, these shapes are dispatched by the module that wishes to output content then rendered at the end. In between these shapes can be manipulated by themes or modules to change how the information is displayed. It takes a while to get your head around it, but its a great system&#8230; <em>until you make a mistake!</em></p>
<p>Modules define where shapes are placed through a file called <strong>placement.info</strong> your module dispatches shapes through it&#8217;s Driver (a class inherited from ContentPartDriver<t>)</p>
<pre>
public class DefinitionListPartDriver : ContentPartDriver&lt;DefinitionListPart&gt; {

    ...

    protected override DriverResult Display(
        DefinitionListPart part,
        string displayType,
        dynamic shapeHelper) {

        return ContentShape("Parts_DefinititionList",
            () => shapeHelper.Parts_DefinitionList(
                        ContentPart: part,
                        DefinitionList: part.Entries));
    }

    ...

}
</pre>
<p>You may have seen the mistake already, but just in case your not sure here is my placement.info file:</p>
<pre>
&lt;Placement&gt;
    &lt;Place Parts_DefinitionList_Edit=&quot;Content:11&quot;/&gt;
    &lt;Place Parts_DefinitionList=&quot;Content:11&quot;/&gt;
&lt;/Placement&gt;
</pre>
<p>Yep, when I dispatched the shape it had an extra it in Definition&#8230; oh well, remember to check that first next time.</t></p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2011/05/31/orchard-placement-id-strings-must-match/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Responsive Design for Programmers</title>
		<link>http://www.richard-slater.co.uk/archives/2011/03/30/responsive-design-for-programmers/</link>
		<comments>http://www.richard-slater.co.uk/archives/2011/03/30/responsive-design-for-programmers/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 15:23:09 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=933</guid>
		<description><![CDATA[Responsive Design is a term that seems to have risen up around me over the course of the last year. Up to this point I have been largely unaware of what it meant other than had a good deal to do with designing markup and CSS for the mobile platform. Today I thought I would [...]]]></description>
			<content:encoded><![CDATA[<p>Responsive Design is a term that seems to have risen up around me over the course of the last year. Up to this point I have been largely unaware of what it meant other than had a good deal to do with designing markup and CSS for the mobile platform. Today I thought I would spend a couple of hours researching the topic, I have included some of the best articles and post I could find.</p>
<p><strong><a href="http://www.alistapart.com/articles/responsive-web-design/">A List Apart&#8217;s Responsive Design Article</a></strong></p>
<p>Key points I took away from this article are; the plethora of screen resolutions and orientations on the web is an advantage not a disadvantage. Mobile continues to rise in both business and the social web. Media queries are a neat implementation for modern browsers (IE9, Chrome, Safari 3+, Firefox 3.5+) with a practicable JavaScript backup for non compliant browsers.</p>
<p><strong><a href="http://www.cloudfour.com/css-media-query-for-mobile-is-fools-gold/">CloudFour&#8217;s CSS Media Query for Mobile is Fool&#8217;s Gold Blog Post</a></strong></p>
<p>This is quite a pragmatic stance on using Media Queries for the mobile platform as a direct response the aforementioned article from A List Apart. Key points for me were performance, specifically speed are very important for Mobile. The common use case for a mobile website is to find something quickly, waiting for large images and style sheets affects this performance. There are now low-power smartphones without the CPU power, resizing images in-browser does not work. There is a <a href="http://www.quirksmode.org/blog/archives/2010/08/combining_media.html">good response</a> on Quirksmode.</p>
<p><strong><a href="http://www.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/">Smashing Magazine&#8217;s Guidelines for Responsive Web Design Article</a></strong></p>
<p>Kayla Knight goes into depth into the techniques and technologies that front end web developers have at their hands. There is a lot to take in in this article, and some great examples of responsive web design out in the wild. <a href="http://adactio.com/journal/1699/">Further</a> <a href="http://adactio.com/journal/1696/">examples</a> and discussion can be found on Adactio.</p>
<p><strong><a href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/03/22/targeting-mobile-optimized-css-at-windows-phone-7.aspx">Windows Team Blog&#8217;s Targeting mobile optimized CSS at Windows Phone 7 Post</a></strong></p>
<p>This was the article that kicked me off on my research spree this afternoon. I was seriously disappointed by Windows Phone 7&#8242;s 19/400 score on HTML5 test so I didn&#8217;t hold out much hope for support for CSS3 and Media Queries this article didn&#8217;t do much to reassure me. Microsoft advise going down the route of conditional HTML comments to import the correct style sheet for the platform you require.</p>
<p><strong>Conclusion</strong></p>
<p>Not being a &#8220;Front End&#8221; developer, I may never have to put any of this into practice however now I know more than when I started I can follow along when the design team talks about responsive design. If you know of any other resources or articles, please post them in the comments for me to read. If I find them useful I will update this post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2011/03/30/responsive-design-for-programmers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>2010 Blogging Year In Review</title>
		<link>http://www.richard-slater.co.uk/archives/2010/12/31/2010-blogging-year-in-review/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/12/31/2010-blogging-year-in-review/#comments</comments>
		<pubDate>Fri, 31 Dec 2010 14:38:18 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=921</guid>
		<description><![CDATA[I try to do this post every year as it gives me an idea of where my readers come from and what they are looking at. My blog is consistently getting 100+ unique visitors per day, most of these are new visitors who have found a blog post via organic search results (Google, Yahoo!, etc), [...]]]></description>
			<content:encoded><![CDATA[<p>I try to do this post every year as it gives me an idea of where my readers come from and what they are looking at. My blog is consistently getting 100+ unique visitors per day, most of these are new visitors who have found a blog post via organic search results (Google, Yahoo!, etc), with a smaller number having found me through links from other sites or directly into the site.</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/12/2010VisitsVsNewVisits.png"><img class="aligncenter size-full wp-image-922" title="2010VisitsVsNewVisits" src="http://www.richard-slater.co.uk/wp-content/uploads/2010/12/2010VisitsVsNewVisits.png" alt="" width="593" height="145" /></a></p>
<p>The most popular article by far has been <a title="Change your MTU in Vista and Windows 7" href="http://www.richard-slater.co.uk/archives/2009/10/23/change-your-mtu-under-vista-or-windows-7/">Change your MTU in Vista and Windows 7</a>, this is in no small part because I have written one of the few articles that explains the method to identify your ideal MTU, not just the command to change it. The next most popular article is another one from last year titled <a href=" /archives/2009/10/26/card-reader-on-acer-aspire-5100-serie-under-windows-7/ ">Card Reader on Acer Aspire 5100 Series under Windows 7</a> and my explanation of obtaining an <a href="http://www.richard-slater.co.uk/archives/2010/10/07/elevated-command-prompt/">Elevated Command Prompt in Windows 7</a> comes in at number 5. With the top two entries centred around fixing problems with Windows 7 this suggests more people are interested in getting their computer working than programming, ho hum.</p>
<p>My review of <a href="http://www.richard-slater.co.uk/archives/2010/02/27/onenote-vs-evernote/">OneNote and Evernote</a> has been fairly popular, as has my review of <a href="http://www.richard-slater.co.uk/archives/2008/08/02/center-parcs-longleat-forrest/">Center Parcs from 2008</a>. I shall try and review products and holidays as I go along, although I am reguarly stuck for inspiration in these terms.</p>
<p><strong>Visitor Breakdown</strong></p>
<ul>
<li>iPhone/iPad/iPod are the most popular mobile platforms to view my site with over three times as many visitors using iOS than Android.</li>
<li>Most popular Browser is Firefox with 40% of the share, IE comes in at 33% and Chrome at 17.5%, strangely Opera has a 4.3% share &#8211; I was under the impression that Opera&#8217;s market share has been dropping off.</li>
<li>Windows holds 95% of the operating system share, presumably the result of my Windows 7 posts.</li>
</ul>
<p><strong>Keywords</strong></p>
<p>Unsurprisingly the most of the searches are for &#8220;windows 7 mtu&#8221; or similar. There also appear to be quite a few people searching for drivers by Googling device strings, this can work well, although in the first instance you should try <a href="http://www.pcidatabase.com/">PCI Database</a>. Further down the list a couple of people have been searching for MSM/PSL which is the prescribed acronym for making a manovure as taught by the DSA, there are some good resources all over the internet including <a href="http://www.smartlearners.co.uk/tips/routine.htm">Smart Learners</a>.</p>
<p>Someone has been searching for me on LinkedIn, it may not have been me you were looking for but here is <a href="http://www.linkedin.com/profile/view?id=46241161">my profile</a> for reference purposes.</p>
<p>One user got to my site looking for an answer to the question &#8220;windows 7 what are the blue &amp; yellow shields on desktop shortcut icons for&#8221;; unsure what it was for but these icons describe executables or shortcuts that either contain information in their manifest or have had their properties changes to require administration rights to execute. There are quite a few posts on social.microsoft.com but very little explaining exactly why they are there.</p>
<p>There don&#8217;t seem to be any funny keyword sequences any more (I looked through all 7,000 from 2010), maybe some will show up next year. So until 2011, good bye and have a happy new year!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/12/31/2010-blogging-year-in-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Listing Table Sizes</title>
		<link>http://www.richard-slater.co.uk/archives/2010/12/24/listing-table-sizes/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/12/24/listing-table-sizes/#comments</comments>
		<pubDate>Fri, 24 Dec 2010 10:20:09 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sys. Admin.]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=867</guid>
		<description><![CDATA[Databases are a pain in the neck to look after, poorly designed models and processes that don&#8217;t remove temporary data can cause a database to grow in size. A database that is allowed to grow large beyond its requirements becomes a burden on the nightly backup, takes longer to restore in the event of a recovery scenario [...]]]></description>
			<content:encoded><![CDATA[<p>Databases are a pain in the neck to look after, poorly designed models and processes that don&#8217;t remove temporary data can cause a database to grow in size. A database that is allowed to grow large beyond its requirements becomes a burden on the nightly backup, takes longer to restore in the event of a recovery scenario and slows down the development process by preventing developers from testing things out on &#8220;live&#8221; data.</p>
<p>More often than not I have found that the problem lies with log or analytic tables sometimes this information is liberally logged (which it should be) and then totally ignored without a thought for trimming the data on a regular basis.</p>
<p>SQL Server Management Studio provides a way of looking at the storage usage of tables individually from the properties context menu item of the table.</p>
<p style="text-align: center;"><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/SSMSStorageProperties.png"><img class="aligncenter size-full wp-image-868" title="SSMS Storage Properties" src="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/SSMSStorageProperties.png" alt="SSMS Storage Properties" width="394" height="354" /></a></p>
<p>In large databases this can be laborious, I found <a href="http://www.cryer.co.uk/brian/sqlserver/howto_list_table_sizes.htm">a script</a> that will collect this information and present it as a table. I have adapted it a little so that I can see the total size of the table and sort by each column to drill down to the problem tables.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SET</span> NOCOUNT <span style="color: #993333; font-weight: bold;">ON</span>
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> #spaceused <span style="color: #66cc66;">&#40;</span>
  name nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">120</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">ROWS</span> <span style="color: #993333; font-weight: bold;">CHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  reserved <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">18</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">DATA</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">18</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  index_size <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">18</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  unused <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">18</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">DECLARE</span> TablesFromSysObjects CURSOR <span style="color: #993333; font-weight: bold;">FOR</span>
  <span style="color: #993333; font-weight: bold;">SELECT</span> name
  <span style="color: #993333; font-weight: bold;">FROM</span> sysobjects <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #993333; font-weight: bold;">TYPE</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'U'</span>
  <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> name <span style="color: #993333; font-weight: bold;">ASC</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">OPEN</span> TablesFromSysObjects
<span style="color: #993333; font-weight: bold;">DECLARE</span> @<span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">128</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
FETCH <span style="color: #993333; font-weight: bold;">NEXT</span> <span style="color: #993333; font-weight: bold;">FROM</span> TablesFromSysObjects <span style="color: #993333; font-weight: bold;">INTO</span> @<span style="color: #993333; font-weight: bold;">TABLE</span>
&nbsp;
WHILE @@FETCH_STATUS <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>
<span style="color: #993333; font-weight: bold;">BEGIN</span>
  <span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> #spaceused <span style="color: #993333; font-weight: bold;">EXEC</span> sp_spaceused @<span style="color: #993333; font-weight: bold;">TABLE</span>
  FETCH <span style="color: #993333; font-weight: bold;">NEXT</span> <span style="color: #993333; font-weight: bold;">FROM</span> TablesFromSysObjects <span style="color: #993333; font-weight: bold;">INTO</span> @<span style="color: #993333; font-weight: bold;">TABLE</span>
<span style="color: #993333; font-weight: bold;">END</span>
&nbsp;
CLOSE TablesFromSysObjects
DEALLOCATE TablesFromSysObjects 
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span>	name <span style="color: #993333; font-weight: bold;">AS</span> TableName<span style="color: #66cc66;">,</span>
		<span style="color: #993333; font-weight: bold;">ROWS</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">ROWS</span><span style="color: #66cc66;">,</span>
		<span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span>reserved<span style="color: #66cc66;">,</span> LEN<span style="color: #66cc66;">&#40;</span>reserved<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> Reserved<span style="color: #66cc66;">,</span>
		<span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color: #66cc66;">,</span> LEN<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">DATA</span><span style="color: #66cc66;">,</span>
		<span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span>index_size<span style="color: #66cc66;">,</span> LEN<span style="color: #66cc66;">&#40;</span>index_size<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> IndexSize<span style="color: #66cc66;">,</span>
		<span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span>unused<span style="color: #66cc66;">,</span> LEN<span style="color: #66cc66;">&#40;</span>unused<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> Unused<span style="color: #66cc66;">,</span>
		<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span>reserved<span style="color: #66cc66;">,</span> LEN<span style="color: #66cc66;">&#40;</span>reserved<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color: #66cc66;">,</span> LEN<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span>index_size<span style="color: #66cc66;">,</span> LEN<span style="color: #66cc66;">&#40;</span>index_size<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span>unused<span style="color: #66cc66;">,</span> LEN<span style="color: #66cc66;">&#40;</span>unused<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> Total
<span style="color: #993333; font-weight: bold;">FROM</span> #spaceused
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> Total <span style="color: #993333; font-weight: bold;">DESC</span>
<span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> #spaceused</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/12/24/listing-table-sizes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ordinance Survey OpenData (Part 3 &#8211; Cleaning Up)</title>
		<link>http://www.richard-slater.co.uk/archives/2010/12/17/ordinance-survey-opendata-part-3-cleaning-up/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/12/17/ordinance-survey-opendata-part-3-cleaning-up/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 15:55:38 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sys. Admin.]]></category>
		<category><![CDATA[OpenData]]></category>
		<category><![CDATA[Ordinance Survey]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=882</guid>
		<description><![CDATA[If you look through the schema of the table we imported in Part 2 there are a number of unused fields and some of the data appears to be missing. Cleaning up the Schema You can go right ahead and remove the fields that start with &#8220;Unused&#8221; as far as I can tell the full [...]]]></description>
			<content:encoded><![CDATA[<p>If you look through the schema of the table we imported in <a href="http://www.richard-slater.co.uk/archives/2010/12/10/ordinance-survey-opendata-part-2-importing-the-data/">Part 2</a> there are a number of unused fields and some of the data appears to be missing.</p>
<h2>Cleaning up the Schema</h2>
<ol>
<li>You can go right ahead and remove the fields that start with &#8220;Unused&#8221; as far as I can tell the full version of Code-Point uses these fields.</li>
<li>Remove the nullable attributes from all of the fields, this will prevent us from doing something silly at a later date, and will avoid Object Relational Mappers such as Entity Framework from creating nullable data types.</li>
<li>Many of the fields contain codes not data itself but codes that describe other data, so lets prepend code on the end of those fields for the time being.</li>
</ol>
<h2>Cleaning up the Data</h2>
<p>The quality column in Code-Point Open describes the source and reliability of the data, it ranges from the most accurate 10 through to no data 90, when building a system around this data you need to decide at what data is important to your use case. The following query will give you an idea of the quality of the dataset as a whole, I have annotated it based upon the <a href="http://www.ordnancesurvey.co.uk/oswebsite/products/code-point-open/">OS Code-Point documentation</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> Quality<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">COUNT</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">COUNT</span>
<span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>OSOpenData<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>CodePointOpenCombined<span style="color: #66cc66;">&#93;</span>
<span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> Quality
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> Quality</pre></div></div>

<table>
<tbody>
<tr>
<th>Quality</th>
<th>Count</th>
<th>Description</th>
</tr>
<tr>
<td>10</td>
<td>1683975</td>
<td>Within the building of the matched address closest to the postcode mean determined automatically by Ordnance Survey.</td>
</tr>
<tr>
<td>20</td>
<td>73</td>
<td>As above, but determined to visual inspection by GROS (General Register Office for Scotland).</td>
</tr>
<tr>
<td>30</td>
<td>1086</td>
<td>Approximate to within 50 m of true position.</td>
</tr>
<tr>
<td>40</td>
<td>52</td>
<td>The mean of the positions of addresses previously matched in ADDRESS-POINT but which have subsequently been deleted or recoded.</td>
</tr>
<tr>
<td>50</td>
<td>4395</td>
<td>Estimated position based on surrounding postcode coordinates, usually to 100 m resolution, but 10 min Scotland.</td>
</tr>
<tr>
<td>60</td>
<td>93</td>
<td>Postcode sector mean (direct copy from ADDRESS-POINT).</td>
</tr>
<tr>
<td>90</td>
<td>6361</td>
<td>No coordinates available.</td>
</tr>
</tbody>
</table>
<p>For my purposes I want to use the coordinate data stored in the Eastings and Northings columns, which makes postcodes with no data useless to me, I can remove these with the following SQL script:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>CodePointOpenCombined<span style="color: #66cc66;">&#93;</span>
<span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#91;</span>Quality<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">90</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/12/17/ordinance-survey-opendata-part-3-cleaning-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ordinance Survey OpenData (Part 2 &#8211; Importing The Data)</title>
		<link>http://www.richard-slater.co.uk/archives/2010/12/10/ordinance-survey-opendata-part-2-importing-the-data/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/12/10/ordinance-survey-opendata-part-2-importing-the-data/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 14:26:53 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sys. Admin.]]></category>
		<category><![CDATA[OpenData]]></category>
		<category><![CDATA[Ordinance Survey]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=878</guid>
		<description><![CDATA[All of the data is in different files; SSIS is capable of extracting data from multiple files however for the purposes of this article I am going to stick to the Import Export Wizard. To combine all of the files into one (big) file a quick switch to the command prompt is required: type data\*.csv [...]]]></description>
			<content:encoded><![CDATA[<p>All of the data is in different files; SSIS is capable of extracting data from multiple files however for the purposes of this article I am going to stick to the Import Export Wizard.</p>
<p>To combine all of the files into one (big) file a quick switch to the command prompt is required:</p>
<pre>type data\*.csv &gt; .\CodePointOpenCombined.csv</pre>
<p>Because none of the data files have headers this works fine, if they did have headers some work would be needed to strip those out.</p>
<p>Create a new database in SQL Server then follow these steps:</p>
<ol>
<li>Right Click the Database select &#8220;Tasks&#8221; &#8211; &#8220;Import Data&#8221;.</li>
<li>In the Data Source step change the drop down to &#8220;Flat File Source&#8221;.</li>
<li>Select the combined file we created above (you may have to change the filter).</li>
<li>Check the Columns page if Quotation Marks (&#8220;) appear in some of the columns change the Text qualifier field on the General Page to a &#8220;.</li>
<li>On the Advanced page click Suggest Types.</li>
<li>Set the number of rows to 1000 (the maximum), then click OK.</li>
<li>Go through each column and update the name and DataType to match those we discovered in the <a href="http://www.richard-slater.co.uk/archives/2010/12/03/ordinance-survey-opendata-part1-schema-scanne/">previous post</a>.</li>
<li>Check the correct database and table are selected on the next two steps.</li>
<li>Click Next then Next again, then check over the data type mappings.</li>
<li>Click Next then ensure Run immediately is checked then click finish.</li>
<li>All being well, all of the data will be imported successfully.</li>
</ol>
<p>If there are problems importing the data you can go back and make changes to the configuration, typically the issue is incorrect data types (too small) or incorrect text delimiters.</p>
<p>You may be asking why we went to tall that trouble, and time, only to let the Import Data Wizard suggest the data types. The reason I wrote the script was the wizard is limited to checking the first 1,000 lines; even if you set the value to 2,000,000 it will default down to 1000 after you move your focus away.</p>
<p>The result being if your data is naturally sorted on a specific column as some of the Ordinance Survey data appears to be the import will fail. Running the schema scanner allows you to scan through all of the data so that you can modify the suggested data types to match the maximum values.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/12/10/ordinance-survey-opendata-part-2-importing-the-data/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ordinance Survey OpenData (Part 1 &#8211; Schema Scanner)</title>
		<link>http://www.richard-slater.co.uk/archives/2010/12/03/ordinance-survey-opendata-part1-schema-scanne/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/12/03/ordinance-survey-opendata-part1-schema-scanne/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 15:49:32 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sys. Admin.]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[OpenData]]></category>
		<category><![CDATA[Ordinance Survey]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=873</guid>
		<description><![CDATA[In April 2010 the Ordinance Survey released certain parts of their data under special licence which allows for commercial use without cost. All the types of data made available are outside the scope of this post although I hope that the techniques described could be applied to any data set not limited to Ordinance Survey [...]]]></description>
			<content:encoded><![CDATA[<p>In April 2010 the Ordinance Survey released certain parts of their data under special licence which allows for commercial use without cost. All the types of data made available are outside the scope of this post although I hope that the techniques described could be applied to any data set not limited to Ordinance Survey data.</p>
<p>In this post I am going to look at <a href="http://www.ordnancesurvey.co.uk/oswebsite/products/code-point-open/">Code-Point Open</a>, a list of all UK postcodes with their corresponding spatial positions. Unlike many other OS OpenData downloads the ZIP file does not contain the User Guide or the Schema Data, this can be found on the website, I spent a good 10 minutes searching for this data.</p>
<p>The term for what we are doing in this post is Extract-Transform -Load (ETL), a process in which we take data in one format and covert it for use in another format. Generally ETL is used to take a flat file format and load it for use in a relational database, although technically any format or database could be used. SQL Server offers two built-in mechanisms to perform ETL; the &#8220;Import Export Wizard&#8221; and SQL Server Integration Services (SSIS). The &#8220;Import Export Wizard&#8221; actually creates a SSIS package in the background and is available to all versions of SQL Server, SSIS  is not available in SQL Express.</p>
<p>Before we create a table in a SQL Server Database we need to know something about the data we are importing, the documentation for Code-Point Open tells us the data contains the following fields:</p>
<p><strong>Postcode</strong>, <strong>Quality</strong>, Unused1, Unused2, Unused3, Unused4, Unused5, Unused6, Unused7, Unused8, <strong>Eastings</strong>, <strong>Northings</strong>, <strong>CountryCode</strong>, <strong>RegionalHealthAuthority</strong>, <strong>HealthAuthority</strong>, <strong>AdminCounty</strong>, <strong>AdminDistrict</strong>, <strong>AdminWard</strong>, Unused10</p>
<p>A number of the fields are not used, the fields and the dummy data held within them will be weeded out at a later date, we know the fields but we don&#8217;t know the format of the data it contains, it could be numeric, strings, decimals, telephone numbers? I created a PowerShell script which scans through all of these files to work out what type of field it is and the range of data held within it, be warned it will take a few hours to run!</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;"># Schema Scanner v1.0</span>
<span style="color: #008000;"># ©2010 Richard Slater</span>
&nbsp;
<span style="color: #008000;"># Create an empty hash table</span>
<span style="color: #800080;">$columns</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;"># Loop through every file that matches this pattern</span>
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$file</span> <span style="color: #0000FF;">in</span> <span style="color: #008080; font-weight: bold;">Get-ChildItem</span> <span style="color: #008080; font-style: italic;">-Path</span> <span style="color: #800000;">&quot;D:\OSOpenData\Code-Point Open\data\ze.csv&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Processing $file&quot;</span>
&nbsp;
	<span style="color: #008000;"># PowerShell Import-Csv cmdlet is pretty powerful, but if there is no header row you must feed it in</span>
	<span style="color: #800080;">$PostCodeData</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Import-Csv</span> <span style="color: #800080;">$file</span> <span style="color: pink;">-</span>Header <span style="color: #800000;">&quot;Postcode&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Quality&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Unused1&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Unused2&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Unused3&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Unused4&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Unused5&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Unused6&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Unused7&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Unused8&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Eastings&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Northings&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;CountryCode&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;RegionalHealthAuthority&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;HealthAuthority&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;AdminCounty&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;AdminDistrict&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;AdminWard&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;Unused10&quot;</span>
&nbsp;
	<span style="color: #008000;"># Go through each row in the file</span>
	<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$row</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$PostCodeData</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
		<span style="color: #008000;"># Go through each column in the row</span>
		<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$attr</span> <span style="color: #0000FF;">in</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Get-Member</span> <span style="color: #008080; font-style: italic;">-InputObject</span> <span style="color: #800080;">$PostCodeData</span><span style="color: #000000;">&#91;</span><span style="color: #804000;">0</span><span style="color: #000000;">&#93;</span> <span style="color: #008080; font-style: italic;">-MemberType</span> NoteProperty<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #800080;">$key</span> <span style="color: pink;">=</span> <span style="color: #800080;">$attr</span>.Name
&nbsp;
			<span style="color: #008000;"># Ignore unused columns</span>
			<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$key</span>.StartsWith<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Unused&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
				<span style="color: #000000;">&#123;</span> <span style="color: #0000FF;">continue</span> <span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #008000;"># Construct an object to store the meta data, store it in the hash table to retreive next loop</span>
			<span style="color: #800080;">$column</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> PSObject
			<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: pink;">!</span><span style="color: #800080;">$columns</span>.ContainsKey<span style="color: #000000;">&#40;</span><span style="color: #800080;">$key</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #800080;">$column</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Add-Member</span> <span style="color: pink;">-</span><span style="color: #008080; font-weight: bold;">Type</span> NoteProperty <span style="color: #008080; font-style: italic;">-Name</span> StringLength <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #804000;">0</span>
				<span style="color: #800080;">$column</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Add-Member</span> <span style="color: pink;">-</span><span style="color: #008080; font-weight: bold;">Type</span> NoteProperty <span style="color: #008080; font-style: italic;">-Name</span> MaxValue <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>System.Int32<span style="color: #000000;">&#93;</span>::MinValue<span style="color: #000000;">&#41;</span>
				<span style="color: #800080;">$column</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Add-Member</span> <span style="color: pink;">-</span><span style="color: #008080; font-weight: bold;">Type</span> NoteProperty <span style="color: #008080; font-style: italic;">-Name</span> MinValue <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>System.Int32<span style="color: #000000;">&#93;</span>::MaxValue<span style="color: #000000;">&#41;</span>
				<span style="color: #800080;">$columns</span>.Add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$key</span><span style="color: pink;">,</span> <span style="color: #800080;">$column</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0000FF;">else</span>
				<span style="color: #000000;">&#123;</span> <span style="color: #800080;">$column</span> <span style="color: pink;">=</span> <span style="color: #800080;">$columns</span>.Get_Item<span style="color: #000000;">&#40;</span><span style="color: #800080;">$key</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #800080;">$isInt</span> <span style="color: pink;">=</span> <span style="color: #800080;">$false</span>
			<span style="color: #800080;">$value</span> <span style="color: pink;">=</span> <span style="color: #804000;">0</span>;
&nbsp;
			<span style="color: #008000;"># Work out if this is an integer type</span>
			<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>System.Int32<span style="color: #000000;">&#93;</span>::TryParse<span style="color: #000000;">&#40;</span><span style="color: #800080;">$row</span>.<span style="color: #000000;">&#40;</span><span style="color: #800080;">$key</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span> <span style="color: #000000;">&#91;</span><span style="color: #008080;">ref</span><span style="color: #000000;">&#93;</span> <span style="color: #800080;">$value</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
            	<span style="color: #000000;">&#123;</span> <span style="color: #800080;">$isInt</span> <span style="color: pink;">=</span> <span style="color: #800080;">$true</span> <span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: pink;">!</span><span style="color: #800080;">$isInt</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
				<span style="color: #008000;"># it is not an integer how many characters is the string</span>
            	<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$row</span>.<span style="color: #000000;">&#40;</span><span style="color: #800080;">$key</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>.Length <span style="color: #FF0000;">-gt</span> <span style="color: #800080;">$column</span>.StringLength<span style="color: #000000;">&#41;</span>
                	<span style="color: #000000;">&#123;</span> <span style="color: #800080;">$column</span>.StringLength <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$row</span>.<span style="color: #000000;">&#40;</span><span style="color: #800080;">$key</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>.Length <span style="color: #000000;">&#125;</span>
&nbsp;
				<span style="color: #0000FF;">continue</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #008000;"># it is an integer start working out the maximum and minimum values</span>
			<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #800080;">$value</span> <span style="color: #FF0000;">-gt</span> <span style="color: #800080;">$column</span>.MaxValue <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #800080;">$column</span>.MaxValue <span style="color: pink;">=</span> <span style="color: #800080;">$value</span> <span style="color: #000000;">&#125;</span>
			<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #800080;">$value</span> <span style="color: #FF0000;">-lt</span> <span style="color: #800080;">$column</span>.MinValue <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #800080;">$column</span>.MinValue <span style="color: pink;">=</span> <span style="color: #800080;">$value</span> <span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #800080;">$columns</span>.Set_Item<span style="color: #000000;">&#40;</span><span style="color: #800080;">$key</span><span style="color: pink;">,</span> <span style="color: #800080;">$column</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;"># Print a report of all of the fields</span>
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$field</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$columns</span>.Keys<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$stringLength</span> <span style="color: pink;">=</span> <span style="color: #800080;">$columns</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$field</span><span style="color: #000000;">&#93;</span>.StringLength
	<span style="color: #800080;">$numericMax</span> <span style="color: pink;">=</span> <span style="color: #800080;">$columns</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$field</span><span style="color: #000000;">&#93;</span>.MaxValue
	<span style="color: #800080;">$numericMin</span> <span style="color: pink;">=</span> <span style="color: #800080;">$columns</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$field</span><span style="color: #000000;">&#93;</span>.MinValue
&nbsp;
	<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$stringLength</span> <span style="color: #FF0000;">-gt</span> <span style="color: #804000;">0</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;$field (String) : Length =&quot;</span> <span style="color: #800080;">$columns</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$field</span><span style="color: #000000;">&#93;</span>.StringLength
	<span style="color: #000000;">&#125;</span>
	<span style="color: #0000FF;">elseif</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$numericMax</span> <span style="color: #FF0000;">-gt</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>System.Int32<span style="color: #000000;">&#93;</span>::MinValue<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-and</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$numericMin</span> <span style="color: #FF0000;">-lt</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>System.Int32<span style="color: #000000;">&#93;</span>::MaxValue<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;$field (Numeric) : MaxValue =&quot;</span> <span style="color: #800080;">$numericMax</span> <span style="color: #800000;">&quot;, MinValue =&quot;</span> <span style="color: #800080;">$numericMin</span>
	<span style="color: #000000;">&#125;</span>
	<span style="color: #0000FF;">else</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;$field (Empty)&quot;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The output from the script should give you enough information to construct a nice tight schema to import the data:</p>
<pre>AdminWard (String) : Length = 2
AdminDistrict (String) : Length = 2
AdminCounty (Numeric) : MinValue = 0 , MaxValue = 47
Quality (Numeric) :  MinValue = 10 , MaxValue = 90
RegionalHealthAuthority (String) : Length = 3
Postcode (String) : Length = 7
Eastings (Numeric) : MinValue = 0 , MaxValue = 655448
Northings (Numeric) : MinValue = 0 , MaxValue = 1213660
CountryCode (Numeric) : = 64 ,  MaxValue   = 220
HealthAuthority (String) : Length = 3</pre>
<p>In a future post I am going to take it to the next stage; create a table and complete the import with the Import Export Wizard. I would also like to improve the performance of the schema scanner by converting the code into C#.</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/12/SchemaScanner.zip">SchemaScanner</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/12/03/ordinance-survey-opendata-part1-schema-scanne/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Things to listen to on the way to work</title>
		<link>http://www.richard-slater.co.uk/archives/2010/11/19/things-to-listen-to-on-the-way-to-work/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/11/19/things-to-listen-to-on-the-way-to-work/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 20:23:06 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Diary]]></category>
		<category><![CDATA[Podcasts]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=437</guid>
		<description><![CDATA[I spend about an hour and a half on the bus every day commuting to and from work. It was a huge boon for me when I got my HTC Desire as it opened up the world of Google Listen. I wanted to go through some of the Podcasts that I listen to in the [...]]]></description>
			<content:encoded><![CDATA[<p>I spend about an hour and a half on the bus every day commuting to and from work. It was a huge boon for me when I got my HTC Desire as it opened up the world of <a href="http://listen.googlelabs.com/">Google Listen</a>.</p>
<p>I wanted to go through some of the Podcasts that I listen to in the hope that someone else in my position can enjoy them and hopefuly learn as much from them as I have:</p>
<p><strong>Software Development / Programming</strong></p>
<ul>
<li><a href="http://www.dotnetrocks.com/">DotNetRocks</a> &#8211; one of the best produced .NET podcasts out there, Carl Franklin and Richard Campbell. All topics related to the .NET Platform and software development in general.</li>
<li><a href="http://www.hanselminutes.com/">Hanselminutes</a> &#8211; Scott Hanselman is a Microsoft Developer, Family Man and general Geek, podcasts are of a concise and casual nature covering mainly programming matters, but sometimes branching out into other areas of Scott&#8217;s interests.</li>
<li><a href="http://herdingcode.com">Herding Code</a> &#8211; kind of reminds me of the Spanish Inquisition (which I remember well&#8230;) many hosts one topic or guest. The shows can be a little long.</li>
<li><a href="http://blogs.sitepoint.com/category/podcast/">SitePoint Podcast</a> &#8211; a fairly new addition to my listening list, I am not convinced on the format but there have been some good shows.</li>
<li><a href="http://www.sparklingclient.com/">Sparkling Client</a> &#8211; is short, really short. Which is great as the information is presented clearly and quickly, very programmer like. Makes me happy to see it appear on my List.</li>
</ul>
<p><strong>Entertainment</strong></p>
<ul>
<li><a href="http://thisdeveloperslife.com/">This Developers Life</a> - modelled after This American Life some podcast I have never heard of, hosted by Scott Hanselman and Rob Conery; it is different, it&#8217;s not information its about experience it is also fairly new and has music.</li>
<li><a href="http://">Escape Pod</a> &#8211; Sci-Fi podcast and blog, what can I say&#8230; I love Sci-Fi. Have a listen some of the stories are absolutely fantastic, well worth a listen.</li>
</ul>
<p>So if you have the time to try some of these give them a go, let me know what you think and what else you find.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/11/19/things-to-listen-to-on-the-way-to-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SteamBirds</title>
		<link>http://www.richard-slater.co.uk/archives/2010/11/19/steambirds/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/11/19/steambirds/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 12:16:42 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Things You Find]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=894</guid>
		<description><![CDATA[Danc gave those who read LostGarden a heads up that Spry Fox was releasing SteamBirds for the Android platform. I have been watching Spry Fox since Dan mentioned it on Lost Garden. Due to being plain busy (no pun intended) I never got a chance to try SteamBirds on the web. Now it is on my phone [...]]]></description>
			<content:encoded><![CDATA[<p>Danc gave those who read LostGarden a heads up that Spry Fox was releasing <a href="http://www.steambirds.com/">SteamBirds</a> for the <a href="http://www.lostgarden.com/2010/11/steambirds-now-out-for-iphone-ipad-and.html">Android platform</a>. I have been watching <a href="http://www.spryfox.com/">Spry Fox</a> since Dan mentioned it on Lost Garden. Due to being plain busy (no pun intended) I never got a chance to try SteamBirds on the web. Now it is on my phone I get a chance to play it while on the bus!</p>
<p style="text-align: center;"><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/SteamBirds.png"><img class="aligncenter size-full wp-image-896" title="SteamBirds" src="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/SteamBirds.png" alt="" width="480" height="288" /></a></p>
<p style="text-align: left;">The premise is you are flying a nuclear-powered steam driven air plane. I encourage you to read the embeded back-story in the initial levels, it is great to see good writing has gone in with the game.</p>
<p style="text-align: center;"><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/SteamBirds2.png"><img class="aligncenter size-full wp-image-897" title="SteamBirds2" src="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/SteamBirds2.png" alt="" width="480" height="288" /></a></p>
<p style="text-align: left;">The game is turn based, you control your planes by selecting the type of manoeuvre then dragging navigation icon to the location you wish the plane to be at the next turn; the black line shows the path your plane will take.</p>
<p style="text-align: center;"><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/SteamBirds3.png"><img class="aligncenter size-full wp-image-898" title="SteamBirds3" src="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/SteamBirds3.png" alt="" width="480" height="288" /></a></p>
<p style="text-align: left;">If you tap your plane you see the name, health, stats and the manoeuvres it is capable of, as you have probably gathered by now the concept is to shoot down the other teams.</p>
<p style="text-align: center;"><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/SteamBirds4.png"><img class="aligncenter size-full wp-image-899" title="SteamBirds4" src="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/SteamBirds4.png" alt="" width="480" height="288" /></a></p>
<p style="text-align: left;">The healthier you keep your planes the more stars you get when you are victorious, the more stars you get the higher the rank you achieve.</p>
<p style="text-align: left;">I am really pleased I took the time to download this game, and even more pleased that Danc and SpryFox have been able to break away from the mould and start creating well designed, fun and highly polished games without loosing the indie edge.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/11/19/steambirds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

