Monday, June 11, 2012

adb shell simulate touch screen click


Start button:
/dev/input/event8: 0003 0035 00000101
/dev/input/event8: 0003 0036 000000bc
/dev/input/event8: 0003 0030 00000028
/dev/input/event8: 0003 0032 00000006
/dev/input/event8: 0003 0039 00000000
/dev/input/event8: 0000 0002 00000000
/dev/input/event8: 0000 0000 00000000
Stop button:
/dev/input/event8: 0003 0035 00000104
/dev/input/event8: 0003 0036 000002af
/dev/input/event8: 0003 0030 00000028
/dev/input/event8: 0003 0032 00000006
/dev/input/event8: 0003 0039 00000000
/dev/input/event8: 0000 0002 00000000
/dev/input/event8: 0000 0000 00000000

click start button
./adb shell "sendevent /dev/input/event8 3 53 257;
           sendevent /dev/input/event8 3 54 188;
           sendevent /dev/input/event8 3 48 40;
           sendevent /dev/input/event8 3 50 6;
           sendevent /dev/input/event8 3 57 0;
           sendevent /dev/input/event8 0 2 0;
           sendevent /dev/input/event8 0 0 0;
           sendevent /dev/input/event8 1 330 1
   sendevent /dev/input/event8 0 0 0;
   sendevent /dev/input/event8 1 330 0;
   sendevent /dev/input/event8 0 0 0"
click stopbutton

./adb shell "sendevent /dev/input/event8 3 53 260;
           sendevent /dev/input/event8 3 54 687;
           sendevent /dev/input/event8 3 48 40;
           sendevent /dev/input/event8 3 50 6;
           sendevent /dev/input/event8 3 57 0;
           sendevent /dev/input/event8 0 2 0;
   sendevent /dev/input/event8 0 0 0;
   sendevent /dev/input/event8 1 330 1
   sendevent /dev/input/event8 0 0 0;
   sendevent /dev/input/event8 1 330 0;
   sendevent /dev/input/event8 0 0 0"


adb shell input keyevent

After entering adb shell environment, you can use "input keyevent" to simulate button clicks.

