2012/2/6

flush the memory space of cache

In Linux, you can clear the cache of the memory by using
free pagecache
echo 1 > /proc/sys/vm/drop_caches


free dentries and inodes
echo 2 > /proc/sys/vm/drop_caches
free force cache
echo 3 > /proc/sys/vm/drop_caches

At last, remember to type
echo 0 > /proc/sys/vm/drop_caches
echo 0 > /proc/sys/vm/drop_caches
Another method, 
Method 2:

echo 1 > /proc/sys/vm/drop_caches
    or
sysctl -w vm.drop_caches=1

Method 3:
fcntl(fd, F_SETFL, O_DIRECT)

Method 4:
sysctl -w vm.vfs_cache_pressure=n  (n > 100)

this make kernel to free cache frequencily.

2011/2/12

To make HUAWEI E800 modem usb care working for Linux-like OS (Mandriva 2010.2)

They provide driver:
Unzip and read the guide in PDF file.
Following the step (Here are simple methods):
1. ./install
2. Reboot
3. Tools -> system tools -> configure your computer -> Network and internet -> setup a new network
4. Choose GPRS/3G and following
Finally, it will work with HUAWEI card.
I make it working in my Mandriva 2010.2 OS system

2011/2/10

Installing browser plug-ins (Adobe Flash)

Flash plug-ins
Different plug-ins exist for viewing Flash content in browsers. Swfdec and Gnash are two open source and Free Software plug-ins which work natively on both i586 and x86_64. While they can be used to view most common Flash video animations on sites as YouTube, they can give problems on more complex Flash content. Adobe's proprietary Flash plug-in for Linux should be more complete, but it's not open source and there exists only an i586 version of this plug-in. The i586 Adobe Flash plug-in, can also be used on Mandriva x86_64 by using nspluginwrapper.

By preference, you only have one of these plug-ins at the same time installed. This way, you are sure that your preferred Flash plug-in is used, and not some other plug-in which is installed at the same time.
SWfdec
Install the swfdec-mozilla package with Mandriva's software installation tool
Gnash
Install gnash-firefox-plugin with Mandriva's software installation tool (Install & Remove Software in your applications menu). If you use Konqueror, install gnash-konqueror-plugin
Adobe Flash
Use Mandriva's software installation tool to make sure gnash-firefox-plugin and swfdec-mozilla are not installed, so they certainly cannot interfere with Adobe's Flash plug-in. If necessary, remove them from your system.

If you are using Mandriva x86_64 edition, make sure all media sources are configured, both i586 and x86_64 sources (see Making more software available).

On Mandriva x86_64, use the software installer to make sure the nspluginwrapper package is installed

Go to http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash and choose to download the Flash RPM for Linux. A window will pop-up asking whether you want to save the file on your disk or whether you want to install it with the Software Installer. Choose the latter option. The Flash plug-in and all the libraries it requires, will be installed automatically

As an alternative to the previous step, you can also install the flash-player-plugin package with Mandriva's Software Installer if you have configured the PLF i586 non-free repository

If you are using Mandriva x86_64 and Flash is still not shown in about:plugins after installing the plug-in, make sure libflashplayer.so exists in either /usr/lib/mozilla/plugins or in /usr/lib64/mozilla/plugins (if necessary, copy or link this file from /usr/lib/flash-plugin), open a terminal (Terminal or Konsole in the applications menu - Tools) and execute this command

nspluginwrapper -v -a -i

If you don't have sound working in Flash animations, make sure you have the packages libflashsupport and libpulseaudio0 installed.


2010/8/27

security for sshd server

Recently, I suffer a lot attack from china IP.
I set some security rules for sshd server
1. edit sshd_configure
PermitRootLogin no
MaxAuthTries 2
PermitEmptyPasswords no
PasswordAuthentication yes
UsePAM yes

2. edit /etc/hosts.deny
ALL: {IP from fuck damn China}
or
sshd: {IP from fuck damn China}

The IP can check from http://www.ipdeny.com/ipblocks/

3. apply pam
auth required pam_stack.so service=system-auth
auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/sshd_user_deny_list onerr=succeed
account required pam_nologin.so
account required pam_stack.so service=system-auth
password required pam_stack.so service=system-auth
session required pam_stack.so service=system-auth
session required pam_loginuid.so


Touch directories recursively

Some linux or unix workstation may clean your files that you do work for a long after a period.
But sometime some file we do not expect the system to clean like as file of lib.
The solution is write a script to touch them.
Actually, "touch" can not touch recursively in linux system.
However, I find a solution in web. could solve this problem.

find ~/lib -exec touch {} \;

2010/7/22

PC-clusters on Fedora 13 by using MPICH2

Recently, Due to some reason, I have to wake up my memory on setting pc-clusters on redhat long time age and then doing it again on Fedora 13.

PC-cluster:
NFS + NIS + (SSH or RSH) + intel compiler + MPICH2

1. update your system
* Set up your network to make it work well
* yum update OR yum upgrade
* Shut down the firewall and SELinux
=>System => Administration => Firewall=> disable
=>System => Administration => SELinux management => disable
=> vim /etc/selinux/config => SELINUX=disabled
=> vim /boot/grub/menu.lst => add "selinux=0" in back of kernel
* Shut down the service you do not need because we don't have firewall
=> sendmail, iptables, ip6tables, httpd, cup and etc.

2. hosts
* The inner computer must can be checked each others
=> 192.168.10.1 n1
=> 192.168.10.2 n2
=> 127.0.0.1 n1 localhost
* This is very important step. If you have the message as using mpd later like that
=> conn error in connect_rhs: Connection refused
(connect_rhs 979): failed to connect to rhs at 127.0.0.1 48503
(enter_ring 886): rhs connect failed
failed to enter ring
* This due to the n2 always connect to itself as checking the hosts file
* You have to change the localhost to the last line, and put 192.168.10.2 n2 in first line

3. NFS
rpm: nfs , nfs-utils, rpcbind (before fedora 7 is portmap)
on n1
* I want to share the /home and /opt to n2
* vim /etc/exports
=> /home 192.168.10.0/24(rw,async,no_root_squash)
=> /opt 192.168.10.0/24(ro,async)
* restart the nfs and rpcbind
* observe whether it work
=> check /var/log/messages
=> showmount -e n1
=> netstat -utln
=> rpcinfo -p n1
On n2
* restart rpcbind
* Can it find the n1 share
=> showmount -e n1
* Mount n1 share to n2
=> mount -t nfs n1:/home /home
=> mount -t nfs n1:/opt /opt
* edit the /etc/fstab
=> n1:/home /home nfs defaults 1 2
=> n1:/opt /opt nfs async,auto,ro,exec,nouser

4. NIS
rpm: yp-tools,ypbind,ypserv,rpcbind
on n1 (NIS server):
**set nis domainname
=>nisdomainname aaa
=>vim /etc/rc.d/rc.local
=>/bin/nisdomainname aaa
=> add "NISDOMAIN=vbirdnis" in /etc/sysconfig/network
**edit main configure file
=>vim /etc/ypserv.conf
127.0.0.0/255.255.255.0 : * : * : none
192.168.10.0/255.255.255.0 : * : * : none
* : * : * : deny

