Posts

Showing posts from November, 2012

Programmatically Scheduling Hangouts

Image
One pretty common request around Google+ hangouts is the ability to programmatically schedule them, and have a URL which everyone can join in the future. This is useful for being able to send out links beforehand, and make sure people are ready to go.

While there isn't a specific API for this at the moment, there is actually a workaround that makes use of the Hangout integration into Google Calendars.

In the Calendar you want to use to create hangout entries, go to the Settings page under the cog icon on the top right, and enable automatic hangout creation:


This means that any event created on that calendar will automatically have a hangout URL generated, and that can be retrieved via the API. So, to programmatically create a URL for a future hangout, create an event using the calendar insert API. This example is using the PHP client library.


$event=newGoogle_Event(); $event->setSummary('Future Hangout'); $event->setLocation('The Internet!'); First we set the …

ZeroMQ Pattern: Pub/Sub Data Access

Image
One problem that comes up with some regularity is controlling access to a stream of rapidly changing data, particularly over multicast. For example, there may be a stream of updates which is being broadcast out to many users (possibly a tree of users with repeaters at certain points), but we would like to control which ones can see those updates independently of that data transmission. 
There are a tonne of ways of doing this, but one of my favourites is to take a note from the book of everyones favourite copy protection technology on DVDs and Blu-Rays. Rather than trying to restrict each users access to the data, we encrypt and freely share the data, but share the decryption key only with our approved readers.
The publisher holds a list of keys which are shared between it and individual consumers. It generates a data encryption key which will be used to symmetrically encrypt the messages as they are sent. The publisher encrypts this key under each of the consumer keys, and sends out…

Google APIs Java Client Library from Clojure

At Devoxx the other week I spoke about Clojure, and as an example looked at how it could be used to access the Google+ public data API. Because the Google+ APIs are part of the general Google APIs Discovery Service we looked at how to process and generate functions to call this library automatically (more on which in later blog posts). However, for use now the easiest way to access any Google API via Clojure is probably via the Java client libraries using the Java interop in Clojure.

There's a complete example up on Github, and it is really easy to get started. I use Leiningen to handle dependencies (as everyone should!), and because this backs onto Maven it can just pick up the Google repo which contains builds of a variety of useful libs. The project.clj file looks like this:



In this case we're bringing in 3 jars from the Java API library: the (ridiculously fast) Jackson JSON parser, the base API client library and the Google+ API service. This last part is what you would re…