David Chandler's Journal of Java Web and Mobile Development

  • David M. Chandler

    Web app developer since 1994 and Google Cloud Platform Instructor now residing in Colorado. Besides tech, I enjoy landscape photography and share my work at ColoradoPhoto.gallery.

  • Subscribe

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 228 other followers

  • Sleepless Nights…

    March 2020
    S M T W T F S
  • Blog Stats

    • 1,010,175 hits

GWT, App Engine, maven, and… IntelliJ!

Posted by David Chandler on June 5, 2014

I’ve been putting off migrating to Android Studio for a while now because I’m frankly loathe to learn a new IDE. I’ve used Eclipse for a decade and grew to become very productive in it. But a completely different team at Google may have just well forced me into it.

When I joined the GWT Developer Relations team in 2010, I worked closely with the Google Plugin for Eclipse team to get maven support into GPE. With their excellent work, we eventually achieved the holy grail: you could import a POM containing maven-gae-plugin and gwt-maven-plugin into Eclipse and all the GWT + GAE stuff from GPE like launching dev mode would just work (well, if you had the right supporting plugins like m2e-wtp). So the other day, I picked up a POM that worked in those days and tried it out on Kepler + GPE + m2e-wtp. Amazingly enough, the GWT stuff still works. Google now supports its own appengine-maven-plugin, so I swapped out the old GAE plugin for the new. It’s supposed to work with GPE and WTP, but so far no dice. It will be great when they get the kinks worked out. Funny thing is, I remember seeing exactly the same problem with GAE-maven integration way back in my GWT days. Only then, I could just walk over to Rajeev’s desk and he would fix it 🙂

In the mean time, imagine my surprise to discover that I could just import the POM into IntelliJ (full edition) and everything works. The maven project imported, I can launch GWT dev mode, set breakpoints and debug, etc. It’s funny to me that JetBrains can keep up to date with Google App Engine better than the GPE team, but that’s how big companies move sometimes….

So I’m off to learning new keyboard shortcuts (I could use the Eclipse keymap, but I had customized Eclipse, too. It’s easier than I thought to learn new tricks). And I have to say, the performance of IntelliJ is impressive. A couple of my teammates way back at Intuit will no doubt be glad to hear that I finally came around to maven + IntelliJ, not to mention some of my Android DevRel mates. We’ll see how this goes, but so far, I’m impressed.


Posted in AppEngine, Eclipse, Google Web Toolkit | 1 Comment »

Android Camp in the Rockies

Posted by David Chandler on April 29, 2014

Photo of Android green robot in RMNP

Join me in the Rockies Aug 25-29

Calling all mountain lovers who’ve been thinking about learning Android development…

Ever feel like you’re just a bit too ADD to spend all week in a nondescript classroom and pay big bucks to stay in a downtown hotel where there’s not much to do? Does your brain hurt after working exercise after tedious exercise using courseware that adds little value over the API docs? Do you gain weight eating on the expense account without much exercise?

Me too. Besides these problems, in my past training experience I’ve found that many students find it difficult to maintain concentrated technical attention 8 hours at a time (yeah, it happens in the workplace, too). For myself, I find that I frequently want take a walk, preferably somewhere more refreshing than the parking lot or around the downtown block.

So I started looking around for venues in more refreshing places. I thought of Denver, Boulder, and Colorado Springs (see the pattern?). But then I realized that as long as my mind would still be in the mountains, I might as well put my body there, too.

So this is a bit of an experiment. I’m offering a 5-day Android bootcamp with lodging and meals included in one of the most refreshing spots on earth, YMCA of the Rockies Estes Park Center. We have about 3 solid days of material, so we can cover it in 3, 4, or 5 days, and work around the weather for hiking. In the evenings, you can head into the bustling town of Estes Park or hang out in the meeting room to work on an app project with others in the group. We’ll have some special activities, too, like a BBQ or ice cream social. Because most schools in the US now start in early Aug, the last two weeks see a thinning out of the crowds. Which makes it a great time to visit RMNP, especially if you want to access the high trails free of snow.

