Archive for the ‘Techniques’ Category


I’m a fan of SublimeText and it suits well for my work (I code Python, MATLAB, LaTeX and sometime C++). People often tell me that if something works well for me, I shouldn’t change it. However, I’m a curious guy and VIM is recommended to me several times in … 10 years and I was too lazy to try it. So I write this blog post as a simple tutorial, a simple first step for myself. If it isn’t suit my work-flow, it’s still nice to know about this tool. I also hope this would be useful for other people who want to learn VIM from zero.

There is a joke from linux users about Windows user: “The easiest way to generate a random string is telling a Windows User type in VIM”. Starting as a Windows user, it’s funny that it was true for me the first time I used VIM (long time ago) and I don’t have time to use it again, until recently.

To install vim:

 sudo apt-get install vim 

How to create a text file with vim:

Open vim by opening the terminal and input:


Then press Enter, what we should have is like this:

To go to inter mode, press i, to return to command mode (default), press Esc.

We can navigate through text in the command mode with directional buttons as H-J-K-L, equivalent to left-up-down-right.

Now as told earlier, press i to go to Insert mode (VIM will tell us with INSERT at bottom left corner). Insert whatever text you like.

Now, to save it, we need


command, press Esc to quit Insert mode, type

:w testtxt.txt

and press Enter.

As a result, VIM will create a testtxt.txt file, note that because I run the terminal in Home folder, then the saved file is located there.

[to be continued…]


[Note] Use Logitech MX 2S in Ubuntu 16.04

Normally with the unifying dongle (provided in the package), you plug in and you can use it right away. However, for unknown reason(s), on Ubuntu 16.04 the bluetooth function is stop and I cannot use the mouse again.

Enough with frustration and struggling, I found a solution that on Ubuntu 16.04 I have to install the Logitech Dongle Software that named Solaar:

Here is the link to the installation and tutorial:

Now everything is good to go.

Submit Latex manuscript to Elsevier

I struggled a little bit yesterday when I was working with a revision of my manuscript at Elsevier system. So I want to share some experiences here. Similar explanation is found at Pr. Bartneck blog, my blog post is merely a copy-paste and a personal note with some additional information.

Your first submission as PDF is normally accepted by the editor, however, your revised version should me modifiable source (such as .tex, .docx …). But it is not so simple like that with latex, here is some remarks:

  • Elsevier will compile your text file online to finally give you a PDF version, so do not submit your compiled PDF version in the attachment section, otherwise it will be included in the output PDF. Only .tex file and figures for the manuscript.
  • Do not use directory, because Elsevier Latex Compiler WILL NOT understand it. Otherwise you should put all figures in the same folder as the source file, remove all Figures in includegraphics and it’s good to go.
  • As remarked by professor Christoph Bartneck, do not submit PDF image files, other wise use EPS and other common rasterized format such as PNG and JPEG.
  • The Answer To Reviewers sheet can be included by being set order after the .tex document. The output PDF should contain it. The .docx format is applicable.
  • This is minor remark, but you should remove the linenumber, because (as you knew already I suppose) reviewers and editors would use editor’s generated line numbering.
  • You can zip all your files to single zip file then upload that single file. That way allows you to upload faster and you only have to modify a little bit the order of uploaded files.

Now I understand a little bit why my former supervisor had said that working with Latex to him is a nuisance. I agree with certain level. But we can manage and do not let this nuisance stop you from using latex, it’s always amazing!

Chạy Matlab 2017 trong SublimeText 3 trên Win 10

SublimeText là phần mềm soạn code nhanh và dễ dùng nhất tôi từng sử dụng, điểm trừ lớn nhất của nó có lẽ là giá của cái bản quyền hơi mắc ($80), tuy nhiên mấy key lượm lặt trên mạng copy về xài lụi cũng được một thời gian, có tiền thì mua vì nó đáng.

Matlab là phần mềm tính toán khoa học tương đối mạnh mà mấy trường đại học và mấy người làm nghiên cứu hay dùng, đây là một trong những bộ code siêu mạnh, ứng dụng rộng rãi và được hỗ trợ rất tốt, điểm trừ cũng giống như SublimeText đó là bản quyền mắc, tuy nhiên làm việc trong trường đại học thì thường được cấp license.

Ok, giới thiệu xong hai cái phần mềm cho ai không biết, hoặc cho chính bản thân mình lỡ đâu sau này mình quên. Version ở tiêu đề chỉ đơn giản là cái tôi đang dùng, cơ bản là giống nhau trừ khi tương lai một trong ba hệ thống có gì thay đổi quá đáng, lúc đó nếu nhớ sẽ câp nhật sau :p.

Kết hợp hai phần mềm là một ý tưởng tốt và với tôi thì nên làm vì nó làm việc lập trình nhanh hơn và dễ chịu hơn (ý kiến cá nhân, ai không thích thì không dùng). Để làm được việc này thì cần thiết lập hai file sau thông qua menu “New build system” trong SublimeText.


“fallback_encoding”: “Western (Windows 1252)”,
“default_encoding”: “Western (Windows 1252)”


“selector”: “source.matlab”,
“shell”: true,
“windows”: {
“cmd”: [“matlab”, “-nodesktop”, “-nosplash”, “-r”, “$file_base_name”]
“osx”: {
“cmd”: [“matlab”, “-nodisplay”, “-nosplash”, “-r”, “$file_base_name”]
“linux”: {
“cmd”: [“matlab”, “-nodisplay”, “-nosplash”, “-r”, “$file_base_name”]

Không nhớ là có cần khởi động lại SublimeText không, hình như là không.

Đơn giản vậy thôi, happy coding!


Matplotlib color chart

Here is the color chart for using inside matplotlib



Image gotten from a discussion on stack:

Tag Cloud

%d bloggers like this: