Saturday, November 30, 2013

Books I've Read This Week

Remote: Office Not Required by Jason Fried and David Heinemeier Hansson is a good book for folks who are looking to take the leaving into working remotely. As someone who worked remotely for 3+ years I didn't find anything in the book that I would disagree with. Unfortunately, I also didn't find anything in it that would convince you boss to let you telecommute. So if you are looking for a book to feed your confirmation bias this is it but you may want to just get it from the library.
Raising Steam by Terry Pratchett is the latest book in the always hilarious Discworld series. This time around the main protagonists are Moist von Lipwig as he has been tasked by Lord Vetinari to take charge of this new fangled steam engine that has been brought to Ankh-Morpork.

The book gives Pratchett the opportunity to look back on how the invention and subsequent rollout of steam engine powered railroad. He's able to show how the discovery of this new technology brings people closer together by reducing the physical impediments that were once in place to separate the different races. You can draw a parallel with our own world where the internet is connecting people all over the place.

Sadly, this is not Pratchett's best effort. There is a long period in the middle where not too much happens and it could have probably been edited away. As well I'm not quite sure who the antagonist was in the novel. Certainly there was some conflict between the Grags and the rest of the dwarves but that didn't seem to gel quite right for me.

Although, I did enjoy the novel. Like most of Pratchett's books there are laugh out loud moments and I really thought the bit where the main steam engine was compared to a goddess of the earth as it embodied all four elements coal = earth, steam = water/air and fire to burn the coal and generate the steam from the water. 

Monday, November 25, 2013

Doctor Who Speculation on the 13th Doctor and Beyond

First off if you haven't watched the 50th anniversary special that aired this past Saturday don't read this post as it will spoil major plot points.

Alright, if you are still reading then you must want to hear this. An established part of Dr Who cannon is that Gallifreyan's can regenerate their bodies 12 times which effectively gives them 13 bodies in total. A fact which has been confirmed by Steven Moffat. This was a plot device originally dreamed up in 60's in order to allow the second Doctor, Patrick Troughton, to replace the first played by William Hartnell.

Looking back the following actors have played the Doctor:
  1. William Hartnell
  2. Patrick Troughton
  3. Jon Pertwee
  4. Tom Baker
  5. Peter Davison
  6. Colin Baker
  7. Sylvester McCoy
  8. Paul McGann
  9. Christopher Eccleston
  10. David Tennant
  11. Matt Smith
But as we now know there was a Doctor between McGann and Eccleston, the War Doctor played by John Hurt. Plus it has already been announced that Matt Smith is leaving the show and Peter Capaldi will be taking over. So the list actually looks like:
  1. William Hartnell
  2. Patrick Troughton
  3. Jon Pertwee
  4. Tom Baker
  5. Peter Davison
  6. Colin Baker
  7. Sylvester McCoy
  8. Paul McGann
  9. John Hurt
  10. Christopher Eccleston
  11. David Tennant
  12. Matt Smith
  13. Peter Capaldi
Oh no, we're at 13 Doctor's now. That must mean that Peter Capaldi will be the last actor to ever play the Doctor. Well of course not, they are going to keep making this show until it stops being profitable. During the 50th anniversary show we see John Hurt's Doctor beginning his regeneration but we never see him fully transforming into Christopher Eccleston. Perhaps this is because Christopher Eccleston was unable or unwilling to participate in the special or maybe it's something a little more timey wimey.

Since we had three Doctor's in the same time and space and they were actively messing around with their own timeline (yes, I know they hand wavey explained this away) I'm surmising that an alternative timeline has been created. Now when Doctor number 9 regenerates he doesn't become Christopher Eccleston but instead Peter Capaldi. This means that Capaldi could be Doctor number 10 and they've been able to stave off the question of a 13th Doctor for at least 3 more actors. 

8) Paul McGann
9) John Hurt
10) Peter Capaldi
11) ?
12) ??
13) ???

But wait, what about Matt Smith's Doctor what happens to him? Well, I believe that he is the 13th Doctor. You see David Tennant actually regenerated twice. Once in Journey's End and then again in his last show The End of Time. So that would make his list:

8) Paul McGann
9) John Hurt
10) Christopher Eccleston
11) David Tennant
12) David Tennant
13) Matt Smith

So in closing you probably had to be a real Whovian in order to read this post to the end but I believe we'll see a reboot of the Doctor Who franchise with Peter Capaldi stepping in as the new 10th Doctor and Eccleston, Tennant and Smith's Doctors being relegated to an alternative time line.

