Sunday, November 7, 2010

Android App Development Hard to Beat

I gotta say, Google Android is going to blow the iPhone and iOS away.

Now, I don't say this because I think Android phones or the Android user experience are necessarily better. In fact, with respect to the user experience, I think quite the opposite.  I switched from an iPhone to a Samsung Captivate (Android 2.1) and I'd have to say that the user experience was hands-down better on the iPhone. The ease of use and slickness in terms of the way applications were integrated on the iPhone was far superior. Now, a techie like me can tweak Android out to make it pretty nice too, but someone like my wife - forget it! She got my iPhone 3G as a hand-me-down, and it will be more phone that she needs.

Still, I think Android will dominate the market space. A big reason I believe this is the Android SDK - and I'll explain why in a couple of paragraphs - but first, some background:

If you know me well, you're probably aware that I go all-out with the lights at Christmas, including wearing a Light Suit to events like the Trail of Lights fun run and the Capitol Tree lighting. My home lights are already synchronized to sound an music, but this year, I wanted synchronized lights on my light suit too. You can follow my endeavors in more detail on my other blog, AustinLightGuy.wordpress.com. I had already written a custom light sequence application for my home lights, in which I can compose and run complex sequences in time with music, but those take a lot of time to compose. I wanted a more diverse play list for the light suit, so I also wrote a visualization plugin for Windows Media Player which uses the WMP-supplied frequency info to drive light channels more or less to the beat. The plugin results are not as impressive in terms of patterns timed perfectly to the music, but I don't have to spend time composing sequences. Both can run on a small laptop in a backpack or whatever.

I sort of want the best of both worlds when I go out with this contraption - I want to be able to play lots of songs through WMP, but I also want to be able to play the well-choreographed sequences for maximum impact from time to time. I had already developed the Sequencer, which I wrote in C#, to incorporate the ability to launch sequences from external apps via remoting. That made it really easy for me to throw together another little Windows app that has an embedded Windows Media Player ActiveX control which can play a playlist and also supports the visualization. The app can also submit sequences to the sequencer via remoting. I incorporated some simple RESTful services using System.Net.HttpListener (kudos to Microsoft for making that really easy too, by the way) and Presto! - a RESTful HTTP service that can play MP3's or sequencer sequences. I was basically done - I can network my phone to the laptop via AdHoc wifi, hit a simple control page, and play either way...but...  My buddy Richard was telling me how easy it was to write Android apps, so I thought I'd take a quick stab at writing a simple native app that hits the same RESTful services.

So here at last is my point.  It is really easy for a Java developer to write Android apps.  Google's developer docs are quite thorough and the SDK includes plenty of samples. The SDK is available for the PC, Mac and Linux. You want to develop an iPhone app? You'd better have a Mac. It also includes an emulator, a plugin for Eclipse (which can debug code running in the emulator), and you can sign and deploy apps right to your phone.  But more importantly, you write your app in Java. UI layout is nicely separated in XML layout files and you interact with it using a pretty basic object model and a simple GUI event mechanism. Everything else is just basic Java and, of course, it's open - no going through iTunes, no waiting on approval from Apple, no OS secrets - just write and deploy.

Code Sample
To talk to my RESTful services, I just use standard Java coding incorporating standard JDK functionality in the java.net package. If you've done any Development using Google's GWT UI toolkit, you'll find the event model quite familiar...probably not too different from Swing development either, although I've really only barely dabbled in that.
Screen Shot of Sequence Control App

So my point is this; there are millions of Java developers out here.  Seriously - about 10 million. By making the barrier to entry for this huge population of developers to write apps for Android very low, Google has, in my opinion, ensured that Android will be the first choice for developers wanting to target a mobile platform. Sure, if they want saturation, they'll do both, but they'll still develop for Android first (a lot of them may just stop there or run out of venture funds :-). And some percentage of those 10 million who, like me, just want to write a cool mobile app won't bother with the iPhone.  By making it super easy for a huge developer community to write apps for Android, Google has effectively ensured that more apps will be written for Android.