Over the five days, we will learn the basics of Android development with an emphasis on enterprise apps. If you finish with a lab early or need a short break, you can play mini-golf or go elk-spotting in the woods at the center. During longer breaks, you can grab a buddy and go for a hike in Rocky Mountain National Park. I know the trails quite well and look forward to sharing them with you if you’re so inclined. If you’re really nice, I’ll talk you to the spot where I took the photo above. Bring your tripod for HDR 🙂

For further description, syllabus, cost, etc., see the full event listing on EventBrite below.

See you in Colorado!

Eventbrite - Android Bootcamp in the Rockies Aug 18-22

Posted in Uncategorized | Leave a Comment »

Ruh-roh, I think my brain is re-wiring

Posted by David Chandler on April 26, 2014

Spanish is starting to sound natural to me. This is very, very good news. But English… I can hardly spit this out: I’ve been making spelling mistakes. With increasing frequency, Gmail or Google Docs has put a red squiggly under a word after I’ve moved on the next one. At first I questioned why the spellchecker didn’t have certain words in the dictionary. But as it’s kept happening, I’m afraid there might be a better explanation. Spelling mistakes are very much a new thing for me (go ahead and laugh–please remember that I was very disappointed when I came runner up in the 3rd or 4th grade spelling bee). The other night, it took me until the next morning to remember the instinctive spelling of “legitimate.” For a long time, I sat staring at the red squiggly. I tried all kinds of things that didn’t make the squiggly go away and only the next day while I was walking downtown or maybe sitting in the kitchen, the word suddenly sort of appeared in my brain and it was obvious again.

Spelling isn’t all that’s wrong, however. I routinely find, upon re-reading what I’ve written, that left a word out or put in one the wrong order. This is very troubling! I have rarely needed to double-check my writing for grammar and spelling mistakes. No the purpose of revision is to smooth any rough edges [ok, this is getting ridiculous–the errors in the second sentence were for fun, but I really did forget the comma after “No” just now]. There are two possible explanations for this phenomenon. One is that I’m getting old. Of course, I know better than that. The second is that as I learn Spanish, my brain is somehow re-wiring. If that truly is the case, then I am left in complete awe of the Creator of the human mind. The capacity for learning our first language is a miracle, especially when you consider that two year olds do it. But the capacity to learn a second language at age 43, well… it blows my mind.

Posted in Uncategorized | 4 Comments »

storm-gen has moved

Posted by David Chandler on March 20, 2014

In order to more easily support pull requests, I’ve moved storm-gen, the annotation-based open source ORM for Android SQLite, to Github. You can now find it here:


I’ve migrated all open issues to the Github tracker and, following six months of language school in Peru, have recently resumed work on the framework. Thanks to Alex G, we’re about to add support for maven, gradle, and Android Studio. I’m also adding more operators and the long-awaited .order() method to FilterBuilder.

Also, there is now a G+ community for feature discussion and a StackOverflow tag.


Posted in Uncategorized | Leave a Comment »

Open for business in Peru

Posted by David Chandler on February 18, 2014

This is my last week in language school (at least until I need a refresher course) and with it come some big changes. My family has settled in to life in Arequipa, at least to the extent that can be expected after five months in a foreign country speaking a new language. I have received my work visa and have started a Peruvian company to focus on training / consulting for software developers.

My first client / partner is Lima-based Tekton Labs, which has hired me to provide technical training and architectural guidance to the cloud and mobile development teams. I am looking forward to working with the team for several reasons:

  1. Tekton has a talented team and strongly believes in personal development. This is very important because, while there are a few good computer science programs in the country, there is no substitute for continuing education in our field.
  2. The company has a mature, agile software development process (Scrum), which in my view is a prerequisite for taking on large projects.
  3. Tekton has a sizable portfolio of work for large enterprises, but still offers significantly lower prices than US-based companies.

In the US, some of the most coveted jobs in programming are with Internet and software companies. In Peru, on the other hand, they are in finance and telecommunications because they typically pay the best ($500 – $2,000 / mo. + benefits). Unfortunately, this means there are few cloud and mobile jobs here; however, there ARE talented developers with the necessary training as well as self-taught hackers just like in the US. My aim is to help provide further training for these developers and to connect them with US-based companies like startups who may have great ideas, but can’t afford US-based labor. Over the next year or two, I’ll keep you posted on how it’s going. In the mean time, if you have an idea which might be a fit for a Peruvian development team, ping me on G+ and let’s talk.

