Friday, November 22, 2013

Install a particular version of gcc.

 sudo apt-get install gcc-4.4  
 sudo apt-get install gcc-4.4-multilib  
 sudo apt-get install g++-4.4  
 sudo apt-get install g++-4.4-multilib  
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4  

I am using ubuntu 12.04, and my default gcc version is 4.7. I wanted to install gcc 4.4.


 ~$ gcc -v  
 Using built-in specs.  
 Target: x86_64-linux-gnu  
 Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.7-1ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu  
 Thread model: posix  
 gcc version 4.4.7 (Ubuntu/Linaro 4.4.7-1ubuntu2)   

Problem I faced with git

Changed a lots of code for testing, now I want to go back to commit state. All changes will be undone.
     git checkout -- .

Checkout a specific commit.
    git checkout 'hashvalue'

Force push a revision
   git push --force origin development



Monday, November 18, 2013

Creates a functional field that save field value in database

I have a field name as :
 _column {  
   'name': fields.char('Name', size=64, required=True, translate=True),  
   'hash_value': fields.function(_get_hash,method=True,type='char',string='Hash Value', store=True )  
 }  

I want hash_value equal to the slugify value of name and also want to save it in database. This code will do the trick.
  def _get_hash(self, cr, uid, ids, fld_name, arg, context=None):  
     if not len(ids):  
       return []  
     result={}  
     reads = self.read(cr, uid, ids, ['name'], context=context)  
     for atr in reads:  
       result[ atr['id'] ] = slugify(atr['name'])  
     return result  

Sunday, November 17, 2013

JRTPLIB, object-oriented RTP library written in C++ By Jori

Site Link :

My Current Machine :
  $ uname -a  
    Linux xerxes-pc 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux  
  $ lsb_release -a  
    No LSB modules are available.  
    Distributor ID: LinuxMint  
    Description: Linux Mint 13 Maya  
    Release: 13  
    Codename: maya  

Download :
 xerxes@xerxes-pc ~/Documents/Development/Jrtplib $ axel http://research.edm.uhasselt.be/jori/jrtplib/jrtplib-3.9.1.tar.gz  

Extract : 
 xerxes@xerxes-pc ~/Documents/Development/Jrtplib $ tar -xvzf jrtplib-3.9.1.tar.gz   

Configure and Compile :
 xerxes@xerxes-pc ~/Documents/Development/Jrtplib $ cd jrtplib-3.9.1/  
 xerxes@xerxes-pc ~/Documents/Development/Jrtplib/jrtplib-3.9.1 $ cd ..  
 xerxes@xerxes-pc ~/Documents/Development/Jrtplib $ cmake jrtplib-3.9.1  
 xerxes@xerxes-pc ~/Documents/Development/Jrtplib $ make  
 xerxes@xerxes-pc ~/Documents/Development/Jrtplib $ sudo make install  

Saturday, November 16, 2013

Git Bitbucket push local folder to remote repo

lets my new branch name is openerp_pos

1. Create a git or bitbucket branch from their website
2. git clone https://pallab-gain@bitbucket.org/pallab-gain/openerp_pos.git 

3. git checkout openerp_pos

4. git status
5. git add .
6. git commit -a
7. git push origin openerp_pos