Monthly Archives: September 2014

I have been thinking about how to make data visualization more fun, although this blog has absolutely nothing to do with data, it is still a very fun experiment with d3. Basically the idea comes from a super simple and ugly wall decoration at GYPSY:

101.pic

and then I suddenly want to do something fun with it, which leads to the following: here is the live version.

rainbowrain

As you can probably tell, the colorful circles will drop to the bottom and get absorbed by those black holes until all the black holes are filled by the colorful ones.

Thanks for reading.

A lot of people ask me about what I use to write my resume, here is a copy, it is obviously LaTeX. The confusion they have is that my resume looks like some popular latex templates combined. Indeed, I did some customization of two popular templates, and added some other stuff, eventually turned it into what my resume looks like now.

Today I am using Jinja environment to turn my static LaTeX resume into a template which will later read a JSON file to fill in the content. I call it XNemo, you can download it here, and apply to your own resume. It requires no knowledge of coding, but a bit of JSON.

Now, I will go into some of the details how I designed this, and how you can use it for your own resume.

After you download the code, you should see the following file structure, pretty simple.

Screen Shot 2014-09-26 at 4.36.35 AM

At a high level, how it works is also easy to understand: you run a python script, it will read the content of data.json to templates/template.tex file, and generate the LaTeX source file resume.tex and the final resume.pdf file. What you need to do is simple, just type the following two commands.

Screen Shot 2014-09-26 at 4.00.33 AMNote: Make sure you have Flask installed, otherwise you will get errors.

Now I will explain some of the details.

First, I defined my own template block syntax in generate_pdf.py as the following:

Screen Shot 2014-09-26 at 4.04.02 AM

Basically, when I set block_start_string to ‘((*’, and block_end_string to ‘*))’, that means your for loop in the LaTeX template will look like: ((* for <condition> *)) ((* endfor *)), setting variable_start_string will make your variable value retrieval looks like <(( value ))>. From line 57 to line 60, I customized some template tags that later will be used in the template.

Now let’s take a look at data.json file. My resume contains multiple different colors, and timeline, and this block of info simply defines them:Screen Shot 2014-09-26 at 4.16.54 AM

When you set “usecolor” to true, the timeline color and the theme color will be applied to your resume, false will make your resume look pure black and white. Since my resume has timeline, “start_year” will be the earliest year that will appear in your resume, and the default hidden “end_year” is just next year. “theme_color” defines all the other colors besides the timeline colors (including the quote).

For the rest in the data.json file, it defines your skills, working experience, projects, education, and interests, the most common things you will most likely be interested in having them in your resume, and how it works is very self explained.

If you want to add more content to you resume, you can look through data.json and templates/template.tex, and modify them into what fits you, which might require a bit of knowledge of LaTeX and JSON, but it is still not too hard.

If you have any questions, you can always send me a request or comment on this blog. I will respond as soon as possible.

Thanks for reading.

金庸的小说精彩的太多, 其中我最喜欢的一部,要数倚天屠龙记,当然肤浅的我也仅仅看过港版吴启华演的电视剧版本。之所以喜欢这部,必然和黎姿惟妙惟肖的演出不无关系。

金庸的小说虽然被打上武侠的烙印,但是在我看来篇幅最大的应该是情。论倚天屠龙, 剧中出现4名女子,蛛儿刁蛮任性,却一直挂念的张无忌,小昭温顺体贴,聪明机智,周芷若,秀若芝兰,淡雅脱俗,赵敏,机智多谋,精明能干,直率豪爽。

周芷若从小孤苦,在峨眉也受尽了同门师姐妹的欺辱,在师傅峨眉临终前,曾发下永世不能和张无忌在一起的毒誓,并承诺将峨眉发扬光大。后来盗取倚天屠龙,并杀害蛛儿。周芷若和张无忌也算最早认识,对张无忌的感情又怜悯又倾慕,两人曾有婚约,在即将拜堂成亲之刻,天下众人之前,被张无忌无情的抛弃。

为何周芷若会变坏,不仅仅是因为张无忌的辜负,她曾说偷倚天屠龙是为了对师父的承诺,要将峨眉发扬光大,作为那时候的周芷若,的确没有说谎,但应该有更多的原因。其一,周芷若在剧中也是饱经磨难的人,被同门师姐妹的欺辱是她心中的仇恨滋生,想要等待回到峨眉的一天,不想要被别人冤枉背叛师门,而得到倚天屠龙则是她重回峨眉的唯一途径。其二,想要和张无忌平起平坐,让当初抛弃她的张无忌后悔。为何偷了倚天屠龙,还要杀珠儿,之后继续隐藏真相,在我看来则是想要隐瞒造成一错再错不能回头。

