Tools of success

These things will help me in achieving what I want.

1.Focus

2.Concentration

3.Physical fitness

4.Super Workethics (become a workholic)

5.Forget about everything else , just focus on work.

6.keep your mind empty all the time.You cann’t afford to entertain ediotic and irrelevant thoughts .

7.Stay positive , don’t focus much on the result . Focus on work  , your journey .Make it memorable by sheer hard work.

Anxiety,Fear and Anger

These are few feelings , most of the times I’m surrounded with.

I would have liked these to be fearlessness, freedom, calmness.

But reality is reality I’m far away from the ideal situation.

I thought lets sit and pen down  the reasons , why the things which I don’t want have clogged my life and what’s the root cause.

High Expectations

I’ve have above average expectaions from life .A good job, a small family , monthly salary 9-5 routine.
The free office lunch , the pizza parties , owning a luxury car.Just doesn’t fit in the picture.
The life which I’ve imagined for myself is beyond these things.I want freedom .And the first step towards that is financial freedom or some high ranked officer where someone will take care of all your experinces.A life which is above average and where you don’t have to care much about others.

Average or below average effort.Living in my comfort zone

While I put effort towards achieving the above goal .I’m still not coming out of my comfort zone . I don’t work with the pace which is required to achieve the goal in short time.If I continue the same I won’t be anywhere.I have to start living on the edge.

Not achieving anything and lack of consitent effort creates anger

Earlier I was angry because I didn’t knew what I want .I was totally confused earlier and at that time that was something that used to fill me up with anger.But now the goal is clear . But I still don’t put the rewuired effort.And I know if I continue the same I’ll destroy my future . This is something which makes me angry.I know there are many excuezes which I give to myself when I don’t put the reuired effort .But I’ve to constantly remind myself that these excuses , the problems are all mine . The effort required will remain the same. Destiny doesn’t caare what happedned and why it happened. It just want you to proove that you want something very badly , so you are putting desparate efforts in acheiving that. that’s it .
No matter what happens you have to put effort reuired , to proove that you want something and you are more deservant than thousands out there to hold that fortune that trophy which your are running for.

Goals for year 2015

This post is intended to remind me what I need and is written to mentor me  and show me the correct path in times of anxiety , when the feeling of fear and uncertainty clouds my mind .I need something which reminds me who I’m , to which breed I belong to and where I’m heading towards and what I really want. This will act as a guide for me for next 7 months.

The Ultimate Goal

The ultimate goal of my life is to achieve freedom.Now freedom in itself is a broad concept.

But what I want to achieve is this. Freedom to work on things which I want.

To be wherever I want o be.To work whenever I want. To do whatever I want if it’s not troubling anyone.There should not be fear of any kind.Behaving the way I want o behave .

I’m free from feeling like reciprocity . I’m not dependent on any one in any way.

Freedom from this monthly salary and happy small family loop.

The 2BHK , flat , apartment ,rising and falling stock loop.

The marriage and insurance and that big car loop.

The friendly neighbors loop.

The constant complain loop.

The appraisal and increment loop.

Believe it or not these loops are infinite and you won’t realize , none of these will end before retirement and some will end only after death if I allow external things to control my life. Let things go the way they are. Working regular hours each day.

You see some extra push is needed to have something extra ordinary (freedom ) in my case.By putting the regular effort only regular things will fall in your pocket ,sometime a little bonus on that .But nothing more than that .So I’ve to work like hell a few days.Consistency is somethings very much I need.You know even a druggie can work for 22 hours a day when he is on drug.So sometimes I do the same and expect why my life is not changing.So I’ve to differentiate myself from such people. I’ve to prove that I can work hard consistently .With consistent extra effort only  I can achieve what I want.Work like hell , keep this goal in mind.Remain motivated.Aspire to be free.

 

While this again looks very big.So lets start with something small.

Goals for nxt 7 months.

  1. Achieve some degree of freedom , by going ahead of what I’ve planned to finish. Finish things quickly by putting extra effort and utilize the extra time for achieviing you goal of freedom.
  2. Move closer to you ultimate goal. by clearing atleast one exam.You clearly know the list of exams which can make you free.
  3. Give your parents the things which they have missed because they were working hard because their son can achieve which they couldn’t .They could have enjoyed the luxuries by spendin everuthing they were earning and could have enjoyed their lives .But they did the opposite , saved every single rupee they could and invested that in education of yours  .That’s a heavy debt on me , which I’ve to pay back somehow.

I’ll complete this post later.

 

 

 

 

SEO Beginners Guide

