09 January 2012

44. Apt-cache server on LAN on debian

Apt-caching allows you to share updates between different computers and, what is more important, allows you to update a machine that is not directly connected to the internet, but which can access a computer which is.

I've added almost nothing new to this post: http://ubuntuforums.org/showthread.php?t=564301

Ergo, all glory to 'coolen'. My only contribution, and a very small one at that, is showing a solution for a system, with a switch rather than a router.

Anyway, here's my reproduction of the prescribed method. I've changed almost nothing. The main purposes for reproducing the approach here are 1) so that I can remember it myself and 2) so that other people get independent verification that the method does indeed work.

The server ip address in the example is set to 192.168.1.2.

On server:
sudo apt-get install apt-cacher-ng
sudo vim /etc/services (or sudo nano, gksu gedit etc.)

(I had a whole lot of stuff in my /etc/services)

Add
apt-cacher   3142/tcp    #apt-cacher-ng service
apt-cacher   3142/udp   #apt-cacher-ng service

'coolen' adds AUTOSTART=1 to /etc/default/apt-cacher-ng
As far as I understand that's not necessary.

sudo /etc/init.d/apt-cacher-ng start

Make sure that your firewall is not blocking connections to port 3142 (e.g. configure gufw).

On client:

With ROUTER
To turn on:
sudo vim /etc/apt/apt.conf.d/01proxy
Acquire::http::Proxy "http://192.168.1.2:3142";

Do sudo apt-get update and you're done


(If you want to go back to the default repos, turn off  by changing to
Aquire::http::Proxy "http://";)


With SWITCH
(I basically looked at https://help.ubuntu.com/community/Apt-Cacher-Server)

sudo vim /etc/apt/sources.list

If your sources.list file currently looks like this:
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

change it so that it looks like this:

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


Do sudo apt-get update and you're done.

43. nwchem revisited. Install on new debian machine

Here's a streamlined version of compiling and setting up nwchem with mpich2 support on a virgin debian testing (wheezy) 64 bit computer. I'm working on a build guide for nwchem 6.1 -- currently it builds fine but all jobs end with a Segmentation Violation error and exits with status 11.

Start by running
sudo apt-get install build-essential  gfortran
Edit these two files (the preferences one will most likely not exist)
/etc/apt/sources.list

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

/etc/apt/preferences

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

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

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

IMPORTANT: the pin-priority for stable must be positive (here +10), or it won't work.

Run
sudo apt-get install mpich2=1.2.1.1-5 libmpich2-dev=1.2.1.1-5

Set the Pin-priority to -10 for stable again.

sudo su
echo "mpich2 hold"|dpkg --set-selections
echo "libmpich2-dev hold"|dpkg --set-selections
mkdir ~/nwchem
cd ~/nwchem
touch buildconf.sh
chmod +x buildconf.sh

(EDIT 21/02/2012: I accidentally put a bad csh-formatted buildconf.sh file at the beginning. Then I put an incomplete bash version. It should work now.)

In buildconf.sh put
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

cd $NWCHEM_TOP/src
make clean
make nwchem_config
make FC=gfortran

Then download the source code for nwchem

wget http://www.nwchem-sw.org/images/Nwchem-6.0.tar.gz
tar -xvf Nwchem-6.0.tar.gz

To start building:
./buildconf.sh

Once it's built:
echo "PATH=$PATH:/home/myname/nwchem/nwchem-6.0/bin/LINUX64" >> ~/.bashrc
source ~/.bashrc

Prepare mpd
echo "MPD_SECRETWORD=jibberjabber" >> ~/.mpd.conf
chmod 600 ~/.mpd.conf
mpd --ncpus=3 &

Prepare for a test-run
touch nwchem.nw
Put the following in the nwchem.nw file:

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

Launch the job:
mpdrun -n 2 nwchem nwchem.nw

And you should be ready to go


Edit: 12/02/2012 It looks like version of nwchem currently in SID is built with mpi support: http://packages.debian.org/sid/nwchem . I haven't checked it out.

42. Installing gnome-shell extensions and icon theme on debian


FOR GNOME/GNOME-SHELL 3.4 see this as well: http://verahill.blogspot.com.au/2012/06/gnome-34-frippery-extensions-in-debian.html

Here are a few quick fixes to make Gnome 3/gnome-shell work and look a bit better:

An example of my desktop as it looks today (April 201) is shown below:
My desktop, in response to a comment below..

And here a rough indication of what is done with the gnome-shell extensions below:
From top left, clockwise: applications menu, panel favourites (with faenza icons), move-clock, bottom panel and static workspaces. The information on the right hand side is done via conky.


Index:
1. gnome-shell extensions
2. Getting maximize, minimize and close back
3. prettier icon theme --faenza
4. Using conky instead of gnome applets to monitor computer


1. gnome-shell extensions
NOTE: download the .tgz file to your home folder e.g. /home/me/ or the files won't go to the right place on tar -xvf

The Gnome-shell Frippery extensions ("for grumpy old sticks in the mud") are what you're looking for: http://intgat.tigress.co.uk/rmy/extensions/index.html

a) For gnome/gnome-shell 3.0:
In /home/me/
wget http://intgat.tigress.co.uk/rmy/extensions/gnome-shell-frippery-0.2.8.tgz
tar -xvf gnome-shell-frippery-0.2.8.tgz