Sunday, November 24, 2013

Books I've Read This Week

The Shambling Guide to New York City by Mur Lafferty is a witty book that I quite enjoyed reading. The premise is an out of work writer ends up working for a small publishing company that is populated by vampires, zombies, death goddesses, etc. Initially Zoe is a skeptical of the varicosity of her co-workers claims but she is soon thrown head first into the monstrous underbelly of NYC. An innocent mistake from her previous job comes back to make trouble for her as well.
Fortunately, The Milk by Neil Gaiman is a book I'm very much looking forward to re-reading with my daughter. In it a father pops out to get milk for his kids breakfast cereal and he takes a very long time. When he gets back he regales his kids with a tale of dinosaurs, pirates, aliens and vampires.

It seem to me to be exactly the sort of story a father would come up with. It actually reminds me of the time my daughter was worried about dragons setting our house on fire to which I quickly replied that she didn't need to worry as we had dragon scale shingles on the house and obviously dragon scale shingles are impervious to dragon fire as it would be silly for a dragon not to be immune to their own breath. Well that story worked as she went to sleep. It wasn't until a few years later where I had to dance around that when we were getting our roof re-shingled.

Three Things That Tripped Me Up This Week

I've had a pretty productive week at work but here are three things that tripped me up this week. I'm putting them down in blog post format so that I'll remember them and maybe they'll help you as well.

1) Concurrent Modification Exception

So I was working on some code where I needed to loop through a collection of users and remove one when it meets a certain criteria. Which I coded up as:

        List users = um.getUsers();
        
        for (User user : users) {
            if (user.isAnAss()) {
                users.remove(user);
            }            
        }

Do you see the problem? No, neither did I as I wasn't thinking and luckily enough for most of my test runs the user who isAnAss was at the end of the List so the exception wasn't throw. When the isAnAss user was in the middle of the list BOOM! ConcurrentModificationException.

To get around this problem I ended up doing an old school iteration through the list.

        List users = um.getUsers();
        
        User user = null;
        for (int i = 0; i < users.size(); i++) {
            user = users.get(i);
            if (user.isAnAss()) {
                users.remove(user);
            }            
        }

2) Relative Layouts in Android are Slow for Complex Layout

I've been working on a lot of complex layouts for an Android app I'm working on and I was using the RelativeLayout judiciously. One of my dialogs was taking quite awhile to load and doing some profiling I determined it to be the measure method for the RelativeLayout was being called many, many times. Switching to a LinearLayout helped reduce these calls.

Romain Guy recently posted a slide deck on how RelativeLayout's are getting better in Android 4.4 and here is a video or Romain and Adam Powell talking about writing custom Android views.




3) Android's Handling of Images Sucks

It just sucks so hard. I was doing some performance tuning of one of our dialogs and found that about 90% of the time it was taking before being show was loading the three images it was using. Cache those images folks, doesn't matter how small they are.

Monday, November 18, 2013

Books I Read This Week

Year Zero by Rob Reid is a hilarious look at the recording industry and our insane patent and copyright laws through the lens of alien visitors to our fair planet. The elevator pitch is such, apparently aliens have been listening to our radio and TV broadcasts illegally since the 70's and have racked up so much in fines that the combined wealth of the entire universe is not enough to pay off the debt. Their solution is to blow up the Earth to avoid paying the fine. Now it is up to low level entertainment lawyer, Nick Carter (no not the Backstreet Boy) to save the world along with two alien reality TV stars.

I really enjoyed this book. It is a super funny work of satire.

Wait, is that it? Don't I usually put up two book reviews every week? Well yeah, I do but...well Attack on Titan is all I can say. I got super hooked on that anime this week and it has been eating up all of my spare leisure time. It's not even like I can watch it while doing something else as it is English sub-titles only. 

Monday, November 11, 2013

Jawbone Up Review

So I purchased the Jawbone UP back in July and I think I've had it long enough to have an informed opinion about the band and that would be, it's not quite ready for prime time. If I had the opportunity to do it all over again I wouldn't purchase the UP instead I'd be talking hard look at the Fitbit Force.

While the UP does a good job of tracking physical activity and sleep it has a number of deficiencies that keep me from recommending it. First there is no wireless sync option. Originally, I didn't think that it would bother me but it has become cumbersome to sync the band by plugging the band into my phone's headphone jack but it's become a PITA. Second, there is no external display where you can check your daily activity progress or see what time it is. Third, there is no website for you to track your progress everything has to be done via the phone interface.

