21 December 2011

37. Making posters in latex


As a scientist you may have discovered how much less swearing occurs when writing articles in latex rather than MS Word or other What You See Isn't Quite What You Wanted  packages (WYSIQWYW -- I guess this is an acronym that won't be taking off anytime soon). The next step is to move from using powerpoint to make posters and presentations, to using latex.

It's never elegant to post the entire code in blog form, but what to do when you can't upload simple files?

The poster style is based on a theme by Rob J Hyndman and is an adapation of i6dv by David Vilar and edited by me.


Here's beamerthemeMyTheme.sty which you should put in the same folder as your post tex file:


\ProvidesPackage{beamerthemeMyTheme} % this style was created by Rob J Hyndman and is an adapation of i6dv by David Vilar. Edited by Someone Else

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\selectcolormodel{cmyk}
\selectcolormodel{rgb}
\mode<presentation>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% custom colors
%\definecolor{i6blue}{cmyk}{1,0.305,0,0.06}
\definecolor{i6bluedark}{rgb}{0.0156,0.2578,0.5625} 
\definecolor{i6colorscheme1}{HTML}{333333}  %333333 e.g. for block title
\definecolor{i6colorblockbg}{HTML}{555555}
\definecolor{i6colorblockfg}{HTML}{FFFFFF} %block title white
\definecolor{i6colorscheme2}{HTML}{000000}  % e.g. title in headline
\definecolor{i6colorscheme3}{HTML}{F0F0F0} % e.g. for poster background
\definecolor{i6colorscheme4}{HTML}{000000} 
\definecolor{i6colorschemeHeadline}{HTML}{000000}  % for headline bg
\definecolor{i6colorschemeFootline}{HTML}{101010}  % for headline bg

% headline colors and fonts
\setbeamercolor{headline}{fg=yellow,bg=i6colorschemeHeadline}
\setbeamercolor{title in headline}{fg=yellow}
\setbeamercolor{author in headline}{fg=white}
\setbeamercolor{institute in headline}{fg=lightgray}
\setbeamercolor{separation line}{bg=i6colorscheme1}

% footline colors and fonts
\setbeamercolor{footline}{fg=white,bg=i6colorschemeHeadline}
\setbeamerfont{footline}{fg=white, size=\normalsize}

% body colors and fonts
\setbeamercolor*{normal text}{fg=black,bg=i6colorscheme3}

% block environment
\setbeamercolor*{block body}{bg=white,fg=black}
\setbeamercolor*{block title}{fg=i6colorblockfg,bg=i6colorblockbg}
\setbeamerfont{block title}{size=\large,series=\bf}

% example environment
\setbeamercolor*{example title}{fg=white,bg=i6colorscheme1}
\setbeamerfont{example title}{size=\large,series=\bf,bg=i6colorscheme1,fg=white}

\setbeamercolor{alerted text}{fg=i6colorscheme1}

