Archive for the ‘Developer’ Category

No fixed IP address? No problem!

January 14, 2019

Over the years I’ve been pretty lucky with our ISPs – I’ve usually been able to get a fixed IP address so setting up a DNS entry for a subdomain to point back to ‘home’ has been fairly simple. I’ve been able to use that to VPN/tunnel back to the home network to access resources and fix the families machines from anywhere in the world. It also made using the SmartDNSProxy service really simple as it was a set and forget exercise.

Sadly with our new ISP (and long awaited move to NBN) fixed IP addresses are not offered for residential packages (and the cost of upgrading from residential to ‘business’ offered very little value) so I had to come up with a solution.

I could have gone with a service like NoIp.com or DynDns, both of which are supported by our router, but it added additional cost and either required me to move DNS hosting or use (and pay for) a DNS name that I didn’t control and while that supported my “phone home” scenarios, it didn’t help with the Smart DNS Proxy configuration every time the IP address changed. None of the existing IP updater utilities that I could find addressed the problem either.

Luckily, Cloudflare (my DNS provider) has an API that let’s me quickly update the IP address for a specific subdomain, so the DNS entry I use for ‘home’ could be updated, and SmartDNSProxy also have an API to programatically update the relevant details for their service.

As I have a Windows PC that’s always on (it’s the hub for our Media Center, and some of the home automation scripts) I decided to put together a quick PowerShell script that I could set TaskManager to run every five minutes and following a reboot (power outages being the most common cause of an IP address change) and would:

  • Obtain our current public IP address
  • Check the entry for my ‘home’ DNS entry at Cloudflare
  • If they differed, update CloudFlare, SmartDNSProxy (and any other services) and log the change (just for my curiosity)

So far it’s worked flawlessly (the CloudFlare API took a bit of figuring out, it’s very flexible but luckily well documented and has meaningful error messages!) so I’ve tidied it up a bit, removed my API keys and other identifying ‘stuff’ and shared it as a GitHub project for anyone who needs to do something similar.

Over time I may re-write the script for bash so I can run it on the Raspberry Pi that I have around for some other little projects but at the moment it’s not an always-on machine so no urgency … though if anyone needs it, let me know.

Links:

Pi and Blyncing lights

August 28, 2018

A while ago I put together a simple proof of concept to use an Embrava Blynclight to flash various colors to let people know their conference room booking was coming to an end (it ran off a PC as a NodeJS app, and connected to the Office365 graph to see when the room booking was ending… it would use color and flashing to signal when it was time to start packing up, and when you needed to clear out. Source isn’t currently shared, but contact me via the comments if you’re interested).

I’d tweaked the light control source a little and made it more general purpose and shared the project in case it was useful, but not done much else with it until recently.

I’ve been helping out on a local TV show, and we needed a way to communicate with the hosts while recording was going on – and a simple blinking light next to the monitor turned out to be a simple and easy solution… once I put the pieces together!

To make it work, and keep it self-contained and standalone (we needed to be able to control it from the Control Room, but didn’t want to run cables for it) I needed to get a light I could easily control over wifi – as luck would have it, I have my Blynclight Mini and a Raspberry Pi B+ (which has built-in Wifi), so it was just a case of connecting them together.

First of all, I had to get the Blynclight working with the RPi B+. While Node already works well on the device, getting the HID libraries working took a little bit more effort (but luckily other people had already worked out how). Once I could control the Blynclight form the RPi, I added a simple web page to let me choose a color and blink speed (still using Node), and was able to use my phone or iPad to adjust the lights.

The initial version however did still rely on both the iPad and the RPi both being on the same wifi network, which was going to be a problem in the studio because of how the network was locked down. Luckily, you can configure the RPi to act as it’s own hotspot, so I followed these instructions, and was able to get a standalone wifi network that I could log the iPad onto and control the light.

One last thing was to check that we could run the RPi off a battery pack, as there wasn’t easy power availability near where we wanted the light – I was delighted to find that it ran happily off the battery I carry to top up my phone, and connected to the 1a output comfortably lasted long enough to record 2 episodes (though in future I might try and find a bigger battery pack, or make sure I recharge it between episodes, as after shooting two back to back it was down to the last bar on the battery pack!)