不可否认周芷若对张无忌的情之深切,她所受的委屈大于常人,在我看来整部剧中周芷若的性格特点被塑造的最为鲜明, 不像张无忌从头到尾的仁义道德,也不像全冠清彻头彻尾的卑鄙小人。相反周芷若亦正亦邪, 正的令人怜惜,邪的令人发指,其中的过程却是动人的。苦难可以给人正能量,也可以起到反作用。

性格本身就不是一个简单的词能形容的, 也不是一千一万的复杂的词结合在一起能形容的。性格为环境时势所驱使。我不是一个坏人,也可以做一件坏事。有时可以回头,有时一步走错,满盘皆输。

愿周芷若这一生能够不再坎坷,来世能和张无忌再续前缘。

As you work in a team, collaboration becomes essential. At this early stage, I am leading a small team to build our platform. Although I am the one who writes the most code, I realized how important to start doing code review. I know a lot of companies use Review Board as their code review tool, and some other tools for task management, etc. Back to the time I worked at Minted, Review Board did not impress me; therefore, I started looking for something better, and I quickly found out Phabricator.

Phabricator is a collection of open source web application that help software companies build better software, it does not only do one thing, it can do many things, it is a suite of applications including task mangement, code review, etc. It is also free with self hosting.

I started looking at this, and decide to host Phabircator on a EC2 Ubuntu instance for experiments. Before I decide to do so, I had the chance to ask the CTO at Phabricator that how soon their hosting service will become live, and he replied with “At least a few months”, I could not wait.

Just like all the other people who are also using Phabricator, I got super addictive to it. I spent hours playing around with it, trying different configurations and exploring different features. The following is an image of my Phabricator home page, which is also customizable for everyone.Screen Shot 2014-09-24 at 6.24.30 PM

One of the feature that I found that is extremely amazing is that their Arcanist tool provide a command “arc lint” to analyze the source code and raise warnings and errors about it, like a syntax checker that makes sure you are writing clean code. If you are not, it will raise errors and warnings; for example, the following is what happens for a Python code.Screen Shot 2014-09-24 at 6.34.33 PMFor more about Phabricator, you can find out on their official website. All you need to believe is that Phabricator is cool.

In terms of the price, at KuKy World, my hosting strategy is that we reserved a t2.micro  heavy utilization instance for 3 years with total $109, and hourly rate at $0.002, and a general SSD EBS volume with 1GB data. You can do the math, it is not expensive.

Thanks for reading.

Recently I read a paper about exploring the use of memory colors for image enhancement. Memory colors have been defined as “those colors that are recalled in association with familiar objects”. Several early psychophysical studies support that the majority of people associate and ideal color with an array of everyday objects (skin, grass, sky, plant, sand, and etc).

An interesting fact is that when people use Photoshop to polish their photos, they inadvertently apply a lot of memory colors. Think about some of the modern famous photo apps like Instagram, which also applies memory color to enhance the photos, it has proven that memory color make people more pleasing than the original color.

There are also situations where the association with memory color is less appropriate; for example, the images that convey a certain mood, memory color can make the mood disappear.

The basic idea of using memory color to enhance an image is to shift the original color in some region of that image towards the memory color.

The following is a little experiment I did in Matlab to see how variation goes within an image.

For the common object that people might see every day: grass, brick, sky.

brick  grass  sky

I obtained the following graphs:

brick_rgbgrass_rgb  sky_rgb

The following is the Matlab code that does the trick:

function [ ] = generate_3d_plot( img_str )
  img = imread(img_str);
  [height, width, dim] = size(img);

  s = height*width;
  R = double(reshape(img(:,:,1), 1, s));
  G = double(reshape(img(:,:,2), 1, s));
  B = double(reshape(img(:,:,3), 1, s));
  figure;
  scatter3(R,G,B,30,[R' G' B']./255,'filled','Marker','o');
  xlabel('RED');ylabel('GREEN');zlabel('BLUE');
  title('RGB values');
end

Thanks for reading.