Finally, charging is problematic. In order to charge the band you need to connect it's head phone jack connector to a special cable that connects to a USB port. Also, the battery sometimes will not take a charge, I'm on my second band since July and a friend of mine is in the same boat.

All in all, I love the idea of life tracking I just don't think this is the product for me.

Sunday, November 10, 2013

Book I Read This Week

Wool Omnibus Edition by Hugh Howey is the indie publishing darling series that started off as Kindle singles and has been collected into this omnibus format. The book is split into 5 parts which are more like novella's because, well, that's how they were written. The first story acts a lot like world building giving you an introduction to the Silo in which it appears the remnants of humanity live.

The whole thing has a post-apocalyptic vibe and it is hard to talk about without giving away some big secrets in the book. I really enjoyed the read and would recommend it to anyone who loves sci-fi.
Fullmetal Alchemist, Vol. 27 is the final volume of the long running anime series. Will the Elric brothers be able to stop the murderous "father" from sacrificing an entire country so he can achieve godhood. The Elric brother together with all of their allies they've met during the series band together in a final climatic battle against "father".

I was really impressed with the growth of the Elric brothers in the series. What kicked everything off was their attempt to bring their mother back to life but because of the alchemic principle of equivalent exchange they ended up sacrificing part of their bodies without truly bringing the dead back to life. They originally started by somewhat selfishly trying to restore their own bodies only to realize how much they care for other people and their country. 

Monday, November 4, 2013

Books I've Read Last Week

Whispers Under Ground is the third book in the Rivers of London series by Ben Aaronovitch. Once again we are hanging out with police constable and apprentice wizard Peter Grant. His new case is trying to find out who murdered the son of an American politician, of course, the FBI gets involved as well. His case takes him into the London subway system.

While all this is going on Peter is trying to figure out who the "Faceless Man" is with Inspector Nightingale.
Broken Homes is the fourth book in the Rivers of London series by Ben Aaronovitch. We are back with Grant and Nightingale once again but this time we spend a lot more time trying to figure out who the "Faceless Man" is while working a case at a London housing project.

I'm really, really enjoying this magical detective series but now I have not more left to read. Bwahahah. If you like Butcher's Dresden Files than this one is for you. I'm purposely trying not to say much about them as I'm four books into the series and I figure most of you will be starting with book one.

Sunday, October 27, 2013

Book's I've Read This Week

Moon Over Soho is the second book in the Rivers of London series by Ben Aaronovitch. In it we follow police constable and apprentice wizard Peter Grant on a new case. In this one he is investigating the sudden deaths of jazz musician's in London. This is a particular interest to Peter considering his Dad is a jazz musician himself.

I'm really enjoying this magical detective series, so much so I've already read the next two books in this series but more on that next week. If you like Butcher's Dresden Files than this one is for you.
Battling Boy by Paul Pope is simply amazing. I've read through it multiple times now and I pick up new bits in the story and art every time. The book was written for 12 year old boys but it works on many levels and is definitely an all ages hit. For long time comic book fans you will pick up on the homage to Jack Kirby and his work on titles like Thor and the entire New Gods line.

In Battling Boy we have a young god being sent on walk about basically. He needs to grow up and his father sets him a challenge to clean up a world of the monsters that threaten it. During he first challenge we see how new Battling Boy is to his powers and how naive he is. This is a good story about growing up and I can't wait for volume two to be released.

Friday, October 18, 2013

Books I've Read This Week

David and Goliath by Malcolm Gladwell probably would have been better titled Underdog but that title is probably taken. The setup is the biblical story of David and Goliath where the shepherd boy, David, defeats the massive Goliath against all odds to the contrary. Or is is that cut and dried? Gladwell uses this as a jumping off point to examine where perceived weaknesses can be turned into strengths.

Apparently, there is a bit of a controversy surrounding the truthiness of Gladwell's book. Regardless, he's an excellent story teller and this is an entertaining read. 
Hell to Pay by Simon R Green is the 7th book in his Nightside series. I really felt like reading the next book in the Rivers of London series by Aaronovitch but I hadn't had a chance to pick it up and all these Nightside books were still sitting in my stack. This is a passable read, that is all.

Friday, October 11, 2013

Books I've Read This Week

