A Coding Monkey's Blog

Fix the Loading Dll Issue of Octave Cygwin

Have you run into this loading problem when you start Octave in Cygwin recently? If yes, you are not alone.

[zandy@cygwin] ~ $ octave
/usr/bin/octave-cli-3.8.1.exe: error while loading shared libraries: ?: cannot open shared
object file: No such file or directory


[zandy@cygwin] ~ $ cygcheck /usr/bin/octave-cli-3.8.1.exe
cygcheck: track_down: could not find cygblas-0.dll
cygcheck: track_down: could not find cygblas-0.dll
cygcheck: track_down: could not find cyglapack-0.dll
cygcheck: track_down: could not find cyglapack-0.dll
cygcheck: track_down: could not find cygblas-0.dll
cygcheck: track_down: could not find cyglapack-0.dll
cygcheck: track_down: could not find cygblas-0.dll
cygcheck: track_down: could not find cyglapack-0.dll

It looks like Octave cannot find the shared libraries of blas and lapack but they actually have been installed.


The loading issue is cause by the fact that cygblas-0.dll and cyglapack-0.dll were accidentally installed into /usr/lib/lapack. According to the Cygwin documentation, Cygwin looks for DLL’s by searching the directories defined in the environment variable PATH. The default PATH doesn’t include /usr/lib/lapack. Therefore, the solution is either

