I’ve uploaded the latest Land Registry data to my site. Prices continue on their seemingly never ending upward march.
Saturday, March 28, 2015
Thursday, March 05, 2015
A cross browser XML parser
A post from three years ago detailing how to implement selectSingleNode for XML documents in a cross-browser friendly manner is still getting a good number of hits. Which I guess shows that developers still need to manipulate XML in browsers, even with the increasing popularity of JSON. When we started to rewrite our desktop app on the web, JSON seemed like the obvious choice, but we use XPath in a big way and we wanted our web app to be compatible with our desktop app, so we stuck with XML, which meant having to deal with the different ways XML is supported in different browsers. So we now have a reasonably well featured cross browser XML parser, the source of which you’ll find below.
A couple of things to note, this probably works in IE8 and below but I’ve never tested it since our app needs at least IE9. Also, the code is TypeScript rather than Javascript, since TypeScript is slightly less insane…
// stop TypeScript complaining about stuff we don't have definitions for interface Window { DOMParser; } declare var XPathResult; class XmlWrapper { private xmlDoc: any; constructor(xml: string) { try { // try Internet Explorer first. Although later versions have DOMParser, they don't implement evaluate this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); this.xmlDoc.async = false; this.xmlDoc.loadXML(xml); this.xmlDoc.setProperty("SelectionLanguage", "XPath"); } catch (ex) { if (window.DOMParser) { var parser = new DOMParser(); this.xmlDoc = parser.parseFromString(xml, "text/xml"); } else { throw new Error("Can't find an XML parser!"); } } } public selectSingleElement(xmlNode, elementPath: string): Element { return <Element>this.selectSingleNode(xmlNode, elementPath); } public selectSingleNode(xmlNode, elementPath: string): Node { if (xmlNode == null) { xmlNode = this.xmlDoc; } if (this.xmlDoc.evaluate) { var doc = xmlNode.ownerDocument; if (doc == null) { doc = xmlNode; } var nodes = doc.evaluate(elementPath, xmlNode, null, XPathResult.ANY_TYPE, null); var results = nodes.iterateNext(); return results; } else { return xmlNode.selectSingleNode(elementPath); } } public selectElements(xmlNode, elementPath: string): Element[] { return <Element[]>this.selectNodes(xmlNode, elementPath); } public selectNodes(xmlNode, elementPath: string): Node[] { if (xmlNode == null) { xmlNode = this.xmlDoc; } if (this.xmlDoc.evaluate) { var doc = xmlNode.ownerDocument; if (doc == null) { doc = xmlNode; } var resultsArray = []; var results = doc.evaluate(elementPath, xmlNode, null, XPathResult.ANY_TYPE, null); var thisElement = results.iterateNext(); while (thisElement) { resultsArray.push(thisElement); thisElement = results.iterateNext(); } return resultsArray; } else { return xmlNode.selectNodes(elementPath); } } get documentElement(): Element { return <Element>(this.xmlDoc.documentElement); } public xml(): string { // for IE if (this.xmlDoc.documentElement.xml) { return this.xmlDoc.documentElement.xml; } // Chrome, FireFox if (this.xmlDoc.documentElement.outerHTML) { return this.xmlDoc.documentElement.outerHTML; } // Safari return (new XMLSerializer()).serializeToString(this.xmlDoc.documentElement); } public static getNodeText(node: Node): string { if (node == null) { return ""; } var value: string = node.text; if (node.textContent) { value = node.textContent; } return value; } public static setNodeText(node: Node, value: string): void { if (node == null) { return; } if (node.text !== undefined) { node.text = value; } if (node.textContent !== undefined) { node.textContent = value; } } }
Sunday, March 01, 2015
Google Earth Pro is kind of free
I was excited when Google announced Google Earth Pro was going to become free. A lot of geographical data comes in Shape files, but these aren’t usable in any free applications I know of and can’t really be used on the web without converting to something like KML first. But Google Earth Pro can load up Shape files and convert them to KML/KMZ.
Downloading isn’t a problem but getting hold of a key doesn’t seem to work as far as I can tell. Following the link to grab a free key just keeps redirecting to the download page. So I gave up in the end and grabbed an illicit key instead. Not sure of the legality of that, but if it’s meant to be free and I still need a key and Google won’t give me one, what choice did I have? Anyway a search for “google earth pro serial key or number” gave me a link to a site that produced a key I could use.
Saturday, February 28, 2015
UK house price data January 2015
I have uploaded the latest Land Registry house price data to my site. Prices continue their gradual ascent.
The BBC reports the blindingly obvious that there is a wide gap in regional house prices. This is clearly visible if you compare my place of birth with my current abode. Blackburn, like many areas outside the South East, has seen pretty much static house prices since 2008. Kingston upon Thames, like most other areas in London, took a bit of a breather in 2008 and then continued on its upward trajectory. I guess the interesting question is whether this is a permanent change or if the differences in regional prices will revert back to their historical average at some point. I can’t pretend to know the answer to that, but I do know prices in London are insane…
Wednesday, February 25, 2015
UK Postcode data for February 2015
The ONS have released the latest version of their postcode dataset and I have now uploaded it to my website. A few sanity checks suggest it is OK but let me know if you spot anything strange
Sunday, February 08, 2015
How to beat a Strava PR on every ride
I think getting to, or maintaining, a healthy weight is fairly straightforward, in principle at least. Match your calorie intake with your calorie burning. Riders on the Tour de France eat 9000 calories a day, but don’t put on any weight for the obvious reason that they burn through all those calories. Eating less has never appealed to me, so the exercise side of the equation is the one I try to work on and it generally works OK for me.
But motivation can be a problem. Cycling is my exercise of choice and a winter of cold, wet and windy weather can rather reduce the will to get out on the road. I’ve found a few things to motivate me in the past, signing up with Endomondo (and trying to beat various personal bests), buying a new bike and training for the Ride London 100 to name a few.
Strava is the latest motivator. Every ride gives the opportunity to beat a PR on one segment or another, so there are many more chances to get a little boost from receiving a medal at the end of a ride. But sometimes, nothing. A ride of an hour may lead to no achievement.
But there is a way to almost guarantee a PR on every ride. First, sign up with veloviewer. This provides even more geeky information about every segment you’ve ridden. Next, filter the segment list for ones you’ve only ridden once or twice. Next, check the weather to find out the prevailing wind. Now find some segments where the wind will be behind you. Then plan your ride to include those segments. And finally, ride the route!
And voila, chances are you will beat one of your PRs on that ride. And even better, you’ll probably have ridden some new segments during your ride, which will now be in your list of potential PR segments.
I’ve been using this technique for the last few months and I’ve still got 140 segments within 5 miles of my house that I’ve ridden 2 or less times. Of course I’ll get bored of this at some point, but maybe I’ve already found my next motivation tool (aside from Ride London 2015), increasing my Eddington number…
Saturday, January 31, 2015
UK house price data for December 2014
I’ve uploaded the latest Land Registry house price data, for December 2014, to my website. Prices seem to be gradually drifting upwards, as do the number of sales.
Wednesday, December 31, 2014
House price data for November 2014
I’ve uploaded the Land Registry sales data for November 2014 to my site.
Monday, December 15, 2014
Grading bike ride climbs
I’ve updated the route elevation page on doogal.co.uk so you can now grade climbs. It uses the same rating as Strava, which is based on the UCI climb categorization. Hopefully it will be useful if you can’t find a matching segment on Strava.
Saturday, December 06, 2014
Non-geographic postcodes added to UK postcode list
I received a complaint that some postcodes were missing from my UK postcode list that were in the original ONS data. I was a little confused by this, since the import is pretty much automated. But looking at my import code I realised I was ignoring postcodes with no location information. I think initially I’d assumed these were postcodes with duff data so ignored them, but for completeness I’ve now added them to the list, adding a few thousand more postcodes. Since they have no associated location data, there isn’t much interesting information available for each of these postcodes but they may be useful for something… An example.
Saturday, November 29, 2014
UK house sales October 2014
I’ve just finished uploading the latest Land Registry UK house sales data to my website. I then realised my annual percentage change calculation was wrong and have fixed that.
Wednesday, November 26, 2014
UK Postcode data November 2014
I’ve uploaded the latest UK postcode data to my site. There seem to be a few changes to the data (some codes for wards and districts have changed and LSOA data is now available for Scotland). I think I’ve found all the anomalies but let me know if you spot anything odd
Sunday, November 23, 2014
More options when calculating route elevations
I’ve added a couple of options to my page for calculating route elevations. You can now select options to avoid highways and toll roads so it should be even more useful!
Saturday, November 15, 2014
Goodbye Endomondo, hello Strava and VeloViewer
I’d heard of Strava before but I’d discounted it because there was no app for my Windows Phone (what’s new right?). But then I realised Endomondo has the ability to export workouts which can then be imported into Strava. So I gave it a try. And I was immediately hooked. Rather than compare activity over a specific distance/time, I can compare efforts over the same bit of road, a segment. So for any ride I might pass through 20 or 30 segments and I generally beat a personal best on at least one of them. And that helps keep me going.
And for the ultimate geek experience, there’s VeloViewer. This runs on top of Strava and gives me an even more in depth view of my performance on segments. It tells me I have cycled on 1472 segments and I have a score of 86.4 (I have no idea if this is good or bad but it’s headed in an upwards direction which seems like a good thing)
VeloViewer was free but is now asking for £9.99 a year, with a pretty limited free version. This seems like a reasonable amount to pay for something so compelling. Strava also has a premium service but I haven’t seen anything in there that I need. My guess is that Strava will probably start to require premium membership to use their API fully which means any VeloViewer users will need to pay for their Strava account to use VeloViewer. I’d have thought that would be a no-brainer for Strava, since all VeloViewer users are the kind of people who are prepared to pay for a service and are therefore likely to cough up for Strava as well.
Anyway, that should keep me going during the long winter months. Maybe my next motivator will be my own little app running on top of Strava…
Friday, November 14, 2014
House price data now with annual change
The Land Registry sales data on my site now includes the annual price change. I thought this would smooth out the seasonal variations but the annual change is still quite volatile. Even so, it may be of interest.
Friday, October 31, 2014
UK house sales September 2014
The latest house price data from the Land Registry is available on my website and prices continue to defy gravity…
Thursday, October 02, 2014
Unable to get property 'setState' of undefined or null reference in ckeditor.js
I’ve been working on the latest and greatest Business Optix product which dynamically creates lots and lots of HTML controls, some of which are CKEditor controls. Whilst testing the app and quickly navigating around it, I started getting an error “Unable to get property 'setState' of undefined or null reference” coming from deep in the bowels of CKEditor. Google astonishingly turned up nothing, but I remembered I’ve had trouble in the past with CKEditor when I didn’t explicitly destroy the editors. The fix was simple, like this
for (name in CKEDITOR.instances) { CKEDITOR.instances[name].destroy(); }
Friday, September 26, 2014
Property sales data for August 2014
I’ve uploaded the latest Land Registry data to my website. People comparing the data on my site to news stories like this may be wondering why my data shows a new all time average price, whereas the BBC say prices are yet to reach their previous peak of November 2007. I believe this is due to the Land Registry seasonally adjusting their figures whereas the average values on my site uses a geometric mean of the raw data.
Saturday, August 30, 2014
UK property sales data for July 2014
The latest Land Registry data for property sales is now uploaded to my site. Not much can be read into a single month’s figures, but the average sale price has reached an all time high, which I guess pleases a government seeking re-election soon and probably dismays first time buyers.
Wednesday, August 27, 2014
UK Postcodes August 2014
I have uploaded the ONS postcode dataset for August 2014 to doogal.co.uk. Hopefully everything is in order, let me know if you spot any issues.