Changes to this blog


From now on, all non-technical articles might not be wrote in English. For technical ones, they’ll always be wrote in English. I know it’s been a while that this blog is not updated. Today I decided to continue writing my life and experience down on this site. The original incentive for building this blog is job hunting, but soon I found this made writing boring. The blog should have more funny stuff.


Read full article..

Fix VMware Shared Folder vmhgfs Module Compilation Error


Today my ubuntu 14 updated its kernel to 3.16 then VMware shared folder disappeared in /mnt/hgfs. I tried to recompile vmhgfs modules with and reinstall vmware-tools, but both failed with error messages:

from /tmp/modconfig-qqjwHn/vmhgfs-only/inode.c:29:
/tmp/modconfig-qqjwHn/vmhgfs-only/inode.c: In function ‘HgfsPermission’:
include/linux/kernel.h:793:27: error: ‘struct dentry’ has no member named ‘d_alias’

This bug has already been reported to VMware. Before VMware release official patch, we can manually fix this problem.

Read full article..

Why Bare Git Repository


For homework in 18-645(How to write fast code), I’m required to set up a bare git repository with command

$ git init --bare fastcode

Noticing the flag “–bare”, I wonder why we need this flag. After some searching, now it’s clear to me.

What a git repository contains

A normal git repository is a directory that contains

  • Project directories and files (so called “working tree” or “working directory” ).
  • A single directory called .git containing all of git’s administrative and control files.

As image below shows, we work on codes in working directory then “git add” changed files to staging area. Finally, we “git commit” to local repositoy.

Read full article..

New Semester!


Today is the first day of new semester. And unluckily only one course is successfully registered so far. Courses of CS department are too popular.

Hope everything will be all right in new semester.

Read full article..

Cracking the Coding Interview: Q 16.5 Run Threads In Sequence


With the help of C++11 multi-threading library, this question about running threads in sequence can be easily implemented. Both implementations below is public on GitHub.


Suppose we have the following code:

public class Foo {
    public Foo() { ... }
    public void first() { ... }
    public void second() { ... }
    public void third() { ... }

The same instance of Foo will be passed to three different threads. Thread A will call first, thread B will call second, and thread C will call third. Design a mechanism to ensure that first is called before second and second is called before third.

Read full article..