Search Engine Optimization(SEO) however big this term may sound .But it simply means how to write your content so that your page should appear on the first page and if you are extremely lucky than the First result in Google Search(please don’t mind but now a days search means google search). Though the topic SEO is vast and there are many advanced techniques for improving your search engine rankings.But believe me if you follow these simple suggestions I’ve mentioned and your content is original you will be on First page. If your blog is not very large to be more specific ,If your monthly traffic is less than 500000 page views and your content is original just follow this guide and believe me you will be on top. Lets begin 1.SEO is not Rocket Science some of the web Gurus will tell you that it will take years to master  this subject but believe me that’s not true. 2.Help people find what you are offering to them by using right keywords.You can use tools such as google keyword tool , to find  right keywords. 3.Write quality content :

  • Be specific :If you are writing about iPhone write it as iPhone instead of mobile.
  • Title : Write related and eye catching title that attracts users attention.
  • Link : link to other good sites that explains other things which your site is about.This will result in other sites linking to you as well.
  • Update : Make sure the  content on your site is not outdated, update it regularly.

4.Headings Headings are somewhat similar to headings in a book .Generally, there should only be one H1 tag on each page, and you can have as many h2s, h3s, and h4s as needed. Also, make sure your headings contain keywords and are relevant to the content on your website. 5.URL URL is also plays one of the most important part of your search engine Rankings.If your page urls are messy then search engines will find difficult in finding your page.Also if some keywords are present in the url then it can improve your rankings For Example: randomtechbits.in/codelibrary/sorting       will result in better ranking than randomtechbits.in/dec13/codelibrary/sorting 6.Internal links the way you link your sites content to each other decides you search engine rankings.Try to have good number of internal link within the same page as well as to other pages of your website. 7.Images Try to name your images in a way that describes it properly.Like if you have an image of Stevejobs on your website , try to name it as stevejobs.jpg instead of image01.jpg.Also in the alt tag of the image give brief but proper description of the image. like <img src=”http://randomtechbits.in/images/stevejobs.jpg” alt=“steve jobs image” />
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.00 out of 5)
Loading ... Loading ...

Eclipse Shorcuts

Shortcuts are among the effective ways to increase your speed and efficiency .Eclipse apart from standard shortcuts like CTRL+A provides many other shortcuts using which you can increase your productivity.Below I’m listing the 10 essential eclipse shortcuts which every eclipse user should know to work more effectively.

1.CTRL+SHIFT+O
Organize imports.Press this combination to import all missing classes which is needed to run your code.Also this will remove all unused classes.

2.CTRL+D
Delete a row.No need highlight the entire text and press delete or use mouse , just press CTRL+D and you are done.

3.CTRL+SHIFT+R
One of the most effective eclipse shortcut opens a search dialog to search form recently used resources.U can any patter like Foo* to search all files whose name starts with foo prefix.eclipse shortcut ctrl+shift+r

 

4.CTRL+H
Search .Use this eclipse shortcut to search any class ,method ,string within text .And a lot of other things.

5.F3
Another important eclipse shortcut.Highlight an object and press F3 to go to the object declaration.Select a class name and press F3 to view class definition.

6.ALT+Left/Right arrow
Used for navigating the code.Lets say you are in class A and there is an object of type B in it you pressed F3 on that and moved to class B, now you want to go to class A again simply press ALT+Right arrow if you again want to go to class B press ALT+Left Arrow.

7.CTRL+SHIFT+\ or /
Add and remove block comments around a piece of code.

8.CTRL+F8
Move between perspectives.

9.CTRL+SHIFT+F
format ,use this eclipse shortcut to format your ugly looking code .

10.CTRL+1
Quickfix , use this eclipse shortcut to see quickfixes available for any errors or warnings.

Though there are many more shortcuts available in eclipse but I mentioned only those which I think are a kind of must know , if u think I forgot something important let me know I will add it.

Deploying Grails app on Tomcat

Below I’m describing the steps to follow for deploying a grails web application in tomcat server instead of the default server that comes with the grails package.

Steps:

1. For deploying grails app on tomcat or any other application server we have to create a web archieve [.war file].

2. Before creating the war  file do any kind of configuration changes which you want , b’coz these cann’t be changed after generating the war file.

3. Also make sure that the line   “// TODO: grails.serverURL = http://www.changeme.com in file “appname\grails-app\conf \Config.groovy” is commented or is set to  appropriate url if running live  by default the                     line is commented and hence no modification is needed  for  testing on localhost.

4 .Now create the war file by type  “ grails prod war”

5. Now check the appname/target directory you will see a war file there

Ex: if app name is Gregister the a file Gregister-0.1.war will be there.