0 -->  "KEYCODE_UNKNOWN"
1 -->  "KEYCODE_MENU"
2 -->  "KEYCODE_SOFT_RIGHT"
3 -->  "KEYCODE_HOME"
4 -->  "KEYCODE_BACK"
5 -->  "KEYCODE_CALL"
6 -->  "KEYCODE_ENDCALL"
7 -->  "KEYCODE_0"
8 -->  "KEYCODE_1"
9 -->  "KEYCODE_2"
10 -->  "KEYCODE_3"
11 -->  "KEYCODE_4"
12 -->  "KEYCODE_5"
13 -->  "KEYCODE_6"
14 -->  "KEYCODE_7"
15 -->  "KEYCODE_8"
16 -->  "KEYCODE_9"
17 -->  "KEYCODE_STAR"
18 -->  "KEYCODE_POUND"
19 -->  "KEYCODE_DPAD_UP"
20 -->  "KEYCODE_DPAD_DOWN"
21 -->  "KEYCODE_DPAD_LEFT"
22 -->  "KEYCODE_DPAD_RIGHT"
23 -->  "KEYCODE_DPAD_CENTER"
24 -->  "KEYCODE_VOLUME_UP"
25 -->  "KEYCODE_VOLUME_DOWN"
26 -->  "KEYCODE_POWER"
27 -->  "KEYCODE_CAMERA"
28 -->  "KEYCODE_CLEAR"
29 -->  "KEYCODE_A"
30 -->  "KEYCODE_B"
31 -->  "KEYCODE_C"
32 -->  "KEYCODE_D"
33 -->  "KEYCODE_E"
34 -->  "KEYCODE_F"
35 -->  "KEYCODE_G"
36 -->  "KEYCODE_H"
37 -->  "KEYCODE_I"
38 -->  "KEYCODE_J"
39 -->  "KEYCODE_K"
40 -->  "KEYCODE_L"
41 -->  "KEYCODE_M"
42 -->  "KEYCODE_N"
43 -->  "KEYCODE_O"
44 -->  "KEYCODE_P"
45 -->  "KEYCODE_Q"
46 -->  "KEYCODE_R"
47 -->  "KEYCODE_S"
48 -->  "KEYCODE_T"
49 -->  "KEYCODE_U"
50 -->  "KEYCODE_V"
51 -->  "KEYCODE_W"
52 -->  "KEYCODE_X"
53 -->  "KEYCODE_Y"
54 -->  "KEYCODE_Z"
55 -->  "KEYCODE_COMMA"
56 -->  "KEYCODE_PERIOD"
57 -->  "KEYCODE_ALT_LEFT"
58 -->  "KEYCODE_ALT_RIGHT"
59 -->  "KEYCODE_SHIFT_LEFT"
60 -->  "KEYCODE_SHIFT_RIGHT"
61 -->  "KEYCODE_TAB"
62 -->  "KEYCODE_SPACE"
63 -->  "KEYCODE_SYM"
64 -->  "KEYCODE_EXPLORER"
65 -->  "KEYCODE_ENVELOPE"
66 -->  "KEYCODE_ENTER"
67 -->  "KEYCODE_DEL"
68 -->  "KEYCODE_GRAVE"
69 -->  "KEYCODE_MINUS"
70 -->  "KEYCODE_EQUALS"
71 -->  "KEYCODE_LEFT_BRACKET"
72 -->  "KEYCODE_RIGHT_BRACKET"
73 -->  "KEYCODE_BACKSLASH"
74 -->  "KEYCODE_SEMICOLON"
75 -->  "KEYCODE_APOSTROPHE"
76 -->  "KEYCODE_SLASH"
77 -->  "KEYCODE_AT"
78 -->  "KEYCODE_NUM"
79 -->  "KEYCODE_HEADSETHOOK"
80 -->  "KEYCODE_FOCUS"
81 -->  "KEYCODE_PLUS"
82 -->  "KEYCODE_MENU"
83 -->  "KEYCODE_NOTIFICATION"
84 -->  "KEYCODE_SEARCH"
85 -->  "TAG_LAST_KEYCODE"

Friday, June 8, 2012

adb shell quit app


You can use adb shell kill to kill the process, but first you need to find the process id. To do this you can use adb shell ps and parse the output. Here is a sample (assuming your development PC is Unix):
adb shell kill $(adb shell ps | grep YOUR.PACKAGE.NAME | awk '{ print $2 }')

Wednesday, June 6, 2012

Wednesday, May 30, 2012

Convert bytes array to string

String str = new String(byte[] byteArray);

Full explanation to build apk and install it on android device using command line

1. make sure JDK is installed instead of JRE, and JAVA_HOME variable is pointing to JDK installation path

2. make sure you have ant and android sdks installed, and there is android.bat inside android sdks

3. go to the android project directory

4. under this directory, use command: /path/to/android.bat/android.bat update project -p /path/to/project folder/       =======> this will create build.xml for building apk file

5. use this command: /path/to/ant directory/bin/ant debug      ========> this will generate debug version apk

6. now you have an apk file ready for installation, use this command first: adb devices to test if a device is connected

7. after making sure you have a valid device connected, use this command: adb -d install path/to/your/app.apk     ========> this will install the apk to your android device

8. after installing the app, we want to open the app, use this command: adb shell am start -n com.zhoubo/.AppName  note: com.zhoubo represents the app source   ==========> this will open the app named AppName from source com.zhoubo

Tuesday, May 29, 2012

How Java Uses Threads


Java applications and applets are naturally threaded. The runtime environment starts execution of the program with the main() method in one thread. Garbage collection takes place in another thread. Screen updating occurs in a third thread. There may be other threads running as well, mostly related to the behavior of the virtual machine. All of this happens invisibly to the programmer. Some of the time you're only concerned with what happens in the primary thread which includes the main() method of a program. If this is the case you may not need to worry about threading at all.

