People often ask me why I have decided that I’d be writing the bulk of my new code in Go, which I started programming in November of 2011 while attending Hacker School. At that time, concurrency was a very hot topic in Hacker School, and we were all trying out different ways of writing…


Laura Parker on the newest entry in the e-death industry, a start-up called

“Developmental psychologists often talk about the importance of leaving a legacy—something tied to who we are that will outlive us. But this is usually something obvious, like…



Robert Doisneau, Rue Henry-Monnier, Distribution of tracts in Notre Dame de Lorette district, Paris, c. 1940
Thanks to m3zzaluna


Robert Doisneau, Rue Henry-Monnier, Distribution of tracts in Notre Dame de Lorette district, Paris, c. 1940

Thanks to m3zzaluna

[Repost] /dev/null

Technically /dev/null is defined as a null device. Anything written to it is lost forever. If you read the wiki description of /dev/null, you will get to know lots of jargons/metaphors written/referred by UNIX techies a lot. In this article, we will concentrate on the importance of /dev/null, why it is there, and how to use it.


When things written to it are lost forever, then why do we need it? This is a valid questions, but we need /dev/null/ to lose information. That’s correct, to explain let’s take an example:

Example 1:

Suppose, you want to list all files of directory /var/tmp/ having word “foo” in its content. To achieve the task, we will write something as:

]$ grep -l foo /var/tmp/*
  grep: /var/tmp/td.log: Permission denied

So we got two files having word “foo”; but we also an annoying error message which was part of STDERR. We were not interested in any error message, and we wanted to see only those files which I am permitted to read. So, how do I get rid of this error message? Luckily newer version of grep provides a silent option “-s”, using which we can get rid of this message. But what if I am working on a traditional system, having traditional grep? What if the system command is not having the silent option? The solution is given below:

Capturing STDOUT only

  1. Using newer grep:
       ]$ grep -ls foo /var/tmp/*
  2. Using traditional grep:
       ]$ grep -l foo /var/tmp/* 2>/dev/null
  3. In general using any system command :
       ]$ cmd 2>/dev/null

Most of you should have captured the importance of /dev/null by now. In simple words, by using “2>/dev/null”, we are asking the shell to redirect the STDERR to /dev/null. This is very useful when we execute system command through a program and expect to get only the STDOUT.

There may also be a case, when we are only interested to see the error message (STDERR), and are not at all interested in STDOUT. To get STDERR, and to discard the STDOUT we will redirect the STDERR to STDOUT and will redirect the STDOUT to /dev/null; as given below:

Capturing STDERR only

]$ cmd 2>&1 1>/dev/null

You may be thinking, that if I am redirecting STDERR to STDOUT which in-turn is redirected to /dev/null, so there should not be any output. But that is not the case, and you get the error messages.

Read More

Tags: unix command

Understanding callback

What’s callback?

In computer programming, a callback is a reference to a piece of executable code that is passed as an argument to other code. This allows a lower-level software layer to call a subroutine (or function) defined in a higher-level layer. (source:wikipedia)

My understanding:


Callback in android:

Example in C:

#include <stdio.h>
#include <stdlib.h>
/* The calling function takes a single callback as a parameter. */
void PrintTwoNumbers(int (*numberSource)(void)) {
    printf("%d and %d\n", numberSource(), numberSource());
/* A possible callback */
int overNineThousand() {
    return (rand() % 1000) + 9001;
/* Another possible callback. */
int meaningOfLife() {
    return 42;
/* Here we call PrintTwoNumbers() with three different callbacks. */
int main() {
    return 0;

android development notes

An Intent is an object that provides runtime binding between separate components (such as two activities). The Intent represents an app’s “intent to do something.” You can use intents for a wide variety of tasks, but most often they’re used to start another activity.

Eclipse shortcuts

Maximize or unmaximize the current tab: ctrl+M

Delete row: ctrl+D (command+D in Mac)

Go to the start/end of the row: cmd+ <- or ->

Show all the files in editor: ctrl+E (command+E in Mac)

Move between tabs:ctrl+f6 (command+[ or ] in Mac)

Correct indenation:ctrl+i

Import missing classes: ctrl+shift+O (Cmd+Shift+O on Mac).

Search: ctrl + H


Tags: shell study


凯撒·卡狄尼(Caesar Cardini)在1924年发明了凯撒沙拉。卡狄尼是个墨西哥蒂华纳(Tijuana)的意式餐馆老板兼主厨,他住在圣迭戈,但为了避开禁酒令(Prohibition)而在蒂华纳工作。关于沙拉发明的故事有许多种版本,最常见的说法是,在有次七月四日那天,餐厅耗尽了厨房内所有的东西,因此卡狄尼用他仅剩的食材,并以他的天赋异禀,制作出了凯撒沙拉。另一个说法是说,沙拉是为了一群好莱坞明星在周末派对后所制作出的。在现今的墨西哥蒂华纳,凯撒饭店(Hotel Caesar)已经不再经营餐馆,但重新装修的饭店旁边的酒吧与餐馆近来也按照传统开始提供凯撒沙拉。


Source: Wikipedia

Tags: food


— 村上春樹 《慢跑路程的極致》