Iain M. Banks gave me more than Science Fiction books

June 9, 2013 – 20:51

Iain M. Banks died today, in my mind Iain is one of the few people who was capable of building a world so vast yet so detailed that it would take a life time to understand the ramifications and practicalities of living in this kind of pan-galactic near-post-physical civilization.Excession Cover

Iain masterfully takes you through a single thread introducing ideas and concepts that underpin something much larger than the story itself. He does this again and again, winding threads together to build a book.

Beyond my awe of Banks’ world building and book writing skills, there are some very specific things that he introduced to me that have contributed to me as a person:

  1. Out of Context Problems exist; whether these are the September 11th attacks, the arrival of a new and totally unexpected person in your life or the realization of the value of Graphene in material sciences. These are things that change the world in an unpredicted and unprecedented way.
  2. Interpersonal relationships only get more complex in space; let’s face it interpersonal relationships are complex on one planet with one species. Isaac Asimov, Arthur C. Clarke and Stephen Hawking have explored this through fiction and theory Banks addresses it again and again through his books both insightfully and amusingly.
  3. When compared to the speed of light we move slowly; in Surface Detail Bank’s describes an intricate battle involving the complete destruction of many ships only to explain that the entire battle started and ended within a fraction of a second. This is a fact of life for us.

I am glad I discovered Iain M. Banks, and I am grateful to the man who introduced him to me. I believe Iain will live on through the pages of his book long after we have all turned to star dust.

Thanks Iain.

Read my recent technical blog posts over at Amido

March 29, 2013 – 19:48

In October 2012 I joined Amido a quickly going consultancy in Brighton as a Full-Time Technical Consultant. Amido share my commitment to Open Source Software and giving back to the community. As a result I get to spend some time getting paid to write blog posts on the Amido Blog.

I shall aim to keep this post updated with all the posts I write, but just in case take a look at my Author Page.

Elevated Command Prompt on Windows 8

March 12, 2013 – 12:00

Two and a half years ago I posted about openening an elevated command prompt on Windows Vista and Windows 7. The process has changed slightly in Windows 8 as we have lost the traditional start menu.

In Windows 8, applications don’t automatically get administrator privileges, they either need to request it or the user needs to explicitly start the application as an Administrator. The way to do this with the Command Prompt is as follows:

  1. Press the “Start” button.
  2. Type “Command”.
  3. The list of all applications will be filtered by the search term:
    elevated-command-prompt-on-windows-8-type-command
  4. elevated-command-prompt-on-windows-8-select-command-prompt

  5. Right click or press the menu key on the keyboard:
    elevated-command-prompt-on-windows-8-right-click-command-prompt
  6. Select “Run as Administrator” from the bottom of the screen:
    elevated-command-prompt-on-windows-8-click-run-as-administrator
  7. Click “yes” when prompted to confirm:
    elevated-command-prompt-on-windows-8-uac

The Command Prompt running as an administrator will appear in much the same way as Windows 7 or Vista:

elevated-command-prompt-on-windows-8-command-prompt

Public Virtual Auto-Properties and CodeRush

February 11, 2012 – 22:36

Since starting to make the move towards utilizing NHibernate in most of my projects I have been a little frustrated by the need to make properties virtual. This is by no means a criticism of NHibernate just the tooling, specifically Visual Studio 2010 and CodeRush. Whilst CodeRush has templates for everything the virtual keyword dosn’t seem to get a look in, fortunately it’s not hard to add support.

Thanks to Rory Becker’s article on Creating Virtual Methods I had everything I needed to create the template. Auto-properties are actually significantly less complex than methods as they are composed of little more than the type, property name and the { get; set; } block.

Templates are easy enough to create from the DevExpress Options Menu (DevExpress Menu -> Options) you jump to the templates page quickly with the search in the top left hand corner. I prefer to organize my custom templates into their own folder, then I can easily import and export these between machines via drop box.

1) Right click your preferred folder and select “New Template” inter “u?Type?” and press enter/OK.

2) Set the Context – I copied the context of my template from a?Type? and removed the InStruct directive, as virtual is not valid in structures, the Use: field should read something like this:

((InClass or InInterface) and OnEmptyLine) but not (InComment or InMethod or InPreprocessorDirective or InProperty or InString or VS2002 or VS2003 or VS2005)

It’s not critical you get this right, as it is probably going to work where you want it, if the above is wrong it may work where you don’t want it.

3) Enter the expansion

public virtual «?Get(Type)» «Caret»«Field(PropertyName)»«BlockAnchor» { get; set; }

This bit is essential to get right:

  • “public virtual” are string literals
  • the ?Get(Type) StringProvider is a macro that takes the ?Type? part of your template and emits the type of the property
  • Caret is the position of the Caret unsurprisingly
  • Field(PropertyName) gives you a place holder to enter the name of your property
  • BlockAnchor highlights the text between the Caret and BlockAnchor making the PropertyName field instantly replacable
  • { get; set; } is again a string literal

With that you are all set and can save and test out your new template in the code editor. Simply move to an empty line inside a class and type

us<space>

This should then expand to

public virtual string PropertyName { get; set; }

Connect to VPN with Windows 7

July 11, 2011 – 17:30

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 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.

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.

What you will need:

  • Windows 7.
  • A workplace with a compatible VPN End Point.
  • Your account enabled to use the VPN.
  • The IP address of your VPN End Point.
  • Your Username, Password and Domain.

1. Click the “Networking” tray icon

It is a monitor with a network cable to the left of it, although quite understandably some users see it as a “monitor and a fork”:

2. Go to Network and Sharing Center

It is the link at the bottom of the popup you see after clicking the Networking tray icon.

3. Click “Connect to a network”

4. Click “Connect to a workplace”

5. Click “Use my Internet connection (VPN)”

6. Enter your settings then click Next

The “Internet address” 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.

7. Enter your Login details then click Next

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.

8. Wait

This bit can take a while, the VPN Client will connect to your workplace VPN send your login details then setup the connection.

9. Your Done!

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’t do what you shouldn’t do, get over it.

10. Remember to disconnect (and how to reconnect)

Remember that “Monitor and Fork” 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 “Disconnect”. You can reconnect in the future in a similar way, click the “Monitor and Fork” select the connection then click “Connect”.

Orchard Placement ID Strings Must Match

May 31, 2011 – 20:12

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… until you make a mistake!

Modules define where shapes are placed through a file called placement.info your module dispatches shapes through it’s Driver (a class inherited from ContentPartDriver)

public class DefinitionListPartDriver : ContentPartDriver<DefinitionListPart> {

    ...

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

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

    ...

}

You may have seen the mistake already, but just in case your not sure here is my placement.info file:

<Placement>
    <Place Parts_DefinitionList_Edit="Content:11"/>
    <Place Parts_DefinitionList="Content:11"/>
</Placement>

Yep, when I dispatched the shape it had an extra it in Definition… oh well, remember to check that first next time.

Responsive Design for Programmers

March 30, 2011 – 16:23

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.

A List Apart’s Responsive Design Article

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.

CloudFour’s CSS Media Query for Mobile is Fool’s Gold Blog Post

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 good response on Quirksmode.

Smashing Magazine’s Guidelines for Responsive Web Design Article

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. Further examples and discussion can be found on Adactio.

Windows Team Blog’s Targeting mobile optimized CSS at Windows Phone 7 Post

This was the article that kicked me off on my research spree this afternoon. I was seriously disappointed by Windows Phone 7′s 19/400 score on HTML5 test so I didn’t hold out much hope for support for CSS3 and Media Queries this article didn’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.

Conclusion

Not being a “Front End” 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.

2010 Blogging Year In Review

December 31, 2010 – 15:38

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.

The most popular article by far has been Change your MTU in Vista and Windows 7, 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 Card Reader on Acer Aspire 5100 Series under Windows 7 and my explanation of obtaining an Elevated Command Prompt in Windows 7 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.

My review of OneNote and Evernote has been fairly popular, as has my review of Center Parcs from 2008. I shall try and review products and holidays as I go along, although I am reguarly stuck for inspiration in these terms.

Visitor Breakdown

  • iPhone/iPad/iPod are the most popular mobile platforms to view my site with over three times as many visitors using iOS than Android.
  • 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 – I was under the impression that Opera’s market share has been dropping off.
  • Windows holds 95% of the operating system share, presumably the result of my Windows 7 posts.

Keywords

Unsurprisingly the most of the searches are for “windows 7 mtu” 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 PCI Database. 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 Smart Learners.

Someone has been searching for me on LinkedIn, it may not have been me you were looking for but here is my profile for reference purposes.

One user got to my site looking for an answer to the question “windows 7 what are the blue & yellow shields on desktop shortcut icons for”; 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.

There don’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!

Listing Table Sizes

December 24, 2010 – 11:20

Databases are a pain in the neck to look after, poorly designed models and processes that don’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 “live” data.

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.

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.

SSMS Storage Properties

In large databases this can be laborious, I found a script 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.

SET NOCOUNT ON
CREATE TABLE #spaceused (
  name nvarchar(120),
  ROWS CHAR(11),
  reserved VARCHAR(18),
  DATA VARCHAR(18),
  index_size VARCHAR(18),
  unused VARCHAR(18)
)
 
DECLARE TablesFromSysObjects CURSOR FOR
  SELECT name
  FROM sysobjects WHERE TYPE='U'
  ORDER BY name ASC
 
OPEN TablesFromSysObjects
DECLARE @TABLE VARCHAR(128)
 
FETCH NEXT FROM TablesFromSysObjects INTO @TABLE
 
WHILE @@FETCH_STATUS = 0
BEGIN
  INSERT INTO #spaceused EXEC sp_spaceused @TABLE
  FETCH NEXT FROM TablesFromSysObjects INTO @TABLE
END
 
CLOSE TablesFromSysObjects
DEALLOCATE TablesFromSysObjects 
 
SELECT	name AS TableName,
		ROWS AS ROWS,
		CAST(LEFT(reserved, LEN(reserved) - 3) AS INT) AS Reserved,
		CAST(LEFT(DATA, LEN(DATA) - 3) AS INT) AS DATA,
		CAST(LEFT(index_size, LEN(index_size) - 3) AS INT) AS IndexSize,
		CAST(LEFT(unused, LEN(unused) - 3) AS INT) AS Unused,
		(CAST(LEFT(reserved, LEN(reserved) - 3) AS INT) + CAST(LEFT(DATA, LEN(DATA) - 3) AS INT) + CAST(LEFT(index_size, LEN(index_size) - 3) AS INT) + CAST(LEFT(unused, LEN(unused) - 3) AS INT)) AS Total
FROM #spaceused
ORDER BY Total DESC
DROP TABLE #spaceused

Ordinance Survey OpenData (Part 3 – Cleaning Up)

December 17, 2010 – 16:55

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

  1. You can go right ahead and remove the fields that start with “Unused” as far as I can tell the full version of Code-Point uses these fields.
  2. 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.
  3. 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.

Cleaning up the Data

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 OS Code-Point documentation.

SELECT Quality, COUNT(*) AS COUNT
FROM [OSOpenData].[dbo].[CodePointOpenCombined]
GROUP BY Quality
ORDER BY Quality
Quality Count Description
10 1683975 Within the building of the matched address closest to the postcode mean determined automatically by Ordnance Survey.
20 73 As above, but determined to visual inspection by GROS (General Register Office for Scotland).
30 1086 Approximate to within 50 m of true position.
40 52 The mean of the positions of addresses previously matched in ADDRESS-POINT but which have subsequently been deleted or recoded.
50 4395 Estimated position based on surrounding postcode coordinates, usually to 100 m resolution, but 10 min Scotland.
60 93 Postcode sector mean (direct copy from ADDRESS-POINT).
90 6361 No coordinates available.

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:

DELETE FROM [CodePointOpenCombined]
WHERE [Quality] = 90