Search This Blog

Tuesday, April 26, 2011

How to use UHthesis2e in Lyx

=== Ubuntu ===

Become a root by
$ sudo bash

Go to the latex directory (/usr/share/texmf-texlive/tex/latex)
$ cd /usr/share/texmf-texlive/tex/latex

Make a uhthesis directory
$ mkdir uhthesis
$ cd uhthesis

Copy uhthesis setup files to the dir.
$ cp /somewhere/uhthesis2e.cls  ./
$ cp /somewhere/uht10.clo       ./
$ cp /somewhere/uht11.clo       ./
$ cp /somewhere/uht12.clo       ./


Go to
$ /usr/share/lyx/layouts
$ vi uhthesis2e.layout

Add following lines
#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[uhthesis2e]{article (uhthesis2e)}
# Input general definitions
Input stdclass.inc

Start Lyx and in Lyx
do: Tools > Reconfigure ; Restart Lyx.

And you will see "article (uhthesis2e)"
Now you should be able to use the document class in LyX as usual:
Document > Settings > Document Class > Document Class > article (uhthesis2e)


Download UHthesis2e.zip

Wednesday, April 20, 2011

gcc and OpenFOAM

I also find a couple of links that may be useful to you to compile gcc and OpenFOAM. (by Shengmeng at Platform Inc.)

(Link 1) http://www.cfd-online.com/Forums/blogs/wyldckat/385-automated-scripts-building-gcc-4-4-x-4-5-x-using-openfoam-1-7-series.html

(Link 2: discussion forum) http://www.cfd-online.com/Forums/openfoam-installation/73629-openfoam-installation-redhat-enterprise-linux-5-a.html

(Link 3: OpenFOAM in CentOS) http://sourceforge.net/apps/mediawiki/centfoam/index.php?title=Main_Page


I followed the steps in link 1 and so far so good.

First, Using yum in RHEL, I downloaded and installed flex, texinfo, byacc, and bison.

$ yum install -y flex flex++ --downloadonly --downloaddir=/home/albertsk/packages/
$ rpm -i /home/albertsk/packages/flex-2.5.4a-41.fc6.x86_64.rpm



$ yum install -y bison --downloadonly --downloaddir=/home/albertsk/packages/$ rpm -i /home/albertsk/packages/bison-2.3-2.1.x86_64.rpm 

$ yum install -y byacc --downloadonly --downloaddir=/home/albertsk/packages/
$ rpm -i /home/albertsk/packages/byacc-1.9-29.2.2.x86_64.rpm

Second, I downloaded  File Type: gz build-gcc_v4.tar.gz (5.7 KB, 12 views) and used the script to install other utilities such as gcc, gmp, mpfr and mpc.  During this process, I defined set FOAM_INST_DIR under my $HOME directory, which is quite important to "source etc/bashrc" for compiling environment.


Third, I went to OpenFOAM/OpenFOAM-1.7.1 directory and execute
$ ./Allwmake

which is still going on for about a half day. 



Fourth, later on I found that not all the executable files are built and got error message that says "/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found".  None of web information is directly useful, so I search the library and found an newer version at

ThirdParty-1.7.1/platforms/linux64/gcc-4.3.3/lib64/libstdc++.so.6.0.10



So, I copied libstdc++.so.6.0.10 to /usr/lib/ and make a newer link

ln   -sf   libstdc++.so.6.0.10   libstdc++.so.6

(The file libstdc++.so.6.0.10 should be copied to all the compute nodes and the link should be updated once a serial OpenFOAM test is done in fractal.)

Fifth, I got 4 errors in config such as

configure: error: no vtf3.h found; check path for VTF3 package first...
configure: error: no bfd.h found; check path for BFD package first...
configure: error: no libiberty.h found; check path for LIBERTY package first...
configure: error: no papi.h found; check path for PAPI package first...

This link seems to have a solution: http://www.cfd-online.com/Forums/openfoam-installation/80787-missing-vtf3-h-bpatch-h-papi-h.html

