Thursday, June 21, 2012

grub2 - Grub Error in Ubuntu 12.04 after upgrade from 11.10

Boot into the Ubuntu Live Cd and open terminal.



1. Identify Ubuntu partition:

sudo fdisk -l


2. Mount it ( replace sda1 with the Ubuntu partition number):

sudo mount /dev/sda1 /mnt


3.Reinstall grub:

sudo grub-install --root-directory=/mnt /dev/sda
sudo update-grub

Solution from: grub2 - Ubuntu 11.10 not showing up in GRUB bootloader after update and restart :( - Ask Ubuntu.

Friday, June 15, 2012

Installing Oracle-JDK in Ubuntu

Download JDK from ORacle. Run Terminal:

chmod u+x jdk-6u31-linux-i586.bin
./jdk-6u31-linux-i586.bin
sudo mv jdk1.6.0_31 /usr/lib/jvm/


#Next line will add java to symlink

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_31/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_31/bin/javac" 1

Or, better if you can set environment variable by adding the following lines at the bottom of .bashrc by "gedit ~/.bashrc":

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_03
export PATH=$PATH:$JAVA_HOME/bin

You can now check if the java is installed properly in terminal:

java -version
javac -version

These will return the version of java and javac.

Tuesday, April 24, 2012

Ubuntu Command Collection

  • install debian file:
sudo dpkg -i package_name.deb
  • install dependency:
sudo apt-get -f install
  • install software:
sudo apt-get -f install package_name
  • install bundle file:
sudo sh file_name.bundle
  • install bin/sh file:
chmod +x file_name.bin
./file_name.bin
  • Installing WIRESHARK's dumpcap without allowing non-root users to capture packets:
setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap
  • Find the MAC address:
ifconfig

References:
  1. WIRESHARK:

Monday, April 9, 2012

Generics are not supported in -source 1.3 error in Maven Project

When compiling via maven project, you may have encountered following error:
generics are not supported in -source 1.3 error in Maven Project. use -source 5 or higher to enable generics.

Annotation is not allowed in -source 1.3 use -source 5 or higher to enable annotation.

To solve this you must add the below lines at your pom.xml :


    
        
            org.apache.maven.plugins
            maven-compiler-plugin
            
                1.5</source>
                1.5
            
         
    

Tuesday, January 17, 2012

C++ : keywords

32 keywords defined by standard C.
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while

A list of some commonly used extended keywords:
asm  _cs  _ds  _es
_ss  cdecl  far  huge
interrupt  near  pascal

All C (and C++) keywords are lowercase. Also, uppercase and lowercase are
different: else is a keyword; ELSE is not.