31 January 2014

545. NMR on Debian Wheezy: NMRNotebook by NMRTec

While it's possible -- even easy -- to write your own scripts for processing NMR data (e.g. here and here) there's still a value in having a GUI handy.


Either way, this entry is about NMRNotebook, which ultimately derives from another gratis program called Gifa which I experimented with in the early 00s. Apparently after Gifa v4 (article), NMRTec developed Gifa v5. After that there seems to have been a split in efforts (not a fork) where NMRTec developed NMRNotebook, and other people involved in Gifa developed NPK. NMRNotebook appears to use NPK as the underlying engine, but provides a nice GUI which is written in tk/tcl, java and python.

Note that Gifa 4 and Gifa 5 are still available for download, but require license files to run. I don't know if it's still possible to get licenses for Gifa. Based on my memory of running Gifa (4?) the interface was quite slick, and it had a terminal at the bottom, similar to xwinnmr.

License
Either way, NMRNotebook can be downloaded for free from NMRTec for academic users. You will need to register and then get a license, which can be had by following the instructions on their website and sending off an email with your details.

So I did that.

NOTE that the 1D line fitter is not included in the free version  -- it's priced at 1,000 Euro, which sounds a bit insane to me, in particular if you compare with the price of the software (Euro 100 for a student license, 750 for an industry one). Either way, you can write your own fitter in octave in fifteen minutes..


Installation

There are two files to download: NMRnotebook.sh and NNBMACROS.zip

Run NMRnotebook.sh

sh NMRnotebook.sh
NMRnotebook installer - starting installation... please wait NMRnotebook will be installed in your home directory. Unpacking ... Running post-install script ... done !! To run NMRnotebook, type '~/NMRnotebook/NMRnotebook' to create a shortcut named nnb in your home directory, type 'ln -s ~/NMRnotebook/NMRnotebook ~/nnb' To uninstall simply erase the directory ~/NMRnotebook and ~/.nmrnotebook Some examples can be found in the '~/NMRnotebook/examples' directory Thank you for using NMRnotebook. NMRtec software team
Run nmrnotebook as indicated:
~/NMRnotebook/NMRnotebook









Import the license by going to File/Open and select the nnb file you got via email.

Close the program and start it again.

Unzip the macros by
mkdir ~/work/nnbmacros -p
cp ~/Downloads/NNBMACROS.zip ~/work/nnbmacros
cd ~/work/nnbmacros
unzip NNBMACROS.zip

To run a macro, select it and run it:
To be able to launch nmrnotebook from GNOME create ~/.local/share/applications/nmrnotebook.desktop
[Desktop Entry] Name=NMRnotebook GenericName=nmrnotebook Comment=Software for processing of NMR data Exec=/home/me/NMRnotebook/NMRnotebook Terminal=false Type=Application Categories=Science Version=0.27

Overview
NMRNotebook can open varian, bruker etc. files. Bruker shown here


Window functions, showing EM and interative LB


Several different types of fourier transforms are available

My first spectrum

Zoom works similar to mestrec

Right-clicking brings up a menu that allows you to integrate, label, draw boxes, lines etc.

Normalised integral

NMRnotebook can accept SR values for calibration

Spectrum overview

NMRnotebook only has a few features available, but is sufficient for basic NMR processing. Line-fitting is the most serious omission.
 Overall I find NMRnotebook perfectly adequate for what I would see myself using it for -- simple processing of NMR spectra. Anything more serious and I'd use my own scripts -- but I'd do that anyway in order to be able to trust the data.

25 January 2014

544. rehash: making gnome 3 usable on debian

This post is meant to help a specific person leaving ubuntu's unity for debian's gnome. He finds unity easier to use then stock debian gnome 3.

While I agree that gnome 3 without any modifications isn't very good, by installing the right set of extensions you can make it very usable.
I'll be showing Jessie/gnome 3.8 in all the screenshots below. Setting up gnome 3.4 is pretty much the same though.