vtf3 library problem can be solved. See
http://anirban.org/cs521/ass7/
Download VTF library and extract & copy to a convenient location.

For bfd.h, it is found at
 /home/albertsk/OpenFOAM/ThirdParty-1.7.1/platforms/build-linux64Gcc/binutils-2.20.1/bfd/bfd.h
/home/albertsk/OpenFOAM/ThirdParty-1.7.1/platforms/linux64/gcc-4.5.2/include/bfd.h
/home/usr/local/binutils-2.21/include/bfd.h
Perhaps, these directories should be included in "INCLUDE" environment.

For iberty package, it is because binutils-devel is not installed.
http://www.rootninja.com/configuring-and-making-oprofile-for-a-custom-kernel-on-fedora/
/home/albertsk/OpenFOAM/ThirdParty-1.7.1/binutils-2.20.1/include/libiberty.h
/home/albertsk/OpenFOAM/ThirdParty-1.7.1/gcc-4.5.2/include/libiberty.h

How Do I Find Out CPU is 32bit or 64bit?

$ grep flags /proc/cpuinfo
$ cat /proc/cpuinfo
$ lshw -C cpu

CPU Modes:

  • lm flag means Long mode cpu - 64 bit CPU
  • Real mode 16 bit CPU
  • Protected Mode is 32-bit CPU

How do I tell if 32 bit or 64 bit ubuntu is installed on a machine?

file /sbin/init

Monday, April 18, 2011

Encoding from multiple input image files (JPEG, PNG, TGA, etc.)

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



6.8. Encoding from multiple input image files (JPEG, PNG, TGA, etc.)

MEncoder is capable of creating movies from one or more JPEG, PNG, TGA, or other image 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 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

Wednesday, April 6, 2011

Subversion Commands and Scripts

 Subversion Commands and Scripts
http://www.yolinux.com/TUTORIALS/Subversion.html

 Basic SVN Commands
http://www.linuxfromscratch.org/blfs/edguide/chapter03.html

svn status

svn status. This command prints the status of working directories and files. If you have made local changes, it'll show your locally modified items. If you use the --verbose switch, it will show revision information on every item. With the --show-updates (-u) switch, it will show any server out-of-date information.

$ svn ci -m " any message"
$ svn update
$ svn status

will show files that are not subversioned with "?" in front.

Tuesday, April 5, 2011

Reference sheet for natbib usage

http://merkel.zoneo.net/Latex/natbib.php

The natbib package has two basic citation commands, \citet and \citep for textual and parenthetical citations, respectively. There also exist the starred versions \citet* and \citep* that print the full author list, and not just the abbreviated one. All of these may take one or two optional arguments to add some text before and after the citation.
\citet{jon90}     -->    Jones et al. (1990)
\citet[chap. 2]{jon90}     -->    Jones et al. (1990, chap. 2)
\citep{jon90}     -->    (Jones et al., 1990)
\citep[chap. 2]{jon90}     -->    (Jones et al., 1990, chap. 2)
\citep[see][]{jon90}     -->    (see Jones et al., 1990)
\citep[see][chap. 2]{jon90}     -->    (see Jones et al., 1990, chap. 2)
\citet*{jon90}     -->    Jones, Baker, and Williams (1990)
\citep*{jon90}     -->    (Jones, Baker, and Williams, 1990)

Monday, April 4, 2011

ls exclude

http://www.unix.com/shell-programming-scripting/100038-ls-exclude-pattern.html

# See all files ending in .html
ls | grep "\.html$"
# see all files not ending in .html
ls | grep -v "\.html$"

Sunday, April 3, 2011

crontab how to

https://help.ubuntu.com/community/CronHowto


01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand
 
The above example will run /usr/bin/somedirectory/somecommand
at 01 and 31 minuts
past the hours of 4:00am and 5:00am
on the 1st through the 15th
of every January and June.

Labels

Blog Archive