Monthly Archives: July 2014

The UK’s First Official Google Glass Hackathon – Ok Glass, Where is the Space Station?

Last weekend (19th-20th July) was the UK’s first official Google Glass Hackathon, and it was a fantastic event – just a few short weeks after Glass became officially available in the UK.  Places were very limited for those without Glass (to ensure there were enough spare pairs floating around), but since I have Glass I was able to go without going through a very competitive lottery.

So, what was talked about, what happened, and what did we build?  Let’s get started.

The Hackathon was organised by Hoi Lam, the Wearables Developer Advocate for Google UK, and a few Googlers came across from the US, including Timothy Jordan, who is a Developer Advocate for Google, focussing on Glass.

Timothy Jordan introduces everyone to developing for Glass #throughglass

Timothy Jordan introduces everyone to developing for Glass #throughglass

After breakfast, the first event was an introduction to the event by Hoi, with some overview of what Glass was (at a non-trivial level) for the Android developers in attendance who hadn’t experienced it before.

Then we moved onto a Design Sprint – just classic stuff really, here’s a use case, design an app that would help this user, that’s Glass specific – not a cell phone app.  Although it was simple, it was a useful exercise in moving some developers away from this idea of a smart phone app with lots of buttons and tons of information.

Finally, it was the main part of the hackathon – the hacking!  People split into groups of between 2 and 8 to produce whatever app they wanted to, with the occasional guidance of a Glass engineer.  I teamed up with two Android developers who were also working in the city, Alessio Fabiani and Antonio Matarrese, and we started brainstorming.

Alessio, Antonio and I - the three creators of 'Ok Glass, Where is the Space Station'

Alessio, Antonio and I – the three creators of ‘Ok Glass, Where is the Space Station’

One idea that came out was a Google Authenticator app for Glass, so that, for users with two-step authentication enabled for their Google Accounts, instead of having to get their phone out when they needed a code, they could just say “Ok Glass, Give me a 2-step code” and Glass would show/read to you the 6-digit code necessary to login to your account.  However, we’ll either leave this until next time or for someone else to make, as we decided to make an application that is especially well suited to the Glass platform – an app to help you find the International Space Station.

There were lots of opportunities for some fun as well, like with this unfortunately labelled bin.

There were lots of opportunities for some fun as well, like with this unfortunately labelled bin.

All a user would have to do is wake up Glass, and say “Ok Glass, Where is the Space Station” – Glass then tells you how long it will be until the Space Station is next visible to you (i.e. it will be visible in the horizon of your current position), using location data from both NASA and the GPS in your phone, tethered to Glass.  We then showed four arrows, at the top, left, bottom and right sides of the screen, pointing in the direction of the Space Station, with annotations indicating at what angle in each positive direction you would have to move your head to be looking straight at the Space Station (calculated using the positions of both you and the ISS, and the accelerometer/tilt sensor and compass built into Glass).

This is an example of a really great app for the Glass platform, since because the device is worn on your head it can measure the angle you are currently looking at and direct you as to exactly how to adjust your head position, as opposed to a phone app which can tell you the positions relative to magnetic north and ‘flat’, and then you have to align your head using some other method (e.g. a compass and knowledge of what ‘flat’ is).  Check out the video below of the app working.

Although the code is hackathon level (poor, badly documented, little-if-any code style), and we got a bit confused with the maths for calculating elevation angles, it all seems to work well.  Take a look at the code on GitHub here, try putting it on your Glass and let me know your feedback.  We’re hoping to get it on the MyGlass app store eventually.

Although we didn’t win, we did very well – we had about 18 ‘votes’ (stickers) on our card, compared to the winners who had twenty-something.  We were commended on creating a piece of undeniably useful piece of Glassware, which was a great use-case of the Glass platform.

All in all, a great event – a big Thank You to the Glass Team who organised this – bring on the next Glass Hackathon!

The Glass Hackathon Organising Team

The Glass Hackathon Organising Team

Creating a Useful and Awesome Screen Saver for Mac

This summer I spent a lot of time working in the Library and wanted to be able to keep my laptop open so I could quickly refer to it, whilst keeping it locked.  Of course, the obvious choice is a screensaver, but they’re all pretty boring – static content, never changing day-to-day, and never useful.  So, as someone who loves Google and has a problem with the size of their inbox, I came up with this – a screensaver that shows currently entered Google Searches (from Google Trends) and the number of items in my inbox, along with a coloured background to indicate if I’m doing well (it’s always always red at the moment).  Check it out below:

It’s very easy to create – all you need is:

  1. A Gmail inbox that you want to keep clear
  2. A PHP file to check how many emails are in your inbox and to change background colour (and a server to run it on, whether remote or local).
  3. A HTML file to bring this together with the Google searches.
  4. WebSaver

(1 and 2 could easily be combined to save the use of an iframe, and this is not great code – but it works).

For the PHP file, you’ll need to fetch the number of items in your inbox (using your mailbox password) and echo back the appropriate page background colour.  I do this with:

<?php
/* connect to gmail */
$hostname = '{imap.gmail.com:993/imap/ssl}';
$username = '<Your gmail or Google Apps email address>';
$password = '<Your Gmail Password or device-specific password (for 2 step)>';

/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());

/* grab emails */
$emails = imap_search($inbox,'ALL');

if($emails) {
        if (sizeof($emails) < 100) {
        echo '<body style="background-color:green">';
        } elseif (sizeof($emails) < 150) {
        echo '<body style="background-color:orange">';
        } else {
        echo '<body style="background-color:red">';
        }
        echo '<div style="width:200px; height:200px; margin:auto; position:absolute; top:0; bottom:0; left:0; right:0; color:white; font-family: Verdana; font-size: 50px;" align="center">' . sizeof($emails) . ' Emails</div>';
}
?>

Note, where I have set my username and password at the top, and that I have set the level for doing badly (a red background) as 150, and the level for doing OK (a orange background) as 100 (less than that is good, so I get a green background).

In the HTML file, I simply create an IFrame to this page and the page containing the cool Google searches (simply replace below):

<html>
<style>
iframe {
        display:inline-block;
        width: 49.89%;
    height: 100%;
}
body {
    margin: 0px;
    border: 0px;
}
</style>
<body>
<right>
<iframe src="<path to your PHP file>" frameborder="0"></iframe>
<iframe src="http://www.google.co.uk/trends/hottrends/visualize?nrow=5&ncol=3" frameborder="0"></iframe>
</right>
</body>
</body>
</html>

Finally, set your new webpage as your screensaver. Simply download the WebSaver, install it, open Screen Saver options from System Preferences on your Mac, and click on WebSaver on the left. Then click “Screen Saver Options” and enter the URL to the HTML webpage for your screen saver.

Voila, done! Enjoy your awesome screensaver.

(On a final note, I configured a keyboard shortcut on my system of “Command+Alt+.” to activate the screensaver, so I could quickly lock my screen.

Summer 2014 – Morgan Stanley and Google Glass

Some may be wondering what I am up to this summer.  Am I just beaching it back home in Cornwall, enjoying the sun, or travelling?  None of the above unfortunately – instead I’m doing an Internship at Morgan Stanley, again working on a large-scale backend engineering project (but this time in Java).

This does mean I’m in London all summer (10 weeks) – something I never thought I’d do!  But like last summer, I’m taking every opportunity that comes my way (whether it’s trying bouldering, kayaking through London, exploring ridiculously busy markets and trying cultures that I didn’t even know existed), and it’s certainly been an enlightening experience so far.  For one thing, I now appreciate Zürich so much more than before – the city and citizens are so much more happy and cheerful, happy to help and smiley, and they have more respect for their city – London is full of not necessarily selfish people, but people who never seem to think of people other than those they know – people who, for example, see it as their right to have a door held open for them.

Ok – England bashing over (Switzerland – please give me citizenship!).  What have I been up to, and what’s been significant so far?  Obviously Google Glass has been a big piece of my life for the last 9 months, and since I arrived in London before it became publicly available here, I was keen to find out what people’s reaction to it was.  With that in mind, I went to the Tate modern (a famous modern art gallery in London) to enjoy the art and get peoples perspective on it (without actually asking them).  Loads of people recognised it, and I ended up doing a lot of demos, as I had expected.

Glass really came into it’s own at Wimbledon (where a Glass demo helped me get a great ticket for court Number 1 on the penultimate day) – I got some great footage and was kept aware of an ongoing server outage without having to use my phone – so much more natural!  I will add that the Wimbledon staff were not happy with me wearing it in Centre Court, where the dress code is more smart – but that’s fine – it is bright blue after-all.

Another awesome use I’ve had for Glass in the couple of weeks is with advertising/fundraising.  Last week I took part in an event at Morgan Stanley where we fundraised for The Princes Trust, who give disadvantaged or vulnerable young people the practical and financial support to stabilise their lives, undertake training and develop self-esteem, so that they have the skills for work.  We cycled around London for the day, doing the ‘Tour de Londres’, whilst seeking donations from the public.  Whilst out and about, it was important that we kept a steady stream of contributions coming in, and Glass certainly helped out with publishing media and updates of our progress.  For example, when we were cycling along by the Thames, I was able to post videos and photos of our journey so far to encourage donations (I had earlier posted with how-to-donate information and had said I would be posting media throughout the day).

When Glass was announced as being available in the UK for developers, I was interested in what the reaction would be – would there be a sudden influx of Glass into the hands of the public, like there now is in the US, or would it be more subdued?  I was expecting it to be the former, but I have to say I was wrong – apart from at this Hackathon, I have yet to see another Londoner with Glass, after 5 weeks here!  I think I know why though – since the public launch, the vast amount of media coverage in the UK about Glass has diminished to, well, nothing.  I haven’t read anything in the media about Glass since then, and people who see me with it and ask for demos (who have obviously read about it) don’t know they can buy it now.  Perhaps after two years the media got bored of writing about this product that would one day make it to general availability?  Whatever it is, I think Glass needs some advertising in the UK right now.