The first error is:

Traceback (most recent call last):
  File "C:\foo\foo.py", line 17, in &lt;module&gt;
    diffCounts[ str(getBin(diff)) ] += 1
TypeError: list indices must be integers


Why are you converting an int to a str when a str is needed?  Fix that, then we get:

Traceback (most recent call last):
  File "C:\foo\foo.py", line 17, in &lt;module&gt;
    diffCounts[ getBin(diff) ] += 1
IndexError: list index out of range


because you've only made 5 buckets.  I don't understand your bucketing scheme, but let's make it 50 buckets and see what happens:

6
Traceback (most recent call last):
  File "C:\foo\foo.py", line 21, in &lt;module&gt;
    maxBin = max(maxdiff)
TypeError: 'int' object is not iterable


maxdiff is a single value out of your list of ints, so what is max doing here?  Remove it, now we get:

6
Traceback (most recent call last):
  File "C:\foo\foo.py", line 28, in &lt;module&gt;
    print binStr + '\t' + '\t'.join(map(str, (diffCounts[i])))
TypeError: argument 2 to map() must support iteration


Sure enough, you're using a single value as the second argument to map.  Let's simplify the last two lines from this:

 binStr = '[' + str(lo) + ',' + str(hi) + ')'
 print binStr + '\t' + '\t'.join(map(str, (diffCounts[i])))


to this:

 print "[%f, %f)\t%r" % (lo, hi, diffCounts[i])


Now it prints:

6
[0.000000, 1.000000)    3
[1.000000, 3.000000)    0
[3.000000, 7.000000)    2
[7.000000, 15.000000)   0
[15.000000, 31.000000)  0
[31.000000, 63.000000)  0
[63.000000, 127.000000) 3


I'm not sure what else to do here, since I don't really understand the bucketing you are hoping to use.  It seems to involve binary powers, but isn't making sense to me...

Howto bin series of float values into histogram in Python?
I am basically just experimenting with Android development, and a couple of days ago I came across this app called "Go SMS Pro", which, among other things, can set up notifications in different colors (blue, green, orange, pink and light blue). So, I have tried to do this myself in my own app, however I cannot change neiher the color nor the blinking internal of the LED. I currently use this code:

public class MainActivity extends Activity {
  static final int NOTIFICATION_ID = 1;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Button button = (Button) findViewById(R.id.button);
    button.setOnClickListener(buttonOnClick);
  }

  public OnClickListener buttonOnClick = new OnClickListener() {

    @Override
    public void onClick(View v) {
      String ns = Context.NOTIFICATION_SERVICE;
      NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

      Notification notification = new Notification(R.drawable.icon, "Hello", System.currentTimeMillis());
      notification.flags = Notification.FLAG_SHOW_LIGHTS | Notification.FLAG_AUTO_CANCEL;
      notification.ledARGB = Color.BLUE;
      notification.ledOnMS = 1000;
      notification.ledOffMS = 300;

      Context context = getApplicationContext();
      CharSequence contentTitle = "My notification";
      CharSequence contentText = "Hello World!";
      Intent notificationIntent = new Intent(MainActivity.this, MainActivity.class);
      PendingIntent contentIntent = PendingIntent.getActivity(MainActivity.this, 0, notificationIntent, 0);

      notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

      mNotificationManager.notify(NOTIFICATION_ID, notification);
    }
  };
}


But as I said, it doesn't work the way I want it to; instead it just blinks in regular green with the default delay, and not the one I have set in my code.

Can anyone see what is wrong with my code, or know if I have to do something else to achieve this?
