Global Constants in C++

Declaring the global constants can polute the names available and create conflicts as the project grow larger. One solution is to declare it using a namespace.
globalconst.h
namespace GlobalConst{
const double PI=3.14;
};
and in your file, simply use
GlobalConst::PI
UPDATE: I have corrected the code, thanks

cannot reintegrate branch

I created a branch from another branch, and after I am ready to merge, I encounter this problem:
$ cd photon-branch; svn update
$ svn merge –reintegrate https://nanoes.svn.sourceforge.net/svnroot/nanoes/branches/photon-recursive/
svn: Cannot reintegrate from ‘https://nanoes.svn.sourceforge.net/svnroot/nanoes/branches/photon-recursive’ yet:
Some revisions have been merged under it that have not been merged into the reintegration target; merge them first, then retry.
It turns out to be [...]

Compiling IT++ with MKL library

I downloaded it++ 4.0.6 and tried to compile using MKL library. To do that, I need first to set the environment path
export LDFLAGS=-L/opt/intel/Compiler/11.0/081/mkl/lib/32/
export CPPFLAGS=-I/opt/intel/Compiler/11.0/081/mkl/include
and then I run the configure with this option
./configure –prefix=$HOME/local F77=gfortran –with-blas=”-lmkl_intel -lmkl_sequential -lmkl_core -lpthread” –with-lapack=”-lmkl_lapack”
With this settings configure can detect my MKL library
UPDATE: though it can detect MKL, but it gives [...]

Using Eclipse with Subversion

For a detail instruction to install the plugin in Eclipse which enable Subversion, go to:
http://www-128.ibm.com/developerworks/opensource/library/os-ecl-subversion/
There are some differences with the version which I am using in Kubuntu. So I will list down again briefly.
1. Open Eclipse, click menu “Help->Software Updates->Find and Install”
2. click the option, “Search for new features to install”, and then “Next” button.
3. [...]

Programming C/C++ using Eclipse with the use of CDT

I am developing C/C++ codes in Linux, and luckily Eclipse has a plugin called CDT to be used for C/C++ language. To install Eclipse and CDT plugin in Kubuntu/Ubuntu, just type:
sudo apt-get install eclipse eclipse-cdt

Guide to available mathematical libraries

I just found an interesting site to help you find the required mathematical libraries for computation.
http://gams.nist.gov/

Use fabs for getting the absolute from double

I am porting my Octave code to C++, somehow I always got zero for one expression that I calculate. After debugging, it turns out after I take abs(expression), the values always zero. Argh. I forgot, abs() in C++ is only for integer and long. I need to use fabs() for float or double. Now it [...]

how to create a package from svn (subversion) folder

After developing my code for quite sometime, now it is ready to release its 1.0 version.
svn export my-working-copy my-dest-folder
This copy action omit the “.svn” folder inside. So all the svn info is not copied. And then, just archive the folder as usual.
tar czvf yourpackage.tar.gz ./yourfolder
more info on svn export:
http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.export.html