Monday, June 17, 2013

Spartan Race 2013

In the tradition of "pictures or it didn't happen" here are some shots of me and my friends participating in the Spartan Race this past Sunday.

So it begins

Probably the first time I've ever successfully climbed one of those ropes. Amazing what the threat of 30 burpees can do.

Flying Matrix crane fire jump

You're almost done, so guys hit you with sticks

and scene!

Robin and I (pictured above) finished the race in a time of 1:49 which is much longer than I expected to take. However, I think we did pretty well considering the race was done in the pouring rain which made the course slick and muddy. Considering we ran up and down Edelweiss three times I'm thinking 1:49 was a pretty good time.

The race course was advertised as 5km but I've heard it was 6.7 km which makes sense to me. As well each time up/down the mountain was a 200m change in elevation.

Things I learned that are important for Spartan Race competitors:

  1. Cotton fiber underwear is a bad idea. They get soaked and weigh you down. Better to go with lycra biking shorts as they don't absorb quite so much water.
  2. Thiner shoes! I hate to buzz market those Vibram FiveFingers shoes but I can see how they would come in handy in this race. By the time we were heading up the mountain for the 3rd time I believe my shoes and socks gained an extra couple of pounds of water, muck and rocks.
  3. If it is raining I'd go with some gloves as it is pretty tough to grab the rings, monkey bars, etc. when everything is slick with rain.
Anyway, I had a blast and I would definitely do it again. Anna really wants to do one so I'm going to have to look into a kids version for her as she is very, very excited to get full of mud.

Thursday, June 13, 2013

My PhoneGap Presentation to Ottawa JS

So on Wednesday night I did my Introduction to PhoneGap/Apache Cordova (GitHub repo) presentation for Ottawa JS at the beautiful Shopify lounge. I've given this presentation a ton of times so I decided to give it a twist this time around.

The first thing I did was convert my old slide deck into a reveal.js presentation. Then I popped all the assets into a PhoneGap iPad project to see how it looked. Well, reveal.js looks and works great on an iPad.

At this point I started to get fancy. When I got to the part of the presentation where I would usually switch from the presentation software to Eclipse/Xcode to show the code and emulator I decided to call out to PhoneGap to take a picture instead. All I needed to do was include cordova.js in the app and make a call to Camera.getPicture and the results were:


this is my view from the stage


the view from the audience

And Darren took a picture of me taking the picture, while the picture I was taking was being put up on the big screen which is also in this picture. So I was able to do a presentation on PhoneGap in a PhoneGap app calling the PhoneGap API. It got meta pretty damn quick!





Tuesday, June 11, 2013

A Couple of Good Google Apps Scripts

Here are a couple of good Google Apps Scripts I've run into last week. The first script I saw on Lifehacker. It converts a Google Doc to markdown. It is a great way to create a README.md for GitHub. The second is from Pamela Fox which converts a Google Speadsheet to JSON data. Great way to create sample JSON data for your app.

Sunday, June 2, 2013

Why Don't My Plugins Work in PhoneGap Android 2.7?

Well it's pretty simple, the Plugin class which has been deprecated for awhile has been removed from the package and should be replaced with CordovaPlugin.

I'm going to go through the steps needed to upgrade your old style plugins to the new style. For this example I'm going to use the Google Analytics plugin.

The first thing you will notice in 2.7.0+ is that the GoogleAnalyticsTracker class now has 4 errors in Eclipse. To get rid of them you would change:


import org.apache.cordova.api.Plugin;

into:

import org.apache.cordova.api.CordovaPlugin;

and:

public class GoogleAnalyticsTracker extends Plugin {

to:

public class GoogleAnalyticsTracker extends CordovaPlugin {

and now you'll notice you only have one error left in the file and that has to do with the execute method. You'll need to change the method signature from:

public PluginResult execute(String action, JSONArray data, String callbackId) {

to:

public boolean execute(String action, JSONArray data, CallbackContext callbackContext) {

then you need to add a new import line at the top of the Java file:


import org.apache.cordova.api.CallbackContext;

and we still have one error which is now the line in which we are returning the PluginResult. That's because the method now expect a boolean to be the return value. To fix this issue you would replace:

return result;

with:

callbackContext.sendPluginResult(result);
return true;

Finally our Java code is free of error messages. Whew, were done but what's with the change to the execute method? Well let's just say there have been improvements in the way the Plugins are handled internally. What you need to know is that when you want to send a result back to the JavaScript side you now have a choice of three methods:

1) callbackContext.sendPluginResult(...)

Use this if you have constructed your own PluginResult and you want to send it to the JavaScript side.

2) callbackContext.error(int | String | JSONObject) 

Skip creating a PluginResult and just invoke the error callback on the JavaScript side sending back an int, a String or a JSONObject as the method payload.

3) callbackContext.success(empty | int | String | JSONObject | JSONArray)

Again, just skip creating the PluginResult and invoke the success callback on the JavaScript side sending back an int, a String, JSONObject or JSONArray as the method payload. If you don't provide any payload the method on the JS side will be executed with no payload.

So that should get you unstuck if you have a Plugin that no longer works for you as of PhoneGap 2.7.0. You should also check out my posts on the GalleryPlugin as shows how to write a Plugin using the new API for JS and Java.

IMPORTANT UPDATE!!!

We've heard your screams of pain and we are putting the Plugin class back for PhoneGap 2.8.1. Go read Joe Bowser's post. The class is back in 2.8.1 and will be in 2.9.0 then gone for good in the 3.0.0 stream!





Friday, May 31, 2013

Books I've Read This Week

The Demon by Jack Kirby collects the entire 16 issue run of the series. Kirby's art is brilliant and his story telling is frantic. This book defies convention as it isn't a pure super hero story but it isn't a pure horror story either. You can see how these stories went on to inspire so many other authors in their use of the Demon and maybe even Mike Mignola and his Hellboy character.
Inferno by Dan Brown. Yeah, I wasn't going to read it but the book is available so cheaply and it such a quick read. Plus, I already reviewed it before it even came out so I figured I should read it to see how right or wrong I was.

Whelp, I was way off base in plotting as Brown uses flashbacks to re-jigger his timeline. However on character's I was spot on and you can check them off one by one as they appear in the story. There is supposed to be a huge swerve in the book but it is utterly predictable when you realize that two of Brown's usual character archetypes are combined into one person.

If you usually like the Robert Langdon series you'll probably like this one as well. It's like comfort food at this point as you know what to expect.  

Saturday, May 18, 2013

Books I've Read This Week

Marvel Comics: The Untold Story by Sean Howe. Ug, sometimes it's not a good idea to learn how the sausage is made. As a long time comic book fan and a lover of Marvel comics for untold years I though it would be interesting to learn the story behind how some of my favourite comic books were produced. That was kinda a bad idea that left me feeling depressed. These weren't super happy people bouncing around the bullpen fronted by the always jovial Stan Lee, these were real people with real problems. After reading this book I wonder how the entire comics industry didn't implode, multiple times. Anyway, it was a good read but one I'm wishing I didn't read regardless.

Tuesday, May 14, 2013

My Review of Dan Brown's Inferno Before I've Even Read It

Oh my god! I just heard that Dan Brown is releasing a new book today starring Robert Langdon called Inferno. If you are not a Dan Brown fan you might not know that this is the 4th book with Robert Langdon as the main character with Angels & Demons, The DaVinci Code and The Lost Symbol being the prequels. I have read all the previous novels and even reviewed The Lost Symbol so you wouldn't have to read it yourself.

This time around I figured I'd review the novel before I even have read the book. Please note I haven't read the book and I don't have an advanced copy of the book. Instead I'm basing my review completely on what I've read in the previous books. I figure I can get about 85% correct so if this spoils the novel for you then I'm sorry.

The book opens in Florence Italy where an old man is being chased. He's able to avoid his pursuers long enough to hide some crucial piece of information that will become important later even though it seems silly now. The old man is now murdered and we immediately cut to...
Robert Langdon being awoken. The author is just trying to show how clever he is as he understands time zones. Langdon soon learns that an important figure in the symbolism sect has been killed and only Robert Langdon can help solve the problem. He then gets off to Florence Italy. 
Where he's taken to the crime scene where he meets the Misguided Policeman who immediately starts off on a bunch of exposition to catch up all us readers on why this person is important. Then the love interested walks in and we soon discover that she is the daughter/grand-daughter/adopted daughter of the dead man. The Misguided Policeman gets a phone call/interrupted by underling and leaves the two alone to talk where Langdon realizes that this is all a big puzzle related to Dante's Inferno. 
At that point Misguided Policeman realizes that Langdon must be in on it somehow even though he was an ocean away when the murder was committed. The chase is on!  Langdon uses his knowledge of medieval Florence to give the police a slip. Not realizing that they are being chased by a crazed assassin who has a some sort of glaring physical trait like a unicorn horn that should make him easily spottable from space. 
Langdon and love interest run around Florence solving clues only to get to a point where they need help. Langdon now realizes he knows someone near Florence that can help so they go to them for help. Super Spoiler Alert! This person they go to for help is the villain who is pulling all the strings from behind the scenes. 
Now the three of them are running around Florence solving clues and heading towards a final conflict where Langdon realizes that the help is the villain and tricks him into thinking that he can't solve the final puzzle. The Misguided Policeman finally realizes who the true villain is and arrests the help and guns down the crazed assassin. 
Langdon and the love interest go off and solve the final puzzle and for some reason even though beautiful women keep throwing themselves at him Langdon once again fails to seal the deal.
The End

Well that's my best guess. Feel free to leave a comment to let me know how right or wrong I am.