Rename the war file  from Gregister-0.1.war to Gregister[ using which you were deploying it originally].

6. Place this file in  “webapps” directory of tomcat.

7. Start tomcat.

8. Click Manage App button    tomcat manage apps

9 .Enter Login details

10. A table with name Applications is there which shows the  list of all applications . apache managerwebapps

11. In this table Click in the path column on the row corresponding to your application

Ex: /Gregister in this case. //screenshot available

12. You wil be directed automatically to the home page of the grails app and you can use the grails app similar as running using grails framework.grails workingapp

13. If the application name is not listed in the Applications table then  goto War file to deploy table on the same page

.click choose file and select the war file in web apps directory

.click deploy and refresh page and follow above steps to deploy

14. One thing to note is that this time the application runs on the port on which tomcat is installed Ex: http://localhost:8011  [here 8011 is the port on which I installed tomcat].

Failed to load the JNI shared library :Eclipse Error

I recently downloaded the 64 bit version[eclipse-SDK-3.7.1-win32-x86_64] of eclipse for windows 7 .But on when I tried to run the eclipse.exe file , the following error message was displayed.

” Failed to load the JNI shared library  c:\Program Files(x86)\java\jdk1.6.0_25\bin\..\jre\bin\client\jvm.dll\ “

As displayed here:

eclipse error

Failed to load the jni shared library :Eclipse Error

What’s the reason for this Error ?

1.You have downloaded the 64 bit version of eclipse but are using the 32 bit jdk.

2.For using 64bit version of any of the eclipse ide, you have to install the 64 bit version of jdk[jdk-7u2-windows-x64.exe].

How to solve the problem:

1.Download the 64 bit version of jdk .

2.Install it .

3.Set the value of JAVA_HOME enviornment variable to C:\Program Files\Java\jdk1.7.0 [default installation].

I’ll recommend try to start eclipse now before going to next step

Still not able to launch workspace? Do this

Modify the  eclipse.ini file

1.Eclipse startup is controlled by the options in eclipse.ini file present in eclipse installation directory it contains command-line options that are added to the command line used when Eclipse is started up.

2.Now use the -vm option to specify pate to the java executable which u want to with this eclipse modify the file as shown here:
initial eclipse.ini file present

eclipse.ini before before

eclipse.ini before before

after modifying eclipse.ini

eclipse.ini after modification

eclipse.ini after

3.Note that u have to specify the full path to the javaw.exe file with javaw.exe added to it  not just the path to it different from what we do while specifying JAVA_HOME .                          Visit eclipse wiki page for more information eclipse.ini.
This is a kind of workaround if u are facing problems in specifying the jvm path

Now Run eclipse.exe and enjoy the 64 bit version.

Binary Search

Binary Search finds the position of a specified value (key)in a sorted array.In each step it discards half of the elements to search , thus the worst case running time of binary search is O(log n).

Binary search follows these simple steps :

1. Compare the middle element of the array with key if middle element is same as key return the index of the middle else go to step 2

2.if middle element greater than key  binary search for the key in the left half of the array (start to middle-1) , if its less  than key binary search for the key in the right half of the array (middle+1 to end) .

3.repeat this till the size of array to search reduces to zero.

 

For more information on binary search visit http://en.wikipedia.org/wiki/Binary_search_algorithm

Below is the C++ code for binary search algorithm.
CODE:

/*

http://randomtechbits.in/

*Program to search a number in a sorted array using BINARY SEARCH
*inputs: N- number of integers to sort ,A-array of integers,NUM -the number to search for     
*output: position of number in the array
*code tested on devc++ IDE
*/
#include<iostream>
#include<conio.h>
using namespace std;

int binarysearch(int A[],int NUM,int low,int high)
{int mid;
if(low>high)return -1;
else mid=low+(high-low)/2;
if(A[mid]==NUM)  return mid;
else if(A[mid]>NUM)  return binarysearch(A,NUM,low,mid-1);
else  return binarysearch(A,NUM,mid+1,high); 
}
main()
{
int N,NUM,pos;
int *A;
int i,j;
cout<<"Enter the number of elements in te sorted array:\n"; cin>>N;
A=new int[N];
cout<<"Enter the array\n";
for(i=0;i<N;i++)   cin>>A[i];
cout<<"Enter the number to search for\n";   cin>>NUM;
pos=binarysearch(A,NUM,0,N);
if(NUM!=-1)
  cout<<"\nNumber found at postion at "<<pos<<" in the array"<<"\n";
else 
  cout<<"\nNumber not found in the array"<<"\n";
//for more codes visit randomtechbits.in
getch();   
}

