using update-alternatives

I have several version of octave now, and I do not want to remove the older version yet. Debian system provides a nice command called update-alternatives where it can choose from several alternatives the program you want to use. for example in the case of octave. It will create a symbolic link in /usr/bin/octave that points to /etc/alternatives/octave. This in turns link to the choice of octave we want.

To install a new version of octave to the alternative system:

sudo update-alternatives --install /usr/bin/octave octave ~/Programs/Octave-3.2.4/bin/octave 4

The number at the back is the priority number. Now to choose the default octave we want to load:

sudo update-alternatives --config octave

This will display:
There are 4 alternatives which provide `octave’.

Selection Alternative
———————————————–
+ 1 /usr/bin/octave-2.1.73
2 /home/kurniawano/Programs/Octave3.0.1/bin/octave
* 3 /home/kurniawano/local/bin/octave
4 /home/kurniawano/Programs/Octave-3.2.4/bin/octave

Press enter to keep the default[*], or type selection number: 4
Using ‘/home/kurniawano/Programs/Octave-3.2.4/bin/octave’ to provide ‘octave’.

Of course in the above I choose the newly installed version.

to remove an option, you can use:

sudo update-alternatives --remove octave /home/kurniawano/Programs/Octave3.0.1

Advertisements

finding which package should I install in ubuntu/kubuntu

Sometimes, in installing some software from the source, it requires certain file or packages. If you know the package, it is pretty simple in ubuntu, simply type “sudo apt-get install “. But what if you don’t know and you only know xxx.h is required. To find the package, you can use apt-file. To install this,

sudo apt-get install apt-file

Then, to search which package contains xxx.h, simply type

apt-file search xxx.h

apt-file can even list down where this file will be installed,

apt-file list xxx.h

Building OpenCascade 6.3 in Kubuntu Hardy

I tried to install OpenCascade 6.3 in my Kubuntu Hardy desktop. First I downloaded the tar.gz file and untar it. After that, I go to the “ros” folder inside. There you will find the instruction in README.txt.

So the first thing I did was to edit env.csh file and change the CASROOT environtment variable to where I untarred the source code. After that I run env.csh.

The next thing was to run ./configure. This is a bit tricky since a lot of things to set up. I first installed tk8.5 by typing:

sudo apt-get install tk8.5-dev

In the first trial, the configure cannot find Xmu.h, so I installed “libxmu-headers” package. But somehow, it still cannot find my X. So what I did was to create a symbolic link to libXmu.so.6

sudo ln -s libXmu.so.6 libXmu.so

This fixed the problem and now configure can find my X. But there’s still one thing it cannot find which is java. the configure cannot find jni.h. So I installed sun-java6-jdk from apt-get and run the following configure command:

./configure --prefix=$HOME/Programs/OpenCascade/ --with-gl-include=/usr/include --with-gl-library=/usr/lib --with-xmu-include=/usr/include/X11/Xmu/ --with-xmu-library=/usr/lib/ --with-tcl=/usr/lib/tcl8.5/ --with-tk=/usr/lib/tk8.5 --with-java-include=/usr/lib/jvm/java-6-sun/include/

Now configure can find all that is required.  When I ran make, I encountered this error:

macro `AM_PROG_LIBTOOL' not found in library

From some forum, it was suggested to install libtool, so I install libtool from Adept, and the make can continue, but again it stopped and giving this error:

Makefile.am:3: directory should not contain `/'

I tried to run make again and it can continue even to the step of make install. But when I tried to run DRAWEXE application, it cannot find some library:

./DRAWEXE: error while loading shared libraries: libTKDraw.0: cannot open shared object file: No such file or directory

So I decided o try the steps described in: http://www.opencascade.org/org/forum/thread_15409/


% aclocal
% libtoolize --force
% autoconf
% automake
% mkdir build
% source flag.sh
% cd build
% ../configure ${flags}
% make
% make install

where flag.sh is defined as following:

flags="--prefix=$HOME/Programs/OpenCascade/ "
flags="$flags --with-gl-include=/usr/include --with-gl-library=/usr/lib"
flags="$flags --with-tcl=/usr/lib/tcl8.5/ --with-tk=/usr/lib/tk8.5"
flags="$flags --with-java-include=/usr/lib/jvm/java-6-sun/include/"
flags="$flags --enable-production"

I will update the post once it finishes 🙂

Installing Octave 3.2.4 in workstation

Though my previous installation for octave 3.2.2 failed, this time octave 3.2.4 configure just fine. This is what I typed:

./configure --prefix=/scratch/kurniawano/local/ LDFLAGS='-L/scratch/kurniawano/local/lib' CPPFLAGS='-I/scratch/kurniawano/local/include' FFLAGS='-ff2c' LIBS='-lmetis'

After that, I just typed make, and make install. If I didn’t put -lmetis, the make step will give an error, undefined reference to metis.

How to get double precision pi constant in Fortran

<code>

program testpi
implicit none
double precision::mypi
mypi=acos(dble(-1.0));
write(*,*) mypi
write(*,*) sin(mypi)
end program testpi

</code>

This outputs:

<code>

3.14159265358979
1.224646799147353E-016

</code>

Note that the sin(pi) is close to the value given in Mathworks:

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/pi.html

Error 2200 for my Dell all-in-one 926 printer

When I moved to a new place, my dell printer started to give an error message “Error 2200” every it starts. I tried to google around and found the solution on this page:

http://en.community.dell.com/forums/p/19232971/19363125.aspx

Basically the steps are:

  1. Switched off the printer.
  2. Unplugged the power.
  3. Press the power button for 15 seconds.
  4. plugged in back the power.
  5. Turn on.

Connecting to Network Printer from Linux desktop

I am using Kubuntu Hardy for my office desktop and the printer is a network printer. To setup a new printer in Kubuntu, I need first to check the properties from a windows PC. In windows XP, go to Printers and Faxes, and right click the installed network printer there, then choose “Properties”. The following information are useful:

  • click “Sharing” tab and take note the “Share name”
  • click on the “Ports” tab and take note the IP address

After this go to your Kubuntu OS, and use the printer wizard. Choose TCP/IP printer, and enter the IP address as you have noted before. Follow the wizard until finish.