Confessions of a Public Speaker by Scott Berkun. In the last few years I've had the opportunity to do a lot more public speaking whether it be at local Ottawa events or at conferences across North America. Apparently, I'm not too bad at it as I keep getting asked to do presentations but I really can't tell myself. Here's a secret, once I get up on stage it's not me. No really, some other persona that is not afraid of public speaking takes over and my mind retreats back to it's happy place. Most of the time I can't even tell you what I've said.

That's why I was so intrigued to get and read Confessions of a Public Speaker. I rather enjoyed Mr. Berkun's insights into public speaking. I was also very glad to find out that most people are more afraid of public speaking than death. Actually, that doesn't make much sense but it is a good anecdote. The book is filled with some great stories and a lot of practical advice.

The one piece of advice I'm immediately putting into play is to interrupt those folks who ask rambling 5 minute long questions after your talk. I guess the audience is just as disappointed to have to listen to the ramblings of a mad man as I am. However, you can do it politely. Just offer to take the persons super involved query off line and follow up with your email address so they can contact you.

There is also some good bits on "what can go wrong" during a talk. It's great to be prepared for problems. For instance, when I walk into a venue to do a talk I usually have my presentation in 3 separate locations, my laptop, a usb stick and Dropbox. So god forbid anything happens to one of them I have a redundant back up ready to go.

You might think that sounds a bit excessive but let me refer you back to my PhoneGap Day US talk. My laptop would mirror it's display with the projector so the audience would only be able to see the left half of my presentation. I didn't get freaked out about it, I just jumped on Tommy's laptop and did the presentation out of my Dropbox account.

But that was nothing compared to what Kristofer Joseph was able to pull off at September's PhoneGap Paris meetup. Kris was doing some live coding of Topcoat while presenting to a large Parisian crowd. Now that doesn't sound too bad but here is the picture:



Now you have to look at the top right hand corner of the picture to see Kris leaning over the railing on the second floor of this busy bar in Paris. He's presenting to the crowd down below while holding a hand mic, while typing on his computer, while a bunch of people sing happy birthday behind him. Yup, I will never complain about a tough presentation setup ever again.
American Gods by Neil Gaiman. Wow, I really hated this book the first time around. Wait wut? You hated a Neil Gaiman book? Yes, yes I did but with what I feel was good reason. You see I was on vacation and I had just finished Tim Powers excellent novel Last Call. The next book up in my queue was American Gods and I thought OMG! Neil Gaiman stole the plot for this book from Tim Powers. The two books are amazingly similar in a number of regards and since I read them back to back I was pretty upset with Mr. Gaiman at the time.

But then some time passed and I read an interview with Powers and Gaiman where they agreed that it was an odd co-incidence that the books seemed similar but there was no copying going on by either party so I read it again and loved it! This is actually the third time I've read the book as it was the October book in my book club and I must say I thoroughly enjoyed it once again.

The book centers on an ex-con named Shadow. He gets out of jail a few days early in order to attend his wife's funeral. Rudderless after the loss of his wife he takes a job for Mr. Wednesday an embodiment of the Norse god Odin. While on the job Shadow criss crosses America with Mr. Wednesday trying to recruit the old gods, the ones immigrants brought to America, in a war against the new gods of America, the Internet, Fame, TV, etc.

It is a pretty great treaties on the conflict between spiritual beliefs and the new gods of technology. It does a good job of exploring the question of whether man creates gods or gods create men.

Also, it contains quotes from one of my favourite poems, The Second Coming by W.B. Yeats.

Monday, October 7, 2013

My PhoneGap Day US Talk on Speech Recognition

Back in July I went out to Portland to talk at PhoneGap Day US. The video has just become available so I figured I would post it up here. The talk I did at PhoneGap Day EU is very similar to this one with a bit of updated information and mostly new jokes.


Friday, October 4, 2013

Books I've Read This Week

Midnight Riot is the first book in the Rivers of London series by Ben Aaronovitch. I'd actually been keeping my eyes out for this book for awhile but it isn't usually carried in North American books stores as near as I can tell. Yes, yes I know there is this thing called Amazon where you can order books online but when you to read list is hovering around 90 books you don't need to order any new ones. I ended up seeing this it in an English language bookstore in Amsterdam and I needed something to read on the train but I digress.