Counting Sort

Counting Sort assumes that each of the  input element is an integer in the range 0 to k, for some integer k. When k=O(n), the sort runs in O(n) time. The basic idea of counting sort is to determine, for each input element x, the number of elements less than x. This information can be used to place element x directly into its position in the output array. For example, if there are 10 elements less than x, then x belongs in output position 11. This scheme must be modified slightly to handle the situation in which several elements have the same value, since we don’t want to put them all in the same position.

In the code for counting sort, we assume that the input is an array A[], and thus length[A] =n. We require two other arrays: the array B[] holds the sorted output, and the array C[] provides temporary working storage.

 For more information on counting sort visit http://www.algorithmist.com/index.php/Counting_sort

Below is the C++ code for counting sort algorithm.
CODE:

/*
 http://randomtechbits.in/
*Program to sort numbers using COUNTINGSORT
*inputs: N- number of integers to sort ,A-array of integers       
*output: sorted array of integers
*Assumption : all the number will lie in range 0 to MAX-1
*code tested on devc++ IDE
*/
#include<iostream>
#include<conio.h>
#include<string.h>
using namespace std;

void coutingsort(int A[],int len,int MAX)
{int *C=new int[MAX];
//intialise all elements to 0  
memset(C,0,sizeof(int)*MAX);
for(int i=0; i<len; i++)
 {
 C[A[i]]+=1;
 }
for(int i=1; i<MAX; i++)   {   C[i]+=C[i-1];   } int *B=new int[len]; for(int j=len-1; j>=0; j--)
  {
  B[C[A[j]]-1]=A[j];
  C[A[j]]-=1;
  }
for(int j=len-1; j>=0; j--)
  {
  A[j]=B[j];
  }
}
main()
{
int N,MAX,temp;
int *A,*O;
int i,j;
cout<<"Enter the number of elements in array:\n"; cin>>N;
A=new int[N];
O=new int[N];
cout<<"Enter the upper limit for input values:\n"; cin>>MAX;
cout<<"Enter the array\n";
for(i=0;i<N;i++)   cin>>A[i];
coutingsort(A,N,MAX);
cout<<"\nThe Sorted array after COUNTING SORT:"<<i<<"\n";  
for(i=0;i<N;i++)
  cout<<"\t"<<A[i];   
//for more codes visit Code Library
getch();
}

Merge Sort

Merge Sort  belongs to category of divide and conquer algorithms. Which means it divides the problem into  small subproblems, solves them and then combine the solutions of these subproblems to generate solution  of the original problem.Merge Sort compares elements with each other for sorting the list.

The steps followed to mergesort are are:

  1. Divide the unsorted list into n sublists, each containing single element .
  2. Repeatedly merge(involves comparing elements of the sublists) sublists to produce new sublists until there is only 1 sublist remaining. This will be the sorted list.

 For more information on merge sort visit http://en.wikipedia.org/wiki/Merge_sort

Below is the C++ code for merge sort algorithm.
CODE:

/*
 http://randomtechbits.in/
*Program to sort numbers using MERGESORT
*inputs: N- number of integers to sort ,A-array of integers       
*output: sorted array of integers 
*code tested on devc++ IDE
*/
#include
#include
using namespace std;

void merge(int A[],int p,int q,int r,int O[])
{
int i=p;
int j=q+1;
int k=p;
//Note that I have intionally used few extra lines in all of the follwing loops tomake it more clear to learners
while((i<=q)&&(j<=r))
  {
  if(A[i]<A[j])
    {
    O[k++]=A[i++];
    }
  else
    {
     O[k++]=A[j++];
    }
}
while(i<=q)
  {
  O[k++] =A[i++];
  }
while(j<=r)
  {
  O[k++]=A[j++];
  }
int l=p;
while(l<=r)
  {
  A[l]=O[l];
  l=l+1;
  }
}

void mergesort(int A[],int p,int r,int O[])
{
  if( p < r)
    {
    int q=(p+r)/2;
    mergesort(A,p,q,O);
    mergesort(A,q+1,r,O) ;
    merge(A,p,q,r,O);
    }
}

main()
{
int N,temp;
int *A,*O;
int i,j;
cout<<"Enter the number of elements in array:\n"; cin>>N;
A=new int[N];
O=new int[N];
cout<<"Enter the array\n";
for(i=0;i<N;i++)   cin>>A[i];
mergesort(A,0,N-1,O);
cout<<"\nThe Sorted array after MERGE SORT:"<<i<<"\n";  
for(i=0;i<N;i++)
  cout<<"\t"<<A[i];
//for more codes visit Code Library

getch(); 
}