Monday, April 30, 2012

Octave 3.4.3 Installation Ubuntu

1) Sudo apt-get install build-essentials
2)Download octave3.4.3 from Here
3)Untar it, and then install gfortran using sudo apt-get install gfortran
4)apt-get install octave3.2-headers [For building dependencies]
Or
apt-get install libblas-dev libatlas-dev liblapack-dev
5)sudo mv /usr/bin/gfortran    /usr/bin/gfortran.ORG
6)sudo ln -s /usr/bin/gfortran-x.x   /usr/bin/gfortran [create a soft link]
7)Create enviornment variables :
   - export CC=/usr/bin/gcc-x.x
   - export CXX=/usr/bin/g++-x.x
8)./configure in octave folder
9)make [it will take around 30 mins]
10)./run-octave
11)make check
12)sudo make install
13) make
14)make clean
For more Info check here
 
 
 

Wednesday, January 4, 2012

Useful Links for Algorithms and Puzzles

Coding Contest :

1>Code Chef : Initiative of Directi
2>AI challenge : http://aichallenge.org/problem_description.php
3>ML coding contest : http://www.kaggle.com/ [Best]
4>Heritage Health Prize :  Data analysis contest http://www.heritagehealthprize.com/c/hhp


Algorithms :

1>Carrer Cup [Blog /Pdf]
2>Geek for geeks [best]
3>Crack The Interview [Pdf]
4>Freshers world

Puzzles :
1>Gurmeet singh puzzles :Delightful Puzzles
2>Cracking the code : http://shashank7s.blogspot.com/p/stacks.html


Wednesday, December 7, 2011

Git Simple commands

Like other repository managers CVS, git is a also a repository manager. Where we can commit our code, so that it can be updated in repository.

Branches : Whole repository can be managed using two branches : local  and remote branches. Master is the root of all branches where all builds from different branches are committed and are in production version. Local branches are the branches specific for particular project. Remote branches are the branches specific to particular project but not created by us.

Useful git commands :

#git push origin branch-name : push the code to specified branch
#git branch : will show your current branch
#git branch  -a :show list of all branches including remote and local and master branches
#git branch -r : show list of all remote branches.
#git stash : save your local changes into git pull or git svn (so that whenever you git pull --rebase changes will automatically comes in)
#git checkout <branch_name> : To switch to specified branch
#git pull --rebase : pull the updated build from current branch
#git logs : to check the last updates in repository
#gitk : is an Graphical interface to git.
#git status : How many local changes you have made.
#git diff <filename> : shows the differences of changes you have made in that file after last commit/update.
#git branch <branch_name> : create a new branch with <branch_name>

Note for more details refer link

Wednesday, November 30, 2011

String vs String Builder vs String Buffer

String : Immutable
String Builder : Mutable + Thread safe
String Buffer : Mutable + not Thread safe.


Performance wise : string is bad , as for every operation it creates new string object hence immutable. whereas String builder/ String Buffer doesn't create new object very time for string operations.

For ex :

String A = A + "BBC"
then for this a new "A" object will be created. So we are creating those many objects of string class.

When using String Builder/ String Buffer, then operations performed on same object and doesn't create new object of String Buffer/ Builder. Hence mutable.
Therefore performance is good.

##PS : For more refer mutable/immutable

Saturday, October 1, 2011

MySQL Reset Root Password

1> First, stop the database
sudo /etc/init.d/mysql stop

2> Start mysqld_safe [which starts the mysql server in safe option] LIke to restart server when some error occured. For more details click here.
Similarily we are using mysqld_safe for resetting lost/forgot password.

/usr/bin/mysqld_safe --skip-grant-tables &
You have to run above using root (sudo -i)
3> It shows mysql daemon started with databases in /var/lib/mysql
Since server is running with --skip-grant-tables flag, means you can access the database without password
Now write the command :
mysql --user=root mysql
Enter your root password
4> Now since we have to update our password in User table. Therefore 
We provide command :
Update user set Password=PASSWORD("Your New Password") Where User='root';
5> Flush Privileges :
Means clear and reload the priviledges.
So command will be 
flush privileges; More about flush option click here
 
6> Exit Mysql
7>Now You have to stop the Daemon Mysql server
It is a two step process :
  • Firstly bring the Background process to Foreground
    Command used for this is :
    fg
     
     
  • Kill the Foreground process
    Ctrl + c [But sometimes Ctrl +z]
8>Now start the mysql 
sudo /etc/init.d/mysql start
9>Now go to mysql
mysql --user=root --pass=newpassword

Monday, September 5, 2011

apt -get broken packages

1>
sudo apt-get clean
will clear your cache, afterwards try again to install the packages you want.
2>
sudo apt-get install -f

Monday, August 29, 2011

Some important commands in ubuntu

1> To remove an application already installed
sudo apt-get remove <app>

2> To remove application already installed with all config files.
sudo apt-get --purge remove <appn>

3>To list all installed packages
dpkg --list
 dpkg --list less
dpkg --list | grep -i 'app'