Twilio Vs Nexmo -SMS service

April 20, 2014 Leave a comment

 

Twilio offers more than just SMS, with their Voice IVR API being the unique API. Nexmo doesn’t offer any voice API, and the inbound numbers they offered is strictly for SMS only. So if you want the same number that can receive SMS and also receive phone calls, Twilio is the only one that can do that.

Categories: Android

SAP Hana – Feeding data from xodata to Pie/Bar Chart

February 13, 2014 Leave a comment

SAP Hana ,  Getting the data from xodata and feeding it to pie / bar chart for Analytical views 

In your view.js file , define the pie/ bar chart object as below

sap.ui.jsview(“view.ViewName”, {

getControllerName : function() {
return “view.ViewName”;
},

createContent : function(oController) {

var oPage = new sap.m.Page(“homePage”, {
showNavButton : false,
showFooter : false
});

var dataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions : [
{
axis : 1, // must be one for the x-axis, 2 for y-axis
name : 'COLOUMN', //Any name .. preferrably db column name
value : "{COLOUMN}" //database column that you get in while access .xodata
}],

measures : [ {
group : 1,
name : "XYZ_COUNT",
value : "{XYZ_COUNT}" // this is database count for the columb you chose

}],

data : {
path : “/XXXXXXX”, // this is your context that you define in your .xodata file

}
});

var pie = new sap.viz.ui5.Pie({
width : “100%”,
height : “300px”,
showLegend : false,
plotArea : {
‘colorPalette’ : d3.scale.category20().range()
},
title : {
visible :true,
text : ‘Graph Name’
},
dataset : dataset
});

oPage.addContent(pie);
return oPage;
}
});

Categories: Big Data, SAP Hana

SAP Hana – Different Charts

February 13, 2014 Leave a comment
Categories: Big Data, SAP Hana

search on sorted array which has been rotated to unknown pivot

October 4, 2013 Leave a comment

Binary search with change :

int start = array[0];
int end = array[length -1];
int mid = array[length/2];
int left = 0;
int right = length – 1;

while (left <= right) {
int middle = left + (right-left)/2;
if (array[middle] == find) return middle;

if (array[left] <= array[middle]) {
if (find >= array[left] && find < array[middle])
right = middle – 1;
else
left = middle + 1;
}
else {
if (find > array[middle] && find <= array[right])
left = middle + 1;
else
right = middle – 1;
}
}
return -1;

Categories: JAVA

Quick sort & Merge sort

October 4, 2013 Leave a comment

Quick sort is nothing but a series of recursive calls to partitioning and the fastest comparison sort on arrays in practice.
Merge sort is stable comparison sort, which also works on linked lists .

Categories: JAVA

Sorting algorithm Comparision

October 1, 2013 Leave a comment

A good implementation uses O(log N) auxiliary storage in the form of stack space for recursion.
A stable sort is one that’s guaranteed not to reorder elements with identical keys.

Sorting algorithm Comparision
Bubble sort –

  • Stable sort .
  • Time complexity – O(n) on best , O(N^2) in the worst case .
  • Memory -O(1).

Insertion sort

  • Stable sort.
  • O(N^2) time complexity.
  • Useful for adding new data to a presorted list.

Merge sort –

  • stable sort .
  • O(N log N) time complexity
  • Downsides to it are that it uses O(N) auxiliary space and has a slightly larger constant than a quick sort.
  • Uses extra memory

Selection sort:

  • Not stable sort . 
  • Time complexity -O(n^2) .
  • Memory -O(1) auxiliary space.

Quick Sort:

  • Not stable sort . 
  • Time complexity – O(N log N) on average, O(N^2) in the worst case .
  • Memory – log n on average, worst case is n

Heap Sort :

  • Not stable sort . 
  • Time complexity- O(Nlog N)
  • It’s guaranteed to be O(N log N), and uses O(1) auxiliary space, meaning that you won’t unexpectedly run out of heap or stack space on very large inputs.
  • Slower than quicksort.
  • Memory -O(1) auxiliary space.
Categories: JAVA

singleton class -constructor throwing Exception

September 25, 2013 Leave a comment

We can take example :singleton class and  if the constructor is throwingIOException ,and the best strategy to create instance of this class:

class TestSingleTon{
private static TestSingleTon INSTANCE=null;

private TestSingleTon() throws IOException {
}

public static synchronized TestSingleTon getInstance() throws IOException{
if(INSTANCE==null){
return new TestSingleTon();
}
return INSTANCE;
}
}

The caller to SingleTon instance of the class should handle the exception.SingleTon class have to just throw exception it to the caller.

Categories: DESIGN PATTERNS, JAVA
Follow

Get every new post delivered to your Inbox.