**edit the trust group
=>touch /etc/netgroup
**restart the service: rpcbind, ypserv, yppasswdd
**set the user and password to database for ypserver
=>/usr/lib/yp/ypinit -m
***If the error message says miss some file, just touch it
=>touch /etc/aliases
=>/usr/lib/yp/ypinit -m
**restart the service: rpcbind, ypserv, yppasswdd

on n2 (NIS client):
rpm: ypbind, yp-tools
**set nis domainname as same as n1 server
=>nisdomainname aaa
=>vim /etc/rc.d/rc.local
=>/bin/nisdomainname aaa
=> add "NISDOMAIN=vbirdnis" in /etc/sysconfig/network

**change user and password in authentication
=>vim /etc/nsswitch.conf
passwd: files nis
shadow: files nis
group: files nis
hosts: files nis dns

**edit authconfig
=>vi /etc/sysconfig/authconfig
USENIS=yes <- change no to yes

**edit pam
=>vi /etc/pam.d/system-auth
"password sufficient /lib/security/$ISA/pam_unix.so nullok use_authtok md5 shadow"
change to
"password sufficient /lib/security/$ISA/pam_unix.so nullok use_authtok md5 shadow nis"

**set which server to look up
=>vi /etc/yp.conf
domain aaa
server n1

**restart ypbind and rpcbind

**test
=>yptest

5. SSH
rpm: sshd
server: n2
client: n1
**Actually, n1 and n2 always turn on ssh server as the operating system installing

**restart sshd

**no password log in n2 (MPICH2 user-manual suggest)
on n1 (client):
=>ssh-keygen -t rsa
=>cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys

on n2 (server):
**switch on sshd to RSA Authentication
=>vim /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

**restart sshd


6. intel compiler

7.MPICH




To be continued

2010/7/4

Linux Code Editor, programming editor, Syntax Highlight

* cooledit
It's my preferred edit. I like it's style, background color, fonts. However, It only support by Mandriva not work for other linux-like OS.

* SciTE
SciTE is a SCIntilla based Text Editor. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. It is best used for jobs with simple configurations - I use it for building test and demonstration programs as well as SciTE and Scintilla, themselves.

*Bluefish
Bluefish is a powerful editor targeted towards programmers and webdesigners, with many options to write websites, scripts and programming code. Bluefish supports many programming and markup languages, and it focuses on editing dynamic and interactive websites. See features for an extensive overview, take a look at the screenshots, or download it right away. Bluefish is an open source development project, released under the GNU GPL licence.

* Scribes


2010/6/22

Usage of sed II: insert a line into files

You can insert a new line before the pattern with the "i" command:
insert "testtest" into 100 line in a.txt
sed -i '100i testtest' a.txt

Append a line with 'a'
The "a" command appends a line after the range or pattern. This example will add a line after every line with "WORD:"
exchange insert 'i' to 'a'
insert "testtest" into 100 line in a.txt, you can also rewrite with a in
sed -i '99a testtest' a.txt

To fin any number in file, and then replace to "asdf"
sed -n '/EXPORTFNAME/s/[0-9][0-9]*/asdf/p' FILE

2010/5/7

VirtualBox on Mandriva 2010

Due to playing game, I need to set up a virtual windows XP.
The virtualbox is a good choice.

1. urpmf --name virtualbox (root)
To find the package you want to install
suggestion: virtualbox, dkms-virtualbox, dkms, virtualbox-guest-additions
2. urpmi dkms; urpmi virtualbox, urpmi dkms-virtualbox, urpmi virtualbox-guest-additions

3. run virtualbox from menu: Toos-> Emulator -> VirtualBox OSE (normal user)

4. install win XP

5. This step is very important.
As win XP installing down, please press right-ctrl to out of virtualbox.
Press device, then choose install Guest Addition to make sure having VGA driver, DirectX

6. reboot XP

7. Down

reference:
http://forum.sabayonlinux.org/viewtopic.php?f=5&t=8280
http://wiki.mandriva.com/en/2010.0_RC_1

2010/5/6

Using VNC to login from other OS to linux

1. install tightvnc-server
type as root "urpmi tightvnc-server"
2. install vncviewer
type as root "urpmi tightvnc"
3. Edit the file /etc/sysconfig/vncservers and add a line like this: Code:
VNCSERVERS="1:yourusername"
4. Logged in as yourself
type "vncserver :1 -geometry 1024x768 -depth 24" to start vncserver
set password as logging "'vncpasswd"
kill vncserver please type "vncserver -kill :1"
5. Create the file .wmrc in your home directory and add a single line with either KDE or GNOME
vi .wmrc => KDE

Note:
a) If you log as root, then command as "vncserver :1 .........". The external logged user will log as root
b) When you log form other machine, the command like IP:1 (port please refer to ~/.vnc/*:1.log)

reference:
English=>
http://www.aerospacesoftware.com/vnc-howto.html
http://wiki.linuxquestions.org/wiki/VNC
Han's character =>
http://jimmy.med93.org/debian/TightVNC_遠端桌面
http://linux.vbird.org/linux_server/0310telnetssh.php#vnc
http://www.l-penguin.idv.tw/article/vnc_server.htm
http://horse.nchc.org.tw/IPv6/VNC

2010/4/7

Content Management System

content management system (CMS) enables you to build Web sites and powerful online applications.
A content management system is software that keeps track of every piece of content on your Web site, much like your local public library keeps track of books and stores them. Content can be simple text, photos, music, video, documents, or just about anything you can think of. A major advantage of using a CMS is that it requires almost no technical skill or knowledge to manage. Since the CMS manages all your content, you don't have to.

More popular CMSs are on http://php.opensourcecms.com/
For example:
  • Portial:phpnuke, Xoops ,Joomla
  • Forums:phpbb ,discuz, smf, vbb, ipb
  • eCommerce:osCommerce, phpShop
  • Blogs:Lifetype, Wordpress, Movable Type
Joomla homepage: http://www.joomla.org/
Joomla homepage in taiwan: http://www.joomla.org.tw/

2010/3/2

The user home in apache mandriva 2010

The apache in mandriva 2010 would not install mod_userdir automatically.
You have to install it by typing "urpmi mod_userdir"

2010/2/4

The difference between different kernel in Mandriva Linux

Due to they being complicated as I install the Mandriva Linux, I do not understand what kernel-XXX means.
reference: http://wiki.mandriva.com/en/Docs/Howto/Mandriva_Kernels

2009/12/22

set up your own blogger by WordPress

WordPress is a state-of-the-art publishing platform with a focus on aesthetics, web standards, and usability. WordPress is both free and priceless at the same time.

With famous 5-minute installation: http://codex.wordpress.org/Installing_WordPress


Install Google Chrome browser (beta)

If your Official Mandriva distribution medias do not provide

go to rpm search http://rpm.pbone.net/

search "chromium-browser"

You will find your distribution rpm

2009/12/8

Usage of mencoder II

mencoder input.avi -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video \
-oac copy other_options -o output.mpg
mencoder output.avi -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video -oac copy -o outputmpg.mpg



mbd=<0-2> (also see *cmp, qpel)
Macroblock decision algorithm (high quality mode), encode each macro block in all modes and choose
the best. This is slow but results in better quality and file size. When mbd is set to 1 or 2,
the value of mbcmp is ignored when comparing macroblocks (the mbcmp value is still used in other
places though, in particular the motion search algorithms). If any comparison setting (precmp,
subcmp, cmp, or mbcmp) is nonzero, however, a slower but better half-pel motion search will be
used, regardless of what mbd is set to. If qpel is set, quarter-pel motion search will be used
regardless.
0 Use comparison function given by mbcmp (default).
1 Select the MB mode which needs the fewest bits (=vhq).
2 Select the MB mode which has the best rate distortion.


trell
Trellis searched quantization. This will find the optimal encoding for each 8x8 block. Trellis
searched quantization is quite simply an optimal quantization in the PSNR versus bitrate sense
(Assuming that there would be no rounding errors introduced by the IDCT, which is obviously not
the case.). It simply finds a block for the minimum of error and lambda*bits.
lambda
quantization parameter (QP) dependent constant
bits
amount of bits needed to encode the block
error
sum of squared errors of the quantization

2009/11/10

How to apply mencodes to convert image (jpg,png) to movie or animation (avi,mpeg)

MEncoder is capable of creating movies from one or more JPEG, PNG or TGA files. With simple framecopy it can create MJPEG (Motion JPEG), MPNG (Motion PNG) or MTGA (Motion TGA) files.

Explanation of the process:
  1. MEncoder decodes the input image(s) with libjpeg (when decoding PNGs, it will use libpng).
  2. MEncoder then feeds the decoded image to the chosen video compressor (DivX4, XviD, ffmpeg msmpeg4, etc...).

Examples

The explanation of the -mf option can be found below in the man page.

Creating a DivX4 file from all the JPEG files in the current dir:
mencoder -mf on:w=800:h=600:fps=25 -ovc divx4 -o output.avi \*.jpg

Creating a DivX4 file from some JPEG files in the current dir:
mencoder -mf on:w=800:h=600:fps=25 -ovc divx4 -o output.avi frame001.jpg,frame002.jpg

Creating a Motion JPEG (MJPEG) file from all the JPEG files in the current dir:
mencoder -mf on:w=800:h=600:fps=25 -ovc copy -o output.avi \*.jpg

Creating an uncompressed file from all the PNG files in the current dir:
mencoder -mf on:w=800:h=600:fps=25:type=png -ovc rawrgb -o output.avi \*.png

Note: Width must be integer multiple of 4, it's a limitation of the RAW RGB AVI format.

Creating a Motion PNG (MPNG) file from all the PNG files in the current dir:
mencoder -mf on:w=800:h=600:fps=25:type=png -ovc copy -o output.avi \*.png

Creating a Motion TGA (MTGA) file from all the TGA files in the current dir:
mencoder -mf on:w=800:h=600:fps=25:type=tga -ovc copy -o output.avi \*.tga


reference: http://web.njit.edu/all_topics/Prog_Lang_Docs/html/mplayer/encoding.html


Examples. The explanation of the -mf option is in the man page.

Creating an MPEG-4 file from all the JPEG files in the current directory:

mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc lavc \
-lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi

Creating an MPEG-4 file from some JPEG files in the current directory:

mencoder mf://frame001.jpg,frame002.jpg -mf w=800:h=600:fps=25:type=jpg \
-ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi

Creating an MPEG-4 file from explicit list of JPEG files (list.txt in current directory contains the list of files to use as source, one per line):

mencoder mf://@list.txt -mf w=800:h=600:fps=25:type=jpg \
-ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi

You can mix different types of images, regardless of the method you use — individual filenames, wildcard or file with list — provided of course they have the same dimensions. So you can e.g. take title frame from PNG file, and then put a slideshow of your JPEG photos.

Creating a Motion JPEG (MJPEG) file from all the JPEG files in the current directory:

mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc copy -oac copy -o output.avi

Creating an uncompressed file from all the PNG files in the current directory:

mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc raw -oac copy -o output.avi

Note

Width must be integer multiple of 4, it is a limitation of the RAW RGB AVI format.

Creating a Motion PNG (MPNG) file from all the PNG files in the current directory:

mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc copy -oac copy -o output.avi

Creating a Motion TGA (MTGA) file from all the TGA files in the current directory:

mencoder mf://*.tga -mf w=800:h=600:fps=25:type=tga -ovc copy -oac copy -o output.avi



reference: http://www9.mplayerhq.hu/DOCS/HTML/en/menc-feat-enc-images.html

My example convert png to xvid
mencoder mf://*.png -mf w=800:h=600:fps=12:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -o output.avi

2009/10/28

Bluefish-tool of webdesign

Bluefish is a powerful editor targeted towards programmers and webdesigners, with many options to write websites, scripts and programming code. Bluefish supports many programming and markup languages, and it focuses on editing dynamic and interactive websites. See features for an extensive overview, take a look at the screenshots, or download it right away. Bluefish is an open source development project, released under the GNU GPL licence.

Homepage: http://bluefish.openoffice.nl/

2009/10/20

Add more color fot xmgrace

edit Default.agr

***********************************************
@map color 16 to (60,179,113), "MediumSeaGreen"
@map color 17 to (0, 149, 182), "BondiBlue"
@map color 18 to (123, 160, 91),"Asparagus"
@map color 19 to (181, 166, 66), "Brass"
@map color 20 to (150, 75, 0), "Brown"
@map color 21 to (240, 220, 130), "Buff"
@map color 22 to (255, 20, 147), "DeepPink"
@map color 23 to (255, 99, 71), "Tomato"
@map color 24 to (209, 226, 49), "Pear"
@map color 25 to (128, 128, 0), "Olive"
@map color 26 to (0, 0, 128), "NavyBlue"
@map color 27 to (212, 175, 55), "Gold"
@map color 28 to (185, 78, 72), "Deepchestnut"
@map color 29 to (233, 150, 122), "DarkSalmon"
@map color 30 to (139, 0, 139), "DarkMagenta"
***************************************************************

2009/8/17

Some option of PETSc

This is reminded me not for all user.
1cup:
./run.exe -inputfile input.txt -ksp_type preonly -pc_type lu -pc_factor_shift_nonzero -snes_rtol 1.e-5 -snes_max_it 6 -iterations 5000000 -snes_monitor -dump_data_cycle 200 -CONSTANT_TIME_STEP -dump_data 3020

2009/8/5

PETSc with intel MKL

Fastest option:
./config/configure.py --with-clanguage=c++ --with-fc=0 --with-cc=mpicc --with-cxx=mpicxx --with-debugging=0 --with-vendor-compilers=intel --with-blas-lapack-dir=/opt/intel/Compiler/11.0/083/mkl/lib/32

2.3.3
./config/configure.py --with-clanguage=c++ --with-fc=0 --with-cc=mpicc --with-cxx=mpicxx --with-debugging=0 --with-vendor-compilers=intel --with-gnu-compilers=0 --with-x=0 --with-mpi-dir=/opt/mpich-intel/ --CXXFLAGS="-Kc++ -O2" --CFLAGS=-O2 --CPPFLAGS=-O2 --CXX_CXXFLAGS="-Kc++ -O2" --with-blas-lapack-dir=/opt/intel/mkl/10.1.1.019/


3.0.0
./config/configure.py --with-clanguage=cxx --with-fortran=0 --with-windows-graphics=0 --with-cc=/opt/mpich-intel/bin/mpicc --with-cxx=/opt/mpich-intel/bin/mpicxx --with-gnu-compilers=0 --with-vendor-compilers=intel --CC=/opt/mpich-intel/bin/mpicc --CXX=/opt/mpich-intel/bin/mpicxx --with-fc=0 --with-debugging=no --CFLAGS='-O2' --CXXFLAGS='-O2' --CXX_CXXFLAGS='-O2' --with-mpi-dir=/opt/mpich-intel --with-x=0 --with-x11=0 --with-blas-lapack-dir=/opt/intel/mkl/10.1.1.019/lib/64

running fast:
./config/configure.py --with-clanguage=cxx --with-fortran=0 --with-windows-graphics=0 --with-gnu-compilers=0 --with-vendor-compilers=intel --with-debugging=0 --with-errorchecking=0 --with-c++-support --with-log=0 --with-info=0 --CFLAGS=-O3 --CXXFLAGS=-O3 --with-mpi-dir=/home/benvar/lib/mpich2 --with-x=0 --with-x11=0 --download-c-blas-lapack=1

2009/7/21

convert images to movie using ffmpeg/mencoder

We often have a sequence of images from either
my experiment or from a simulation that I want
to put together into a movie. Since I use linux,
I wanted to do this using free software in linux,
and I wanted to be able to play the
movie in linux.


With mencoder, we can use the vbitrate option to
set the degree of lossy compression. Note that the
default mpeg4 option will add a "DivX" logo to the
movie when playin in windows media player, so we
prefer to use one of the other mpeg4 encoders, such
as msmpeg4 or msmpeg4v2. The commmand line I've used is:

mencoder "mf://*.jpg" -mf fps=10 -o test.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800

We can also use ffmpeg directly to encode the
images files into a movie. If we start with
files name 001.jpg, 002.jpg, ..., we can use:

ffmpeg -r 10 -b 1800 -i %03d.jpg test1800.mp4

Reference:
http://electron.mit.edu/~gsteele/ffmpeg/

2009/5/22

Linux PDF editor for manipulating PDF documents

Adobe Acrobat is a commercial tool for manipulating PDF files. Earlier I was using CUPs - printing system, to export PDF files. I've also tried out gv for the same purpose. However, I needed complete editing of pdf documents. My search ended with PDFedit software, which is free and open source editor for manipulating PDF documents. The software available in both GUI and CLI (commandline) interface.

Install PDFEdit

  • Mandriva Linux

urpmi pdfedit

  • Ubuntu Linux

sudo apt-get install pdfedit

Reference: http://www.cyberciti.biz/tips/open-source-linux-pdf-writer.html

How to put variable in sed command

I declare a variable in bash

VALUE=dance

How to put it in sed command like that:

sed 's/hop/$VALUE/' filename

Solution:

sed 's/hop/'"$VALUE"'/' filename

OR

sed 's/hop/'$VALUE'/' filename

Two method are worked.

2009/5/11

MPICH2: the md5 module is deprecated

Due to Mandriva 2009 upgrade to Mandriva 2009 spring, as you type mpd&
You will get like this message:
The popen2 module is deprecated.
the md5 module is deprecated; use hashlib instead from md5

please refer to this article : http://trac.mcs.anl.gov/projects/mpich2/attachment/ticket/362/mpd_deprecated_workaround.patch

or
edit
mpdlib.py
add
*************************************************************
import warnings
warnings.filterwarnings('ignore', '.*the md5 module is deprecated.*', DeprecationWarning)
warnings.filterwarnings('ignore', '.*the popen2 module is deprecated.*', DeprecationWarning)
****************************************************************

2009/4/24

Linux connected to a Windows print server

chkconfig your system that is CUPS on?
if no, please turn it on.
open firefox type http://localhost:631

If you are connected to a Windows print server (or any other Samba capable print server), you can skip the section about kernel modules and such. All you have to do is start the CUPS daemon and complete the web interface as specified in section 3.3 and 3.4. Before this, you need to activate the Samba CUPS backend. You can do this by entering the following command:

# ln -s `which smbspool` /usr/lib/cups/backend/smb

Note that the symbol before is ` (underneath the ~ on a standard US keyboard) and not '. After this, you will have to restart CUPS using the command specified in the previous section. Next, simply log in on the CUPS web interface and choose to add a new printer. As a device choose "Windows Printer via SAMBA".

For the device location, enter:

smb://username:password@hostname/printer_name

Or without a password:

smb://username@hostname/printer_name

Make sure that the user actually has access to the printer on the Windows computer. Select the appropriate drivers and that's about it. If the computer is located on a domain, make sure the username includes the domain:

smb://username:password@domain/hostname/printer_name

Note: If your network contains many printers, use lpoptions -d your_desired_default_printer_name to set your preferred printer

Note: I, thepizzaking, was having 'NT_STATUS_ACCESS_DENIED' errors and to fix them I needed to use a slightly different syntax:

smb://workgroup/username:password@hostname/printer_name
reference: http://wiki.archlinux.org/index.php/CUPS#Windows_to_Linux

2009/3/17

2D data plot

QtiPlot description

QtiPlot is a data analysis and scientific plotting.

QtiPlot is a data analysis and scientific plotting. Free clone of Origin.
QtiPlot uses Qt and the excellent libraries Qwt, GSL, QwtPlot3D and Ingo Berg's Fast Mathematical Parser.


SciGraphica

SciGraphica description
SciGraphica is a scientific data visualization and analysis application. It supplies many of the basic plotting features for 2D and 3D charts. It features opening several worksheets and plots to work with at the same time and PS output.
The libscigraphica libraries are the kernel of the program and provide all the widgets and dialogs, as well as the new plugin system.

2009/3/13

DVD Ripper for Linux (convert DVD to avi or DivX)

Linux DVD Ripper category lists several perfect and cool programs to ripping DVD to AVI file. All software below is picked through a series of testing by our editors. They not only are DVD movie ripping software but also rip, convert DVD to OGG, DivX, XviD, MPEG4(.mp4), etc file on Linux. The converting process is easy and fast, and created video quality is beyond your imagination. Do not hesitate. Free download the DVD Ripper for Linux to start converting at once!

Thoggen

Linux DVD RipperThoggen is a DVD Ripper utility for Linux, based on GStreamer and Gtk+. Thoggen is Linux DVD Ripper software designed to be easy and straight-forward to use. It attempts to hide the complexity many other transcoding tools expose and tries to offer sensible defaults that work okay for most people most of the time.

Free Download

Supported formats
OGG/Theora: - Theora video with Vorbis audio in an OGG container (in case you have not heard of Theora before: it is basically what Vorbis is for audio - a patent-free, royalty-free codec that can be implemented by anone and is supported by recent versions of all major media players on all major platforms).
AVI/DivX/MPEG4: - More formats, like MPEG4/DivX/XviD in AVI etc., will be added once the core functionality has been finished and works reliably.

Requirements:
GStreamer core 0.10.10 or newer
GStreamer plugins required: a52dec, mpeg2dec, dvddemux, dvdreadsrc, theoraenc, vorbisenc, oggmux, videorate, and others (see README for details of versions required)
Gtk+ 2.8.0 or newer
libdvdread3 (version 0.9.4 or higher)
HAL, libhal, dbus, and the dbus GLib bindings

Key Features

  • Easy to use, with a nice graphical user interface (GUI)
  • Supports title preview, picture cropping, and picture resizing.
  • Language Selection for audio track (no subtitle support yet though)
  • Encodes into OGG/Theora video.
  • Can encode from local directory with video DVD files.
  • Based on the GStreamer multimedia framework, which makes it fairly easy to add additional encoding formats/codecs in future.

dvdrip

dvd ripper for linuxdvdrip is a full featured Linux DVD Ripper program written in Perl. It provides an easy to use but feature-rich Gtk+ GUI to control almost all aspects of the ripping and transcoding process. It uses the widely known video processing swissknife transcode and many other Open Source tools. dvdrip itself is licensed under GPL / Perl Artistic License.

Free Download

Key Features

  • Runs on Linux, FreeBSD, OpenBSD (and probably other Unices) and does not depend on anything produced in Redmond - pure Open Source!
  • Rip to harddisk, on the fly or from an existent DVD image
  • Select audio track(s), viewing angle(s), multitple titles
  • Rip as much audio tracks as you like into one AVI/OGG/SVCD file
  • Supports nearly all of transcode's video codecs, e.g: divx4, divx5, xvid, xvidcvs, ffmpeg, fame, opendivx and mpeg2enc
  • DivX/Xvid multipass encoding
  • (S)VCD modes, with multiple audio tracks for SVCD
  • Integrated video bitrate calculator based on target size resp. number of discs
  • Automatic splitting of the target files for best fit on the specified number of discs
  • Several deinterlace filter presets
  • Audio AC3 and PCM passthrough
  • Audio MP3 encoding
  • Audio volume maximizing and/or range compression
  • OGG/Vorbis support, quality and bitrate based, adjusting the optimal video bitrate after audio transcoding in quality mode
  • WAV file creation from a selected audio track
  • Subtitle rendering and vobsub creation
  • Support for all transcode video filters, with realtime configuration and video preview
  • Live video transcoding preview window
  • Chapter mode: one file per chapter
  • Use your favorite movie player for preview
  • Provide frame clipping, resizing and final clipping
  • Powerful auto adjusting of all clip & zoom parameters
  • Adjust clipping area using drag and drop
  • dvdrip's zoom calculator let you adjust every possible parameter, if you like to do so
  • Two resize modes: fast and high quality resizing
  • Simple but easy to use CD burning facility
  • Last but not least a comprehensive cluster mode, which let you use all your Linux/Unix hardware for parallel encoding

bitterbpp

linux dvd rippingDescription: bitterbpp is Linux DVD ripping software, a GUI interface for MPlayer, specifically for transcoding DVD titles (video, audio, and subtitles) to Matroska file format. It has some nice features.

Free Download

Disclaimer: bitterbpp may not be used to make illegal copies of DVD movies; in fact, it functionally cannot since it depends entirely on MPlayer and lsdvd to read and process the DVD structure. So if you cannot legally (local laws, etc) make a backup copy of a DVD you legally own, you may not use this software in conjunction with MPlayer to do so. In fact, if for you the previous statement is true, I wouldn't even visit the MPlayer site, let alone download MPlayer.

Design: bitterbpp is designed as a lightweight, feature rich GUI "wrapper" to MPlayer, lsdvd and various other related software. As such, bitterbpp is an application written in Perl, utilizing the Gtk+ 2.x Perl bindings. Since it has some typically non-portable methods and system calls designed for Linux compatible systems, I don't suggest using this in any untested environment (Mac OS X, Windows, etc).

Feature list: Recompresses any selected movie track in 2 passes (or n passes if desired) using one of four configurable codecs, to fit chosen space and scaling requirements. Scaling calculations are based on bits per pixel estimates, hence the name bitterbpp; Unlimited audio tracks (in original AC3 or DTS, or recompressed to OGG Vorbis) and unlimited subtitle tracks, with proper language support.


Thoggen homepage: http://thoggen.net/


dvdrip homepage: http://www.exit1.org/dvdrip/


bitterbpp homepage:

DVD Backup Burner Copy for Linux

Linux DVD Burner, Linux DVD Copy, Linux DVD Backup software category lists several perfect and cool programs to burning DVD for Linux, copy DVD movies for Linux, backup DVD for Linux. All software below is picked through a series of testing by our editors. They not only are DVD movie copy software but also burning video files to DVD on Linux. The converting process is easy and fast, and created video quality is beyond your imagination.

K9Copy

K9Copy is a small utility which allows the copy of DVD on Linux. The DVD video stream is compressed by the program Vamps

homepage: http://k9copy.sourceforge.net/

Copy without menus :
In this case, dvdauthor is used to create a new DVD structure. It is possible to choose the order in which the video sequences are played.
Copy with menus :
As dvdauthor does not make it possible to integrate the original menus, K9Copy reproduces the original structure of the DVD. The navigation packs as well as IFO files are modified to point on the compressed MPEG stream.

Key Features

  • The video stream is compressed to make the DVD fit on 4.7 Gb recordable DVD
  • DVD Burning for Linux
  • Creation of ISO images
  • Possibility of selecting the audio tracks and subtitles to be copied
  • Title preview (video only)
  • Possibility of preserving the original menus


GEAR PRO for Linux

GEAR PRO for Linux is the leading professional CD-Recordable software for Linux platforms. GEAR incorporates the latest advances in optical storage technology including rewritable support, with the uncompromising quality and reliability users have come to expect from GEAR Software. This version supports both a GUI and CLI interface. GEAR PRO for Linux offers full CD-R, CD-RW ,DVD-R and DVD-RAM recording and pre-mastering. GEAR supports most drives on the market. GEAR PRO for Linux is the ideal application for Imaging, Mission Critical Archiving, CAD/CAM, Graphic Storage, Title Development and Pre-Master testing. With GEARTM PRO for Linux, users can easily and economically store software, large data sets, databases, audio, video and other assorted information to compact disk while maintaining total control over the formatting and mastering process. Power and Cross Platform Flexibility... GEARTM PRO for Linux supports the widest spectrum of file formats in the industry including ISO 9660, Digital Audio, Orange Book mastering modes and RockRidge which enables users to create true cross-platform media for readability between Windows and Linux platforms.

homepage: http://www.gearsoftware.com/

DVD Burner for Linux Functionality:

  • back up mission-critical data to CD and DVD media
  • pre-master audio, video, software and game titles
  • archive graphics, databases, email, third-party generated data files, music, digital photos and video
  • Create cross-platform discs compatible with Windows, UNIX and Mac platforms
  • replicate DVD and CD discs using a jukebox
  • distribute documents, marketing materials, and other data on a CD or DVD
  • copy non-protected DVDs and CDs
  • extract content from CD and DVD
  • use the media in your CD or DVD recorder for near-line incremental storage

DVD Burner for Linux Key Features:

  • Supports all current Linux kernel releases
  • Creation of CD and DVD images for all industry standard disc types including CD-Audio, CD-ROM, CD-XA, Enhanced CD, DVD-ROM, DVD-Video and DVD-Audio
  • DVD mastering capabilities for both single and dual sided discs
  • Physical format support for mastering DVD-5, DVD-9, DVD-10 and DVD-18
  • Able to format discs using ISO9660, UDF (Universal Disc Format), Rockridge and Joliet file extensions
  • Comprehensive CD and DVD recorder support for all industry standard media types including DVD+R/RW, DVD-R/RW, DVD+R dual-layer, DVD-RAM, CD-R and CD-RW
  • Support for DLT, Exabyte, and DDS/DAT recording devices for creating DDP (Dis Description Protocol) master tapes
  • Conversion of CD and DVD discs or projects to industry standard DDP 1.0 or 2.1 images for professional disc mastering
  • Jukebox and autoloader management for in-house mastering, unattended disc replication and multi-disc recording of large data sets for disc duplication
  • Batch file scripting capability allows for unattended recording or backup operations to CD and DVD
  • Support for links, pipes, device special files, etc with permission and group handling
  • Complete command and message-logging capability provides for documentation, post process diagnostics and improved error resolution
  • Easy to use Graphical User Interface

DVD Burner for Linux Formatting:

  • Supports all CD and DVD formats including CD-Audio, DDP, CD-ROM, CD-XA, Enhanced CD, DVD-ROM, DVD-Video and DVD-Audio
  • Provides DVD mastering for single or dual layer discs
  • Allows the import of DVD-Video disc images (VIDEO_TS folders) for the creation of DVD-Video titles
  • Enables the creation and manipulation of all industry standard file systems and file extensions including ISO9660, UDF 1.02 to UDF 2.5, Rock Ridge and Joliet
  • Fast virtual image building requiring less than 5% of the total image size to record
  • Direct-to-disc recording of files to UDF volumes

DVD Burner for Linux Recorder Support:

  • Supports all of the latest CD and DVD recordable drives as well as most legacy devices
  • Supports jukeboxes and media changers
  • Automatically initiates support for new recorders (automatic drive recognition) without requiring driver or configuration file updates
  • Supports test writing, CD and DVD recording speed setting, C2 error checking, multi-session disc creation, disc formatting and other advanced recorder features
  • Enables all recording methods including track-at-once, disc-at-once, session-at-once, raw recording and fixed and variable packet writing
  • Provides the capability to extract data and audio tracks (ripping)
  • Allows direct disc-to-disc CD and DVD copying

2009/3/5

How to convert jpg to gif

Here reveals very simple command. I suggest you have to read the convert help.
For example, if you want to convert many file named haha01.jpg, haha02.jpg, .... etc.
please type

convert -delay 500 haha*.jpg test.gif

delay time unit is (ms)
then , apply firefox to read test.gif like that

firefox test.gif

2009/3/4

Argument list too long when copying/deleting/moving files on Linux

If you do a lot of command line stuff in Linux, sooner or later you'll come across the "argument list too long" error when copying, moving, deleting, listing etc files in a directory that contains a lot of files. This post looks at a couple of ways of solving this problem.
will result in errors like this:
-bash: /bin/mv: Argument list too long
-bash: /bin/cp: Argument list too long
-bash: /bin/rm: Argument list too long
-bash: /bin/ls: Argument list too long

To workaround the problem you can use xargs or find, or a combination of the two.

Using the "ls" command, you could do this to move all the files from source into target:
ls -1 ./*.dat | xargs -i mv {} /home/user/targe/

Using find to do the same move from source to target, you could do this:

find . -name "*.txt" -maxdepth 1 -exec mv {} /home/user/targe/ \;
or this, using xargs instead of the -exec flag:
find . -name "*.txt" | xargs -i mv {} /home/user/targe/
Reference: http://www.electrictoolbox.com/argument-list-too-long-linux/

Blender

Blender is the free open source 3D content creation suite, available for all major operating systems under the GNU General Public License

Homepage: http://www.blender.org/

Resource in Taiwan: http://ossacc.moe.edu.tw/modules/tinyd1/index.php?id=66
in Wiki: http://en.wikipedia.org/wiki/Blender_(software)

GIMP

GIMP is an acronym for GNU Image Manipulation Program. It is a freely distributed program for such tasks as photo retouching, image composition and image authoring.

It has many capabilities. It can be used as a simple paint program, an expert quality photo retouching program, an online batch processing system, a mass production image renderer, an image format converter, etc.

GIMP is expandable and extensible. It is designed to be augmented with plug-ins and extensions to do just about anything. The advanced scripting interface allows everything from the simplest task to the most complex image manipulation procedures to be easily scripted.

Homepage: http://www.gimp.org/

Resource of how to use in Taiwan: http://163.20.160.21/xoops22/t167/gimp/list.htm

Or http://ossacc.moe.edu.tw/modules/tinyd1/index.php?id=60

2009/2/19

Gmail Notifier - Gmail Linux Checker from Your Desktop

I like to receive mail from gmail. However, The problem is if I am very busy, I will forget to check mailbox. Therefore, you can use Gmail Notifier to check your mail in gmail automatically
Homepage: http://gmail-notify.sourceforge.net/
Gmail Notifier is a Linux alternative for the notifier program released by Google, it is written in Python and provides an attractive and simple way to check for new mail messages.

When using rm:/bin/rm: Argument list too long

If you want to delete more than usual number file.
For example: rm -f *.dat
/bin/rm: Argument list too long
then you can solve by this way:
find . -name 'dat.*' | xargs rm
find . -name '*.dat' -depth 1 -delete
ls *.dat | xargs rm -f

2009/2/13

sed: How to

sed -n '2p' haha.dat => print the 2nd line in haha.dat
sed -n '3,4p' haha.dat => print the line 3th to 4th in haha.dat
sed -e '/^aaa bbb/s/source/object/' => find the first word is "aaa ddd" then substitute source to object.

sed -i -e '1,7 {/^READ BLOCK/s/".*\.dat"/"'$file_name'"/}'
-e 's/".*\.jpg"/"e_He_gif_sourcesink_Te_'$JPGNAME'\.jpg"/' $plot_batch

sed -n '3~5;' haha.dat => print from line 3 then every 5 line print (3,8,13,18.... will print)

Install Nvidia CUDA in mandriva 2009

It is very easy, as you install driver nvidia >= 177.70
Therefore if you had referred to my old article, urpmi nvidia was already >=177.70
CUDA complier is exist in our operation system, if your driver had worked.
Next, only having to to is rpm -ivh nvidia-cuda-toolkit-2.0-2mdv-2009-i586.rpm
OK, Finished.

2009/2/5

Usage sed and regular expression

sed - stream editor for filtering and transforming text
important argument:
-e -> add the script to the commands to be executed
-f -> add the contents of script-file to the commands to be executed
-i -> edit files in place (makes backup if extension supplied)

find the word "test.jpg" and replace to "qwer.jpg" in file plot.com
sed 's/".*\.jpg"/"testtest\.jpg"/' plot.com

.* -> any word
\. -> Escaped word "."
s/haha/nana/ -> replace the word haha to the word nana once
s/haha/nana/g -> replace the word haha to the word nana every time

2009/1/28

Kdenlive - Free and open source video editor

Kdenlive is an intuitive and powerful multi-track video editor, including most recent video technologies. Our software is completely free, in all sences of the expression, as defined by the GNU foundation. Using Kdenlive is investing in a community driven project, which aims to establish relationships between people in order to built the best video tools

Homepage: http://www.kdenlive.org/

Powerful features

Kdenlive is the most versatile video editor available today:

  • Support for a wide range of camcorders and cameras, including:
  1. Low resolution camcorder (Raw and AVI DV editing).
  2. Mpeg2, mpeg4 and h264 AVCHD (small cameras and camcorders).
  3. High resolution camcorder files, including HDV and AVCHD camcorders.
  4. Professional camcorders, including XDCAM-HD™ streams, IMX™ (D10) streams, DVCAM (D10) , DVCAM, DVCPRO™, DVCPRO50™ streams and DNxHD™ streams (decoding only, encoding untested). Please note that Kdenlive does not offer the original codecs, but only that we use FFmpeg free software codecs, which can read original streams and sometimes export as well. When you own a camcorder, there is no reason why you should not be able to read your own films.
  • Multitrack edition with a timeline and unlimited number of video and audio tracks.
  • Video and audio tracks organized in layers.
  • Tools to create, move, crop and delete video clips, audio clips, text clips and image clips.
  • Configurable keyboard shortcuts and interface layouts.
  • A wide range of effects and transitions. Ability to add custome effects and transitions.
  • Non-blocking rendering using a rendering separate application. Stop, pause and restart rendering. Continue to work on your project without any possible loss of data.
  • Export to standard formats:
  1. DV (PAL and NTSC).
  2. Mpeg2 (PAL, NTSC and HDV) and AVCHD (HDV).
  3. High quality h264.
  4. Non-destructive formats.

Mix video, audio and images to unleash your creativity

Modern filmakers need to mix different kinds of media, including video, audio and images. Kdenlive is built upon MLT and ffmpeg frameworks, which provide unique features to mix virtually any kind of media.

  • Mix different media without prior import:
  1. Any Video, audio or image files supported by Kdenlive.
  2. Custom profiles including resolutions, frame rates, PAR and DAR.
  • Support for a wide range of codecs and formats:
  1. Mpeg2, mp4 and h264 video.
  2. Mp2, mp3 and ac3 audio.
  3. Lossless video (SNOW lossless codec, etc ...).
  4. Free video (Ogg vorbis, etc ...).

2009/1/22

xmgrace and grace

Grace is a WYSIWYG 2D plotting tool for the X Window System and M*tif. Grace runs on practically any version of Unix-like OS
Homepage: http://plasma-gate.weizmann.ac.il/Grace/
The most important is that batch file
My sample:
********************************
* READ NXY "He-Raja-G01.rate" *
* READ NXY "He-Raja-G02.rate" *
* s0 line color 1 *
* s1 line color 2 *
* s0 legend "ionization" *
* s1 legend "Excitation" *
* PRINT TO "asfdaa.jpg" *
* HARDCOPY DEVICE "JPEG" *
* PRINT *
*********************************
Below samples are from wiki: http://ringo.ams.sunysb.edu/index.php/Xmgrace

Sample Xmgrace input batch file

READ NXY "5M030.rmsd1.txt"
READ NXY "5M030.rmsd2.txt"
s0 line color 1
s1 line color 2
s0 legend "pose1 rmsd"
s1 legend "pose2 rmsd"
title "RMSD"
xaxis label "time (ps)"
yaxis label "RMSD (angstroms)"
PRINT TO "${system}.eps"
DEVICE "EPS" OP "level2"
PRINT

Run Xmgrace with the command

xmgrace -batch temp.bfile -nosafe -hardcopy

where temp.bfile is the name of the batch file nosafe allows xmgrace to write the output eps plot hardcopy means make the plot and exit. Do not show gui.

For high resolution png file output with transperant background: The DEVICE "PNG" DPI dpi does not seem to change anything.

PRINT TO "output.png"
HARDCOPY DEVICE "PNG"
PAGE SIZE 2560, 2048
DEVICE "PNG" FONT ANTIALIASING on
DEVICE "PNG" OP "transparent:on"
DEVICE "PNG" OP "compression:9"
PRINT

Print to jpg

HARDCOPY DEVICE "JPEG"
DEVICE "JPEG" OP "optimize:on"
DEVICE "JPEG" OP "quality:100"
DEVICE "JPEG" OP "smoothing:40"
PRINT TO DEVICE
PRINT TO "testtest.jpg"
PRINT


2008/12/15

How to draw and view data when PETSc running

Example solve AX=B
vec X;
  • In source code
VecView(Vec vec,PetscViewer viewer)
VecView(X,PETSC_VIEW_STDOUT_SELF)
  • In command
VecViewFromOptions(Vec vec, char *title)
VecViewFromOptions(X,"TEST")


petscmpiexec -n 2 ./a.out -vec_view_draw -draw_pause 1

2008/12/2

How to play DOS game in linux

install dosbos
  1. uprmi dosbox
  2. dosbox (normal user)
  3. in dosbox commend terminal
  4. mount c /game-dir
  5. c:
  6. play.bat
OK!!

2008/11/27

Install MPICH2 in Mandriva 2009 single machine

  1. You will need the following prerequisites : download mpich2 from http://www.mcs.anl.gov/research/projects/mpich2/
  2. Set you environment : export CXX=icpc & export CC=icc
  3. ./configure --prefix=/home/YOU/MPICH2-install/ --enable-cxx --enable-sharedlibs=gcc
  4. make
  5. make install
  6. vi ~/.bashrc and plus "export PATH=/home/YOU/mpich2-install/bin:$PATH"
  7. touch ~/.mpd.conf
  8. touch .mpd.conf
  9. edit .mpd.conf to add line like that secretword=
It will work NOW! If your no-passwd sshd is work.
How to run a MPI program:
  1. mpd &
    mpdtrace
    mpdallexit
  2. mpdboot -n -f mpd.hosts
  3. mpd &
    mpdtrace -l
  4. mpdtrace
  5. mpdringtest 100
  6. mpiexec -n hostname
  7. mpiexec -n 2 c.out
  8. mpdallexit
Summary
  • How many processor: mpdboot -n -f mpd.hosts
  • mpd &
  • Run your parallel program: mpiexec -n 2 c.out
  • Clean mpd: mpdallexit

2008/11/26

The lastest MPICH-1 configure environment parameter

./configure --with-device=ch_p4 --with-arch=LINUX --with-mpe --enable-cxx --enable-mpedbg --enable-debug --enable-traceback -prefix=/opt/MPICH/ -c++=/opt/intel/Compiler/11.0/074/bin/ia32/icpc -cc=/opt/intel/Compiler/11.0/074/bin/ia32/icc -opt=-g -rsh=ssh

Confessions of a Linux Fan: 10 Things You Might Want To Know Before Switching Over To Linux

This article is I refer from http://thinkthick.blogspot.com/2007/07/confessions-of-linux-fan-10-things-you.html


Confessions of a Linux Fan: 10 Things You Might Want To Know Before Switching Over To Linux
1. The basic installation of most mainstream Linux distributions is very easy, but a first time user might run into trouble when trying to depart from the defaults.
2. If you want a proper Linux installation, you are going to have to mess around with the partition table.
3. You will have to learn how to use the command line.
4. All those pretty effects of wobbly windows and cube desktops require some work from the user.
5. Yes, more hardware works with Linux than with Windows. No, not all hardware works 100% like it's supposed to.
6. If you need/want to install a package not included in the repositories, or install from source, you might need to do some research.
7. Most mainstream software manufacturers forget about Linux.
8. Linux is not for the meek of heart.
9. Linux is almost entirely virus/trojan/spyware free, but you will still need some kind of protection.
10. Linux assumes that you are an intelligent person.

2008/11/25

Install Mandriva 2009

I had installed Mandriva 2009 for two days.
There are some of my thoughts:
  1. Beginning, The Mandriva 2009 will choose kernel-server-2.6.27.0
  2. After installed, Do not update anythings
  3. Put you install DVD into DVD-Rom, then update kernel to kernel-desktop-2.6.27.0 (which also support memory to 4GB). Or , suggestion, Using Easy urpmi to update to kernel-desktop-2.6.27.5. Please don't forget to install kernel source code.
  4. Type commend as root: urpmi nvidia
  5. If you are not kernel-desktop-2.6.27.5, it will update automaticly
  6. It will install x11-driver-video-nvidia-177.70, dkms-nvidia-current-177.70, nvidia-current-kernel-2.6.27.5-desktop and so on
  7. Type "XFdark" as root
  8. My video card is GeForce 9400GT, it will suggest choose "GeForce 6100 or later"
  9. Reboot, using kernel-desktop-2.6.27.5
Finished!!!!!!

2008/10/15

fstream

include
write to file:
ofstream ffile;
read file:
ifstream ffile;
open file:
ffile.open("filename");
check file:
ffile.is_open();
ffile.fail();
if(!ffile){
}
close file:
ffile.clear();
ffile.close();
ios_base:
ios::app
ios::ate
ios::binary
ios::in
ios::out
ffile.open("filename",ios::app | ios::out | ios::binary);

2008/9/25

Conditional operator <-> ternary operator

condition ? expression1 : expression2
C = A > B ? V1: V2;

if (A>B) C = V1;
elese C =V2;

2008/9/24

Distribution Data (DA)

DAGetInfo
Gets information about a given distributed array.
Synopsis
#include "petscda.h"
PetscErrorCode PETSCDM_DLLEXPORT DAGetInfo(DA da,PetscInt *dim,PetscInt *M,PetscInt *N,PetscInt *P,PetscInt *m,PetscInt *n,PetscInt *p,PetscInt *dof,PetscInt *s,DAPeriodicType *wrap,DAStencilType *st)
Input Parameter
da -the distributed array
Output Parameters
dim - dimension of the distributed array (1, 2, or 3)
M, N, P - global dimension in each direction of the array
m, n, p - corresponding number of procs in each dimension
dof - number of degrees of freedom per node
s - stencil width
wrap - type of periodicity, one of DA_NONPERIODIC, DA_XPERIODIC, DA_YPERIODIC, DA_XYPERIODIC, DA_XYZPERIODIC, DA_XZPERIODIC, DA_YZPERIODIC,DA_ZPERIODIC
st - stencil type, either DA_STENCIL_STAR or DA_STENCIL_BOX
Note
Use PETSC_NULL (PETSC_NULL_INTEGER in Fortran) in place of any output parameter that is not of interest.

DAGetCorners
Returns the global (x,y,z) indices of the lower left corner of the local region, excluding ghost points.
Synopsis
#include "petscda.h"
PetscErrorCode PETSCDM_DLLEXPORT DAGetCorners(DA da,PetscInt *x,PetscInt *y,PetscInt *z,PetscInt *m,PetscInt *n,PetscInt *p)
Input Parameter
da -the distributed array
Output Parameters
x,y,z - the corner indices (where y and z are optional; these are used for 2D and 3D problems)
m,n,p - widths in the corresponding directions (where n and p are optional; these are used for 2D and 3D problems)
Note
The corner information is independent of the number of degrees of freedom per node set with the DACreateXX() routine. Thus the x, y, z, and m, n, p can be thought of as coordinates on a logical grid, where each grid point has (potentially) several degrees of freedom. Any of y, z, n, and p can be passed in as PETSC_NULL if not needed.

2008/9/17

Data Visualizer

MayaVi
homepage: http://mayavi.sourceforge.net/index.html
  • An easy to use GUI.
  • Can be imported as a Python module from other Python programs and can also be scripted from the Python interpreter.
  • Provides modules to:
    • Visualize computational grids.
    • Visualize scalar, vector and tensor data.
  • Quite a few data filters are also provided.
  • Supports volume visualization of data via texture and ray cast mappers.
  • ParaView
    Homepage: http://www.paraview.org/New/index.html

    ParaView is an open-source, multi-platform application designed to visualize data sets of size varying from small to very large. The goals of the ParaView project include the following:

    • Develop an open-source, multi-platform visualization application.
    • Support distributed computation models to process large data sets.
    • Create an open, flexible, and intuitive user interface.
    • Develop an extensible architecture based on open standards.
    OpenDX
    Homepage: http://www.opendx.org/
    OpenDX gives you new control over your data...and new insights into their meaning. Yet OpenDX is easy to use because it lets you visualize data in ways you've never dreamed of--without getting bogged down in the technology.