The closest comparable I can find for this book is the Dresden Files series by Jim Butcher which is a good thing as that is a really fun series. Anyway, PC Peter Grant is just finishing his probationary period and is hoping to become a detective but after standing guard at a grisley murder scene he discovers that he can talk to ghosts. This leads to Peter being assigned to a special division of the London Metro Police that deals with super natural crime.

I really enjoyed this book and I'm looking forward to reading the rest of the series.
The Fractal Prince by Hannu Rajaniemi is the second book in the Jean de Flambeur trilogy. I remember really enjoying the first book, The Quantum Thief, when I read it a couple of years back as it seemed fresh and original. This book to me seems to be a bit more chaotic and the science in this is more like magic. Plus it is short clocking in at about 300 pages. I guess what I'm saying is that I didn't enjoy it as much as I thought I would. 

Monday, September 30, 2013

Books I Read Last Week

Whoops, sorry was traveling last week and didn't get a chance to pull together a post.
Cooked: A Natural History of Transformation by Michael Pollan is not my favourite book by the author. In this one he learns how to cook by working with some incredible chefs that are out of the realm of a mere mortals ability to contact.There is some interesting info on how to cook but it is certainly not a cookbook. I'd probably take a pass on this one if I had the chance to do it over again.
The Lost Fleet: Beyond the Frontier: Guardian by Jack Campbell. In this third book of his Beyond the Frontier trilogy the fleet is on their way home. On their way they have to defend the Midway star system from an attempted takeover by the Syndicate Empire who want to bring Midway back into the fold.

Check out my post from last week to see how I feel about the second book in this series.

Friday, September 20, 2013

Books I've Read This Week

You Are Not So Smart by David McRaney is an extension of his popular blog also called You Are Not So Smart. The book catalogs all of the different ways in which we lie to ourselves. It's a pretty interesting book but I felt like I've read quite a bit of the topics that he covered in books by Dan Ariely
Lost Fleet: Beyond the Frontier: Invincible is the continuation of the Lost Fleet series by Jack Campbell. In this second book of his Beyond the Frontier trilogy the fleet is escaping a battle with the Enigma race when the run headlong into another alien race that they need to quickly determine if they are friend or foe. If they are hostile how does the fleet get out of this star system without being wiped out.

I always like these Lost Fleet novels. They are like popcorn, quick and enjoyable reads. They are fun for anyone who enjoys military sci-fi.

Saturday, September 14, 2013

Book's I've Read This Week

The Evolutionary Void by Peter F Hamilton concludes his Void trilogy. I really, really loved this book and series. It is a big commitment in terms of page count but it is worth it. I hesitate to get into it in too much detail for fear of spoiling anything. You are probably better off going back and checking my review of the first or second book.
Revival Volume 1: You're Among Friends TP with story by Tim Seeley and art by Mike Norton is a rural noir story. It is set in small town Wisconsin where the dead have come back to life but they are not brain eating zombies instead they are rational thinking human beings that are not really different than you and I other than they are dead.

The residents of the town have to deal with their loved ones coming back to life. The government quarantining the town to prevent the "possible" infection from spreading. It seems like the government has watched a lot of George Romero movies and that has informed their opinion of what to do. As well the religious calamity arising from the dead walking.

This is a really creepy feeling graphic novel and another great work from Seeley and Norton.

Friday, September 6, 2013

Books I've Read This Week

Wonder is the concluding chapter of Robert J Sawyer's Wake, Watch, Wonder trilogy where a young girl discovers an emerging intelligence on the internet. In this volume the world now is aware of webmind and we see how we'd react to a non human intelligence. The reactions run the full gamut where some folks treat webmind like god while others see it as a threat and make moves to kill it.

I enjoyed the book but I did get skived out at one point where the female lead, Caitlin a 15 year old girl, is about to become "sexually active". I'm not sure why it bothered me so much but it may have something to do with that 8 year old daughter I have and wanting to stick my head in the sand.
The Daylight War by Peter V Brett is another third volume but in this case it does not conclude the series. In this volume we get more of the background of Ahmann Jardir who is possibly the Deliverer reborn. Could this be the man fated to deliver this world from the tyranny of the demons that plague it nightly.

The book does a nice job of filling in the background of the man who is so important to the story but I did feel like it stalled the narrative a bit. By the end of the book we are ready for the fight to between Jardir and Arlen Bales. Only one of they can be the Deliverer and it rightly identifies that the world will remain split as you can't have two generals so one of them has to go.

Wednesday, September 4, 2013

