Category Archives: Tech

Nginx: Redirect everything except the home page

Recently I moved this blog to philipjohn.blog, making philipjohn.me.uk a sort of “homepage” pointing to my various online presences.

Previously, my blog was at philipjohn.me.uk so as well as changing the URL (which was made easy by WP-CLI) I need to redirect all philipjohn.me.uk URLs to philipjohn.blog.

However, I wanted the root of philipjohn.me.uk to show a special page, not redirect to philipjohn.blog.

After much Googling and some help from Nicola Heald I finally had a working Nginx config:


server { listen 80; listen [::]:80; server_name philipjohn.me.uk; root /var/www/philipjohn.me.uk/www/; index index.html; location = /index.html { try_files $uri $uri/ =404; } location ~ ^/.+$ { return 301 http://philipjohn.blog$request_uri; } }

They key bits are the two location blocks. The first uses location = /index.html because Nginx interally redirects requests for the root into an index file, according to the index directive.

That first location block has the effect of telling Nginx to look inside the root folder for the index.html, or return a 404.

The second location block only then gets called if the request is not for the root index.html file. This block simply grabs the request string and passes it onto philipjohn.blog.

Simple! (And only took me several hours to get right 😉 )

Fitbit Surge – one month in

In December I started wearing a Fitbit surge (a work perk) and wanted to share my thoughts/experience.

  • Steps seem largely accurate, although as you might expect it’s not so great at counting them when you’re pushing a pushchair! However, I have managed to achieve my steps target (7k per day) whilst;
    • walking up to bed
    • driving my car
    • cooking Christmas dinner
    • stirring my pasta
  • Heart rate is *not* very accurate. Given this is something the Fitbit Surge is supposed to be very good at, and Fitbit advertise it as being accurate, it’s disappointing. I noticed it was reporting well below my actual bpm whilst on an excercise bike at the gym. It turns out, I’m not the only one – Fitbit are facing a class action lawsuit over it.
  • Floors seems like a lot of nonsense to me. I don’t see how it’s accurate or useful.
  • Battery life is woeful, compared to what Fitbit claim. It lasts about two days for me.
  • I love that I can connect to my phone while playing music to see what’s playing, pause or skip tracks. However, I’ve had to stop using it because it massively drains the power.
  • Tracking cycling works, for the most part, and the GPS seems accurate. GPS does drain the battery quickly though.
  • Through the app you can choose from a number of different types of exercise to make available on the Fitbit Surge. However, it’s unclear what some of these are, or the difference between them and there is *no* documentation to explain it. I’ve read in forums, for example, that “spinning” and “workout” do the same thing.
  • The vibrating alarm is nice at first but I find it all to easy to just ignore. If you ignore it, it stops and doesn’t do anything else other than leave the alarm display on. I’d expect it to, like my phone does, automatically snooze and keep on going until I turn it off.
  • The app isn’t terrible intuitive. There’s a lot in it, and it’s kind of hard to know where to go. You get used to it, and once you do there’s a ton of info there. It’s the primary way to look at what you’ve been up to, and it gives you all the info you need.
  • Being a cyclist I like to link it up to Strava and that works really well.
  • I like that you can set a goal other than steps. Calories, for example.
  • When I’m in my car, my phone connects to it via Bluetooth. But if I have the Fitbit connected to my phone the car can’t connect. It’s probably the car’s fault because the Bluetooth on that is crap, but it’s frustrating none the less.
  • From the start I’ve had call and text notifications on so I can see from the Fitbit Surge who is calling or texting me. It’s never worked, but I just got it working a couple of days ago… :shrug:
  • I’ve tracked exercise bike workouts as “spinning” and while the calories seems right, the steps don’t. For example, a 40 minute workout that burned 334 calories only added 25 steps and was classed as 32 active minutes. My heart rate was pretty accurate during that too.

State surveillance is not comparable to online privacy issues

Often, when opposing state surveillance such as that revealed by Ed Snowden, activists are questioned why they use online services that actively collect data about them. There is one core reason why this comparison is unhelpful and irrelevant.

“You are the product” goes the saying, which is true. Companies like Google and Facebook collect streams of data about who we are and what we do. Some have called this “self-surveillance”.

When we “self-surveil” and grant companies the ability to use – and sell – our data, we expect – and get – something back. We get a service. We pay a small privacy price (largely inconsequential, I’d argue) in exchange for a service.

On the other hand, the state demands we let them take our data. They chose warrant-less mass-collection over targeting, leaving us in the dark about what they’re collecting. We get nothing in return – there is yet to be a convincing case, backed up with evidence, that the mass surveillance of the citizenry in any way makes us safer.

There is one, undeniably crucial difference however.

The state has the power to use that data against us in a devastating way.

We can be detained, without charge, for fourteen days – the longest pre-charge detention period of any comparable democracy. Previously this limit was 28 days, and there was an attempt to raise it to 90 – that’s 3 whole months of being locked up for being a suspect.

Outside of detention, the state has the power to severely limit our activities with only “suspicion” as a reason, destroying the presumption of innocence until proven guilty.

I don’t see any social networks able to limit my civil liberties…

Image: CC-BY-SA George Rex

Embedded tech can be implanted in brains, thanks to new power technique

Re: Wearable tech can be implanted in brains, thanks to new power technique

That title has it wrong – it’s not embedding wearable tech, it’s just embedded tech.

I’ve been saying for a while that I’m not interested in wearable tech like “smart watches” -it’s embedded tech that excites me, and this innovation is a great move forward in that area.

Idea: A re-usable framework for “Who Should I Vote For?” tests

Those “Who Should I Vote For?” sites are, I think, a great idea. Many of them fail though. They;

  • often miss out huge policy areas (e.g. Europe)
  • often just copy/paste from manifestos making it easy to see which party is which
  • over simplify questions or provide limited answer choices that don’t always match views
  • become out of date and are slow to be updated

I’d like to propose we (anyone with the inclination to help me) build a framework for creating such tests that we can use again and again.  I have an idea how we can do it.

It needs to be;

  • Open source and collaborative (obviously!)
  • Easy for anyone (i.e. non-developers) to contribute to improving the policy questions

Here’s what I propose;

1. Agree/disagree questions

In order to determine the political leanings of the user without revealing actual policies we should use questions to which the answer has to be one of five choices;

  • Strongly Agree
  • Agree
  • Neither
  • Disagree
  • Strongly Disagree

Each political party will then be attached to one of those five answers. For example, consider the proposition “The UK should leave the EU” to which the matching would probably be;

  • Strongly Agree – UKIP
  • Agree – Conservatives
  • Neither
  • Disagree – Labour
  • Strongly Disagree – Liberal Democrats

For each matching answer, a “point” will be given to that party, and at the end of the survey those points will be used to generate percentage “matches” to each party. E.g. if the user was Nick Clegg you’d hope he achieved a 100% match to the Liberal Democrats, and lesser percentage matches to some other parties too.

2. Markdown for question and answer generation

So that anyone can help to contribute, the questions and the matching of parties to answers should use Markdown. The application would then parse the markdown to generate the actual questions and calculate the points based on the answers given.

This is an example of how that Markdown might look.

It’s not great for parsing, but should be straightforward for contributing too. I’m very open to ideas on a better format, in any case.

 

So, what do you think? Is it a good idea? Is it workable? Will you help me build it?

WordPress fork is happening – and it looks amazing!

Obviously I’m a huge WordPress fan, but I’m not a blind believer. I can see it’s limitations, I’m well aware of it’s growing pains. That’s why, when John O’Nolan first presented his concept for Ghost I was excited.

While WordPress evolves into a CMS from a blogging platform (and it still has a long way to go!) it necessarily looses the simplicity it had as a pure blogging platform. John’s brainchild was to provide something that returned to those first principles.

Now the project is actually coming to life. John and his team have a great introduction and they’re seeking backers through Kickstarter. I’ve pledged.

One big thing that draws me in are the principles that John talks about in the introductory video. One of my constant bugbears around other open source project, WordPress included, is the ownership – structures that often do not reflect the spirit of open source, and we see the impact time and time again.

John is committed to making sure that Ghost is open source and non-profit and that that follows through to the entire eco-system that will surround Ghost.

I can’t wait!

Update: just two hours after this post was published (and a while after I actually wrote it!) I’ve had an e-mail from John O’Nolan along with all the other backers. Ghost is over 120% funded. Phenomenal! It’s got incredible backing – WooThemes, Envato, Seth Godin and many more influential tech folk. This could really be something…

Vulnerability in WP Super Cache and W3 Total Cache – update now!

Hot on the heels of the big WordPress botnet attack comes news of a serious vulnerability in the two most popular caching plugins, WP Super Cache and W3 Total Cache.

By allowing anyone to inject malicious code into your WordPress site through the standard comments form, this security vulnerability is particularly nasty in it’s simplicity and ease of exploitation.

I’m glad that the security and maintenance measures I take as part of my WordPress maintenance package mean that both the botnet attack and this vulnerability weren’t a concern, but others might not be so lucky.

Make sure you secure your site now, and keep it up to date.

Why super intelligence?

This fascinating article about human extinction includes a big section about artificial intelligence (AI) and the risks of creating a super intelligence.

It reminds me that so much of what I read on the subject focuses on the idea of a single, intelligent machine that could provide extraordinary decision making power.

I’m skeptical that AI will lead us in that direction though. Why would we use AI to create something so risky when the reason we’re doing it is to reach past or own cognitive limitations?

Instead, surely AI will be used to improve our own cognition, not create a new cognitive superpower.

It’s the same reason I’m not convinced by augmented reality (AR) yet. While Google Glass looks impressive I just can’t see it going mainstream. The only way AR will receive mass adoption, in my opinion, is through embedded technology – retinal implants, for instance.

It’s that evolution from wearable tech to embedded tech that will bring AR into the mainstream, and it will present humanity with the technological vehicle to use AI to enhance our own cognitive abilities, without the risk of manufacturing our own destruction.

Ubuntu for mobile… damn that’s exciting!

Over the Christmas and New Year holiday I wanted to get something done that I’d been planning for a number of months: replace Windows 7 on my PC with Ubuntu, ridding myself of any Microsoft software (I think).

I’d long ago abandoned Microsoft Office in favour of Libre Office and have had my Samsung N130 netbook running Ubuntu for more than a year. Using my netbook had shown me that it was possible so over several weeks I listed all the software I used on my Windows 7 PC and next to each I listed Ubuntu alternatives. Finally, I was satisfied that it was time and the expected Christmas lull gave me opportunity time to back up (which took ages!) and make the switch.

It worked (on the second attempt) and my Acer Z5101 (with 5GB extra RAM, I might add) is now completely Windows-free and running Ubuntu 12.04 LTS.

The Excitement

During all this I noticed a countdown on the Ubuntu site. There was no mention of what it meant so I made a mental note to return when the timer was up. I didn’t need to in the end as plenty of tweets made it obvious: Ubuntu is moving into mobile.

There have been some doubts about whether it’ll work or even if Canonical have what it takes to build a mobile OS. Only time will tell so I remain open minded but it certainly excites me. As most who know me will testify to, I’m a big Android fan and that’s partly because it’s a Linux-based operating system, as is Ubuntu. That’s partly why I’m excited because it gives the mobile world an alternative to the increasingly dominant Android system on the same free and open terms.

Android to Ubuntu

A bigger reason though is the suggestion, from Canonical founder Mark Shuttleworth, that Ubuntu’s mobile OS will be developed with Android in mind so that apps built for Android will also work on Ubuntu devices. This is fantastic news! For Ubuntu it kinda makes sense as it potentially gives them a ready-made app marketplace to tap into instead of having to build their own. But what excites me is the potential that as a consumer I could flip from one OS to the other, retaining all the same apps that I’ve learnt to love or tolerate (it happens).

It also strengthens the attraction of both Android and Ubuntu to mobile developers. Too often at the moment developers build apps for Android after iOS. If Ubuntu was to steal market share off the likes of RIM and Windows Phone (’cause let’s be honest, that’ll be another MS flop…) it’d create a Linux mobile OS dominance that would take precedence over iOS for app developers who would know that developing for Linux (rather than Android/Ubuntu specifically) means developing for the largest share of the mobile market. Of course, there are nitty gritty details to get around (different devices need different solutions) but there’s a solid foundation to work from.

HTML5

Long a bug bear of mine is that all too often we see native apps developed (often for iOS only at first, or at all) when a HTML5 app would do just as good a job, and in doing so would be naturally cross-platform, excluding no-one and benefitting everyone (with a smartphone, obviously…).

So when Mark Shuttleworth said that HTML5 apps would be treated as ‘first class citizens’ in the Ubuntu ecosystem I nearly leaped out of my chair! Giving HTML5 apps access to the same features of the OS as native apps allows developers to provide the same experience across multiple devices at a much lower cost. Instead of developing for iOS, then again for Android, then again for Windows Phone, then again for Blackberry (…..no, I’m joking, no-one cares about CrapBerry anymore), you just develop once in HTML5 and deliver the same app to every device.

That will make development cheaper which will give the consumer either lower prices or more bang for their buck. It will also prevent the ridiculous monopoly situations like Apple’s app store where it takes 30% of all revenue (including in-app purchases) that only serve to increase the costs to the consumer, because HTML5 apps will have the freedom to process payments however they choose.

Integration

There’s probably a better word.

One thing I don’t think was mentioned (at least not enough) in the Ubuntu announcement (see video below) was the user experience that can be expected when moving between different Ubuntu devices. Google Chrome is a huge part of my everyday digital life and one of it’s best features for me is that I can open Chrome on any one of my devices and see the most recent sites I’ve visited on each of those devices. For example, I could be reading an article on my PC then pick up my Samsung Galaxy Tab 2 and carry on reading as I walk downstairs to sit on the sofa, without having to do anything silly like email the link to myself – opening Chrome on the tablet presents me with a list including that article that I just tap once to open up.

Having a similar level of integration at the OS level would be fantastic, and I really hope Ubuntu considers this. One example I keep thinking about is games. I’m very fond of playing Solitaire and do so on my Galaxy Tab and my Galaxy S3 using the same app, always trying to beat the high score. However, each device has a different high score because they don’t talk to each other. How great it would be to simply sync the two!

Or imagine the article scenario with Google Chrome mentioned above, ported to a document in Libre Office. I might start to write a little document out on my tablet whilst sitting on the sofa but decide it’d be more comfortable to do it on the PC, so I just head upstairs, open Libre Office on the PC and it greets me with a quick link to just open that same document (of course you can do this with Google Drive, but what if I’m offline or using my own personal cloud?).

That kind of cross-device user experience is what really gets me behaving like a 5 year old on Christmas morning. It’s why I love using my phone to queue YouTube videos to play in the YouTube app on my TiVo 🙂