Hello Laos, Cheerio Aperture

We got back from our latest long haul trip at the end of January. I normally try to write up our interesting trips as quickly as I can while I can still remember everything, but I’ve been migrating off my old Mac Pro – or more specifically, Aperture – which has turned into a pretty torturous affair. As it’s also something that has a direct bearing on the photos I’ll be embedding in this post, I’ll make a few comments on it. With the demise of Aperture landing at some point, I imagine there are a lot of people planning a similar move.

The long and short of it is that you have a few choices with your library under management with a view to moving, and – beyond the obvious, like organising your source files in a sensible directory structure – they all revolve around what to do with your edited files. You can either save them as separate duplicates files into the same library and live with the repeats, you can store them separately and live with the disconnect, or you can throw them away. After a lot of messing around I chose the final option.

This sounds draconian, but most of the changes I was making in Aperture were pretty minor – just topping and tailing exposure settings. There are a couple of exceptions to that, and the first is portraiture: I’ve tended to put a lot more effort into those. However they tend to be one-offs: I find I work on them at the time, send them to people, and then don’t really think about them again. I still have all of my original Aperture files backed up on a cloud service, so I have a few months to make up my mind as to whether or not I care; for now, I don’t think I do. The other exception is HDR but the Nikor plugin for Aperture that I was using saved the resulting merged file back as a Tiff, so I’ve got all of those.

If you are planning on a more sophisticated approach, like import tools, don’t bet the farm on it. I couldn’t get LightRoom’s offering to work.

It appears that I’m not alone in finding the subscription model that Adobe is applying to Lightroom unpalatable, and paying a perpetual license for the never-to-be-updated-again version amounts to swapping one timebomb for another, so I’m trying a couple of the alternatives that have sprouted up. The one I like best so far is On1, which has much more sophisticated editing features than Aperture [something of a mixed blessing], and won’t break the bank.

One final comment before I get onto the trip. I made a mistake over the 8 year period that I was running Aperture on the same machine. As I ran out of space I added a couple of SSDs as I went along, and decisions I made that seemed like a good idea at the time – in terms of splitting up my photos – were messy to retrace years after the fact. If it happens again, I’ll deposit READMEs for myself as a memory aid.

Anyway, on with the trip. The numbers of photos we took were well down by recent holidays’ standards: I took less than 400 and my wife took 275. There were a couple of reasons. First and foremost, it’s a low key destination for wildlife. I sweated blood over what lenses to take to Cambodia a couple of years ago, and ended lugging around everything, including my 100-400, which I used precisely never. So this time I took a more conservative approach: I packed my wide lens, my 24-105 and 100mm macro. I forgot my dust blower, which made me wary of getting dust on the sensor [a bloody nuisance to clone out after the fact] so, barring a couple of half-hearted, half-drunk HDR sessions with 16-35, I kept my walkabout pretty much nailed on the whole time we were there. That meant I could take a much smaller bag – annoyingly, still too big to put under the seat in front of me on the Thai Airlines flight. It was an A380, and the cabin service was pretty decent [putting Air France to shame on our last long haul with them], but the seats had an odd configuration. There was a metal container along the side of one of the legs in front which, never mind my bag, meant that we couldn’t put our legs out straight for the flight. Bearing in mind that we’re both at the smurf end of the height distribution, it was pretty uncomfortable. I’ve a feeling that the metal boxes may have contained life jackets, so I guess we can file those under “necessary compromises”. So I ended up doing what I hate: putting my camera bag in the overhead storage and then having kittens every time someone goes near it.

The second reason for the low exposure count was that I got a camcorder for Christmas. I’m not going to post the results here because, frankly, I’m rubbish.

We flew in via Bangkok. The only point worth passing comment on is the fact that Bangkok airport is furiously expensive. Our layover was about 4 hours so once we’d figured out the puzzling procedure for transferring without a boarding card, we could relax and try to stay awake. Then we had a couple of hours on a twin prop plane into Luang Prabang airport, which was painful getting out of. There was an incomprehensible – well, with jet lag descending – queuing system for the visas, which flummoxed everyone, but which was endured in a good humoured manner by everyone. The patience started to evaporate when we spent a good half hour at the baggage reclaim, getting dizzy watching the same bags going round, and wondering why there was a queue forming at a desk next to it. We eventually found out that the plane was unburdened by luggage for all the passengers who had transited via Bangkok. That was about half the plane we reckoned: you have to admire the even-handedness of it, if nothing else. One American lady was threatening litigation. The bags duly appeared at the hotel the same evening, so I doubt she’d have had a chance to dispatch her lawyer.

Our first pit stop was Le Sen Boutique in Luang Prabang, which we both really enjoyed. The room had an unusual layout, with an absolutely enormous bed right next to the bath. It also had two showers, which I think was a first for us, solving a problem which we didn’t know we had: who showers first. I think it also had the best breakfasts of the trip. Luang Prabang [I have to almost physically restrain myself from adding ‘Kipperbang‘] was a mixed bag. While it’s touristy, we had some absolutely cracking meals there.

On the whole, the food we had throughout the holiday was fantastic. Having been to the 3 countries comprising former French Indochina, based on our admittedly limited experience, I think I’d rate the food in Laos the best. It’s a combination of unusual flavours, and very heavy uses of herbs and spices. My predominant recollection of the food in Cambodia was that it tended to be quite sweet. The Lao food is closer to Vietnamese in style, but is very distinctive in its own right.

We ate in a place called the Coconut Garden on the first night [a bit simpler than subsequent nights but nice], then had a fairly fancy tasting menu at the 3 Nagas, and finishing in Tamarind on our last night. I’d rate Tamarind as one of the food highlights of the holiday.

We had an early start on our first full morning with alms-giving. Someone at work had done this a couple of years ago and said it was packed. We were the only tourists at the spot we were taken to, which was a little off the beaten track in a residential part of town. I have to say I had mixed feeling about participating. It felt like a bit of an intrusion, and it’s part of a faith that I know practically nothing about.

Glass Buddha

We spent rest of the morning walking around the town, the highlight of which was the local market [distinct from the night market]. Among the delicacies on sale were barbecued rats and squirrels. They look like any other cooked meat up to the point where you get to the head and feet, still attached, and with their teeth queuing up to get out of their mouths. We passed: having been hospitalised on our last trip to SE Asia, we tend to be very conservative with the street food options.

That afternoon we drove up to the Kuang Si waterfall. It was quite busy, but it was a pleasant enough walk up there, and the falls themselves were spectacular. I enjoyed watching a bloke flying what seemed like a very fancy drone. I have to admit they are on a [very] long list of toys I’d quite like. But as my wife will attest to, I have  enough expensive hobbies to be getting on with, and there is a huge potential for expensive mistakes with them. They must make packing for holidays interesting. I could see myself with a choice between the drone and clothes.