My SpeechShim for Desktop Development of Speech Recognition and TTS Apps

So I've been working on some plugins for PhoneGap to enable people to develop their apps with Speech Recognition and Text to Speech functionality. I've been following this specification and while it isn't on track to be adopted by the W3C anytime soon it does have two big benefits:

1) The speech recognition bit is already available in Chrome.
2) The specification is "sane". I guess it helps when only a couple of people are credited as authors instead of a committee.

One of the things that has been bugging me for awhile is the inability to develop these type of apps on the desktop using the same API. Yes, as I said above the speech rec bit is available in Chrome but the objects have the "webkit" prefix and there is not TTS support. So during one of the Ottawa Ruby project nights I set out to write a shim that would give everyone the ability to use the same API that will be available from the PhoneGap plugins on their desktop.

Basically that is what SpeechShim is in a nutshell. When you add speechshim.js into your web app you will be able to access the "SpeechRecogntion" object instead of needing to prefix it like "webkitSpeechRecognition". As well if you combine it with the speak.js project the speechshim.js code will add the methods necessary so you can use the SpeechSynthesis interface.

To get up and running you will need:
  1. A copy of Google Chrome version 29 or higher.
  2. A copy of the speak.js project from github.
  3. A copy of my speechshim.js from github.
Here's an example HTML page:


and you can run the live demo here. It's nothing fancy. Just click the big button then say something. It should get updated under the button and you will hear it spoken out by the TTS. More on plugin availability for PhoneGap is coming soon.


Friday, August 30, 2013

Books I've Read This Week

It's an all graphic novel catch up week. Back with sci-fi and fantasy books next week.

Mind The Gap Volume 2: Wish You Were Here story by Jim McCann and art by Rodin Esquejo is the continuation of the "murder mystery" from volume one. Unlike some other books or shows in this volume we start to get answers from all of the questions that were originally raised. But like any good story the answers just open up some new questions. This is just a great series and more people should be buying it.

Batwoman Vol. 2: To Drown the World is a book I was apprehensive about buying. I've really loved JH Williams III art but in this volume he's not contributing to the art duties. Instead we get Amy Reeder (who I love) for a short period of time before she left the book under the ominous creative differences label. Then Trevor McCarthy picks up the rest of the issues. The art is good but not as amazing as when JHW3 handles the layouts.

The story is a confusing mess. JHW3 and Haden Blackman you are not Alan Moore so while I applaud your attempt at telling a cohesive narrative from six different point of view characters while jumping back and forth the timeline I can't really say you did a good job as the whole thing is confusing as hell.

Apparently the next volume is set to guest star Wonder Woman and supposedly it is better but I'm not sure I'll shell out the bucks to pick it up in hard cover.

Saga Volume 2 story by Bryan K Vaughn and art by Fiona Staples. Okay, here's my elevator pitch, Romeo and Juliet in Space! Wait you need more details, okay then. In volume 2 of this space epic we get more background on how Marko and Alana fell in love and decided to run away from the conflict between their two species. We also get more Price Robot IV, more Izabel the ghost baby sitter, more The Will, more Slave Girl, and the repercussions of Marko's parents visit. Plus, Marko's ex Gwendolyn gets involved.

Oh and more of the break out star, Lying Cat...


Best. Cat. Ever.

This is really some great writing and phenomenal art make this book a standout. One of the best things about it is Staples really lets her imagination go wild when drawing the aliens. Think the Star Wars Mos Eisley cantina scene amped up to 11.

Sweet Tooth Vol. 6: Wild Game by Jeff Lemire who is everywhere in DC right now. You could make a case that he is there second most important writer next to Geoff Johns, but I digress. The final volume of Sweet Tooth has our band of humans and hybrids travelling north to Alaska in order to find out where Sweet Tooth originally came from, the initial cause of the disease and maybe even a cure?

Lemire is on fire here tugging out our heart strings and eliciting a strong emotional response as we see the ultimate fates of characters we've been following for years. I strongly recommend this whole series to anyone. 

Friday, August 23, 2013

Books I've Read This Week

The Blade Itself, Before They are Hanged and Last Argument Of Kings are all part of the First Law trilogy by Joe Abercrombie. Previously I'd read a couple of stand along novels set in the same universe but I finally had a chance to jump into this trilogy and I was not disappointed.

This is a fantastic grim and gritty fantasy series. There are a lot of memorable characters in these books including a couple of my favourites the northern beserker Logan Ninefingers and Inquisitor Glotka. None of the characters that you encounter in these novels are purely altruistic or purely evil.

