Leaflet Geolocation error: Only secure origins are allowed

I described some reasons to switch to HTTPS on my website. To be completely honest though, I didn’t finally get off my ass do that for any of those good reasons. I did it because I was building a map thing which requested browser geolocation and I noticed geolocation stopped working in chrome.

I’ve seen this deprecation warning a few times:

“getCurrentPosition() and watchPosition() are deprecated on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.”

But somehow didn’t take it seriously. But yes. New versions of chrome won’t do geolocation unless it’s a HTTPS site. See this for yourself with this very basic geolocation test page on w3schools (which is http). [Update: Originally this was http, and so didn’t work in chrome. w3schools have since gone https]

The javascript console still only shows it as a deprecation warning not an error, but if your web application was relying on this…  it broke.

(Update for Aug 2017) Firefox v55 is going with this lock-down too. It says “Geolocation error: User denied geolocation prompt” as a popup, and in the console “A Geolocation request can only be fulfilled in a secure context.”

Any sensible application should probably be watching out for failure cases with geolocation anyway (see later examples for handling errors), but even so I find it a bit surprising that any old websites using geolocation across the web will be broken. There’s a bit more info on this google developers page

If you use LeafletJS, there’s a map.locate method which presumably uses the same method internally (navigator.geolocation.getCurrentPosition), but leaflet also detects the Chrome failure and pops up a different error message…

“Geolocation error: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV)..”

If you use chrome you can see this on my geolocate example (http) here:

http://harrywood.co.uk/maps/examples/leaflet/geolocate.view.html

…and    *Trumpet noise*   see it fixed with the newly available https URL:

https://harrywood.co.uk/maps/examples/leaflet/geolocate.view.html

HTTPs on this site

I made harrywood.co.uk run on HTTPS recently. Quite easy to do, and free using letsencrypt

https

Why encrypt harrywood.co.uk?

On the face of it there’s not much point. This is mostly just a straightforward read-only website. Not much scope for bad people to be snooping anything interesting. No passwords or credit cards or anything. General “tracking” doesn’t seem particularly problematic either. Who really cares if somebody can track the fact that you’ve been visiting these sweet innocent innocuous blog posts? Well…

Some types of commercial web tracking only tend to get creepy when they happen in bulk. The evil corporate advertising machine won’t learn much about you from knowing you read a blog post on harrywood.co.uk, but it might start to know you pretty well if it knows this and the previous thousand websites you visited. Encryption throws a spanner in the works for some types of tracking.

Government tracking by intelligence agencies, is also thwarted by encryption (more so probably). They would also like to intercept your browsing traffic to get to know you with their big evil AI. Now sometimes I think it’s fair enough for governments to do a bit of anti-terrorism targeted snooping, but the trouble is it’s too easy for politicians to make that simple-minded argument. The flipside is a subtle future threat of eroded freedoms. That’s tricky, and in general I don’t trust politicians to weigh it up properly. We can use technical measures (encryption!) to help things move in a more freedom preserving direction.

Tracking is a numbers game, done across many websites, and equally encryption as a counter-measure is more effective if we encrypt many websites. If we start to be able to browse a significant proportion of the web in HTTPS, even right down to piddly little websites like this one, then we’ll be getting somewhere. As a result it’s becoming recommendation and slowly a sort of groundswell of expectation on webmasters to do this. It’s slow to get lazy webmasters like me to do something like this, but …well now’s the time for harrywood.co.uk (Who knows? One day I may actually work on updating the content!)

Encryption helps protect against password snooping security issues. harrywood.co.uk has no user passwords, except…  my own password for logging in to write blog posts. I’ve probably used this from public wifi access points in the past. Slapped wrists for me. But now I guess I can be a little more relaxed about that. Speaking of wifi, wifi javascript injection (attacks or just crappy advertising) seems like a nasty problem. Are we safe using any wifi these days? Well we’re a lot safer from this when browsing HTTPS sites.

Free iOS games

Here’s some iOS games I’ve found enjoyable. These are all FREE.

angry-birdsObviously Angry Birds is a good place to start if you’ve not played any games on your phone. A blockbuster success for a reason. Quite addictive, and broad appeal (meaning they’ll draw you in, even if you’re not the kind of person that enjoys games). There’s also more of the same with several variations on the theme: Angry birds seasons. Angry birds star wars. Angry birds rio. etc etc.

I guess Candy Crush is similar. That one’s so mainstream my wife plays it. Personally I’ve deliberately denied myself that time-waster. In general I’m trying to avoid the super-mainstream blockbuster apps, but…

dotsDots is the stylish minimalist version of candy crush. Same idea. Swiping to match up lines and clear things tumbling down from above. But yes, less cutesy more minimalist graphics.

line-upLineup Puzzle. Make lines from different shapes, very similar to tetris, but without the blocks tumbling down from above (is this all sounding abstract enough for you)

amazing-thiefAmazing Thief. Another super-dinky little game. In fact this “Ketchapp” developer seems to specialise in insanely simple little free games. I’ve tried a lot of them, but this one was my favourite. I don’t quite know why I played this one until I managed I score of 22. Maybe because the single tap control is good for playing while crammed on a crowded tube train.

little-craneThe Little Crane That Could. Ever wanted to pull those levers to control an articulated crane? This 3D crane simulation is remarkably entertaining. I think it’s the realistic physics simulation that makes it. The free version only gives 5 missions. Even I have been tempted to pay for more.

airplaneAirplane! So speaking of physics I tried a few flight sim free apps. This one didn’t have particularly good physics, but it kept me entertained for quite a while for some reason. Maybe the choice of planes and the challenge of enabling new ones.

f18-carrier-landingF18 Carrier Landing. This one has better physics and more interesting controls. Weirdly they went to the trouble of developing this nice flight-sim engine and then made the game mission extremely limited. You just land on an aircraft carrier. That’s it. It’s like they forgot to make the rest of the game. But randomised weather conditions and start locations kept me entertained.

I can’t say I’ve done a systematic review of lots of free apps by genre. This is just some apps I’ve stumbled across and which turned out to be pretty entertaining (sometimes against my first impressions).

Playing silly little games on my phone is a guilty pleasure of mine. I’ve generally only ever installed free games, because… well, long story short, I’m a cheapskate. But they are very hit & miss. They can be a bit rubbish or not working at all for whatever reason. Increasingly they can have such unbearable advertising bombardments, in-app purchase nags, or sign-up demands, that I don’t really get as far as figuring out if the game is any good. Sorting the wheat from the chaff is a problem. Hence I thought this list might be useful for others.

I’d like to list some free and open source examples, but it seems open source isn’t a big thing for iOS developers. There’s very few working games on the appstore (as opposed to game engines / ideas) where you can also find the source code. I thought I’d installed Lumio off the appstore (quite a nice little game) but can’t find it on there any more.

I’m actually getting around to writing this finally now that I’m ditching my iPhone (and all these games) and swapping to a new android phone! I imagine I may be able to write a similar list but just for free open source games on android.

Vote remain

This sums up the EU referendum pretty well for me:

“If you vote leave it doesn’t necessarily mean you’re xenophobic,
but if you’re xenophobic you’ll vote leave”

I read this sentence somewhere else, but with the word “racist” instead of “xenophobic”. I think “racist” feels too strong, but I do think there’s unfortunately quite a high proportion of the UK population who are mildly xenophobic. They don’t like foreigners that much. And that is pretty much all this EU referendum vote will come down to.

There are of course lots of other important issues being debated.

Take trade for example. I see the remain camp saying that a brexit would be totally disastrous for trade, and then the leave camp saying that it’d be fine, we’ll easily strike up trade agreements. I find myself thinking the truth is probably somewhere in between. There’ll be a lot of admin and hassle (better have a good reason for it) but in the end we’d get trade agreements in place and we’d be trading with Europe as we always have.

And there’s lots of similar tit-for-tat debates where the campaigns have been quite polarised, with scare-mongering and lies from both sides.

So I started out thinking, let’s leave aside these smaller short-term issues and think about the big picture: The EU represents unification. Working together closely with our european neighbours. To me that’s very compelling, especially in a world where increasingly Russia and China are calling the shots. Let’s be unified. Let’s be a European super-power. But the leave campaign says, in an increasingly turbulent world we need more control over our own affairs to be able to better cope with whatever the world throws at us, acting in our own interests. I can see that point. I can see why others might be persuaded by that. Personally on these broad big picture viewpoints, I’m more for unification.

So I was always taking a remain view, but I recently realised I was watching/reading too many debates and losing sight of the real driving force of this referendum. This makes me feel very strongly in the remain camp with the realisation that, if the country does vote to leave, it’ll be for a terrible reason. I’m convinced the majority of people voting to leave are not even thinking about the issues. The only reason the EU referendum has ever even been a thing, is because a lot of people in this country are mildly xenophobic.

For some people this is because they take in too much tabloid nonsense (particularly on the massively over-inflated non-issue of immigration), some people have fooled themselves that it’s the right way to be “patriotic”, for others it’s just a failure to reign in their innate distrust of foreign people. Fear/distrust of people who are not like us, is something which exists in all of us. A perfectly natural feature of our monkey brains. We’re more likely to learn to take our xenophobia and set it aside if we work with foreign people, or we do a lot of foreign travel, or we live in a part of the country which is more cosmopolitan. But I worry that many people when they head to the ballot box will be listening to this nasty little voice, this mild xenophobia, in the back of their mind, and they’ll vote leave for no other reason.

I don’t know if this is a good way to persuade people. We saw as UKIP were taking votes in the general election, that nobody likes being told that they’re racist. Maybe telling someone they’re mildly xenophobic is not much better. But what this does mean, is that a general background level of xenophobia is swaying the vote towards brexit. What a terrible reason to take a decision like this. It means all right-thinking people, even if they find themselves on the fence on the EU issues, must make themselves count as an antidote to this.

vote remain

BRemain

UK passport photos for 39p

photo_boothI recently had to get some UK passport photos printed for my baby. This has extra fun issues, like getting him to look at the camera, and not having a hand visibly holding him. But even for adult passport photos…  I have a nice camera. It feels like paying a £5 for a photo booth is wrong. So I have used the following approach …because I’m cheap like that.

At boots you can print a single photo for 39 pence, and a single photo is big enough to fit eight little UK passport photos within it. Bargain! We just need to prepare a picture like this to print:

passport-photos-baby-small
(There’s our little lad!)

The trick is to get the pixel ratios right. The other trick was to realise that boots photo machines crop photos a little bit at the edges, and they actually automatically crop more if you give them an image with a lot of blankness, hence the decorative leafy border on this image to prevent this. This skinflint Yorkshireman has done the trial and error so you don’t have to!

Passport photos template image <<< (right click ‘save as’)

So you might make use of this file as a template, and edit it to put your own passport photo image, but you’ll have to do some clever resizing and cropping and positioning using image editing software. The overall photo file here is 3264 x 2448 pixels. Your mugshot photo image will need to be sized 738 x 949 pixels, but don’t forget there’s rules for how big the head should be within a passport photo. So this means within that image you need the head to be ~660 pixels tall. In fact it’s easiest to take that as the starting point.

So the steps are:

  • Take your photo
  • Make a copy of the file
  • Resize it so that the head is 660px tall
  • Crop it to frame the picture nicely and to exactly 738 x 949 pixels
  • Save that
  • Open the template image and copy your image onto it
  • repeat for all 8 positions

Finally put that image on a USB key/SD card and take it to boots. When you come to print, select “6×4 From: £0.39”

And there you have it… 8 passport photos for 39 pence!

The new (baby) normal

We had a baby boy! Quite a while ago actually. I announce these things on facebook and twitter these days:

back-to-normal-tweet

He’s a healthy normal baby, but I’m not sure I even remember the “normal” I was referring to in this tweet. Life without a baby feels like a long time ago.

We had a lot of preparation for the birth. Hypnobirthing classes in particular lead us to be hoping for a “natural” birth. Really we just wanted a “normal” birth. Following the procedure women have followed for 200,000 years seems like a good way to do that. We learned that things like inductions and epidurals were to be feared and avoided. …and then that’s what we got!

The due date was nicely ahead of Christmas, but the baby didn’t come. The relatives all arrived (including my wife’s family from Brazil), and the baby still didn’t come, and so the date for “induction” was set… for Christmas eve! Weeks earlier my brother joked that if the baby arrived on Christmas day, we’d have to name him Jesus (pronounced “yay-zuss”. It’s a relatively common name in Brazil) but the joke was starting to come true.

Our un-normal birth timelineWe had a booking for Christmas lunch in a pub, involving no small amount of pre-booking and pre-payment, but the relatives enjoyed that without us. The hospital served turkey, while we waited for the induction drugs to take effect, but the baby still didn’t come

…until boxing day. But the contractions were more regular than normal because of the way induction drugs work. After hours of that, my wife opted for an epidural, the most kick-ass of all the pain killing options, but not the most casual of options since it involves a heavily gloved up sterilised anaesthetist inserting a needle in your spine. This was no longer natural.

And the pushing wasn’t working so eventually the birth took a final spectacular deviation from the normal. We were given various cautions and asked to sign permissions and disclaimers for a C-section operation. I was asked to put on doctors outfit. Finally, under the glare of some massive operating theatre lamps, surrounded by medics, with some help by forceps… our baby was born.

We got him home a few days later, and I remember enjoying a big family meal. Catching up on the Christmas celebrations we’d missed. And on the evening I sent that tweet, I was joking of course, but it actually did feel like things were getting back to normal in some ways. Back on track for the normal experience of being new parents.

We had a check from a midwife at home, who weighed the baby, and seemed happy he wasn’t losing too much weight. But we weren’t too sure if the breast-feeding was going correctly, and we now know he had not really been feeding properly at all. He was having a few short guzzles of a few seconds, whereas a proper breastfeeding “latching on” period would be at least a minute of non-stop sucking, more like ten minutes or longer. This seems obvious to us now, but somehow all the midwives advising us, had not spent long enough to put us right on this.

The result was that he was getting more and more hungry, just the next day after being told his weight loss was not a worry, we took him to the doctor because things were not normal. He was mega grumpy and had dry-looking lips. The GP said it didn’t seem normal, and sent us back to hospital to be checked. The paediatricians told us he would need to be fed through a tube in his nose to bring his weight back up. That definitely felt like a serious deviation from the normal again. We ended up staying in hospital for two more days feeding the baby and re-establishing breastfeeding. That just happened to correspond with new years. We saw in 2016 watching the London fireworks from the tall balcony at Whittington hospital.

So Christmas and new year felt pretty frantically un-normal for us. Since then we’ve hit a whole sequence of other interesting challenges. Breastfeeding was the big one. That’s a story for another day. In general looking after a little baby, understanding his behaviour, knowing how to make him sleep or feed or stop crying, is constantly shifting challenge. He’s growing so fast that each week the goalposts move. The process seems designed to evade any attempt at containment in a predictable manageable cycle.

So no, things are not really back to normal. But I do feel like we are now getting to grips with a new normal, in which we need to be constantly ready for new challenges, and take them as they come. We’re sleeping more and relaxing into parenting more now.

…And we’re taking these smiles when they come too:

smile

Birthing affirmations

I designed some “birthing affirmations” as printable posters. There’s lots of birthing affirmation images on the internet …but here’s some more:

1

SVG, PDF

 

2

SVG, PDF

 

3

JPEG, PDF

 

4

SVG, PDF

 

5

SVG, PDF

 

These images are all my own work I and release them to the pubic domain (CC0 if you like)

Birthing affirmations?

We’re having a baby soon, in case you didn’t gather that. So we have these messages pinned up around our living room. The idea of these birthing affirmations comes from the “hypnobirthing” classes we went to. A friend recommended hynobirthing. I wasn’t sure what it was, but I knew my wife was nervous about the pain of childbirth, and could do with all the help she can get.

Affirmations were one things we learned about. It’s a pretty simple idea really. Use positive language. Tell yourself positive things over and over again, and stick up eye catching messages around the house to continuously remind you.

Even though you conciously know that the messages might not necessarily be true, they can work their way into your subconcious, through repetition. It also works during labour, giving you something positive to look at and focus on (hopefully!)

