Monday, September 19, 2011

combine multiple pdfs into one with pdftk

http://maketecheasier.com/combine-multiple-pdf-files-with-pdftk/2010/02/22

http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

At first glance this topic might seem like an easy fix, but if you stop and think about it, there are few quick and easy methods for merging two or more PDF files. The desired end result is one PDF file that contains all of the information from the original two or more files without any noticeable breaks or ugly indications of a hack.

If the PDF files are yours, the intelligent thing to do is to combine them before you export them into PDF format. But if you no longer have the original documents, or you want to combine files that were not yours originally, such as bank statements, tax forms, etc., you will need pdftk.

Short for “pdf toolkit”, pdftk allows you to merge PDF documents, split PDF pages into new documents, rotate PDF pages, decrypt and encrypt, update metadata, apply watermarks, and much more. It is free and open source software available for Windows, Linux, Mac OS X, FreeBSD, and Solaris. Best of all, it does not require Acrobat or any other Adobe products to work.

To begin you will need to make sure that you have pdftk installed. In Ubuntu, run this command in a terminal:

sudo apt-get install pdftk

(or use Synaptic to install pdftk)

1. Once you have pdftk installed, you will need to run it from the command line, so start the terminal application you prefer (i.e. gnome terminal, xterm, xfterm, konsole).

2. Change to the directory containing your PDF files:

cd ~/pdf-directory

3. Decide what order you want the PDF files to appear in the final document. You will use that order when typing the command line string.

4. Type the following string, listing your PDF files in the order you want them to appear:

pdftk file1.pdf file2.pdf file3.pdf cat output newfile.pdf

That is all it takes. Be sure to check the new PDF file to make sure all of the new pages display correctly. The merging process is seamless, painless, and should work on any regular PDF files you have.

To combine multiple documents in a directory without listing each one, use wildcards (*):

pdftk *.pdf cat output newfile.pdf

As an added bonus, pdftk can perform many other tasks. For example, to split a pdf file’s pages into multiple documents, run the following command:

pdftk newfile.pdf burst

This will split the document into single pages that you can then manipulate as you see fit.

With pdftk you can even merge certain pages from within multiple documents into one new document. Just enter the following command:

pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf

In this case, “A” and “B” are used as “handles” for the names of your documents. You can use as many as you need.

To encrypt your new PDF file, use the following command:

pdftk mydoc.pdf output mydoc.128.pdf owner_pw foopass

This only touches the surface of the many functions of PDF manipulation available with pdftk. The project’s website gives a good overview of commands and also provides full documentation. The site itself describes this powerful program the best:

“If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses.”

pdftk is available for installation on many Linux distributions or can be built from source on numerous operating systems.

Tuesday, September 13, 2011

Basic vi Commands

http://www.cs.colostate.edu/helpdocs/vi.html

1. open file: vi filename
2. enter the insert mode: i
3. turns off the Insert mode:
4. enter command model: shift + :
5. exit vi: q
exit vi and save file: wq
exit vi and not save file: q!
6. delete entire current line: dd

error while loading shared libraries: libifport.so.5: cannot open shared object file: No such file or directory

When run Fortran program, and meet the following problem:

"
./zzzzz: error while loading shared libraries: libifport.so.5: cannot open shared object file: No such file or directory
"

Solution:
Compile the Fortran program again, with ifort, or gfortran, or pgf90 ......

Thursday, April 28, 2011

Combine multiple PDFs into one file in Ubuntu Linux (zz)

http://www.debianadmin.com/combine-multiple-pdfs-into-one-file-in-ubuntu-linux.html

=====================================================================================

It is very useful to combine multiple PDF documents into one file. This is useful especially if you accumulate many PDFs (newsletters, bills, etc.) over time.

Preparing Your system

sudo apt-get install gs pdftk

Now we will see one example how to combine pdf files let us assume we have 1.pdf,2.pdf,3.pdf files and now we need to cobmine this files using the following command

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combinedpdf.pdf -dBATCH 1.pdf 2.pdf 3.pdf

In the above command after “-sOUTPUTFILE=” type whatever name you want for the merged file (don’t forget to append .pdf to the end of the file name). Rename “1.pdf 2.pdf 3.pdf” to whatever your file names are (separate your file names with a space).

After you run the above command, a new PDF file called combinedpdf.pdf will be created with your individual files merged according to the order you list.

If you want to know more options available for gs command check man page

Thursday, January 20, 2011

Error: Permission denied

After installed KILE, and open KILE, a error displayed:
"Unable to save bookmarks in /home/me/.kde/share/apps/kfileplaces/bookmarks.xml. Reported error was: Insufficient permissions in target directory.. This error message will only be shown once. The cause of the error needs to be fixed as quickly as possible, which is most likely a full hard drive."

Solution:
$sudo chmod -R 777 /home/me/.kde

Note: donot forget "-R"

Monday, November 1, 2010

Linux command to display package description, information, version and usage (zz)

How do I display installed packages list?

If you are using rpm based distro such as Redhat/CentOS/Suse/Fedora Linux, enter:
# rpm -qa
# rpm -qa | less

