Monday, August 25, 2014

Axis2 is 10 years



All most 10 years ago (August 21, 2004) we started Axis2 project and during last 10 years it has become one of the most successful projects in Apache software foundation (and yes this marked my 10 years at Apache).  Axis2 was started with a handful or people including Sanjiva, Dims, Glen, Paul, Srinath, Chinthaka, Ajith, Chathura, Jaliya and myself (and second wave consist of many more).  

In a short period of time a small team of six developers was able to make a huge process and it was more than enough to convinced IBM to drop their own web service stack (which they were working for many months) and join Axis2. That was the first wave of developers outside Sri lanka joined Axis2. Today, IBM websphere comes with Axis2 as the default WS framework.

Here are the few noticeable tings about Axis2.


  • Axis2 was the main driving force behind bringing Microsoft to ASF (through Stonehenge).
  •  All the initial members (Chinthaka, Ajith, Chathura, Srinath, Jaliya and myself) of the project were able to obtain PhDs (Axis2 is the first project in the history of Apache to do something in this nature).
  • Helped many Sri Lankan students to pursue their higher studies in top universities in the world (over 50 students, in several countries).
  •  Helped Sri Lanka to become the open source hub in the Asian continent.  Sri Lanka is the only country outside USA and Europe to have most number of Apache committers and members.
  • Community around Axis2 helped to have first ever Apache Con (ApacheCon Asia 2006) outside USA and Europe.
  • Google summer of code effort in Sri Lanka was started with Axis2 (now for several consecutive years Sri Lanka has produced a number of successful Google summer of code projects.
  • Produced many international speakers and authors.
  • The main web service framework used for many academic research studies across the globe.
  •  Axis2 is used for eBay to process two billion transactions per day.

 Let's look back some of the history of Axis2 project.


This is the First email that Srinath sent to the list announcing Axis2 F2F

These are the first set of people who come to the Axis2 F2F.

This is the summary mail of the first F2F

At the initial stage of Axis2 we used to have weekly chat, what special about those chat is we(initial developers) implement a prototype and discuss about that at the weekly chat. The funny thing is all most all the days, we have to throw that prototype and start a new one after the chat.
Here is the chat log of the first weekly chat.

From the day one of the project we used to follow the Apache guidelines, so we create patch and send them to the list. Then existing commiters can apply them, most of the time Alex and Dims used to apply those patches.

Here is the very first patch of the project.

When we start the project we did not have any commiter for Axis2 project, we had WS commiters. So following are the initial commiters of Axis2 project and here is the commiiter nomination email.

[VOTE][Axis2]Ajith, Deepal and Chinthaka for Axis2 Commiter


At the initial stage of the project we had so many milestone release before we hit 0.94 release. Here is the announcement email for first release of Axis2.
Axis2 first release – Axis2 M1
 
First few F2F
  • First F2F 21-24 August 2004, Colombo, Sri Lanka. And here is the first set of people who came to the event
  • Second F2F March 29-31st 2005 – Comobo, Sri Lanka
  • Third F2F and hackathon – December, 2005, San Diago, USA
  • Fourth F2F and hackathon - Indiana University, Bloomington

 

Saturday, July 14, 2012

Sorting Alogirthm in Java - Quick , Insertion, Merge, Heap, Selection, and Shell

You can find Java based implementation for Quick , Insertion, Merge, Heap, Selection, and Shell sorting algorithm. All those are properly tested, I assume you have good understand on how each algorithm works that helps you to understand the implementation much better.

HeapSort

public class HeapSort {

    public int[] sort(int[] a) {
        sort(a, a.length-1);
        return a;
    }

    public void sort(int[] a, int end) {
        for (int i = end / 2; i >= 1; i--) {
            fixHeap(a, i, end, a[i]);
        }
        for (int i = end; i > 0; i--) {
            swap(a, 0, i);
            fixHeap(a, 0, i - 1, a[0]);
        }
    }

    private void fixHeap(int[] a, int root, int end,
                         int key) {
        int child = 2 * root; // left child
        if (child < end && a[child] < a[child + 1]) {
            child++;
        }
        if (child <= end && key < a[child]) {
            a[root] = a[child];
            fixHeap(a, child, end, key);
        } else {
            a[root] = key;
        }
    }

    private void swap(int[] a, int i, int j) {
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;
    }
}

InsertionSort


public class InsertionSort {

    public int[] sort(int[] input) {
        int size = input.length;
           for (int i = 1; i < size; i++) {
            int j = i;
            int x = input[i];
            while (j > 0 && input[j - 1] > x) {
                input[j] = input[j - 1];
                j--;
            }
            input[j] = x;
        }
        return input;
    }
}

MergeSort 

public class MergeSort {

    public int[] sort(int[] list) {
        mergeSort(list, 0, list.length-1);
        return list;
    }

    public void mergeSort(int list[], int first, int last) {
        if (first >= last) {
            return;
        }
        int middle = (first + last) / 2;
        mergeSort(list, first, middle);
        mergeSort(list, middle + 1, last);

        int size = (last - first) + 1;
        int[] results = new int[size];

        int start2 = middle + 1;
        int indexC = 0;
        int start1 = first;
        while ((start1 <= middle) && (start2 <= last)) {
            if (list[start1] < list[start2]) {
                results[indexC] = list[start1];
                start1++;
            } else {
                results[indexC] = list[start2];
                start2++;
            }
            indexC++;
        }
        if (start1 <= middle) {
            for (int i = start1; i <= middle; i++) {
                results[indexC] = list[i];
                indexC++;
            }
        } else {
            for (int j = start2; j <= last; j++) {
                results[indexC] = list[j];
                indexC++;
            }
        }

        int c = 0;
        for (int index = first; index <= last; index++) {
            list[index] = results[c];
            c++;
        }
    }
}

QuickSort

public class QuickSort {

    public int[] sort(int[] list) {
        quickSort(0, list.length - 1, list);
        return list;
    }

    public void quickSort(int start, int end, int[] list) {
        if (start >= end) return;
        int p = partition(start, end, list);
        quickSort(start, p, list);
        quickSort(p + 1, end, list);
    }

    private int partition(int start, int end, int[] list) {
        // First element
        int pivot = list[start];
        int pivotPoint = start;
        for (int index = start + 1; index <= end; index++) {
            if (list[index] < pivot) {
                pivotPoint = pivotPoint + 1;
                swap(pivotPoint, index, list);
            }
        }
        swap(start, pivotPoint, list);
        return pivotPoint;
    }

    private void swap(int i, int j, int[] list) {
        int temp = list[i];
        list[i] = list[j];
        list[j] = temp;
    }
}

SelectionSort

public class SelectionSort {
    public int[] sort(int[] input) {
        int size = input.length;
        for (int i = 0; i < size; i++) {
            int index = i;
            int currentMin = input[i];
            for (int j = i+1; j < size; j++) {
                int y = input[j];
                if (y < currentMin) {
                    currentMin = y;
                    index = j;
                }
            }
            int x = input[i];
            input[i] = input[index];
            input[index] = x;
        }
        return input;
    }
}

ShellSort 

public class ShellSort {
    public int[] sort(int[] a) {
        double passes = Math.floor(Math.log(a.length));
        while (passes > 1) {
            int increment = (int) (Math.pow(2, passes) - 1);
            for (int start = 0; start < increment; start++) {
                insertSort(start, increment, a);
            }
            passes = passes -1;
        }
        insertSort(0, 1, a);
        return a;
    }

    public void insertSort(int start, int increment, int[] a) {
        int j, k, temp;

        for (int i = start + increment; i < a.length; i += increment) {
            j = i;
            k = j - increment;
            if (a[j] < a[k]) {
                temp = a[j];
                do {
                    a[j] = a[k];
                    j = k;
                    k = j - increment;
                } while (j != start && a[k] > temp);
                a[j] = temp;
            }
        }
    }
}

Friday, July 13, 2012

Google Maps - Display points with different markers

If you want to display different points with different markers this is for you.  Say you want to display points with two markers, let's first create markers:

Let's get started:

function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(28.2,-89.6), 6);
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
   
        // Create our "tiny" marker icon
        var greenIcon= new GIcon(G_DEFAULT_ICON);
        greenIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/icons/green-dot.png";
        greenmarker = { icon:greenIcon };

        var redIcon= new GIcon(G_DEFAULT_ICON);
        redIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/icons/red-dot.png";
        redmarker = { icon:redIcon };

        var greenIcon= new GIcon(G_DEFAULT_ICON);
        greenIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/icons/green-dot.png";
        greenmarker = { icon:greenIcon };

        var redIcon= new GIcon(G_DEFAULT_ICON);
        redIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/icons/red-dot.png";
        redmarker = { icon:redIcon };


