书籍推荐:Java SE8 for the Really Impatient

2016 Oct 13

推荐一本非常好的关于Java 8的书,Java SE 8 for the Really Impatient

亚马逊链接豆瓣链接

Java SE 8 for the Really Impatient

给变量和函数起个不啰嗦的名字

2016 Oct 13

写代码就像写作文,所以Joshua Bloch在Coder at Work的采访中推荐了一本写作书,The Elements of Style,和 一本词典,Merriam-Webster’s Collegiate Dictionary, 11th Edition。

强烈推荐“Long Names Are Long”这篇文章,可以帮助我们给函数或者变量命名时更加简洁。 下面是文章中给出的一些例子(例子的上下文见文章),

// Bad:
String nameString;
DockableModelessWindow dockableModelessWindow;

// Better:
String name;
DockableModelessWindow window;

// Bad:
List<DateTime> holidayDateList;
Map<Employee, Role> employeeRoleHashMap;

// Better:
List<DateTime> holidays;
Map<Employee, Role> employeeRoles;

// Bad:
mergeTableCells(List<TableCell> cells)
sortEventsUsingComparator(List<Event> events,
	Comparator<Event> comparator)

// Better:
merge(List<TableCell> cells)
sort(List<Event> events, Comparator<Event> comparator)

Hash Join

2016 Oct 13

Hash join是数据库实现join操作的一种算法。

  • First prepare a hash table of the smaller relation. The hash table entries consist of the join attribute and its row.
  • Once the hash table is built, scan the larger relation and find the relevant rows from the smaller relation by looking in the hash table.

3种基本的join实现算法:

Three fundamental algorithms for performing a join operation exist: nested loop join, sort-merge join and hash join.

Nested loop join就是两个简单粗暴的for loop。

AMQP 0-9-1 Model Explained

2016 Oct 13

非常非常好的一篇文章,可以帮助理解RabbitMQ或者AMQP。

Javascript Engine in Java

2016 Oct 13

A colleague recently asked me to extract some information/text from a json file in a Docker container. This Docker container has no things like Python or Perl included, and it’s dedicated to Java application only. Parsing json with grep/awk seems a bit intimidating. At last, I recalled that Java is shipped with a Javascript engine and after simply googling found the jjs. We used Javascript as the script language and jjs as the script interpreter to solve the problem.

Java SE 8 will instead ship with a new engine called Oracle Nashorn, which is based on JSR 292 and invokedynamic. It provides better compliance with the ECMA normalized JavaScript specification …

To do so, builds of Oracle’s JDK or OpenJDK include a command-line tool called jjs. It can be found in the bin/ folder of a JDK installation along with the well-known java, javac, or jar tools.

More details in this doc

Increase Number in Vim

2016 Oct 13

光标放在数字上,按Ctrl+A原数值加1;按Ctrl+X减1。

10Ctrl+A,在原数值上加10.

vim

Python开发环境简介

2016 Oct 13

简单介绍了什么是依赖、pip、virtualenv、requirements.txt……

Linux共享库简介

2016 Oct 12

之前写的关于Linux上的共享库(shared library)的一个简单介绍。

工具推荐:Apple Keyboard with Numeric Keypad

2016 Oct 12

一个程序员应该有一把自己的键盘! Apple Keyboard,键程短、不伤手👏,推荐!

apple keyboard

网站上线了

2016 Oct 12

搭建这个网站的目的是为了分享一些自己认为值得分享的博客文章、图书等杂七杂八东西。 网站的名字叫OneFeed,意思就是来我一个人的推送。

这是一个简单的Ruby on Rails应用程序,也是我第一个上线的Rails应用(真正意义上的第一个Rails应用因为有点复杂还没有写完🤔)。 整个网站的架构如下图所示,

网站架构