If you are using apt based distro such as Debian/Ubuntu Linux, enter:
# dpkg --list

Task: Display package description and other information

If you are using rpm based distro such as Redhat/CentOS/Suse/Fedora Linux use rpm command:
rpm -qi {package-name}

For example display package description, version, vendor, build date for package called mtop, enter:
# rpm -qi mtop
Output:

Name        : mtop                         Relocations: (not relocatable) Version     : 0.6.6                             Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ Release     : 1.2.el4.rf                    Build Date: Fri 20 Jan 2006 05:40:49 PM CST Install Date: Wed 07 Feb 2007 07:04:54 PM CST      Build Host: lisse.leuven.wieers.com Group       : System Environment/Base       Source RPM: mtop-0.6.6-1.2.el4.rf.src.rpm Size        : 138090                           License: GPL Signature   : DSA/SHA1, Fri 20 Jan 2006 05:48:51 PM CST, Key ID a20e52146b8d79e6 Packager    : Dag Wieers  URL         : http://mtop.sourceforge.net/ Summary     : Tool to monitor a MySQL database Description : mtop (MySQL top) monitors a MySQL database showing the queries which are taking the most amount of time to complete. Features include 'zooming' in on a process to show the complete query and 'explaining' the query optimizer information.

If you are using rpm based distro such as Debian/Ubuntu Linux use dpkg command:
dpkg -p {package-name]

For example display package description, version, and other information for package called zip, enter:
$ dpkg -p zip
Output:

Package: zip Priority: optional Section: utils Installed-Size: 248 Maintainer: Santiago Vila  Architecture: i386 Version: 2.32-1 Replaces: zip-crypt (<= 2.30-2) Depends: libc6 (>= 2.4-1) Recommends: unzip Conflicts: zip-crypt (<= 2.30-2) Size: 105640 Description: Archiver for .zip files  This is InfoZIP's zip program. It produces files that are fully  compatible with the popular PKZIP program; however, the command line  options are not identical. In other words, the end result is the same,  but the methods differ. :-)  .  This version supports encryption. 

Friday, October 29, 2010

Install Lammps on CentOS 5.2

http://planet.admon.org/howto/set-syste-variables-in-debian-and-centos/
http://rpm.pbone.net/index.php3/stat/11/limit/11/dl/40/vendor/3950/com/http:
wget -m -nd http://lammps.sandia.gov/tars/lammps.tar.gz

check linux Operation System: $ cat /etc/redhat-release

yum list will give you a list of all installed packages, and other packages available in the repos.

sudo yum install compat-libstdc++-33.x86_64

1. sudo yum install gcc gcc-c++ kernel-devel
sudo yum groupinstall "Development Tools"


2. sudo yum install tcsh

3. install fftw (version 2.1.5,download from http://www.fftw.org/download.html )
$ tar xvzf fftw-2.1.5.tar.gz
$./configure
$make
$sudo make install
$make check (to put the test programs through their paces. )

4. install gfortran

5. install mpich2 (version mpich2-1.3)
download from http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads

For install process, pls follow the file of Installguide
$ tar xzf mpich2-1.3.tar.gz
$ mkdir /home/.../mpich2-install
$ mkdir /tmp/.../mpich2-1.3


$ cd /mpich2-1.3
$ ./configure --prefix=/home/lxi/apps/mpich2-install 2>&1 | tee c.txt
$make 2>&1 | tee m.txt
$ make install 2>&1 | tee mi.txt

Add the bin subdirectory of the installation directory to your path:
(add to the file ~/.bashrc)
for bash and sh:

$ ~
$vi ./bashrc
(add " PATH=/home//mpich2-install/bin:$PATH ; export PATH "to the file)
$source .bashrc
$env (check if env variable set correctly)
$ which mpicc
$ which mpiexec
$mpiexec -n 5 ./examples/cpi
A file named .mpd.conf file must be present in the user's home directory

(/etc/mpd.conf if root) with read and write access only for the user, and
must contain at least a line with: MPD_SECRETWORD= One way to safely create
this file is to do the following:
cd $HOME
touch .mpd.conf
chmod 600 .mpd.conf
and then use an editor to insert a line like MPD_SECRETWORD=mr45-j9z into the file.
(Of course use some other secret word than mr45-j9z.)

5. install lammps
tar xvzf lammps.tar.gz
Copy Makefile to lammps-24Jan10/src/MAKE/Makefile.centos
$chmod 777 Makefile.centos

Make sure you are sitting in lammps-24Jan10/src (not the MAKE directory!).

# for parallel binaries make ubuntu # for serial, make STUBS, then LAMMPS cd STUBS ; make ; cd .. make ubuntu

Try an example to verify it works
While sitting in the src directory, the first command should run the "crack" example in serial mode. If your computer supports it, the second command should utilize 2 cores and run faster. Remember, even if you compile using the parallel makefile, the first invocation will still work, and is the reason you don't need a separate binary for serial runs.
Code:
# change to the examples/crack directory cd ../examples/crack # for serial or parallel builds ../../lmp_ubuntu <>