Kuang Si

We had the next day to ourselves, and had a long walk from the hotel to the far end of town, which was a nice way of spending our last day while still wrestling with the jet lag.

Temple in Luang Prabang

The next day we flew to Vientiane, which we both really liked. My wife said that she could imagine herself living there. She didn’t say whether or not I’d be in tow her but I remain hopeful. But, as we told ourselves, it was the middle of winter. It would be a very different proposition when it’s 40C+ and in the middle of the rainy season. There was a really relaxed feel to the place, lots of interesting shops and big wide boulevards. I was tempted to buy an old, ornate opium pipe in an antique shop for all of about 10 seconds, up to the point when I realised that it might turn into an interesting discussion at customs on the way home. We didn’t have any excursions planned for our first day in the capital, so it was nice pootling around and taking in the sights and sounds.


The room we had in the Ansara Hotel was vast. It had its own office area, just in case we were missing work, and had access onto a large terrace overlooking the pool. I was quite taken with the little laptop in the office which was running Ubuntu in some sort of kiosk mode, something I’d never come across before. I had a bit of a poke around: it seemed to create a new user every time it rebooted, which was quite an interesting approach to privacy. A point lost on whoever used the machine before me [without rebooting] and who failed to clear their cache: nothing dodgy, just really careless.

Anyway, back to South East Asia…

Vientiane HDR

We had what my wife rated as her standout meal on our last night, in a spot called the Lao Kitchen. She was amused to overhear a scrotal old duffer [he was English] telling his other half at the table next to us, “that’ll be on bloody Instagram in a bloody minute”, when my wife took a picture of her food – for private consideration, I might add. Part of me can’t wait to get to that age where all sense of discretion and your ability to judge how loudly you’re talking simply sail off into the sunset. Off to meet your long-departed moderate political views, I might add.

I won’t think of it as “going on holiday” any more, but rather “going abroad to complain about all the bloody foreign stuff” :).

Our second and final day in Vientiane was taken up with a tour of some temples. Interesting enough, but wasted on me. From there, we started a long trip south on Route 13, which we’d continue for the rest of the holiday. Our first stop was at a place called the Spring River Resort in Hin Boun. It was a stunning location. The room itself was a little on the basic side [no air con; electricity off for the early part of the day], but it overlooked a river with steep limestone formations looming over the other bank. The jagged karsts dominated the views for much of the rest of the journey.

Spring River Resort

Despite having relatively basic facilities, the network at the Resort was fantastic – something that we found repeated throughout the country. One more quick aside on the technology front, which really made me giggle: my iPhone wasn’t exactly tying itself down too much with the location for the weather:

The weather in the general vicinity of…

For what it’s worth, I’ve played around with the Google API that takes GPS coordinates and turns it into an address. This looks like a backing off of accuracy, based on address availability, taken to an extreme level.

It was a shame that we only had one night at the Resort because we really enjoyed it, but the main purpose of the stay was to break the journey so we could do a tour of the Kong Lor cave. It was really good fun: unlike our crystal maiden experience, we had full access to cameras, but I bottled out and left my SLR at home. The cave itself is huge [so even the flash would have been a waste most of the time] with most of the trip covered in a motor boat going at full tilt. The site could do with some more development: everywhere we pointed the head- and hand torches there were interesting rock formations, but we spent the majority of the hour or more we were in the cave in the dark, hoping that the guy driving the boat knew where he was going, and when to slow down.

Our next stop was in a town called Thakhek, which had a wild west vibe, and had what was probably the worst of the hotels we stayed in – the Inthira. It wasn’t terrible, it was just that the staff were almost universally miserable, and the food was a bit pants. Still, there was a decent little bar in the square across the road, where the beer was cheap and ice cold. Slightly incongruously, we had fantastic pizza on our last night there at a spot called Patalai.


We had one full day of sightseeing when we were in Thakhek, which started around a village called Ban Nakhang Xang in the morning. It was the closest that we came to something going wrong for the entire trip – other than the errant luggage – when a local guide failed to materialise for the first half hour. The walk started at the village, and quickly became quite steep via an overgrown path, at which point the shorts and sandals were starting to seem like a bad idea. After passing by a lake called Nong Thao, which was stunning, we ended up at our second cave, called Nong Paseum. It was occasionally a bit hairy clambering up and down over boulders, but interesting enough. Our final underground adventure was that afternoon, with a trip to the “Buddha Cave” at Nong Pa Fa. It was spectacular, but as an active Buddhist religious site, no cameras were allowed.

The last leg of the holiday started with another long drive down Route 13 to Champasak. We were staying at a hotel called The River Resort. The staff were fantastic, but it was very pricey. We ended up spending more in our 3 nights there than we did during the rest of the holiday combined. It has to be said it was a spectacular location, right on the bank of the Mekong.

Next up on the itinerary was the “4,000 island tour”. My wife was starting to feel the pace by this stage so decided to sit it out. A white lie that she wasn’t feeling well [rather than just saying she needed an idle day by the pool] started to take on a life of its own when our guide insisted on telling the every staff member at the hotel to look after her. Meanwhile I was sheepishly saying that, really, she wasn’t that ill, all the while receiving withering glances for being a heartless bastard.

It was a physically demanding day, the best parts of which were the boat trips to and from the island of Don Khone. I could have taken or left the island itself: it was OK, but not really enough to warrant the long journey at that stage of the trip. Part of the day out involved transferring onto yet another boat to go and have a look at some fresh water dolphins. “Boat” is an evocative word, all sleek lines and sunglasses. By contrast, ours was a bloody wreck. I could see the water through a joint in the wood at the pointy end where I really don’t think you should have been able to. It was also incredibly uncomfortable, sitting on a slat a few inches high. We did see the dolphins but by that stage my back was so sore I could barely have mustered interest if they were doing somersaults, rather than just breaching the water every now and then.

Or as dolphins probably call it, “breathing”.


Lippi Falls

Our last outing was a look around the Watt Phou temple complex. This was a highlight of the trip. It was scorching though: the further south we travelled throughout the fortnight, the hotter it was getting. There is a slog up some steep steps to the temple so it was tough going in, what I reckon was mid-30s Celcius the day we went up there.

Watt Phou

Watt Phou

We weren’t able to stay in the country as long as we liked, because all of the hotels that made sense for our itinerary were full at the end of the second week. So, we had a long drive starting in the early afternoon of the Thursday, from Champasak across the Thai border to a regional airport called Ubon Ratchathani. One notable experience on the drive: we started it on the right hand side of the road and then, after crossing the border on foot, we got back into the car and continued on the left. It was a first for us. Contrary to what I guessed at the time, it’s actually not that unusual. There are vast swathes of former British empire influenced countries were you can do it.

