Month: June 2015

KeePass and the variance


KeePass is my favourite for password manager. In Linux, there are KeePassX and KeePass 2. There are several differences.

KeePass has two versions, they are KeePass version 1 and Keepass version 2, namely KeePass 2. They are using different file formats: kdb and kdbx. KeePass is natively runnable in Windows; KeePass 2 requires .NET Framework 2.0 (and above) or Mono (and above). That is why, KeePass 2 is able to run in Linux. Then, KeePassX is a port of KeePass, so that it works as cross-platform, including Windows. However, KeePassX is not based on KeePass 2. Thus, it cannot read/write kdbx. But, there is KeePassX version 2 in the alpha stage, which is available in GitHub.

CJK problem in KeePass 2 (Linux)

I personally found that KeePass 2 on Linux has several problems. CJK (Chinese/Japanese/Korean) characters do not work in KeePass 2. To make it work with Fcitx, I have to edit the desktop entry (.desktop) file by changing the exec to

Exec=sh -c 'GTK_IM_MODULE=xim QT_IM_MODULE=xim LANG=zh_CN.UTF8 keepass'

Besides that, I also found that KeePass 2 is a little slow. Nevertheless, KeePass 2 is more up-to-date comparing to KeePassX.

Format conversion in Linux

Because of the big differences of KeePass and KeePass 2, file conversion between the two versions has a little trouble, especially in Linux. KeePass 2 in Windows can import from and export to KeePass 1 format (xdb). Yet KeePass 2 in Linux does not work. So, my solution is using Wine with PlayOnLinux.

Download KeePass 2 for Windows, install .NET Framework 2.0 on Wine using PlayOnLinux, install KeePass 2. Then you can run KeePass 2 Windows version smoothly on Linux. As a result, you can import/export the xdb file. (Please aware that the CJK conversion may not work properly.)

 

So, if you are a Linux user, you can choose over KeePassX, KeePass 2, or KeePassX in GitHub, or even running KeePass Windows version in Wine.

Vim and Emacs


After watching the Bloomerg video of Mr Torvalds, I found that he is using Emacs-like editor, which is uemacs, I immediately compiled my Vim and Emacs cheatsheet.

A programmer can write program without IDE, but cannot write without a good text editor. There are a lot of modern text editors. But I feel that learning using a text user interface (console-based) text is very much important. Imagine that you have to use SSH to write some scripts on the remote computer.

I personally inclined to Vim. This is because of Vi editor, which is a very common text editor in every Unix-like OS. Therefore, I learnt Vim.

Unlike Vim, Emacs does not have the visual mode or insert mode. Therefore, Emacs is easier to highlight/select the text.

The following is the comparison table (my personal cheatsheet),

vim emacs
Navigation
Left, down, up, right h, j, k, l ←, ↓, ↑, →
Left by word b Ctrl+←
Right by word w (begin), e (end) Ctrl+→
Begin line ^, 0 Home, Meta+a
End line $ End, Meta+e
First line gg Meta+<
Last line G Meta+>
Next single page, previous single page Ctrl+f, Ctrl+b Ctrl+v, Meta+v
Next half page, previous half page Ctrl+d, Ctrl+u
Go to line [:digit:]g Meta+x goto-line
Select v (visual mode) Shift+arrow
Copy y Meta+w
Paste p Ctrl+y
Cut d Ctrl+w
Edit i (insert mode), R (replace mode)
Delete x, d[hjkleb] Del
Append a
Open new line below, above o, O Enter
Undo, redo u, Ctrl+r Ctrl+/
Revert :e! Meta-x revert-buffer
Search
Forward, backward search /pattern, ?pattern Ctrl+s, Ctrl+r
Next, previous n, N Ctrl+s, Ctrl+r
Search and replace :%s/old/new/g, :%s/old/new/gc (with confirmation) Meta+% (interactive)
Toggle case sensitivity :set ic (insensitive case) Meta+c
Regular expression search forward, backward /pattern, ?pattern Ctrl+Meta+s, Ctrl+Meta+r
Regular expression search and replace :%s/old/new/g, :%s/old/new/gc (with confirmation) Ctrl+Meta+% (interactive)
Programming
Increase indent, decrease indent >, < (in V) Ctrl+x Tab (interactive)
Window
Horizontal, vertical split Ctrl+ws, Ctrl+wv Ctrl+x 2, Ctrl+x 3
Focus window Ctrl+w[hjkl] Meta+x windmove-[left|down|up|right]
Close window Ctrl+wq Ctrl+x 0
Close others Ctrl+wo Ctrl+x 1
Horizontal, vertical resize :res [+-][:digit:], :vert res [+-][:digit:] Ctrl+x { (horizontal shrink)

Ctrl+x } (horizontal enlarge)

Ctrl+x ^ (vertical enlarge)

