Search This Blog

Tuesday, April 24, 2007

gnuplot with GNU readline and history support

By default, the gnuplot packages in Debian are not built with libreadline (GNU readline). This is due to licensing issues (see /usr/share/doc/gnuplot/README.Debian for more info). Having the libreadline support is useful as it enables tab completion of file names inside gnuplot. Using GNU readline, one can also access the commands used in previous gnuplot sessions. The recipe for recompiling the gnuplot packages (in the Debian way) with support for GNU readline and history file is given below.


$cat ~/makefiles/gnuplot.install
#add the following or similar entry into the /etc/apt/sources.list
deb-src http://ftp.us.debian.org/debian/ etch main contrib non-free
# other possible entries look like
# deb-src http://ftp.us.debian.org/debian/ unstable main contrib non-free

# install packages necessary for building gnuplot
sudo apt-get install fakeroot
sudo apt-get build-dep gnuplot
# see the versions of gnuplot available
rmadison gnuplot
# I decided to use gnuplot 4.0.0-5

# go to the place where you normally compile packages
cd /home/software/compileHere/gnuplot

# (optional) move files from previous versions/compilations if they exist
# mv gnuplot-4.0.0/ /tmp
# (optional) move old binary deb files also if necessary
# mv gnuplot*deb /tmp

apt-get source gnuplot=4.0.0-5
dpkg-source -x gnuplot_4.0.0-5.dsc
cd gnuplot-4.0.0/debian/

# Edit the file named "rules" and change
--without-gnu-readline
TO
--with-readline=gnu

# Enable the history file by adding
--enable-history-file

cd ..
dpkg-buildpackage -us -uc -rfakeroot
cd ..

ls gnuplot*deb
gnuplot_4.0.0-5_all.deb gnuplot-nox_4.0.0-5_i386.deb
gnuplot-doc_4.0.0-5_all.deb gnuplot-x11_4.0.0-5_i386.deb

sudo dpkg -i gnuplot*deb

apt-cache showsrc gnuplot

Friday, April 20, 2007

calculate md5sums in windows

A free, open source software called winMd5Sum is available from http://nullriver.com/winmd5sum . This software can be used to compute md5sum values of files.


tested on : Windows XP

Saturday, April 14, 2007

recipe for building texmacs package with pdebuild

As of Fri Apr 13, 2007, the stable branch of Debian (Etch) carries texmacs 1:1.0.6-10, unstable branch of Debian (Sid) carries texmacs 1:1.0.6-11 . Assuming that pdebuild is used for the first time, the following recipe can be used to build the unstable's texmacs packages on a machine running Debian Etch (stable).
$cp /usr/share/doc/pbuilder/examples/pbuilder-distribution.sh ~/bin/pbuilder-sid
$mkdir -p ~/pbuilder/result
$sudo aptitude install cdebootstrap
$pbuilder-sid create # if second time, use 'pbuilder-sid update'

$cat ~/bin/pdebuild-distribution.sh
#!/bin/sh

DISTRIBUTION=`basename $0 | cut -f2 -d '-'`
BASE_DIR="$HOME/pbuilder"
pdebuild --buildsourceroot fakeroot \
--buildresult $BASE_DIR/result \
-- --basetgz $BASE_DIR/$DISTRIBUTION-base.tgz \
--distribution $DISTRIBUTION $@

$cp ~/bin/pdebuild-distribution.sh ~/bin/pdebuild-sid
$chmod +x ~/bin/pdebuild-sid
$cd ~/practice/
$wget http://ftp.debian.org/debian/pool/main/t/texmacs/texmacs_1.0.6-11.dsc
$wget http://ftp.debian.org/debian/pool/main/t/texmacs/texmacs_1.0.6.orig.tar.gz
$wget http://ftp.debian.org/debian/pool/main/t/texmacs/texmacs_1.0.6-11.diff.gz
$dpkg-source -x texmacs_1.0.6-11.dsc
$cd texmacs-1.0.6
$pdebuild-sid
The commands can be changed accordingly for other packages as well as for distributions other than sid. The ~/bin/pdebuild-distribution.sh performs similar function for pdebuild as /usr/share/doc/pbuilder/examples/pbuilder-distribution.sh does for pbuilder.