That's it! The extensions will only be installed for the user doing the untar-ing.

b) For gnome-shell 3.2:
UPDATE: 1/2/2012 -- Wheezy upgraded to gnome-shell 3.2.2.1 on 31/1/2012. Here's how to get a useful desktop environment again:

Either:
Use iceweasel/firefox, and visit the following pages:
https://extensions.gnome.org/extension/13/applications-menu/
https://extensions.gnome.org/extension/3/bottom-panel/
https://extensions.gnome.org/extension/12/static-workspaces/
https://extensions.gnome.org/extension/2/move-clock/
https://extensions.gnome.org/extension/4/panel-favorites/
https://extensions.gnome.org/extension/14/shut-down-menu/

All of the frippery extensions are listed here:
https://extensions.gnome.org/accounts/profile/rmyorston

Install the extensions by settting on the slider icon to ON.


OR:
In /home/me/ (replacing 'me' with your username)

wget http://intgat.tigress.co.uk/rmy/extensions/gnome-shell-frippery-0.3.6.tgz
tar -xvf gnome-shell-frippery-0.3.6.tgz

IF the shell extensions don't show up -- make sure that they are in /home/me/.local/share/gnome-shell/extensions/ -- if not you may want to extract and put the files there manually.

Either way, once you installed using firefox or in the terminal:
Log in and out of gnome-shell -- alt+f2 + r only enabled the applications-menu, bottom-panel and static workspaces, but the other extensions wouldn't work. This is based on a case of installing the extensions immediately after dist-upgrading to install gnome-shell v 3.2.2.1

You can now open gnome-tweak-tool (install it as shown below under "2. Getting max/min/close back") -- in the gnome-shell activities/launchers window or whatever they call it it shows up as Advanced Settings or start it using alt+f2 or terminal (gnome-tweak-tool). Click on Shell Extensions, and enable everything.

OR open firefox/iceweasel and go to https://extensions.gnome.org/local/ to enable/disable extensions.


Note:
The extensions.gnome.org versions of Frippery's Shutdown menu, move clock and panel favourites wouldn't work with 3.2 on a first try, nor would the extensions downloaded by wget and untared -- logging in and out of gnome-shell solved that.

Trying to find something on the extensions.gnome.org website is at the moment hopeless - hopefully they'll implement a useful search function soon.




2. Getting maximize, minimize and close back
Install gnome-tweak-tool
sudo apt-get install gnome-tweak-tool

Start it. Go to Shell. Under 'arrangement of buttons on title bar' select all.




3. prettier icon theme --faenza
I've never been a fan of the default icon themes for gnome. I used the linux lex icons (http://linuxlex.cz/en/?option=com_phocadownload&view=file&id=2:linuxlex-8-icon-theme&Itemid=350) for gnome 2.x/compiz