Affirmations are also part of the “hypnosis” bit of hypnobirthing. A voice on a recorded hypnobirthing track can plant these positive affirmation messages in your subconscious, but this works best while in a state of deep relaxation, close to sleep. …or so the theory goes.

Missing Maps talk: OSMLondon & Mapping your own neighbourhood

Recently we celebrated one year of “Missing Maps” events. These humanitarian OpenStreetMap mapathon events have been very successful, packing out venues in London every time, with enthusiastic new mappers, who bring their laptops and perform remote armchair mapping of far off lands.

We’re successful at getting new mappers involved, and as we teach them, we drive up the quality of the basic data, and also help some of them to become quite advanced mappers (only some. That’s the long tail curve after all)

Meanwhile the OSMLondon pub meet-ups remain successful too in their own way. I’ve been organising them for years. Going back through the history of OpenStreetMap we’ve always had our merry band of OpenStreetMappers meeting in pubs, and doing London mapping.

I’m very keen to promote more cross-over. These newly recruited humanitarian mappers are yet learn about the joy of on-the-ground survey-based mapping. Mapping your own neighbourhood is the OpenStreetMap way. It seems like a vital missing piece of the puzzle really, if these new mappers are to truly integrate and be a part of the OpenStreetMap community.

So given a speaking slot at this special OSMGeoWeek Missing Maps event, I had a go at explaining those things… while also talking about pubs a lot! Here’s the slides and Continue reading “Missing Maps talk: OSMLondon & Mapping your own neighbourhood”

Going to be a dad

Big news….

ultrasound

That’s our 11 week scan. My wife’s starting to show a bump, and we’ll be getting a 20 week scan pretty soon, at which point we find out if it’s a boy or a girl.

Recently I’ve been doing grown up things like getting married and getting a mortgage. I’m even thinking about learning to drive. But this… this is very grown up. I’ve a feeling it’s going to change my life a bit.

The main advice from friends so far seems to be… get in some sleep now. I’m well practiced at staying up late at night, but that’s because there’s an internet full of irresistibly exciting activities out there. Or sometimes I’m just catching up with work, which also throws up some irresistibly fun coding challenges at times. …but I think maybe these habits and hobbies will be about to change.

I’m not really a morning person, and I believe small children are generally morning people.

A few months back my big sis came to visit with their 1 year old. I was woken by crying at 6a.m. …which was fine. It’s new and exciting, and I rushed downstairs to join in the baby fun, at which point my sister said “OK. You play with him. I’ll go back to bed”

Playing with my nephew is great fun, but I quickly found the challenge was to keep him interested in things. At one year old I can present him with a fairly mundane household object, like a plastic milk bottle for example, and he’ll be excited and fascinated by it for a few minutes, but then he’ll want a different object to play with. Now if you rule out the objects which will break if they’re dropped, or be destroyed by slobbering, or be a swallowing risk, well there’s still quite a few things around the house, but after an hour and half I think we’d identified all of them!

But of course an hour and half is the end of playtime anyway because he’s onto the next thing which is probably milk, then sleep, then the cycle starts again (with a few nappy changes thrown in). Spending time with my sister, I noticed this cycle is surprisingly short, and relentless. It doesn’t stop, or synchronise conveniently with the adult’s three-meals-a-day, or any of the other normal routines.

So on this occasion I handed him back because he was crying, and my sister identified it was time for milk. It was about 7:30, and I felt shattered. I went back to bed and slept through till about 10:30 (meanwhile my nephew would’ve gone through another couple of sleep, play, milk cycles) Exhausting!

So yes. A new adventure for me and my wife! Baby’s due near Christmas time :-O

Sky news interview on HOT Nepal earthquake response

Yesterday I appeared on Sky News giving a short interview about the Humanitarian OpenStreetMap Team response to the Nepal earthquake. This was part of a news tech show called “#Digitalview”, aired at 10:30 (just in the UK I think).

Click to view video
Click to view video

Read more about the HOT Nepal earthquake mapping on the OpenStreetMap wiki and on the HOT website. I also blogged there with a message for aid agencies, on the ways in which our maps can be used.

Note: I hope sky news don’t mind me sharing this video clip here for the moment. I think they may publish the whole show at better quality at some point. I’ll swap in a link to that if/when I see it.