Equal size Ctrl+w= Ctrl+x + (balance all)
Switch window Ctrl+ww Ctrl+x o
Tab (buffer and frame)
New tab :tabnew Ctrl+x 5 2 (frame)
Close tab :tabc Ctrl+x 5 0 (frame)
Close others :tab
Switch next, previous tab gt, gT Ctrl+x Left, Ctrl+x Right (buffer)
Switch n tab [:digit:]gt Ctrl+x b (interactive for buffer)
Move tab :tabmove [:digit:]
File
Quit :q, :q! (without changes) Ctrl+x Ctrl+c
Quit all :qa
Save :w Ctrl+x Ctrl+s
Save as :w filename Ctrl+x Ctrl+w
Save and exit :wq
Open
:o filename
Ctrl+x Ctrl+f
Miscellaneous
Cancel command Ctrl+g
Command Meta+x command

 

HTTrack, FBReader, and Calibre


HTTrack Website Copier is always my favourite. Internet is not always available. Download a website, especially articles, for offline reading is always a good solution. HTTrack is the best. Previously I used GUI, but in Linux, command-line is a better method.

On the other hand, Android e-book reader I used most is FBReader. It supports multiple e-book format, especially EPUB. FBReader is easy to use, and there is night reading mode. Furthermore, it is open source and available in multiple platforms.

The best e-book management software I know is Calibre. The best feature is e-book conversion which supports various e-book format.

However, I have a problem with the downloaded website using HTTrack. The offline website is converted to EPUB format, which can be read by FBReader. Yet, because of the EPUB is a ZIP compressed file, opening the EPUB file requires to decompress it and retrieve the content. Moreover, the offline website is around 50 megabytes and contains around 4,400 files. This causes using FBReader to open the e-book requires more than 1 minute. This is extremely annoyance.

At the end, I choose to use Calibre to convert the offline website to a large size TXT format e-book. Now, I can read the offline website contents as e-book in my phone.

 

P/S: I tried to use mobile web browser to read the website online, even using the Reader View mode from Firefox. But there are a lot of disadvantages. Firstly, Internet connection is required. Secondly, Firefox cannot remember until where you have read, and bookmarking does not solve the problem. Thirdly, you cannot adjust the background colour and the text colour as easy as in FBReader. Each app is developed in a very different purpose.

Interesting Linux distros and desktop environments


Ubuntu is considered as the most popular Linux distro. It is based on Debian, where Debian is famous of its stability. And Linux Mint, which becomes another most popular Linux distro, is based on Ubuntu and Debian. Recently, there are several Linux distros attract my attention.

Firstly, elementary OS, which is based on Ubuntu, is well-known of its aesthetic design. Unlike other distros which were using common desktop environments, for instance GNOME, KDE, Xfce, and LXDE, it uses Pantheon.

elementary OS in VirtualBox
elementary OS in VirtualBox

Then, deepin, which is also based on Ubuntu, uses its own desktop environment, i.e. Deepin Desktop Environment. The Deepin Desktop Environment is based on HTML5, this is something distinguish.

deepin in VirtualBox
deepin in VirtualBox
deepin using Chinese language in VirtualBox
deepin using Chinese language in VirtualBox

During the installation, if Chinese language is chosen, then Sogou Pinyin will be installed.

Next is Chromixium OS, which is also based on Ubuntu. It does not use a desktop environment, but a window manager, i.e. Openbox. It uses Plank for the panel/dock.

Chromixium OS in VirtualBox
Chromixium OS in VirtualBox

Solus is neither based on Debian nor Ubuntu, but from scratch, uses different package manager. Interestingly, the desktop environment used is called Budgie. Not only from the scratch, but it has its own desktop environment.

Solus in VirtualBox
Solus in VirtualBox

Bodhi Linux, another Ubuntu-based distro, which the desktop environment is Enlightenment. In fact, it is not the only distro uses Enlightenment. But I know Enlightenment because of Bodhi Linux.

Bodhi Linux in VirtualBox
Bodhi Linux in VirtualBox

Enlightenment is referred as “the original eye-candy window” [1]. However, I personally struggle with the tray icon problem with Enlightenment.

GoboLinux is another independent distro from the scratch. It also uses Enlightenment, but very different from Bodhi Linux and other distros. GoboLinux has a very different filesystem hierarchy.

GoboLinux in VirtualBox
GoboLinux in VirtualBox

Finally, I would like to mention about a desktop environment: Sugar. Unlike other desktop environments, it has different design and different concept. I tried SoaS (Sugar on a Stick) which is based on Fedora. Because Sugar is developed for children, thus it has a very different HCI (human-computer interaction) design. It focuses on activities instead of applications. It focuses one specific tasks instead of multi-tasking, thus each activity will be launched at fullscreen. In my opinion, this is a little similar to running mobile apps. Furthermore, instead of traditional desktop metaphor, it uses “Zoom Metaphor”.

SoaS in VirtualBox
SoaS in VirtualBox

 

There are not only various Linux distributions, but also different package managers. Moreover, there are also various desktop environments. How to choose a distro? Read various reviews and try them.