In my opinion the blockier icons in faenza work better with gnome3/gnome-shell than the fancy linux lex icons.

So...
Install the gnome-tweak-tool
sudo apt-get install gnome-tweak-tool

To get faenza
mkdir ~/tmp
cd ~/tmp
wget http://www.deviantart.com/download/173323228/faenza_icons_by_tiheum-d2v6x24.zip
unzip faenza_icons_by_tiheum-d2v6x24.zip
./INSTALL
cd ~/.icons
mkdir faenza
mv * faenza/

Now start gnome-tweak-tool. Under Interface  --> Icon Theme -- select faenza
Do alt+f2 and type r, hit enter to restart.


4. Using conky instead of gnome applets to monitor computer
conky is a lot more flexible and capable than any single gnome-applet. But then conky doesn't sit quietly on a panel but is instead overlaid on top of you desktop.

To install
sudo apt-get install conky

Edit configuration file
sudo vim /etc/conky/conky.conf

Here's a sample conky.conf
-------------------------

alignment top_right
double_buffer yes
background yes
border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont DejaVu Sans Mono:size=12
gap_x 20
gap_y 60
minimum_size 5 5
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline no
own_window yes
own_window_class Conky
own_window_type desktop
own_window_transparent yes
stippled_borders 0
update_interval 1.5
uppercase no
use_spacer none
show_graph_scale no
show_graph_range no

TEXT 
${execi 60 acpi |gawk '{print $3,$4,$5}'|sed 's/\,/\t/g'}
${addr eth0}/${addr wlan0}
$hr
${color grey}Uptime:$color $uptime
CPU:$alignc $cpu%
$alignc $color ${cpugraph 15,200 ffff00 ff0000 -l -t}  
RAM:$alignc $mem/$memmax
$alignc$color ${memgraph 15,200 ffff00 ff0000 -t}
I/O:$alignc $diskio_read/$diskio_write
$alignc$color ${diskiograph 15,200 ffff00 ff0000 -t}
${color grey}Frequency (in GHz):$color
${freq_g 1} ${freq_g freq_g2}
$color CPU: $alignr${acpitemp}°C 
$color Fan(rpm): $alignr${execi 1.5 sensors|grep fan1|cut -c12-18} 
#${color grey}CPU Usage: ${cpubar 10,100 ffffff ff0000 -l -t} $cpu%
${cpugraph cpu1 15,100 ffff00 ff0000 -t} ${cpugraph cpu2 15,100 ffff00 ff0000 -t}
$hr
${color grey}File systems:
 / $color${fs_used /}/${fs_size /}
 /home $color${fs_used /home}/${fs_size /home}
${color grey}eth0 ${color red} ${upspeed eth0}/${color green} ${downspeed eth0} ${color grey}
${color grey} ${upspeedgraph eth0 15,100 550000 ff0000 -l -t} ${color grey} ${downspeedgraph eth0 15,100 0000ff 00ff00 -l -t} ${color grey}
${color grey}wlan0 ${color red} ${upspeed wlan0}/${color green} ${downspeed wlan0} ${color grey}
${color grey} ${upspeedgraph wlan0 15,100 550000 ff0000 -l -t} ${color grey} ${downspeedgraph wlan0 15,100 0000ff 00ff00 -l -t} ${color grey}
$hr
${color grey}Name CPU%   MEM%
${color} ${top name 1} ${top cpu 1} ${top mem 1}
${color} ${top name 2} ${top cpu 2} ${top mem 2}
${color} ${top name 3} ${top cpu 3} ${top mem 3}
$hr
${font Arial:bold:size=12}${color Tan1}WORLD TIME ${color DarkSlateGray}

$font${color}San Francisco ${execi 60 ping -c 1 berkeley.edu | grep icmp_req |gawk '{print $8}'| cut -c6- } ms$alignr${tztime America/Los_Angeles %H:%M}


