Archive for the ‘Tech’ category

Metro Timetables

April 30th, 2011

For a long time I have been trying to get a copy of the Tyne and Wear Metro timetables in a format that I can work with in software. Although Nexus (the owner and the former operator of the Metro) is mandated to distribute the timetable they can choose the way the information is distributed, and they chose a PDF for each station.

Last year I decided to create the Metro simulator that shows the state of the Metro system at any given time. This was so I could find out how many trains there were on the network at a time and visualise where they were. To do this I manually entered the weekday timetable. A task that took 18 hours over several days just to get the weekday timetable in.

I did not give up thought and although the recent timetable changes were not great with only a few peak time trains being dropped I decided to make a big push for the new timetables rather than altering my current on.

The way I eventually successful in getting the information was via a Freedom of Information request to Nexus via the My Society web service What Do They Know where you can follow the communications relating to the request. I must confess I was expecting the standard we have the PDFs again, or perhaps now the commercial interest card to be (inappropriately) played, but instead the gentleman responsible was most professional and got the information I was requestion instead of trying to get out of giving it. For that I am truly respectful and grateful.

I have been also given some legal advice regarding any IP issues and in short we can do just about anything with it and distribute it. The one thing we can not do is exactly reproduce and distribute it, but that is not an issue here. If you want to play with the data yourself then it can now be downloaded from Weekday and Weekend.

Update: The time tables have changed again slightly but I intend to create an updated database to reflect that.

DarkBar

March 27th, 2011

There are many times I knock up a quick application to work around a problem and then just throw it away. I decided that I really should make more of these available to others who may well be having the same problems as me. This is the first of what will hopefully will be many such apps.

DarkBar is a little Windows application that sits at the top of the screen and blanks out any headers or menus of any other maximised application. I built this for a display showing Google Earth at the Maker Faire UK. You can switch Google Earth to full screen mode and turn off all the on screen controls, but you can not get rid of the menu at the top, and that looks a little naff on a big screen. When DarkBar is loaded it stays in front of the Google Earth window and masks out the menu.

By default DarkBar will load on your last monitor and be the height of the standard Windows menu. If you want to change this you will need to enter the following optional parameters.

DarkBar <monitor_number> <bar_height>

To access the DarkBar menu and to exit the application just right click on the bar. Click here to download DarkBar and please let me know if you find it useful.

I have a new laptop

January 30th, 2011

….and the winner is, A Sony Vaio VPCEB3J1E. This is my quick review of it.

Originally I decided not to continue with a Vaio despite my good experiences of them because of the cost, but by the time I had added up the total cost of the other options with all the features I needed they were back in play again.

* Build

The general build of the machine is good. The colour is a rather unusual brown, but that saved me £50 at the Sony shop so I went for it. I am pleased that it has plenty of USB ports that were lacking in my last Vaio, and I now have a SATA port to play with. The PCMCIA port has been replaced with an Express Card port and the Firewire has now vanished. There is fan noise but no more than I expect in a modern-day laptop.

* Keyboard

The keyboard is good with nice response from the keys when you push them with a low pressure and I am really starting to like it. As I tend to use it a lot this is important to me. They have squeezed a full keyboard with numeric keypad but pleasingly have not reduced the key size. I am finding this a little odd with the keyboard is slightly to the left of where I am use to it being, but I am getting use to it. Offsetting the touch pad in line with the QWERTY keyboard is a great bit of thinking.

* Touchpad

This is merged in to the case and there is no hard edge to sensitive aria. I am getting use to it but do prefer being able to judge where my finder is on the pad by feeling the edge. I have had to turn off many of the special scroll functions until I get more use to it. I have also had to turn the multi-touch functionality off for now as I am finding more annoying than intuitive, but this is more of a Windows than a hardware issue.

* Screen

The screen was the one thing that did not live up to the success of the rest of the computer. I am a bit picky when it comes to my screen and it is well known that touching my screen is punishable by death. My last machine had a lovely screen that when it was black it was very black and coped well in daylight. Don’t get me wrong, this is a really nice screen and in line with the competitors on the market, but it is just not quite as good as my last one. I discovered that it is important to tweak the colour settings in Windows using the wizard to have a half decent screen. Another minor annoyance is that I can’t fold the screen almost flat. It might sound daft but I did this a lot to read something behind the computer or get rid of a reflection on the screen. Also the height of the screen is smaller by 32 pixels and I am amazed how much smaller that makes it feel despite being a lot larger in reality and pixel count.

There is also a good old VGA output and an HDMI port.

* Hard Drive

