Zhu Yong

$ echo "Be Persistent, Be Patient" >> ~/.life

Nov 25, 2014 - 3 minute read - Comments - HHKB gadget

Finally, I Bought a HHKB Professional 2 Type-S

Same as many programmers using Emaces or VIM, I want to own a HHKB professional for real long time, and for the same reason not many people buy it: the price. This keyboard is really expensive when compare to other mechanical keyboard. But deep in my heart, I always want to own one. So this month when I want to replace my IBM model M SSK from workplace, I decided to buy a HHKB Professional 2 Type-s.

Nov 24, 2014 - 2 minute read - Comments - MobaXterm

MobaXterm Install Package To Persistent Root Direcotry

MobaXterm is a very good SSH and X-Windows client. I have being use the free portable personal version for quite a while. Its built-in X-Server is very handy and convenient for people like me to run remote GUI applications occasionally. From version 7.2, they added the apt-get like package manager: MobApt Package Manager, and added the option to set persistent root directory, so user can install their own cygwin package to this persistent root directory.

Jun 26, 2014 - 1 minute read - Comments - git MobaXterm

Fix git connection problem over HTTPS in MobaXterm

MobaXterm is a very nice portable ssh client as well as UNIX environment on Windows system. It has a lot of useful utilities including Xserver bundled into one single exe file. Recently I use it as my primary terminal on Windows system. But when I use the git plugin to clone / push my github repository, it first give me error of cert file not found, so I follow online instruction to set the root cert file in ~/.

Mar 19, 2014 - 1 minute read - Comments - c testing

C Code Unit Testing Using cmocka

cmocka is a unit testing framework for C, it is developed based on Google’s project cmockery. It was easy to use, and the author corrected some bugs from cmockery. Install cmocka First download source code for latest version of cmocka from https://open.cryptomilk.org/projects/cmocka/files. Current latest version is 0.3.2, and the source file is cmocka-0.3.2.tar.xz. cmake is required to build cmocka. $ cd ~/Downloads $ xz -d cmocka-0.3.2.tar.xz $ tar vxf cmocka-0.

Feb 20, 2014 - 6 minute read - Comments - vim clang

Hack YouCompleteMe And libclang For Lamely Structured Project

On 13 Feb 2014 I asked a question on StackOverflow on how to configure / modify vim plugin YouCompleteMe to fit special project structure. I guess my project structure is really lame, after two days waiting, some comments were given, but my problem not realy addressed. So I think I have to DO IT MYSELF. Then I read the source code for YouComeplteMe as well as libclang, because I only need the code completion function, lucky the related code are not much. Then I done experiments with different approaches, and today, finally, I had my hacking works. Then I think I should record this nice experience, that’s the purpose of this blog post.

My Question On StackOverflow

My C project has following structures. This is the structure for a large project, I can’t change the structure. I want to use YouCompleteMe for semantic code completion for this project.

main/                     // folder for C file to be compiled
  |- module1.c            // module main C file.
  |- module2.c
  |- .....
module1/
  |- mod1_func1.c         // function file to be included in main module C file.
  |- mod1_func2.c
  |- mod2_func3.c
module2/
  |- mod2_func1.c
  |- mod2_func2.c
  |- mod2_func3.c

Content for moduleX.c, this will include all related header files and module related C files.

#include "header1.h"
#include "header2.h"
...
#include "modX_func1.c"
#include "modX_func2.c"

Content for modX_funcX.c has one or few function definitions. Doesn’t have header included

// no header file included here
int modX_funcX(void) {.....}

Because there is not related header included, clang must parse moduleX.c in order to do code completion on modX_funcX.c, I have tried clang code completion from command line. Command below works

clang -cc1 -x c -fsyntax-only -code-completion-at mod1_func1.c:4:11 module1.c 

So my question: how to configure YouCompleteMe to do code completion when I edit the modX_funcX.c file?

I guess modification to YouCompleteMe source might required to do this job. My current idea is to add a file mapping database with format:

path_of_file_to_complete:path_of_file_for_clang_to_parse

So before send the code completion request, get path_of_file_for_clang_to_parse from database based on current buffer name, pass this file name to libclang.

Is my idea workable? If Yes, where is exactly place to add this file mapping function?

Feb 12, 2014 - 1 minute read - Comments - opensource

DARPA Published Over 60 Projects Source Code In One Place

The Defense Advanced Research Projects Agency, or DARPA, sponsors a lot of technology through grants to universities and private lab, has published DARPA Open Catalog which listed over 60 opensource projects. Chris White, the DARPA program manager behind the effort, said “Making our open source catalog available increases the number of experts who can help quickly develop relevant software for the government. Our hope is that the computer science community will test and evaluate elements of our software and afterward adopt them as either standalone offerings or as components of their products.

Feb 10, 2014 - 3 minute read - Comments - applications

Windows Data Backup Using FreeFileSync Step By Step

This article is the step by step guide that I prepared for my colleagues to do the data backup to our newly bought server. I was assigned the task to evaluate some backup tools and find the best one that fits our requirements. After some testing, I finally choose FreeFileSync. I choose it over other tools because it has a feature I like most:

I can mirror folders to backup server, so the backup server is always the latest copy, when I restore, I just copy this folder back to its location; while for those modified / deleted files, they will be saved in another dedicated loation with Date as version.

OK. Here begins the step by step guide.


Introduction

FreeFileSync is a free Open Source software that helps you synchronize files and synchronize folders for Windows, Linux and Mac OS X. It is designed to save your time setting up and running backup jobs while having nice visual feedback along the way.

FreeFileSync latest vesrion is 6.2. For more information about this software, can visit its homepage

Download & Install FreeFileSync

Visit here to download the latest version of FreeFileSync

After download finished, run the downloaded exe file to start setup. You can choose normal installation or portable installation.

Feb 8, 2014 - 2 minute read - Comments - reading

Thoughts After Read "The Power Of Habit"

I have finished the book “The Power Of Habit” one week ago. This is an interesting, easy reading and transformative book. It uses plenty of examples to explain how habits been created, changed for individuals, organization and the whole society. The concept of habit loop is simple, it consists of a cue, a routine and a reward. No matter good or bad habits, they all been created following this loop with or without our awareness.

Feb 5, 2014 - 2 minute read - Comments - Octopress

Add "Related Posts" Section To Octopress

When reading someone’s article, it’s good to have a section to show the releated posts. Today I searched online and found to add Related Posts section to Octopress is quite easy. First, edit config file _config.yml to add line lsi: true Second, create file source/_includes/post/related_posts.html with content below {% raw %} {% if site.related_posts %} <h3>Related posts</h3> <ul class="posts"> {% for post in site.related_posts limit:3 %} <li class="related"> <a href="{{ root_url }}{{ post.

Feb 4, 2014 - 1 minute read - Comments - chromecast gadget

Google Released Chromecast SDK : Countless Apps Coming

After received my Chromecast for 10 days, I received good news from Google. Google finally opened chromecast SDK to all developers. This is what Chromecast users and developers waiting for long time. Developers now must be busy coding to integrate the SDK into their apps, so countless Chromecast-compatible apps would show-up any day now. Media player apps will be the first batch to support Chromecast, especially for local media streaming. I think this is the most desired feature for most of Chromecast users including me.