$font${color}Melbourne ${execi 60 ping -c 1 rmit.edu.au | grep icmp_req |gawk '{print $8}'| cut -c6- } ms$alignr${tztime Australia/Melbourne %H:%M}



-----

You can get more information about available objects here: http://conky.sourceforge.net/variables.html

To make conky start up every time you start your computer, start gnome-session-properties, and add conky. That works most of the time but is the old gnome 2.3 way of doing things. Here's a post on gnome-shell specifically and how to add start-up applications: http://linuxandfriends.com/2011/06/01/how-to-add-startup-programs-in-gnome-3/

08 January 2012

41. Chinese character and input support on debian testing

Update: You should also install support for gtk and gtk3:
sudo apt-get install ibus-gtk3 ibus-gtk
in order to be able to use it with e.g. thunderbird.

Original post:
Here's how to set up Chinese (simplified) support in Gnome 3 /gnome-shell and the terminal (bash).

First install the fonts:
sudo apt-get install fonts-arphic-*

Next. add Chinese via locales:
sudo dpkg-reconfigure locales

Select
zh_CN.UTF-8

(For traditional characters choose zh_HK, zh_SG or zh_TW)

As default language English is probably a good idea
In my case it's en_AU.UTF-8

Edit ~/.bashrc and add the following lines:
LANGUAGE=zh_CN.UTF-8
LANG=zh_CN.UTF-8

Run
source .bashrc

Install ibus:
sudo apt-get install ibus-pinyin 
This pulls another 18 packages with it

Start ibus-daemon in terminal
An icon in the notification tray still appear
Right-click, choose Preferences (P)
Click on the second tab (input methods)
Select an input method -> Chinese -> Pinyin

You should now be able to choose between regular (latin) input and Chinese characters using Ctrl+Space.

To make ibus-daemon start with gnome, run
gnome-session-properties
and add
ibus-daemon

And you're more or less done.

Sogou is a popular pinyin database on the Windows platform -- but afaik it's not available for Linux. On Linux, it seems that the ibus-pinyin-db-open-phrase database is the default ibus database used to guess what characters you intend to type, but you can also install and select either ibus-googlepinyin or ibus-pinyin-db-android. After installation you need to select the database by going to preferences in the ibus daemon and selecting it as input method. Not being Chinese I can't tell whether sogou, google pinyin and android pinyin are comparable.

Sogou does however work with Google Chrome/Chromium on linux -- go to Preferences/Extensions -- Get More Extensions, and install the Sogou Cloud Pinyin Extension for Chrome.


04 January 2012

40. Getting started with GNUCash

I've both recently relocated and started my own research group, so keeping track of money has become important -- it's difficult to get an overview of your economy in the beginning in a new country, and you better keep track of your research grants because the University WIL screw it up.

As someone with nil background in finance getting to grips with GnuCash has taken some time.

I've got two databases -- one for my personal finances, and one for my grants. I'll only show how to set up a database for personal finances here.

For most of the steps there isn't much to say...
Choose the simplest type of account -- Checkbook.

You now have four main types of accounts: Assets, Equity, Expenses and Income. The assets accounts has a sub-account called  Checking Account.


Double-click on the Checking account, put the current amount of money in your account under Deposit, and select Equity:Opening Balance under Transfer.


You now have money to spend.

Time to customise the set-up. Create an new account -- select placeholder, income and New Top Level Account. We're calling it John Doe.

(You'll find that only top level accounts can be all types of accounts. Some accounts can only be income/expenses, while other types (e.g. Bank) can't be either of those.)

 Next, create a series of accounts and select either income or expenses depending on type:


 If you have cash in your wallet you can put that cash as the opening balance of a cash account under current assets -- put the current amount of money in your account under Deposit, and select Equity:Opening Balance under Transfer. Make main expenses and income accounts under your name. Add specific sub-accounts.

Note how it says Imbalance: 3,000 (the amount added to income/salary). Transfer that money (income/salary) to your checking account:


 Then you get:

 We can move money from the checking account to cash (i.e. ATM withdrawal), pay by cash etc.

Here's the double-entry aspect of GnuCash -- every transaction shows up twice:

Here's another overview of the accounts:


Anyway, at this point it's fairly easy to start exploring and setting up more complex accounts.








Essentially, GnuCash SEEMS to be powerful, but for some reason I can't bring myself to read the documentation. Maybe it's the way it's written, maybe it's the topic at hand (few scientists relish the dirty world of money...or so we like to think), or maybe it's just me. Regardless, it's a piece of software you SHOULD learn how to use if you need to keep track of spending -- as most scientists do.


03 January 2012

39. Opinion -- little annoyances regarding opinions about linux

I spend far too much time browsing the web, and I do often end up on linux-related sites. A fair number of sites are still dedicated to converting windows/osx users or helping new Linux users. In particular the latter aim is noble, of course.

At time it does get a bit tiring reading the comments sections though -- and that goes for both Linux advocates and their detractors.

Quotes collected from the web are given within "".

As an aside, most linux users, but perhaps not most windows and OSX users, are well aware of the difference between Learn-ability and Usability. A program may well be easy to LEARN how to use ('intuitive') but it may be a pain in the arse to actually USE. Most linux CLI tools require a bit of extra effort to learn, but once learned, are eminently usable.

0. Fewer than 1% use Linux or Ubuntu/Mint/X is the most popular distro
According to my blog, 55% of all visitors use linux (Win 40%, OSX 2%). This blog, given it's content has a positive bias towards Linux users.

According to my professional university homepage (I'm a chemist, not a Comp. Sci. person) about 11% use Linux, while 74% use Windows and 12% use OSX. My homepage, by virtue of being strictly related to my field of research, is biased towards users who are professional chemists.

So what to do?
For starters, what does 'use' mean? Do we only mean as a primary Desktop OS? Or do we include servers? Or even indirect use, such as visiting websites run on linux servers and using devices with embedded linux? These problems also apply to deciding which is the most popular distribution -- do we count embedded? Server installations? Or only Desktop usage?

The problem is compounded by the problem of measuring usage, regardless of definition. For commercial OS one might use the number of licenses sold as an indication, but that won't work for a Free OS. Same goes for number of downloads. Repo access sounds like a good idea, but in addition to most major universities (+ companies and kind individuals) running mirrors, a fair number of us use apt-cache to cut down on both our and server traffic. And what about people who, like me, have a large number of computers which they use each day (desktop at home for watching tv, laptop at home for work, desktop at work for...work, three desktops at work for number crunching, router at home with busybox/tomato)

There would of course also be the practical issue of compiling all the stats, so this approach isn't used today.

So...for OS share 'Net applications' statistics is often used, see discussion e.g. here. Website stat, however, do not adequately distinguish between Number of Users and Number of Visits. The selection of reporting sites also influences the results.

Still, the problem is even greater when it comes to crowning the reigning distro. Most of the time distrowatch data is quoted, and it really makes absolutely no sense. I use only linux, and I visit distrowatch less than once per year -- because why would I? I use Debian, I'm happy with Debian, and I have no longer any time to explore other distros without a bloody good reason, and even if I did, distrowatch wouldn't be the place I'd go looking for information. I really wish articles would stop quoting distrowatch data.

1. The year of the Linux Desktop/Focus on mobile devices
"That's why I feel it's more important to focus on how Linux performs in growth areas like mobile devices than on a desktop that's increasingly less relevant for content consumption."

This is, if not a meme, then at least a standing joke. However, there's still this idea that Linux NEEDS to become a big player on the desktop and that it has so far failed to achieve this. Alternative, Linux NEEDS to focus on mobile devices where they can grab a large market share.

Well, guess what -- for a lot of people every year is the year of the linux desktop -- we're using linux as our only, or primary, OS.

Also, there isn't a NEED for linux to become anything.

What most linux users feel is probably that rather than necessarily converting everyone to some flavour of linux, it would be nice of non-linux users would stop forcing proprietary formats on everyone.

At my current job people insist on emailing .docx files for some reason. This
   1.  more-or-less forces Windows users to upgrade their office versions (which is the real reason behind changing the file format)
   2. pisses off anyone who isn't using office --- such as linux users. A guess-timate would be that 80% of the documents emailed contain so little formatting that a plain ascii file would have been enough. For the rest, pdf would work just fine since editing isn't required.

Really, you can use office if YOU want to, but don't 1. pretend that it's superior to latex because you can click on things or 2. force it on other people.

2. 'obscure' terminal commands
"Look it's 2009. The public doesn't want to type in commands. GUI's have been around for how long? It's obvious by the success of Windows that users want an easier experience."

They are only 'obscure' if you are dead-set against learning what they do. There is no difference between typing in a command and looking through a graphical menu. You still need to be willing to dedicate at least a modicum of effort towards learning.

And guess what? There's a reason why the terminal/command line/cli is still around. In fact there are several. For a starter, it's a faster, easier and more convenient method once you've made a bit of effort of learning how to use the standard *NIX tools such as gawk, sed, vim etc. Not everyone uses their computer for data processing, or even work, and that's fine -- some people live their lives in the browser and won't benefit much from using the terminal (but they really shouldn't complain about its existence either).

