Mendeley Manual Sync and Pubmed import

Table of Contents

There are many reference management software out there, free and commercials. Among them, Mendeley is a fantastic reference management software. It integrates seamlessly with my emacs orgmode, as well as libreoffice.

1 Manual sync

Sync pdf is straightforward (e.g. rsync). But that is not enough. “.local/share/data/Mendeley\ Ltd./Mendeley\ Desktop/youremail@www.mendeley.com.sqlite” has to be synced as well.

2 Pubmed import

Pubmed search results can be exported to XML file which can be converted using xlstproc (apt-get install xlstproc in ubuntu) to .bib format, which can be imported to Mendeley.

#!/bin/bash
xsl="~/Documents/bash\ scripts/pubmed2bibtex.xsl"
input="$1"
output="output.bib"

eval xsltproc $xsl $input > $output

http://svn.gna.org/svn/kbibtex/trunk/xslt/pubmed2bibtex.xsl

Beowulf clusters with centos 6.5 virtual machine

Read about Beowulf cluster on wikipedia. Main reference: “Beowulf Howto” by Kurt Swendson

1 Virtual machine installation & network configuration

Download from NUS mirror site Enable VT-x in BIOS/Security/Virtualization Create Redhat x64 virtual machine, attach centos installation image, configure network adapter (as below), boot up virtual machine to begin installation.

After installation of the 1st virtual machine, clone one or more of it with “reinitialize MAC address” enabled. Lastly enable port forwarding on one of them (head node).

1.1 Network

Adapter 1
NAT
  • Enable port forwarding for head node:: Example: TCP; 127.0.0.1; 5679; 10.0.2.15; 22
Adapter 2
Internal network

Port forwarding is for host to connect to virtual machine via ssh, so port must be ssh default port 22.

One problem that will happen is that the cloned virtual machine’s network adapter configuration will not be updated although the MAC address is changed, by “reinitialize MAC address”. Thus ifconfig shows only the lo adapter but no eth0 and eth1.

In this post, a solution is given as below:

  1. Remove the kernel’s networking interface rules file so that it can be regenerated

    rm -f /etc/udev/rules.d/70-persistent-net.rules

  2. Restart the VM

    reboot

  3. UPDATE your interface configuration file

    vim /etc/sysconfig/networking/devices/ifcfg-eth0

  4. Remove the HWADDR entry or update it to the new HWADDR for the interface (listed in this file: /etc/udev/rules.d/70-persistent-net.rules).
    • Remove the UUID entry
    • Save and exit the file
  5. Restart the networking service

    service network restart

1.2 Hostname

/etc/hosts. The hostname at command line prompt will change once we change the hostname after 127.0.0.1 and reboot. It allows us to see easily the host that we are in when multiple nodes are connected to via ssh.

127.0.0.1  beowulf0x localhost localhost.localdomain
...
192.168.0.101 beowulf01
192.168.0.102 beowulf02
...

2 NFS

Main reference: How to set up nfs on centos 6 Head node serves as nfs server, which shares its /home directory to all worker node.

yum install nfs-utils 
chkconfig nfs on 
service rpcbind start
service nfs start

Create /etc/exports file and put in the following:

/home   192.168.0.102/255.255.255.0(rw,sync,no_root_squash,no_subtree_check)
rw
This option allows the client server to both read and write within the shared directory
sync
Sync confirms requests to the shared directory only once the changes have been committed.
nosubtreecheck
This option prevents the subtree checking. When a shared directory is the subdirectory of a larger filesystem, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.
norootsquash
This phrase allows root to connect to the designated directory
exportfs -a

On the client, install

yum install nfs-utils

Append to /etc/fstab and mount

cat >> /etc/fstab
192.168.0.101:/home     /home   nfs     rw,hard,intr    0 0
mount -a

Docky in Ubuntu 12.04

Weather and gmail docklet in default docky in ubuntu 12.04 is incompatible with the network-manager according to here.

So I built docky 2.2 from source and it works now.

Some dependencies have to meet to make successfully.

I installed mono-complete which may be unneccessary, but it is easier.

sudo apt-get install mono-complete intltool libxml2-parser-perl gnome-sharp2 libgio-cil libgconf2.0-cil libgio-2.0-cil libgnomedesktop2.0-cil-dev libgnome-keyring1.0-cil-dev librsvg2-2.0-cil-dev libdbus1.0-cil-dev libdbus-glib1.0-cil-dev libnotify-cil-dev libwnzk1.0-cil-dev

Hope you enjoy docky in Ubuntu. I also recommend conky manager.

How to achieve simple page layout in reveal.js with org-reveal

There are several ways of exporting org-mode to presentation slides, as described in Writing Non-Beamer presentations in org-mode. reveal.js is a javascript package developed by Hakim El Hattab for making html slides which has rich features and is easy to use. What is even better, Yujie Wen has already made an exported for org-mode: org-reveal, which works really well and is constantly improving.

One thing I miss in MS powerpoint is page layout. I know in html that can be easily achieved but what about in org-mode. I spent an hour on this problem and I am quite satisfied with the result. It looks like this:

reveal_layout.png

org-mode default html block is not recognized by the exporter, but only #+REVEALHTML keyword. We can assign class=”fragment” to a <div> to display each div sequentially.

