Thursday, December 6, 2012

Example code for Twitter OAuth in Android

I’ve shared an example project on github demonstrating how I used ideas borrowed from David Crowley at to get a Twitter OAuth access token without the signpost (or any other) library besides twitter4j, instead using only the Android Web View. The main improvement in the general method being that the the web view activity does all of the work to get the request and access tokens and responds back to the calling activity and the work to get the tokens occurs on a background thread.

This code is stripped down from another project, but it demonstrates the idea. You’ll need to update the, your callback URL and implement the listTweets () method.

Tuesday, December 4, 2012

Irritated by the Twitter app experience on Android

I’ve been working on a custom Twitter app for Android but have become pretty frustrated with the user experience of such apps.

First, the Android via the official Twitter client stores a user’s Twitter account OAuth token in the AccountManager. But this token is actually useless to third-party apps because it is only signed for the “consumer" id/secret pair that is compiled into the official Twitter apk. (Though I could cite examples of folks extracting this key pair.)

So the only way for my custom app to get its own access token for its “consumer" id/secret pair is via the traditional OAuth route by requesting one from Twitter’s servers and having the end user allow the app to have access to their account. The ugliness of this is that it requires leaving the app to visit with the browser app (though, there are work-arounds to place a webview in a dialog). Worse, a user’s mobile browser is not very likely to be already signed in to in the browser, which now requires them to authenticate.

It seems reasonable enough to expect that if a user has added a Twitter account globally in the Android OS that browser visits to would be smart enough to create a single-signon experience with the access token already saved in the phone.

Edit: This sounds exactly how it should work, but unfortunately, it is for iOS 5. Though I don’t see any reason why something special would need to be baked into the OS, the official Twitter client could provide a custom system service.

Tuesday, October 9, 2012

Technology platforms and new experiences

It is amazing how simple innovations like bluetooth headphones creates a new platform that causes me to seek out more content to enjoy the platform. Being wireless decoupled from my phone, I can more pleasantly listen to TED radio whenever I go out on a walk or when I bike commute to work. Having this platform has caused me to seek out and increase the content consumption. The same can be said for being able to control YouTube on my TV with my phone; there is just so much good, free, educational content out there and now there are so many great ways to enjoy it…

Monday, October 8, 2012

Standardized keyboards on standardized tests

There’s really no other way around the requirement to use a standard keyboard on a standardized test such as the GRE or GMAT. This means those that use Dvorak are out of luck. After googling around, one finds a lot of frustration but the only possible solution being a doctor’s note with an accommodation. I just don’t see typing an essay as something that is feasible if one has to stare at the keyboard. That means practice, practice, practice just like the rest of the exam. After a few dozen words, some of the key lines are coming back…

Tuesday, October 2, 2012

Friday, September 28, 2012

Friday, September 21, 2012

Building on multiple platforms with rmake

rmake (rsync make) is a remote build enabler that replicates a build workspace to one or more locations and executes a build life-cycle for each location.

While building remotely incurs a small replication overhead, rsync is incredibly efficient, and the benefits are enormous.

[It] Eliminates the checkin thrashing that comes from trying propagate and test source code changes on multiple platforms through version control

As part of the source tree replication, rmake has the opportunity to filter the file list based on certain policies, and even modify the file attributes as they are copied to the remote location.

Meaningful build version numbers of developer builds

svnversion is good for versioning builds of specific source revisions. However, sometimes, the build is modified or the svn tree is exported. The following is a basic example of creating a meaningful build number in a Makefile:

SVN_VERSION=$(shell x=$$(svnversion); ([ "$$x" != "exported" ] && echo $$x) || echo $$USER.$$(date +"%Y%0m%0d%0k%0M%0S"))

Thursday, September 13, 2012


If you absolutely have to use gnu make and can’t use something else like Boost.Build or you don’t want to invest in the infrastructure for a small project here’s some useful macros:

exec = output=$$($(1) 2>&1) || (ret=$$?; echo -e "$(1)\n$${output}"; exit $$ret);

configure = echo "configure in $(1)"; $(call exec,cd $(1) && ./configure)
make = echo "make in $(1) $(2)"; $(call exec,make -C $(1) $(2))

compile-cxx = echo "compile-c++ $(2) -> $$(basename $(1))"; \
$(call exec,g++ -fPIC -o $(1) -c $(2) -Wall ${INCS} ${CXXFLAGS})

link-shared = echo "link-shared $$(basename $(1))"; \
$(call exec,g++ -fPIC -shared -o $(1) $(2) $(3))

%.o: %.cpp Makefile
@$(call compile-cxx,$@,$<)