Saturday, March 30, 2013
Books I've Read This Week
It's been awhile since I've done one of these. I've been away on vacation and didn't get as much reading done as I would have hoped but I'm back on track now.
Monday, March 4, 2013
PhoneGap Bluetooth Plugin Updated
So the Bluetooth plugin was horribly out of date so I took some time to update it to work with PhoneGap 2.2.0 and higher. As well as the usual updates to the JS and Java code I fixed an instance in the "listDevices" call which would block code execution for 10 seconds while it scanned for devices.
Anyway, if you need Bluetooth functionality the plugin provides the following method:
Anyway, if you need Bluetooth functionality the plugin provides the following method:
- listDevices
- isBTEnabled
- enableBT
- disableBT
- pairBT
- unPairBT
- listBoundDevices
- stopDiscovering
- isBound
Enjoy!
Update: Oh by the Hoary Hosts of Hogarth! I should mention that I didn't originate this plugin, I just saw the need for it to be updated. All credit should go the original authors: Daniel Tizón, Idoia Olalde and Iñigo González
Update: Oh by the Hoary Hosts of Hogarth! I should mention that I didn't originate this plugin, I just saw the need for it to be updated. All credit should go the original authors: Daniel Tizón, Idoia Olalde and Iñigo González
Friday, March 1, 2013
Books I've Read This Week
| The Blinding Knife and The Black Prism by Brent Weeks are the first two books in his new trilogy. I previously enjoyed his Night Angel trilogy so I figured I'd start in on this new series of books. While I have not enjoyed it as much as as the Night Angel trilogy is it still a pretty good series. The system of magic that is used is based off of the colours of the rainbow. Each colour is also linked to an emotion so someone "drafting" (using) red magic will feel rage or anger and someone drafting blue magic will feel calm and detached. It is a pretty neat concept that may remind some folks of the time they've spent playing Magic the Gathering. Which is by design as the game shows up in the books as something called 5 Kings. No, I'm not making this up. Brent Weeks admits to this in the afterword of the second book. Anyway, the story itself centers around Gavin Guile who is the top magic user or Prism of the main religious organization in this world. His role is not unlike the Pope of the Catholic church and that is not the only analogy to be drawn between their system of religion and the Catholic church. Anyway, the world is in a bit of dis-array and people are turning away from the church. Now Gavin has to try and hold off full scale war who's roots were seeded 16 years ago when he and is brother fought in "The False Prism's War" to see who would be the true Prism. Well not really, the war was actually started by the brothers fighting over a woman. Typically right? Anyway, good characterization going on in these books and some interesting commentary on our contemporary society going on under the scenes. I thought for awhile there Weeks was going to do something really different with the main character then he backed away from it. Regardless, I'll be picking up the third book in the series when it comes out. As an aside if anyone wants the three books of the Night Angel trilogy get in touch with me and I'll ship them to you as long as it is not prohibitively expensive. |
Thursday, February 28, 2013
What's New in PhoneGap Android 2.5.0
Well PhoneGap Android 2.5.0 is out! There isn't much to get excited about on Android in this release as it is mostly bug fixes. Check out the full list of commits in the CHANGELOG. Fixes include:
However, something I can get excited about is that in the past month we've seen 8 new committers to the Android project. Yup, 8 new coders contributed their time to cordova-android which I think is a great sign of the health of the project.
- Fixing a null pointer exception when the user clicks the back button while the app is starting.
- Enabling the application cache.
- New configuration parameter "disallowOverscroll" to remove that blue glow when you try to scroll past the top/bottom of the screen.
- Enabled geolocation in the InAppBrowser.
However, something I can get excited about is that in the past month we've seen 8 new committers to the Android project. Yup, 8 new coders contributed their time to cordova-android which I think is a great sign of the health of the project.
Monday, February 25, 2013
Friday, February 22, 2013
Books I've Read This Week
Soon enough there will be a new Black Jack Geary novel on the way in The Lost Fleet: Beyond the Frontier: Guardian. |
Hmmm...a bit negative today maybe I'll be more positive next week.
Monday, February 18, 2013
PhoneGap Android XhrFileReader
The FileReader API works great as long as the file you want to read is on the device's file system. However if you want to read a file you've packed in the Android assets folder you would need to use XHR to read the file. I'm providing an interface that follows the same API as the regular FileReader. Of course the XhrFileReader is not limited to only reading files from the assets folder, it can also read files from the file system and over HTTP.
Adding the plugin to your project
To install the plugin, move XhrFileReader.js to your project's www folder and include a reference to it in your html files.
Using the plugin
To instantiate a new reader use the folling code:
Adding the plugin to your project
To install the plugin, move XhrFileReader.js to your project's www folder and include a reference to it in your html files.
Using the plugin
To instantiate a new reader use the folling code:
var reader = cordova.require("cordova/plugin/xhrfilereader");Setup your event handlers:
// called once the reader beginsUnfortunately, you will only get an error on files read over HTTP. When you specify a file:// path the request status is always 0. There is no way to tell between a successful read or an error. So if you specify a file that does not exist like "file:///does.not.exist.txt" you will get an empty evt.target.result in your onloadend handler.
reader.onloadstart = function() {
console.log("load start");
};
// called when the file has been completely read
reader.onloadend = function(evt) {
console.log("File read");
console.log(evt.target.result);
};
// called if the reader encounters an errorProgress events are fired but are not very useful as they don't contain partial results.
reader.onerror = function(error) {
console.log("Error: " + error.code);
};
// called while the file is being readFinally call your read method, for instance:
reader.onprogress = function(evt) {
console.log("progress");
};
reader.readAsText("http://www.google.com"); reader.readAsText("file:///android_asset/www/config.json"); reader.readAsText("file:///sdcard/error.log");and that's about it. Obviously, this plugin is most useful when you need to read a text file from the assets folder.
Subscribe to:
Posts (Atom)

