ITHCWY: Robert Ellison's Blog

Get an email if your site stops being mobile friendly

Get an email if your site stops being mobile friendly

Google just released an API for the mobile friendly test and so I've whipped up a script to send an alert if a web page violates their guidelines. This will run the test as often as you like and send you an email if it detects a problem. Alternatively if you're not mobile friendly it will keep emailing you until you fix any problems which might be a good motivational tool.

First start a new apps script project in drive and paste in the code below:

var urlToMonitor = '';
var alertEmail = '';
var runTestKey = '';

var runTestUrl = 'https://searchconsole.googleapis.com/v1/urlTestingTools/mobileFriendlyTest:run?key=';

function mobileFriendlyMonitor() {
  try {
    
    var postBody = {
      'url' : urlToMonitor
    };
      
    var options = {
      'method' : 'post',
      'contentType': 'application/json',
      'payload' : JSON.stringify(postBody)
    };
    
    var response = UrlFetchApp.fetch(runTestUrl + runTestKey, options);
    var json = response.getContentText();
    var mobileFriendlyResult = JSON.parse(json);
    
    if (mobileFriendlyResult.mobileFriendliness != 'MOBILE_FRIENDLY') {
      sendEmail('Mobile friendly test failed for ' + urlToMonitor + ', check https://search.google.com/search-console/mobile-friendly for details');
    }
      
  } catch (e) {
    sendEmail('mobileFriendlyMonitor failed for: ' + urlToMonitor + ' with error: ' + e.message);
  }
}

function sendEmail(msg) {
  MailApp.sendEmail(alertEmail, 'Mobile Friendly Monitor Alert on ' + Utilities.formatDate(new Date(), "GMT""yyyy-MM-dd'T'HH:mm:ss'Z'"), msg);
}

There are three variables you need to set, urlToMonitor is the full URL of the page to test, alertEmail is your email address (or whoever needs to be pestered) and runTestKey is the API key for the service. To get this go to the Google API Console, click Enable API, search for 'Google Search Console URL Testing Tools API' and click enable. Then click the Credentials option and generate a browser key.

Once you've configured the script choose 'Current project's triggers' from the Resources menu in apps script and set up a schedule for the mobileFriendlyMonitor() function.

If You Give a Browser a Cookie

If You Give a Browser a Cookie

If you give a browser a cookie, it’s going to ask for local storage.

When you give it the local storage, it’ll probably ask you for a list of system fonts. When it’s finished, it’ll ask you for your screen resolution.

Then it’ll want to look to see if Flash cookies are supported. It’ll probably create a local shared object.

When it’s finished with the local shared object it’ll want more things to hash. It will hash your timezone and language. It might get carried away and hash every supported plugin. It may even end up hashing the platform and user agent.

When it’s done it’ll probably want to check out your WebGL. You’ll have to tell it your WebGL vendor and renderer. It’ll probably ask you to open a HTML5 canvas.

When it looks at the HTML5 canvas, it’ll get so excited it’ll want to draw it’s own hidden image. Then it’ll want to hash the image as well.

Looking at the image will remind it that it should store the hash somewhere. So it’ll ask for local storage.

And chances are if it asks you for local storage, it’s going to want a cookie to go with it.

(With apologies to Laura Numeroff, and you may be a snowflake yourself).

Subscription Economics

Subscribe to The Economist today and receive a FREE portable phone charger - ad seen on Facebook

I think I'd be more likely to subscribe if you'd take a charger away. Most right thinking gadget vendors don't even include them anymore.