Six months ago, I heard in the news that Android phones have passed iPhone in market share. It was just about three years ago today that Google announced Android - several months and a couple of years of R&D behind Apple - and yet the platform is already winning. This seems phenomenal to me, but is no longer surprising.  Sure, it has a lot to do with the fact that a lot of vendors are producing smart phones that compete with the iPhone, but that's kind of the point. These vendors have chosen Android. They've chosen it because it's a robust smartphone OS. There are various hardware discriminators; slide-out keyboards, bigger screens  (I like the big, bright AMOLED screen on the Captivate).  But those features are really kind of a wash. Vendors will be leapfrogging each other hardware-wise from now to eternity. But the big discriminator is Apps. More apps = more users = more phones and Google has guaranteed there will be more Android apps. Just you watch!

CatGenie Rocks!

This entry was copied from the original after Google sucked up Blogspot and disconnected my login from my blog...

(Originally posted in July 2009)


Well, sure enough - my contributions have been sad and enemic(actual, non-existent) since starting this blog, but I'm going to make another go at it.

Although this post has nothing to do with my professional software endeavors, it does involve technology.

I want to relate my satisfaction with a recent purchase, the CatGenieself-cleaning litter box (http://www.catgenie.com/).

We recently go a second cat, resulting in a change in the litter dynamics. Now you first need to understand that:

(1) In our household, the duty of cleaning the litter box falls on me.
and
(2) The only/best place for the litter box is in our Master Batch.

With just our first cat (Asia) - who is rather petite, and therefore does not produce a lot of, shall we say, solid waste - this was not anoverwhelming chore. The litter box needed to be cleaned maybe twice a week and Asia is quite delicate and tidy. Our new cat, El Diablo Rubio(The Blond Devil), is the opposite. He eats a lot, produces a lot of "waste", and runs, jumps, and trounces all over the place. It also turns out that, when we initially got him, he had some kind of digestional bug which resulted in frequent, loose stools. A dirty litter box led to himpreferring to go on the shower floor or even our bed!

Litter box maintenance became a daily chore. This was unacceptable.

Sooo... I decided to automate. I first tried the PetSafe Simply Clean™ box (available at the Petco, or PetSafe website). This unit is essentially a rotating basin which moves so slow it doesn't freak out the cat, and a sort of a conveyor that moves clumped waste into an enclosed hopper. Although elegant in it's simplicity, this box didn't work out so well - it had a tendency to break apart Rubio's loose waste into a gillion little fragments that stank and mucked up the conveyor, rather than conveying it to the hopper. In retrospect, this was probably more a factor of his digestion problems (which have cleared up), but still - that's a situation that is going to exist and is something the box needs to be able to cope with.

So, rather than giving in, I decided to throw more money at the problem. We blew another $350 or so on the CatGenie. This box, though a lot more expensive, is pretty sophisticated. First, you hook it up to the water supply (fittings are included to T-in to your toilet or other water supply) and a discharge tube hooks over the toilet rim and can be fed into, say, your washer discharge. On demand, or at pre-determined intervals, it runs through a cycle where it scopes out solids, fills the basin with water mixed with "SaniSolution", then drains and flushes it all out. The cleaning cycle repeats a few (3) times, then it essentially blow-drys the litter. (see a video here)

This thing is awesome!

Now, it took some effort to train the cats to use it (training tips are included), and we have to run it frequently to keep it clean enough to prevent the cats for looking for "alternative locations", but once we worked through these issues, I found myself in the much better situation of never cleaning the litter box!

So, you've probably realized the caveat by now...you have to buy special litter and consumable SaniSolution cartridges, which aren't cheap, on an ongoing basis. Hmm.. not seeming like quite as great of a deal (although, in my opinion, still worth it :-) The special litter granulesare only gradually depleted, but the SaniSolution cartridges cost about $15 a pop. Each cartridge has a chip in it which keeps track of how many "doses" of SaniSolution have been consumed. Each one is good for 60 washings, which if you use the maximum frequency of four times per day, lasts a couple of weeks.

HOWEVER, this is where The Technophile goes to work. Turns out, these suckers have already been hacked. There are Instructables for refilling the cartridges and resetting the chip. I bought a pre-assembled interface kit on ebay, which worked almost flawlessly (more on this shortly). The kit includes a syringe for putting new cleaner into the cartridge, and a serial-attached interface and related programming software for resetting the chip.

Two minor issues I ran into:

You have to be careful with your choice of cleaning solutions you use. I didn't want to use Simple Green, as suggested in the Instructable, since it is jsut a surfactant, not a disinfectant. Also, concentratedsurfactants aren't great for the environment. I first tried some watered-down Clorox toilet bowl cleaner (I know, Clorox ain't great for the environment either, but cat crap ain't great for my sanity, so too bad). This stuff reacted with the small amount of SaniSolution left in thecartridge and produced some chlorine gas. Probably, this could have been avoided by flushing the empty cartridge first. The instructions that came with the programmer suggest Formula 409, which I am trying out now and seem not to react.

The other issue was that the DOS batch file, GenieConnect.bat, installed by the software installer seems to be flawed. It seems to use the "find" command to scan a dump file of the data read from the chip for certain strings (much like unix 'grep'). I didn't really even know that 'find' existed, but on my Windows XP system, it didn't behave right. maybe the syntax has changed since he made the script or something, but I wound up replacing all occurrences of 'find /c' with 'findstr' and that seems to have fixed it. You can also use the PonyProg executable manually, load the script via the menu, and manually write to the chip - you just have to kind of know what you're doing a little more.

Anyway, I give the CatGenie two thumbs up and am (almost) completely happy with it. The one remaining issue I have gives me something else to hack, though! Basically, the interval timer works on a fixed interval. So, for example, if you set it to run four times a day, it runs every 6 hours. Period. Including in the dead of night. When we're trying to sleep. 'Nuff said.

I've already got a bunch of Insteon home automation devices in my house, so my plan is to tap into the manual run button, probably with aContact Closure module, then program it to run a specific times morerelevant to our cat's digestion schedules. Actually, I may use a hybrid approach - leaving it on a twice-per-day schedule, but adding another cycle in both the morning and evening via Insteon control, or something along those lines. That way, if there's an Insteon hiccup, it still runs a couple times a day. Anyway, I'll like post specifics of that hack here before long, so check back if you're interested!

Welcome

This entry was copied from the original after Google sucked up Blogspot and disconnected my login from my blog...


(Originally posted in 2009)


Well, I finally broke down and I'm going to take a stab at this whole blogging thing.

Until recently, blogging wasn't really something I'd considered. In terms of technical trends, although I'm probably as aware of them as you're average technical geek - and certainly more so that your average consumer, when it comes to adoption I tend to stick to the 'knee of the curve'. I think this is a good place to be in terms of adopting technology in general. As interesting as the bleeding edge can be it is, as many smart people before me have pointed out, a good place to get cut. My attitude is, if I can wait for a more mature product/device/service/framework/whatever without suffering any negative effects by waiting, then I will. This invariably results in a much more cost-effective investment in terms of time, money, or effort. I'd recommend that everyone follow this course, but if they did, the knee would never come. We need mad scientists, hackers, dabblers, visionaries, and people with to much time on their hands to push the bleeding edge out and chase the bugs and monsters out of newly claimed territory.

Anyway, blogging is a technical trend that I've certainly benefited from but, like online social haven't had a compelling reason to jump on board with personally. If you're a technophile like me, you've have certainly benefited from other bloggers as I have. Probably half the valuable hits I find when googling for technical information winds up being on some dude's blog. My attitude regarding blogging has changed from thinking of it as either a dalliance or an activity practiced by more seasoned writers to thinking of it much more as a social collaboration tool.

So why jump in? Well, the way I see it, social collaboration works better the more people participate. Not that long ago, there weren't that many people blogging and all the useful online info in terms of software development was coming from more formal online documentation or message boards. So I figure, hey, I've benefited many times from some geeks blog, why not join them.

So...my intent is to post articles about tough technical problems I work through, as well as some that maybe aren't so tough, but lack a predominance of information on the web. Also, I'll probably babble on about cool stuff I've encountered, or others geeky things. We'll see if I stick with it. The reality is, it takes time to type this stuff up, and I often have things I'd rather spend that time on. Then again, I work through challenging development issues all the freakin' time...so why not "give back" some sage advice from time to time? Also, I readily admit, my memory just ain't what it used to be, so I figure it can serve as a useful personal archive.

Happy reading,

Andrew (Andy) Coulson
Software Developer, Consultant, and Technophile