Why I'm an Employee and Not a Founder

I have been working very closely with the founder of a successful startup [1]. For the sake of this post we’ll call him John. John has the title of CTO but he works in the company as an individual contributor. I have lead the team of engineers that John has contributed to for most of the last year. Being in the position of both leader/coordinator and mentee I have become painstakingly aware of a trait that John embodies, seemingly with his whole soul, that I fail to even register on a scale of any measure in comparison.

Exploring the Worst Case Complexity of Quicksort

The quicksort algorithm has the best case complexity of O(n log n) when each pivot in the sort divides the list into two equal uniform pieces [1]. The worst case occurs when the pivot always divides the list into one list of size 1 and one list of size N - 1. Such as when sorting an already sorted array and the pivot is always chosen as the last element in the list. The complexity of quicksort in this case is an unfortunate O(n2). For this reason, it is recommended to use a random pivot point. This gives an average case of O(n log n) [2]. However, this does not remove the worst case scenario.

For example, consider this array:

array = {44,88,7,2,1,999,1040,23,123,89,2009}

with these given “random” pivots:

You get this result:

   algorithms, quicksort, java, big-o

Login Screen with NgAndroid


With the release of the official Android data binding library NgAndroid has been deprecated.

I really don’t like writing user interface glue code. Enough said about that.


NgAndroid is an effecient compile time annotation processor that generates two data binding and layout controllers for Android MVC. NgAndroid is currently unstable.

The code for a login screen can be found below or here.

   android, ngandroid

NgAndroid Introduction


This tutorial is out of date. See Login Screen with NgAndroid for a tutorial on the lastest version of NgAndroid.


It’s finally here. The Android UI framework has become as simple and powerful as AngularJS. Sort of.

The project ngAndroid (which is still in beta) on Github has done something that some might not think is possible; NgAndroid brings Angular type directives and data-binding to Android xml attributes.

If you don’t know anything about AngularJS then you probably don’t know why this is such an exciting anouncement. You can learn more at Angular’s website but a previous knowledge of AngularJS is not required to revel in the epicness that is about to be laid before your eyes.

   android, angular

Creating a striped view in Android

Have you ever said to yourself, ‘Wow, this view needs some stripes, but there is no android:stripes=“true” attribute and I don’t know how to draw stripes using the canvas’? If so, this is the perfect place for you. Or, if you need to draw stripes and figured you’d check the internet for an easy solution before you tried it yourself than you are also in the right place.

For those of you who just want the code here it is.

public class StripedView extends View {

    private static final float STRIPE_WIDTH_PERCT = .05f;
    private static final float STRIPE_OFFSET_PERCT = .2f;
    private Path stripespath = new Path();
    private Paint blackPaint = new Paint();

    public StripedView(Context context) {

    public StripedView(Context context, AttributeSet attrs) {
        super(context, attrs);

    public StripedView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

    public StripedView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);

    protected void onDraw(Canvas canvas) {
        drawStripes(canvas, 0, getHeight(), 0, getWidth(), blackPaint);

    private void drawStripes(Canvas canvas, float topy, float bottomy, float startx, float endx, Paint p){
        if(bottomy - topy < 1){
        float width = (bottomy - topy) * STRIPE_WIDTH_PERCT;
        float offset = (bottomy - topy) * STRIPE_OFFSET_PERCT;
        for(float xPos = startx - offset; xPos <= endx; xPos += offset + width){
            stripespath.moveTo(xPos, topy);
            stripespath.lineTo(xPos + width, topy);
            stripespath.lineTo(xPos + offset + width, bottomy);
            stripespath.lineTo(xPos + offset, bottomy);
            stripespath.lineTo(xPos, topy);
        canvas.drawPath(stripespath, p);
Which will result in something that looks like this.