The first book starts off with the Magus Bayaz putting together a group of adventurers to go off on a quest including Logan Ninefingers, the vain fencer Jezal dan Luthar among others. While this sounds like a typical fantasy setup Abercrombie eschews the normal traps of epic fantasy.

The three books are a long read but well worth it especially if you like you fantasy novels to be more like George R R Martin instead of J R R Tolkien.

Sunday, August 18, 2013

Books I've Read This Week

The Ocean At The End Of The Lane has been described as one of Neil Gaiman's most accessible books to readers new to the fantasy genre. In this story we follow a middle age man who returns home to attend a funeral and finds himself drawn to the farm at the end of the lane. Once there he unlocks memories he hasn't thought of for forty years. Memories where he and a childhood friend stumbled onto something otherworldly.

It's got a creepy faerie tale vibe, combined with the exploration of youthful memories. It is really worth the read even if it is only a short book weighing in under 200 pages.
One Click: Jeff Bezos and the Rise of Amazon.com by Richard Brandt was a quick read as well. Even though the book was published in 2011 it tends to focus on the earliest years of Amazon. I can't honestly recommend this book as it doesn't tell me anything about Amazon I didn't already hear about from other sources.

Friday, August 9, 2013

Books I've Read This Week

Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript by David Herman is an excellent book on JavaScript. Chapter 7 on Concurrency is worth the price of the book alone. It is a great way to extend your mastery of JavaScript.
For the Win by Cory Doctorow is a pretty cool book where "gold farmers" across the world try to unionize in order to get fair wages. The gold farmers in India, China, etc. use the internet to get organized and are opposed by not only their local bosses but also the big companies that run the games and are responsible for the game economics. Honestly, the information about how these large economies are run is some of the most interesting stuff in the book.

Friday, August 2, 2013

Books I've Read this Week

Whoops, haven't done one of these in awhile but that doesn't mean I haven't been reading.

Ted Chiang doesn't often write but when he does it's usually a masterpiece. He's a 4 time Nebula award winner to go along with 4 Hugo's. I re-read his collection of short stories Stories of Your Life: and Others for a book club I'm in. Even upon the second reading I was just as drawn into these stories as I was the first time I read the collection. While I'm not a huge lover of short story collections this is one I'd recommend to anyone.
Among Others is a Hugo and Nebula award winner by Jo Walton. In it there is a semi-autobiographical journey of a young woman who has just defeated a dark fairy queen and is living with the consequences or maybe she's just nuts. You'd really have to read it to decide. It has a very "what happened after Sam and Frodo dropped the ring off in Mordor" vibe to it. Not a typical fantasy novel but a really enjoyable one all the same.

Thursday, July 25, 2013

PhoneGap Day US 2013 Recap

Why, weren't you there? Seriously, what's stopped you? This conference is so great and so cheap that if you are anywhere near Portland, Oregon you need to go. Even if you aren't near Portland you need to convince your boss to send you to the conference.

What's the number one reason to attend PhoneGap Day? Timing, no wait the community. The community really comes out for this conference. I can't think of another conference I've attended where you can meet so many committers. If you were there you could have met all those people you see fixing bugs on JIRA and checking code into GIT.

Beyond the committers there were lots of folks who are building real applications with PhoneGap and they are there for you to talk with, network and generally pick their brains.

There were a lot of great presentations this year but if I was going to single out three they'd be Andy Trice's PhoneGap+Hardware, Michael Brooks super slick PhoneGap Command Line demo/presentation (I only wish I was that smooth) and finally Lyza Danger Gardner's deck on PhoneGap Self-Defense for Web Devs. That one was jam packed with things web devs should know before diving into PhoneGap.

I was sweating my talk a bit before heading up on stage. I was about to give a speech recognition demo on a stage in front of 250 people. There were so many things that could have gone wrong like the (network, crowd volume) and one thing did. For some reason my MBP would not mirror the displays so either I could see the presentation or the audience could. Luckily, as a former boy scout, I was prepared. I was hosting my presentation on Dropbox so I was able to slide over to Tommy-Carlos Williams laptop to do my demo without holding up the show. Thanks again Tommy!

Sacrificing my laptop to the demo gods seemed to appease them and the rest of my presentation went off pretty well with only one unintentionally funny moment. People seemed to have liked it which I was happy about. You can download a PDF version of the presentation but it plays much better as a live demo.

