Saturday, August 31, 2013

Git

Learning git, finally.  I've been using TFS and things like it (subversion) for a number of years now.  When it comes to source control and builds, I'm definitely a believer in the critical importance of them.  On the current contract job I'm doing, they told me they couldn't get me a TFS build for my project on their build server, because of blah blah.  To me, that's like asking a pilot to fly without all his instruments being functional.  You wouldn't do it, it's a safety violation.  So I had to turn my own workstation into a build server using TeamCity (free).

Anyway, I'm getting my new project, AR, all framed out and setup on github.  And I have to say, there is a bit of a learning curve.  But I'm plugging away at it. It's important to me that the source code that's in source control always builds and has its unit tests all green and happy.  Yeah, I'm kinda anal like that.

So I did some coding on AR this morning. This OCR library that I found, tesseract (http://gaut.am/making-an-ocr-android-app-using-tesseract/), was a little more unwieldy than I had hoped.  I'm spoiled by all the free libraries that I can add from NuGet in a couple of keystrokes.  For this OCR lib, I had to download the open source from GitHub, and then get CygWin  and the Android NDK, and actually get it to build.  Then I had to import the module into my Android project in IntelliJ.  I really wanted to just reference a jar file, but I ended up checking all this code in to source once I got it building and working.

So doing OCR is apparently very processor intensive.  It probably makes sense to farm the work out to a server somewhere, but I'm doing it right on the phone.  My big stride I made this morning was putting that work into an IntentService and getting it off the GUI thread.  Yea!

After that, I decided to see if my source base was actually valid.  So I downloaded the code from GitHub to a different location on my machine and built and ran.  It built and ran.  It also crashed when I ran it.  So I used Beyond Compare to compare the folders of my working version versus my freshly checked out version, and I found some libs folder under this tesseract OCR library that I hadn't checked in.  The .gitignore file screened out the folder.  Apparently this native android code business does some runtime linking or something.

So that's the update.  It's going a little slow but I'm moving forward.

Welcome

I've recently embarked on writing my second Android app.  My first one, Tapster, was kind of a novelty app that was built to entertain me and my colleagues while working at PerTrac.

This new app, working title ActionReaction, came about as a means of scratching my own itch.  I use William Hill sportsbook on my phone (http://www.williamhill.us/).  It is legal in Nevada, where I live.  Anyway, I spray around a bunch of little bets, mostly on football, as a means of entertaining myself.  Well, the app is good for getting your bet in, but not good for much more than that.  So I'm writing an app that will help me track and follow bets, hopefully with some real time updates when scores change and so forth.

So, with that being said, I started writing the app this week.  The basic toolchain is:


  1. IDE:  IntelliJ IDEA 12
  2. Android Platform:  4.2.2
Some risks:
  1. If I move out of the state of Nevada, I can't use the app and the project is basically dead
  2. I probably can't put it on the Google Play store, as they frown on gambling.  You currently have to download the William Hill app from their site, you can't get it on Google Play store.  This sucks because it cuts of a big distribution channel.
With that being said, it's still fun to write apps that have a purpose, rather than contrived ones that you're not really passionate about.  So I'm going for it.

One of the things I needed was OCR (Optical Character Recognition).  After placing a bet in the William Hill app, the best you can get for a summary is a screenshot.  They give you no email, no copy past ability, nothing.  So the best workflow I could come up with is to screenshot the summary screen, and then share the picture with my application. 

Through the use of Intents, my application (I'll use the abbreviation AR for my app) will take the image and parse the text out of it. Then I'll have to model the domain and turn this information into tickets,or bets, with types (parlay, straight bet, etc).  At this point, I'm thinking of calling into some web based API to get scores or live updates, so that I can notify the user that some action is happening in his game(s).

I'll try to keep this blog updated as much as possible and chronicle my efforts as I go.  Stay tuned!