cp /usr/lib/lapack/*.dll /bin


export $PATH=/usr/lib/lapack:$PATH

Use Juniper VPN Client Under Fedora 20 X86-64

This is my first time to use Juniper VPN to connect to the workplace from home. My computer runs Fedora 20 in 64bit and Firefox in 64bit. I had a hard time to establish a connection through the web portal. The client files were downloaded into


I followed the instructions listed here, here, here and here. None of them worked. I got stuck by the error message in ncsvc.loglike this:

ncapp.error Failed to authenticate with IVE.

Finally this blog post saved my day. I confirmed it solved my issue. It turns out sometimes you have to use the web browser to make the connection. Here is what I did.

  1. Install 32bit Opera
  2. Install 32bit JRE. Java plugin is stored in /usr/java/default/i386/libnpjp2.so
  3. Type about:plugins in the address windows of Opera to find out where the plugins is located. In my case it is in /usr/lib/mozilla/plugins .
  4. Made a symbolic link of 32bit Java plugin to /usr/lib/mozilla/plugins .
  5. Re-visit the VPN login portal to set up the connection.

You should see the VPN session window pop up and the connection is up. This is the simplest way to make everything work.

Watch Netflix in Linux

I had watched TV shows on Hulu for a simple reason that it’s Flash-based so I could watch it in Linux. One thing I did’t like about Hulu is its high-frequency of ads. Netflix has fewer ads but it builds its business on Silverlight plugin, which is generally exclusive for Windows and Mac OS. I’ve never imagined that I could be able to watch movies in Linux until I found Pipelight.

Pipelight is a very smart project that makes use of Wine to make Silverlight work in Linux web browser. The website of Pipelight has provides a very complete documentation on the installation for various Linux distributions. For me the installation for Fedora 19 was a breezy. Of course, you also need some Firefox plugin to make Netflix believe you are using Windows Firefox. When you first load Pipelight, Wine will automatically configure everything including downloading Silverlight. I like this plugin so much. I don’t think I will upgrade to Fedora 20 until Pipelight for that version is available.

Only one thing I found worth mentioning this time is the update. If your Linux distribution updates the version of Wine and your Pipelight doesn’t work, my solution is to completely remove Wine and Pipelight and then reinstall them.

You can how Netflix looks like in my Linux Firefox: alt

Fly With Vim Airline

I recently replaced my vim-powerline with vim-airline. I like vim-airline so much that I can’t help spreading words about it.

For those who don’t know what vim-powerline is. It is a Vim plugin that can make the statusline of Vim colorful and eye candy. When vim-powerline first came out, it caught on very quickly. The author of vim-powerline even re-wrote it in Python (the project powerline) to make it work for more applications (zsh, Tmux, ipython to name a few). But the current problems are

  1. vim-powerline is deprecated. No feature is added. To support other plugins, extra work needs to be done (see linepower)

  2. powerline is too heavy for Vim users who believe less is more. Its dependency in Python complicated the installation and uninstallation. I’ve never set it up successfully. Most importantly, it is unstable. Many issues are open.

I really appreciate the hard work done by the author of vim-powerline. If vim-airline didn’t appear, I would continue to use this plugin.

Comparing with the former two, vim-airline is lightweight, vimscript-only and actively maintained. It supports many plugins and the number is increasing. I did a very rough statistics on lines of code:

vim-airline:   935 lines
vim-powerline: 2638 lines
powerline:     11067 lines

It is impressive that vim-airline uses less than half the code of vim-powerline and all the features are covered. Here is my settings in .vimrc

" airline
let g:airline_theme             = 'powerlineish'
let g:airline_enable_branch     = 1
let g:airline_enable_syntastic  = 1

" vim-powerline symbols
let g:airline_left_sep          = '⮀'
let g:airline_left_alt_sep      = '⮁'
let g:airline_right_sep         = '⮂'
let g:airline_right_alt_sep     = '⮃'
let g:airline_branch_prefix     = '⭠'
let g:airline_readonly_symbol   = '⭤'
let g:airline_linecolumn_prefix = '⭡'

To view the unicode glyphs correctly, please use the font patched by fontpatcher in the github repo of vim-powerline (NOT POWERLINE).

Another tip. If you start Vim but the statusline is blank like this alt You may check in your .vimrc if you

set lazyredraw

Comment it. You will see alt

I strongly recommend this great plugin.

Fedora 19 and Gnome 3.8

Last night I didn’t resist the temptation to enter

sudo yum install fedora-upgrade 

Viola, my journey to Fedora 19 began!

Every time I upgraded my Linux to the latest release, either Ubuntu or Fedora, I would have to spent another day to tweak the new system to make it comfortable to use. The biggest challenge was surely the transition from GNOME 2 to 3. Two years have passed and I still can’t get used to the new UI. Accurately speaking, I really like the new UI elements in GNOME 3 but I just don’t like the ways that GNOME shell asks me to do things. I think GNOME shell is attractive for new users and especially good for tablet. But for a senior user, it is too obtrusive. It wanted to be smart but overdid.

I appreciated the fallback mode that GNOME 3 provided. I turned off all the fancy animations and sticked to the old-fashioned UI. I used tint2 as the window list panel. In Fedora 18 with Gnome 3.6, the clock applet surprisingly had a memory leak issue. I disabled the clock applet and only used the tint2 panel to show the time. However, sometimes, I missed the weather information.

With the advent of GNOME 3.8, the fallback was sadly dropped and the 2D GNOME shell was so ugly that I had to make a change.

I first tried Xfce and MATE Desktop. MATE failed to start on my Fedora 19. I realized that I was spoiled by the modern UI of GNOME 3 so the look and feel of Xfce (based on GTK+ 2) became intolerable. Thank God there is Cinnamon. When Cinnamon was first released, I thought it was another flamboyant window manager but it turns out sleek and practical. The status bar is very compact but full of useful information. Window list? Check. Weather applet? Check. Start menu? Check. Transparency effect? Check. GNOME compatible? Check. I don’t need many. These are good enough. I’m so happy to settle down with Cinnamon.

Some other issues with GNOME 3.8 are

  1. The transparency of the background of GNOME Terminal can’t be set. Not a very big deal. But some users complained about it.

  2. The upgrade changed my wallpapers for the desktop and the GDM. I really wanted them to be kept.

  3. The theme is broken. Many guys complain about that

Fix Neocomplcache to Support Perl Complete

I have long been jealous about the great auto-complete feature of Python in Vim. With the wonderful plugin neocomplcache, once you type . after an object, the memeber methods will pop up.

I want this feature for Perl when I type ->. Actually, until today haven’t I realized that I already own at my finger tip. The answer is neocomplcache and perlomni.

The installation of neocomplcache and perlomni is easy. If you use the settings from the help of neocomplcache, the key part to triger neocomplcache omni-complete by -> is to change the setting in .vimrc from

let g:neocomplcache_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::'


let g:neocomplcache_omni_patterns.perl = '\h\w*->\|\h\w*->\h\w*\|\h\w*::\|\h\w*::\h\w*'

Make sure omnifunc is PerlComplete.

A little explanation: \h\w*-> will triger the popup window, \h\w*->\h\w* will complete as-you-type. The similar situation goes to :: operator. But do remember that sometimes :: won’t triger neocomplcache if the package is not based on the OO that perlomni supports. In this case, C-X C-O will always pop up the window. After this you should see someting like this:


Introducing Quickcd

I just published the code of quickcd on github. Check it out at https://github.com/jchain/quickcd


A rewrite of fuzzycd in Perl. You only need to type partial directory names to change directories. It saves you a lot of keystrokes and enhances your productivity, especially when you navigate in many subdirectories with tricky names.

This script is inspired by fuzzycd. Big thanks to the author for sharing his/her great code. The way of intercepting the system cd is genius. I recommend you to try both scripts and choose the one you like most.


quickcd enables you to use cd with partial directory names. For example:

$ cd box
  => Dropbox
$ cd ok
  => Ebook

If there is more than one directory containing your cd path, you just need to type one more letter to take you to the target folder.

~ $ cd D
Make a choice:
[a] Desktop  [b] Documents  [c] Downloads  [d] Dropbox
Desktop $

Why rewrite?

The differences:

  1. When your cd path contains capital letter quickcd will match case sensitively. This way can result in less matches. fuzzycd seems to do case insensitive match all the time.

  2. quickcd prints out a well-formatted candidates. It fits the width of the terminal windows and the columns are aligned neatly. I worked really hard on making this right. fuzzycd candidates are not always aligned.

  3. quickcd doesn’t support multi-level directory nagivation. Its main focus is current directory. fuzzycd supports fuzzy jumps to multi-level directory but I rarely use this feature.

  4. quickcd is written in Perl. Yep, I like Perl! fuzzycd is written in Ruby.


This following instruction are shamelessly copied from fuzzycd’s README.

Modify your ~/.profile (or ~/.bashrc, depending your operating system) and add the following lines. This assumes you put fuzzycd in the ~/scripts/ directory.

export PATH=~/scripts/fuzzycd/:$PATH
source ~/scripts/fuzzycd/fuzzycd_bash_wrapper.sh

This will effectively wrap the builtin bash cd command with the fuzzy cd command. Enjoy!

Note: If you have any other shell plugins which try to redefine the “cd” function (e.g. rvm does this), make sure that the source ... fuzzycd_bash_wrapper.sh line comes last in your bash profile. fuzzycd plays nicely with other bash modification plugins, but it should be loaded last.

Build Feh From Source and Install to Home Directory

Feh is a lightweight image viewer for Linux. Its source code doesn’t ship the Autoconf script and only Makefile. The customization is done by modifying the file config.mk. In my case I would like to install it to my HOME directory. Plus, I have installed the dependency library giblib into HOME directory before so I have to specify the search path for compiler and linker. Here is what I got so far:

PACKAGE ?= feh
VERSION ?= 2.8

# Prefix for all installed files
# PREFIX ?= /usr/local

# Directories for manuals, executables, docs, data, etc.
main_dir = ${DESTDIR}${PREFIX}
man_dir = ${main_dir}/share/man
bin_dir = ${main_dir}/bin
doc_dir = ${main_dir}/share/doc/feh
image_dir = ${main_dir}/share/feh/images
font_dir = ${main_dir}/share/feh/fonts
example_dir = ${main_dir}/share/doc/feh/examples

# default CFLAGS
CFLAGS ?= -g -O2
CFLAGS += -Wall -Wextra -pedantic

curl ?= 1
debug ?= 0
help ?= 0
xinerama ?= 1
exif ?= 0

ifeq (${curl},1)
  LDLIBS += -lcurl
  MAN_CURL = enabled
  MAN_CURL = disabled

ifeq (${debug},1)
  MAN_DEBUG = . This is a debug build.

ifeq (${help},1)

ifeq (${stat64},1)

ifeq (${xinerama},1)
  LDLIBS += -lXinerama
  MAN_XINERAMA = enabled
  MAN_XINERAMA = disabled

ifeq (${exif},1)
  LDLIBS += -lexif
  MAN_EXIF = enabled
  MAN_EXIF = disabled

# Uncomment this to use dmalloc


# LDLIBS += -lm -lpng -lX11 -lImlib2 -lgiblib
LDLIBS += -lm -lpng -lX11 -lImlib2 -lgiblib -L${PREFIX}/lib64/

Install RcppOctave if Octave Is in User-defined Directory

Even though I have been very busy these days I think I should try to get at least one post published per month. My recent job involved a lot of data analysis and statistical computing. I pushed myself to get familiar with R because some packages from R are indispensable for my work. Meanwhile I also wanted to reuse my existing Octave code. Luckily I get the best of both worlds by using RcppOctave which is a bridging package connecting the R and Octave sessions.

I compiled the latest Octave on the server and installed in my home directory. When installing RcppOctave in R by running


I ran into an error message like this:

** preparing package for lazy loading
Creating a generic function for ‘show’ from ‘methods’ in package ‘RcppOctave’
    (from the saved implicit definition)
** help
Error : /tmp/Rtmp028JZY/R.INSTALL6dea26e533ee/RcppOctave/man/o_addpath.Rd:40: unable to load
shared object '/home/zandy/lib64/R/library/RcppOctave/libs/RcppOctave.so':
liboctinterp.so.1: cannot open shared object file: No such file or directory

ERROR: installing Rd objects failed for package ‘RcppOctave’
* removing ‘/home/zandy/lib64/R/library/RcppOctave’

The build phase seemed OK. Only did the install phase complain. I spent some time and figured out a work-around is to specify the library path to your liboctinterp.so:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib64/octave/3.6.3

I don’t know much about the internal mechanism of install.packages otherwise I may be able to fix the problem completely.

Vim Gets Slow When Editing LaTeX File

Recently I have been working on editing multiple LaTeX files containing many lines and equations. I noticed there was an annoying slowdown when I moved the cursor around. CPU usage jumped to 100% so frequently that I almost lost patience to focus on the writing itself.

After tweaking the Vim plugins and configurations for a while, I found out set cursorline and the built-in plugin MatchParen made Vim scrolling very slow. Some people seemed to have run into the same problem as mentioned here and here. Some complained that Vim got slow when editing Ruby file. And I use Vim in terminal.

I have no idea why Vim drawing is so CPU expensive. At this moment I disabled the highlighting of cursorline and cursorcolumn

set nocursorline
set nocursorcolumn 

I also notice that cursor movements in the equation environment was very slow partially it was because the math equations had so many parentheses, brackets and braces. Matching pairs and syntax highlighting easily ate a good amount of CPU cycles. So I turned off this plugin by


I didn’t completely disable this plugin since I found that it was useful when editing long equations. So I didn’t try this in .vimrc

let g:loaded_matchparen=1

I found some other tweaks by using Vim’s :profile command and the verbose options vim -V foo.bar. They are good ways to try to analyze the slowdown.

The lesson I learned:

  1. All-around syntax highlighting seems a little bit expensive in Vim. Emacs seems to beat Vim on this point.
  2. Use autocmd FileType to further tweak the performance, such as disable the unnecessary plugins.