Sometimes, however, you need to add your own threads to an applet or application. The simplest reason for adding a separate thread is to perform a long calculation. For instance if you're trying to find the ten millionth prime number, you probably don't want to make users twiddle their thumbs while you search. Or you may be waiting for a resource that isn't available yet, a large graphic to download from the Internet, for example. Once again you shouldn't make the user wait while your program waits. Any operation that is going to take a noticeable period of time should be placed in its own thread.

The other reason to use threading is to more evenly divide the computer's power among different tasks. If you want to draw random rectangles on the display, you would still like the applet to respond to user input. If all the CPU time is spent drawing rectangles, there's nothing left over for the user. On a preemptively multitasking operating system like Solaris or Windows NT, the user may at least be able to kill the application. On a cooperatively multitasking operating system like MacOS 9 or Windows 9x, the user may have to reboot their machine. This is a bad thing. With threads you can set the priority of different processes, so that user input receives a high priority and drawing pretty pictures receives a low priority. Then the user can stop the applet without flipping the power switch on their machine.

From: http://www.cafeaulait.org/course/week11/04.html

Friday, May 25, 2012

Use ant to build android project

if the directory is different from where ant is in, use ./path to ant/ant [debug]



$ cd android-project-directory
$ android update project --path  This creates build.xml, default.properties, and local.properties for your project
Then, follow this link to use ant command to generate apk file



./android.bat update project -p SpeechRecV6/
/cygdrive/d/Android/apache-ant-1.8.4/bin/ant debug




Thursday, May 24, 2012

Use command line to install apk


adb -d install path/to/your/app.apk
in my case, I copied the apk file to the same folder as adb exists, and use: ./adb -d install -r SpeechRecV4.apk

tomorrow I will try to use command line to do the build and compile work

After entering: ./adb shell ==============> I entered shell environment, and I tested am start -a android.intent.action.MAIN -n com.android.settings/.Settings  and this worked and opened the setting page
Then I tried to open my own SpeechRecV4 app using am start -n com.zhoubo/.SpeechRecV4Activity this also worked

Tuesday, May 22, 2012

Java network byte order issue

Java uses a DataOutputStream which has a method writeShort() (and writeIntwriteLong, etc.) which automatically write in network byte order ( the high-order byte first, followed by the next highest-order byte and so on, with the low order byte sent last).


// Input and output streams for TCP socket
protected DataInputStream in;protected DataOutputStream out;