Tested on Debian Etch, using pbuilder 0.161

recipe for building texmacs package with pbuilder

As of Fri Apr 13, 2007, the stable branch of Debian (Etch) carries texmacs 1:1.0.6-10, unstable branch of Debian (Sid) carries texmacs 1:1.0.6-11 . Assuming that pbuilder is used for the first time, the following recipe can be used to build the unstable's texmacs packages on a machine running Debian Etch (stable).
$cp /usr/share/doc/pbuilder/examples/pbuilder-distribution.sh ~/bin/pbuilder-sid
$mkdir -p ~/pbuilder/result
$sudo aptitude install cdebootstrap
$pbuilder-sid create # if second time, use 'pbuilder-sid update'
$cd ~/practice/
$wget http://ftp.debian.org/debian/pool/main/t/texmacs/texmacs_1.0.6-11.dsc
$wget http://ftp.debian.org/debian/pool/main/t/texmacs/texmacs_1.0.6.orig.tar.gz
$wget http://ftp.debian.org/debian/pool/main/t/texmacs/texmacs_1.0.6-11.diff.gz
$pbuilder-sid build texmacs_1.0.6-11.dsc
The commands can be changed accordingly for other packages as well as for distributions other than sid. More info can be found at /usr/share/doc/pbuilder/pbuilder-doc.html

Tested on Debian Etch, using pbuilder 0.161

Wednesday, April 11, 2007

executing octave scripts

Using Octave 3.0.1, bash 4.1.5(1)-release on Debian Squeeze (stable)
$cat even_odd.m
# prevent Octave from thinking that this is a function file
clear;

function even_odd1(m)
# use bitand instead of mod to figure out if a number is odd or even
# if (mod(m, 2) == 1)
if (bitand(m,1))
printf("%d is odd\n", m)
else
printf("%d is even\n", m)
endif
endfunction

n = 25
even_odd1(n)
n = 30
even_odd1(n)
The above octave script can be run
1. Directly at the command line by doing
$octave -qf even_odd.m
n = 25
25 is odd
n = 30
30 is even
2. Inside Octave by doing
$octave -qf
octave:1> even_odd
n = 25
25 is odd
n = 30
30 is even
octave:2> n
n = 30
The advantage of first method is that no interaction is necessary. Useful for well tested scripts. The advantage of second method is that variables can be accessed even after the script is executed. Useful while debugging.

3. Source the script inside Octave
$octave -qf
octave:1> source("./even_odd.m")
n = 25
25 is odd
n = 30
30 is even
This approach comes in handy if the name of the script contains any special characters (ex:- '-' hyphen) or if the script has to be called by its relative path name.

Tuesday, April 10, 2007

insert page numbers in a texmacs document

To insert page numbers inside a texmacs document, do

Document -> Page -> Type -> Paper
Document -> View -> Page Layout -> Show header and footer

Sunday, April 08, 2007

copy paste code into blogger

The difference between pasting some random text and pasting source code is that, it is necessary to preserve the formatting (indentations etc.,) when pasting the source code. If you would like to list some program inside the articles posted via blogger, then you can do the following:
  • Convert all the tabs in the program to spaces. While this step is optional, I suggest this since there would be no unwanted surprises with tabs in the final document. If you are using a good editor such as vim, this takes less than a minute.
  • Go to "Edit Html" tab when editing the post
  • Put your code inside

    <pre class="verbatim" xml:space="preserve">
      ...
    </pre>
    tags. 
  • You can also use

    <pre class="literal-block">
      ...
    </pre>
    tags. 

That's it.

Thursday, April 05, 2007

Google groups feature suggestions - 1

Today I suggested the following feature to google groups at http://groups.google.com/support/bin/request.py?contact=1

I am the maintainer of a group called xxxx. For some reasons, I have to allow non members to post to this group. So in the group settings, I chose "Anyone can post" and checked the "Hold messages from non-members for moderation". However due to this, I am receiving enormous amounts of spam at http://groups.google.com/group/xxxx/pendmsg

This is, as such, not a problem. The main problem is that I am not able to view the full headers of these pending messages. Currently, I can see only the body and subject of the pending message. Could you please allow moderators to see full headers of the pending messages? That way I can report these spams to knujon, spamcop etc.,

Followers