Walking the London LOOP - part 21 (part 2) and 22

We traveled to Noak Hill by various means of transport. We traveled to Liverpool Street by tube, then train to Harold Wood and then by bus to the point where we aborted last time. Or sorta, as the bus stopped 50 meters short or so.

Section 21 (part 2)


Just after we got off the bus, we spotted another couple doing the LOOP. They were slightly faster than us, although we did catch up with them near the end of section 22. The first few hundred meters were tough going, as it was near a brook through some woods. With lots of fallen over trees and some very narrow paths. But this didn't last very long and we walked a bit besides Carter's Brook, a tributary of the Ingrebourne river, before entering Central Park. This Central Park is not nearly as large as the one in New York, but it did have a bench with Henry VIII behind it.

After Central Park we followed the path besides Paines Brook and after a while we walked past The Old Brickworks to get back to Harold Hill station to finish this short part of section 21. We skipped going to the pub The King Harold as we've only been going for about ¾s of an hour.

Usually at each section's start there is a nice brass plaque for that section. Unfortunately, at Harald Wood Station, it was gone. Likely vandalized.

Section 22


Continuing past the Archibald Road allotments we soon came upon Harold Wood Park with its cricket club and play ground. I attempted to take a nice photo of a tree with coloured leaves with the Sun just behind it, but the result wasn't as good as I would have hoped.

From Harald Wood Park we crossed into Pages Wood, although, most of the wood seemed to just have been planted. It was more of a walk through a meadow with some small trees on the sides, than a "wood". It was quite pleasant though, and because it was quite warm, we decided to have a little picnic just before we left it.


Then came a rather nasty section of the walk, past a road, and across the A127. Another mile later, we happily left the roads behind to go through some fields, and we walked besides the Emerson Park School's playing fields towards Upminster Bridge station, where the walk ended.

We really didn't stop at any pub throughout this walk, but on the way home, we called out our favourite cider pub, the Euston Cider Tap for some refreshing drinks. This was nearly the warmest walk that we did, so we thought we quite deserved our pints. Only one walk left now!

The weather was really warm and sunny at 25°C, although towards the end there were more clouds. We took 2¼ hours for the 11km.

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.


This article has a short URL available: http://drck.me/loop2122-b43


No comments yet

Walking the London LOOP - part 20 and 21 (part 1)

Another weekend, another walk. While having a few beers on Sunday, we had a look at the weather forecast for the day after. It looked really good, we decided that we were going to attempt 3 sections in one day. At a whopping 16½ miles. That meant getting up early too, and not spending ages getting breakfast. By the time we finished breakfast, we were already an hour behind schedule…


We traveled to Chigwell by means of Bakerloo to Oxford Circus and then the Central line out to Chigwell. On the way back from last time the trip via Woodford was recommended, instead of going the long way around via Hainault. So when we were waiting for the train at Oxford Circus we decided not to wait 7 minutes for the direct train via Hainault to Chigwell, but instead transfer again at Woodford. That ended up being a mistake, and we had to wait 20 minutes at Woodford to get to Chigwell. When we got to Chigwell, and the start of the walk by 11:15, we were an hour and a half behind schedule. Not a great start.

Section 20

After a short stretch along the High Road we turned into a first meadow just after passing by St. Mary's Church and an old Tudor Looking building—formerly Ye Olde King's Head. After a few minutes we crossed another road and ended up in the country, with loads of fields. While walking along the edge of one, we saw a familiar "public footpath" sign, which pointed diagonally across a field. The path was however not really visible at all, and the sign at the other end was on the ground. Not more than 15 minutes later, a similar situation popped up when both the walking directions, map and a fallen over guidepost told us to cross a field, which was clearly just planted without any regard for the public right of way. After pondering about we decided to go around the field, although I think we really should have crossed it. The PROW blockage has been reported.


After a while, we passed the Chigwell Water Treatment Works and wandered into another bit of meadow. Right after we crossed a stile we saw a little worm scurrying away into the undergrowth. We think it was a slow worm.

We passed by another church and after crossing the busy Romford Road we had to push through a gate so small that I had to take off my backpack. Going through another gate got us into Hainault Forest where after a while we got to a lake full of "ducks" (where "ducks" means ducks, geese, swans and moor hens).


Walking around Fox Burrow Farm we could quite well see that autumn was near. Some of the trees started showing their amazing autumn colours. Hopefully, on the last two walks these colours will be more pronounced. At the top of the field we had a great view over London, with the Shard, Canary Wharf and the City's skyscrapers barely visible through the haze.

A while later we crossed a fairway of the Hainault Golf Club where I nearly got a golf ball on my head as it went the wrong way straight up into the trees.


We escaped the golf club through a stretch of wood, the Mile Plantation and ended up at a corn field. This time, there was a neat path through the field and Morag and I had great fun pushing through it. However, we did not pay enough attention and ended walking along the wrong side of a thorny hedge and ditch. Something we only found out when we got to the end of it. There wasn't really a way for us to cross the hedge and ditch, and as we didn't really want to walk all the way back we simply jumped a barbwire fence.

Soon after we came upon a field with horses in it. One was very interested in us and followed us all along the fence! Soon after, we climbed a little hill and sat on a bench admiring the view, while I removed a stone from my booth.

In the last stretch of section 20 we crossed into Havering Country Park, where we walked over Wellingtonia Avenue with its majestic Sequoia trees into Havering-atte-Bower. Here we stopped at The Royal Oak where the friendly landlady poured us a refreshing beer.

Section 21 (part 1)

With the beer gone, we continued the walk, now section 21. On our right we spotted The Round House. However we found the signage slightly lacking and after a few minutes trying to figure out where we had to go, we realized we had to go through a gate which had horses just behind it trying to "escape". In our speed to open and close the gate, Morag let out quite a scream after she inadvertently touched the electrified fence.

I didn't escape damage either. With the forecast being so nice I went with shorts. In the end, that wasn't the cleverest idea as we had to go through quite a lot of brambles and stingy nettles. With as result my legs got all scratched and itchy. When we neared the top of another (small) hill we startled a covey of grouse and a nide(?) of pheasants. There were quite a lot and some kept hidden in the undergrowth even when we were nearly on top of them. The view from the summit was great, but there were more horses following us. Nobody got electrocuted this time though.


We hit more brambles and stingy nettles, and walked around a corn field that we apparently should have gone through. We passed by some woods, but then also missed a turn through a well hidden gap in the hedge and had to double back a little again. But we were not half way our second stage, and at a little to four it was already darker than we would have liked. So we decided to abort section 21 near a half way point. We still had a few more steps to make though, and we encountered a gate onto footpath 16. However, there was not a path behind the gate, but a vast jungle. We didn't spot a tiger.

By this time, we neared the pub The Bear on Noak Hill Road, where we took the bus into Harold Wood to take the train back into London. This leaves us with half of section 21, and all of section 22 to do on our next walk.

The weather was cloudier than expected and it wasn't very warm, at about 16°C. We took 3¾ hours for the 16km that the walk took.

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.


This article has a short URL available: http://drck.me/loop2021-b3u


No comments yet

Walking the London LOOP - part 18 and 19

After a month long hiatus, we started with another few walks to finish the LOOP within our one year goal. I made an extra few checks to make sure I was recording a trace with my GPS (successfully).

Section 18


Starting at Enfield Lock station, our first highlight was, as you might guess, Enfield Lock itself. After the lock, we continued first past the river Lee, and then the King George V reservoir, and finally the Rammey March Flood Relief Channel. In a field we found some very tiny horses as well.


Crossing a road, our route was disrupted by a car boot sale. Instead of traversing a field diagonally, we had to zig zag around it avoiding cars and vans. At the end of the field we started climbing up Daws Hill which gave some nice views over the King George IV reservoir. At the top of the hill, we got minimally lost, as our path continued through a hole in a hedge that was quite overgrown. Once we found the path through, we ended up in a meadow.

After a while we got to the Gilwell Scout Centre, which was rather empty looking. Some fields later, we made our way to Chingford. Instead of following the LOOP through a car park and past a road, we continued along a field directly to The Royal Forest for a refreshing pint.

Section 19


After the beverage, we continued, now on section 19 of the LOOP. Near the pub we passed the Queen Elizabeth's Hunting Lodge and a café. We then had to push through some undergrowth to continue our way towards Buckhurst Hill. Not long thereafter we had a quick snack at Simply Seafood on Epping New Road. A rather "local" establishment, serving a multitude of various seafood dishes. We stayed on the safe side and had a fish finger sandwich.

After filling up, we walked to Buckhurst Hill, where we crossed the Central Line section to Epping. The walk through Buckhurst Hill was nicer than I thought it would be. Instead of walking through a town, the LOOP guided us in between residential areas through a patch of green ending at a pond (or reservoir).


After going around a David Lloyd sports centre the last part of the walk crossed the M11 and got us past a road into Chigwell, were we celebrated yet another successful walk at The King William IV for a few snacks and another pint. On the way to Chigwell station, I did a spot of mapping to get some more shops, and a postbox, onto OpenStreetMap.

