Thomas Lockney (@tlockney) once said: “I love the serendipitous discoveries that often occur via a series of links from some random twitter post.” I recently had such a discovery myself.
Escape Analysis in Java
Object allocation is very cheap in modern java virtual machine. According to Brian Goetz, new Object() is approximately 10 machine instructions now. With escape analysis, which was introduced into HotSpot JVM in Mustang, it’s possible to eliminate some object allocations or allocate them on the stack. So even faster. This microbenchmark is going to measure that.
ARC Is Cool
I got to know Adaptive Replacement Cache, ARC for short, from Solaris (now Illumos) ZFS. Recently I had a chance to implement and use ARC myself. It is cool.
Java Fluent Interfaces, Revisited
Fluent interface is probably one of the most known design patterns in Java world. It is subtle to get right, though. Even part of it, method chaining, can be easily done wrong.
Storm, Storm!
Storm, a open source project from twitter, is a
distributed, reliable, and fault-tolerant stream processing system.
Whatever that means, I decide to find out myself.
Setup Ganglia on OS X
I finally get Ganglia up and running on my Mac. It isn’t as smooth as I may have expected. Here are steps that work for me.
This post gave a quite good overview of the architecture of Ganglia. It has three main components: gmond, gmetad and web front-end. Gmond sits on every node one wants to monitor and gathers metrics. Gmetad, one the other hand, is responsible of collecting data from gmond’s or other gmetad’s and persisting those data into RRD. This distributed architecture, especially the fact that gmond’s and gmetad’s can been set up in a hierarchy way (gmond -> gmond, gmond -> gmetad, gmetad -> gmetad and any combination of them), is said to make Ganglia be able to scale out. One thing is not clear though. Above post claims that Ganglia relies on data push, not polling. But Ganglia document reads:
gmetad - is a daemon that polls gmonds periodically and stores their metrics into a storage engine like RRD.
HTML5将变革Web开发
(译按:这篇文章翻译自Galios公司博客上的一篇文章,Rapid, Consistent Web Development is Coming with HTML5,转载请注明原著和译作出处。)
HTML5就在眼前,它远远不止是下一个版本的HTML。
开始的时候HTML只是一门小小的标记语言,用来链接网络上的一些文档,并告诉我们如何显示这些文档。随着一个个新版本的到来,新增了对各种新格式的支持,比如图像、视频和交互式内容。最近,人们对于在更深层次上理解文档和万维网的兴趣越来越浓厚。这方面最显著的一个例子就是语义万维网,它寻求将万维网从“文档的网络”变化为“信息的网络”。
之前所有版本的HTML语言都让这一任务异常具有挑战性,其难度可同仅从印刷格式来理解一篇哲学著作相媲美。
HTML5将改变这一切。HTML5的设计者们极端注重将语义内容(一篇文档打算要传达或阐述的信息)和展示处理(一篇文献如何在浏览器中显示)分开。由于这种分离,HTML5有能力给我们如何看待万维网,我们如何使用万维网,我们如何创建万维网上的内容带来革命性的变化。我们的兴趣点是HTML5的潜力,它改变我们定义,设计,创建和分析用户界面的潜力,不论这种用户界面在何处展现:万维网,移动设备,还是桌面。
Solve Problem by Generalizing It
Key takeaway: paradoxically but commonly, a more general problem is often easier to solve!
Chris Okasaki’s ICFP 2000 paper, Breadth-first numbering: lessons from a small exercise in algorithm design, is a good read. It shows how to use ADTs to design algorithms. He demonstrated that the key steps to design a breadth-first numbering algorithm are:
Generalize the problem from breadth-first traversal of a tree to breadth-first traversal of a forest. The more general problem turns out to be easier to solve.
Write down the specification (equation) of algorithm first, with the help of ADTs. Then translate spec to the real function. In functional programming language, such translation is rather straightforward.
Chris used Standard ML in his paper. Here’s Haskell and Erlang implementations. Not accustoming to Haskell yet, my Haskell implementation is quite ugly. But I wrote Haskell one first. When writing Erlang equivalent I found myself missing algebraic data type very much.
Below are source code.
Re-setup Octopress and Deply to Github
I’ve used Octopress for a while and I deploy my blog to Github pages. Very happy with it. For some reason, I need to set up my blog repository from scratch, again. Of course, my precious blog posts must remain intact. But Octopress document only talks about setting up new Github repository, remember? Thank God the solution is so simple:
1 2 3 | |
That’s it!
手把手教你架设自己的免费OpenVPN服务
(原文在Shearing FireSheep with the Cloud,经作者同意翻译成中文。文中的“我”均指原作者。)
无线网络早已大行其道。如果你曾经把你的笔记本连接到一些公共的Wi-Fi热点,象hhonors、attwifi或者panera,那你来对地方了,这篇博客就是写给你看的。这篇手把手的教程会教你如何在亚马逊云里部署一个VPN,你可以在任何地方使用它,而花费不过区区一个月3块钱。一旦设置好了,你可以放心地使用任何Wi-Fi热点,让那些试图用FireSheep窃取你密码的人吃灰去吧。
谈到FireSheep,实际上我的一些朋友(包括我老婆)早就问过我如何防止这类攻击。已经有一些不错的现成解决方案,比方说HTTPS Everywhere和BlackSheep,但作为一个安全“砖家”,我想要给他们建议一个能防止更广泛攻击的方案。