\setbeamertemplate{itemize items}[triangle]
\setbeamertemplate{navigation symbols}{}  % no navigation on a poster

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{block begin}{
  \vskip0.5ex %space between boxes
  \begin{beamercolorbox}[rounded=true,shadow=true,leftskip=1ex,colsep*=0.5ex]{block title}%colsep - height block title, leftskip - title text indent
    \usebeamerfont*{block title}{\Large \insertblocktitle}
  \end{beamercolorbox}%
  {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%space between head and block
  \usebeamerfont{block body}%
%  \begin{beamercolorbox}[rounded=true,shadow=true,colsep*=0.5ex,sep=0.5ex,vmode]{block body}%colsep, sep - vert margin top and bottom
  \begin{beamercolorbox}[rounded=true,shadow=true,colsep*=0.5ex,sep=0.5ex,vmode]{block body}%colsep, sep - vert margin top and bottom
   \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.5ex}\vbox{}%
  }
  \setbeamertemplate{block end}{
  \end{beamercolorbox}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{headline}{  
  \leavevmode

  \begin{beamercolorbox}[wd=\paperwidth]{headline}
\centering
        \vskip4ex % height above text
        \usebeamercolor{title in headline}{\color{fg}\textbf{\LARGE{\inserttitle}}\\[1ex]}
        \usebeamercolor{author in headline}{\color{fg}\large{\insertauthor}\\[1ex]}
        \usebeamercolor{institute in headline}{\color{fg}\large{\insertinstitute}\\[1ex]}
  \end{beamercolorbox}

  \begin{beamercolorbox}[wd=\paperwidth]{lower separation line head}
    \rule{0pt}{2pt}
  \end{beamercolorbox}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{footline}{
  \begin{beamercolorbox}[wd=\paperwidth]{upper separation line foot}
    \rule{0pt}{2pt}
  \end{beamercolorbox}
  
  \begin{beamercolorbox}[ht=5ex,leftskip=1cm,rightskip=1cm]{footline}% ht - thickness
    \hfill \raisebox{0.4cm}{\insertfooter} %raisebox - placement of text
    \vskip1ex
  \end{beamercolorbox}

  \begin{beamercolorbox}[wd=\paperwidth]{lower separation line foot}
    \rule{0pt}{0pt}
  \end{beamercolorbox}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mode<all>

\def\footer#1{\def\insertfooter{#1}}


and here's the poster.tex file:


\documentclass[final]{beamer}
\usetheme{MyTheme}
\usepackage[orientation=portrait,size=a1,scale=1.14,grid,debug]{beamerposter}
\usepackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1.0cm}
\setlength{\TPVertModule}{1.0cm}
\usepackage{ragged2e}
\usepackage{mhchem}
\usepackage{caption}
\captionsetup{labelformat=empty,labelsep=none}


\title{A hypothetical LaTeX poster}
\author{I Am Me\inst{*} \quad She S Someoneelsei\inst{\dag} \quad A. Third Party\inst{\dag}$^{,}$\inst{\ddag}}
\institute[School of Somethingorother]{
\inst{*}%
School of Somethingorother, My University \quad
\inst{\dag}%
Department of Haxx0r
\inst{\ddag}%
Department of 1337, UC Other
}
\footer{url: http://http://www.blogger.com/ \quad email: me@blogger.com}
\date{}

\begin{document}

\begin{textblock}{6}(0.6,0.6)
\includegraphics[height=4.0cm]{mylogo_light.eps}
\end{textblock}

\begin{textblock}{6}(54.9,0.6)
\includegraphics[height=4.0cm]{ucother_logo.eps}
\end{textblock}

\begin{frame}{} 
\begin{textblock}{28.5}(0.6,6.3)

\begin{block}{Introduction}
\justifying
\begin{center}\begin{minipage}{28cm}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum gravida nisi eget lectus commodo luctus. Pellentesque vitae velit ligula. Nullam diam enim.[1,2]
\end{minipage}\end{center}
\begin{center}
\begin{figure}
\includegraphics[width=23.9cm]{screenshot.eps}
\caption{A caption for  \ce{[Fe4(H2O)8L9]^{-}}}
\end{figure}
\end{center}
\begin{center}\begin{minipage}{28cm}
Integer nec felis massa, ac tincidunt tellus. Phasellus ornare urna nec erat eleifend eu egestas arcu sodales. Cras interdum, lectus vitae ultricies rutrum, orci sapien bibendum orci, ut facilisis lectus velit at risus. Maecenas ut nisi mi. Praesent in nunc vitae justo ullamcorper placerat nec id lectus.  \ce{[[Fe4(H2O)8L9]^{-}} cluster[3]ante ipsum primis {\sc nmr}.[4]\\
\tiny{
\begin{enumerate}
\item G. Romanum, J. Eunt, G. Ite, F. Sum, \emph{A. Journal. Int. Ed.} \textbf{2011}, \emph{8}, 1943--1946.\\
\item A. Graecum, D. Hispanum, F. Molybdenum, R. Verum, H. Ipsum, P. J. Consectetur, G. Lectus, R. Ligula, M. Diam, \emph{Science} \textbf{2011}, \emph{323}, 13--17.
\item A. Graecum, D. Hispanum, F. Molybdenum, R. Verum, H. Ipsum, P. J. Consectetur, G. Lectus, R. Ligula, M. Diam, \emph{Science} \textbf{2011}, \emph{323}, 13--17.
\item A. Graecum, D. Hispanum, F. Molybdenum, R. Verum, H. Ipsum, P. J. Consectetur, G. Lectus, R. Ligula, M. Diam, \emph{Science} \textbf{2011}, \emph{323}, 13--17.
\end{enumerate} }
\end{minipage}\end{center}

\end{block}

\begin{block}{Experimental} \justifying

\begin{center}
\begin{figure}
\includegraphics[width=23.6cm]{screenshot.eps}
\caption{Another figure caption}
\end{figure}
\end{center}

\begin{center}\begin{minipage}{28cm}
Integer nec felis massa, ac tincidunt tellus. In eget lectus a ante hendrerit gravida ut a massa. Nam euismod nisi vel nulla suscipit fermentum. Quisque vel nulla nibh, at bibendum quam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc tempor pretium blandit. Nulla vulputate odio quis tortor porttitor rhoncus. Vestibulum euismod purus non dolor pharetra non tempus diam pharetra. Nulla nec mauris vitae risus dapibus eleifend eget et ipsum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec aliquam fringilla nulla, et ornare urna blandit id. In blandit lacinia massa quis tempus. Cras vel feugiat mi. Nullam risus nunc, aliquam non facilisis sit amet, condimentum id felis.  \end{minipage}\end{center}
\end{block}


\begin{block}{Data massage} \justifying
\begin{center}\begin{minipage}{28cm}
In eget lectus a ante hendrerit gravida ut a massa. Nam euismod nisi vel nulla suscipit fermentum. Quisque vel nulla nibh, at bibendum quam. Vestibulum ante ipsum primis in faucibus orci. In eget lectus a ante hendrerit gravida ut a massa. Nam euismod nisi vel nulla suscipit fermentum. Quisque vel nulla nibh, at bibendum quam. 

\end{minipage}\end{center}
\end{block}


\end{textblock}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{textblock}{28.5}(30,6.3)

\begin{block}{Data reduction} \justifying
\begin{center}\begin{minipage}{28cm}
 Donec aliquam fringilla nulla, et ornare urna blandit id. In blandit lacinia massa quis tempus. Cras vel feugiat mi. Nullam risus nunc, aliquam non facilisis sit amet, condimentum id felis.\end{minipage}\end{center}
 
\begin{table}
\begin{tabular}{c c}
\begin{minipage}{14cm} 
\begin{center}
\begin{figure}
\includegraphics[width=10.0cm]{adobe.eps}
\caption{A caption}
\end{figure}
\end{center}
\end{minipage} 
&
\begin{minipage}{14cm}
\begin{figure}
\includegraphics[width=10.0cm]{adobe.eps}
\caption{A caption.}
\end{figure}
\end{minipage}

\end{tabular} \end{table}  
\begin{center}\begin{minipage}{28cm}
Donec aliquam fringilla nulla, et ornare urna blandit id. In blandit lacinia massa quis tempus. Cras vel feugiat mi. Nullam risus nunc, aliquam non facilisis sit amet, condimentum id felis.\end{minipage}\end{center}  
 
\begin{center}
\begin{figure}
\includegraphics[width=12.6cm]{screenshot.eps}
\caption{Map of $\displaystyle \sum_{i}^{}(A(\lambda_{i})_{obs.}-A(\lambda_{i})_{calc.})^{2}$ as a function of pK$_{\textrm{a}}$s}
\end{figure}
\end{center}

\end{block}

\begin{block}{Fringilla nulla}
\justifying
Donec aliquam fringilla nulla, et ornare urna blandit id. In blandit lacinia massa quis tempus. Cras vel feugiat mi. Nullam risus nunc, aliquam non facilisis sit amet, condimentum id felis. $\displaystyle \frac{1}{T_{2r}}\approx\frac{C_{m}}{C_{aq}} \cdot k$:
\begin{eqnarray}
-\Delta H^{\ddag} \frac{1}{T} + \Delta S ^{\ddag}&=& R \cdot ln (\frac{\pi}{p_{m}}\frac{h}{k_{b}}\frac{1}{T}\Delta \nu) \nonumber
\end{eqnarray}

\begin{table}
\begin{tabular}{c c}
\begin{minipage}{14cm}
\begin{center}
\begin{figure}
\includegraphics[width=12.6cm]{screenshot.eps}
\caption{Observed $\Delta$H$^{\ddag}$ as a function of pH.}
\end{figure}
\end{center}
\end{minipage}
&
\begin{minipage}{14cm}
\begin{center}
\begin{figure}
\includegraphics[width=12.6cm]{screenshot.eps}
\caption{Observed $\Delta$S$^{\ddag}$ as a function of pH.}
\end{figure}
\end{center}
\end{minipage}
\end{tabular} \end{table}
\begin{center}\begin{minipage}{28cm}
 Ut ultrices ipsum vitae ipsum sagittis eget egestas dui interdum. 
\end{minipage}\end{center}
\end{block}

\begin{block}{Summary}
\begin{center}\begin{minipage}{28cm}
\begin{itemize}
\item Ut ultrices ipsum vitae ipsum sagittis eget egestas dui interdum. Phasellus nec nisl quam. 
\item Ut ultrices ipsum vitae ipsum sagittis eget egestas dui interdum. Phasellus nec nisl quam. 
\end{itemize}
\end{minipage}\end{center}
\end{block}

\begin{block}{Acknowledgements} \justify
\begin{center}\begin{minipage}{28cm}
Ut ultrices ipsum vitae ipsum sagittis eget egestas dui interdum. \\
Phasellus nec nisl quam. \\
\end{minipage}\end{center}
\end{block}


\end{textblock}
\end{frame}
\end{document}


36. PDF and annotation/editing under linux -- no solutions

Update: There are newer posts here and here.


Galley proofs of scientific articles are typically provided in the form of pdf files with ambiguous passages and editorial suggestions marked. You are then expected to add comments to the pdf indicating whether you agree to changes and/or clarifications. Well, good luck doing that.

It does appear that Acrobat Reader (9.4.x under linux, 10.1.1 under windows) does not support annotation/commenting anymore. See picture for security settings:

I fooled around with pdf2ps + ps2pdf, pdftk allow AllFeatures etc. No luck. Still no annotation in acroread.

PDFedit didn't help much. It looks like an advanced piece of software, but it offers no obvious way of making post-it type comments. The best approximation is adding text to the margins, but it's not what I set out to do.

Sadly, using wine + pdf x-change viewer (http://appdb.winehq.org/objectManager.php?sClass=application&iId=5549) is at the time of writing the best solution. You can download the free version here: http://www.tracker-software.com/product/pdf-xchange-viewer (there's also a 'pro' version)

It really is a straightforward piece of software, and does the trick, so no complaints there. However, it is very unfortunate that such a central piece of functionality is unavailable under linux.

Also, it does seem that acrobat reader is intentionally crippled -- from what I understand there is no obvious reason why commenting isn't allowed (i.e. not the fault of the authors of the pdf) other than because Adobe wants you to shill out money for their 'Pro' version (...interesting how FOSS normally doesn't market itself by adding X or Pro to the name...)


20 December 2011

35. Fixing: gnome alt+f2 broken, returns command not found -- debian testing current bug, description and solution

22/12/2011
An explanation and solution is here: http://forums.linuxmint.com/viewtopic.php?f=198&t=67502&p=510197#p512994

SOLUTION
--------------
My version of the solution above is a follows:

1. First, locate the file to edit

locate utils.js | grep misc

which returns

/usr/share/gnome-shell/js/misc/util.js

2. Next, confirm that argc is present (this is what's causing the problems)

cat /usr/share/gnome-shell/js/misc/util.js | grep argc

which returns

        let [success, argc, argv] = GLib.shell_parse_argv(command_line);
    let success, argc, argv;
        [success, argc, argv] = GLib.shell_parse_argv(command_line);

There are more elegant ways of doing this, but this is how I roll.

3. Edit /usr/share/gnome-shell/js/misc/util.js as root

sudo vim /usr/share/gnome-shell/js/misc/util.js (you can of course use gedit, nano, emacs etc.)

search for argc and remove all instances of of it, so that
[success, argc, argv] turns into to  [success, argv]
etc.

Once you've removed all argc, save and then hit alt+f2 in gnome, type r and enter to restart the shell. Then hit alt+f2 and type e.g. gedit to test it

It now works!

Reading through bug reports it seems it won't be fixed in Debian -- instead we'll have to wait until gnome 3.2 rolls out. Or just follow the instructions above.

-------------------------------
THE OLD POST
20/12/2011

(Current version of gnome-shell is 3.0.2-8+b1)


Hitting alt+f2 to start e.g. gedit or another program used to be straightforward.

During the past week it hasn't worked properly though -- instead the entry of any command has returned a 'command not found'. If you instead of simply typing in gedit type in /usr/bin/gedit, chances are the computer will experience an odd sort of freeze -- the top bar will be unresponsive, the black entry box will remain, the screen will be shaded, but gedit won't open. You will, however, be able to continue using your computer, but it'll be a dark experience.

Symptomatic descriptions of the bug and experiences are available here:
https://bugzilla.redhat.com/show_bug.cgi?id=719675
https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/816762


16 December 2011

32. Apt-pinning in Debian -- simple example


---------------------------------------------------------
Summary:
* create an /etc/apt/preferences files
* add the repos to /etc/apt/sources.list
* put a hold on packages if downgraded
---------------------------------------------------------


I'm not an expert at this. However, I managed to get apt-pinning to work using this approach. I wish I had a better grasp of how .d directories work, but I don't, which is why a monolithic /etc/apt/preferences files is used

Anyway, apt-pinning is an interesting approach to having a system in which some packages are pulled from stable, some from testing and some from unstable. For example, if the Evolution version in stable is missing what you consider critical functionality, and a better version is present in the testing repos, you can install the testing version of Evolution, while still running a mainly stable version of debian. In other words, apt-pinning allows you to pull single packages from other debian releases.

You need to add the repos to your /etc/apt/sources.list
e.g.

deb ftp://ftp.au.debian.org/debian/ testing main contrib non-free
deb ftp://ftp.au.debian.org/debian/ stable main contrib non-free
deb ftp://ftp.au.debian.org/debian/ unstable main contrib non-free


You also need to create a file called /etc/apt/preferences
e.g.

Package: *
Pin: release a=testing
Pin-Priority: 990

Package: *
Pin: release a=unstable
Pin-Priority: -10

Package: *
Pin: release a=stable
Pin-Priority: -10


The example preferences file prioritises testing over unstable and stable. Default apt behaviour is to use the highest version and revision of each package is there are several alternatives i.e. without /etc/apt/preferences you will end up with the unstable/sid release. The Pin-Priority values are a science onto themselves.

Here's what
 man apt_preferences
 says:


P > 1000
           causes a version to be installed even if this constitutes a downgrade of the package

       990 < P <=1000
           causes a version to be installed even if it does not come from the target release, unless the installed version is more recent

       500 < P <=990
           causes a version to be installed unless there is a version available belonging to the target release or the installed version is more recent

       100 < P <=500
           causes a version to be installed unless there is a version available belonging to some other distribution or the installed version is more recent

       0 < P <=100
           causes a version to be installed only if there is no installed version of the package

       P < 0
           prevents the version from being installed

I think negative values for the unwanted releases is a good place to start, or you may start automatically pulling over packages that depend on the one package which you want.

A way to see if it's working is to (for the package Evolution)
apt-cache showpkg evolution

Package: evolution
Versions: 
3.0.3-3+b1 (/var/lib/apt/lists/ftp.au.debian.org_debian_dists_unstable_main_binary-amd64_Packages)
..
3.0.3-3 (/var/lib/apt/lists/ftp.au.debian.org_debian_dists_testing_main_binary-amd64_Packages)
..
2.30.3-5 (/var/lib/apt/lists/ftp.au.debian.org_debian_dists_stable_main_binary-amd64_Packages)
..

..

Provides: 
3.0.3-3+b1 - mail-reader imap-client 
3.0.3-3 - mail-reader imap-client 
2.30.3-5 - mail-reader imap-client 


Basically, it returns the different versions in the different release repos.

I've already described how to put a hold on a package so that it won't be upgraded, but here it is again (using the mpich2 package as an example):

sudo su
echo "mpich2 hold" | dpkg --set-selections

31. Update flash -- chrome on debian wheezy/testing 64 bit

You may have had problems playing flash videos recently and have been presented with a message saying that your player is out of date, and that you can either play (just this time) or upgrade. Clicking on upgrade takes you to the adobe website -- downloading the file is easy enough, but then what?

Well, here's how to upgrade.
Download the file install_flash_player_11_linux.x86_64.tar.gz
extract the libflashplayer.so file from the root of the compressed file

Figure out what files to replace:

locate libflashplayer.so
yields
/usr/lib/chromium-browser/plugins/libflashplayer.so
/usr/lib/flashplugin-nonfree/libflashplayer.so

So, in the directory where you put your new libflashplayer.so
sudo cp libflashplayer.so usr/lib/chromium-browser/plugins/libflashplayer.so
and
sudo cp libflashplayer.so /usr/lib/flashplugin-nonfree/libflashplayer.so


Restart your browser, and you should be good to go.

30. "Bench-marking" nwchem with mpich2 on debian wheezy

For various reasons my beowulf has been dismantled and in boxes for most of the year, with only the six-core node seeing use a normal work computer.

Anyhow, here's a very unscientific test of the performance of my six-core (phenom II, 2.8 GHz, 8Gb RAM) running the nwchem code compiled in the previous post.

The speed-tests were performed by starting up mpd
mpd --ncpus=6&
and then executing with
time mpdrun -n x ./nwchem input.nw
where x is an integer signifying the number of cores

The nwchem.nw files I used was

nwchem.nw
start benzene 

geometry units angstroms
C  0.100  1.396  0.000
C  1.209  0.698  0.000
C  1.209 -0.698  0.000
C  0.000 -1.396  0.000
C -1.209 -0.698  0.000
C -1.209  0.698  0.000
H  0.000  2.479  0.000
H  2.147  1.240  0.000
H  2.147 -1.240  0.000
H  0.000 -2.479  0.000
H -2.147 -1.240  0.000
H -2.147  1.240  0.000
end
basis
 H library sto-3g
 c library sto-3g
end
dft
    xc b3lyp
end
task dft optimize

Here are the results:


(x is number of cores; times in seconds)
x   Run 1   Run 2    Run 3   Run 4   Run 5
1* 40.8     37.9     40.7     40.3      39.9
1   22.2     40.7      40.6    44.8      38.2
2   22.8     22.4     16.3     23.5       21.5
3   14.1     12.3     15.7     15.5       15.1
4   14.5     11.5     12.0     14.9       14.7
5   11.4     11.5     8.9       11.9       12.5
6   16.0     12.2     13.4     9.9        9.6

* No mpd running; executed using time nwchem nwchem.nw



So here's the unscientific part -- the computer is running a full desktop environment with evolution, chrome etc open in the background so that each run sees a slightly different system. I've tried to vary the order in which the runs were made though.

 A guess would be that a longer run would yield more reproducible results. As it is now, the length of the runs vary significantly. The only lesson that can be obtained is that it doesn't help much throwing more cores at a problem as the optimisation times only drop off slowly past a certain point.

Edit: I've run the same file using an almost identical set-up on two more boxes
Don't compare the benchmarks when running at maximum numbers of cpu, since this will be heavily affected by other processes.

Optiplex 990 (Intel i5 2400, 4 cores @ 3.1 GHz, 8 Gb RAM)

x   Run 1   Run 2    Run 3   Run 4   Run 5
1   45.80   46.97  46.56   46.95   39.01
2   22.77  25.81   26.93  26.61   25.81
3   17.18  16.48   18.89  19.26  19.18
4   11.62  16.62   15.82  15.86   16.03

Homebuilt (3 core AMD Athlon 2 X3 @ 3.1 GHz, 4 Gb RAM)

x   Run 1   Run 2    Run 3   Run 4   Run 5   Run 6   Run 7
1   43.74   57.02   40.22   47.89   53.87
2   31.41   22.31   25.83   32.31   33.00
3   36.19   31.01   43.55   24.75   37.82   33.95   27.06


15 December 2011

29. Compiling/Building nwchem with mpich on debian testing 64 bit (Wheezy -- 15/12/2011)

So, as seen in the previous post, mpich2 ver 1.4 and nwchem 6.0 don't play nicely together.

Continuing with the virtual machine in the previous post, I added a line referencing the stable version to /etc/apt/sources.list:
deb ftp://ftp.au.debian.org/debian/ stable main contrib non-free

Important: I ADDED that line -- all lines referencing the testing version (or wheezy) are left untouched.
Do
sudo apt-get update
Since the versions in stable are older adding that line won't affect your system.

Now,
apt-cache showpkg mpich2

Under provides it should say:
1.4.1-1+b1
1.2.1.1-5

Now,
sudo apt-get install mpich2=1.2.1.1-5

You'll get a warning that you're about to downgrade, which is what we're trying to do.

sudo apt-get autoremove (will downgrade dependent packages. Just go with it)
aptitude search mpich2
check what's installed and what version
aptitude show libmpich2-dev
If it's 1.4.1 or not installed, make sure to set it to 1.2.1.1-5 just like for mpich2

Run sh myconfig.sh (see here for the script). Seems to build ok. All the mpd tools are where they should be.
NOTE: according to this post mpd isn't needed in newer (>=1.3) versions.

In summary, this seems to be the way to build nwchem on wheezy -- by downgrading the mpich2 and mpich2-dev packages. Since downgrading those packages may affect other packages as well, it may cause problems, but so far so good.

Testing the built binary:
mpd --ncpus=4 &
mptrace -l
mpdrun -n 4 ./nwchem ../../examples/dirdyvtst/h3/h3tr1.nw

All is good

EDIT (16/12/2011):
So, you've installed an older version of a package. apt-get will want to upgrade it, so you should put the packages on 'hold'. Every time you upgrade your system apt-get will warn you that there are packages on hold, so don't worry about forgetting about it

sudo su
echo "mpich2 hold"|dpkg --set-selections
echo "libmpich2-dev hold"|dpkg --set-selections

(taken from http://forums.debian.net/viewtopic.php?f=20&t=71448&start=15)

As an aside, you may want to downgrade gromacs-mpich to use mpich2-1.2 as well:
sudo apt-get install gromacs-mpich=4.0.7-3

28. Compiling/Building nwchem with mpich on debian 64 bit (15/12/2011) -- observations of squeeze, wheezy, sid and experimental

** NOTE: the nwchem build in the debian repos (6.0-1) does not support mpich. It will not run in parallel. It seems like 6.0-2 will, but it's not in the repos yet, and looking at the package status page I get a bit worried about the likelihood of seeing a finished build for amd64 **

** The solution to building on debian testing and above (and presumably ubuntu >10.10) is here: http://verahill.blogspot.com/2011/12/building-nwchem-on-debian-testing-64.html **

** NOTE: according to this post mpd isn't needed in newer (>=1.3) versions. It is needed -- and provided -- by mpich2 1.2**

So, I've had problems building nwchem on debian testing for about a year now. Actually, building nwchem is pretty straightforward, but building it with mpich2 support doesn't seem to work.

I also noted that mpd doesn't refer to an mpich daemon anymore, leading me to suspect that maybe the version of mpich2 (now at 1.4; was at 1.2 when I built on ubuntu early in the year) could be part of the problem.

Long story short: it builds with mpich2 support on debian stable (squeeze), but not debian testing (wheezy).


----------------------------------
SQUEEZE
----------------------------------
Here's what I did: I installed debian stable 64 bit in virtualbox from the business-card iso (standard tools + ssh. No desktop environment). I made sure the system (squeeze) was up to date, downloaded nwchem-6.0 and extracted it in /home/myhome/nwchem/nwchem-6.0  and create a build file, myconfig.sh, with the following content:
export LARGE_FILES=TRUE
export TCGRSH=/usr/local/bin/ssh
export NWCHEM_TOP=/home/myhome/nwchem/nwchem-6.0
export NWCHEM_TARGET=LINUX64
export NWCHEM_MODULES=all
export USE_MPI=y
export USE_MPIF=y
export MPI_LOC=/usr
export MPI_INCLUDE=$MPI_LOC/include/mpich2
export LIBMPI="-lfmpich -lmpich"
cd $NWCHEM_TOP/src
make nwchem_config
make FC=gfortran

Only thing remaining before building is:
sudo apt-get install mpich2 gfortran

mpich2: version 1.2

sh myconfig.sh then starts the build process which takes about 10-20 minutes in a virtual machine. Everything good. Works as should -- I only have one core in the virtual machine, so can't do much testing. It builds without a hitch though. In addition mpd, mpdtrace etc are all present.

 Time to take a snapshot. 1.7 Gb.
----------------------------------
WHEEZY
----------------------------------
I next edited /etc/apt/sources.list and replaced all instances of squeeze with wheezy (including commenting out the last two lines (wheezey-updates / squeeze-updates), did sudo apt-get update and sudo apt-get dist-upgrade

mpich2: version 1.4.1.
mpd and mpdtrace are now gone. Only mpi* around.

Tried sh myconfig.sh again (added a make clean before make nwchem_config). It builds for a long time - 10-20 minutes -- ultimately the build fails with
..
..
/usr/lib/libmpich.so: undefined reference to `MPL_trid'
..
..
/usr/lib/libmpich.so: undefined reference to `MPL_trinit'
collect2: ld returned 1 exit status
make: *** [all] Error 1

The undefined references are: MPL_trid, MPL_trvalid, MPL_env2int, MPL_trrealloc, MPL_trspace, MPL_trDebugLevel, MPL_TrSetMaxMem, MPL_trlevel, MPL_trmalloc, MPL_putenv, MPL_env2bool, MPL_env2range, MPL_trcalloc, MPL_trfree, MPL_en2str, MPL_trstrdup, MPL_trdump and MPL_trinit

So no luck with Wheezy, which is the system I run on all my computers. I've actually tried quite a few approaches under Wheezy and have managed to complete the odd build, but without getting proper functionality i.e. using mpiexec -n 6 six instances are created instead of one instance spread across six cores so that the system is solved six times instead of just one.


----------------------------------
SID.
----------------------------------
Time to take another snapshot followed by an upgrade.
The wheezy snapshot is 2.2 Gb -- wonder where the 0.5 Gb come from?

Replacing all instances of wheezy with sid using vim (:%s/wheezy/sid/g). Fails to fetch http://security.debian.org/dists/sid/updates/main/binary-amd64/Packages during sudo apt-get update. Oh well. Remove that line from sources.list. Now update works.
Then sudo apt-get dist-upgrade. 140 Mb of archives to get.


As a general thought -- maybe it'd be worth keeping a copy of sid in a virtual machine just to see what's around the corner?

Upgrade done, sudo shutdown -r now
mpich2: version 1.4.1, same as wheezy. No mpd or mpdtrace.

Try building and...starts at 14:17, fails at 14:45. Same errors as for Wheezy.

Last chance -- snapshot (1.9 Gb...), add a ref to experimental and...no updates. They are the same. Not worth trying thus.
------------------------------------


So there you go -- nwchem builds ok on Squeeze using mpich2 ver 1.2, but not on any of the more up-to-date distros. I also wonder about the lack of mpd/mpdtrace -- in Squeeze mpd is the mpich daemon, while in Wheezy and above it's the Music Player Daemon. Something is odd here.

Coming next: can you build nwchem on Wheezy if you pull mpich2 ver 1.2 from the archives? Of course you can. The answer and how-to is here: http://verahill.blogspot.com/2011/12/building-nwchem-on-debian-testing-64.html

11 December 2011

27. Linux: some applications

Here are some linux tools which I've found myself using:
_Terminal/cli_:
email -- mutt
chat -- mcabber
spreadsheet -- sc, sed + gawk, python
calculator -- bc
editing -- vim, nano
browser -- elinks
music -- cplay
plotting -- gnuplot
maths -- octave, maxima
Gnome (some of these I use only in the terminal, so I list them twice):
terminal -- guake
latex -- gvim, texmaker, latexilla
editing -- gvim, gedit
plotting -- gnuplot
maths -- octave, maxima
system stats -- conky
email -- evolution
chat -- gajim
browser -- chrome
video -- vlc
music -- mostly cplay in cli, but otherwise vlc
crypto -- truecrypt
password management -- keepassx
I probably spend 90% of my time using vim since, being a 'simple' editor, it's so versatile. Before taking the time to learn vim, I used gedit (and to a smaller extent nano) for the same purpose. Nano is fine, but vim is more ubiquitous (in the form of vi) and has an excellent tutorial included. I simply don't know what the full capabilities of nano are -- maybe it's only as powerful as, say, notepad, or maybe it can do everything vim can.
I gave emacs a serious try about a year ago, and it didn't suit me. I do appreciate that emacs can be considered as an OS almost in itself, but since I believe in the idea of one program - one task, and find vim more user-friendly (not meaning learner-friendly, although it is too) I felt more motivated to get serious with vim. Two weeks with emacs brought me to the same level as two rather relaxed evenings with vim.

26. Linux The Basics: the evolution of a user

I've used linux for a few years by now, and I find that how I do things have changed over this time. In other words, the way you use linux will change and evolve as you learn more. I never experienced this in windows -- there you click your way around, and you quite easily become stuck with a handful of applications and a way of doing things.

In the beginning, I dual-booted. Windows at work, where I would use originlab's origin, micromath scientist, excel etc. Linux at home where I'd browse the web, check email and chat. That lasted for a month or so, until I become confident that virtualbox could handle a copy of XP.

For about a year I persisted in doing most of my personal work in linux, and using virtualbox to run origin, use word to write articles etc. At least that way I only had to boot one operating system and could make the initially frightening step of removing windows for ever (you're a green linux user without anyone to help you, you have a paid job relying on you being able to use your computer, and you sever the ties with an OS which has been with you since 1993? It's frightening)

Making the transition complete required finding native ways of doing things. Instead of using origin I used gnuplot. I started using latex via texmaker. sed + gawk with a little bit of python has been a great stand-in for excel (there's always gnumeric as well). Latex has replaced powerpoint as well - I don't know why it never occurred to me before to use pdfs for presentation. I mean, it makes a whole lot more sense using something that's designed to be portable (fonts is the one theoretical issue) and which is pre-compiled. Rendering on the fly as powerpoint does is just asking for trouble (and as anyone who's ever been to a conference can confirm, a fair proportion of powerpoint presenters experience problems of some sort).

I've also slowly moved form using gnome with its tools, to using the terminal. Some things simply don't need a fancy gui. While at first I used gedit under gnome and nano in the terminal, I now use vim and gvim. While vim takes an hour or two to learn well enough to use, it is worth it for the convenience of a powerful keyboard-driven and ubiquitous editor. I also use vim for editing latex documents. Mutt is good enough for email when you don't need a gui, mcabber is less intrusive than gajim if you're busy, etc. And you can use them remotely. There's nothing that can be done in matlab (which exists for linux) that I can't do in octave. I don't need mathematica since I use maxima (they are not equivalent -- but I use maxima for symbolic math and octave for numerical stuff. I've dabbled in R as well, and while it's powerful I find the behaviour of it being a bit unpredictable -- R tries to second-guess what you want to do, and often gets it right. But not always).

There's no right way (but plenty of wrong ones -- if all you are doing in linux is installing explorer and msn in wine, then why bother?) of using linux, but what I do find satisfying is that you have the freedom to create your own workflow.

Where I am today: using Linux is no big deal. I don't think about it except when explicitly confronted with another OS. It's as second-nature as using windows once was -- you knew there were people out there using something infuriating and ridiculous-looking called MacOS  going 'eep' at inopportune moments, and that there was something hardcore called UNIX (Jurassic Park -- 'It's a UNIX system. I know this!'. That was 1993 btw.) Linux is just the way I do things, and I no longer evangelise. It might be age too -- you tend to be less religious about things as you get older. If people are willing to expand their horizons and feel that using linux makes sense, then I'm willing to help. If they are happy where they are today, that's fine too. Just don't email me any doc, docx or xls files where simple text files or a pdf would do -- that's just presumptuous in the other direction.

The main problem which hasn't been solved to this day is actually word. I can't stand the fetid piece of excrement (most people have at some point been frustrated by self-moving figures or odd formatting incidents), but if you collaborate with other people in writing articles and those people aren't willing to spend the time necessary to learn LaTex, you're pretty much stuck. Well, articles are better written by a single author anyway - writing by committee never flows. Anyway, turns out Office 2003 installs just fine in Wine. At this point, I find it difficult to understand why people insist on using binary formats like .doc and docx even for unformatted text. LaTeX works for me, and it suits my way of working.

Anyway, each to his or her own. The main challenge for a linux user isn't so much how to configure a certain piece of software as in finding out about the existence of the piece of software in the first place.

25. Linux The Basics: Google talk using Gajim or mcabber

Empathy is the stock gnome chat client, gajim is a REALLY versatile python-based chat client which integrates with gpg/pgp and mcabber is a command line chat client.

While I used empathy for a few years, I much prefer gajim. Partly it's the geek cred that comes with using something a bit less common, but mostly it's because it 1) supports gpg, 2) is highly configurable and 3) is easy to use. It's available in the debian repos. I like mcabber over centerim for the same reason - gpg support. Now, if I only had friends who were as paranoid as I...

[gajim]
Jabber ID: youruser@gmail.com
Resource: Gajim
Priority: adjust to status

Hostname: talk.google.com
Port: 5223

If you use gpg, go to the Personal information tab
You don't need to select 'Use gpg agent' (gpg agent segfaults on one of my boxes)


[mcabber]

The following goes into ~/.mcabber/mcabberrc

set color_background=default #allows transparent background

# Account
set jid = youruser@gmail.com
set password = areallylongandcomplicatedpasswordwhichyoullneverremember
set server = talk.google.com
set port = 5222
set ignore_self_presence = 1 #show self in list?

# GPG/PGP
set pgp = 1
set pgp_private_key = "01100110C1C1C1C1" # get the Key ID from seahorse 
set pgp_passphrase_retries = 3

set nickname = blofeld
set spell_enable = 1
set spell_lang = en_GB
set spell_encoding = UTF-8
set cmdhistory_lines = 250
set roster_display_filter = ofdna
set max_history_blocks = 8
set message_autoaway = Auto-away (idle)
set escdelay = 50

alias me = say /me
alias online   = status online
alias away     = status away
alias dnd      = status dnd
alias notavail = status notavail

bind 17 = roster unread_next
bind 24 = roster alternate
bind 269 = roster toggle_offline
bind 276 = roster toggle
bind 521 = buffer up
bind 514 = buffer down

24. Linux and The Basics: configuring Evolution for gmail or fastmail accounts

While it comes more naturally to post a blog entry when you've just managed to fix a problem which has been nagging you, it helps newcomers to the linux community if you post how-to guides for the more basic stuff.

Since I can see what search terms drive people to the blog, I get a very simplistic overview of what people are looking for but which the blog doesn't yet provide. So, here are the gmail and fastmail (http://www.fastmail.fm/) settings.

[gmail]

If you're using google apps with an address along the lines of user@domain.example, then keep the server names (i.e. smtp.gmail.com) but use the full address (user@domain.example) as the user name.


--Receiving email
server type: imap (or imap+)
server: imap.gmail.com
username youruser@gmail.com
Use secure connection: ssl
Authentication type: password

--Sending email
Server type: smtp
server: smtp.gmail.com:587
use secure: tls
type: login
username youruser@gmail.com

--Defaults
Drafts: youruser@gmail.com/Drafts
Sent: youruser@gmail.com/Sent
etc.
*******************************
[fastmail] -- fastmail has a lot of domains. Like for google apps this means you must include the domain name in the username. Here's how it's done for imap.cc


--Receiving email
server type: imap (or imap+)
server: mail.messagingengine.com
username youruser@imap.cc
Use secure connection: ssl
Authentication type: password

--Sending email
Server type: smtp
server: mail.messagingengine.com
server requires authentication: yes
use secure: tls
type: login
username youruser@imap.cc

--Defaults
Drafts: youruser@imap.cc/INBOX/Drafts
Sent: youruser@imap.cc/INBOX/Sent
etc.

06 December 2011

23. Configuring Mutt for two IMAP accounts

Edit: fastmail configuration added -- see beneath original post

Here's my situation: I have a personal gmail account, and a google apps gmail account via my job.

A lot of the configuration stuff (gpg in particular) was copy/pasted from some website a few years ago. Kudos to them. If I only remembered who they were, I'd give credit where credit is due.

Since I'm paranoid about protecting my identitity, let's say that the google apps account is vera@hill.com and my gmail account is verahill@gmail.com (it isn't).

Here's how it can be done:
1. create ~/.mutt
2. You want to create the following files in ~/.mutt :
private.account
work.account
muttrc


Optional:
aliases
signature.private
signature.work

3. Here are the contents of the files (the passwords are from http://xkcd.com/936/):

~/.mutt/private.account:
set from=verahill@gmail.com
set hostname="gmail.com"
unset folder
set folder="imaps://verahill@gmail.com@imap.gmail.com"
set postponed="=Drafts"
set record="=Sent"
set smtp_url="smtps://verahill@gmail.com@smtp.gmail.com"
set spoolfile="imaps://imap.gmail.com/INBOX"
set from='Vera Hill <verahill@gmail.com>'
set signature="~/.mutt/signature.private"

~/.mutt/work.account:
set from=vera@hill.com
set hostname="hill.com"
unset folder
set folder="imaps://vera@hill.com@imap.gmail.com"
set smtp_url="smtps://vera@hill.com@smtp.gmail.com"
set from='Vera Hill <vera@hill.com'
set realname='Vera Hill'
set postponed="=Drafts"
set record="=Sent"
set spoolfile="imaps://imap.gmail.com/INBOX"
set signature="~/.mutt/signature.private"

basic ~/.mutt/muttrc
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

set sort='threads'
set sort_aux='last-date-received'
set imap_check_subscribed


auto_view text/html #needs ~/.mailcap and install elinks!
set attribution="* %n <%a> wrote\a ecrit:\n"

set pager_index_lines="15" #split view 

# Make sure the inbox updates and bind a key
set timeout=15
set mail_check=60
bind index "i" imap-fetch-mail

#dual boxes specific
macro index <f3> '<sync-mailbox><enter-command>source ~/.mutt/private.account<enter><change-folder>!<enter>'
macro index <f4> '<sync-mailbox><enter-command>source ~/.mutt/work.account<enter><change-folder>!<enter>'

folder-hook 'verahill@gmail.com' 'source ~/.mutt/private.account'
folder-hook 'vera@hill.com' 'source ~/.mutt/work.account'

account-hook imaps://verahill@gmail.com 'set imap_user=verahill@gmail.com imap_pass=correcthorsebatterystaple smtp_pass=correcthorsebatterystaple'
account-hook imaps://vera@hill.com 'set imap_user=vera@hill.com imap_pass=Tr0ub4dor&3 smtp_pass=Tr0ub4dor&3'
source ~/.mutt/private.account # default account

~/.mailcap:

#allows viewing html, but requires that elinks is installed
text/html;                      elinks %s; nametemplate=%s.html
text/html;                      elinks -dump %s; nametemplate=%s.html; copiousoutput


You can do a lot more -- if you want to use an address book (aliases), create a file called ~/.mutt/aliases with each line having an alias of the format:
alias  Obama "Barak Obama" <potus@whitehouse.gov>

Add the following to the end of your muttrc:
 # Addressbook
set alias_file=~/.mutt/aliases
set sort_alias=alias
set reverse_alias=yes
source $alias_file

If you want to use GPG add this to your muttrc (anywhere) and the ID of your key is C1C2C3C4:
# GPG stuff - autosign


set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f"
set pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f"
set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f"
set pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f"
set pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f"
set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0xC1C2C3C4 -- -r %r -- %f"
set pgp_encrypt_sign_command="pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0xC1C2C3C4 -- -r %r -- %f"
set pgp_import_command="gpg --no-verbose --import -v %f"
set pgp_export_command="gpg --no-verbose --export --armor %r"
set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r"
set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r" 
set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r" 
set pgp_autosign=yes
set pgp_sign_as=0xC1C2C3C4
set pgp_replyencrypt=yes
set pgp_timeout=1800
set pgp_good_sign="^gpg: Good signature from"

If you prefer vim to nano:
set editor="vim -c 'set tw=70 et' '+/^$' "
set edit_headers=yes

A colour-scheme which happens to work with my set-up for guake:
color index green black plain
color normal green black
color status white black
color body green black plain
color header cyan black plain
color quoted blue black
color tree green black

Not sure what this does (something to do with headers) but it's there in my file:

ignore "Authentication-Results:"

ignore "DomainKey-Signature:"

ignore "DKIM-Signature"

hdr_order Date From To Cc

EDIT:
If you want to add a fastmail account (in my case me@imap.cc), do this:
There's no free smtp service from fastmail, so I use the gmail smtp service

Create imapcc.account in ~/.mutt and fill it with

set from=me@imap.cc
set hostname="imap.cc"
unset folder
set folder="imaps://me@imap.cc@messagingengine.com"
set postponed="=Drafts"
set record="=Sent"
set smtp_url="smtps://verahill@gmail.com@smtp.gmail.com"
set spoolfile="imaps://messagingengine.com/INBOX"
set from='Me at gmail <verahill@gmail.com>'
set signature="~/.mutt/signature.private"


and edit ~/.mutt/muttrc to add the following lines:

macro index <f5> '<sync-mailbox><enter-command>source ~/.mutt/imapcc.account<enter><change-folder>!<enter>'

folder-hook 'me@imap.cc' 'source ~/.mutt/imapcc.account'
account-hook imaps://me@imap.cc 'set imap_user=me@imap.cc imap_pass=ashortpassword smtp_pass=correhorsebatterystaple'

05 December 2011

22. gnome-shell/GNOME3 -- acceptance

So after the turmoil of being thrown into a new desktop metaphor, I've finally reached a stage where I'd feel less at home in Gnome 2.3 than 3.0. Truth be told, the new gnome is both pretty and quite responsive. Key to making Gnome 3 usable is, however, that enough shell extensions are installed that it works similar to the old gnome. The application centric desktop may work for casual users (email/browser), but not for traditional linux/unix applications where different parts of a work flow is handled by different applications (e.g. latex -- scripting/composition in one application, compilation by another, inspection in a third; or gnuplot -- data preparation, gnuplot scripting, visualisation of output file).

But once all the shell extensions are installed, it's back to business as usual.

Even Linus seems to be coming around to Gnome 3 after mumbling about defecting to xfce4: https://plus.google.com/102150693225130002912/posts

So far I've only had one unresolved problem - an 'old' desktop with a radeon 5400 hd card won't run gnome-shell on debian testing. No acceleration. Oh well. At least all my other computers are reasonably happy so far.

26 November 2011

21. Current Bug -- gnome applications unresponsive to keyboard input

UPDATE 02/02/2012:
It seems like whatever the problem was, it's gone now. An up-to-date testing system with ibus runs smoothly.

26/11/2011
For some reason, after updating today I'm having a hard time entering input in various gnome applications, whereas non-gnome applications work fine.
E.g. I can't type certain letters, and in general it's difficult to provide any inpurt, in gnome-terminal and gnome-session-properties. lxterm and guake work completely normal though.

No sure what is causing this, but it's happening on my Thinkpad SL410 as well as on my Optiplex 910. The only thing they have in common is the operating system (up-to-date debian testing 64 bit).

Don't know enough about it to file a bug report.

Edit: the problem is present in Evolution as well. Still present as of 28/11/2011. Problem exists on a home-built six-core AMD with 1 GB graphics card.

Edit 2: It sounds a bit like this, which was reported in June (!).
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631116
It seems to be related to iBus/SCIM


Edit 3: Evolution is also affected, as is gEdit. Turning off iBus 'solves' the problem. Now, why does it affect the standard gnome applications, but not other packages?

At any rate, this bug has given me the incentive to leave gnome-terminal for guake, and to give alpine and thunderbird a try instead of evolution.

I tried
sudo apt-get install ibus-gtk3
sudo apt-get autoremove ibus-gtk

iBus still works. But unfortunately evolution is still way too slow to be useful.

25 November 2011

20. Is there no molecular weight calculator in the Debian repos?

UPDATE: see here for an isotopic calculator written in python -- it calculates mass as well: http://verahill.blogspot.com.au/2012/10/isotopic-pattern-caculator-in-python.html

The best molecular weight calculator which I've encountered is Matthew Monroe's Molecular Weight Calculator, which can be found at http://ncrr.pnnl.gov/software/

It does everything. Molecular weights. Isotopic patterns. And so, so, so much more.

It has one major drawback though - it's written for Windows. Luckily, it sort of works under Wine after you've done a bit of wine-trick-ery.

As great as the calculator is, sometimes you only need to calculate the molecular weight of something, and nothing else. Searching the debian repos I can' t find a single dedicated molecular weight calculator. In particular, a command-line driven calculator would be nice.

Seriously - it's a crying shame that the distribution with the largest repos, i.e. Debian, does not have a single passable molecular weight calculator. It is even more surprising given the number of chemistry-related packages which are present.

So, here's what I did:
a quick google on "python molecular weight calculator" brought me to http://pygments.org

A little bit of editing gave the code below, which was saved as molcalc, copied to /usr/bin, followed by sudo chmod +x /usr/bin/molcalc. It can now be called using
molcalc "(Co(CO)5)2"
and returns
The mass of (Co(CO)5)2 is 257.916890.

Here's the code, which is 99.9% the original and 0.1% my modification. All credit thus due to Lee, Freitas and Tucker.

NOTE: it doesn't handle layered parentheses. (Al(NO3)3)2 gets interpreted as Al2(NO3)3.

#!/usr/bin/python2.6
#########################################################################
# Author: Toni Lee with the help of Guilherme Freitas and Becky Tucker. Minor changes by Lindqvist
# Copyright: This module has been placed in the public domain
#########################################################################

#Import regular expressions
import re
import sys
try:
test=sys.argv[1]
except:
quit()

#Create the dictionary (From Becky with a value of 0 inserted for Uus(mass not measurable))
TableofElements ={ 'H':1.00794,'He':4.002602,'Li':6.941,'Be':9.012182,
                        'B':10.811,'C':12.0107,'N':14.0067,'O':15.9994,'F':18.9984032,'Ne':20.1797,
                        'Na':22.98976928,'Mg':24.3050,'Al':26.9815386,'Si':28.0855,
                        'P':30.973762,'S':32.065,'Cl':35.453,'Ar':39.948,'K':39.0983,'Ca':40.078,
                        'Sc':44.955912,'Ti':47.867,'V':50.9415,'Cr':51.9961,'Mn':54.938045,
                        'Fe':55.845,'Ni':58.6934,'Co':58.933195,'Cu':63.546,'Zn':65.38,'Ga':69.723,
                        'Ge':72.64,'As':74.92160,'Se':78.96,'Br':79.904,'Kr':83.798,'Rb':85.4678,
                        'Sr':87.62,'Y':88.90585,'Zr':91.224,'Nb':92.90638,'Mo':95.96,'Tc':98,
                        'Ru':101.07,'Rh':102.90550,'Pd':106.42,'Ag':107.8682,'Cd':112.411,
                        'In':114.818,'Sn':118.710,'Sb':121.760,'Te':127.60,'I':126.90447,
                        'Xe':131.293,'Cs':132.9054519,'Ba':137.327,'La':138.90547,'Ce':140.116,
                        'Pr':140.90765,'Nd':144.242,'Pm':145,'Sm':150.36,'Eu':151.964,'Gd':157.25,
                        'Tb':158.92535,'Dy':162.500,'Ho':164.93032,'Er':167.259,'Tm':168.93421,
                        'Yb':173.054,'Lu':174.9668,'Hf':178.49,'Ta':180.94788,'W':183.84,
                        'Re':186.207,'Os':190.23,'Ir':192.217,'Pt':195.084,'Au':196.966569,
                        'Hg':200.59,'Tl':204.3833,'Pb':207.2,'Bi':208.98040,'Po':210,'At':210,
                        'Rn':220,'Fr':223,'Ra':226,'Ac':227,'Th':232.03806,'Pa':231.03588,
                        'U':238.02891,'Np':237,'Pu':244,'Am':243,'Cm':247,'Bk':247,'Cf':251,
                        'Es':252,'Fm':257,'Md':258,'No':259,'Lr':262,'Rf':261,'Db':262,'Sg':266,
                        'Bh':264,'Hs':277,'Mt':268,'Ds':271,'Rg':272, 'Uus':0
}


#######################################
#Computes the MW of an atom-number pair
#######################################
def getMass(x):
    atom=re.findall('[A-Z][a-z]*',x)
    number=re.findall('[0-9]+', x)
    if len(number) == 0:
        multiplier = 1
    else:
        multiplier = float(number[0])
    atomic_mass=TableofElements[atom[0]]
    return (atomic_mass*multiplier)

################################################################
#Segments formula into atom-number sections (i.e. 'H3' or 'N10')
################################################################
def parseFormula(fragment):
    segments=re.findall('[A-Z][a-z]*[0-9]*',fragment)
    return (segments)

##################################################################################
#Computes total mass of both parenthetical and nonparenthetical formula components
##################################################################################
def molmass(formula):
    parenMass=0
    nonparenMass=0
    while (len(formula)>0):
        #First computes the molecular weight of all parenthetical formulas from left to right
        while (len(re.findall('\(\w*\)[0-9]+', formula))!=0):
            parenthetical=re.findall('\(\w*\)[0-9]+',formula)
            for i in range(0,len(parenthetical)):
                parenMult1 = re.findall('\)[0-9]+', parenthetical[i])
                parenMult2 = re.findall('[0-9]+', parenMult1[0])
                segments =parseFormula(parenthetical[i])
                for i in range(0, len(segments)):
                    parenMass= parenMass + ((getMass(segments[i]))*(float(parenMult2[0])))
            formula=re.sub('\(\w*\)[0-9]+', '', formula)
        #Sums nonparenthetical molecular weights when all parenthetical molecular weights have been summed
        segments = parseFormula(formula)
        for i in range(0, len(segments)):
            nonparenMass=nonparenMass + getMass(segments[i])
        formula=re.sub(formula, '', formula)

    Mass=parenMass+nonparenMass
    return Mass
     
if __name__ == '__main__':
test=test.split(',')
for element in test:
print ('The mass of %(substance)s is %(Mass)f.' % {'substance': \
element, 'Mass': molmass(element)})
 

22 November 2011

19. Gnome3/gnome-shell -- 11 days later

So, I stuck it out. The new gnome-shell is fairly functional for me, finally.
The lack of system indicator applets was solved by using conky to overlay information on the desktop.
Frippery's gnome-shell extensions also make the experience less frustrating.

However, it still feels like everything I've done have been finding /work-arounds/ rather than /customisation/. In the end the whole idea of an application-centric desktop is unsuitable for me -- I would expect this to be true for the majority of established linux users.


Edit (25/11/2011):The screengrab shows what my heavily modified desktop looks like.

10 November 2011

18. Gnome 3/Gnome-shell -- first impressions. Rant.

Debian testing has now transitioned to gnome-shell/gnome3. It's...different...from gnome 2.32, so be warned. While I'm as frustrated as anyone else who feels that they are being forced to move to a new desktop metaphor for no good reason, I'm trying to keep an open mind. The lack of a bottom panel is pissing me off and disorienting me enormously though. I also would like all my panel applets back - I used to have a good overview over how my computer hardware was doing, and now I have no clue anymore.

<RANT>
Essentially, at this point it seems like gnome-shell is fine for people who do their work in a specific application - like a browser, word processor etc. It absolutely blows if you're using your COMPUTER. I edit code in gedit, render figures in the terminal, inspect them using evince, include them in documents using LaTeX etc. Suddenly I feel I have no overview what's going on. The lack of a bottom panel showing me which applications are open on a specific virtual desktop is very confusing. Using alt+tab to check before I switch is a great time-waster.

For those who haven't used gnome-shell -- yes, you can still have windows side-by-side. You just can't see if you're hiding a window behind another one.

Seriously. I don't see why I can't customise my desktop anymore. Gnome has always (I do realise that this isn't entirely true - functionality is being removed and re-added all the time in most desktop environments) been a bit more restrictive than KDE in terms of granular control and I do understand that this is on purpose -- it's a design philosophy. I guess I just violently disagree with it.

Finally, even though I can't put my finger on WHY, I feel that I suddenly have a tiny screen. It's 23 inches. It's huge. It's made for having lots of windows open side-by-side.

I admit that I'm as resistant to change as anyone, but since I use my computer as part of my work, I need a damned good reason for changing. Few people can afford a few weeks downtime in productivity while learning the ropes if they feel that the change isn't justified.

I'll stick with gnome for a while longer. You can't bitch if you don't give it a chance. But I'll spend those weeks looking closer at the alternatives - XFCE, LXDE, KDE etc.

The point here -- and which was seen with the defections to OSX caused by Windows Vista -- is that if people are forced to learn a new way of working, they might as well explore ALL the options.

Prediction: I'll either stay with gnome-shell (which will hopefully improve as functionality and control is returned), or move to xmonad (another extreme)

I obviously appreciate the fact that I'm using a free and open source collection of software - in theory no-one is forcing me to keep on using GNOME. Nor was I forced to upgrade. In reality, it's not so easy.

Given that gnome 3/gnome-shell is more than just an iterative update, I think it would've have made sense to allow for the installation of gnome 2.32 and gnome3 side-by-side. After all, there's nothing preventing you from running KDE, gnome, xfce and lxde side-by-side. Sure, uptake would be slower - but 'forcing' people to move from one version to another isn't really a good idea either. The way it is now you have no easy way of reverting back to 'normal' if you accidentally, or misguidedly, upgrade to gnome3.

Oh well, ranting is easy. A better use of my time would probably have been to learn how to write gnome-shell-extensions to provide the functionality which I feel is missing.
</RANT>

<How to deal with it>
So, there are a few things which can be done to make the transitions a bit easier to handle -  do an online search for gnome-shell-extensions and download the ones which you think will help. For me, I've got the following installed and active:
Bottom Panel
windowNavigator
Gajim IM integration
Alternative Status Menu
Shut Down Menu
User Themes
Break Dynamic Workspaces
Panel Favorites
Weather
Applications Menu
Move Clock
Auto Move Windows

Make sure that you get the right version of the extension for your version of gnome-shell (gnome-shell --version; currently it's on 3.0.2) since extensions for 3.2 won't necessarily work with 3.0.2 (e.g. the bottom panel extension).

You will also want to install the gnome-tweak-tool and explore what it does. At least you can choose your preferred icon theme, set nautilus to handle the desktop space, bring back maximize/minimize buttons etc.

You may also want to add keyboard shortcuts to the most commonly used application since it's a PITA having to go back to the Activities every time you open e.g. a terminal, nautilus or gedit  instance. I've mapped terminal to ctral+shift+up, google chrome to ctrl+shift+down, nautilus to ctrl+shift+left and gedit to ctrl+shift+right.


If you find that you can't run gnome-shell but only use the fallback mode, check that you haven't got 'compiz --replace' in your start-up programs (gnome-session-properties)

24 August 2011

17. Linphone with iinet iitalk voip service on Debian Testing 64 (Wheezy)

We've got the Naked DSL from iinet, and included with it is a 'free' voip service, iitalk. Since we haven't got either a modem supporting voip, or an ATA adapter + regular terrestrial phone, we're aiming for the next best - using a software voip solution on our desktop. Linphone is FOSS and available in the debian repos.

You will have received an email from iinet with the following details:
Your Netphone number:         0xxxxxxx
Your Netphone password:     yyyyyyy
Your Netphone PIN:                 zzzz
VoIP SIP domain:            iinetphone.iinet.net.au
VoIP SIP server:              sip.state.iinet.net.au

where state is act, nsw, vic, wa etc. giving something along the lines of sip.act.iinet.net.au


first
sudo apt-get install linphone

You'll find the GUI version on your gnome menu under 'internet'. Start it.
Go to Linphone/Settings
Click on the manage SIP accounts tab.
There are three main sections on this tab: default identity, Proxy accounts and Privacy
Don't bother with the Default identity or Privacy; instead click on Add under Proxy accounts


Your SIP identity: sip: 0xxxxxxx@sip.state.iinet.net.au
SIP proxy addres: sip: sip.state.iinet.net.au
Route (optional): sip:
Registration duration (sec): 3600
Register at startup: yes

You can also set up the account directly in your ~/.linphonerc :

[proxy_0]
reg_proxy=sip:sip.state.iinet.net.au
reg_route=sip:
reg_identity=sip:0xxxxxxx@sip.state.iinet.net.au
reg_expires=3600
reg_sendregister=1
publish=0
dial_escape_plus=0

[auth_info_0]
username=0xxxx
userid=0xxxxxx
passwd=yyyyyyyyyyy
realm="iinetphone.iinet.net.au"


The number after proxy_ and auth_info_ depends on whether you have other accounts defined as well. Note that the .linphonerc file will contain a fair number of other things. Here's my full .linphonerc (with some information replaced by x's)


[sound]
playback_dev_id=ALSA: default device
ringer_dev_id=ALSA: default device
capture_dev_id=ALSA: default device
remote_ring=/usr/share/sounds/linphone/ringback.wav

[video]
device=V4L2: /dev/video0
size=cif
enabled=0
display=0
capture=0
show_local=0
self_view=1

[GtkUi]
advanced_ui=1
uri0=0xxxxxxxx

[net]
download_bw=0
upload_bw=0
firewall_policy=0
mtu=0

[sip]
sip_port=5060
guess_hostname=1
contact=<sip:xxx@192.168.1.2>
inc_timeout=15
use_info=0
use_rfc2833=0
use_ipv6=0
register_only_when_network_is_up=1
default_proxy=0

[auth_info_0]
username=0xxxxxxx
userid=0xxxxxxxx
passwd=yyyyyyy
realm="iinetphone.iinet.net.au"

[rtp]
audio_rtp_port=7078
video_rtp_port=9078
audio_jitt_comp=60
video_jitt_comp=0
nortp_timeout=30

[audio_codec_0]
mime=speex
rate=32000
enabled=1

[audio_codec_1]
mime=speex
rate=16000
enabled=1

[audio_codec_2]
mime=speex
rate=8000
enabled=1

[audio_codec_3]
mime=GSM
rate=8000
enabled=1

[audio_codec_4]
mime=PCMU
rate=8000
enabled=1

[audio_codec_5]
mime=PCMA
rate=8000
enabled=1

[video_codec_0]
mime=MP4V-ES
rate=90000
enabled=1
recv_fmtp=profile-level-id=3

[video_codec_1]
mime=theora
rate=90000
enabled=1

[video_codec_2]
mime=H263-1998
rate=90000
enabled=1
recv_fmtp=CIF=1;QCIF=1

[video_codec_3]
mime=H263
rate=90000
enabled=1

[video_codec_4]
mime=x-snow
rate=90000
enabled=1

[proxy_0]
reg_proxy=sip:sip.state.iinet.net.au
reg_route=sip:
reg_identity=sip:0xxxxxxxxx@sip.state.iinet.net.au
reg_expires=3600
reg_sendregister=1
publish=0
dial_escape_plus=0





11 August 2011

16. Using onboard video card with acceleration on Optiplex 990 on Debian

NOTE: another issue debian users should be aware of is the failure to reboot on sudo shutdown -r now. The fix is easy though: change GRUB_CMDLINE_LINUX in /etc/default/grub to read GRUB_CMDLINE_LINUX="reboot=pci"

--Start Here ---
The videocard (nvidia quadro something or other) my work Optiplex 990 came with only has a 'displayport', and the supplied adapter for it only has DVI-D (no analogue signal, so a VGA converter won't work). Since my 24" monitor doesn't have DVI, and I hate HDMI, and at the same time appreciate graphics acceleration (can't live without my wobbly windows in compiz), I had to generate an /etc/X11/xorg.conf which would allow me to use the motherboard graphics capabilities. Here's that xorg.conf (ripped out the video card, used smxi to generate an xorg-driver dependent xorg.conf):


Section "ServerLayout"
Identifier     "X.org Configured"
Screen      0  "Screen0" 0 0
Screen      1  "Screen1" RightOf "Screen0"
Screen      2  "Screen2" RightOf "Screen1"
InputDevice    "Mouse0" "CorePointer"
InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
ModulePath   "/usr/lib/xorg/modules"
FontPath     "/usr/share/fonts/X11/misc"
FontPath     "/usr/share/fonts/X11/cyrillic"
FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath     "/usr/share/fonts/X11/Type1"
FontPath     "/usr/share/fonts/X11/100dpi"
FontPath     "/usr/share/fonts/X11/75dpi"
FontPath     "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
FontPath     "built-ins"
EndSection

Section "Module"
Load  "dbe"
Load  "record"
Load "dri"
Load  "dri2"
Load "glx"
Load  "extmod"
EndSection

Section "InputDevice"
Identifier  "Keyboard0"
Driver      "kbd"
EndSection

Section "InputDevice"
Identifier  "Mouse0"
Driver      "mouse"
Option    "Protocol" "auto"
Option    "Device" "/dev/input/mice"
Option    "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
Identifier   "Monitor0"
VendorName   "Monitor Vendor"
ModelName    "Monitor Model"
EndSection

Section "Monitor"
Identifier   "Monitor1"
VendorName   "Monitor Vendor"
ModelName    "Monitor Model"
EndSection

Section "Monitor"
Identifier   "Monitor2"
VendorName   "Monitor Vendor"
ModelName    "Monitor Model"
EndSection

Section "Device"
Identifier  "Card0"
Driver "intel"
BusID       "PCI:0:2:0"
EndSection

Section "Device"
Identifier  "Card1"
Driver "intel"
BusID       "PCI:0:2:0"
EndSection

Section "Device"
  Identifier  "Card2"
Driver "intel"
BusID       "PCI:0:2:0"
EndSection

Section "Screen"
Identifier "Screen0"
Device     "Card0"
Monitor    "Monitor0"
SubSection "Display"
Viewport   0 0
Depth     1
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     4
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     8
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     15
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     16
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     24
EndSubSection
EndSection

Section "Screen"
Identifier "Screen1"
Device     "Card1"
Monitor    "Monitor1"
SubSection "Display"
Viewport   0 0
Depth     1
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     4
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     8
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     15
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     16
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     24
EndSubSection
EndSection

Section "Screen"
Identifier "Screen2"
Device     "Card2"
Monitor    "Monitor2"
SubSection "Display"
Viewport   0 0
Depth     1
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     4
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     8
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     15
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     16
EndSubSection
SubSection "Display"
Viewport   0 0
Depth     24
EndSubSection
EndSection

Section "Extensions"
# Option      "Composite" "disable"
# Option      "RENDER" "disable"
EndSection

10 August 2011

15. ORTEP-3 for Windows (Winortep) under Wine

Note: for those who use Mac OS X and get sent here by google, you can also use wine to run ortep3v2. See here for instructions on how to install wine: http://wiki.winehq.org/MacOSX

The installation file can be downloaded from http://www.chem.gla.ac.uk/~louis/software/ortep3/. Install in the same fashion as you would with any other windows program under wine. I will assume that you have installed it in c:\ortep3v2

Request a license the usual way. Make a file called Ortep3-license in the c:\ortep3v2 directory (/home/you/.wine/drive_c/ortep3v2). Put the license information in it:

########################################################################
Program license for : Ortep3 for Windows
User name  : XXXXXXXXXX
User email : XXXX@XXXXX.XXX
User affiliation : Department of Chemistry, XXXXX, XXXXX
Windows version  : Windows XP
License number   : XXXXXXXXXX
########################################################################

So far everything is the same as for a regular windows installation.
The one difference arrives when it comes to setting the ORTEP3DIR variable:
go to the linux shell, type regedit
Navigate to HKEY_CURRENT_USER/Environment
If you don't have the Environment directory, create a new key with that name, then create a string value which you call ORTEP3DIR. Double-click on the data field, and set it to c:\\ortep3v2

You should now be ready to go.

Winortep can write pov-ray files -- and they are well-written, logical and very easy to read/modify


WinOrtep is a full-featured program which can do just about anything.

08 August 2011

14. Evolution email and Google Calendar(s)

The process is already described here:
http://www.ubuntugeek.com/how-to-sync-google-and-evolution-calendars-in-ubuntu.html.

It's not much of a post, but it may be of help to someone who tried the Google option when setting up the calendar sync in Evolution and found it less than satisfactory.

Edit 16/12/2011:
Recently (last two days, version 3.0.3-3) been getting error messages in evolution when trying to connect to my google calendar. While using the method described above for a while I switched to using 'google' instead of 'caldav' as the calendar type at some point. Well, it doesn't work anymore.

Here's how to use google calendar in Evolution:
New -> Calendar
Type -- CalDav


URL: caldav://www.google.com/calendar/dav/myemail%40gmail.com/events/
Use SSL: yes
User name: myemail@gmail.com
User email: myemail@gmail.com

Then clock 'Browse server for calendar and select the
+ /calendar/dav/myemail%40gmail.com/
         - myemail@gmail.com


Whether  you want to copy content offline or use it as default calendar is a personal choice.

Edit: 16/12/2011 -- 2 hours later
Well, it's not working anymore. Same TLS handshake BS as before.

"Error loading calendar
Cannot open calendar: Unexpected HTTP status code 6 returned (Peer failed to perform TLS handshake)"

What I can't understand is why there is no good description of this problem on the web, given that Evolution is the default email and calendar client for gnome. I don't like thunderbird/icedove+sunbird/iceowl much, but things seem to work better in general there.