Labels

Saturday, January 10, 2015

How to enable USB Debugging and Developer Options on Motorola Moto E

How to enable USB Debugging and Developer Options on Motorola Moto E Here is the instruction how to turn on USB Debugging hidden in secret Developer Options on Android Jelly Bean. 1) Turn on the developer mode options Go to Settings -> About phone -> and tap 7 times"Build number" 2) Enable USB Debugging Settings -> Developer options-> and check USB Debugging

How to take screenshot on moto-e

How to take screenshot on moto-e : 1) Press "volume -" + "power" button in one go. Hold both of them for 2 seconds. 2) Your screen will be captured and you will get a notification. 3) Your picture will be visible in gallery App.

Friday, January 9, 2015

How to fix error "Xlib: connection to "hostname" refused by server"

If you are facing this issue on second server and everything works fine on first server. Then do the following : first$ xauth list $DISPLAY first.server.com/unix:0 MIT-MAGIC-COOKIE-1 076aaecfd370fd2af6bb9f5550b26926 first$ telnet second.server.com login: Password: second% setenv DISPLAY first.server.com:0 second% xauth add first.server.com:0 . 076aaecfd370fd2af6bb9f5550b26926

Saturday, June 1, 2013

Cheated by Naukri.com

My experience with Naukri.com  :

After 6 months in my first job I learned some new skills and I thought I should update them on linkedin or Naukri.com, not because I was looking to change my job just because I fuc***g acquired some new skills.

After a few days of my update my manager calls me to his office and asks me why do I want to change job? I was shocked at first I did not understand why he was saying that. I just assured him that I was very much satisfied with my job and have no reason to look for another,which was 100% truth at that point of time .

Thinking about the incident later it became very clear that the only reason for him to think that I am looking for a change is my naukri profile.

Later when I talked with some of my senior colleagues things became crystal clear. HR of my company takes employee attrition very seriously and they have premium consultant accounts at all major job search websites and continuously monitor employee activities. 

This can happen to you too, so do not post anything on these fu****g sites unless you are very sure of leaving the company.

Anyways these site are pretty much useless and only shows useless job openings.

Saturday, May 18, 2013

Quick sort c++ code

For in-depth understanding of Data Structure and Algorithm concepts refer :

1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in

2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in

#include<iostream.h>
#include<conio.h>
int count=0;
int partition(int a[],int  p,int r)
{

    int x,j;
    x=a[r];
    int i=p-1;
    for(j=p;j<r-1;j++)
    {
        if(a[j]<=x)
        {
            i=i+1;
            int t=a[i];
            a[i]=a[j];
            a[j]=t;
        }
    }
    int g=a[i+1];
    a[i+1]=a[r];
    a[r]=g;
    return(i+1);
}


int quicksort( int A[],int p,int r)
{
    int q;
    if(p<r)
    {
        q=partition(A,p,r);
        quicksort(A,p,q-1);
        quicksort(A,q+1,r);
    }
}

void main()
{
    int a[20],n;
    cout<<"Enter the size of the array: "  ;
    cin>>n;
    cout<<"ENTER ARRAY ELEMENTS: \n";
    for(int i=0; i<n; i++)
        cin>>a[i];
    quicksort(a,0,n-1);
    cout<<"YOUR SORTED ARRAY IS: \n";
    for(int i=0;i<n;i++)
        cout<<a[i]<<endl;
    getch();
}

Bucket sort C++ code


For in-depth understanding of Data Structure and Algorithm concepts refer :

1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in

2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in

#include<iostream.h>
#include<stdio.h>
#include<conio.h>

class node
{
    public:
        float info;
        node *next,*prev;
        node(){next=prev=0;}
        node(int n, node *ptr=0, node *ptr1=0)
        {
            info=n;
            next=ptr;
            prev=ptr1;
        }
};

/* sort the link list of elements*/
void isort(node *head)
{
    if (head == 0)
        return;
    float key;
    node *j,*i, *q=0;

    for(i=head->next;i!=0;i=i->next)
    {
        q=0;
        key = i->info;
        j=i->prev;
        while(j!=0 && key < (j->info) )
        {
            j->next->info=j->info;
            q = j;
            j=j->prev;
        }

        if(q!=0)
            q->info = key;
    }

}


void bucket_sort(float *a,int n)
{
    /* create buckets */
    node* *b = new node* [n];
    for(int i=0; i<n;i++)
        b[i]=0;

    /* step 2 begins - insert a[i] into buckets */
    for(int i=0;i<n;i++)
    {
        int index=n*a[i];

        node *temp=new node(sizeof(node));
        temp->info=a[i];

        if(b[index]==NULL)
        {
            b[index]=temp;
        }
        else
        {
            temp->next=b[index];
            b[index]->prev=temp;
            b[index]=temp;
        }
    } // end of for
    /* step 2 ends */

    /* step 3 begins - sort each bucket */
    for(int i=0; i<n;i++)
    {
        isort(b[i]);
    }
    /* step 3 ends */

    /* step 4 begins - concatenate all the buckets */
    node *trav=0;
    cout<<"\n\nSorted array is: \n";
    for(int i=0; i<n;i++)
    {
        trav = b[i];
        while(trav != 0)
        {
            cout<<trav->info<<" ";
            trav = trav->next;
        }
    }
    /* step 4 ends */
}

void main()
{
    clrscr();

    int n;
    float *a;

    cout<<"\n\t Enter the size of array  :  ";
    cin>>n;

    cout<<"\n\t Enter the elements of an array  :\n";
    a=new float[n];
    for(int l=0;l<n;l++)
        cin>>a[l];

    cout<<"\n\t Unsorted array is..\n";
    for(l=0;l<n;l++)
        cout<<a[l]<<" ";
    cout<<"\n" ;

    /* sort lements using buckt sort */
    bucket_sort(a,n);

    getch();
}

Radix sort c++ code

For in-depth understanding of Data Structure and Algorithm concepts refer :

1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in

2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in

#include<iostream.h>
#include<conio.h>
#include<string.h>

void countingsort(char s[][20],int a[],char b[][20],int n,int k)
{   int c[100];
    int l,j,i;
    for( l=0;l<=k;l++)
        c[l]=0;
    for(j=0;j<n;j++)
        c[a[j]]=c[a[j]]+1;
    for(i=1;i<=k;i++)
        c[i]=c[i]+c[i-1];
    for(j=n-1;j>=0;j--)
    {
        strcpy(b[c[a[j]]-1],s[j]);
        c[a[j]]=c[a[j]]-1;
    }
    for(i=0;i<n;i++)
    {
        strcpy(s[i],b[i]);
    }
}

void radixsort(char s[][20],int d,int n)
{  int z[20];
    char b[20][20];
    int i,j,k;
    j=d-1;
    for(i=1;i<=d;i++)
    {
        for(k=0;k<n;k++)
        {
            z[k]=s[k][j]-48;
        }
        --j;

        countingsort(s,z,b,n,9);
    }
    cout<<"Output"<<endl;
    for(i=0;i<n;i++)
        cout<<b[i]<<endl;
}


void main()
{
    int n,i,d;
    char a[20][20];
    cout<<"Entr the size of the array"<<endl;
    cin>>n;
    cout<<"Enter the no. of digits"<<endl;
    cin>>d;
    cout<<"Enter its element"<<endl;
    for(i=0;i<n;i++)
        cin>>a[i];
    radixsort(a,d,n);

    getch();
}