Dependent Origination

Archive for August 2012

the_hundred_days

这本书我是因为爸爸病情恶化 改票匆匆赶回北京的路上第一次看的 最近又看了一遍 因为第一次虽然理论上把每一页都读过了 但是一点都没往心里或者脑子里去 后来好几次拿起又放下了 很怕相关的回忆又回来 这次终于又看了一遍 觉得不是特别好看 只能是average Patrick O’Brian的说 看完的主要动力是我想完成Aubrey and Maturin的全集 当然average Patrick O’Brian is probably better than best of 90% books out there so don’t think it is bad — it is your expectations will be raised fairly high after a couple Patrick O’Brian’s.

I still miss Dad. 偶尔还会做梦梦见他 他总是很eager to please me, as usual 每次醒来 都很伤心 也很茫然 因为he won’t be in my real life any more 唯一欣慰的是 他每次出现 精神和气色都不错 穿着这件或者那件我很熟悉的衣服 看起来就是pre-cancer的样子 所以虽然伤心 我想他应该顺利的投胎到人道了 他一向愿意牺牲自己成全别人 看来积累了一些福报 只是不知道他投到了哪个人家 家道是否殷实 父母是否善良厚道 不知道他新的人生能不能少受点苦 能不能让他按照自己的意愿活一次 哪怕就几年 所以我的心里难免有些担心 怕他性子不改 还是瞎乐观 随便扔掉自己的所有 去赌一个未知 希望他新的生命里面至少能够赌到些东西吧 不要输太惨 如果遇到困境 希望有贵人去帮帮他 然后 运气好一点 过的开心多一点 想起来的时候 回来看看 梦中也有一个世界

没什么意思 最前面稍微有点意思 其他的太套路了 介绍一下人物 复述一下他的有名剧本大概是讲什么的 给个评语 我已经看不了这样的东西了

what i am really trying to do here is i want the output from mongodb all printed on a single line so that i can use mongoimport later to read them back.

<code>

var cursor = db.web.find({“created”:{$gt:timestamp}});
while (cursor.hasNext()) {
var str = tojson(cursor.next());
str = str.replace(/(\t|\r\n|\n|\r)/gm, “”);
str = str.replace(/\s+/, ” “);
print(str);
}

</code>

g — replace more than once

m — replace multiple lines

i don’t know why i keep getting ‘Syntax Error: missing ; at the end of statement’ for my single-line test javascript scripts i am planning to develop into a cron job to run regularly against mongodb.

it was puzzling, to say the least. i ended up deleting stuff, making the line shorter and shorter to a state it works with no grammar complaints, then added back the stuff i wanted. and it works in the end, with the same line, which was being complained about a few minutes ago.

still a mystery on what is going on.

reason why we need phpsh?

1. it is awesome 🙂

2. when we were using ubuntu 10, you can do php -a and it is a decent interactive shell for vanilla php. and i run into problems making phpsh recognizing our own database so i just get by php -a for a while. but now that we upgraded to xfce, it turns out there is licensing issues with read-line, so xfce (and some other distributions) comes with php without read-line support, which means php -a is now practically useless.

3. phpsh can work with your own codebase, which makes testing, prototyping orders of magnitude easier.

so here we go, installing phpsh.

the vanilla one (phpsh) works out quite easy. the trouble is always at (phpsh your_code_base_include_file_list). when you try to access your own php classes, functions etc, it is always class not found. why?

in fact, i don’t understand why. the way phpsh works, it is a python script that invokes a php script, and establishes pipes to the php processes. when you invoke the php script, it calls ‘php file options etc’ directly, which in turn should be reading the /etc/php5/cli/php.ini file, where you can change include_path so it would find your classes.

but it doesn’t work — for some reason, the installation on the network drive doesn’t seem to read in the php.ini on my drive at all. a really local installation in fact can read it.

anyway, how to make it work? lots of options.

1. you can change inside the phpsh.py script, the comm_base parameter, when invoking php, instead of ‘php’, put in ‘php -c /etc/php5/cli/php.ini’ –> this works, i tested. however, not sure if it works with the xdebug enabled version of phpsh.

2. alternatively, you can change the phpsh.php script, do ini_set(‘include_path’, ‘path_to_your_codebase’) and it works, i tested.

the benefits of these approaches are you can put in multiple include paths, in case the php code you want to play with scatters around. but these requires changes every time you update phpsh (if you do that at all).

3. the easiest approach doesn’t require you to do anything — just invoke phpsh include_file_list from the directory you would have put in include_path. –> for most cases, this should just work.

that is a fun few hours to figure out what is going on with phpsh 🙂

art_of_fielding

I like the first half, which is like five stars. It feels like the author loses his grip on the characters and plots in the second half of the book. For one thing, the architect showed up and ate dinner and were just gone, without any other splashes. For another thing, the great namesake of the fictional bible for a shortstop in the book showed up and ate dinner with the team and were just gone too, when I totally expected he would be cruicial in helping Henry to regain his confidence.

The build up to the climax is exceptional — fully developed characters (with very familiar cliche’s, sometimes) which draws you in. However, the climax is nowhere to be found. Don’t get me wrong — I love the premise of the book: self-doubt and its eradication. Who never has any doubts about themselves? Who never think of the question whether they are right or not? Or how did they do what they do? I was expecting quite some soul-searching, introspection on the way to confidence again but the book didn’t deliver on the solution, thought it describes the problem very well.

I think the author has potential. The book is full of literary references. Having not read Moby Dick, or the books or poems they were citing, I am sure I missed lots of the references. Had it had a better second half, I might go back to read the book once I finish reading all the classics 🙂

that is because it is the gnu ctags, not exuberant ctags.

user@hostname:~/source_directory$ ctags –version

ctags (GNU Emacs 23.4)
Copyright (C) 2012 Free Software Foundation, Inc.
This program is distributed under the terms in ETAGS.README

now do sudo apt-get install exuberant-ctags

you should see this:

user@hostname:~/source_directory$ ctags –version
Exuberant Ctags 5.9~svn20110310, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Apr 14 2012, 13:09:28
Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
Optional compiled features: +wildcards, +regex

now run ctags -R *


August 2012
M T W T F S S
« Jul   Sep »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Twitter

  • Style Transfer is fun! TensorFlow rocks! #WTM17 https://t.co/zYP0IFIDfp 3 weeks ago
  • couldn't get over the jetlag, sleeping during the day from seven to four, for days. 2 months ago
  • is emptying trash and happily discovering the available disk space now ranks at 100G+. 3 months ago
  • is looking at other people's intentions, not their capabilities, and feeling much happier every day :) 1 year ago
  • is planning on how to spend the next two weeks until the new year, at home. 1 year ago

Flickr Photos

IMG_3517

IMG_3515

IMG_3505

IMG_3497

IMG_3261

IMG_3260

IMG_3255

IMG_2736

IMG_2733

IMG_2629

More Photos