protected Socket connect (int port) throws IOException
{
// Connect method
output.appendText ("\nConnecting to " + server + " Port " + port + "\n");
Socket socket = 
new Socket (server, port);
OutputStream rawOut = socket.getOutputStream ();
InputStream rawIn = socket.getInputStream ();
BufferedOutputStream buffOut = new BufferedOutputStream (rawOut);
out = 
new DataOutputStream (buffOut);
in = 
new DataInputStream (rawIn);return socket;
// END connect

Sunday, May 20, 2012

价格管制不会解决短缺问题

这个论点是从《经济解释》里面看来的。说的是在被管制下的价格如果低于市价,需求方的边际价值高于价格,但是供应有限,就要付出金钱价格之外的代价来补充。这些补充的代价可能是排队,论资排辈,武力解决,政治手法,人际关系等等。只要知道了补充的代价,加上原本的金钱代价就会等于边际价值。

所以《经济解释》霸气的断言,“短缺”只是一些三流经济学家的思想短缺。

Saturday, March 31, 2012

利用networking找到梦想的工作

几天前在ES210W的课上,Lou做了主题是利用networking找工作的presentation。可以说这个presentation是二十多个里面对我触动最深也影响最大的一个。

先说说Lou这个人。前一次的演讲,他没有做任何准备,演讲前用了大概五分钟构思+在网上搜了一下数据,演讲时沉稳淡定,气度不凡,吐字清晰,声音有磁性,内容精彩感染了大多数人。后来我在LinkedIn看他的主页,发现他的经历远比我以为的丰富得多。他现在算是大四上,还有一个学期毕业。在大学期间,他在三个hedge fund有过三次实习经历,在三个投行有过三次实习经历,六次实习经历短则一个月,长则达一年。我看到这些的一刹那觉着我的生活和他相比简直就是幼稚园和博士后站的差距。
在那之后我与他有过一次几分钟的聊天,聊了聊美国和新加坡的生活,聊了聊以后的发展。令我惊讶的是他在新加坡也待过一段时间,因为当时他的女朋友的父亲是新加坡一家hedge fund的founder。我不知道是他因为这个背景才选择了这个女朋友还是碰巧是这样,不过我相信Lou这样有规划和雄心壮志的人应该是前者。

我对Lou当时的presentation记忆深刻还有一个原因。根据我的观察,Lou这个人虽然不属于沉默寡言,但绝对不是说废话的一个人,而且不会轻易帮助或者与以后不相关的人打交道。但是这次的presentation却很有内容,非常具有启发性。

以下是我总结的他演讲的内容,希望对以后能有帮助。

首先他给出了一些很吸引眼球的事实。70%的工作是通过networking找到的,应该时刻准备好在任何地点和任何人networking,networking与其说是技术不如说是艺术,因为那是你独有的方式。
然后他讲了networking具体的实施。Initial contact应该用邮件,发邮件的目的是去set up一个informational interview,寻求advice而不是一个job。确保这封邮件concise,甚至在一个黑莓的屏幕上也能读完。讲出你是谁,为什么发这封邮件,简单说一下你的背景,并且提前感谢。这封邮件从头到脚都应该保持formal并且谦逊。如果一个星期都还没回邮件,就打电话。电话是问他们是否收到你的邮件,然后电话内容和那封邮件的内容保持一致。
在成功set up informational interview以后,把它当做正式的Interview来对待。
先写下你希望谈到的topic,把问题变得更像聊天,好好研究一下公司的背景,谈话对象的背景,还有整个行业的大概情况。最好也要知道这个行业最近发生的大事。把所有问题都准备好以后,确保这些问题是open-ended,so that谈话对象可以谈谈自身的情况和achievements。比如以下的问题:
Did you do an internship before you held this job full time? Did it help prepare you?
Why did you choose this firm over any other firm?
What kind of changes are going on in X industry right now that my impact jobs in this field?
What advice would you give someone in my position?
Don't ask for a job interview - ask for advice!!
尽力展示出自己独有的personality。

Wednesday, March 28, 2012


发一篇旧文,是去年读《乌合之众》时做的摘抄。 这本书的伟大之处就在于从各个方面分析了人在群体中的表现为何和单独时的表现差异是如此巨大。
=================================================================
前段时间看《第三帝国的兴亡》,感叹希特勒演讲能力的牛逼之余,也发现如果用逻辑去分析他的那些煽动性演讲,其实有着很多了漏洞,希特勒本人的逻辑也是七上八下,很不系统。很疑惑究竟是什么力量让这些漏洞百出的演讲具有这么大的威力,于是去把旁勒的《乌合之众》找来看。算是意外收获,本以为这是一本讲经论道非常学术的心理学著作居然写得如此通俗易懂,也明白了把学术著作写的看不懂得都是装逼犯,真正牛逼的学者的作品是连傻逼如我的人都可以看得懂的!
既然看完了这么好的书,还是应该把自认为写得精彩的地方记录一下哈:
1. 只有环境的单一性,才能造成明显的性格单一性。一切精神结构都包含着各种性格的可能性,环境的突变就会使这种可能性变现出来。
2. 在集体心理中,个人的才智被削弱了,从而他们的个性也被削弱了。异质性被同质性所吞没,无意识的品质占了上风。
3.群体中累加在一起的只有愚蠢而不是天生的智慧。
4.形成群体的个人也会感觉到一种势不可挡的力量,这是他敢于发泄出来自本能的力量,约束着个人的责任感便彻底的消失了。
5.有意识人格的消失,无意识人格的得势,思想和感情因暗示和相互传染作用而转向一个共同的方向,以及立刻把暗示的观念跟转化为行动的倾向,是组成群体的个人所表现出来的主要特点。他不再是他自己,他变成了一个不受自己意识支配的玩偶。
6.群体在智力上总是低于孤立的个人,但是从感情及其激起的行动这个角度看,群体可以比个人表现的更好或者更差,这全看环境如何。一切取决于群体所接受的暗示具有什么性质。
7.群体是刺激因素的奴隶。
8.孤立的个人具有主宰自己的反应行为的能力,群体则缺乏这种能力
9.群体虽然有着各种狂乱的愿望,它们却不能持久。群体没有能力做任何长远的打算或思考。
10.群体不仅冲动而多变。就像野蛮人一样,它不准备承认,在自己的愿望和这种愿望的市县之间会出现任何障碍,它没有能力理解这种中间障碍,因为数量上的强大使它干到自己势不可挡。对于群体中的个人来说,不可能的概念消失了。
11.群体通常总是处在一种期待注意的状态中,因此很容易受人暗示。最初的提示,通过相互传染的过程,会很快进入群体中所有人的头脑,群体感情的一致倾向会立刻变成一个既成事实。
12.于是,群体永远漫游在无意识的领地,会随时听命于一切暗示,表现出对理性的影响无动于衷的生物所特有的激情,它们失去了一切批判能力,除了极端轻信外再无别的可能。
13.群体是用形象来思维的,而形象本身又会立刻引起与它毫无逻辑关系的一系列形象。
14.群体很少对主观和客观加以区分。它把头脑中产生的景象也当做现实。
15.群体中的某个人对真相的第一次歪曲,是传染性暗示过程的起点。
16.只能把史学著作当做纯粹想象的产物。他们是对观察有误的事实所做的无根据的记述,并且混杂着一些对思考结果的解释。
17.各种事实都证明,应当明智地认为群体的证词极不可靠,它甚至能够达到无以复加的程度。
18.群体表现出来的感情不管是好是坏,其突出的特点就是极为简单而夸张。
19.群体中的个人类似于原始人,因为他不能做出细致的区分,他把事情视为一个整体,看不到它们的中间过程。
20.在群体中间,傻瓜、低能儿和心怀妒忌的人,摆脱了自己卑微无能的感觉,会感觉到一种残忍、短暂但又巨大的力量。
21.群体因为夸大自己的感情,因此它只会被极端感情所打动。希望感动群体的演说家,必须出言不逊,信誓旦旦。夸大其词。言之凿凿、不断重复、绝对不以说理的方式证明任何事情。
22.群体只知道简单而极端的感情;提供给他们的各种意见、想法和信念,他们或者全盘接受,或者一概拒绝,将其视为绝对真理或绝对谬论。
23.掌握了影响群众想象力的艺术,也就掌握了统治他们的艺术。
24.偏执与妄想是宗教感情的必然伴侣。凡是自信掌握了现世或来世幸福秘密的人,难免都会有这样的表现。
25.群众不管需要别的什么,他们首先需要一个上帝。
26.在同理性永恒的冲突中,失败的从来就不是感情。
27.一切政治、神学或社会信条,要想在群众中扎根,都必须采取宗教的形式——能够把危险的讨论排除在外的形式。
28.凡是怀有这种感情的人,必然会用火与剑去清除那些反对建立新信仰的人。
29.各种制度是观念、感情和习俗的产物,而观念、感情和习俗并不会随着改写法典而被一并改写。
30.制度和政府都是种族的产物,它们并不是某个时代的创造者,而是由这个时代所创造。
31.决定着个民族命运的是它们的性格,而不是它们的政府。
32.深刻影响群体秉性的手段,不能到制度中去寻早。
33.教育既不会使人变得更道德,也不会使他更幸福。
34.掌握一些派不上用场的知识,是让人造反的不二法门。
35.词语的威力与它们所唤醒的形象有关,同时又独立于它们的真实含义。最不明确的词语,有时反而影响最大。
36.说理与论证战胜不了一些词语和套话。它们是和群体一起隆重上市的。
37.像“祖国”这样的词,对于雅典人或者斯巴达人来说,除了指雅典或斯巴达的城邦崇拜之外,还能有别的含义么?它当然不可能指由彼此征伐不断的敌对城邦组成的全希腊。在古代高卢,“祖国”这个词又能有什么含义?它是由相互敌视的部落和种族组成的,它们有着不同的语言和宗教,凯撒能够轻易征服它们,正是因为他总是能够从中找到自己的盟友。罗马人缔造了一个高卢人的国家,是因为他们使这个国家形成了政治和宗教上的统一。
38.政府和帝国的具体工作就是用新的名称把大多数过去的制度重新包装一遍,这就是说,用新名称代替那些能够让群众想起不利形象的名称,因为它们的新鲜能防止这种联想。
39.统治者的艺术,就像律师的艺术一样,首先在于驾驭辞藻的学问。
40.这种根据讲话的效果不断改变措辞的必要性,使一切有效的演讲完全不可能事先进行准备和研究。
41.一切文明的主要动力并不是理性,倒不如说,尽管存在着理性,文明的动力仍然是各种感情——如尊严、自我牺牲、宗教信仰、爱国主义以及对荣誉的爱、
42.他的意志是群体形成意见并取得一致的核心。他是各色人等形成组织的第一要素,他为他们组成派别铺平了道路。一群人就像温顺的羊群,没了头羊就会不知所措。
43.在群体的灵魂中占上风的,并不是对自由的要求,而是当奴才的欲望。
44.我相信拿破仑曾经说过,极为重要的修辞法只有一个,那就是重复。得到断言的事情,是通过不断重复才在头脑中生根,并且这种方式最终能使人把它当做得到证实的真理接受下来。
45.各种观念、感情、情绪和信念,在群众中都具有病菌一样强大的传染力。
46.支配大众的是榜样,不是论证。
47.每个时期都有少数个人同其他人作对并受到无意识的群众的模仿,但是这些有个性的人不能过于明目张胆地反对公认的观念。他们要是这样做的话,会使模仿他们变得过于困难,他们的影响也就无从谈起。
48.历史与模仿的双重作用,从长远看,会使同一个国家、同一个时代的一切十分相似,甚至那些好像坚决不受这种双重影响的个人,如哲学家、博学之士和文人,他们的思想和风格也散发着一种相思的气息,使他们所属的时代立刻就能被辨认出来。
49.伏尔泰在谈到基督教时也注意到,“在一百多年里,接受它的只有一些最恶劣的败类”。
50.群众会把陌路英雄视为自己的同类,为自己曾想一个已不复存在的群为低头哈腰而进行报复。
51.信徒们总是穷凶极恶地打碎他们以前神灵的塑像。
52.我们有重要而持久的信仰,它们能够数百年保持不变,整个文明也许就是以它为基础。
53.一切普遍信念不过是一种虚构,它唯一的生存条件就是它不能收到审查。
54.在不知不觉中支配着人们头脑的暴政,是唯一真正的暴政,因为你无法同它作战。
55.但一种文明让群众占了上风时,它便几乎没有多少机会再延续下去了。如果说还有什么事情能够推迟自身的毁灭的话,那就是极不稳定的群众意见,以及他们对一切普遍信仰的麻木不仁。
56.民族主要是受其种族的秉性支配,也就是说,是受着某些品质的遗传残余的支配,而所谓秉性,正是这些品质的总和。种族和我们日常只需的枷锁,是决定着我们命运的神秘主因。
57.领袖的影响力只在很小的程度上是因为他们提出的论据,而在很大程度上来自他们的名望。
58.领袖很少超前于民意,他所做的一切几乎总是在顺应民意,因此也会助长其中的所有错误。

把这些打完,等于自己又重新复习了一遍。假如有人认真看的话,是不是也能从这些语句里面找到中国历史的影子呢,尤其是近代史……

Tuesday, March 27, 2012

博客·序

受到刘未鹏《暗时间》的影响,决定重新开一个博客。这个博客将主要用于记录自己的想法,逻辑,技术相关,工作相关的内容。
就如刘未鹏所说的,每有想法出现时,先写下几个关键词来提示自己,等到有时间整理思绪再把其变成一篇博文,此种的益处大大,不必赘言。
至此,将不再重复以往在博客里宣泄感情的幼稚行为,希望能将这个博客坚持下去,至少每周一篇。

How to ask for a reference letter (by Great on the Job)


希望在离开vanderbilt之前能够收获一两封reference letter.

摘自 http://greatonthejob.com/2010/04/800/
In the 2009 film “Up in the Air,” Natalie Keener decides she can no longer stomach being part of a corporate firing squad and quits her firm. Her mentor, played by George Clooney, behaves as the magnanimous gent we all know him to be: he writes a glowing reference letter on her behalf, addressed simply “to whom it may concern.”
In the real world, getting a reference letter is far more difficult and often a source of much anxiety. Whom to ask, how to ask, what to say?
But getting an outstanding reference letter is entirely within your control and easier than you think, even if you don’t have a benevolent benefactor at your back…
Here are three tips to ensure your mentor, former boss, or academic counselor writes you a rave review:
1.Highlight their qualifications
2.Provide a template
3.Offer a “no questions asked” policy
Let’s look at each of these individually:
Highlight their Qualifications
When reaching out to ask for a letter of reference, explain up front and center why it is that you value that person’s opinion and respect their professional expertise enough so that you chose them (of all people) to vouch for you in your next professional endeavor.
Beyond mere flattery, show why you think that person is uniquely qualified to accurately assess and communicate your personal contribution to your future organization. Why did you enjoy working for them, and why do you value their opinion? Why do you look up to them? How do the qualities match your own, or speak to the authority you want your recommendation to convey?
Provide a Template
It’s almost impossible to get a good reference letter from someone if you don’t provide the tools necessary for them to actually write a good letter. It’s also terribly inconsiderate not to give ample guidance. The last thing anyone wants to do is spend hours or days thinking about and drafting a letter which you yourself could have composed far better and more readily in about half the time.
Providing a template, therefore — an outline, bullet points, or even a fully-baked draft — of what you’d like the reference letter to say is the most effective (not to mention generous and thoughtful) approach to asking for a letter of reference. The goal isn’t to put words into your former colleague’s mouth or to co-opt her into vouching for you in an untrue or disingenuous manner; it’s simply to do some of the work for her and provide all of the pertinent data points that you’d like included in the letter. Moreover, as boastful, bragging or full of yourself you may feel writing your own referral, often people will be even more generous than you will when talking about your skills and contribution to an organization. So go ahead and toot your own horn.
“No Questions Asked”
Finally, once you provide your reviewer with a useful template and make it clear that your intention is to make this process as painless as possible for her, then it’s time to hand over the reins and offer a “no questions asked” policy. First, give your colleague an easy “out” to decline your request for any or no reason. Then, assuming she agrees, give her ample leeway to change, modify or edit your letter as she sees fit. You want to convey a sense of trust in her and give her an opportunity to write a letter she is entirely comfortable with.
Let’s take a look at what this request might actually look like:
Highlight their Qualifications
Dear John,
Hello, I hope you are well. I am writing to ask a huge favor — I’m applying for a senior marketing position with Merck and I was hoping you’d consider writing a letter of recommendation on my behalf. I always appreciated your perspective and judgment while working together. You have so much credibility within the product development space that I thought you’d be a perfect person to act as a reference.
Provide a Template
I have included a list of bullet points along with a draft letter you might consider using as a template. I’d like to make the process as easy as possible on you and I know it’s hard to recall details about the many different projects we worked on together in 2007 and 2008.
“No Questions Asked”
If for any reason you don’t feel comfortable writing a letter on my behalf, I completely understand. If you are willing to do so, however, please feel free to take the attached sample letter and use it as a template however you see fit. I have tried to address my core strengths as a strategic thinker and team player and I have highlighted several marketing campaigns I’m particularly proud of. To the extent that you’d like to make any changes or modifications to the letter, please go ahead and do so. I trust that you’ll include only those topics you feel comfortable commenting upon.
Further, I would welcome the opportunity to see a copy of the letter, but I of course understand your position if you’d like to keep it confidential.
Finally, finish your request with all the grace and charm you can muster — thank the other person profusely for their time and help and offer to make yourself available for any further questions he may have.
Stay tuned for next week’s post on how to write that template and make your reference letter stand out from the pack.


Last week, I wrote a post on How to Ask for a Reference Letter which gave three steps for asking for (and getting!) a great letter of recommendation.   The second, and arguably most important step, is to provide a template for your reviewer of what you’d like included in the letter.

Recently, an elementary school teacher told me that her former principal had failed to respond to her request for a letter of recommendation.  I asked if she had included a template for her principal of what to say, to which she replied no, and then admitted sheepishly, “Honestly, I wouldn’t have any idea how to write the letter myself.”  At the risk of stating the obvious, if you can’t imagine writing the letter yourself, how do you think someone else is going to write it for you? 

When you are asking for a recommendation, take the time to create a template for the person writing the recommendation. This can be a draft of the letter itself or a simply a roadmap—a set of points that provides them with an outline, the context and content for their note.
A strong ready-made template hits upon three key points: your motive, your credentials and the impact you expect to have on your new organization. To be most effective, you need to answer three key questions:
  1. Why are you applying for the position or academic program? (Motive)
  2. How or why are you uniquely qualified for the position? (Credentials)
  3. What will you contribute to your new organization or program? (Impact)
Let’s see what this might look like in a particular case:
Alex Wallace was a human resources professional who worked in financial services for ten years.  Alex earned her MBA from a top tier school and most recently covered the multimedia team at Reuters.  After two years at Reuters, Alex decided to make a major career shift and jump from human resources to broadcast journalism.  Alex reached out to the head of HR at her former employer to ask for a letter of reference for her application to Columbia’s Graduate School of Broadcast Journalism. She included the following bullet points in her template to assist her former boss in writing in the letter:
Motive: Why Are You Applying?
  • Throughout my career, I’ve lived and worked abroad have always had a strong interest in business journalism and international affairs.   
  • My work at Reuters has inspired me to make a leap I’ve considered for a long time and which I believe will tie together many diverse aspects of my career.
Alex gave both a personal reason and a professional motive—her work in HR in the news industry ultimately inspired her to make a change.   Why are you applying for a new job or program? Are you hoping to learn a new skill, make an industry, firm or career switch, or are you, like Alex, following a life-long dream of doing something you’ve always wanted to do but were never sure how to?
Credentials: How Are You Uniquely Qualified?
  • I have a strong background in both finance and business issues, having spent ten years on Wall Street supporting finance professionals and two years at Reuters learning about the news industry
  • In my current role,  I am responsible for managing employee issues related to ethical standards of stories, quality of writing and knowledge of key figures and trends in the news industry
  • I am strong writer, a skilled presenter and a quick learner—I am able to discern the important and relevant pieces of information from large amounts of data and make decisions quickly and effectively
Alex highlighted both her relevant experience and her inherent skill-set.  Together, these combine to make her an excellent candidate for the program.   As you think about your own qualifications, consider coursework and academic programs, relevant work experience, extra-curricular or volunteer activities, or even your own natural talents or strengths that will be better utilized in your new endeavor.
Impact: What Will You Contribute?
  • I believe that the reporting and writing classes will give me the tools I need to become an outstanding broadcast journalist
  • With my quick grasp of the issues and my in-depth understanding of finance and news organizations,  I hope to bring a unique perspective to the program
Alex’s impact—her unique perspective—could even be more compelling if she talked about how her news coverage would be different or unique from what exists today.  Regarding your own contribution, what is your vision of how you will impact your new organization—do you have new ideas, better ideas, a different way of thinking about things or a richness of experience that will impact your new environment?
At the end of the day, your goal is to give your former boss or colleague a clear-cut outline of what to include in your reference letter.  By providing a thoughtful and well scripted template, you’ll greatly increase the chances of getting your reviewer to agree to write the letter of reference and make that letter of reference communicate and convey exactly what you want.