<?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 &#187; Programming</title>
	<atom:link href="http://www.richard-slater.co.uk/archives/category/programming/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>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>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>Encapsulating Alpha Fade in Unity3d</title>
		<link>http://www.richard-slater.co.uk/archives/2010/11/12/encapsulating-alpha-fade-in-unity3d/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/11/12/encapsulating-alpha-fade-in-unity3d/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 20:09:31 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Unity3d]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=854</guid>
		<description><![CDATA[Several days into my late Unity3d project I realised that the was a bulk of code designed solely to make an object invisible by fading it out of the scene. The code was not complex although because of the way it was all in one class it appeared complex. After doing some research into the [...]]]></description>
			<content:encoded><![CDATA[<p>Several days into my late Unity3d project I realised that the was a bulk of code designed solely to make an object invisible by fading it out of the scene. The code was not complex although because of the way it was all in one class it appeared complex.</p>
<p>After doing some research into the best way to go about making this change, realised it was both convenient and logical to extract the code into a separate script and attaching that to the object that I wished to apply the effect to.</p>
<p>This meant that instead of nested if-statements for state management in a script attached to the Main Camera I was able to make declarative statements:</p>
<p><em>GameObject.Find(&#8220;TargetObject&#8221;).GetComponent&lt;SmoothAlpha&gt;().MakeVisible();</em></p>
<p>I have named the script SmoothAlpha only by my convention no actual smoothing or damping of the alpha value, it is simply a linear reduction of the materials alpha value.</p>
<p>There are many improvements that could be made to the script, some of which I may well do over the coming weeks:</p>
<ul>
<li>Should include a delegate call back to signal when the fade is complete.</li>
<li>Should include methods to instantly make an object (in)visible.</li>
<li>Should support changing the alpha of child GameObjects in unison with the parent.</li>
</ul>
<p>In have included the full script below the cut.</p>
<p><span id="more-854"></span></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">UnityEngine</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SmoothAlpha <span style="color: #008000;">:</span> MonoBehaviour <span style="color: #008000;">&#123;</span>
  <span style="color: #0600FF; font-weight: bold;">protected</span> Color origionalColor<span style="color: #008000;">;</span>
  <span style="color: #0600FF; font-weight: bold;">protected</span> Color transparantColor<span style="color: #008000;">;</span>
  <span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #6666cc; font-weight: bold;">float</span> stage<span style="color: #008000;">;</span>
&nbsp;
  <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">bool</span> m_isVisible <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
  <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">bool</span> m_isTransitioning <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
&nbsp;
  <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">float</span> speed <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
&nbsp;
  <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">bool</span> isVisible
  <span style="color: #008000;">&#123;</span>
    get <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">return</span> m_isVisible<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  <span style="color: #008080; font-style: italic;">// Use this for initialization</span>
  <span style="color: #6666cc; font-weight: bold;">void</span> Start <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    origionalColor <span style="color: #008000;">=</span> transform<span style="color: #008000;">.</span><span style="color: #0000FF;">renderer</span><span style="color: #008000;">.</span><span style="color: #0000FF;">material</span><span style="color: #008000;">.</span><span style="color: #0000FF;">color</span><span style="color: #008000;">;</span>
    transparantColor <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Color<span style="color: #008000;">&#40;</span>origionalColor<span style="color: #008000;">.</span><span style="color: #0000FF;">r</span>, origionalColor<span style="color: #008000;">.</span><span style="color: #0000FF;">g</span>, origionalColor<span style="color: #008000;">.</span><span style="color: #0000FF;">b</span>, Color<span style="color: #008000;">.</span><span style="color: #0000FF;">clear</span><span style="color: #008000;">.</span><span style="color: #0000FF;">a</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  <span style="color: #008080; font-style: italic;">// Update is called once per frame</span>
  <span style="color: #6666cc; font-weight: bold;">void</span> Update <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span>m_isTransitioning<span style="color: #008000;">&#41;</span>
      <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span>
&nbsp;
    stage <span style="color: #008000;">+=</span> Time<span style="color: #008000;">.</span><span style="color: #0000FF;">deltaTime</span> <span style="color: #008000;">*</span> speed<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>m_isVisible<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      transform<span style="color: #008000;">.</span><span style="color: #0000FF;">renderer</span><span style="color: #008000;">.</span><span style="color: #0000FF;">material</span><span style="color: #008000;">.</span><span style="color: #0000FF;">color</span> <span style="color: #008000;">=</span> Color<span style="color: #008000;">.</span><span style="color: #0000FF;">Lerp</span><span style="color: #008000;">&#40;</span>origionalColor, transparantColor, stage<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>transform<span style="color: #008000;">.</span><span style="color: #0000FF;">renderer</span><span style="color: #008000;">.</span><span style="color: #0000FF;">material</span><span style="color: #008000;">.</span><span style="color: #0000FF;">color</span> <span style="color: #008000;">==</span> transparantColor<span style="color: #008000;">&#41;</span>
      <span style="color: #008000;">&#123;</span>
        m_isTransitioning <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
        m_isVisible <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
      <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">else</span>
    <span style="color: #008000;">&#123;</span>
      transform<span style="color: #008000;">.</span><span style="color: #0000FF;">renderer</span><span style="color: #008000;">.</span><span style="color: #0000FF;">material</span><span style="color: #008000;">.</span><span style="color: #0000FF;">color</span> <span style="color: #008000;">=</span> Color<span style="color: #008000;">.</span><span style="color: #0000FF;">Lerp</span><span style="color: #008000;">&#40;</span>transparantColor, origionalColor, stage<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>transform<span style="color: #008000;">.</span><span style="color: #0000FF;">renderer</span><span style="color: #008000;">.</span><span style="color: #0000FF;">material</span><span style="color: #008000;">.</span><span style="color: #0000FF;">color</span> <span style="color: #008000;">==</span> origionalColor<span style="color: #008000;">&#41;</span>
      <span style="color: #008000;">&#123;</span>
        m_isTransitioning <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
        m_isVisible <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
      <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> MakeInvisible<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>m_isTransitioning<span style="color: #008000;">&#41;</span>
      <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span>m_isVisible<span style="color: #008000;">&#41;</span>
      <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span>
&nbsp;
    stage <span style="color: #008000;">=</span> 0F<span style="color: #008000;">;</span>
&nbsp;
    m_isTransitioning <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> MakeVisible<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>m_isTransitioning<span style="color: #008000;">&#41;</span>
      <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>m_isVisible<span style="color: #008000;">&#41;</span>
      <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span>
&nbsp;
    stage <span style="color: #008000;">=</span> 0F<span style="color: #008000;">;</span>
&nbsp;
    m_isTransitioning <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/11/12/encapsulating-alpha-fade-in-unity3d/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Unity3d plus three weeks</title>
		<link>http://www.richard-slater.co.uk/archives/2010/11/06/unity3d-plus-three-weeks/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/11/06/unity3d-plus-three-weeks/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 01:07:33 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Unity3d]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=848</guid>
		<description><![CDATA[It is about 3 weeks on since I started learning Unity3d, and today Makemedia delivered the product we were working on using it. I have thoroughly enjoyed the process and the experience, there is still much to learn however I am much more confident experimenting with Unity3d to see what I can come up with. [...]]]></description>
			<content:encoded><![CDATA[<p>It is about 3 weeks on since I started learning Unity3d, and today <a href="http://www.makemedia.com/">Makemedia</a> delivered the product we were working on using it. I have thoroughly enjoyed the process and the experience, there is still much to learn however I am much more confident experimenting with Unity3d to see what I can come up with.</p>
<p>As I am not going out to see the fireworks tonight, I put together a 3d scene to demonstrate some of Unity Basics particle effects in the form of a personal fireworks display.</p>
<p>Move around in the scene using W, A, S, D or the Arrow Keys you can move your head by moving the mouse.</p>
<p><em>Please view the full post to see the Unity content.</em></p>
<p>Some of the rockets go a bit crazy some time and fire off into the distance at low speeds which is quite peculiar when it is towards the camera.</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/11/Fireworks.zip">Source Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/11/06/unity3d-plus-three-weeks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Unity 3D</title>
		<link>http://www.richard-slater.co.uk/archives/2010/10/16/unity-3d/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/10/16/unity-3d/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 20:18:22 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Unity3d]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=839</guid>
		<description><![CDATA[I am starting a project next week using Unity3D, I have known about this for a while and have poked around a bit to try and figure out how to do various things. I have been really impressed as to how fast you can get something done with what is basically a free product. There [...]]]></description>
			<content:encoded><![CDATA[<p>I am starting a project next week using Unity3D, I have known about this for a while and have poked around a bit to try and figure out how to do various things. I have been really impressed as to how fast you can get something done with what is basically a free product.</p>
<p>There are some superb videos on <a href="http://unity3dstudent.com/">Unity3d Student</a> which have been invaluable. I think I have got my head around the controls, UI, paradigms and scripting, although not all in one scene. As evidence of my work I have made three balls bounce around the screen, something akin to a carpenter making a door stop perhaps, but I am sure I will learn.</p>
<p><span id="more-839"></span></p>
<p><em>Please view the full post to see the Unity content.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/10/16/unity-3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing code accessibility modifiers quickly</title>
		<link>http://www.richard-slater.co.uk/archives/2010/10/12/changing-code-accessibility-modifiers-quickly/</link>
		<comments>http://www.richard-slater.co.uk/archives/2010/10/12/changing-code-accessibility-modifiers-quickly/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 20:20:48 +0000</pubDate>
		<dc:creator>Richard Slater</dc:creator>
				<category><![CDATA[CodeRush]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.richard-slater.co.uk/?p=817</guid>
		<description><![CDATA[I have two hints today both of them involving changing accessibility modifiers. The first is a feature of CodeRush that I accidentally discovered while testing out the Visual Studio 2010 Productivity Power Tools the second is a great new feature of Visual Studio 2010. For those who don&#8217;t know what I mean by accessibility modifiers, [...]]]></description>
			<content:encoded><![CDATA[<p>I have two hints today both of them involving changing accessibility modifiers. The first is a feature of CodeRush that I accidentally discovered while testing out the <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef?SRC=VSIDE">Visual Studio 2010 Productivity Power Tools</a> the second is a great new feature of Visual Studio 2010.</p>
<p>For those who don&#8217;t know what I mean by <a href="http://msdn.microsoft.com/en-us/library/ms173121(v=VS.100).aspx">accessibility modifiers</a>, those are the keywords you put before blocks of code that define how that code can be accessed, this is all enforced by the compiler giving you nice compiler error messages if you violate these rules. To provide an example the following auto-properties are all have the accessibility modifier &#8220;public&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Name <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Description <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">decimal</span> Price <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Category <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span></pre></div></div>

<p>CodeRush gives you a handy way to change the User interface by clicking the icon to the left of the code block, you then get a set of actions you can perform upon the that block of code.</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/10/CodeRushCodeContextMenu.png"><img class="aligncenter size-full wp-image-820" title="Code Rush Code Context Menu" src="http://www.richard-slater.co.uk/wp-content/uploads/2010/10/CodeRushCodeContextMenu.png" alt="Code Rush Code Context Menu" width="398" height="162" /></a></p>
<p>As with most everything in CodeRush you can access this functionality from the keyboard anywhere within the scope of that code block by pressing Alt + Up or Alt + Down to cycle through the five possibilities:</p>
<ul>
<li>public</li>
<li>internal</li>
<li>protected internal</li>
<li>protected</li>
<li>private</li>
</ul>
<p>This means that if you need to change access modifiers, either to tighten up or relax the access points into your code you can do it by pressing a hand full of keys (between two and six to be exact), much faster than navigating to the top of the method highlighting and replacing the keyword.</p>
<p>My second hint is something that I have been using quite regularly, lets take the above example again:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Name <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Description <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">decimal</span> Price <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Category <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span></pre></div></div>

<p>I want to change all four fields to &#8220;be internal&#8221;, I could go in and change each one manually or better still use the above keyboard shortcuts (Alt + Down, Down, Alt + Down, etc.) the faster alternative would be to hold down the Alt key then select from the first character of the first &#8220;public&#8221; to the last character of the last &#8220;public&#8221; keyword.</p>
<p>While holding down Alt traditional selection behaviour is not followed and only the &#8220;public&#8221; keywords are selected on all four lines:</p>
<p><a href="http://www.richard-slater.co.uk/wp-content/uploads/2010/10/VS2010LineSelect.jpg"><img class="aligncenter size-full wp-image-821" title="VS2010 Line Select" src="http://www.richard-slater.co.uk/wp-content/uploads/2010/10/VS2010LineSelect.jpg" alt="VS2010 Line Select" width="558" height="110" /></a></p>
<p>You can then type your new visibility modifier overwriting the selected components of all four lines in one fell swoop:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">internal</span> <span style="color: #6666cc; font-weight: bold;">string</span> Name <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">internal</span> <span style="color: #6666cc; font-weight: bold;">string</span> Description <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">internal</span> <span style="color: #6666cc; font-weight: bold;">decimal</span> Price <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#91;</span>Column<span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">internal</span> <span style="color: #6666cc; font-weight: bold;">string</span> Category <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span></pre></div></div>

<p>I think that is neat!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richard-slater.co.uk/archives/2010/10/12/changing-code-accessibility-modifiers-quickly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

