Fix This Up

It's about pc troubleshooting

Thursday, August 17, 2006

Location of the Outlook Express dbx files

It is useful to know the location of the files where Outlook Express stores it's mail messages (outgoing, incoming, drafts, saved messages etc.) so when we need to switch computers or create a backup, we had only copy those files and import them in Outlook Express once our new system is up and running. The location of those dbx files is (Windows XP Pro):

{Drive of Installation of Windows}:\Documents and Settings\{username}\Local Settings\Application Data\Identities\{folder with alphanumerical name}\Microsoft\Outlook Express

Copy all the contents of that folder somewhere (e.g CD, portable drive) and you have made a backup of all the messages in Outlook Express.

In case you might need to save the Address Book too, you may find it at:

{Drive of Installation of Windows}:\Program Files\Outlook Express

The file is called wab.exe

Finally, you may find it useful to extract the email messages from the dbx files so as to store them as individual emails. That is possible with the appropriate software (such as OE Viewer or DBXtract)

Friday, August 11, 2006

How to run Mathematica on a remote machine using Cygwin

Step 1: Ftp the machine that you would like to run Mathematica from. From Cygwin/X this may happen after invoking the XWin X Server (for how this may happen click here. I simply typed at a bash shell prompt: cp /etc/X11/xinit/xinitrc ~/.xinitrc and startx worked fine after that). You can do this by typing: sftp (your-username-for-that-particular-machine)@(that-particular-machine) at a Cygwin/X prompt.

Step 2: On the remote machine, go to Mathematica's font directory. This can be the: /usr/local/mathematica/SystemFiles/Fonts/

Step 3: Download all the files in the directories you will find. I have downloaded the files in the BDF, Type1 and Common directories. It seems more organised if you keep track of the directory structure of the remote font directory and try to reproduce it locally. I don't know if doing that has any significance with Mathematica. If it is not significant, then you might like to skip step 4.

Step 4: Now you have downloaded all the font files to your home directory. Try to reproduce the remote font directory structure locally. That is, create, for example, a /usr/local/mathematica/SystemFiles/Fonts/BDF folder (in case such a folder exists remotely) and put the appropriate files there. Do the same with all the other font files you have downloaded.

Step 5: Now you need to tell Cygwin/X to consider those folders where Mathematica's fonts are whenever Mathematica is invoked. To do that you need to add to the .xinitrc file (can be found in your Cygwin home directory) something which looks like:

xset fp+ (directory-where-Mathematica's fonts-are-stored-locally)
xset fp rehash

In my case, I downloaded whatever there was in the remote folders:

/usr/local/mathematica/SystemFiles/Fonts/BDF
/usr/local/mathematica/SystemFiles/Fonts/Common/Type1/
/usr/local/mathematica/SystemFiles/Fonts/Type1/

I reproduced this structure locally and thus, I had to add the following lines into my .xinitrc file:

xset fp+ /usr/local/mathematica/SystemFiles/Fonts/BDF
xset fp+ /usr/local/mathematica/SystemFiles/Fonts/Common/Type1/
xset fp+ /usr/local/mathematica/SystemFiles/Fonts/Type1/
xset fp rehash

After that, I saved the .xinitrc file and exited the XWIN X Server and then the bash shell. I other words, I exited Cygwin.

Step 6: Start Cygwin/X (by, for example, typing startx at the Cygwin bash shell) and do: ssh -Y -l (your-username-for-logging-onto-that-particular-machine) (that-particular-machine). "That particular machine" is where you will be running Mathematica from. After you have logged in, invoke Mathematica. You should be able to run Mathematica as if you were running it locally.

How to compile a c program linking to the mingw runtime library

Step 1: Open a Cygwin xterm.

Step 2: At the prompt, type the following command: gcc -c -mno-cygwin filename.c. Where filename is the name of your c program file.

Step 3: If this compiles successfully then do: gcc -o filename -mno-cygwin filename.o. Again, filename corresponds to the name of your c program file.

If this compiles successfully as well then you will find a windows executable called filename.exe which you can run on your windows machine. It will run under a DOS shell.

How to compile a program which includes Clapack routines

The commands I tried on Cygwin that worked with some basic programmes are:

The files lapack_CYGWIN.a and tmglib_CYGWIN.a must be in the same directory as the programme to be compiled ( filename.c)

1. gcc -mno-cygwin -I/usr/local/lib/ -I/usr/local/include -O3 filename.c -L/usr/local/lib/ lapack_CYGWIN.a -llapack -lcblaswr -lcblas tmglib_CYGWIN.a -ltstatlas -latlas -lg2c -lI77 -lf77blas -lm

The directories /usr/local/lib/ and /usr/local/include contain all the library (*.a) and definition (*.h) files found after the clapack installation. The directories were manually created and populated.

2. gcc filename.c lapack_CYGWIN.a -llapack -lcblaswr -lcblas -latlas -lg2c -lm

3. gcc filename.c lapack_CYGWIN.a -lcblaswr -lcblas -latlas -lg2c

Every programme that uses a Clapack routine might have to include:

#include < blaswrap.h >
#include < f2c.h >

How to install Clapack on Cygwin

Basic Idea: First Install ATLAS to handle linear algebra routines and then CLAPACK to download appropriate routines. As I understand it, ATLAS provides the basic interface for the CLAPACK routines to run.

Step 1: To run a programme which invokes CLAPACK routines, you, first, need to install ATLAS. Go to the ATLAS website to obtain additional info. Alternatively, you may download the ATLAS software by clicking here. I chose the atlas3.6.0.tar.gz (2.4MB) which is a platform independent and stable distribution. I suppose that this is what one could get if a cygwin installation is intended. You can unpack the .gz file using any archiver to produce a directory with the name of ATLAS. The contents of that directory are:

dir bin
dir CONFIG
dir doc
dir include
dir interfaces
dir lib
dir makes
dir src
dir tune
file config.c
file INSTALL.txt
file Make.top
file Makefile
file README

Step 2: Now you can download CLAPACK. You may go to the CLAPACK web site for further info. I downloaded the clapack2.tgz (6.1MB) archive. You can unpack it with any archiver to produce a directory with the name of CLAPACK. The contents of that directory are:

dir BLAS
dir F2CLIBS
dir INSTALL
dir SRC
dir TESTING
dir TIMING
file clapack.h
file make.inc
file Makefile
file README.install
file README.maintain

in the readme.install file you will see that the contents of the CLAPACK folder also include a directory called Translate. The distribution I got (clapack2.tgz (6.1MB)) does not include that folder.

Step 3: Make sure that the ATLAS and CLAPACK directories are in your Cygwin home directory. Mine is at: C:\cygwin\home\kele (under windows explorer).

Step 4: Open a Cygwin bash shell and then type startx to invoke the XWin X Server (instructions as to how you can do that click here. I simply typed at a bash shell prompt: cp /etc/X11/xinit/xinitrc ~/.xinitrc and startx worked fine after that)). Then do:

cd ~
cd ATLAS
make config
cd lib
cd WinNT_UNKNOWNSSE2 (or the name you chose during the make config process for that folder)
cp *.a /usr/local/lib/
cd ~

I pressed enter almost at every question that prompted up during the make config process. If there is no /usr/local/lib/ directory you can create it by doing:
mkdir /usr/local/ (if there is no /usr/local/ directory)
mkdir /usr/local/lib/

Now, you should have returned to your home directory.

Step 5: Now you can install CLAPACK. Do:

cd ~
cd CLAPACK
cp INSTALL/make.inc.LINUX ./make.inc

Step 6: Edit the make.inc file as follows:

PLAT = _CYGWIN
BLASLIB = ../../libcblaswr.a -L/usr/local/lib -lcblas -latlas

Save the make.inc and exit your editor.

Step 7: Now you are ready to invoke the make.inc file and start the installation. In ~/CLAPACK directory do:

make f2clib
make cblaswrap
cd SRC
make
cd TESTING/MATGEN
make
cd ..
make
cd ..

I got several error 139s during that process. I overcame them by repeating the make command that got interrupted due to that error. It shouldn't take more than 5-6 hours for the whole process (installation of ATLAS plus CLAPACK) to complete. These instructions are quite different from the ones one can find in the readme.install file. I tried following the instructions in that file and whereas everything proceeded smoothly up to step 5, from step 6 upwards error 139s were generated and the installation was painfully slow (it took some 8-9 hours for the steps 6-8 to complete). The instructions presented here have been tried (on my computer) and were found at How to use CLAPACK and ATLAS on Cygwin. The only difference with what the readme.install presents is that the TIMING process is omitted (steps 7 and 8). The error 139s where not avoided.

Step 8: Now copy the rest of the library files to /usr/local/lib/. Do:

cd ~
cd CLAPACK/BLAS/WRAP
cp *.a /usr/local/lib
cd F2CLIBS
cp *.a /usr/local/lib
cd ~
cp *.a /usr/local/lib

Now you should have in your /usr/local/lib directory the following library files (*.a):

libatlas.a
libcblas.a
libf77blas.a
liblapack.a
libtstatlas.a
libcblaswr.a
libF77.a
libI77.a
lapack_CYGWIN.a
tmglib_CYGWIN.a

Step 9: You should be ready to compile any programme which uses a clapack routine. A test programme provided can be found here. You may select and paste from the netlib web site as instructed above. Otherwise, you can download the code by clicking testclapack.c. Sometimes, selecting Save As... from a web browser saves the web page but adds some html tags in the file. Before trying to compile the code make sure that no additional lines have been put by your web browser. Save the file in your Cygwin home directory.

Step 10: In the directory where you have saved the test programme make sure that you also have lapack_CYGWIN.a and tmglib_CYGWIN.a.

Step 11: You are ready to compile the test programme by doing:

gcc testclapack.c (or however your test programme is called) lapack_CYGWIN.a -lcblaswr -lcblas -latlas -lg2c

It should compile without errors. Now run the executable by doing:

./a.exe (or if you have given a name to the output .exe file use the appropriate name)

The output gives:

INFO = 0

s[ 0 ] = 34.000000
s[ 1 ] = 17.888544
s[ 2 ] = 4.472136
s[ 3 ] = 0.000000

That's it I suppose :)