When we got to the airport, we’d been misled by a couple of little details with the online check-in process that you normally take for granted: the time and the flight number, neither of which were on the departure board. Not a great leap of faith in the end – we worked out that ours was a flight with the same company going 10 minutes earlier or later – but it got our attention for a while. One slight nuisance was that we had to get our luggage at Bangkok. We were debating whether or not we would have to go all the way out through customs and passport control, and whether we’d have enough time. We did, and we did.

So, that was our couple of weeks. We’ve talked about going to Laos off and on since we went to Vietnam back in 2008. It’s hard to put our feelings about the place into context without sounding like we’re damning it with faint praise, but it’s lower key than some of the other places we’ve visited in Asia. Cambodia left more of a mark on us, but that’s principally to do with visiting places which remind you of how utterly traumatic its recent history has been. And we did get spectacularly ill in Phnom Penh, which we won’t forget in a hurry. Rather than raving about it since we got home, we’ve been a bit more measured in our praise. But there was plenty to see, the food was great and people were really friendly. Well worth the trip.

Automating Philips Hue Motion Sensor Functionality

OK, this turned out to be a *lot* more complicated than I thought. Here’s what I wanted to do: we have a Hue motion sensor in the bathroom which I’ve set up to do nothing during the day, and then come on at night. Nothing too controversial there. But I wanted to have a 3rd option: for a certain section of the night – say after midnight – to come on at a nightlight setting.

There’s a ‘3 times a charm formula‘ from the Hue Labs which sounded promising, but that only allows you to set the idle time after motion activation. So I started looking at the API. There were a few obvious options I tried which didn’t work [like simply setting the brightness – over-written by whatever scene you have set in the accessory setup].

This article set me on the right track for what I needed to do insofar as rule settings. By toggling changes on the smartphone app and then looking at the results in the Clip API debugger I narrowed down the changes to two rules called ‘MotionSensor 5.night-on’ and ‘MotionSensor 5.night-dark-on’. [Obviously the number is dependent on the identifier the sensor is registered under.]

This isn’t enough on its own. I gave up on this after my first pass, waiting for a rainy day to come back to it – today.

I ended up using OWASP ZAP to proxy the Hue app traffic, to see what it was doing when you submit a change to the sensor configuration. That’s quite interesting actually: I was initially a bit puzzled at what looked like a mountain of traffic on first pass, but what in part turns out to be a very zealous keep-alive – roughly twice a second.

Long and short of it is that resetting the scene config using the app overwrites a ‘resourcelink’ with new scene specific values, as well as updating the rules.

I’ve roughed this out with my own iOS app just to check that it works in a way that I can transplant to another setup [a cron job on a Raspberry Pi would be a reasonable candidate]. To toggle on the ‘dim at night after midnight’ setting I make 3 API calls. You’ll need to fiddle around with the clip tool to get the equivalents for your hub – specifically, your sensor number will be different. For me, these are:

  • Rule: MotionSensor 5.night-on
  • Rule: MotionSensor 5.night-dark-on
  • Resourcelink: MotionSensor 5

For the rules, I Post the same ‘actions’ payload to both of the corresponding endpoints. It looks like:

{"actions": [
                        "address": "/groups/YourActionNumber/action",
                        "method": "PUT",
                        "body": {
                                "scene": "YourDimSceneIDHere"
                        "address": "/sensors/YourStateNumber/state",
                        "method": "PUT",
                        "body": {
                                "status": 1

Then for the resourcelink, I post:

    "name": "MotionSensor 5",
    "description": "MotionSensor 5 behavior",
    "type": "Link",
    "classid": 10020,
    "owner": "OwnerIDHere",
    "recycle": false,
    "links": [

The sensor and rule set you’re linking to will be specific to your own setup.

I’ve no idea what that ‘recover scene’ is. I’m guessing it’s something that’s created when you configure a sensor in the first instance, and is some sort of default state.

There’s a corresponding 3 API calls which I need to make to toggle back to the scene for ‘bright pre-midnight’, replacing the scene ID accordingly.

At the point I gave up – where I was just making the rule changes – I could tell that it wasn’t right by loading up the config in the app. The partial configuration – without the resourcelink change – manifest itself simply as ‘do nothing’ for the nighttime slot. Resetting this restored the full config. I guess there’s always the danger that if you run wild and free with setting values incorrectly, you might invalidate the ruleset to the point where unpicking it could be a problem. All I can say is that the above approach works for me, but test carefully!

Making Your WordPress Site Harder to Break Into

If you are using an infrastructure-as-a-service offering to host your WordPress site, you might find the following suggestions useful. If you have web access to site administration, e.g., via CPanel, there’s not much more you can do beyond:

  • Install WordFence.
  • Pick a very long password for your admin account. Have a look at secondary authentication options [described below].
  • Keep your software up to date.
  • Have a long hard look at all of those plugins you’re using, and try to cut them to the bone.

Here are a few Linux specific things to consider:

  • Install fail2ban.
  • Install the fail2ban WordPress plugin.
  • Change the default port you are running sshd on from 22 to something above 1024. You might want to check the IANA port listing to avoid colliding with other daemons you may be running on your box. This is pretty painless to do. You could do the same for all of your other network services [obviously excluding your web site and mail transfer agent, if you’re using one].
  • Consider running TCP wrappers on your ssh daemon access. Be careful not to lock yourself out if you don’t have a fixed IP address from your service provider. I use BT: a bit of googling suggested a couple of likely address ranges [81. and 86.], but my get out of jail card is a static IP I can use with a VPN service, which I’ve also configured.
  • Consider restricting access to mysqld to localhost. You may have already done this during install. I have to admit I was pretty careless when I was installing the database in terms of notetaking so I just added a TCP wrapper to be on the safe side.
  • Have an extremely long password for your admin account. Mine is basically half a mile long in 8 point text.
  • Have a look at some secondary authentication [or at least Captcha style robot identification] mechanism on the login form. I’ve experimented with Duo in the past. Make sure you understand the implications of changing your mobile phone if you are using one of the app based mechanisms.
  • Consider chrooting your website. I don’t but I may.
  • Have a look at some of the security scanners, like ZAP. Again, be careful not to lock yourself out with fail2ban.

The rest of these are host specific. A good starting point is to run

nmap -n localhost

to confirm what network services you are running. For instance, I found that my Linux distro had an FTP server running out of the box which I didn’t know about. In my case it was as simple as

pgrep ftp

to get the process id, then

ps -ef | grep <process_number>

[substituting appropriately] to find what the process was, and then finally

apt-get remove <package_name>

For any other servers you need to run, there’s a pretty good chance that there is fail2ban config that you can use off the shelf.

Why I felt I needed to pay more attention…

A few months ago, based on the daily activity reports I get from WordFence, I started blocking ranges of addresses using iptables. So if I got repeated brute force attempt on my admin password from say [this is a real example], I’d block the the entire range by doing:

iptables -A INPUT -s -j DROP

This was pretty tedious, but I only needed to do it around once a week. For some reason [presumably it’s some sort of off the shelf attack script], the attack counts from specific IPs always seemed to top out at exactly 1460 hits. Last week, I got my daily email which showed someone had hit the site 49k times that day. By the time I got home and did some digging in the logs, it was totalling more than 80k for the week. I suddenly realised that my manual blocking was way too blunt a tool, so last weekend I wrote a log scanning  script launched by cron every 30 minutes. It pattern matches on the login form in the Apache log file and sends me an email if an individual IP tops out at over a certain threshold. The longer term plan was that I’d call another script that would automatically insert the block rule in iptables. There would be a bit of messing around with state management [seek to a point in the log file based on the timestamp to not go over the same ground twice or something] and it would have to be run as root, but it would be better than nothing. I happened to mention this to someone at work who told me about fail2ban, which is doing the same thing [but better than I could have implemented it].

I also had a dig around at ssh logs, and discovered that some kind soul was trying to brute force the root password, and was up to 8k attempts for the week. Subsequent digging showed that the same thing was happening with my Imap server, but on a smaller scale.

While what I’ve suggested here isn’t necessarily bullet proof, it’s a reasonable start. Bear in mind that the types of attacks I’m seeing are commensurate with the value of my site, which in commercial terms is zero. And oh, the irony, when my server gets brought to its knees next week by someone with serious intent :).

Pin Your Pics…

My year and a bit dalliance with Android concluded as of yesterday, when I took delivery of an iPhone 8. I’m going to start developing again [although I’m going to have to divide my attention with C#, which I’m learning at work].

I’ll need to dust down a couple of projects: I have a password manager which I wrote as an experiment to learn about the Touch ID back in the day. I also really need to update my apps on the App Store…

…All of which leads me in a round about way to Pin Your Pics. It’s had very modest downloads since I released it: very low hundreds. That was up until July of this year, when it appears to have been ‘discovered’ in some way. I’ve no idea why or how. Anyway, this is what the downloads look like for this month which, by comparison to before, is pretty interesting:

Downloads for Pin Your Pics

I’m sure there’s every chance that it will sink without trace again.

Regardless, at some point in the next few weeks I’ll have a look at screen resolution – when I wrote it, it was fixed to the 5S screen dimensions, I think. Also, there’s a perennial bug with the controller for launching the camera, which I’ll have another bash at.

Madagascar: Walking Flowers. Who Knew?

I guess when The Beeb and Attenborough have made a series about a country, it’s a pretty safe bet that it’s going to be a humdinger of a place to visit. We got back from Madagascar on Friday afternoon, our tenth outing with the same company we’ve been using for all our long haul travel. I’ll cut to the chase: it was fabulous.

By the numbers:

  • Photos taken 1466 [me] and 683 [my wife]
  • Of which, keepers: lots. Seriously, if you can’t manage to get memorable pictures in Madagascar, it’s time to give up.
  • Kilometres covered by car: 1500.
  • Species of lemurs seen: 14.
  • Weight lost through illness: about 2kg.

I’ll start with that last point. Clearly, I upset some pagan poo gods by judging the phantom shitter on our Belize trip so harshly. I had the most sustained period of travel sickness that I’ve experienced to date. I only missed a day, but was under the weather from the third day and for about a week. My wife came down with it as well, but didn’t have it for quite as long as me. I jokingly put her stronger constitution down to her less literal enforcement of food best-before dates than me.

There were a couple of options for getting to Antananarivo [which, sympathetic to the world shortage in letter Ns, everyone calls Tana] but we ended up going via Paris. We had an overnight stay in a hotel about 10 minutes drive from the airport. The airport itself is pretty hectic: be prepared for enterprising ‘porters’ to descend on you and try to grab your luggage out of your hands – probably before you have any cash. While I think of it: there isn’t a great selection in duty free if you’re looking to get something last minute on the way back. It’s a similar sort of fare that you see in hotel shops. Oh, and if you’re transiting, be prepared to pay extra for a plastic bag that they staple shut for you – something I’d never come across before. As the 1 Euro represented 12% of the cost of the bottle of rum I was thinking about getting, I decided to skip.
Back to the itinerary. The next day we had two consecutive flights on the same plane – another first for us. First stop was Taolagnaro, and then we went straight on to Tulear, which is in the far south west corner of the country. We’d been warned by the travel company that there was a reasonable chance that our bags wouldn’t make the trip with us into Tana, and then that the internal flights might be rescheduled at short notice. Everything went really smoothly – in fact, the same could be said for the entire holiday. Every long haul trip we’ve had something has gone wrong. This was the first that the entire itinerary worked as planned.
We met our driver and guide for the rest of the holiday at Tulear [Yves and La La] who drove us to our next accommodation, called the Hotel Bakuba. It was a lovely place, something of an ongoing art project for the guy who runs it. That said, some of the features had practicality a little lower down the running order. Our room had a sunken seating area with a glass table in it, which I don’t think was really catering for the guest who might decide that a dozen postprandial Jager bombs are a good idea. It immediately made me think of this.


There was also a table with wildly splayed legs that we both stubbed our toes on every time we walked past it.

Fancy bed

It was undeniably top drawer accommodation but I couldn’t quite shake the sort of vibe you get in a bed and breakfast, because the couple who run it live there: you half-feel like you’re intruding when they are having dinner.
During our two night stay there we had a couple of outings, first to a spot called the Antsokay Arboretum, which was right next to the hotel, and then the Reniala forest. The Arboretum was an interesting enough hour but is really more for the gardening geek. Reniala gets you up close and personal to baobabs, which are fascinating.


From Tulear, we transferred to Isalo, and our next hotel, the Relais de la Reine, where we stayed for 3 nights. This, again, was pretty fancy: just the way the itinerary played out we had a gradual decrease in snazziness of accommodation.
It was in the Isalo national park that we had our first encounter with lemurs, specifically this little fella:

Hubbard’s  sportive lemur

Isalo is also one of your best chances to see sifakas doing their hoppity run along the ground – which brings me to another point. Travelling as we did at the start of July meant that we were right at the start of ‘shoulder season’ [which I’d never heard of before this trip]. It’s mid winter, so the animals are less active than pretty much any other time of the year. However, it also meant that the numbers of tourists around were very low. Probably the busiest of the parks that we went to was Ranomafana, where sightings are co-ordinated among the spotters and guides and so groups of people will coalesce when something interesting happens. I guess at one point we were up to about 15. Our guide said that during the high season, people are tripping over one another. We were told that the sifakas are most likely to hit the ground running in September to October but, given the propensity for the same ground to be covered with people, you’re extremely unlikely to see it.


The little bundle under this mum’s elbow is an infant:

Sifaka with infant

And another common brown lemur. I can’t help but anthropomorphise about this picture, that this guy is thinking ‘oh for God’s sake, get on with it, will you?’:

Grumpy common brown lemur

And so we get on to the title of this post: the ‘walking flowers’. I’d been ill for a couple of days by this stage and wasn’t feeling like the sharpest tool in the box. Our guide pointed a plant covered in white flowers and said, ‘have a look at these’. We’d never seen anything like them before and it took a while for me to notice that they were moving:

Flower bug

I’m not entirely sure which end is which. Needless to say, you don’t get them anywhere else except Madagascar.

Ring-tailed lemur

On our last full day we did a fairly long walk in the Namazaha Valley. It was supposed to be a 10km hike but my world was still being metered out in distances between toilets so we foreshortened it to about 6km in the end. Interesting spot, and a classic example of the arid environment in this part of the country.
The stones [centre left] in this picture are covering the entrance to a grave.


On our last evening in Isalo, I was sitting outside the room when I noticed these weird shaped motes floating in the air. Given the recent experience with the flower bugs, I assumed that they were some sort of whacky insect, until one of them landed on me and I touched it with my finger:

Slash and burn

It’s hardly the most fascinating picture but it was quite a poignant one for me: it’s a piece of ash. ‘Slash and burn’ is a common agricultural technique in the country. We were told a fire got out of control a few years ago: it affected 60% of the Isalo park and killed all but two of the sifakas. You see a lot of fires as you are driving through the countryside.

We visited one other smaller reserve before we moved on, called Zombitse. It was ok: plenty of ring-tailed lemurs and chameleons in the mix but by this stage, unless the lemurs were species we hadn’t seen before or were doing handstands, it was time to move on. Despite the name, there were no zombies.

We had a long drive to our next venue, which was the Ranomafana national park and the Setam Lodge. We passed this along the way. I love this shot, which is pretty much straight out of the camera:

The sky from the start of the Simpsons

The change in the weather over the course of the day reflected our move out of the arid region and into rainforest. We had a very interesting night walk on the first evening with the highlight being a mouse lemur:

Mouse lemur

The guide got a banana and smeared it over the branch [which is the brown slimy stuff you can see in the shot]. You then hope that the smell attracts a lemur. It took a couple of goes as the first fishing expedition attracted a rat. Being Madagascar, you half expect the rats to have, I don’t know, wings and a handlebar moustache at the very least. Nope: they have plain old rats, just like everywhere else.

Anyway, the mouse lemurs are lightning fast: they run along the branch hoovering up the banana as they go. They are ridiculously cute. These and the bamboo lemurs look like the result of a conversation between a toddler and a cartoonist.

“Bigger eyes.”

“No problem.”

This is a baby long-nosed chameleon. It’s not a great shot but the conditions were pretty difficult: macro depth of field, at night, with the 2 inch long subject on a branch that was moving…

Baby long-nosed chameleon

The next day we had our physically toughest hike, which was about 8km over very hilly ground. Just on that point, in our experience I’d say it’s second only to Borneo, in terms of the physical demands of getting around in rainforest. That said, the temperature we had last week was low- to mid 20s. If you were covering the ground that we did in Ranomafana at the height of the summer, you’d have a real slog on your hands.

Ring-tailed mongoose

Golden bamboo lemur

Flat-tailed gecko

From Ranomafana we had another long drive to our final venue, which was the Eulophiella Lodge, next to the Andasibe national park. We broke the journey with an overnight stay in a guesthouse called the Maison Tanimanga in Antsirabe. That was notable for what I rated as the best meal of the holiday.

A quick aside about the grub before I get on to Andasibe. It’s French influenced, with every place we stayed in serving baguettes and croissants for breakfast.

  • Tulear had pretty decent food, but with the odd ‘miss’: like a zebu carpaccio starter which was frozen.
  • Relais de la Reine: very rich food, with lots of creamy sauces.
  • Setam Lodge: I’ve no idea. I was in full-on emergency mode and had boiled rice and vegetables for the entirety.
  • Maison Tanimanga: fabulous home-cooked French food.
  • Eulophiella: slightly simpler fare but still very nice.

Andasibe was the coldest of the places that we stayed, with the temperature down to 11C at night. I enjoyed this park the best, I think: it was slightly easier going and there was a fantastic variety of wildlife.

Velvet amity [I think]


Diademed sifaka

Nightjar [breeding pair – sleeping]

The last place we visited of note, which was on our way back to Tana was ‘Lemur Island’. It’s basically a mini-zoo built into the grounds of one of the fancier lodges in Antsirabe. Our guide was pretty diplomatic about it: it’s a for-profit affair, and the lemurs that are kept there don’t get rotated back into the wild. That said, where else in the world are you going to have a lemur jump on your head? They have 4 species: black and white ruffed, ring-tailed, common brown and bamboo. The ruffed and common brown like to get up close and personal, and the ruffed have particularly luxuriant fur. Once again, being out of season, we had the place to ourselves.

Golden bamboo lemur

Black and white ruffed lemur, and me. I’m on the right.

So that was our fortnight in Madagascar, and it really is an extraordinary place. You’ve got to hand it to that Attenborough fella: he really knows his onions.


We got back from a fortnight in Belize on Sunday afternoon. It was, by my reckoning, the 38th country we’ve visited, on a trip we worked on with a well known UK long haul travel specialist. I say ‘we’: my wife did all the organising. I had almost no idea where I was going – this was a matter of choice, I hasten to add.

By the numbers:
– Photos taken: 580.
– Of which, keepers: 4.
– Wildlife encounters of the “you’ve got to be kidding” variety: 1.
– Arrests: 1.

A warning in advance: we had a scene play out on the way to the famous ATM Cave which was rather unsavoury, and which I can neither window dress [for reasons that will become very clear] nor skip, by virtue of being a significant talking point for a day or two for us. You might want to come back to this if you are having your lunch.

The default offering from the travel company is to fly in via Miami, which an overnight stay. That felt like a waste of time, so we asked if we could fly in via Mexico instead, as we’d be able to stay ‘air-side’ when we were transiting. This isn’t actually right, and made for a pretty tense return leg [which I’ll come back to]. Our agent also screwed up the booking and couldn’t get us on to the Cancun flight to Belize City, so we ended up having to stay in a Marriot just outside the airport anyway. This meant we’d have a pretty long drive to the Belize border on the first full day. In short, travelling via Mexico gained us nothing: if you’re thinking of travelling from the UK, just take the simple option and come in via Miami. Cancun airport is massive, and we had a chaotic 90 minute wait to get our bags. The refried beans we had at breakfast were fantastic but hardly enough to swing it.

We were dropped at the border and walked across the timezone [a first] and through passport control into Belize, sharing the queue with people who seemed to be taking little apart from vast quantities of toilet roll into the country. A short drive and boat journey later and we were at our first destination and highlight of the holiday, the Lamanai Outpost Lodge. Great food, lots of interesting things to do, great wildlife guides, and a really nice atmosphere: we couldn’t rate it highly enough. We were there for 3 nights, and had a nice mix of activities: a couple of wildlife spotting walks, a ‘village life’ tour [which involved making corn tortillas by hand. It’s pretty tough] and a standout ‘flashlight boat trip’.

As well as spotting a pretty interesting array of wildlife [including 3 metre crocodiles which, honest gov, don’t attack humans so feel free to take a dip in the river. Yeah right!], the guide used a laser pointer to talk us through various constellations. I’ve only ever seen the Milky Way as prominently once before and it was stunning: the guys turned the engine off, and left us floating in the middle of the estuary, with absolutely no visible sources of light to spoil the effect.

This little fella worked his / her way into our room, early in the morning of the second night, an encounter which had us carefully knocking out the contents of our walking boots for the rest of the trip.

Early morning visitor

We had a really nice morning looking round the Mayan temples at Lamanai. The lodge had timed it that, apart from one other couple and their guide, we had the place to ourselves.

Lamanai Mayan Ruins

If I had one minor criticism, it would be of this:

Lamanai Mayan Ruins – Big Head

…which has been plastered over to protect the original stonework from the elements. My gripe is that it wasn’t done very sympathetically.

This is the best shot of howler monkeys that I managed to get. They are tricky – by virtue of both altitude and contrast. They also sound… odd. Think Jurassic Park. I took this at the long end of my 100-400mm L, with the 1.4x extender, which meant manual focus…

Howler monkeys

…something I gave up on later in the holiday.

We woke a few times to find that it had poured overnight. This leaf, just in the garden of the Lodge, was so succulent looking I was tempted to take a bite out of it:


From Lamanai, we had a long trip [via the airport for some reason] to Black Rock Lodge. While this place has stunning reviews, and we enjoyed our 6 nights there, it didn’t quite have the same atmosphere as Lamanai: it had more of a hotel vibe. Then there were the seating arrangements: enforced nightly rotation of the cabin occupants at mixed tables. We aren’t unfriendly, and we met some interesting people but the daily procession of the same questions started to get a bit wearing. By the end of our time there, I was itching to find another IT type to speculate on why no-one was able to send emails [untested hypothesis: blocks on both the TLS and non TLS SMTP ports due to people sending bandwidth unfriendly photo attachments].

Anything but the dreaded ‘…and what do you do…?’ Me, I like to judge people from a distance, without the whole palaver of having to find out what job they do first :).

It was in a fantastic location – again on a river. There was a bird feeder that you could spend hours at:

My goodness, my Guinness!

OK, I don’t want to get too technical, but this is a green bird…

A bird. With another bird.

…which I’ve completely failed to identify. We saw a few of these over the course of the stay:


This fella also put in an appearance on our second day:

Arizona unicorn mantis

What a fantastic name for a beastie!

We’d pre-booked a couple of trips and had the option for more, but I fell into my standard long haul holiday pattern of starting to feel off colour at the end of the first week, and had a couple of lazy days, including one where my wife went to the market at San Ignacio, which she enjoyed [possibly because she was on her own :)]. Our first big trip based out of Black Rock was to the ATM caves. It was a physically challenging, but fantastic day out. Right up until I saw the camera shaped hole in the skull of one of skeletons, I was grumbling under my breath about not being able to take my little sports camera [a GoPro wannabe, which I’ve got a waterproof enclosure for].

We had an interesting trip to the cave. We were travelling with the guide in a group of 6: a father and daughter, two women and ourselves. I was talking to one of the women who I thought was possibly drunk. Given that she was about 60, it was about 10 in the morning and we were about to ford a river, I thought she was pretty keen, but who knew, a little bit of Dutch courage might have been what she needed. We’d been walking for about 20 minutes, maybe half an hour, and were somewhere between the second and third river crossing when we noticed quite a distinctive smell. I, in my naivety, immediately thought that we might be passing near by some pecaris: our guide at Lamanai a few days before had pointed out that they have a pretty distinctive musky sort of smell. Looking back at this, I can just imagine my wife rolling her eyes at me; at the time I thought my jungle tracker super-skills had just landed. Anyway, about a minute later, we realised that the woman I thought had been drunk had suffered a spectacular sphincteral failure, and had pooed herself. Wearing shorts. In a group of people. Passing another group that happened to be heading to cave at the same time. And we’re not talking a little whoops-a-daisy squeak: there was poo running down the back of both of her legs to her feet.

It’s funny the way these scenes play out. Rather than sympathy, the group immediately regressed to the rules of the school playground. The only goal, and the one thing that was trying to jostle the smell from my brain, was the thought that we needed to cross the next river in front of her. The rest of the group was coming independently to the same conclusion and there was a not-quite-running foot race developing. Cue the Benny Hill music.

The woman cleaned herself up – probably launching an epidemic of dysentery in the otherwise crystal clear water of the river – and subsequently made it about 2/3 of the way through the cave – with no-one standing behind her at any point in time, I hasten to add.

So, as you might have guessed, my sympathy levels were pretty low. Yes, rather than drunk, she was probably medicating. But, what was she thinking? ‘I don’t feel well, but damn it, I’ve come all this way so I’m going to have a bash at this physically demanding day out.’ Or later: ‘OK, the gates have opened. Oops. I’m just going to try and brazen this bad boy out. Maybe no-one noticed’.

Really?!? I’m sorry, but either you don’t go – to the cave! – or, if it’s a super emergency, sprint off the path, drop your trollies and drop the kids. Fair enough, eye contact might be as light on the ground as waterproof toilet roll but people will understand: everyone has close shaves with the holiday trots. I remember one particularly tricky moment on my one and only diving holiday, struggling like mad to get out of a wet suit with the clock ticking down. But, back to the cave woman: to just try and walk it off? Or, if you are that ill in the first place?

Stay indoors. You know, next to the toilet.

The cave itself was, despite thoughts of poo-gate lingering over us like a green cloud, fantastic: just an absolute sensory overload of sights, swimming, sauna-like humidity and climbing. It’s not for the faint of heart.

We had another full day out to visit the ruins at Caracol. It was really good fun: a walk around the forest with the remains of houses and temples looming out of the undergrowth. We stopped off at a cave, called the Rio Frio, which was actually the highlight of the day for me.

This is an HDR exposure comprising 3 shots, bracketed around an exposure of f8, and 0.6 seconds:

Rio Frio

That was followed by the weird moment of the day: the guide set up lunch and then just switched off: not even an attempt at I-work-in-the-people-busines-so-need-to-try conversation, he just stared glassy eyed into the middle distance. Fair enough, I guess: after a few years in the job there’s probably little to distinguish one set of sweaty Europeans from another…


At least he didn’t shit himself.


This was one of the last shots I took at Caracol. It’s a bit of a daft composition but I quite like it. The ceiba trees, central to Mayan culture, are everywhere, and they are fascinating:

Ceiba tree

From Black Rock, we had another long drive down to our last destination, Placencia. It’s a quirky little town which, for me, didn’t quite add up. While we ate well and enjoyed our few days there winding down, I couldn’t quite see the draw to the location itself – bearing in mind that there was a huge amount of development work going on and our hotel was pretty swanky [the Chabel Mar]. The beach was… well, to be kind, just ok. It was a little too steep to be kid friendly, and there was a strong breeze for almost the entire time we were there, so the water was very choppy. Hardly surprisingly, we saw all of 3 people swimming in the time we were there. Thinking about the location of the town more generally, while there were plenty of day trips to be had, but they were all a long way from Placencia itself.

Brown pelican

We had a couple of stand out meals in town: Dawn’s Grill did a shrimp curry, which was my best meal of the holiday. Also worth an honourable mention was Rhum Fish where we went for my wife’s birthday. That turned out to be memorable for the wrong reasons. She hadn’t been feeling great earlier in the day – a combination of a dodgy tummy, the weather and a bad reaction to a couple of sandfly bites – but felt well enough to go out. She ended up fainting in the loo, and not being able to open the door to get out of it because her hands were sweating so badly. I was just about to go into panic mode – bearing in mind that the starters were sitting on the table – and met her coming back from the loo looking grey. She almost fainted again. The staff were fantastic: a cold, sweet drink, cold towels, cab called, food boxed up. My wife was feeling fine, and ravenous, about 30 minutes later.

We had one last mini-adventure to unfurl on the trip home. We’d arranged a pickup with the ground agent to get us to the airport a couple of hours before they had suggested, which turned out to be a good job. Our driver was stopped at a police check-point and told that his insurance had expired, which was an arrestable offence. His car would have to be impounded, he’d have a night in jail and could arrange bail for a release the next day. We were sat in the back of the car, thinking, yeah, shame, but we need to get to the airport pretty soon. The driver called his son and, after a testing 45 minutes wondering how reliable this arrangement was going to be, he appeared in a very fancy 4 wheel drive and took us to the airport at breakneck speed.

The airport at Belize City appears a little chaotic to the uninitiated: e.g., a mismatch on flight departure times between the main board and the gate, and a very strange seat allocation mechanism that seemed to involve a lot of shouting. Our flight was duly called and, when I realised there were only going to be 3 passengers, my hopes of a nice 737 started to evaporate. We were in a single engined plane for the 90 minute flight. Contrary to popular belief, it wasn’t the air pressure differential on the wing combined with thrust that was keeping the plane in level – and admittedly fairly smooth – flight, but an act of intense willpower on my behalf. I was a nervous wreck by the time we landed. My wife loved it. We landed at a small, separate terminal and, because our pilot and co-pilot accounted for exactly 40% of the people going through the place, cleared customs and immigration control in about 5 minutes. At Belize City airport, we’d arranged for a private taxi to take us to the main terminal for international flights – vastly overpriced [$35] but worth it to make sure we were in plenty of time for final leg of the journey home.

So, all in all, a very enjoyable trip. It has to be said, it was a quite expensive one. While some of that is down to currency exchange rates, it was principally because the accommodation was pretty dear. Bottom line, it was still one of the best holidays we’ve had. The people were really friendly, and the country itself has a great mixture of history, wildlife and beaches to offer.

Thoroughly recommended.

Photography Footnotes

I took my tripod but not my 16-35mm lens, which was a mistake. There are plenty of opportunities for taking shots of the Milky Way [something I’d never tried before], and missing a wide shot of the Rio Frio cave was a bit of a shame.

It’s also worth taking a shutter remote. I had a half-pissed brainwave to improvise by putting the camera on the B setting, and using the off/on to trigger the shutter by holding the shutter release button down by using a Neurofen and about 10 Band Aids [cue my wife rolling her eyes again.] It nearly worked, but I got a bit of movement in the camera body when I turned it on and off – a combination of a beer-induced unsteady hand, and setting the tripod up on less than solid ground.

Best of a bad lot, this was a 111 second exposure [I had a Band Aid failure which closed the shutter] at f4 and ISO 800. I also bounced the flash around the foreground. Going to f2.8 and wide on the 16-35mm would have just made the difference:

Stars – don’t look too closely…

Creating an Alexa Custom Skill on a Web Service

The short version: there is no short version. Implementing server side functionality inevitably involves a fair amount of legwork. Also, an advance warning: I’m a novice at the programming language I chose to implement my web service in – Java. For this reason, I’m only going to post code snippets for problems you need to solve. There may be better ways of doing this. Finally, I’m leaving my Skill permanently in development mode: I don’t intend to publish. While it’s something I find useful, this was primarily a learning exercise for me. If you’ve ended up here via Google, hopefully you’ll find something you can re-purpose.

I’ll come to the Amazon side of things in a bit. First up, you will need a server to host your web service. You have a couple of options here [as an alternative to Lambda]: first, you can host on your home network. If you have DHCP, the typical process is to configure your broadband router for DDNS, and have a port forwarding rule on to your server. I decided to take another approach, simply because I wanted to try it out. I’ve paid for a vm with a hosting outfit called OVH. They have a really nice setup, so I’ve spent less than £10 for a server for 3 months. I’ll probably keep it on permanently as I like the flexibility.

I decided to implement my web service as a servlet. There are plenty of tutorials on how to set up the stub methods [and all the various libraries and files structures you will need when you come to export a War file]. I used Eclipse as my IDE. My testing cycle – which I imagine is pretty common – was to run tomcat on my laptop where I was doing the development. I could then build and deploy to that locally, and then test the interface by POSTing data to it with the Chrome plugin Postman. When I had something I wanted to deploy to my vm, I exported the WAR file, scp’ed it to the OVH server’s web apps directory, removed the old War [and expanded directory] and restarted.

A couple of foundational steps on the remote server. The OVH setup is a vanilla install of your operating system of choice – I went with Debian. As well as installing your server software [tomcat] and its requirements [Java], you’ll need to create a user for it. As Amazon requires the server to run on a privileged port, you’ll need to take this into account. As you really won’t want to run the server as root, I googled around for a snippet of C code which I could adapt and compile, which could use setuid to start my server as another user. This is something to take care over if you intend to run your service in anger, and you have no choice: you have got to run your service on port 443.

The next step on the server side, related to that privileged port, is TLS. Because I tried a ‘real’ CA, which I thought was on Amazon’s supported list [Let’s Encrypt], I also went to the trouble of registering a name for my vm’s IP. If you’re going to stay in developer mode, you may not need to do this. When I realised I was getting TLS handshake errors, I changed the config and went with an openssl self-signed certificate.

Turning to the configuration set up on the Amazon side, it’s generally pretty well documented, but there are a couple of exceptions to this. First, in the Skill Information, you have to provide an Invocation Name. I know of one other developer who made the same mistake as me because of the way the debugging pop-up information is worded: I assumed that the invocation string needed to start with ‘ask’, or equivalent. It doesn’t. If you just want your skill to be invoked with ‘widget counter’, you just have those two words, and then kick it off on your Echo with ‘Alexa, ask widget counter’, followed by one of your sample utterances.

This seems incredibly obvious, but there is a warning on the testing page which states, ‘Please complete the Interaction Model tab to start testing this skill’, I went off on a wild goose chase thinking I’d done something else wrong. That warning is arguably one of the misleading features of the whole orchestration interface that Amazon provides. It stays there permanently, no matter what you do.

There are some good examples of the Intent Schema, and other parts of the interaction model already out there but one more can’t hurt. Before I get into it, a quick explanation of what my skill does. My server side code ‘screen scrapes’ a train operator’s web site every 10 minutes. I then parse the rendered HTML looking for specific information about service conditions. That information forms the basis of the response.

Intent Schema:


The custom slot looks like:

LIST_OF_SERVICES Peterborough | Luton | Cambridge | Brighton

and then some sample utterances:

TrainTimes how is {TrainServices}
TrainTimes how is the {TrainServices} service
TrainTimes how is the {TrainServices} line

[Brief aside: why ‘train times’, when it’s not timing related? This is a vestige of trying to navigate the mistake I made with the invocation name. I have a strong accent and so was trying all sorts, so at one point it was called ‘big dog’ :)].

The rest of the Amazon interface is pretty straightforward, such as the uploading of self signed certificate [if that’s the approach you choose to take]. One final step before moving away from the interface is the testing. The example question, ‘how is the peterborough service’ gets transformed into the following blob of JSON:

  "session": {
    "sessionId": "SessionId.[GUID here]",
    "application": {
      "applicationId": "amzn1.ask.skill.[another GUID here]"
    "attributes": {},
    "user": {
      "userId": "amzn1.ask.account.[long account string here]"
    "new": true
  "request": {
    "type": "IntentRequest",
    "requestId": "EdwRequestId.[one more GUID here]",
    "locale": "en-GB",
    "timestamp": "2017-02-06T13:43:37Z",
    "intent": {
      "name": "TrainTimes",
      "slots": {
        "TrainServices": {
          "name": "TrainServices",
          "value": "Peterborough"
  "version": "1.0"

You will obviously need to check that your web service is able to parse this. As per my comments on  my testing cycle, I copied this into Postman as the raw content of a POST.

I’ll briefly go into some more detail about how my implementation works, because when you get into the business end of parsing the input JSON, you need to map it back to some data to respond with.

The parsing of the train company website as a skill isn’t my first bite at the implementation. I started by trying to write a widget for Android. It’s not as simple as just grabbing the HTML, though: the site uses Ajax to render the results. I ended up using HtmlUnit. Because it’s pretty slow, I implemented a class outside the servlet which uses a combination of a ServletContextListener, and then a ScheduledExectuorService. I got the example code from here to work from. The one gotcha is that your web.xml needs to refer to the class.

Next we get on to the hacky part of passing the information on to the servlet. What I did – having the listener write to a flat file which the servlet reads – is a reflection of my novice levels with Java.

So, returning to the list of general problems to solve: having received the POST data, your service then needs to get hold of the data, and then parse the JSON. For the first part, I tried  a few different options and then settled on the getBody implementation I found here.

The parsing of the JSON itself: it’s the first time I’ve ever done this and it feels way more complicated than it should be. I tried a couple of different parsing libraries, but ended up using JSON.simple.

Going back to the JSON data from the Amazon test interface, you have two consecutive objects, the session and the request. For an industrial strength implementation, there are things you need to do with the session data [I’ve also skipped over the TLS client certificate validation, which Amazon stipulates. While perfectly sensible for security purposes, it’s not necessary to get your development implementation up and running.

So the request itself contains a series of embedded objects that you need to unpack, in turn, until I finally get to the slots data. Your implementation will vary, but mine looks like this:

        JSONParser parser = new JSONParser();
        try {
            JSONObject obj = (JSONObject) parser.parse(postData);
            JSONObject jrequest = (JSONObject) obj.get("request");
            log.warning("request: " + jrequest.toString());
            JSONObject intent = (JSONObject) jrequest.get("intent");
            log.warning("intent: " + intent.toString());
            JSONObject slots = (JSONObject) intent.get("slots");
            log.warning("slots: " + slots.toString());
            JSONObject trainSvces = (JSONObject) slots.get("TrainServices");
            log.warning("trainSvces: " + trainSvces.toString());
            String trainSvceVal = (String) trainSvces.get("value");
            log.warning("trainSvceVal: " + trainSvceVal);
            resultString = trainSvceVal;
        } catch (ParseException e) {
            log.warning("ParseException error: ");

Again, for a ‘proper’ implementation, you are going to have to test each of the sub-objects. My code is taking a leap of faith :).

Having lost the will to live with the parsing, I have to admit that, having figured out which piece of the train-related data the web service needs to respond with, I then print the JSON straight out in the required format.


        PrintWriter out = response.getWriter();
        out.println("  \"response\": {");
        out.println("      \"outputSpeech\": {");
        out.println("         \"type\": \"PlainText\",");
        out.println("         \"text\": \"" + resultsString + "\"");
        out.println("    },");
        out.println("    \"shouldEndSession\": true");
        out.println("    }");

So, not exactly a thing of beauty, but it works.

If I have any better ideas for future skills to implement, I’ll start with the certificate that Amazon needs. There’s an outfit called StartSSL which it looks like they accept, but which requires email based validation on an address corresponding to the domain. I started looking at setting up PostFix for this – one for another day.

The Land of Fire, Ice and Very Expensive Soup

We’re just back from 4 nights in Reykjavik, which was an absolute blast. We did the usual suspects with trips to the Golden Circle and the Blue Lagoon. We weren’t so lucky with the Northern Lights, although we did get to see a murmuring on our second last night. The long exposure below [15 seconds, F4, ISO 800] picks out a lot more detail than was visible with the naked eye:

Northern Lights

Northern Lights

We knew from the weather forecast that there wasn’t really much point in booking an organised tour [and we really only had two nights to play with]. This was actually on a night when the tours had been cancelled. The composition is dire, but it was the darkest spot that we could find around the Old Harbour, and it was blowing a gale.

A few other obligatory waterfall / geyser type shots included below. Oh, and just to explain the title: on the Golden Circle, we called in for lunch at the facilities by Geysir, where you suffer the consequences of being a captive audience. The fish soup we had for lunch was delicious, but £28 for two bowls was almost as memorable as the scenery!



A Geyser; not the Geysir

A Geyser; not the Geysir

Where gloves go to die

Where gloves go to die