Archive for the ‘Programming’ Category.

Remember the path of last login

create ~/.bash_logout

with the following contents:

1
2
t=`readlink -f \`pwd\``
ln -sfn $t ~/lastdir

Continue reading ‘Remember the path of last login’ »

Install Python modules as non-root user on HPC cluster

The key steps

1. Create a folder named “~/python-packages”, then create a path “~/python-packages/lib/python2.6/site-packages/” with

1
mkdir -p python-packages/lib/python2.6/site-packages/

The above path containing the version number of Python should be adjust accordingly base on the actual Python version you are using.
This step sets up a directory structure that is needed by python modules.

Continue reading ‘Install Python modules as non-root user on HPC cluster’ »

Selection of GUI toolkits

To select a toolkit for GUI programming is something like to select a bottle of wine. Only you know your favorites.  Here are mine.

Continue reading ‘Selection of GUI toolkits’ »

Python initial script for Qtiplot

OK, even after reading the handbook a few times, it is not very clear which python file is the initial script for Qtiplot. It is important to know if you want to extend Qtiplot with python. After checking all the default python files in the Qtiplot installation path, I found qtiplotrc.py should be the one, although a smarter guy would have realized this from its name. You could import your own Python module in this startup file and enjoy them right after entering Qtiplot.

History expansion in depth

History Expansion

History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to a previous command into the current input line, or fix errors in previous commands quickly.

Continue reading ‘History expansion in depth’ »

Animation with matplotlib

A demo program showing the way to make animation with matplotlib.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# A demo for animation with matplotlib
# Written by Ting Li (Dr.Ting.Li at gmail.com)
# 2010-09-10
# Ref: http://www.scipy.org/Cookbook/Matplotlib/Animations
import numpy as np
import time
import matplotlib
matplotlib.use('WXAgg') #before import pylab, choose the GUI backend
#It can also be done while calling this script from command line:
#>>> python animation.py -dWXAgg
#Other backends are: valid strings are ['ps', 'Qt4Agg', 'GTK', 'GTKAgg', 'svg',
# 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg', 'TkAgg', 'QtAgg', 'FltkAgg',
# 'pdf', 'CocoaAgg', 'emf', 'gdk', 'template', 'WX']
from pylab import *

 <a href="http://9rivers.linkka.com/2010/09/11/animation-with-matplotlib/#more-561" class="more-link"><small>Continue reading &#8216;Animation with matplotlib&#8217; &raquo;</small></a>

Uncompress tar to specific directory + Other tar/untar tricks

There is a ‘-C’ option allow you to do this. However, it can fail in some situation. There are also some posts online that report this option does not work. If you have that problem, maybe you could try the solution here.

Continue reading ‘Uncompress tar to specific directory + Other tar/untar tricks’ »

Internal overflow compressing coordinates

I occasionally got this error while running some mpi programs. I could not find the exact reason. Even when I google it, it seems no relevant explanation of it. By investigating the codes with debugger, I notices some data in the memory are huge, when I correct them, the error information was gone too. Therefore I guess this error is related to the expression of illegal numbers. However, I would like to know more about it if someone can point out the exact reason.

An MPI implementation I didn’t know before

DeinoMPI is an implementation of MPI-2 for Microsoft Windows. DeinoMPI is a derived work from MPICH2 provided by Argonne National Lab.  By starting with the MPICH2 code base DeinoMPI inherits a stable and complete implementation of the MPI-2 standard.  DeinoMPI heavily modifies the original code base and does not rely on anything from Argonne National Lab.

Continue reading ‘An MPI implementation I didn’t know before’ »

Where to download xulrunner-1.8.1.3 (or older version)?

The download link of this version on the Mozilla webpage has broken.
But you can find it here.