Now let's create a set of data points:

var locations = [['42001', 26.0, - 90.0,    1],
['42002',26.0, -94.0, 2],
['42007',30.1, -88.9, 3],
['42019',27.9, -95.0, 4],
['42020',27.0, -96.5, 5],
['42035',29.2, -94.4, 6],
['42036',28.5, -84.5, 7],
['42038',27.4, -92.6, 8],
['42039',28.8, -86.0, 9],
['42040',29.2, -88.3, 10],  ];

Now, let's create marker with the data point and marker options:

function createMarker(point, moption, id) {
      var marker = new GMarker(point, moption);


      GEvent.addListener(marker, "click", function() {
        marker.openInfoWindow("Point " + id + "");
      });
      return marker;
 }

Putting all together:

// Using first marker
for (i = 0; i < locations.length; i++) {
  var latlng = new GLatLng(locations[i][1], locations[i][2]);
   map.addOverlay(createMarker(latlng, greenmarker, locations[i][0]));
}

//Using second marker 
map.addOverlay(createMarker(new GLatLng(29.3, -90.0), redmarker, 'GDIL1'));
  }
 }

Saturday, June 30, 2012

Virsh console - Issue and solution

I faced several issue when I tried to use "virsh console " in KVM. It simply hangs in following line: 

"Escape character is ^]" 

 After trying several things here is how I solved the problem:

Step 1: If the VM is running destroy it (virsh destroy
Step 2: Mount the image (following instructions are for raw disk image for Ubuntu host)

kpartx -av /location-to-disk-image 
mount /dev/mapper/loop0p2 /path-to-mount

[Note: kpartx list out several mappers and you need to pick the correct one, just play around it you will find the correct one to map. Correct one is one with grub directories] 

vi /path-to-mount/grub2/grub.cfg (in your case it might be grub) 

add "console=ttyS0" as shown below: 

kernel /vmlinuz ro a-set-of-values console=ttyS0 
umount /path-to-mount 
kpartx -dv /location-to-disk-image 

Step 3: Now start the VM "virsh start
Step 4: Console to the VM "virsh console "