Sunday, April 27, 2014

Java on linux and internet brower : chrome / firefox


Install java add on firefox / google chrome
Download
  1. Go to http://java.com and click on the Download button, http://www.java.com/en/download/
Java for Linux Platforms
The instructions below are for installing version Java 7 Update 7 (7u7). If you are installing another version, make sure you change the version number appropriately when you type the commands at the terminal. Example: For Java 6u35 replace 7u7 with 6u35. Note that, as in the preceding example, the version number is sometimes preceded with the letter u, and sometimes it is preceded with an underbar, for example, jre1.7.0_07.

  1. Change to the directory in which you want to install. Type:
    cd <directory path name>
    For example, to install the software in the /usr/java/ directory, Type:
    cd /usr/java/

    Note about root access: To install Java in a system-wide location such as /usr/local, you must login as the root user to gain the necessary permissions. If you do not have root access, install the Java in your home directory or a sub directory for which you have write permissions
  2. Move the .tar.gz archive binary to the current directory.
  3. Unpack the tarball and install Java
    tar zxvf jre-7u7-linux-i586.tar.gz

    The Java files are installed in a directory called jre1.7.0_07 in the current directory.
    In this example, it is installed in the /usr/java/jre1.7.0_07 directory.
  4. Delete the .tar.gz file if you want to save disk space.
Google Chrome
  • Become the root user by running the su command and then enter the super-user password. Type:
    sudo -s
  • Create a directory called plugins if you do not have it. Type:
    mkdir -p /opt/google/chrome/plugins
  • Go to Google chrome plugins directory before you make the symbolic link. Type:
    cd /opt/google/chrome/plugins
  • Create a symbolic link. Type:
    ln -s /usr/local/java/jre1.7.0/lib/amd64/libnpjp2.so
  • Restart your browser and test Java
Mozilla Firefox
  • Become the root user by running the su command and then enter the super-user password. Type:
    sudo -s
  • Create a directory called plugins if you do not have it. Type:
    mkdir -p /usr/lib/mozilla/plugins
  • Go to Google chrome plugins directory before you make the symbolic link. Type:
    cd /usr/lib/mozilla/plugins
  • Create a symbolic link. Type:
    ln -s /usr/local/java/jre1.7.0/lib/amd64/libnpjp2.so
  • or  sudo ln -s /usr/local/java/jre1.7.0_55/lib/i386/libnpjp2.so (use/lib/mozilla/plugins)
  • or  sudo ln -s /usr/local/java/jdk1.7.0_25/jre/lib/i386/libnpjp2.so
  • or sudo ln -s ./jdk1.7.0/jre/lib/i386/libnpjp2.so   (32 bit)
  • Restart your browser and test Java
Source: http://www.java.com/en/download/help/linux_install.xml 

Friday, April 25, 2014

Urgent PhD scholarship in School of Civil and Environmental Engineering - Structures, at Nanyang Technological University, Singapore

Urgent PhD scholarship available in School of Civil and Environmental Engineering - Structures, at Nanyang Technological University, Singapore
(may have less computational mechanics)
Looking for a high score GRE/ GATE student, planning for higher study (PhD program) in Singapore. If any of your student is willing then ask them to contact me by Tuesday evening (29/APRIL/2014).
Program Details : Research-PhD
Scholarship: $S 2000 to 2200 per month for 4 years.
Selection: good scores /CGPA/ GATE/ GRE
Require: BEng/M.Tech /M.S from good institute (All countries are eligible)
Final selection: Interview- Skype.
Contact email: anna0002@e.ntu.edu.sg or
venu.iisc@pmail.ntu.edu.sg or
annamdas.ntu@gmail.com

Wednesday, April 16, 2014

Screen Print, Video recorder, Image/ Video Converter in Linux, Ubuntu

