Friday, June 29, 2012
Books I've Read This Week
Friday, June 22, 2012
Books I've Read This Week
In the novel Ensign Andrew Dahl has been assigned to the starship Intrepid. Once on-board Dahl quickly realizes there is a redshirt problem and sets his mind towards discovering the root cause of the problem. This leads to some hilarious and mind bending examination of science fiction writing in general. I greatly enjoyed the first three quarters of this book but once Scalzi got into the second and third coda's I kinda lost interest. It's not that the coda's weren't written well it is just that they moved on from the comedy of the first part of the book into more melancholy. All and all an enjoyable read. |
![]() On this collection writing duties are handled by Williams and Haden Blackman who are replacing Greg Rucka who's left DC altogether. I can't say I enjoyed the writing as much in this collection as I did in Elegy but I will definitely pick up the next collection based on art alone. Williams is taking a break from the art but a few issues will be handled by Amy Reeder and Trevor McCarthy after a split between Williams and Reeder on the books direction. Anyway, pick up the book on art alone. Hopefully the quality remains just as high for the next collection. Fingers crossed! |
Monday, June 18, 2012
Updated Speaking Engagements
I got some really positive feedback for my Adding Speech Recognition to Your Android Applications presentation that I did at AnDevCon III. I'm incorporating that feedback and I'm going to be giving the talk a couple of more times over the next two months:
- Ottawa Android - Ottawa, June 20th
- OSCON - Portland, July 18th
In addition I'm going to be at PhoneGap Day talking about my side project Corinthian. Basically, Corinthian monkey patches a bunch of stuff that should work in the Android WebView and adds some extra UI elements as well.
- PhoneGap 2.0 Day - Portland, July 20th
If you are going to be in or around those cities on those dates ping me on twitter and we'll see if we can arrange a meet up.
Friday, June 8, 2012
Books I've Read This Week
In the novel we follow the journey of Ig Perrish a year after he was rightly/wrongly accused of brutally murdering his long time girlfriend. The Ig of a year ago was a saint as we discover through flashbacks but now he is literally becoming the devil complete with horns growing out of his head. Let's just say that this novel is full of "bad things happen to good people" which makes it painful to read at times but ultimately satisfying. |
Wednesday, June 6, 2012
PhoneGap Android Application Preferences Plugin
So I'm working on a side app that I get to touch about once a month for about 15 minutes and one of the things I ran into is that I need a way to store user preferences. Well I realized that I could build my own HTML page and store the data in localStorage but I wouldn't learn anything new that way. In the end I decided to do a plugin that would allow PhoneGap developers to use Android Application Preferences and I modelled it after the existing iOS plugin by originally by Tue Topholm (Randy McMillian ported it to the updated Plugin API on iOS).
First if you are unsure about how application preferences are setup on Android go read this tutorial and then come back I'll wait. Oh great, your back. Let's crack on with things.
Functionality
Okay, so the application preferences plugin will provide you with four methods that you can use to interact with the native Android preferences.
get(key, success, fail)
If the key exists in the preferences it will be returned as the single parameter of the success callback that you provide. If the key does not exist the failure callback will be executed with an error object with error.code set to 0 which means no property.
set(key, value, success, fail)
load(success, fail)
Calling load will have the native side loop through all the preferences creating a JSON object that will be returned as the single parameter of your success callback.
show(activity, success, fail)
Calling show passing in the class name of your PreferenceActivity class will cause the native Android GUI to be shown so your user can interact with the preferences. If the class name you pass in doesn't exists your failure callback will be called with an error object with error.code set to 1 which means no preferences activity.
which brings up a GUI that looks like this:
Installation
Installation of the Plugin follows along the common steps:
Oh, and I'm pretty sure that Darren McEntee has already included this plugin in his Live Football on TV app which means this plugin is already in the wild.
Enjoy!
First if you are unsure about how application preferences are setup on Android go read this tutorial and then come back I'll wait. Oh great, your back. Let's crack on with things.
Functionality
Okay, so the application preferences plugin will provide you with four methods that you can use to interact with the native Android preferences.
get(key, success, fail)
If the key exists in the preferences it will be returned as the single parameter of the success callback that you provide. If the key does not exist the failure callback will be executed with an error object with error.code set to 0 which means no property.
window.plugins.applicationPreferences.get(key, function(value) { console.log("The value is = " + value); }, function(error) { console.log(JSON.stringify(error)); });
set(key, value, success, fail)
If the key exists in the preferences then value will be saved and your the success callback will be executed. If the key does not exist the failure callback will be executed with an error object with error.code set to 0 which again means no property.
window.plugins.applicationPreferences.set(key, value, function(value) { console.log("set correctly"); }, function(error) { console.log(JSON.stringify(error)); });
load(success, fail)
Calling load will have the native side loop through all the preferences creating a JSON object that will be returned as the single parameter of your success callback.
window.plugins.applicationPreferences.load(function(value) { console.log("The object is = " + JSON.stringify(value)); }, function(error) { console.log(JSON.stringify(error)); });
show(activity, success, fail)
Calling show passing in the class name of your PreferenceActivity class will cause the native Android GUI to be shown so your user can interact with the preferences. If the class name you pass in doesn't exists your failure callback will be called with an error object with error.code set to 1 which means no preferences activity.
window.plugins.applicationPreferences.show("com.simonmacdonald.prefs.QuickPrefsActivity");
which brings up a GUI that looks like this:
Installation
Installation of the Plugin follows along the common steps:
- Add the script tag to your html:
<script type="text/javascript" charset="utf-8" src="applicationPreferences.js"/>
- Copy the Java code into your project to the src/com/simonmacdonald/prefs folder.
- Create a preferences file named res/xml/preferences.xml following the Android specification.
- Finally you'll need to create a class that extends PreferenceActivity in order to be able to view/modify the preferences using the native GUI. Refer back to the tutorial I mentioned for more details.
Oh, and I'm pretty sure that Darren McEntee has already included this plugin in his Live Football on TV app which means this plugin is already in the wild.
Enjoy!
Friday, June 1, 2012
Books I've Read this Week
Okay, it's been a long time since I've done one of these. You take a couple of week break while on vacation and then the next thing you it is 2 months later.
The Night Circus by Erin Morgenstern is a rocking good story which conjures up remembrances of Ray Bradbury stories I'd previously read. The novel centres around a contest between two young magicians named Celia and Marco. It is a very imaginative little romp as the two magicians compete against each other while falling in love. |
Subscribe to:
Posts (Atom)