The weather was rather cloudy and it wasn't very warm, at about 20°C. We took 3¼ hours for the 15km that both sections took.

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.


This article has a short URL available: http://drck.me/loop1819-b3s


No comments yet

Walking the London LOOP - part 17

We walked section 17 of the LOOP nearly a month ago on August 17th. I've procrastinated on writing about this section for way too long, so hopefully my memory has not degraded too much.


We started off in Cockfosters at the end of the Piccadilly Line and after turning on my GPS we headed straight into the woods to end up at Trent Park. We passed by a no longer used campus of Middlesex University, which was barely visible behind the trees. This part also featured an obelisk which we glimpsed after climbing up a steep hill into, and out of the forest. This location was apparently also used in a Doctor Who episode!

After crossing Hadley Road, we continued past corn fields, where the corn was already harvested. After quite a bit more farm land, part of the Enfield Chase Estate we climbed up another short hill and through newly created Brooke Wood to get to the outskirts of of Enfield.


We did not enter the town, but instead went north over a very nice new paved path, which continued onto an even nicer metalled path through woods and under a bridge with the Hertfordshire loop rail line going overhead. The nice path continued past friendly horses and green houses. Only a few of the green houses remained of a once vast area full of them. After following more paved paths we wandered into Hilly Fields park from where we started to hear music. First fairly soft but constantly swelling. We abandoned our original plan of having a pint and lunch at The Rose and Crown, apparently linked to the Gunpowder Plot, as it was way too loud in, and around the pub. Instead we continued onwards with Turkey Brook to our left, with the music slowly getting less loud over the next mile.


We entered Forty Hall estate where we made a detour to have lunch at the nice green café. Nice it was, but the service was also incredibly slow. We did get our lemonade and cake fix sorted though.

The section continued by crossing the foot bridge over the A10 to King's Lynn, and past the Enfield Crematorium. After a short section through Enfield, we finished the walk by going through Albany part. Crossing both the rail way and Turkey Brook took us to the end at Enfield Lock station.

So, remember that I said at the start of this post "turned on my GPS" — well, I had. But it decided to not see the SD card, and hence not log to it ☹. I had to use my wife's inaccurate "Moves" data, run some extrapolations with gpsbabel, and do some other magic to geo-reference the photos that I took. Bah humbug. I am now making extra sure that the SD card is readable!

The weather was mostly cloudy. It was warm at 20°C and not nearly as humid as we feared. I did not remember this at all, but handily, Wunderground has nice historical data available for August 16th, 2014. We took a little over three and a half hours for the 10 miles (16.5km).

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.


This article has a short URL available: http://drck.me/loop17-b3l


No comments yet

Natural Language Sorting with MongoDB

Arranging English words in order is simple—well, most of the time. You simply arrange them in alphabetical order. However sorting a set of German words, or French words with all their accents, or Chinese with their different characters is a lot harder than it looks. Sorting rules are specified through "locales", which determine how accents are sorted, in which order the letters are in and how to do case-insensitive sorts. There is a good set of those sorting rules available through CLDR, and there is a neat example to play with all kinds of sorting at ICU's demo site. If you really want to know how the algorithms work, have a look at the Unicode Consortium's report on the Unicode Collation Algorithm.

Right now, MongoDB does not support indexes or sorting on anything but Unicode Code Points. Basically, that means, that it can't sort anything but English. There is a long standing issue, SERVER-1920, that is at the top of the priority list, but is not scheduled to be added to a future release. I expect this to be addressed at a point in the near future. However, with some tricks there is a way to solve the sorting problem manually.

Many languages, have their own implementation of the Unicode Collation Algorithm, often implemented through ICU. PHP has an ICU based implementation as part of the intl extension. And the class to use is the Collator class.

The Collator class encapsulates the Collation Algorithm to allow you to sort an array of text yourself, but it also allows you extract the "sort key". By storing this generated sort key in a separate field in MongoDB, we can sort by locale—and even multiple locales.

Take for example the following array of words:

$words = [
        'bailey', 'boffey', 'böhm', 'brown', 'серге́й', 'сергій', 'swag',

Which we can turn into sort keys with a simple PHP script like:

$collator = new Collator( 'en' );
foreach ( $words as $word )
        $sortKey = $collator->getSortKey( $word );
        echo $word, ': ', bin2hex( $sortKey ), "\n";

We create a collator object for the en locale, which is generic English. When running the script, the output is (after formatting):

bailey: 2927373d2f57010a010a
boffey: 294331312f57010a010a
böhm:   2943353f01859d060109
brown:  294943534101090109
серге́й: 5cba34b41a346601828d05010b
сергій: 5cba34b41a6066010a010a
swag:   4b53273301080108
svere:  4b512f492f01090109

Those sort keys can be used to then sort the array of names. In PHP, that would be:

$collator->sort( $words );
print_r( $words );

Which returns the following list:

[0] => bailey
[1] => boffey
[2] => böhm
[3] => brown
[4] => svere
[5] => swag
[6] => серге́й
[7] => сергій

We can extend this script, to use multiple collations, and import each word including its sort keys into MongoDB.

Below, we define the words we want to sort on, and the collations we want to compare. They are in order: English, German with phone book sorting, Norwegian, Russian and two forms of Swedish: "default" and "standard":

$words = [
        'bailey', 'boffey', 'böhm', 'brown', 'серге́й', 'сергій',
        'swag', 'svere'
$collations = [
        'en', 'de_DE@collation=phonebook', 'no', 'ru',
        'sv', 'sv@collation=standard',

Make the connection to MongoDB and clean out the collection:

$m = new MongoClient;
$d = $m->demo;
$c = $d->collate;

Create the Collator objects for each of our collations:

$collators = [];

foreach ( $collations as $collation )
        $c->createIndex( [ $collation => 1 ] );
        $collators[$collation] = new Collator( $collation );

Loop over all the words, and for each collation we have define, use the created Collator object to generate the sort key. We encode the sort key with bin2hex() because sort keys are binary data, and MongoDB requires UTF-8 for strings. My original plan of using MongoDB's BinData type did not work, as it sorts first according to the length of the data. Encoding with base64_encode() also does not work, as it's encoding scheme does not keep the original order. Encoding with utf8_encode() does work, but as it creates some binary (but valid-for-MongoDB-UTF-8) data, it's not good to use as an example.

foreach ( $words as $word )
        $doc = [ 'word' => $word ];
        foreach ( $collations as $collation )
                $sortKey = $collators[$collation]->getSortKey( $word );
                $doc[$collation] = bin2hex( $sortKey );
        $c->insert( $doc );

When we run the script, and see what's in the database, we find something like the following for böhm:

> db.collate.find( { word: 'böhm' }).pretty();
        "_id" : ObjectId("53fc721844670a35498b4569"),
        "word" : "böhm",
        "en" : "2943353f01859d060109",
        "de_DE@collation=phonebook" : "29432f353f0186870701848f06",
        "no" : "295aa105353f018687060108",
        "ru" : "2b45374101859d060109",
        "sv@collation=standard" : "295aa106353f01080108",
        "sv@collation=default" : "295aa106353f01080108"

To see the sorting for the words in all the locales, I've added the following to the end of the script:

foreach ( $collations as $collation )
        echo $collation, ":\n";

        $r = $c->find()->sort( [ $collation => 1 ] );
        foreach ( $r as $res )
                echo $res['word'], ' ';

        echo "\n\n";

As you can see, we call sort() and specify which field to sort on. The $collation variable contains the name of the collation. In each stored document, the field with the name of the collation, stores the sort key for that collation as you saw in the previous MongoDB shell output.

Running with this part of the code added, we get:

bailey boffey böhm brown svere swag серге́й сергій

bailey böhm boffey brown svere swag серге́й сергій

bailey boffey brown böhm svere swag серге́й сергій

серге́й сергій bailey boffey böhm brown svere swag

bailey boffey brown böhm swag svere серге́й сергій

bailey boffey brown böhm svere swag серге́й сергій

  • In English, the ö in böhm sorts as an o.

  • In Germany's phone book collation, the ö in böhm sorts like an oe.

  • In Norwegian, the ö in böhm sorts as an extra letter after z.

  • In Russian, the Cyrillic letters sort before Latin letters.

  • In Sweden's "standard" collation, the v and w are considered equivalent letters.

By generating a sort key for your data, you get to chose with which locale MongoDB will do the sorting, but with the overhead of having to maintain an index yourself. ICU, the library that lies underneath PHP's intl extension supports a lot more customisations for collators, and even allows you to define your own custom rules. In the future, we will likely see some of this functionality make it into MongoDB as well. Until this implemented, generating your own sort-key field for each document like this article shows, is your best MongoDB-only approach. If you find collation sorting in MongoDB important, feel free to vote on the SERVER-1920 issue in Jira.


This article has a short URL available: http://drck.me/mdbcoll-b2p


Nice tip. I just wanted to mention that even for english you have to use a technique like this to sort properly: résumé is sorted after rope if you use a binary sorting method. Sorting people's names is another common requirement in english-only software where you need UCA collation to sort it properly.

Life Line