Shutter program
mencoder (MPlayer's Movie Encoder) 
GTK Record My Desktop

Imagemagick to capture the screen in linux, Ubuntu

How to capture screen in Ubuntu

Install : $ sudo apt-get install imagemagick  

Capture whole screen: $ import -window root Image.png

Capture selected window: $ import Image.png

Capture frame: $ import -frame Pictures/Image.png

Capture selected window and resize: $ import -resize 320 -pause 3 Image.png


Convert video format .ogv to avi or mp4 

ffmpeg -i my-demo-video.ogv -vcodec mpeg4 -sameq -acodec libmp3lame my-demo-video.avi

ffmpeg -i out.ogv -vcodec libx264 -vpre medium -crf 24 -threads 0 -acodec copy foo.mkv

ffmpeg -i out.ogv -vcodec libx264 -vpre medium -crf 24 -threads 0 -acodec libfaac foo.mp4

Convert many files using shell
#!/bin/bash
# ovg2avi - Covert ovg to avi
# Author: Vivek Gite <www.cyberciti.biz> Under GPL 2.0+
# -------------------------------------------------------
input="$1"
output="${input%%.ogv}.avi}"

die(){
   echo -e "$@"
   exit 1
}

[ $# -eq 0 ] && die "Usage: $0 input.ovg\n\tI will convert .ovg file to .avi format."
[ ! -f "$input" ] && die "Error $input file not found."

if [ -f "$output" ]
then
read -p "Warning output file $output exists. Overwrite (y/n)? " ans
case $ans in
y|Y|YES|Yes) mencoder "${input}" -ovc lavc -oac mp3lame -o "${output}";;
esac

fi

Covert many file using bash
for o in *.ogv
do
   /path/to/ovg2avi "$o"

done

Sunday, April 13, 2014

Cygwin: Using Linux in Window


Cygwin: Get that Linux feeling - on Windows

Cygwin is:
  • a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.      
  • a DLL (cygwin1.dll) which provides substantial POSIX API functionality.
http://cygwin.com/

To install the new package: Run setup.exe again and select the desired package, tick on "Src?" square
Select “Install from Internet”

cygpath                Convert Unix and Windows format paths, or output system path information 
cygcheck             List system information, check installed packages, or query package database.
cygcheck -l test    list all file contain "test"
cygcheck -c  \      Check package and version number
dumper                Dump core from WIN32PID to FILENAME.core
getconf                Get configuration values


C/C++, Fortran, compiler with cygwin
- "gcc", "gdb", and "make" in the search separately to find the package, select the desired package
- it usually locates at "Devel" (development)
- $ g++ -v      : after instaled, go to cygwin terminal  to check whether gcc was installed
- $ cygcheck -c bash binutils bzip2 cygwin gcc-core gcc-g++ gcc-java gzip  m4 make unzip zip
                        check the package need for gcc
cygcheck -c  \
$ g++ --version   check g++ version   
$ gcc --version   check  gcc version 
- $ gcc -c program.c -o program      try to compile a file



ERRORS and problems solving
- vi/ vim error in Cygwin: error with backspace, arrow,  type "vim" in select packages> Search. Then select package: "vim", "gvim", "vim-common", "vim-minimal", "vim-debuginfo"
cp /usr/share/vim/vim7/vimrc_example.vim  ~/.vimrc
$ vim file.txt    use vim instead of vi, or u can make a short cut in .bashrc

Thursday, April 10, 2014

K3DSurf: visualize Mathematical models in 3, 4, 5 and 6 dimensions

K3DSurf is a free program to visualize and manipulate Mathematical models in three, four, five and six dimensions. K3DSurf supports Parametric equations and Isosurfaces.
http://k3dsurf.sourceforge.net/

Features

Studying mathematical surfaces with K3DSurf include doing:
  1. Interactive visualization with mouse events (Right: Rotate, Middle: translate and left: Scale).
  2. Real time animation (rotation) and morph (by the introduction of t_time variable). Animation and morph can also be monitored by controls that affect the CPU usage and t_time step.
  3. Creat screenshots by copying the draw window or by using the best ray tracer on the net: Povray.
    Creat movie scene is also supported
  4. Generat Mesh files that describe the shape of the mathematical model.
    Supported formats are:
    1. Povscript : Povray is the best ray tracer available on the net...and it's free.
    2. VRML2: to use with the majority of current browsers via an appropriate plug-in.
    3. OBJ: a well-known file format supported by the majority of 3D applications (Blender, MAYA and Moray...).

K3DSurf Usage

K3DSurf can be used by every one interested in 3D Mathematical drawing functions and don't require any special competences by users. Most of the work was done with the intention to make K3DSurf as simple as possible but without any harm of it's efficiency: 
  1. K3DSurf program is developed for being used by beginner users with low level degree in Mathematical science simply by testing examples (more than 50) given with it and by rendering them with Povray.
    Add/remove some functions from equations and visualize new results is the best way to understand 3D mathematical functions behaviours.
  2. 2D and 3D Designers: Pov scripts (and other file formats) generated by K3DSurf can also be integrated in complicated scenes. Adding textures to mesh objects under Povray, for examples, is straightforward.
  3. Teachers and height level students can study very complicated surfaces with K3DSurf. 4D/5D hyperobjects is another field where talented competences can give their best to discover new entity with artefacts that are not obvious to understand for a neophyte. 
Creating equations to represent specific shapes can be somewhat tricky and require experiences in both Mathematic field and 3D programing but the most "experience demanding", I think, is the creation of specific equations with specific behaviors when rotating in Hyperspace (4D/5D). 

Parametric Surface/curve :

K3DSurf use parametric descriptions of it's physical models. The parametric method of representing surfaces/curves uses a function to map some portion of R2 (the domain) to a patch of the surface in R3.
Because any position in the plane, and thus any position on the surface patch, can be uniquely given by two coordinates, the surface is said to be parameterized by those coordinates.
Parametric equations can be either “Implicit” or “Explicit”:
     ** Explicit equations:
         In an explicit equations, x, y, and z are each given by separate functions of parameters u and v.
         Example: X =u, Y = u+v, Z = cos(u+v)
     ** Implicit equations: Right now, only implicit equations like Z^n = f(X,Y) with (n mod 2 = 1) are supported by K3DSurf.
         Example: Z = exp(x^2 + y^2), Z^7 = exp(x*cos(y))...

Tuesday, April 8, 2014

Vi/vim linux text editor, useful tip

sudo apt-get install vim , to install the vim package

>> vi text.txt          use this command at the termimal
>> vi -r text.txt      open recovery unsaved file from previous work
 
Turn on color syntax for vi/vim permanent
$ cd ~     go to home directory
$ vi .vimrc
in editing of file    ".vimrc"
#---------------------------
syntax on
colorscheme morning

#-------
Options: morning, peachpuff, blue, murphy, ron, zellner, darkblue, desert, koehler, and shine

vi is case-sensitive


Main/ Command Mode
Esc         to escape from editor mode

:           to move the cursor to the bottom of the screen
: set nu
: set number                to show the line numbers
: set nonumber            to hiden the line numbers
: syntax on                   turn on syntax highlight in editor
: syntax off                   turn off syntax highlight in editor
: colorscheme elflord   change colorscheme
Options: morning, peachpuff, blue, murphy, ron, zellner, darkblue, desert, koehler, and shine


0                       move cursor to the beginning of the line
$                       move cursor to the end of the line

1G                    move cursor to the beginning of the file, line 1
:0 + Enter       move cursor to the beginning of the file, line 1
NG                   move cursor to the N number of lines of the file
:N + Enter      move cursor to the N number of lines of the file  
G                      move cursor to the end of the file, the last line
:$ + Enter       move cursor to the end of the file, the last line 

: f                     display current file name and line number

k                       move cursor up
j                        move cursor down
h                       move cursor up
l                        move cursor to the right

w                      move cursor to the beginning letter of the next word
b                       move cursor to the beginning letter of the previous word

                       undo previous

dd                      delete current line
dNd or Ndd      delete current and next N (number) lines
D                       delete the rest of the line from the current cursor
dw                     delete the word within cursor

yy                      copy current line
yNy or Nyy       copy current and next N (number) lines

p                        paste



EDITOR / INSER mode : 
            press "i" to go to this mode 
            press "Esc" to go back to the command mode

i                      to go to editor mode at the current cursor position
I                      to go to editor mode at the beginning of the line content a cursor

:q! + Enter       to quit or exit without saving
:wq! + Enter   to save and exit
:x + Enter        to quit and write



Wednesday, April 2, 2014

Reference/ bibliography: bibtex, endnote, jabref, mendeley