All of these presentation videos will be available soon. In fact when mine is up I'll be posting it here. As well I'm lagging behind posting my source code but I'm kinda busy with some other commitments I'll talk about on a later date.

Beyond catching up with all of the other PhoneGap committers it was a great conference for meeting folks I internet knew, In Real Life. Besides the afore mentioned Tommy-Carlos Williams who shocked me by not having an Australian accent, he is USA born, I got to meet my co-worker Marcel Kinard for the first time. Both Marcel and I work at IBM where he is managing IBM's contributions to the PhoneGap/Cordova code base. Finally I got to know Jim Cowart of Icenium pretty well over the conference. Jim's done a great write up of the conference himself.

Honestly, I will carry to my grave the memory of the taste of Griddled Bacon Wrapped Date with warm honey from Tora Bravo. Jim, Marcel, Burin and I went there after the first day of the conference and we were all blown away with how good the food was. I guess it is not a secret but Portland is a great city for foodies.

Finally I will leave you with this over the shoulder video of me playing Galaga at Ground Kontrol the amazing barcade (bar + arcade) courtesy of Jim.

Wednesday, July 3, 2013

Backup, Remove and Restore your Contacts using PhoneGap

A couple of people have had questions on how to do this recently so I thought I would do a write up on it. As well, it illustrates how you avoid using loops with asynchronous code. Although for an even better explanation of that topic you'll want to read Item 64: Use Recursion for Asynchronous Loops from David Herman's book, Effective JavaScript. Chapter 7 on Concurrency is worth the purchase price of the book but I digress...

First a warning. Try all the code out on an emulator first. The methods below will completely wipe the contacts from your device so you'll want to make sure the backup step works first before continuing. You've been warned!

Anyway, if you want to backup the contacts on your device to a file you'd use the following process:
  1. Find all the contacts
  2. Request a file system object
  3. Create a FileEntry object
  4. Create a FileWriter
  5. Write the JSON data to file
The code in which to accomplish those tasks is as follows: Once you see the "backup complete" message in the console you'll have a file called "contacts.bak" in the root directory of your file system. For Android users that will probably be /sdcard and for iOS, etc. it would be in the applications sandbox. If you take a look at the file you will see something like this: If you are seeing what looks like your complete contact database in text format then you are ready to proceed.

Next we will delete all the contacts on the device. The steps are:
  1. Find all the contacts
  2. Recurse through the contacts deleting one at a time.
The code looks like:

This might look a little bit weird at first glance but trust me it'll make sense. You'll notice in deleteAllTheContacts the first thing we do is to create a local function called deleteContacts. This is the method that will actually remove the contacts from the device. Then after the definition of deleteContacts we call navigator.contacts.find(). This call will get an array of all the contacts on the device and call it's success function which is deleteContacts.

Now in deleteContacts we do a check to see if the length of the contacts array is zero. If it is zero then we are done, there are no more contacts left to be deleted. If the contact array length is greater than zero we have more work to do. We'll pop the next Contact object off of the contacts array, which reduces the size of the array by one and we'll call the remove method of the Contact object. The success call back for remove method is the deleteContacts method. Keep reading this paragraph until all of your contacts have been deleted. Boom recursion.

But wait, you are wondering how could this possibly work. Your thinking I've got 7 quintillion contacts and there is no way the call stack can support that many recursive calls. Ah, but you are forgetting that asynchronous calls return immediately so they never eat up the call stack. If you tried doing this with a for loop you would blow up the call stack causing your program to crash if you had enough contacts and even if you didn't kill your app how would you know when all of those async calls to remove were complete without doing a lot of JavaScript gymnastics. Just use the recursion approach.

Finally you'll want to be able to restore the contacts you've previously saved to file. I've broken it down into two separate methods to make it easier to read:
  1. Request local file system
  2. Get the FileEntry
  3. Request the File object
  4. Read the data and parse it to JSON
  5. Recurse through all the contacts and save them to the device

This is pretty much just unrolling the two previous steps of backing up and deleting the contacts. If you've gotten this far you should be able to understand what is going on. Although there are two lines I want to draw your attention to:
contactData.id = null;
contactData.rawId = null;
What I'm doing here is removing the unique ID's from the contact. If you skip this step you will signal the API that you are attempting to modify an existing contact and the save will most probably fail. Hopefully this helps a bunch of folks.

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.