Changes to this blog

2016-02-05

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.

以后非技术类文章会用中文来写,这个博客本不该这么无趣。原本写技术博客来帮助求职的想法太过愚蠢了,除了导致对编程的热情日渐流失,并没有给我留下什么。喜欢编程,这才是来CMU学CS的原因。

Read full article..


Fix VMware Shared Folder vmhgfs Module Compilation Error

2015-02-28

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 vmware-config-tools.pl 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

2015-01-16

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!

2015-01-11

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

2015-01-09

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.

Question

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..