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:
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
vim-powerline is deprecated. No feature is added. To support other plugins, extra work needs to be done (see linepower)
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:
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
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 You may check in your .vimrc if you
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
The transparency of the background of GNOME Terminal can’t be set. Not a very big deal. But some users complained about it.
The upgrade changed my wallpapers for the desktop and the GDM. I really wanted them to be kept.
The theme is broken. Many guys complain about that
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:
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
$ cd ok
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
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.
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.
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.
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.
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.
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:
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)
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:
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
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
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:
All-around syntax highlighting seems a little bit expensive in Vim. Emacs seems to beat Vim on this point.
Use autocmd FileType to further tweak the performance, such as disable the unnecessary plugins.
Finally I succeeded in installing the nVidia driver on my old Dell Inspiron 530 geared an old nVidia 8300 GS video card running Fedora 17 i386. Here is a quick recap on my journey with Fedora 17.
I started constantly using Fedora 17 half a year ago. I had used the default open source nVidia driver nouveau happily until the system updated the kernel from the 3.3.4 to some newer version. None of these newer kernels worked well with the nouveau driver. A common issue was the mouse was drawn as a big block and the GUI color was totally garbage. I tried to install the nVidia driver either according to what it said or using the installer from the official website of nVidia. But neither way worked. I could see the mouse was spinning but the whole system kept froze. So I excluded the kernel update in yum.conf under /etc. Everything was fine until one day my Fedora Linux suddenly crashed with a kernel panic error. The traceback message indicated it was about a kernel bug in the ext4 file system
kernel BUG at fs/ext4/extents.c
Initially I thought it could be due to certain bad blocks on my hard drive. But soon the hacker news confirmed that the bug in the kernel was the culprit. After several sudden losses of my working sessions I couldn’t wait for any more seconds to update the kernel. And I had to make the Xorg server work too.
It really bugged me that the nVidia driver didn’t work on my Fedora 17. I booted from Ubuntu Linux installed on an external USB disk. And the nVidia driver worked fine under it. There must be something wrong with akmod-nvidia or the official driver.
Accidentally I found the solution. It appeared that my 8300GS card was not supported very well in the recent 3xx driver. I guess this type was not very common. I tried akmod-nvidia-173xx and X server started this time. In my case, I didn’t need to do this:
Remove / disable nouveau drivers from kernel initramfs
The remaining issue was the OpenGL apps were indirectly rendered. It was due to the nVidia GL library was not automatically loaded. The system still used the mesa GL to do the software rendering. A workaround is to put the following line in .bashrc
Another problem was the dual displays. The default xorg.conf generated by akmod-nvidia-173xx didn’t support the twin views. Additionally, nvidia-settings complained the X11 driver was too old to be configured. Fortunately I had a copy of working xorg.conf at my Ubuntu partition. And here is what it looks right now.
Today I got some time to improve my tech blog with Octopress. I found that I couldn’t use the different letter cases as the same category name. Otherwise the category page wouldn’t show correct number of links to the posts under that category. For example, I had to change all git to Git in the meta info of every posts. Here was what I used to get this job done.
-l: ask ack to only show the filename with matched search pattern. You can try first without -l
option to make sure you find the correct files. And then run with -l option to make the output
suitable for xargs
-p: read and loop from files instead of STDIN
-i: in-place edit
-e: run the command. Here we do the search and replace operations.