Also, the idea of 'getting rid of the terminal' as one sees sometimes show s a complete lack of understanding of how a linux system works. GNOME/KDE/Xmonad/XFCE/LXDE etc. are just shells, interfaces on top of the linux kernel. They are like thin sheets of ice covering a deep sea -- most of the action is to be found underneath.

And that's a GOOD thing -- in windows there's little reward for making the effort to learn new things. In Linux, you can learn as little or as much as you want -- you'll get rewarded for any effort to learn that you make.

3. 'Too much' choice
"Fragmentation: 1% of the market split into 100+ distros. Divided they fall."

In the beginning I fretted a lot about choosing the 'right' distro -- after all you don't want to waste your time learning something that's obsolete or not as useful as the next thing around. As it turns out, there's little difference between different distros.

Well, the differences are there there, but they are typically down to philosophy, package management or number of packages in the repos.

I feel more at home using apt-get/aptitude than yum, but since a fair number of users use a graphical package manager, this really doesn't matter much.

Other than that, most distros are the same, and are derived from four or five main distros (the Debian and Fedora/Red Hat families probably being the largest ones). So, instead of 100+ distros you have 3-4 distros which are really not that different.

The differences between windows 2000 through Windows 7 are larger than the differences between any of the linux distros.

4. No drivers/hardware support
"The real killer with linux is using peripherals. Drivers suck if they exist at all."
To date I've only had one piece of hardware which didn't work immediately -- my Diamond ATI Wonder HD 750 USB TV card. And I blame ATI for that, not 'linux'.

5. No games means Linux sucks
"I gave Linux a shot. Despite the irritating little problems I encountered I tried. And then my nephew wanted to play a game and it became all too clear--Linux has no chance."

This is true. But are we discussing a system for casual gaming or are we talking about a computer OS? I'd hate to write articles or do modelling on XBOX or Playstation. If gaming is what you are after, then by all means, find a system where you can do it. Whether a publisher releases a game for a particular platform has little to do with the superiority of that platform and all to do with market share.


Anyway, people can use what they want -- what irks me is when they pretend they'd use Linux if only...and then some half-baked, poorly informed 'reason' is presented.

Use or Do Not Use -- but make no excuses.

38. How to install and/or compile wine on debian testing


UPDATE: See here for Wine 1.5.27 using a chroot
http://verahill.blogspot.com.au/2013/04/376-wine-1527-on-debian-i386-chroot.html


UPDATE: there are plenty of more up-to-date guides on this blog. See e.g. here for how to build v 1.5.6. Obviously, the instructions below are still valid, and will give you a working version of wine.


Original post:
Quite some time ago Wine was removed from Debian Testing/Wheezy. If you already had wine installed, this may not have caused any significant problems, but it did cause inconvenience when setting up a new computer.

There are three fairly easy ways of installing wine in Debian testing.