This is the org-mode file.

#+OPTIONS: num:nil reveal_mathjax:t toc:1
#+REVEAL_THEME: default
#+REVEAL_TRANS: default
#+REVEAL_MATH_JAX_URL: css/MathJax.js
#+REVEAL_ROOT: css/reveal.js
#+ATTR_REVEAL: :frag roll-in
#+OPTIONS: reveal_width:1920 reveal_height:1200
#+REVEAL_MARGIN: 0.05
#+REVEAL_MIN_SCALE: 0.2
#+REVEAL_MAX_SCALE: 1.0

#+REVEAL_HTML: <style type="text/css"> #wrap {width: 80%; margin:0px auto;} #left_col {width: 49% ; float:left; margin: 0.5%; background-color: orange}</style>
#+REVEAL_HTML: <div id="wrap"> <div id="left_col" class="fragment">
*List*
#+ATTR_REVEAL: :frag roll-in
1. a
2. b
3. c
4. d
#+REVEAL_HTML: </div> <div id="left_col" class="fragment">
[[file:~/Pictures/blue ubuntu.jpeg]]
#+REVEAL_HTML: </div> <div id="left_col" class="fragment">
*reveal.js*
A framework for easily creating beautiful presentations using HTML. Check out the live demo.

#+REVEAL_HTML: </div> <div id="left_col" class="fragment">
*org-reveal*
Org-Reveal exports your Org documents to reveal.js presentations.\ With Org-reveal, you can create beautiful presentations with 3D effects from simple but powerful Org contents.
#+REVEAL_HTML: </div> </div>

Connect to juniper webvpn in 64-bit ubuntu

This post by Scott in 2011 has explained in great details how to connect to Juniper VPN from 64-bit linux. It still works now for ubuntu 13.04 64-bit, but things did change a little bit, which I feel it may be useful to document here. Besides I will probably keep this post updated as new releases of ubuntu coming along.

In 32-bit linux Juniper webvpn just works, but not 64-bit ones. And most likely IT department, or computer center do not support linux.

1 Oracle java

Juniper webvpn works with Oracle java, but not openjdk which is the default java in ubuntu. We can download 64-bit jdk from Oracle website here.

Refer to the following code snippet for installation.

if [[ ! -d /usr/lib/jvm ]]; then
    sudo mkdir /usr/lib/jvm
fi  
sudo tar xvf "$DIR"/jdk-7u*-linux-x64.tar.gz -C /usr/lib/jvm/
sudo mv /usr/lib/jvm/jdk1.7.0_?? /usr/lib/jvm/jdk1.7.0
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
sudo update-alternatives --install "/usr/bin/javah" "javah" "/usr/lib/jvm/jdk1.7.0/bin/javah" 1
sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/jdk1.7.0/bin/jar" 1
sudo chmod a+x /usr/bin/java 
sudo chmod a+x /usr/bin/javac 
sudo chmod a+x /usr/bin/javaws
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
if [[ ! -d ~/.mozilla/plugins/ ]]; then
    mkdir ~/.mozilla/plugins/
fi
ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

2 Login to webvpn

Login to webvpn web interface from firefox or chromium/chrome. We may see in chromium/chrome notification like “Java(TM) was blocked because it is out of date.”. Click “Run this time”; while firefox may ask you to update java, click “later”.

The following files will be downloaded to ~/.junipernetworks

META-INF  ncLinuxApp.jar  whitelist.txt
installNC.sh           ncdiag    ncsvc           ssl.crt          xlaunchNC.sh
libncui.so             NC.jar    version.txt

The last time I saw only ncLinuxApp.jar. So I uncompressed it and make ncsvc executable.

jar xf ncLinuxApp.jar
chmod +x ncsvc

Then we can build 32-bit ncui executable.

sudo apt-get install ia32-libs gcc-multilib
gcc -m32 -Wl,-rpath,`pwd` -o ncui libncui.so

Next get webvpn host SSL certificate:

echo | openssl s_client -connect (your host):443 2>&1 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | openssl x509 -outform der > ssl.crt

To run ncui, we need to provide 3 parameters, host name, cookie, ssl certificate. cookie can be different every time we log in, it is a string started with DSID. To get the cookie:

  1. chrome/chromium: in url box javascript:alert(document.cookie), enter
  2. firefox: ctrl+shift+k to get a javascript console, type alert(document.cookie), enter

Last, we can run ncui, e.g.

sudo ./ncui -h hostname -c DSID=217f78c497e6731b0895daa130fbdaac -f ssl.crt

Ubuntu 13.10 tweaks

1 ibus configuration and shuangpin in sunpinyin

Input methods configuration is very different from the previous ubuntu versions. It seems that there are now two places to configure input mehods text entry settings (in notification panel on right corner) and ibus-setup. I have been using sunpinyin’s shuangpin and ibus-zhengma for some years, so they are the first ones to install to a new os. Then I tried to configure sunpinyin to shuangpin using ibus-setup, an error was raised for missing python module ibus. We must install python-ibus package with apt-get to be able to configure it.

2 More tweaks to come

This is my 2nd day of using ubuntu 13.10 x8664 and so far the above are the one issues that I encountered.