Tuesday 15 February 2011

Back to the Grindstone

Oh dear!! I've lost a lot of fitness, both aerobic and climbing wise. Saturday I went for a road bike ride, just a short ride of an hour or so to get back in to things, over the hills to Colne and back. Just as well I didn't go for a longer ride as I was knackered! In mitigation my tyres were slightly soft and the first half up the biggest climbs was in to the wind but it did feel very hard work. There's the rescheduled Christmas Cracker sportive in a couple of weeks so I need to have some semblance of fitness for that but the weather forecast for the coming weekend doesn't look promising to get a long ride or two done so it might be a baptism of fire given it's 56 miles and in the Lakes.

Sunday we went to Harrogate Wall. I've not done any rock climbing or even training for it since straining a tendon at the Bridestones in early November and it showed. I struggled on just about everything and by the seventh or eighth route I couldn't hang on decent holds. Oh well, will just have to do more training.

An update on the calculator code from the last posting. After a bit more refactoring (the software engineer's fancy word for moving things about) I got to 85% common code with just 15% being specific to the BGR calculator. I then went for the PBR calculator. The code for this was quite old, probably a copy of the first generation BGR code, I certainly haven't done any work on it for a long time. The PBR calculator needs to be a bit more complicated as there are five potential starting points unlike virtually every other long distance challenge so the code had to be able to deal with that.

Everything was quite straightforward, I added a few elements to the calculator form plus copying and some slight modification of the BGR specific code and it worked! So the PBR calculator can now create multiple schedules for comparison, swap them round, etc. just as in the BGR calculator. Of course I couldn't stop there and I updated the route notes page to have the same feature set as on the BGR side of things - light status information, editable content and dynamic popups with timing details of each top. The page also presents the notes with the same starting point as chosen in the calculator so that everything lines up.

There's still one or two small issues, mainly to do with Internet Explorer, but all in all the new code and methodology has proven that it's sufficiently adaptable for my needs and I should be able to maintain and extend it easily and use it for other challenges.

Friday 11 February 2011

Wet 'n' Web

Well the weather is more like November at the moment, 41mm of rain in Skipton on Friday and all the becks and rivers are well up. Consequently there hasn't been much climbing action though I've done a few of my short run/jogs through the mire.

With the long nights and plenty of time on my hands with not getting out climbing I've been making updates to my website, in particular the Bob Graham pages. So I'll explain some of the reasons behind the changes.

When I first started the site it was hosted on the free webspace offered by my ISP. Unfortunately it was rather restricted in that there was no server side programming allowed, everything had to be done in the browser. This meant that all the code running the site was done in Javascript  and also that everything was sort of tied together.

After my ISP managed to lose the site for a couple of months (yes that really happened!) I decided to move the site to another host. I ended up on the same host as the FRA forums as Brett lives in the neighbouring village to us and his offices are close to my workplace so everything is quite handy. Another advantage was that I could have server side code - databases and the like.

The first set of changes were simply converting the site to use php as the extension in the links rather than "htm" plus some use of the organising ability that PHP (and ASP and the like) give you. Once this was done I modified the calculator code to be separated from the form that sat in front of it. However everything still happened within the browser, it just wasn't so tightly knitted together as before. This was the version 2 series of code.

Some time last year I bought a book on Web Gadgets which led me to the current set of changes. The idea behind the new code was that one piece of code on the server along with a central core in the browser would mean a great deal of code reuse not only for the BGR calculator but also for the calculator on the Paddy Buckley pages. Linking the two pieces of code (browser and server) would be AJAX which is a means of updating just parts of a page. This way I could wrap customising pieces of code around the core depending on how I wished to use it. At the moment I haven't got the balance quite right as there is only about 30% of the code in the core!! However it should be possible to change this so that perhaps 80% will be in the core files. I am looking at a single generic core file with  supplementary application files which will be wrapped with specific code for each calculator. If I've got it right then implementing the PBR calculator will be simple.

With the first cut of the code released I'm now working towards getting the calculator in to widget form so that users of the Windows Sidebar, the Mac Dashboard and hopefully Google Gadgets will be able to access the same information on their desktop. I've already made the schedule estimator available as a widget that users can embed within their own web pages.

With all that out of the way I just hope that the nice winter weather returns rather than the grey muck we currently have.