Nothing special but that is okay. I am doing more with visualisation for development and testing and the hard drive is always the thing that is the week point. Because of this I am running with it and considering an upgrade in the future. For most stuff this is fine and again the same as everything else on the market.

* Battery

It has a battery? The official specification says 2.5 hours but many shops round it up to 3. In reality it is just over a couple of hours, but for the last couple of years my old laptop has given me 30 minutes tops and I need it for working for when I am plugged in and will be using the netbook for presentations and computing in the train. With this in mind it is a small battery but I am not bothered.

* Sound

Not really had a proper chance to test it but properly but seems quite nice. I have already done some Software Defined Radio working with it and it copes well with a surprisingly high sample rate.

* Windows

It came with Windows 7 Home Premium. Although I lost the trust of Windows a while ago now I need it for some development projects so will stick with it for now. There are some things that they have improved for me, but there are also many other things that make my life harder.

* Bugs

I am still trying to fully debug the problem, but the machine waking up in the middle of the night and flattening the battery. It appears to because of a bug in the Vaio hardware or firmware in combination with Windows media services. The quick fix appears to be to unplug the power before hibernating, but I will blog about this properly when I have done a few more tests.

So, in summary I do rather like the machine and am still pleased with it a month on. There are cheaper options for most users, but if your needs are close to mine I do suggest giving them a look.

One final note. I purchased my machine from the Sony shop because they had a discount on at the time, and Dixon’s / PC World / Curries / whatever they are called this week refused to honour the discount (expect a rant blog soon). If you are going to buy from Sony online DO NOT SET YOUR LOCATION because it will tell you the prices at your local store, but will also increase the online prices to those prices. Yes, if you don’t select you location the online price will be cheaper.

SuperMondays: Open Data

October 20th, 2010

A quick post to say that I am speaking at this month’s SuperMondays event in Newcastle about open Data. More specifically I will be talking about the Hack Days I have been to and what we created using the open data available to us. I will also be giving an overview of the Culture Grid API and inviting everyone along to the Culture Grid Hack Day happening in Newcastle at the start of December. More details on that to follow. There are still places left for Monday so please sign up and come along.

Yes, I am still a BarCamp Addict

June 2nd, 2010

Last year I blogged about my addiction to BarCamps and I decided it was time to update the list of the BarCamps that I have attended.

I have also attended several BarCamp spin-offs including PhotoCampLeeds (28th February 2009), UnSheffield (19th, 20th, and 21st June 2009) talking about “Are people clever and/or stupid?”, Barcamp Transparency UK (26th July) where we discussed “should everything be open?”, and WarbleCamp (8th and 9th May) where we had a twitter show and tell.

So, by my quick count I have attended 29 to date but am still looking forward to the next one. I must need some kind of treatment. Sadly BarCampLondon8 has been indefinitely postponed because of a problem with the venue, and I suspect I will not make BarCampOxford, but BarCampBlackpool was a great event last year with a real party atmosphere so I hope to see you there.

What is the best free email?

May 16th, 2010

I have been using Gmail for almost 6 years now and for me it is great. The ability to have almost instant access to all my communications form almost anywhere is just so useful.

So why do I want to move? Well I don’t, and I am not planning to, but I do want a backup in place just in case Gmail becomes unavailable to me for whatever reason. More recently I have forwarded all my incoming email to Yahoo Mail as the backup, but unfortunately I have had to have Yahoo re-activated my mail again because of “suspicious activity” on the account. This takes time to sort it out I would hesitate moving to Yahoo Mail should I need to because of it.

So, what service do you think is best? Answers of a postcard, as comments here, on Twitter, or even just email me. :-)

BarCampNorthEast3

March 16th, 2010

It is just under a week until BarCampNorthEast3 and we still have some tickets available. This year we are in the great Centre for Life, it is a full overnight event if you want to stay over, and I promise you that if you come you will love it and keep coming to more. There is more information about the event and tickets on the BarCampNorthEast web site.

Blogger to WordPress migration

March 10th, 2010

This blog post summarises my move from a Blogger blog that is published using the (soon to be deprecated) FTP publishing, to a locally installed version of WordPress. My aim is to keep a majority the URLs the same, and seamlessly redirecting users and search engines on the ones I can not. I suggest at least skimming the blog post before starting the move. I also strongly recommend not skipping the backup. Okay, let’s go…

The first thing to do is to set up new installation of WordPress. This is well documented else where so I will not go through that here. I am assuming you have the technical ability to do that, and if you do not then perhaps WordPress is not for you.