Posted in Business of Software | 4 Comments »

A long pause

Posted by David Chandler on October 21, 2013

IMG_5806_DxOHello faithful readers! I apologize for my long absence on these pages. I have not fallen off the edge of cyberspace, just below the equator. In the preceding months, my family has sold most of our earthly possessions (save the small electronic ones :-)) and moved to Peru. We are currently attending language school in fulfillment of a lifetime goal to become fluent in Spanish. I am currently on unpaid leave with status to be determined after language school. Until then, I have precious little time for coding, but hope to squeeze in some work on storm-gen shortly and to continue writing about Android, App Engine, GWT, and other topics as time permits.

At some point, I’d also like to write more about how technology has facilitated our move, but suffice it to say that a scanner, Google Drive, Google Play Books, the Kindle app, and a host of phones and tablets make possible a near weightless existence, which is extremely helpful when conducting an international move. Thankfully, Internet connectivity (both mobile and fixed) is quite good in the major cities of Peru, so our “everything in the cloud” strategy has worked well thus far, although my wife doesn’t think the kitchen made the move very well in the cloud.

Posted in Uncategorized | 6 Comments »

Android + Cloud with Mobile Backend Starter

Posted by David Chandler on May 21, 2013

The Google Cloud Solutions team has made it easier than ever to create a cloud backend for your Android application. Brad Abrams and I presented it last week at Google I/O, and Brad has published a gigantic step-by-step blog post with copious screenshots on how we built our sample app, Geek Serendipity. Here’s all the related content in one handy list:

Posted in Android, AppEngine | 8 Comments »

Android demo tips: behind the scenes at Google I/O

Posted by David Chandler on May 20, 2013

Last week at Google I/O, Brad Abrams and I decided to go for the gold and give a talk on building a cloud backend for your Android app, complete with live coding on stage. For a more interesting example, we chose to build a sample app which relies on location services and Google Cloud Messaging. It all seemed like a good idea at the time. For the benefit of other Android presenters, I wanted to give a behind-the-scenes view of how we overcame some significant challenges to pull off the demos. Also, I will explain the anomalies we saw.

Device display. The easiest way to show an app is using an emulator, but Maps V2 API is part of Google Play Services, which doesn’t currently run on the Android emulator, so we needed physical devices. Droid@Screen works, but it updates slowly and requires the USB cable, which we needed for hardwired Ethernet. Some devices support HDMI out (Galaxy Nexus, N10) which can be used with a BlackMagic or similar HDMI capture box to show the device display on your Mac screen. Note that this requires a Mac with two Thunderbolt ports (hello Retina! BlackMagic in, Mac display adapter out). We could not use this because the phone’s HDMI connector is shared with the USB connector, which we needed for hardwired Ethernet. Fortunately, we had a Wolfvision projector camera available and a 4-port video switcher to show our Macs or the camera. For best results with a projector, set the phone display brightness to max.

The network. Gather 5000+ geeks in a massive concrete structure, give them all a new wifi device, and then try to get a working Internet connection… Despite Google’s stellar efforts, getting wireless Internet at Moscone Center remains very challenging. 3G / 4G / LTE is inhibited by the concrete and steel, and even 5GHz wifi suffered from RF interference or sheer demand. Thus, we knew in advance that we would need hardwired Internet. This was no problem for our laptops, but we also needed 2 phones for the demos to show continuous queries in action. Fortunately, Galaxy Nexus phones support wired connections using a USB OTG adapter paired with a USB to Ethernet adapter, and it just worked. So far so good.

Deferred launch. Because we were coding live in Eclipse, we deployed the code to the phones in real time via the USB cable. When you run an Android app in Eclipse, the default action is to install and run the app. But this  created a problem for the simple version of our demo app, which needed an Internet connection on launch to send a location update immediately. We had to disconnect the USB cable, walk the phone over to the camera, plug in the hardwired Ethernet, and only then launch the app via the home screen. Fortunately, Eclipse has a way to support this. In the project’s run configuration on the Android tab, simply select “Do nothing” for the launch action. This installs the app, but doesn’t launch it.