I've made a few similar posts before:
 http://verahill.blogspot.com.au/2012/01/debian-testing-64-wheezy-installing.html
http://verahill.blogspot.com.au/2012/06/gnome-34-frippery-extensions-in-debian.html
http://verahill.blogspot.com.au/2013/03/367-some-post-install-steps-on-debian.html
http://verahill.blogspot.com.au/2013/05/435-briefly-frippery-extensions-for.html


What I don't like about Stock Gnome 3:
For a first time user there's no obvious first action when greeted by a gnome 3/shell desktop
 

1. Everything opens as full screen and 2. you can't resize the windows (look at the top right corner of the title bar of the program). The feeling is claustrophobic.

The menu for each program is located on the top panel. This is only the case for programs which are specifically written for gnome 3 though, like gedit, nautilus, epiphany etc.

Power Off -- there's no way of choosing between hibernate, power off, restart, suspend etc.




Fixing gnome 3:

1. First hit the terminal

I think gnome-tweak-tool is installed by default these days, but by all means do
sudo apt-get install gnome-tweak-tool

Next, get the frippery extensions for your version of debian/gnome: Wheezy:
cd ~
wget http://intgat.tigress.co.uk/rmy/extensions/gnome-shell-frippery-0.4.1.tgz
tar xvf gnome-shell-frippery-0.4.1.tgz

Jessie:
cd ~
wget http://intgat.tigress.co.uk/rmy/extensions/gnome-shell-frippery-0.6.3.tgz
tar xvf gnome-shell-frippery-0.6.3.tgz