Next make a backup of your Blogger blog. Do this by selecting “Export blog” from the “Basic” settings on the “Settings” tab in Blogger. This is important as the migration process will destroy your comments and loose other settings. If it goes wrong you will need this file to go back and try again.

Next you need to switch your blog to a “blogspot.com” address for an FTP published blog. To do this select “Publishing” from the top of the “Settings” tab in Blogger, click to option to switch to “blogspot.com (Blogger’s free hosting service)”, enter a temporary Blog*Spot address (that can be literally any text and you don’t need to remember it) and save the settings.

We are now ready to import the blogs in to WordPress. Log in to WordPress and select “Import” from the “Tools” menu. Select Blogger (obviously) , click the “Authorise” button, and then “Grant Access”. With luck You should be able to click the import button next to the blog you want to, well, import. Wait while it does it’s magic. For some reason it thought I had fewer comments than I did that made the progress bar go mad, but I left it a while and it worked okay.

Next to fix the premalinks.

Set the WordPress permalinks setting so the format reflects your current blog. You can finds the setting in “Permalinks” from the “Tools” menu. If your old archive settings were for monthly archives with a php extension (like mine) then your new setting will be “/%year%/%monthnum%/%postname%.php”. Add a “/%day%”, remove the “/%month%”, or change the “.php” as required. Remember to created the .htaccess file as requested when saving. If you archived by week then my apologies, but you are on your own with that one as there is no direct mapping between old and new.

Now to change the “slugs” so that the new post URLs are the same as the old ones. To do this we need to run some SQL and I will have to leave you to figure out how to do this on your hosting provider. Most ISP control panels will have a link to phpMyAdmin somewhere.

You can optionally find out what will need to be changed by running the following. This is totally optional and you don’t need to run this if you don’t want to. Not that if you run this at any time you unpublished posts will show up as hey don’t have any slug yet.

SELECT posts.`post_name`, meta.`meta_value`
FROM `wp_posts` AS posts, `wp_postmeta` AS meta
WHERE ( posts.`ID` = meta.`post_id` ) AND ( meta.`meta_key` = 'blogger_permalink' ) AND ( posts.`post_name` <> SUBSTRING_INDEX(SUBSTRING_INDEX(`meta_value`,'.',1),'/',-1) )

If you changed the default settings when installing WordPress remember to replace the “wp_” prefix with the one you changed it to. Do this will all the SQL in this post.

One difference between Blogger and WordPress is that Blogger allows you to have multiple posts with the same files names posted of different days, weeks, months or years (depending on your old Blogger settings), while WordPress requires a unique “slug” filename regardless of the date. With four years of blogging I have been lucky and had no duplicates. If you do have a duplicate then WordPress will rename one of them by editing the post after the import. You can find out how many times each name is used by running the following (rather quick and messy) SQL…

SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(`meta_value`,'.',1),'/',-1), COUNT( SUBSTRING_INDEX(SUBSTRING_INDEX(`meta_value`,'.',1),'/',-1) )
FROM `wp_posts` AS posts, `wp_postmeta` AS meta
WHERE ( posts.`ID` = meta.`post_id` ) AND ( meta.`meta_key` = 'blogger_permalink' ) AND ( posts.`post_name` <> '')
GROUP BY SUBSTRING_INDEX(SUBSTRING_INDEX(`meta_value`,'.',1),'/',-1)
ORDER BY COUNT( SUBSTRING_INDEX(SUBSTRING_INDEX(`meta_value`,'.',1),'/',-1) ) DESC

If you have a duplicated name where count is greater than 1, then make a note of it and rename one of them after the import. If you want to make the old URL point at the new page you will need to add something to the htaccess file.

Now we are ready to change the slugs. To do that just run the following SQL script…

UPDATE `wp_posts` AS posts, `wp_postmeta` AS meta
SET posts.`post_name` = SUBSTRING_INDEX(SUBSTRING_INDEX(meta.`meta_value`,'.',1),'/',-1)
WHERE ( posts.`ID` = meta.`post_id` ) AND  ( meta.`meta_key` = 'blogger_permalink' ) AND ( posts.`post_name` <> '')

Now we need to fix the links to the archives and the labels. To do this I got the server to direct the browser from the old URLs to the new ones using a 301 (permanent) redirect.

First I create a directory called “archive”, create a file in it called “.htaccess” and cut and paste the following code in to it…

RewriteEngine On
RewriteBase /blog/
RewriteRule ^([0-9]+)_([0-9]+)_([0-9]+)_(.*)$ $1/$2/ [R=301,L]

My blog is stored in a subdirectory “blog”. Simply change the RewriteBase line to reflect your blogs location. If you used the day in your old archives then add “$3/” after “$2/”, and remove the “$2/” if you archive by year.

Now for the labels create a directory called “labels”, create another file in it called “.htaccess” in it, and cut and paste the following code in to it…

RewriteEngine On
RewriteBase /blog/
RewriteRule ^(.+)\.(.*)?$ category/$1/ [R=301,L]

Again change the RewriteBase for your blog. This should work whatever your blog settings are.

Finally the RSS feed has also changed so add the following to your blog’s main .htaccess file.

RewriteRule ^atom\.xml$ /feed [R=301,L]
RewriteRule ^rss\.xml$ /feed [R=301,L]

If you don’t want to take down your web site while you are doing this then you can install the blog elsewhere to do the port, and then move the WordPress install in to place. You will also need to change all the references in the database from the temporary URL to the normal one. Just changing the settings in WordPress is not enough. I did the install on a subdomain using the same file structure at the live site, backed up the database as SQL (after the port), did a find a replace of the SQL replacing the temporary domain name to the normal one, and finally run that SQL to replace the old data. Then when I copied the WordPress files across it just worked.

I hope this is of help and I wish you luck in your move. I really can not help with dozens of noddy questions, but if you are really stuck then feel free to get in touch and I sell see if I can help.

UPDATE: There appears to be a bug affecting at least a few of us. The WordPress import process is only importing the latest 50 comments. To work around this follow import process above, but after the posts have been migrated, and before running the scripts, do the following. Delete all the comment on the blog (to avoid duplicates), run your Blogger backup through http://blogger2wordpress.appspot.com/ and import the file produces. I am hoping that is all you need to do and you can continue with the instructions above. Personally I then had to manually go through the log of imported posts and manually merge them, and if you have run the scripts then you will need to do the same, but I an hoping you will not need to do this if you do not run the scripts first.

You can still switch to Blogger FTP publishing (for now)

March 6th, 2010

This blog post might be of use to you if you, like me, you are migrating your Blogger blog to WordPress. As you may have read I am having to move my blog because Blogger is removing it’s publish by FTP feature.

When you first try and migrate your posts it will fail. After a bit of head scratching I realised that this was because the WordPress “import” migration relies on the blog being hosted on a “blogspot.com” address and not on a custom domain. You can easily change this temporarily without affecting your current blog. Just clock the appropriate option under “Publishing” from the blog’s “Settings” tab.

If you then want to edit your old template to redirect the old URLs to the new ones, or are just testing the migration process, you will need to switch back to FTP. This would not be a problem if Blogger had not removed the FTP option already, but they have, so it is. Fortunately the feature is still active and it is just the link that has been removed.

So, to switch back now you need to look at the address of the page when you are creating a post or editing blogger settings. Make a note of the “blogID” from the line. Then paste the following in the address bar replacing XXXXXXXX with the blogID value.

http://www.blogger.com/blog-publishing.g?blogID=XXXXXXXX&publishMode=PUBLISH_MODE_FTP

You can then check all the details, enter the captcha, and save the setting to get back to where you were before. I hope this is of help.

March 2010 Events

March 1st, 2010

People ask me to let them know when something is happening that they might be interested in and I try and do that, but this month there are so many events I thought I would also summarise them here…

  • March 4th is another Dorkbot Newcastle in the Life Lab at the Centre for Life. This month Sam Goldwater talks about animation techniques, David King talks about his KISS ethos (Keep It Simple, Stupid), and Brian Degger talks about the curve from scientist to new media.
  • March 12th is Datarama. This month is an AV and Science festivals special at the Start and Shadow. This is a show and tell with a artistically creative slant. You never quite know what you will see and it is worth a visit.
  • March 13th and 14th is the second Maker Faire at the Centre for Life. This is a chance for the UK’s mad inventors (including me) have a chance to show off there creations.
  • March 17th NE Bytes is back at Newcastle University. This month features Visual Studio 2010 with Richard Fennell and Matt McSpirit from Microsoft talks about System Centre in the R2 Wave.
  • March 20th and 21st is BarCampNorthEast3 at the Centre for Life. This is a chance to share your experiences and skills with others and you are coming. Attendance is mandatory but I promise you that you will enjoy it. :-)
  • March 29th is Super Mondays. This month is all about mobile payments featuring John Lunn from PayPal.

Finally March 10th and 24th is the fortnightly Newcastle Coffee Morning from 8:30am at the The Settle Down Café. Just a chance to have a cupper and a chat before work.

That is it for now. I recommend all these events. There are more details on the events web sites but feel free to ask me if you want any more details.

css.php