Live coding. Speaking of live coding, we have all seen those demos with lots of tedious cut and paste operations from a text file to the IDE. As a presenter, I want something visible in the IDE to prompt me for the fully manually steps as well as an easy way to paste in blocks of code. Eclipse snippets are just the thing. You can show them off to the side of your main editor window, then double-click on a snippet to paste it in. I used snippet titles without code to prompt me for the manual steps. Another challenge of live coding is that you might make a mistake at an early stage of the demo which ruins a later stage. In order to facilitate recovery, we created snapshots of working demo code at six different stages during our presentation. It would have been nice to preinstall these app versions on the devices; however, they all use the same package name and the Android installer doesn’t allow more than one at the same time. Hence the need for adb install and the deferred launch technique. Also we had to uninstall the prior version of the app on the device before each coding stage. Furthermore, Eclipse doesn’t let you create multiple projects with the same name. There is a workaround, but it kind of spoils the magic of our talk and I’ve already spilled enough secrets… let’s just say Eclipse workspaces and “Copy project” are a beautiful thing.

Location services. This is the one that snagged us in the first demo. It turns out that location services are not in fact magic, but require GPS (in Moscone?!) or wifi, which we turned off just before speaking to eliminate the possibility of conflict with the hardwired Ethernet. Fortunately, we were able to get a good enough wifi signal in a later demo to show location. On desktop devices, geolocation works with a hard-wired connection, so I’m not yet sure whether this is a bug or a feature on mobile… it is admittedly an uncommon use case.

The unanticipated. After recovering from the first demo glitch by turning on wifi, I demonstrated that location services worked, but it never sent the location to the server. It turns out the code was working as intended–I had already enabled authentication for my next segment, but the app from the previous segment which I revisited did not have auth turned on. Finally, the last demo showed two markers when it should have showed only one. The second marker turned out be a fellow Googler in the audience who had helped dogfood an early version of the demo app. So once again, the code worked as intended, just not as I intended at the moment. But… this is the stuff live demos are made of. I still prefer live demos with a few glitches to an hour full of slides 🙂

So now you know what Brad and I were busily doing while the other was talking and why talks of this complexity are pretty much impossible without two people and a lot of presentation gear. It was a teeny bit intimidating knowing that our session was part of the Google I/O live stream with thousands of viewers, but in the end, it came off (almost) without glitches and our gracious audience was wowed by the Mobile Backend Starter project. Mission accomplished!

See my next post for a complete list of resources on Mobile Backend Starter.

Posted in Android, Eclipse, Headsmack | 10 Comments »

ProgressDialog considered harmful

Posted by David Chandler on March 26, 2013

Roman Nurik recently wrote a G+ post favoring the use of inline ProgressBar over the pop-up ProgressDialog. Here are some additional reasons to consider.

To be sure, ProgressDialog is very convenient. It has a nice spinner and does its job very simply. You can create one as simply as

ProgressDialog pd = ProgressDialog.show(this, "Please wait", "working...");

The first problem is that by default, there is no way for the user to dismiss a ProgressDialog. A common scenario is to show the ProgressDialog before making a network request. But what happens if the user gives up before the request times out? The back button doesn’t work. The home button works as usual, but if you return to the app, the ProgressDialog is still there. To get rid of it, you have to force close the app.

This is easily remedied by setting an additional property:

ProgressDialog pd = ProgressDialog.show(this, "Please wait", "working...");

However, there is another problem which leads to a lot of confusion for Android or Java newbies. Consider this code which I have inadvertently written myself:

ProgressDialog pd = new ProgressDialog(this);
pd.show(this, "Please wait", "working...");

Like the first example, this will show a ProgressDialog which cannot be dismissed with the back button. Why? Because the show() method used here is a static method which returns a new ProgressDialog. The instance named pd is never shown. The compiler will show a warning that a static method is being invoked in a non-static way so you might get a clue that something is wrong; still, this is a really confusing API with no documentation. If you want to use the ProgressDialog constructor directly (as you must in order to subclass it), you must do this instead:

