Current Stories
PermaLink Automating Android OrmLite Configuration Generation w/ Gradle02/17/2014 05:32 PM
OrmLite provides a standard ORM data mapping layer for Android, but if you want to avoid the performance hit from reflections (it uses annotations), you have to run a generator to make a configuration file that can be loaded at runtime.  Unfortunately, there haven't been any examples of how to do this and the OrmLite documention just mentions it's Advanced usage :-P

The reflection garbage collection issue causing most of this slowness has been fixed as of Android 4.1, but generating the config at compile time will still help your application startup time.  Thankfully, we can do this easily w/ Gradle.


PermaLink Eclipse Importing Android Libraries as Gradle Projects12/12/2013 04:20 PM
If you ever have problems importing an Android library into Eclipse because Eclipse keeps importing the library as Gradle project (not useful for adding to your Android project), be sure the ".gradle" and ".settings" subdirectories are removed from the project before import.  The ".classpath" and ".project" files are also not needed.


PermaLink Surviving MS' "free" Window 8.1 Upgrade and LucidLogix Virtu Conflict11/23/2013
What should have been a simple Windows 8.1 upgrade ended up being a few hours of fiddling w/ Windows to get rid of a boot crash in the igdkmd64.sys (Intel Graphics Kernel Mode Driver).  Uninstalling the Intel HD video driver in Device Manager by booting into Safe Mode got rid of this crash but Windows then booted up into a blank screen that you couldn't do anything with.

But to get into Safe Mode, you have to boot off a Windows 8 install disk, or to get the old F8 key on boot functionality back, you have to boot into a Windows 8 install disk and execute:
  bcdedit /set {default} bootmenupolicy legacy
But in Safe Mode, you can no longer uninstall programs unless you install SafeMSI.

It's best that you do these two steps before you install the Windows 8.1 update.  It's also a good idea to grab the latest Windows 8.1 drivers for your motherboard so you can install them after you install Windows 8.1.  Uninstall LucidLogix Virtu and the Intel HD drivers before you do the update and you should be able to avoid this pain :-P

And after the update, the Windows and Program Files directories become uncompressed.  If you still want to compress them to save space, boot off a rescue CD/USB boot setup and recompress everything with "compact /s /c /a /i *"

If you're using VirtualBox with a bridged adapter, you'll also have to uninstall/reinstall it or it won't be able to find your system's network adapter to bridge to.  Doing a repair on the installation does not work.


PermaLink Gradle Dynamic Dependencies Also Use Ivy Syntax10/05/2013
Most build.gradle dependencies I've seen specify them using the standard "+" Gradle syntax:
  compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.+'
But if you use the maven-plugin that can generate pom.xml files and upload your project to a Maven repository, this breaks Maven builds because the "1.7.+" is not Maven syntax.  You can use this instead:
  compile "org.slf4j:slf4j-api:[1.7,1.8)"
This mathematical set range notation does effectively the same thing.  It includes all 1.7 versions but stops at 1.8.  If you wanted it to include any version above 1.7 (including 2.0, etc.), you'd specify:
  compile "org.slf4j:slf4j-api:[1.7,)"
There's a bit more info on the Maven/Ivy dynamic version syntax on Maestro's blog.


PermaLink Adding Google/Facebook/LinkedIn OAuth Support to DropWizard09/15/2013
DropWizard is a nice lightweight ops-friendly (provides health metrics) one-fat-jar (not a WAR file because it embeds jetty so it doesn't require a Java app server) Java REST web service framework that provides Basic authentication and OAuth (same server) authentication for your web services, but it doesn't provide 3rd-party OAuth authentication (e.g., logging in via your Facebook or Google+ ID).  OAuth authentication requires that you write your own OAuthProvider which isn't documented very well in the manual (where it says "Because OAuth2 is not finalized, this implementation may change in the future"), though there is one limited functionality sample of doing it.

As an alternative, there is a DropWizard example that supports OpenID, but OpenID isn't as flexible as the OAuth APIs.  OpenID primarily provides login/authentication.  OAuth on the other hand, also provides authorization for more rich APIs (e.g., Facebook's Opengraph and Google G+, where you can access a users contacts, albums, post to feed, etc. which is just as important as authentication in applications today), and can provide login/authentication if you add the email scope to your OAuth request (unless you're using Twitter for your authentication in which case you can't get the user's email address so it can't be used as an authentication source effectively).  To confuse matters more, Google also support OpenID, but if you're planning to use your backend for Android authentication, you'll have to use OAuth; you don't want to be migrating users after choosing OpenID by mistake like Player.FM did.


PermaLink Quirks w/ Sencha Touch Hybrid App Development on BB10 w/ Sencha Architect08/25/2013
I've always been curious about how well Sencha Touch works on mobile devices (I found jQuery Mobile to be sluggish when its swiping code was added to Bootstrap's carousel code), so when Blackberry announced a program to try Sencha Architect and a BB10 device, I signed up for it thinking it'd be easy to port one of my simple Android apps to it.  It turns out quirks in Sencha Architect and the Blackberry packaging tools made it a lot more painful than it needed to be.


PermaLink Building Android native clients for the Meteor.js framework08/03/2013
Today's mobile developers generally fall into the responsive-css-hybrid or native app camps.  On the one hand, the idea of a single web application that runs on the site and on mobile devices sounds great to the decision makers (and generally works for simpler apps).  Unfortunately, if you want the best experience for your mobile users (you generally won't find out about issues in hybrid apps until you're mostly done with it), you may very well need a native application as Facebook found out when they kept trying to use HTML5.

In choosing a web platform for your application's web site and as an endpoint for your mobile applications, one of the checklist items inevitably includes whether it's possible to write a pure native client that will talk to your web stack because decision makers like having insurance.  Meteor.js doesn't have the typical RESTful web service APIs that other web stacks have, though you can run another Node.js instance in parallel to do this with direct access to the database.  To provide the reactivity and realtime data sync that is Meteor.js' real strength, you have to talk to the server via the DDP websocket protocol.  For the two main mobile platforms (iOS and Android) as well as ASP.Net (including Windows Phones), this is now possible.


PermaLink Using Gradle to build Android Library Eclipse projects07/31/2013 10:51 PM
The Gradle build system was one of the most exciting things revealed at Google I/O this year if you're a developer.  The promise of getting rid of Ant/Maven XML config hell was a big juicy apple.  But then you find out that it only works well with Android Studio.  But Android Studio isn't stable or featured enough to use for development (no JUnit test support even).  So you go back to Eclipse and find the Gradle Eclipse plugin which mostly works except you have to invoke Gradle via a menu item.  But this doesn't work with Android Library or with Android App projects because you can't override Eclipse's build system (the main reason Google switched to IntelliJ/AndroidStudio is you can do this w/ IntelliJ).

But you still want to use Gradle and Groovy for your build scripts...


Start Pages
RSS News Feed RSS Comments Feed CoComment Integrated
The BlogRoll
July 2014
Contact Me
About Ken
Full-stack developer (consultant) working with .Net, Java, Android, Javascript (jQuery, Meteor.js, AngularJS), Lotus Domino