Even better than threatening to send me e-waste: skip the news bit (it's already stale) and send my Kindle a monthly compendium of analysis.

Routers to defend against rogue IoT devices

Routers to defend against rogue IoT devices

A few months ago I wrote about my cunning plan to stop Internet of Things botnets: stop them at the router.

It's just possible that these were in the works before that post but Symantec, BitDefender and Intel unveiled router level IoT security at CES this year. Not as hard core as my plan, but looks like a useful start.

(Image from Norton Core website).

Securing the Internet of Things

Securing the Internet of Things

We can’t trust manufactures to build secure connected devices and so routers need to be updated to solve this problem once per network.

The distributed denial of service (DDOS) attack on Friday, October 21 was apparently caused by dodgy webcams. But next time it will be Nest or Alexa or Hue - not picking on Google, Amazon or Philips specifically here, those just happen to be the IOT devices currently plugged into my home network. My washing machine and drier would be as well but fortunately LG’s dismal app has saved me from myself by not working for toffee. Oh, I have some DropCams too. And my car is connected. The next attack will probably just come from me.

My fix: update routers to sandbox these devices. A Nest thermostat can only talk to nest.com. If it wants to DDOS Reddit too bad, no connection allowed no matter how badly the device is compromised.

When a new device is connected the router looks it up (MAC address registry?) and then puts it in the appropriate sandbox.

If Nest needs to connect to weather.gov to check the forecast then Google would need to proxy this via nest.com. If the device goes bad it’s only got one domain to attack (so there’s a pretty good incentive for the manufacturer to make sure it doesn’t).

The only downside is new routers or new router firmware. Given the current state of IOT I’d buy one.

As usual if any of my billionaire investor readers are interested get in touch.

Google I/O 2016

An Echo knockoff and rapturous applause for variable font size in a messaging app. Not much innovation so far this year.

The horrific trend in Inbox and now Allo is machine learning auto reply so you can send something canned and inauthentic instead of actually speaking with people. Zombie Robs might approve but I'm far from convinced.

Updated 2016-05-18 14:12:

Android N looks super cool and I can't wait. The #1 productivity enhancement I'd like to see though is copy and paste icons that look like copy and paste. I do not have a clue currently.

Updated 2016-05-18 14:24:

No headset.

Updated 2016-05-18 14:40:

Android Studio is very nice. Eclipse was painful. I actually like Android Studio more than Xamarin which is saying a lot for a C# leaning person.

Chromecast won't connect to wifi - finally found the fix

Chromecast won't connect to wifi - finally found the fix

I've struggled for a while with Chromecast. The idea is great. I love using my phone rather than a remote. I like the idea of being able to cast any screen or browser tab in principle (in practice I think I've only done this once). I like the nice curated background pictures and that I could get round to using my own photos one day.

But here is how it works in practice. Fire up app. Select Chromecast icon and watch it go through the motions of connecting. Nothing streams. Reboot Chromecast, phone and router. Hard reset Chromecast and configure from scratch again. Reboot everything some more. Disconnect house from grid for ten minutes and switch off gas mains as well to be on the safe side. Finally, streaming! Repeat.

It's miserable. With both a Chromecast and a Chromecast 2 (which I really hoped might fix the problem). I've been through two different routers and I've tried a bunch of different settings but nothing seems to make the thing work. I even renamed the device to remove spaces.

For a while I considered buying an OnHub. Maybe Google's router would work with Chromecast? But it can't be bothered with Ethernet ports for some reason and so I'd need a new switch and then I'd probably need another power port and how important is John Oliver right now anyway (very)?

As much as I want Chromecast to work I've binned the wretched thing and bought an Amazon Fire TV Stick. Same basic principle but with apps on the device rather than your phone and a remote control.

I'd rather not have another remote, but it works instantly and without risking an aneurysm. It's also available with voice control which lets you both search for programs and trigger Alexa (my typical morning is asking Alexa for a flash briefing and then sobbing quietly when a daughter yells 'Alexa, stop... Alexa, play Gangnam Style').

My only gripe so far is that the voice search doesn't search inside non-Amazon apps (Netflix, HBO, etc).

Get ITHCWY By Email

I'm over social media - the Facebook page for this blog is a hopeless way to reach people and I removed the slow horrible sharing widgets a while ago. But I have this nagging suspicion that RSS is a super-niche activity for techno-libertarians harking back to the good old days of the Internet with open protocols and wall-free gardens and isn't entirely up to snuff either. So I'm going to experiment for a monthly email list for people who vaguely follow the blog or use Catfood Software products but don't quite manage to come back here every day to check for updates. Sign up here.

Why? Excellent question. The rules for blogs are to pick a narrow topic of interest, know your audience and do keyword research and drop SEO honeypot bombs to draw that audience in. I did that for Catfood Software but this isn't that kind of blog. It's a random collection of my hobbies and interests. So if you're not sure read through the Featured section in the side bar to get a preview.

I write a lot of code so what you'll get for sure is updates from Catfood Software and other occasional side projects. When I struggle with the process or discover something I write about that as well - these posts are more interesting to other developers and less exciting if you just want your desktop wallpaper (or Android phone) to look awesome. I love to make videos that don't have me in as well, mainly complicated time-lapses so you'll find a lot of those too. Also hikes in and around the San Francisco Bay Area. Occasionally politics.

If that works for you and you're not an RSS type then please join and let me know how I'm doing.

Got It

Got It irritating me on Facebook

When I run an app or launch a website it's generally because I've got some task to complete and a few free minutes to try and complete it.

Let's take Facebook for example. I want to quickly scan through to see which of my friends are sharing anodyne inspirational quotes superimposed over stock photography and silently judge them.

Facebook picks this moment to let me know about a new feature that will display previously unshared photos and videos to try and get me to share them. I'm instantly pissed off because of the unwelcome cognitive load and then I realize that the whole app has frozen. In fact every time I load Facebook at the moment it just hangs until I give up and do something else.

This is probably because one of my daughters has the endearing habit of shooting hour long 4K videos of the floor. The poor app is probably innocently trying to grab a couple of thumbnails and instead getting an object lesson in the halting problem. I'm sure this will eventually get fixed and it's not even the root cause of my current fury.

Got It irritating me on the Londonist

Got It

My only option is to click Got It. This chirpy little phrase is slowly infesting every corner of interaction design. It seems relatively innocuous at first but let's unpick it a little.

Generally Got It signals that something has been added to an app or site that the designer feels is important enough that they need to let me know about it.

This is almost always going to be bad news. Probably the way I complete my task has changed and I'm going to have to learn the new way. Maybe there has been a complete redesign and the use I had for the app was considered an edge case and has been removed. It could be that for legal reasons I need to be told that some new previously unpillaged corner of my privacy needs to be violated.

I'm immediately in a bad frame of mind when I see Got It.

Also there is rarely a Don't Got It or  Don't Want It link. Got It is a sign that something is being forced on you and the happy language is an implicit forced value judgement that you've both fully comprehended the change and that you wholeheartedly agree with it.

It probably feels cute to designers that come up with this. After all, a whole team has probably toiled for weeks if not months to come up with a new way to cause my phone to hang. They really want me to use it. But you're not putting yourself in my shoes. I rarely care and usually you're making my day fractionally less enjoyable and the design should be about me and not you.

Got It irritating me on YouTube

I miss OK. It's less loaded. I'm OK with dealing with whatever you're inflicting on me. It's not as good as OK / Cancel but sometimes OK is about the best you can expect.

I just don't Got It.

(Previously)

Commentary

I started with Blogger many years ago. It worked well for a while and then it didn't. I forget why but I wrote a tool to migrate from Blogger to BlogEngine.net.

BlogEngine.net was good for a while, but I never loved the commenting system. I switched to Disqus and I wrote a tool for that as well.

Then Disqus decided to monetize more aggressively than I liked, and I moved on to Facebook comments. Having used these for a while I have come to the conclusion that most people just hate Facebook comments. They're convenient but not many people use them. Also, pages just load much faster without all the Facebook JavaScript. So today I'm switching to home grown manually moderated comments. Just about every comment ever left on this blog has made it from Blogger to BlogEngine.net to Disqus and finally the new system, even the nasty ones. I'll moderate to cut out spam but never dissent. Enjoy!