Now, log out and log in again in gnome (alt+f2, r didn't work for me).



2. Tweak Tools
Then move your mouse to the top left 'activities' corner and open Tweak Tools:


Go to Shell and change 'Arrangement of buttons on the titlebar' from 'Close Only' to 'All'.
Now you can close and resize applications the 'normal' way
Note how the titlebar changes to include both minimize and close buttons.

Next turn off dynamic workspaces and pick a reasonable number of virtual desktops (e.g. 4-6).
You won't see any visible changes just yet, but that'll come.


Now it's time to activate the frippery extensions. Go to Shell Extensions:
Activate the extensions one by one.

Note how there's an application menu in the top left corner now:

 Note the bottom panel:

Note the location of the clock:

Note the 'favourites' group of icons:



And note the appearance of a shutdown menu item:



Other changes
Other changes that I've made to my desktop are

* installing the faenza icon set: link here
It comes with it's own installation script.

* installing conky
conky is in the debian repos.  Here's my /etc/conky/conky.conf:
background no
own_window yes
own_window_type normal
own_window_argb_visual true
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes


alignment top_right
background yes
border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
default_graph_size 20 200
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_class Conky
own_window_transparent yes
stippled_borders 0
update_interval 1.0
uppercase no
use_spacer none
show_graph_scale no

TEXT
${exec lsb_release -ds}
${execi 5 acpi|gawk '{print $3,$4}'}
${addr eth0}/${addr wlan0}
$hr
${color grey}Uptime:$color $uptime
CPU:$alignc $cpu%
$alignc$color ${cpugraph 10,200 ffff00 ff0000 -t}  
RAM:$alignc $mem/$memmax 
$alignc$color ${memgraph 10,200 ffff00 ff0000 -t}
I/O:$alignc $diskio_read/$diskio_write
$alignc$color ${diskiograph 10,200 ffff00 ff0000 -t}
${color grey}Frequency (in GHz):$color
        ${freq_g 1}, ${freq_g freq_g2}
${color grey}Temperature:
$color CPU: ${acpitemp}°C
$hr
${color grey}File systems:$alignr $color/ ${fs_used /}/${fs_size /}
$alignr /home $color${fs_used /home}/${fs_size /home}
${color grey}Networking:
${color grey}eth0 ${color red} ${upspeed eth0}/${color green} ${downspeed eth0} ${color grey}
${color grey} ${upspeedgraph eth0 10,100 ffff00 ff0000 -t} ${color grey} ${downspeedgraph eth0 10,100 0000ff 00ff00 -t} ${color grey}
${color grey}wlan0 ${color red} ${upspeed wlan0}/${color green} ${downspeed wlan0} ${color grey}
${color grey} ${upspeedgraph wlan0 10,100 ffff00 ff0000 } ${color grey} ${downspeedgraph wlan0 10,100 0000ff 00ff00 } ${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
${color}City            Ping $alignr Time  
$font${color}Google $alignr${execi 60 ping -c 1 google.com -n|grep icmp_seq|sed 's/=/\t/g'|gawk '{print $10,$11}'}       $alignr${tztime America/Los_Angeles %a %H:%M}
$font${color}Melbourne   $alignr${tztime Australia/Melbourne %a %H:%M}

17 January 2014

543. Briefly: unexpected weather in Melbourne according to Android

Southeast Australia, including Adelaide and Melbourne, is currently suffering from 40+ temperatures (Celsius) since the beginning of the week. As opposed to e.g. California, when it's hot in Melbourne during the day, it's also hot at night. Many (most?) houses in Melbourne also don't have air conditioning since we're normally dealing with cold and dreicht weather (16 degrees and rain has been the norm this summer).


Either way, since about midnight Thursday the Weather and News app on android, which uses data from the weather channel, has been reporting blowing snow in Melbourne:

We wish...

06 January 2014

542. gnucash 2.6 on debian wheezy by compiling

Update 7/1/2014: Gnucash 2.6 is now in Jessie

Original post:
"Why would you want to compile gnucash yourself", you might ask. "Because version 2.6, which is currently in SID, allows you to attach files to transactions and that's the bee's knees", I might respond.

I use gnucash to manage my grants. Attaching purchase orders, receipts and invoices would be great. Well, now you can, but not in version 2.4 which is the one found in wheezy and jessie.
I've built so many things on my main desktop that I'm not sure about the exact requirements for gnucash. I've provided a list of packages that I suspect gnucash needs in this post, but it might not be exhaustive.

sudo apt-get install build-essential libglib2.0-dev libgtk2.0-dev guile-2.0-libs libgnomecanvas2-dev libgoffice-0.8-dev guile-2.0-dev libxml2-dev libxslt-dev swig libwebkit-dev libdbd-mysql libdbi-dev libofx-dev python-dev
mkdir ~/tmp/gnucash -p
cd ~/tmp/gnucash
wget http://downloads.sourceforge.net/sourceforge/gnucash/gnucash-2.6.0.tar.bz2
tar xvf gnucash-2.6.0.tar.bz2
cd gnucash-2.6.0/
./configure
Options detected/selected ------------------------- gnucash version ...... : 2.6.0 Build for host ....... : x86_64-unknown-linux-gnu Optional components... : dbi ofx Extra Warnings ....... : -Wdeclaration-after-statement CPPFLAGS ............. : CFLAGS ............... : -Wdeclaration-after-statement -g -O2 -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused LDFLAGS .............. : prefix................ : /usr/local
make sudo checkinstall --install=no
0 - Maintainer: [ root@beryllium ] 1 - Summary: [ gnucash 2.6.0 ] 2 - Name: [ gnucash ] 3 - Version: [ 1:2.6.0 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ amd64 ] 8 - Source location: [ gnucash-2.6.0 ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ gnucash ] 12 - Conflicts: [ ] 13 - Replaces: [ ]
sudo dpkg -i gnucash_2.6.0-1_amd64.deb

If you have issues with libgnc-gnome.so.0 missing, make sure that /usr/local/lib is in your ld.so.conf and do ldconfig to update.

Either way, you can now associate a file with a transaction by right-clicking.

It does, however, seem as if you can't actually SEE if a file is associated, which makes the feature pretty useless.

04 January 2014

541. Setting up mythtv on debian with leadtek 1000s (SAA7130)

I've been using me-tv (and occasionally kaffeine and vlc) to watch DVB-T on linux for the better part of two years. While it's working absolutely fine, and I really like me-tv, I'd like to get it to work in mythtv as well in the hope that it will support closed captioning.

Note that mythtv is only available via the deb-multimedia repo and not in the offical debian repos. I first tried to install mythtv that way, and while I got pretty far (scanned for channels etc.) I couldn't get a picture when trying to watch TV using mythtv-frontend. The deb-multimedia packages also screwed up my graphics card set-up somehow, which didn't improve my mood. So while that's probably a viable method, I finally decided to compile things myself. Note that if you do keep deb-multimedia enable and do a dist-upgrade the mythplugins package below will be replaced, and with that the main mythtv package as well, leading to all kinds of fun. You might want to give mythplugins a higher version number than I've done below to circumvent that.


Building

sudo dpkg-reconfigure dash

Select 'No', so that /bin/sh/ points to bash instead of dash.

The next port of call was http://www.mythtv.org/wiki/User_Manual:Initial_Installation 

sudo apt-get install build-essential liblircclient-dev libasound2-dev libdts-dev libdvdnav-dev \
 libxv-dev libxxf86vm-dev transcode libmp3lame-dev subversion qt4-dev-tools libqt4-dev libsamplerate0 \
 libxvidcore4 liba52-0.7.4-dev libfame-dev libcdio-dev msttcorefonts libasound2-doc libmad0-dev \
 libid3tag0-dev libvorbis-dev libflac-dev libcdaudio-dev libcdparanoia0-dev fftw3-dev libfaad-dev \
 libsmpeg-dev libmp4v2-dev libtag1-dev mysql-server libvisual-0.4-dev libexif-dev libxvmc-dev \
 libxinerama-dev uuid-dev libicu-dev 
sudo apt-get install yasm checkinstall gdb python-mysqldb python-urlgrabber libnet-upnp-perl
mkdir ~/tmp/mythtv -p
cd ~/tmp/mythtv
git clone -b fixes/0.27 git://github.com/MythTV/mythtv.git
cd mythtv/mythtv/
./configure --enable-proc-opt
make
sudo checkinstall --fstrans=no --install=no
0 - Maintainer: [ andy@helium ] 1 - Summary: [ mythtv 0.27 ] 2 - Name: [ mythtv ] 3 - Version: [ 0.27 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ amd64 ] 8 - Source location: [ mythtv ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ mythtv ] 12 - Conflicts: [ ] 13 - Replaces: [ ]
Exclude files that are in the home directory.

Continue:
sudo dpkg -i mythtv_0.27-1_amd64.deb
cd ../mythplugins/
sudo apt-get install libmysql++-dev python-oauth libdate-manip-perl libxml-simple-perl libimage-size-perl libdatetime-format-iso8601-perl libsoap-lite-perl libjson-perl 
./configure
make
sudo checkinstall --fsmetrans=no --install=no
0 - Maintainer: [ root@helium ] 1 - Summary: [ mythplugins 0.27 ] 2 - Name: [ mythplugins ] 3 - Version: [ 0.27 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ amd64 ] 8 - Source location: [ mythplugins ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ mythplugins ] 12 - Conflicts: [ ] 13 - Replaces: [ ]
sudo dpkg -i mythplugins_0.27-1_amd64.deb

Note that you may want to use a much higher version number for mythplugins than I've done above -- with 0.27 the deb-multimedia version of the package will take precendence, and cause all kinds of fun...

Setting up

sudo useradd mythtv
sudo usermod -a -G mythtv $USER
mkdir ~/.mythtv

Create a file called ~/.mythtv/mysql.txt:
DBHostName=localhost
DBHostPing=no
DBHostName=localhost
DBUserName=mythtv
DBName=mythconverg
DBPassword=mythtv
LocalHostName=helium
where helium is my hostname.
Before you can run mythtv-setup you should prepare the mysql database.

mysql -u root -p
> show databases;
> create database mythconverg;zymichost.com
> create user 'mythtv'@'%' identified by 'mythtv';
> create user 'mythtv'@'localhost' identified by 'mythtv';
> set password for 'mythtv'@'%' = password('mythtv');
> set password for 'mythtv'@'localhost' = password('mythtv');
> connect mythconverg;
> grant all privileges on *.* to 'mythtv'@'%' with grant option;
> grant all privileges on *.* to 'mythtv'@'localhost' with grant option;
> flush privileges;
> exit;

Now run setup:
mythtv-setup

The first time I did this it asked about country and language, and then exited. I then ran it again and went through the setup as shown in the figures below. Note that I had to use the IP, 192.168.2.123, of my computer rather than 127.0.0.1 (i.e. localhost).















I then ran
mythbackend

and let it run in a terminal, followed by
mythfrontend

in another terminal. And it worked! I mean, not the first time, but by following the instructions above I actually got it to work -- up to a point. The audio wasn't working.


While TV is a visual medium it's still nice to have sound. So, in mythfrontend I went to Settings, Audio and picked Pulseaudio, since that's what I use by default anyway.

 I did have the occasional issue with sudden white noise, so I changed to ALSA, and all has been perfect ever since:



Test driving:
Everything seems to be working fine. Hit M for menu:
 You can choose subtitles (or just hit T):

To bring up the Electronic Program Guide (EPG) hit S:
See http://www.mythtv.org/wiki/Keybindings for a list of shortcuts.

Anyway, I'm still exploring. The one thing that's not working yet is the remote control, but that will be solved in due course.

Missing channels:
Mythtv didn't pick up channels Nine, Gem and Go. While scan found them without issue by doing 'scan /usr/share/dvb/dvb-t/au-Melbourne > channels.conf', I couldn't find an easy way to import the scan data.

Nine Melbourne:191625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:519:720:1072
GEM:191625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:512:0:1073
GO!:191625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:517:700:1074
EXTRA:191625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:520:730:1075
EXTRA 2:191625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:521:740:1076

Trying to import an existing scan in mythtv didn't allow me to provide a URL, but only showed two old scans pre-populating the import dialogue, which was both weird and annoying.

Instead the key was to add a new transport: fire up mythtv-setup, and go to the Channel editor. Note that I'm using a different skin/menu to the default one (Terra), but the process is the same.


See scan output above for the values to add here



 And you're pretty much done.

540. Briefly: prevent Youtube and Google from signing you in -- firefox version

The scenario: I've got a blogger account (i.e. this one) which is linked to my google account, and I'd like to be able to use youtube and google search without being considered as being logged in. If I log out in e.g. the google search page I also get logged out from blogger.  Gmail isn't an issue since I use thunderbird/evolution, but it would cause similar issue to blogger vs search/youtube.

The past year I've become increasingly annoyed by the behaviour of google applications -- they feel more intrusive and I keep on being asked to sign in and stay signed in. Without going into specifics, it's beginning to feel like Google is trying to turn the entire web into their version of Facebook. And I don't lie it.

Anyway, luckily there's a pretty simple way to stay signed out of Google search and youtube, even without using privacy mode -- by restricting the use of cookies.

Here's what you can do in Firefox:

1. Install the Cookies Manager+ add-on in firefox, and restart firefox
2. In firefox, go to Tools, Cookies Manager+
3. Click on Tools/Exceptions
4. Add google.com and youtube.com

Done. Now you can remain signed in to all other google sites, while staying signed out of Youtube and Google Search. Note that it doesn't make you  anonymous, but it just takes care of some of the minor nuisances associated with always being tracked by google.