And what does this Frankensteins’ Monster of a creation look like you ask? Wonder no more…

MVIMG_20180829_134238

 

A visit to the optician opened my eyes

May 30, 2017

For many years the annual trip to the optician, courtesy of my sub-optimal eyesight, was a routine chore that was always accompanied with a nagging sense of failure.

If you’ve ever had your eyes tested you probably know the feeling. Does option 1 make it clearer or darker, or option 2? Is A crisper or B? And no matter what you answer it always feels like, because you are conscious of your ocular faults, it feels like you’re wrong.

When it comes to designing systems – be it functional design, or the user experience – there’s always that same risk. The person answering the question feels like they are somehow “wrong” with their answers. And that makes them hesitant to elaborate.

At my latest eye exam – as it turns out for Lasik – I mentioned that awkward feeling to the optician and they told me something that I wish I’d heard on one of my first visits. “The answers are not right or wrong, they’re just parts of the diagnostic process”. Option1 or 2, A or B. It doesn’t matter. What matters is the differential data it provides the questioner to help refine their understanding of the problem and deliver a correct solution.

My takeaway from this realization is simple. Before asking someone what they need from a system it is important to help them understand that there are no “right” or “wrong” answers, but any responses (and the weight that they give those responses) simply helps provide data to inform the decision. In fact, as a good diagnostician the answers will simply help guide the discovery process rather than just delivery a binary result.

Of course, that still means that the questioner is going to have a subtle, nagging sensation that they’re not asking the right questions… but that’s probably a good thing as that will encourage them to keep refining their approach, and continue to iterate, as they learn more, both from individual interviews but also repeated experiences.

Oh, and the Lasik operation … amazing. Wish I’d stepped out of my comfort zone and done it many years ago.

Data Science (Machine Learning) 101

June 12, 2016

Date Science, or Machine Learning, is a scary topic. It’s hard to know where to get started. It’s hard to even find a good definition of what it does and what you have to do. And there’s always the risk of unleashing the singularity or Skynet by mistake.

As I’ve given a few ad hoc presentations on Machine Learning (and though focused on implementing it with Azure, the basics are applicable to other platforms) I thought I’d take my random notes and present them as a primer. You don’t need to be a Rocket Scientist to get started, but having a basic understanding of Linear Algebra will be helpful. As this isn’t focused purely on Azure Machine Learning (AML), and there are good tutorials on getting started there, this isn’t a step-by-step guide for AML Studio.

The first thing to understand is that there are two main types of machine learning model: (more…)

jsNoSpam – make it harder for bots to find your email address

March 6, 2016

If you want to put an email address on a web page, and have it human readable and easy to click on to open up in a mail client you run the risk of exposing yourself to one of the sleazier sides of the internet. Spam email. There are bots out there which relentlessly hunt down email addresses so their masters can deluge you with unsolicited commercial email (or worse, virus infections).

The best solution is to never show the email address – get your users to use a “Contact Us” form or similar so that there’s nothing for the bots to find. But sometimes you can’t do that, either because of how the pages are hosted or your client simply doesn’t want you to.

So… jsNoSpam was born. 100% javascript, so all client side and easy to insert anywhere that allows you to edit raw HTML and include javascript.

The script works by doing a number of things…

  • Requires you to encode the email addresses so they never appear in a recognizable form in the script or HTML source.
  • Supports decoding the email address back to a usable format
  • Allows you to display the de-coded address on the page, or to require a user action (mouse over, click, keyboard navigation etc) before revealing the address.

Because the email address which is inserted into the page via the script is clickable and usable like any regular mailto: link would be user inconvenience is reduced to a minimum, but the effort for a bot to scrape the address is increased and hopefully as there are enough potential variants in how the script can be applied it will keep it ahead of the game.

Here is a live demo of the code in action.

The code is hosted on GitHub, and is open source and unrestricted license (though it would be great if you find it useful if you comment here). It’s been tested in as many browsers as I can and also with assistive technologies (eg NVDA) but if you do find an issue please comment (or better yet fire off a pull request for me to incorporate your fix).

On their own, the techniques used (encoding the address, requiring user intervention etc) are not new, but hopefully combined they will produce a robust enough solution for people who need this workaround.

Connected Cars and Smarter Smartphones

June 25, 2014

As smartphones get smarter, and cars more connected it seems to me that there is a huge untapped market. Not everyone will replace their car along with their phone (or vice versa) so an opportunity exists to create a flexible, standards based solution both for new vehicles and aftermarket retro fit scenarios.

Luckily many of the standards needed to deliver this already exist. Bluetooth, NFC, wireless charging, ODB-II can all combine to present a seamless experience – if only the software was available to tie it all together… (more…)

Will work for Internet Points!

February 3, 2014

For a year and a half I’ve been helping solve problems, write samples and clarifying questions to make them easier to answer. It’s not my day job and it doesn’t even pay peanuts. It pays me in something even less tangible … internet points! (more…)

Browser Profiles – an excuse to play with Chrome Extensions

December 27, 2013

Like many people I use a laptop that I carry from home to work and back again. That coupled with browser preferences syncing to my other machines means all my bookmarks and extensions travel everywhere with me.

At work (or on our VPN) there are certain intranet sites I can access that are not public, so I’d prefer not to see them if i can’t click on them. There are also some browser extensions that I don’t want to run at work because they are not on our IT departments approved list. This means that either I have to stop syncing settings, or use a different browser for work… or come up with a smarter solution. (more…)

Keeping a-head in the clouds

November 19, 2013

One of the great things about developing on today’s cloud platforms is elastic computing. You never know what the peaks are going to look like, but you don’t want to pay for hardware you’ll only use once in a blue moon. So you opt for a dynamically adaptive scalable solution.

If you’re read any of my posts about jsErrLog (or “jsErrLog posts” if it’s still down) you’ll know that’s what I did for that service. As I’m offering it for free to anyone with a reasonable load I needed something as cost effective as possible (ie free!). When I built it I looked at Windows Azure, Amazon’s EC2, a few smaller options, Virtual Private Servers and finally settled on Google AppEngine – in common with the others it offered a number of options for programming languages and data storage but the big bonus was a no-nonsense the free tier.

Sometimes however things don’t go quite as planned…

(more…)

Change the conversation – don’t play the numbers game.

July 12, 2013

For new entrants to the phone or tablet market the conversation always turns to how many apps there are. At launch, a year later, how fast the numbers are growing. The conversation is driven by the incumbents and echoed by the press and makes it very hard for a newcomer to be taken seriously.

What would happen though if a new entrant to the space, such as Mozilla with the Firefox Phone, decides not to obsess about the numbers game, but own the narrative and re-write the rules…

If you play the numbers game means you are spread thin, chasing a huge catalog and will constantly be behind the ball playing “me too” and catch up at the mercy of the big fish who probably don’t see you worth the effort until you have an established presence.

Defining your rules allows you to identify a small selection, maybe a dozen, of apps that users want, need or actually use as a base line and expend significant effort working with those partners to create the best version of their experience on your platform.

You help with engineering, dollars and resources, providing money, talent and demonstrating true partnership. Engage deeply with your partners and share the risk – you both need to comfortable enough to experiment with new features on your new platform, to iterate and fail fast but within that small group drive their success while establishing your new platform and demonstrating what is possible.

For most of the incumbents this isn’t the way they play the game. Apple dictate to partners secure in their position, Google, with Android, rely on OEMs and the scale of their store to drive developers. Microsoft have a huge field Evangelism organization who can wield marketing dollars but are chasing numbers and have quarterly goals to meet and don’t seem to have the patience for long term engagements any more. BlackBerry are desperately copying any playbook that seems to make work but are finding resurrecting their brand hard going.

For a new player it’s a losing proposition to try and get into their race. Even if you launch with 50 thousand apps there will be the issue of quality and questions around the presence of the “must haves” who won’t have taken the risk, and every omission will hurt. If you make the headlines read “Twitter launches their next generation client on Firefox OS“, “Evernote delivers game changing update first for Firefox OS” you can control the conversation.

By controlling the conversation you become a platform that is aspirational and seen as innovative.

That is where technology evangelism has to return too, not being driven by the same old marketing and PR story that is seen as safe conventional widsom