7/30/2009

nautilus script : backup script

This script copy the selected files in the folder named 'old'.
If the folder is not exist, the script create 'old' folder.
Time stamp strings, e.g. "_Thu_Jul_30_11.05.39_2009", are automatically attached at the end of the file name.


#!/usr/bin/python
# -*- coding: UTF-8 -*-

import os, glob, time

old = 'old' # backup folder name

def showme(s):
os.system('gmessage -center ' + str(s))

def make_time_str():
tmp = time.ctime()
tmp = tmp.replace(' ', '_')
tmp = tmp.replace(':', '.')
return tmp

def make_old_folder():
if len(glob.glob(old)) == 1 and os.path.isdir(old) :
pass #
else :
os.system('mkdir old')

return

make_old_folder()

# get selected file paths
tmp = os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS']
fns = tmp.strip().split('\n') #filenames

for fn in fns : # for filename in filenames
if os.path.isdir(fn) :
#showme('pass')
pass
fn_nameonly = os.path.basename(fn) # extract file name from file path
#showme(os.path.splitext(fn)[1])
cmd = 'cp ' + '"' + fn_nameonly + '" old/"' + fn_nameonly + '_' + make_time_str() + os.path.splitext(fn)[1] + '"'
os.system(cmd)

The script file must be in ~/.gnome2/nautilus-scripts/

7/29/2009

HOWTO install python multiprocessing module with python 2.5

Python 2.6 has multiprocessing by default, while 2.5 has not.
This is HOWTO install multiprocessing module with python 2.5.

download site : http://linux.softpedia.com/get/Programming/Libraries/python-multiprocessing-43286.shtml

In above site, download multiprocessing-2.6.1.1.tar.gz
uncompress, and run "sudo python setup.py install"
That's it

Detail is in INSTALL.txt file.

usage ref : http://kldp.org/node/107470

7/28/2009

HOWTO use korean in lyx (beamer class)

1. open /usr/share/lyx/languages and find line for korean, and modify as follows:
(This will add koreanUCS option for lyx language setting. utf8 encoding is needed for using korean.)

from
korean "" "Korean" false euc-kr ko ""
to
korean "" "Korean" false euc-kr ko ""
koreanUCS "" "KoreanUCS" false utf8 ko_KR.UTF8 ""
Then, reconfigure, restart lyx.
ref : http://ktug.kldp.net/jsboard/read.php?table=setup&no=12092&page=150

2. lyx menu > Tools > Preferences > Language Settings
In Language submenu, change "Default language" to "koreanUCS"
Make "Language package" and "Command start" option blank.
Uncheck the "Use babel" option.

3. Go to Document Settings > Language, and change Language to "KoreanUCS"

4. Document Settings > LaTeX Preamble, add the followings :
\usepackage{kotex}
\usepackage{dhucs-cmap}
ref : http://faq.ktug.or.kr/faq/%C7%D1%B1%DB%B0%CB%BB%F6%B9%D7%C3%DF%C3%E2

5. For 한글(korean) bookmark, go to Document > Settings > Document Class >
add the following line in Class options > Custom
hyperref={unicode, pdftex}
ref : http://project.ktug.or.kr/ko.TeX/kotexguide.pdf -> page 60, '한글 책갈피'

The above ref recommended "\usepackage[unicode,(driver),...]{hyperref}"
where, (driver) is pdftex.

In lyx, however, adding above line into "LaTeX Preamble" makes an error.
The reason is like that : The hyperref package is automatically loaded by beamer.cls and certain options are setup. In order to pass additional options to hyperref or to override options, you can use the following class option:
\documentclass[hyperref=(list of options)]{beamer}
Causes the to be passed on to the hyperref package.
Example: \documentclass[hyperref={bookmarks=false}]{beamer}

ref : http://www.tex.ac.uk/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf -> page 15

7/24/2009

intel fortran non-commercial version for linux

download site :

http://software.intel.com/en-us/articles/non-commercial-software-download/

get IA32/Intel64 version


During install process, I met the following error/warning messages :

Step no: 4 of 7 | Installation configuration - Missing Optional Pre-requisite
--------------------------------------------------------------------------------
There is one or more optional unresolved issues. It is highly recommended to fix
it all before you continue the installation. You can fix it without exiting from
the installation and re-check. Or you can quit from the installation, fix it and
run the installation again.
--------------------------------------------------------------------------------
Missing optional pre-requisite
-- operating system type is not supported.
-- system glibc or kernel version not supported or not detectable
-- binutils version not supported or not detectable
--------------------------------------------------------------------------------
1. Skip missing optional pre-requisites [default]
2. Show the detailed info about issue(s)
3. Re-check the pre-requisites

h. Help
b. Back to the previous menu
q. Quit
--------------------------------------------------------------------------------
Please type a selection or press "Enter" to accept default choice [1]:

Ignore this message, and just hit enter.
(ref : http://software.intel.com/en-us/articles/using-intel-compilers-for-linux-with-ubuntu/)
Then, installation was completed.

Next, I added the following lines to .bashrc file for setting PATH and LD_LIBRARY_PATH :
######## For intel compiler #################################
PATH="/opt/intel/Compiler/11.1/046/bin/ia32:$PATH"; export PATH
LD_LIBRARY_PATH="/opt/intel/Compile/11.1/046/lib/ia32:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH
#############################################################


or

source /opt/intel/Compiler/11.1/046/bin/ifortvars.sh ia32

7/23/2009

ubuntu gnome screensaver cycle_delay

run gconf-editor
Change the key /apps/gnome-screensaver/cycle_delay from 10 to 0,
where, "10" means user must wait 10 minute when he enter an incorrect password.

Change it to "0" so that user could re-enter the password immediately.