Update: See here for version 1.4-rc4: http://verahill.blogspot.com.au/2012/02/debian-testing-wheezy-64-compiling-wine.html

1. The simplest approach -- Using the Stable version of wine 
Simply add the stable repo to your /etc/apt/sources. list (add -- don't replace your testing repo)

i.e. if you sources.list looks like this:

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


then add a line so that it looks like this:
deb ftp://ftp.au.debian.org/debian/ testing main contrib non-free
deb ftp://ftp.au.debian.org/debian/ stable main contrib non-free

Running

sudo apt-get update

followed by

aptitude search wine

should hopefully show wine, wine-bin etc. The current version in the Debian stable repos is 1.0.1-3.1.

You can now install wine by

sudo apt-get install wine


2. The ever so slightly more complex approach -- installing version 1.3.32-0.1
If you want a newer version -- and I'd say that you would since the debian wine packages are OLD -- you can at the moment pull .deb packages from http://dev.carbon-project.org/debian/wine-unstable/

Don't let the 'unstable' fool you -- these are NOT the packages in the debian SID/unstable repos.

Also, pay heed to the following text on the page above: "The amount of traffic this little sub-page generates is quite respectable. If you think this service helpful and want to help cover some of the attached costs, please donate a few Euros". Whether you donate or not, do not download the same packages over and over again.

Download all the .deb files (in my case for amd64) using the following command:

wget -r -l1 --no-parent -A amd64.deb http://dev.carbon-project.org/debian/wine-unstable/

This is an example of using something akin to wildcards in wget.

cd dev.carbon-project.org/debian/wine-unstable

sudo dpkg -i *.deb

You'll see a number of errors being reported and the packages will be left unconfigured -- this is due to missing dependencies. That's easy to fix though:

sudo apt-get -f install

The missing dependencies will now be pulled in and the installation finalised. It's as easy as that!

3. Building your own -- version 1.3.35
It's not as hard as it may look -- I'm not in the habit of compiling my own packages, and chances are that you aren't either, so I'll show the entire process.

Download the source
wget http://prdownloads.sourceforge.net/wine/wine-1.3.35.tar.bz2

Unpack:
tar -xvf wine-1.3.35.tar.bz2

You may have to
sudo apt-get install bzip2 
before running the tar command above if it complains about missing bzip2 etc.

Change to the directory where the files were unzipped
cd wine-1.3.35

Time to start trying to build -- the errors I get may not be the errors you get. The approach to solving them is the same though.

First we need a whole lot of packages:

sudo apt-get install bison flex gcc libc6-dev libfontconfig-dev libfreetype6-dev libglu-dev libgsm1-dev libice-dev libjpeg-dev libldap-dev libmpg123-dev libncurses5-dev libopenal-dev libpng-dev libsm-dev libssl-dev libusb-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libxrender-dev libxslt-dev libxt-dev libxxf86vm-dev make libcapi20-dev liblcms-dev libsane-dev libhal-dev libdbus-1-dev valgrind prelink libcups2-dev

sudo apt-get install lib32v4l-dev lib32ncurses5-dev lib32asound2-dev lib32z-dev ia32-libs-dev

Now start:
./configure

which gives**


configure: OpenCL 32-bit development files not found, OpenCL won't be supported.
configure: gstreamer-0.10 base plugins 32-bit development files not found, gstreamer support disabled
configure: OSS sound system found but too old (OSSv4 needed), OSS won't be supported.
configure: libgsm 32-bit development files not found, gsm 06.10 codec won't be supported.

configure: Finished.  Do 'make' to compile Wine.




Good enough for me. 

make

Building will take a good 20-30 minutes.

Finally, 'install' the binaries in their proper locations

sudo make install

The first time you start a program in wine you'll be asked to install the gecko engine, which you can go ahead and do.

** I initially had some problems -- one of them being


checking for X... no
configure: error: X 32-bit development files not found. Wine will be built without X support, which probably isn't what you want. You will need to install 32-bit development packages of Xlib/Xfree86 at the very least. Use the --without-x option if you really want this.

This was solved by installing ia32-libs-dev



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