ProgressDialog pd = new ProgressDialog(this);
pd.setTitle("Please wait");

Note that the no-arg show() method used here is an instance method inherited from the Dialog class. The resulting ProgressDialog may indeed be canceled.

StackOverflow indicates that ProgressDialog has been a headache for more than a few developers.

So, like Roman said, use ProgressBar instead. Or if you don’t, make sure you’re using ProgressDialog in such a way that it can in fact be dismissed.

Posted in Android, Headsmack | Leave a Comment »

Optimizing your mobile Web app

Posted by David Chandler on February 28, 2013

I frequently meet with mobile app developers using WebView who are looking for guidance on performance optimization. Besides going native, which typically provides the very best user experience, here is an assortment of tips and tools you can use to build better mobile Web pages. These are very rough notes from recent meetings with third party developers and folks on the Chrome and Android teams; nevertheless, I hope there are some helpful nuggets here.

Because most Web developer tooling is for mobile browsers, not WebView per se, the best approach is to optimize your Web site running in Android Browser or Chrome for Android. Most improvements you make should carry over to WebView  as it’s also WebKit-based.


  • Chrome Remote Debugging with Chrome for Android
  • WEb INspector REmote targeting the Android Browser. This 3rd party tool works with WebKit-based browsers and has an elements panel and console similar to Chrome Developer Tools.


Chrome Developer Tools has several features which can be used to measure performance.

  • Inspect Element -> Timelines -> Frames -> Record to see how long it takes to construct and render a frame. To avoid dropping frames, keep your render time under 30ms.
  • Hit h on any DOM element to hide it so doesn’t contribute to layout
  • Uncheck any CSS styles to see which ones are expensive (like border-radius + box-shadow)
  • Use timeline to see where slowness is occurring; i.e., don’t jump straight into JS performance as it might be paint time, layout, etc.
  • Inspect Element -> Settings (bottom right corner)
    • Can show frame rates and memory usage in real time. Good for seeing how much certain effects cost on your rendering and how the cost of multiple effects multiplies up.
    • Show FPS frames per second on pages with animation / loops
    • Show paint rectangles to see if you are doing large repaints when not necessary
    • Continuous page refresh setting available to help profile (available in Chrome dev channel)
  • http://dev.chromium.org/developers/how-tos/trace-event-profiling-tool
  • Web Tracing Framework
  • PageSpeed Insights extension
  • http://jankfree.com

Performance tips


  • Chrome for Android Tracing explains the mobile tracing tool and how to understand the tracing results. See how much time spent in V8 to represent JS processing, layouts, etc.
    • Avoid unnecessary image resizing. Serving multiple devices is a challenge.
      • Image decode, resize ~50 ms each on Galaxy Nexus
    • Chrome for Android & Android Browser with fixed viewport doesn’t need fastclick
    • Swiping between pages: ViewPager + multiple WebViews faster than CSS
  • Hardware accelerated transitions
    • Many devs report issues with views flickering when HW acceleration turned on.  Workaround is to have ‘next’ view peek in 1px so that it renders earlier so doesn’t flash
    • Many devs report inconsistent glitches with acceleration turned on (especially when using JS scrolling vs. native)
  • ViewPager
    • Issues with bezel swipe… HW accelerated swipe doesn’t complete (bounces) because first WebView has to render before the next View will handle the swipe event (because the JS is busy doing something else). Only an issue when swiping from the edge.
  • WebView JS interface
    • Single thread used for all JS can be a bottleneck.; e.g., have three WebViews in a ViewPager, each trying to do DOM manipulation. This can cause slowdowns.
  • WebView performance talk from I/O ‘12
  • Best Practices for Web Apps from developer.android.com (see especially links at end)
  • Hybrid approach popular: download content outside the WebView and inject it in, mainly for offline support

If you know of any additional resources that have been helpful to you, please feel free to add them in the comments.

Posted in Android | 1 Comment »

%d bloggers like this: