Saturday, February 06, 2016

Google Drive API App Running in App Engine

I worked through the JavaScript quickstart guide of the Google Drive V3 API and modified it slightly so I could host and run the whole thing in the Google App Engine . I suggest you work through the quickstart once (following all the steps) before you read on--unless you're already familiar with App Engine and the Google Cloud Console, it may be difficult to follow what needs to change. The quickstart is a simple one-page app that allows the user to authorize access to their Google Drive and then shows ten files and/or folders in that Drive.

Why would you want to do this? It's great to be able to create your app that uses the Google Apps APIs, but even better is to host that app within the Google App Engine so that you don't have to worry about maintaining any of the infrastructure that runs your app. You also get the benefit of sophisticated App Engine features such as performance scaling.

The steps in the Drive V3 quickstart ( will get you most of the way, but with a few changes, you can serve the app from the Google App Engine, which is super powerful and a more modern mechanism for running a web application.

One thing you'll have to change is the URL that your client ID will accept. The quickstart expects you to host and run the app on your local machine, and therefore use http://localhost as the URL. You can enter that when you work through the tutorial, but you'll have to change the URL for "Authorized JavaScript origins" later to the URL for your particular app. However, you won't have that URL until you try running your app from the Google Cloud Shell.

Your client ID should look something like this (I've edited it so as not to disclose my client ID):

Here are some notes to clarify how to get the quickstart running in Google App Engine from the Google Developer Console:

  • You'll likely want to create your own GitHub repo and clone it to your local machine.
  • When you get to the step in the tutorial, you can connect your app project to your new Git repo. You'll have to authorize Google App Engine to use your repo. By connecting the two, it is super easy to manage (and even edit) your code from within the Google Developer Console.
  • Create the sample file (with code provided) in the local repo and push it to master that is synching with GitHub.
  • Don't forget to change your client ID in the sample code: var CLIENT_ID = '';
  • Once you have everything ready. Make sure you have your new quickstart project selected and then open the developer cloud console. The console is a Linux based shell.
  • Change directory (CD) to the src directory for your quickstart project.

cawood@definite-destiny-999999:~$ cd src/definite-destiny-999999/master

  • Start a web server using Python to host your application: python -m SimpleHTTPServer 8080

cawood@definite-destiny-999999:~/src/definite-destiny-999999/master$ python -m SimpleHTTPServer 8080
Serving HTTP on port 8080 ... - - [12/Jan/2016 00:11:56] "GET /?authuser=0/ HTTP/1.1" 200 - - - [12/Jan/2016 00:11:58] "GET /quickstart.html HTTP/1.1" 200 -

  • Open the Web preview from the console window in port 8080. When you navigate to the quickstart.html file, you will get the URL you need to add to your client ID credentials. The Web preview option is in the top-left corner of the cloud console. 
  • Find your client ID in the credentials section of the dev console and edit it to add the URL you just opened in web preview. (To stop the app (quit the web server), press Ctrl+C.)

That's it! You should now have the quickstart running in Google App Engine! Sweet.

Note: I do not cover deploying your app for production use. Perhaps that can be a future post.

Note: If you've made a change and pushed it from your local machine, but the file isn't updating, try closing and reopening the console. I've found that it doesn't pick up changes to the files unless I do this.

Wednesday, January 13, 2016

I AM CARDBOARD VR Url Not Recognized Setup Error

For Christmas, I picked up a Google Cardboard viewer. It's the easiest (read: cheapest) way I know to get a virtual reality headset for home use. When I co-wrote Augmented Reality: A Practical Guide for the pragmatic programmers (in 2006), headsets for augmented reality or virtual reality were expensive and bulky.

That certainly has changed. Google cardboard devices are literally made of cardboard. There are lots of choices. I got the I AM CARDBOARD® 45mm Focal Length Virtual Reality Google Cardboard. So far, I'm impressed with the inexpensive device. Enabling clicking in the virtual user interface by moving a magnet on the side of the device is ingenious.

Unfortunately, I quickly ran into a problem with the set up. When asked to use my phone's camera to grab the QR code on the cardboard, I received the error "URL not recognized" or "Problem in parsing the Url." QR codes represent a URL and if that URL changes, they can break. The solution was to find the manufacturer's website and search for a QR code there. In this case, I found a working QR code for the I AM CARDBOARD. Now I'm looking forward to trying out more of the apps with my daughter.

Update: My daughter loved it! I shot a video of her reaction that I'm sharing with family. So cool. 

BTW: from the site -- "Calibrate your VR headset using the QR code found in this listing images. To do so, open the Google Cardboard app, select "Configuration" menu option, click on "Switch viewer" and scan the QR code."

Friday, December 04, 2015

My Brother's D&D Kickstarter Campaign

The World of Myrr is a Kickstarter campaign that my brother put together. It's a detailed and play tested campaign world for Dungeons and Dragons Fifth Edition

If you know any D&D fans, let them know this new campaign is out there.

He even gave me credit in the video for helping with the World of Myrr Wordpress site and various other technical questions. :)

Monday, November 16, 2015

Aquatic Informatics Named to Deloitte Technology Fast 50

My employer, Aquatic Informatics, was named the 37th fastest growing technology company in Canada and only one of three cleantech leaders on Deloitte’s Technology Fast 50™ List. Very cool for the Vancouver software scene.

Tuesday, October 06, 2015

Copying Playlists from Rdio to Apple Music

Even before it was announced that Rdio was in financial trouble, and even before we learned that Pandora was buying parts of Rdio to shut it down, I wondered if I should move to a different music streaming service. I enjoy Rdio, but I couldn't shake the nagging feeling that I had backed the wrong horse and eventually my hard work on playlists would vanish. Because of this, I was reluctant to spend too much time creating and fine tuning my Rdio playlists.

Fortunately, there's a solution, I successfully used Move to Apple Music to copy my playlists into my free trial of Apple Music--I still haven't decided if Apple's service is the way to go. This playlist migration from Rdio to Apple Music cost me $4.99 and it was well worth it.

I used an old MacBook for the playlist migration and it took about 12-16 hours. Yes, that's right about 16 hours. During that time, I couldn't use the machine for much because it was tying up the internet connection. I had about 2800 songs because it counts Rdio's "My collection" as a playlist.

Move to Apple Music allowed me to export a copy of my playlists (in XML), then upload the playlists I want into Apple Music. It also provides a list of the songs it couldn't find on Apple Music. In my case it was over 200, but when I checked into it, it turned out that most of the songs are available on Apple Music, they're just listed differently (e.g., the same song on a different album version). Be aware, iTunes will actually refuse to sync a playlist if there's a song included that can't be found, so you'll have to check them once you have finished the import.

Note that I did try the free version of STAMP, which copies playlists from Rdio, Google Music, or Spotify to Apply Music or Spotify. I couldn't get STAMP to work and it required move work to run than Move to Apple Music. It also costs a few bucks more.

Update: After the import, I noticed a lot of the songs are not the album version. I haven't tested this theory, but I think I know why it's happening. When a live version, or a remix of a song is available, it's a common format to add "(live...)" or "(...remix)" to the song title. I believe the open bracket results in these versions appearing first in the Apple Music API search results. The upshot is you'll need to go and switch the versions if you're not a fan of live versions and remixes. 

Tuesday, September 08, 2015

Araxis File and Directory Comparison Utility

As part of my role, I'm writing, editing, and managing technical product documentation. One of the challenges in that area is incremental translation to multiple languages. Running a Microsoft Word compare between two versions of a document is easy, so any documentation written in Word can be sent to a translator and the compare will show what's changed—and therefore what needs to be translated since the previous translation. However, some of our documentation is written in XHTML so that it can be compiled to CHM and also provided as web-based help with our server product. How we cost-effectively manage an incremental translation update on these files has been an open question. I now have a reasonable solution.

Free tools such as KDiff will perform a differential analysis on files and even show exactly which lines have changed. However, KDiff doesn't provide any ability to separate the changed files from the ones that don't need to be translated again. Fortunately, there is another application called Araxis Merge (Windows and MacOS supported) that does allow for this ability. At the time of writing, it's $129 for one standard licence.

Like Kdiff, you can run a recursive directory diff to find all the changes in all the files. However, once you have done your folder comparison, you can also select all the altered files (using Select Rows > Selected Changed) and copy them to a new "specified folder." Using this method, I was able to grab all of the XHTML files that have changed since we last did a complete document translation.

Note that this method DOES NOT copy new files. You will need to go through manually and copy the files that have been added. These files appear green in the Araxis folder comparison view.

And if that's not enough, you can even generate an HTML report of all the file changes with links to reports on the changes in each file… so cool.

I did run into some hiccups in Araxis, For example, a bug that often causes the right-click context menu to not appear and consequently hang the application. However, I was able to work around it and get my work done.

Tuesday, August 04, 2015

DocBook 5 Install and Setup for Windows

It has been a long time since I used a system such as DocBook. When writing Pragmatic Augmented Reality I used the Pragmatic PML framework, which is essentially a simplified version of DocBook.

Currently, I only want to set up DocBook to publish HTML--I may be adding PDF later. Finding the installation and set up instructions for DocBook on Windows was not easy. I discovered a couple of old (and short) versions of this and that's where I started. 

Unlike most Windows applications, there is no installer for DocBook. Installing is the same as downloading the executables (and other files), copying them to the location you want and then adding that location to your Windows Path. The Windows DocBook setup essentially has three pieces: 
  1. DocBook DTD (optional)
  2. DocBook XSL stylesheets
  3. Tools: 
    • libxml2
    • libxsl 
    • iconv
    • zlib1
1. Unless you're using a tool that supports DocBook (such as XMetal), you'll need to use one or more of the DocBook schemas. To do this, download and unzip the DocBook XML 5.x.x DTD from: This is optional since the stylesheets reference web versions of the DTD by default and you can edit DocBook files in any XML/text editor--I prefer Sublime Text because it's cross-platform and awesome.

2. Download and unzip the DocBook XSL 1.x.x stylesheets from:

I copied the files into C:\docbook\xsl

3. Download the tools. You can get versions of all 4 from here:

A. XSLTPROC: Download xsltproc: libxslt-1.1.26.win32 from

Unzip the folders and copy the files to c:\windows or another location that's in your Windows path. I prefer to copy them somewhere else (e.g., C:\docbook and add that directory to the path variable):

B. LIBXML2: I downloaded libxml2-2.7.8.win32.

If you want the newer libxml2 kit to convert your XML to HTML, you can get it from:, or But I'd try to get the old one working first. I haven't bothered to upgrade.

C. ICONV: I download iconv-1.9.2.win32

D: ZLIB1: I downloaded zlib-1.2.5.

After grabbing the tools, make sure you set up your Windows Path Variable. To set up the path for my system, I appended this: C:\docbook\libxslt-1.0.9-bin\bin;C:\docbook\libxml2-2.7.8.win32\bin;C:\docbook\iconv-1.9.2.win32\bin;C:\docbook\zlib-1.2.5\bin;

Once you have the tools installed. Run this command: xsltproc -version

The results should look something like this:

stephen.cawood@OLIFANTS /s/GitHub
$ xsltproc -version
Using libxml 20708, libxslt 10126 and libexslt 815
xsltproc was compiled against libxml 20706, libxslt 10126 and libexslt 815
libxslt 10126 was compiled against libxml 20706
libexslt 815 was compiled against libxml 20706

You will need a sample file to test your setup. Start with something dead simple like this (testDocBook.xml):

And the successful output should like like the image below.

To add a CSS stylesheet to your HTML output, use a command similar to this:

stephen.cawood@OLIFANTS /c/docbook
$ xsltproc --output outputFile.html --stringparam html.stylesheet help.css /c/docbook/docbook-xsl
-1.79.0/html/docbook.xsl testDocBook.xml

Note: If you want to build PDFs, you'll need to download  and install FOP for Windows.