Some thought provoking one-liners

Ran across a few good philosophical one liners that run deep

You can tell the size of the man, by the size of things that bother him


Go with the decision that will make a good story


Find your passion and figure out how to get paid for it


Bad things happen, its your job to overcome


If you are the smartest person in the room, you are in the wrong room


Luck favours the prepared


No one is on their death bead wishing they spent more time working. Spend time wisely



Apache error logs on OSX Mavericks

So, if you are wondering why one of your php based application silently dies; its best to look at the apache error logs on OSX.

On Mavericks the last few lines of the error log can be viewed by using this command

tail -f /private/var/log/apache2/error_log

“tail” means that it will display the logs trailing at the end of the error log.

Press control + c to exit

Hope this helps someone.

Android Campaign/Referral Tracking with Cordova / Phonegap

I have been wrestling around for a while to get Campaign Tracking working for our games and apps. Since most of our apps are not built using native technology, we were finding it extremely difficult to access data passed to our app via the INSTALL_REFERRER broadcast receiver. Finally, with a few hacks and a lot of disappointments, we have a work around to the problem for projects built using cordova / phonegap.

Before, i start explaining how to get it going, there are a few things that you guys should be prepared with:

  1. You need to have cordova / phonegap installed with CLI (command line interface)
  2. You need ADT / Eclipse configured with latest Android SDK (i used version 19)


Very quickly, let me explain what i have done and get back to my project.

Here are a list of things you should do:

  1. Create a cordova project in a directory
    cordova create PROJECT_NAME
  2. Add android platform
    cordova platform add android
  3. Open/Import the android project in ADT/Eclipse – the android project can be found within (your_project_folder/platforms/android)


Once you have imported the project in ADT, you need to do the following:

1. Create a custom BroadcastReceiver to accept the INSTALL_REFERRER intent + context

public class CustomBroadcastReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Log.d(D_TAG, "## CustomReceiver onReceive (context, intent)");
try {
Log.d(D_TAG, "## intent " + intent.toString());
Log.d(D_TAG, "## referrer " + intent.getStringExtra("referrer"));
"## intent.getStringExtra('referrer') "
+ intent.getStringExtra("referrer"));
String referrer = intent.getStringExtra("referrer");
} catch (Exception e) {

The doPost method, posts the referrer string to a web server to be tracked.

2. Add this custom broadcast receiver to AndroidManifest.xml

<receiver android:name="" android:exported="true">
        <action android:name="" />

This will tell the android operating system to call CustomBroadcastReceiver when the INSTALL_REFERRER intent is broadcasted.

This is all that was required. To test this solution, we need to follow the method explained by google in the link below:
Testing Google Play Campaign Measurement

Make sure, you have an emulator running or an android device connected to your computer.

From the command prompt, you need to send a modified broadcast request to the device. Make sure while doing this, the app is not open (but should be installed on the device/emulator).

Original shell command:

shell am broadcast -a -n --es "referrer" "utm_source=testSource&utm_medium=testMedium&utm_term=testTerm&utm_content=testContent&utm_campaign=testCampaign"

What you need to do

shell am broadcast -a -n --es "referrer" "referrer=testReferrer"

If you have followed all instructions to the T – then you should get the referrer value in your logcat.


For some reason, i am unable to get the whole string passed to the broadcast receiver but only a single parameter “referrer”; this problem is also observed in the GA Campaign Tracker SDK. If anyone is able to figure this out, or the reason behind this, please let me know. This could be a problem with the adb shell command only sharing one parameter with the broadcast intent instead of the whole parameter string. Or alternatively, it could be something to do with google play being updated to latest version 3.xx

Hope this helps.