Tuesday, 5 April 2011

I've moved...

... to a Wordpress blog.

New address is http://markp3rry.wordpress.com/. You can also follow me on Twitter - @markp3rry.

Sunday, 6 March 2011

A tribute to... Evil Genius

If you have never played Evil Genius here is a quick summary:
  • It's a PC game that was released by Elixir in 2004.
  • Gamespot awarded it 7.3 / 10 and commented on its style over substance and frustrating gameplay.
  • You play the part of an evil genius hellbent on taking over the world. To do so you hire an army of minions, build a base full of facilities for them and send them out across the world to enact various deeds of cunning and malice. All the while the forces of justice try to stop you by infiltration, robbery or sending in the marines.
There are three things about the design of the game that I really love. The first is the fact that you don't control your minions directly. The design of your base and the ability to switch rooms on or off influences them but each one is following its own set of pre - determined instructions. This initially causes frustration when you are under attack and you want to get twenty armed men to a trouble spot but once you get your head around it you learn that the design of your base is everything. I think it would be too easy if you could do the classic 'shift click' on a group and move them to attack a group of enemy soldiers. What you have to do is design a robust security network and ensure that your people can quickly arm themselves and respond to attacks. It's a very different way of looking at things. I recently discovered that the best way to build and defend a base is not something I would ever have come up with - there are some examples of optimal designs on YouTube that exploit the limitations of the enemy AI fully.

The second is the range of room options and minion skills. You don't get a lot of space to build in and there are a vast amount of rooms to cram in. All perform a purpose - if you scrimp on R & R for your staff then they will quickly start deserting. I really like the way it all fits neatly together and that it's easy to chop and change rooms as your needs change. One example is that you will want to keep moving your strongroom where all your cash is stored further and further towards the back of the base so that it's less likely to come under attack. Achieving this is very simple - providing the rest of the base design allows for it. Your men don't have to be told what to 'become' - you simply decide how many scientists or guards you want and they train themselves, leaving you to macro manage the whole operation.

The third is the sense of humour. It's all very tongue in cheek, taking inspiration from Austin Powers ("henchman arbitrarily twiddling knobs) and poking fun at spy legends like James Bond (SMERSH has become SMASH). A minion sent to interrogate an unwelcome guest to your island might perform a Michael Jackson routine until the poor soul can't take it any more and gives up his or her secrets. And the audio clips that play every time you complete an Act of Infamy always make me smile - especially the commentator in India who can see a traffic jam ahead caused by a sacred cow and a traffic jam behind caused by, er, his elephant. Not a million miles from Arty Pie in the Simpsons and just as silly. I have read many novels where the blurb swears blind that they are laugh at loud funny and it's not the case. Ditto video games but this one is an exception.

Evil Genius is really well thought out and great fun to play.

Why volunteer?

I read an article on the Guardian website recently that discussed volunteering and how those who volunteer are somehow playing into the hands of David Cameron and his 'big society', even though we may not necessarily agree with the man or his policies. It's typical that I can find plenty of articles on said newspaper website that discuss volunteering except the one that I want so I am unable to reference it. My dissertation advisor would have a cow. This highlights the fact that we're still not nearly as clever as we think we are when it comes to searching data but that's another story.

So why volunteer? I can only speak from personal experience here. But I can hazard a guess that all those who do volunteer at the moment - be it in a charity shop on the high street, or coaching a youth sports team or anything equally applaudable - will be a bit miffed if Mr. Cameron starts taking credit for the way in which they invest their time. I too am a volunteer because I want to be, not because I am responding to the call of the Conservative government. My motivation is probably a little more mercenary than most; I know that being able to show a future employer that I can work on interesting projects outside of my day job is a good thing. My MSc certainly shows this and so does my volunteer work with the International Thai Foundation. Maybe 90 out of 100 people applying for the same job as me can't show this on their CV's which at least gets me on the interview list. Once you're at that stage it's a bit of a lottery (one or more of the panel might not like you) but create enough chances and one will go your way.

So credit where it's due please. It was my idea to volunteer, and my efforts that got me the right volunteering opportunity putting my skills to good use (and learning some new ones too). Nothing at all to do with the Prime Minister.

Wednesday, 23 February 2011

Delta change script for SQL Server

One of the things I have been working on recently (and finally cracked today) is a way of comparing two record sets and finding if anything has changed. This is handy if you want to integrate data from one system into another and need a constant feed of data. Obviously you don't want to be updating every single record every time; as soon as you get into thousands of records there's a big performance hit and it's slow.

I found this script on a website somewhere but can't remember the original source:

refno, digit, pro_refno, par_refno,
title, forename, surname, nino, DOB, CorrelationID
CorrelationID IN(
refno, digit, pro_refno, par_refno,
title, forename, surname, nino, DOB, correlationid
COUNT(*) = 1)

You can see that I'm pulling data from two tables - tblDataOld and tblDataNew. The idea is that you have an out of date data set to compare against a brand new one. Replace my column names with your own and the script will show you all the rows that have a change. The correlation ID needs to be unique for each row; what I did was concatenate the first four fields together. In the dataset that I have used these are all numbers and I'm pretty certain that if you lump the four together it's unique from any other combination.

A note about the method too; originally I had three tables - Old, New and Delta. I would compare Old and New and put the changes into Delta to be processed. This does work but I found that if something happened in the job - one of the tables got truncated but not rebuilt properly - that the next time it ran it would see everything as a change and try to process all my records. As I have said above - not good. To get around this my tblDataNew is a temporary table that I'm populating for the duration of the identification process. Once I'm done I drop the table. Also, I don't use a table for the Deltas, I run the script inside an ASP.NET application and process each Delta in memory using the SqlDataReader object. I only need to store one table - tblDataOld - in my local database and I repopulate this at the end of the process so new becomes old.

It's much neater and I like the fact that it has a small footprint. If you search Google for Delta scripts you get a lot of links to applications that will identify changes for you but for something as simple as this one SQL script will suffice.

If anyone is interested in the full application let me know and I can mail you the source code; it includes all the steps for building the temporary table, processing the changes and tidying up at the end.

Saturday, 19 February 2011

So you want to offer your IT skills as a volunteer?

So you want to offer your IT skills as a volunteer? Kudos to you. Here are a few things to think about. They are all based on my own experience and I hope they will help others avoid making the same mistakes I did.

1. How much time can you realistically devote?
Time is the scarcest resource of all. The internet is now chock full of open source and / or free to use software packages, programming resources and APIs. There are answers to pretty much any problem out there. Unfortunately there is only one of you, and you only have one pair of hands. It's better to invest a couple of hours a week in something that you can deliver on rather than waste a couple of hours a week on a project you won't finish because it's too big. Are your family members 'onside'? Before you tell me to mind my own business it's much easier if your family know what you are doing and are supportive.

2. What do you want to get out of volunteering?
So, what's your motivation. Volunteering shouldn't all be one way traffic - there should be something in it for you too. Have this clear from the start, and make sure the people you're volunteering with know it too. If you just want to help then great, but I saw volunteering as the chance to make my CV look more impressive than the hundred plus other people I will be competing for my next job with. One mistake I made was to start blogging about working with an organisation before I had OK'd it with them. They weren't happy at being used 'as a reference' and asked me to take all the posts down. They will tell you what their aims are - make sure you tell them what yours are too.

3. Get organised
When are you going to be able to do the work you have volunteered? If you (like me) are only going to be available in the evening and at weekends then a volunteering gig that needs you to be in someone's office at 10am once a week isn't right for you. It's also important to devote all the time you have set aside to doing what needs doing. So make sure you have all your resources (equipment, data, specifications) to hand before making a start.

4. Build a relationship
It's essential to have a good working relationship with the charity or community group that you are representing. So ditch the emailing back and forward, get on the phone, get on Skype or go and meet them face to face. Not only are you showing a more personal and professional approach you also have the opportunity to find out if you are going to be able to get along with the people you are meeting. This isn't like your day job where you're forced to interact with people you're not too keen on; it's your free time you are giving up. If your instincts tell you that it won't work then end the relationship and look for something else. And if you really like each other then you have made an important contact. To LinkedIn!

5. Keep records of what you are doing
This doesn't have to be onerous. I agreed with the charity I am working for to post text files containing updates of progress into a shared area. If you're setting up administrative passwords on applications, databases or servers don't just write them on the pad of paper next to your desk and then throw them away next time your tidy it up. Put them somewhere the organisation is going to be able to read them. This will help you in the long term - if, for some reason in the future you can't continue to volunteer then the last thing you want is being hassled for important information.

6. Enjoy it
For me, volunteering is a chance to do something I am not able to do at work. I can run my own project and make my own decisions. That for me is intellectually stimulating. Find an opportunity that is going to let you try something new, or do something a different way and use the experience for personal development. Don't do something that bores you because you won't stick at it and neither side of the volunteering arrangement profits. Have fun!

If you read this and would like any more help or advice then email me mark dot p3rry at gmail dot com.

Sunday, 13 February 2011


Just over a week ago I started having a conversation (via the wonders of electronic mail) with Anne Stafford. Anne is the Programme Manager for IT4Communities, an organisation that works on "Introducing Volunteer IT Professionals to Charities Needing IT Help". I have mentioned IT4Communities briefly in a recent post and was critical of the charities that advertised through it and whom I made contact with - they either ignored me or didn't follow through. The IT4Communities website and service are both excellent though - it's very easy to register and start finding people and groups that need skilled IT help.

Anne made a couple of very interesting points. The first is that there is generally a mismatch between the number of volunteers and projects for them to work on - the former is larger than the latter. I experienced this when browsing the IT4Communities database looking for volunteering opportunities. There was nothing in my geographic area (the North West of England) that I thought I could assist with and ended up writing to organisations based in Bradford and Seacroft. But this is probably to be expected. I know from working with community groups in the past that time is the most precious commodity of all and there is generally none spare to invest in training or finding someone who might be able to help them out. So engagement from volunteers is the key - I received a staggering response from one email stating that I was offering my services as a volunteer.

The second point that Anne made was about the sort of volunteer help that is out there. I have thought that a good use of my time might actually be to set up some sort of matching service that places volunteers in the Warrington area with projects that would best suit them. On this subject Anne says "companies seem keener to
respond to team challenges not skills based work". It is quite often the case that companies only have access to a limited pool of skills too and these are off limits because they're busy doing what they're employed to do. This is a shame because community groups need skills too. IT4Communities find that "SMEs are
really responsive but the larger the company the harder it is to release
staff time". As a team leader in a largish company I would agree 100% with this statement - any organisation approaching me for a 'loan' of a member of staff would be flat refused because we don't have the capacity, especially following recent budget cuts. So SMEs are the way to go - and I think the spirit of entrepreneurship and individuality that small IT companies have suit community groups best.

If you're a volunteer or a group looking for help then IT4Communities is a route you should consider following. Here's their website - and Anne is happy to answer any questions you might have.

Saturday, 12 February 2011

International Thai Foundation (ITF)

I am delighted to announce the start of a working relationship with the International Thai Foundation (ITF). I was approached by John Lewis (their legal representative) shortly after I sent out my 'volunteer offering his services' mailshot back in December.

ITF is "an international not-for-profit organisation" with a clear set of objectives: "promote education, protect human rights / civil liberties and relieve poverty for the people in Thailand (including Distressed Foreign Nationals); and assist Thai people, their families and businesses integrate in England (and other countries outside of Thailand)".

I am really happy to volunteer my time to ITF, particularly in light of events such as this denial of free speech by the Thai government. My initial work has been to familiarise myself with the web hosting that ITF uses. I've installed Joomla and Wordpress onto one of the websites and can now start to get involved in the detail of what the site looks like and how we get traffic to visit it and keep coming back.

How have I ever managed without Dropbox?

The last couple of weeks have been extremely busy with a holiday and a trip to London omn behalf of my employer. Today I finally have some time to sit down and write a couple of posts...

...and also ask myself this question: 'how have I ever managed without Dropbox'? The answer is 'I'm not sure'. It's a brilliant piece of software that allows you to sync files between computers and share files with others who also use Dropbox. So I can create a Word document on this computer, stick it in my Dropbox folder and it's automatically accessible on any other computers that I am linked to. Brilliant! It looks like all the Dropbox servers do is take a backup of your material so you're still left with a copy and it gets around 'the cloud has all my data and won't give it back' issue.

Saturday, 15 January 2011

Integrating jQuery and ASP.NET

We have started to achieve some really good results by integrating jQuery and ASP.NET. I wrote a post back in August 2010 that described my confusion about how best to make the two work together. After some more work we have found that the two technologies complement each other very well - it's possible to create a slick UI and also rely on the data management capabilities of the .NET framework.

It has also begun to alter the way that we work as a team. There is a definite seperation of duties between the UI design and the data transaction design. So now we can have one person working on the look and feel, and when they're happy someone else can follow on behind them and fill in the data 'blanks' - such as making sure that the login process works OK, or making sure that grid views of data are displaying properly. That sort of thing. The division of labour also leads to increased productivity - Adam Smith was right.

The switch to jQuery also means that we can do away with the .NET AJAX control toolkit. I'm really glad to see the back of it. It was inflexible and rigid - the total opposite of the jQuery library.

Thursday, 13 January 2011

Who are you? Who are you? (2)

One of my colleagues solved this and it had nothing to do with using Ping as I suggested in the original post on this subject. Instead we're using something called the 'winmgmts' object, which is actually linked to to SVCHOST process that runs on the Windows OS.

We sent the following command to this object:

"SELECT * From Win32_PingStatus WHERE Address='" _
& HttpContext.Current.Request.UserHostAddress & "' AND ResolveAddressNames=TRUE")

passing in the IP address of the computer connecting to the application on the server and received a collection of results back which we iterated through to find the hostname.

I would never have thought of this in a million years, kudos to my colleague for discovering it.

Friday, 7 January 2011

Using Wordpress as a Content Management System (2)

I got in touch with the Ridgway Ramblers and asked about their experience of using Wordpress as a CMS. Got a nice reply from them:

"I find wordpress quite easy to use as I have no background in this kind of thing. Loading photos etc basically work on the same basis as microsoft word so is very easy. I actually use the very minimum of the tools available on wordpress as I am so inexperienced. I am sure someone with more computer skills could do a lot more with the site than me."

This gives a bit more weight to my argument - it is possible for someone with a basic level of skills to use Wordpress as a CMS and develop an attractive and detailed website.

Thursday, 6 January 2011

Volunteering with Community Groups (3)

I have had a pretty overwhelming response. After receiving little to no interest from organisations advertising on the IT4Communities website my mailshot has brought at least a dozen different requests for help. The work ranges from some simple IT support (uploading a YouTube video and installing Publisher) to improving website design or rankings to teaching some ASP.NET skills.

The response has shown there is a real appetite amongst community groups for IT support that they simply can't afford to buy in. I'm thinking about whether my time might be better spent trying to develop some sort of local network that hooks in IT companies in the area and increases the number of hours available. But maybe that's a step too far.

Who are you? Who are you?

One small problem that we have hit in the last couple of days is figuring out the hostname of the computer that is connecting to our web app. We need this information because we have a queueing system in our One Stop Shops that sends customers to a specific desk when next customer service officer is free.

All our efforts so far have failed because we have only been able to get the hostname of the server that the app is deployed on. There is a libary within the .NET framework that gives you this info and there are plenty of examples on forums that tell you how to extract the value - Environment.MachineName, DNS.GetHostName, Request.UserHostName are three examples that don't work.

One of my colleagues had the idea of doing a reverse DNS lookup so we gave that a shot. Microsoft themselves recommend that you start monkeying around with the settings on IIS but I don't want to do that because I have no idea what effects it may have down the line. Rich Czyzewski suggests a few lines of code in this blog post which we tried out. Unfortunately this failed - we could see the hostname of the server when we browsed to the web page on the server itself. But when we browsed to the web page from our desktops no hostname showed up, and there were no errors being reported through Try / Catch either.

A bit more reading suggested that we try looking at the Request.Server variables collection. This is an array of values that get passed through from the browser. While no hostname was included this does look like a reliable way of picking up the IP Address of the client which is a start. The majority of desktops that will be connecting to our app have dynamic IP addresses so we can't guarantee the same one every time and therefore can't build a lookup table. So I hit on the idea of trying to do something with PING - i.e. get the IP Address of the client and ping back to it to pick up the hostname. I know that if you run the command "ping -a 111.222.333.444" on the Windows command prompt you get a hostname back. So the next step is to try and figure out if I can do something similar from the web server without crashing the application.

Monday, 3 January 2011

Using Wordpress as a Content Management System?

I was contacted by the North and Mid - Cheshire Ramblers Association after my name was forwarded to them by one of the community groups included in my original mail shot last month. They have already have a pretty good site but are concerned about keeping it running; the vast majority of the work has been done by one person and they don't want to end up with a single point of failure.

One of the common themes I noticed when I was having a look through the list of organisations seeking volunteers in the IT4Communities database was that a good percentage were all looking for help with Content Management Systems. This would either involve guidance on choosing the right one to use, or implementing one they have chosen, or making some changes to an content created through an existing CMS. I don't have much experience working with these types of packages and it's definitely something I want to explore further. But my initial thought was this: 'why not use Wordpress'.

After all, many modern sites are centered around blogs and everything else is arranged around the edges. And Wordpress is the biggest (and maybe even the best) blogging tool around. Because it's built on PHP / MySQL it's free, it's simple to install (hey, even a PHP novice like me can set it up). Many web hosting packages already have the option to install Wordpress onto a domain that you register (this is an option available to the NMCRA).

It comes with everything you need to create content out of the box - all the admin forms and security controls. Wordpress has thousands of themes that will make a site look professional, modern, stylish and colourful straight away. Lots of people use it so help is pretty much only a forum post away. And I'm sure with a bit of tinkering (either through widgets, or through some manual coding) one could modify the blog to include any other content necessary.

It looks like the Ridgway Ramblers in South Africa have taken this approach and developed a useful site chock full of photos and information. Hopefully NMCRA can achieve something similar - and maybe other community groups that are looking for a suitable content management system will consider this as a solution too.