March 15, 2006
使用QEMU调试FreeBSD/Linux内核
http://www.cublog.cn/u/10543/?u=http://www.cublog.cn/u/10543/article.php?frmid=20324
Also see the QEmu Documentation, Section 3.10 GDB Usage.
Another tutorial on general debugging techniques.
Posted by Roy at 11:46 AM | Comments (0)
March 14, 2006
Parking in DC
For parking information and some other fun stuffs coming soon, check out http://www.nationalcherryblossomfestival.org.
Summary:
Hains Point: free parking.
Center City Parking: $10/Day after 10am, $20 before.
Union Station: $10 - 16.
Posted by Roy at 10:20 PM | Comments (0)
Differences between OCaml and Standard ML/NJ
http://www.cs.berkeley.edu/~necula/autded/project/project.html
· Many small syntactic differences. Hard to say if for better or worse. What is worse however is the very poor parser that will basically tell you that there is a syntax error with no other help to figure out why.
· Mutable records. Very convenient.
· Objects and classes (although the project is not setup to use them)
· Nice assert statement that reports the position in the program of an assertion failure
· Significant differences in the standard library.
· A debugger with backstep capability (works on Unix/Linux only and is integrated with Emacs). You can easily do without this.
· Good integration with C
· Good profiler
· Faster compilation and reasonably fast compiled code
· Not quite as powerful of a compilation manager
· Very portable in its bytecode incarnation. A few platforms (e.g, x86) have native compilers as well. but don't be afraid of using the bytecode. It is only 2-3 times slower than the native code version.
Also see the Comp.Lang.ML FAQ, http://user.it.uu.se/~jenso/programming/sml_vs_ml.txt, and http://www.ps.uni-sb.de/~rossberg/SMLvsOcaml.html for syntactic differences.
Posted by Roy at 11:51 AM | Comments (0)
March 09, 2006
加拿大DC使馆签证纪行
昨天去加拿大使馆顺利拿到了签证,为了以后查询方便,特记录如下:
1. 签证tips
基本材料和要求和主页上的说明一致。但是好像接受cash。有的国家需要双份copy的申请表,China不幸为其中之一,甚至in some cases,材料的处理要等上一个礼拜。
周三11点就关门,有人11:10过来就不让进了。一个family只需填一份表(family仅含spouse及dependent children,不含parents)。
加拿大的临时访问签证(TRV)是非常容易的,只要写上一个粗略的访问计划,带上足够的资金证明就可以了。我写的是tourism,没有写去开会,也没写要访问谁,轻松搞定,等了1个多小时,因为我们到的比较晚。
要求两张6个月内的照片,AAA members可以在AAA的local branch照相,8块左右。
2. 进出DC tips
weekdays的traffic真不是人能忍受得了的。我们6点出发,满以为8点就能到预计的停车场了。最主要的因素是我比较了常走的路线和google生成的另一条路线后选了个冒险的路线。这条路线我早就想走了,这次以为它从395直接进DC然后到达我们的目的地所以比较方便。没想到一开始走的就不顺利:我们按照google的路线在250上没走多久后就拐上22,是一条单lane弯来弯去的小路,根本就开不快。沿着22一直开会开上231然后拐上15。google估计是按照最短距离生成的,其实应该不上250,沿着64走到与15的交界处直接上15。在爽爽的15上没走多久,就拐上20然后沿着3号路开上I-95高速。20和3有一条路也走不快,忘了是哪一条了,总之走得很郁闷。
好容易盼到了95,以为是高速了,谁知道进城的人爆多无比,平均时速在10mi/h。进城有条HOV,巨快,但9点以前必须有3个人以上才能开,我们只好在龟速公路上慢慢开。估计下95走local会更快,但地形不熟也就不敢轻举妄动,乖乖的follow打印的driving directions。95开到70出口左右大概就没有路了,分成了395和495。395很短,只是连到DC市内。495是环绕着DC的一条环形高速。395到了DC基本上就不算高速了,到处都是出口,我们被搞得晕晕乎乎的。
总而言之,去DC其实还是应该走29,66。66到了DC就结束了,但可以沿着50进DC,很容易。回来的时候要注意上66的口,容易错过。
最后要说的是,真没想到回来的时候也有爆多的人。当时从fairfax到gainsville的那一段我图省事没上66,直接走了29,谁知道又是堵得像乌龟一样,下次吸取教训,有高速一定要走高速。
如果没有很好的心理准备,weekdays去DC最好还是开车到metro的station, 停在那里坐metrorail。周末在那里的parking是free的,weekdays不是,而且交parking fee还得买一张见鬼的卡,那张卡成本就得5块钱:( 坐monorail可以买一天的通票很划算,但在上班高峰期是不可以用的。
3. parking tips
事先做了些研究,但在网上只查到union station可以停,其他的停车场在网上都找不到。union station是一个很大的车站,有上千个停车位,还有一些shopping的场所。其实停车不用担心,仔细转转能找到不少停车场,费用大概都在14-18一天。只停1小时会便宜,但便宜得很少,半天到一天比较划算。
细心的找的话也能找到metered parking,15分钟一个quarter,缺点是只能停2小时,偏远地区也有可以停4小时的。
我们很幸运的找到了停车位,顺利地在11点前submit了签证申请,并在2小时内赶回了停车处:)
周末在DC大部分street parking是free的。
附上在95抓拍的酷牌照一张:

1上面一行是“VIRGINIA”,下面一行好像是“US Congress”。
Posted by Roy at 10:05 PM | Comments (0)
March 07, 2006
关于小费
发信人: nvnv (nvnv), 信区: Overseas
标 题: 做过waiter,说说小费吧。
发信站: BBS 未名空间站 (Tue Mar 7 10:45:13 2006)
经常见看到中国人讨论给小费的帖子。大概现在的留学生都是拿着奖学金不用出去打工的
那种,那么做过waiter的我,就来说说我眼中的“小费”。
我先后打过两个餐馆,一个老美餐馆,一个中餐馆,那家老美餐馆是每小时$2.5的底薪,
小费要上缴一半;中餐馆是每天$20的底薪(9am---11pm)小费上缴15%。可以看出,小费
就是打餐馆工的几乎全部收入。这是美东南最大的城市,餐馆不计其数,很少有餐馆付
waiter高底薪的,我知道有一家,因为那家餐馆做地道的中国菜,食客基本是中国人,中
国客人小费都很少,有的甚至不付,所以老板不得不给起台的高底薪。
我以前在那家美国餐馆,起台的除了我都是印尼人。平时我们聊天,他们都对中国很感兴
趣,很羡慕中国发展的快。做为中国人的我,当然很自豪了。可是一见中国客人来,他们
谁都不愿意去招待,嘴上叨念“Chinese, cheap.”我起初不以为然,可是后来被自己同
胞坑了几次之后,真的心也挺凉的。吃50多刀,就扭扭捏捏地签5刀,还觉得亏了似的。
嗨!
后来在家中餐馆打半工,最怕的就是三类人,老黑,老墨和老中。老黑就是刁蛮,爱找事
,小费不好;老墨有个特点,你对他客气,他就觉得你看得起他,他小费就会好;老中吧
,不管你对他再客气,反正他签小费的时候就是不爽快,抠抠恰恰,吃27.8,总数就签30
,吃32,最好就给4块。你说说,怎么就不能扔5块钱呢?!差一块,对你来说不算什么,
但是对waiter来说,心里的感觉就非常不一样啊!
说说美国白人,相比老黑,他们很少有找事的,基本上点菜也很快,吃得也很安静,即使
waiter有点纰漏,道了歉,他们都会很客气;有的白人带孩子来吃饭,每次上菜端盘子什
说说美国白人,相比老黑,他们很少有找事的,基本上点菜也很快,吃得也很安静,即使
waiter有点纰漏,道了歉,他们都会很客气;有的白人带孩子来吃饭,每次上菜端盘子什
么的,父母都会教孩子说“谢谢”给waiter,你说服务这样的家庭,钱不说,多开心呢!
吃二十块左右,五六块的小费是很正常的事情。很少有扣着15%或者20%。
不是说做waiter的就认钱,决不是。你试试,你到哪家餐馆,即使waiter挺怕你是中国人
的,他表面也会对你像对任何人一样恭敬,一点不会怠慢你。可是如果这回你的小费好,
下次他就会对你越客气,不好,则反之。其实说白了“你的小费就是告诉waiter你想要什
么样的服务”。别怪waiter,你做waiter,你也一样。
自己做过waiter之后,再去有服务性质的地方我都是个big tipper。上次门口理发店sale
,我花$6.95剪了头发,签了$4小费,总共才不到十一块钱,经理开心得说只要觉得不好
随时来修;几个月后我再去剪头发,经理扔记得我,很热情地招呼,多好啊!自己去餐馆
也不再计较小费多签两三块钱,自己也开心,也轻松。
其实做餐馆(其他的服务业也是)很辛苦很辛苦,服务员不招呼你的时候,一定在招呼其
他客人,或者就是厨房有活儿,老板给每个人安排的工作量就是不能让一个人有一刻空闲
;至于饭菜不合口,那根本不是waiter做的啊;或许你进餐馆之前就不太开心,但也不能
把帐算在waiter身上啊。
嗨,最后说一句,客人走了之后,waiter拿着条儿看客人签卡的时候,那真的是能看清一
个人的一些东西。别看有些人吃饭的时候和朋友谈笑风生好像很nice的样子!
--
※ 来源:·BBS 未名空间站 http://mitbbs.com·[FROM: 24.98.]
Posted by Roy at 12:15 PM | Comments (0)
March 03, 2006
GCC 4.1 takes security into account
There are a lot cool things going on.
The infrastructure of GCC4 seems to be overhauled to accomodate more aggressive optimizations.
Besides optimization improvements, there are other significant security improvements:
GCC can now emit code for protecting applications from stack-smashing attacks. The protection is realized by buffer overflow detection and reordering of stack variables to avoid pointer corruption.
Some built-in functions have been fortified to protect them against various buffer overflow (and format string) vulnerabilities. Compared to the mudflap bounds checking feature, the safe builtins have far smaller overhead. This means that programs built using safe builtins should not experience any measurable slowdown.
See the files under the directory gcc/doc for more details.
Also see the GCC Wiki pages.
In summary the security improvements come in three parts:
1. An instrumentor that protects every potentially bad pointer access: mudflap
2. An implementation that only protects the stack: propolice
3. To improve performance some safe builtin operations can be used.
Posted by Roy at 07:43 PM | Comments (0)
HOW-TO: Tune Settings In sysctl.conf
http://www.webhostingtalk.com/archive/thread/257654-1.html
After you make the changes to the file, you can make them effective immediately by typing in /sbin/sysctl -p. You can also set them by echoing the values as root into their paths in /proc/sys.
Also, you will need to issue sysctl -w net.ipv4.route.flush=1 to flush the routing table to make some of these changes happen instantly.
Newer version: http://forum.ev1servers.net/showthread.php?s=&threadid=48880
Posted by Roy at 06:53 PM | Comments (0)
看病时常用到的英文
http://www.edu-page.com/Digest/bbsdispdst.php?id=9
He feels headache, nausea and vomiting. (他觉得头痛、恶心和想吐。)
He is under the weather. (他不舒服,生病了。)
He began to feel unusually tired. (他感到反常的疲倦。)
He feels light-headed. (他觉得头晕。)
She has been shut-in for a few days. (她生病在家几天了。)
Her head is pounding. (她头痛。)
His symptoms include loss of appetite, weight loss, excessive fatigue, fever and chills. (他的症状包括没有食欲、体重减轻、非常疲倦、发烧和发冷。)
He feels exhausted or fatigued most of the time. (他大部份时间都觉得非常疲倦。)
He has been lacking in energy for some time. (他感到虚弱有段时间了。)
He feels drowsy, dizzy and nauseated. (他觉得昏昏欲睡,头晕目眩和想吐。)
He feels as though everything around him is spinning. (他感到周围的东西都在打转。)
He has noticed some loss of hearing. (他发觉听力差些。)
She has some pains and itching around her eyes. (她眼睛四周又痛又痒。)
(2) 伤风感冒:
He has been coughing up rusty or greenish-yellow phlegm. (他咳嗽带有绿黄色的痰。)
His eyes feel itchy and he has been sneezing. (他眼睛发痒,而且一直在打喷嚏。)
He has a fever, aching muscles and hacking cough. (他有发烧,筋骨酸痛和常常咳嗽。) (hacking = constant)
He coughed with sputum and feeling of malaise. (他咳嗽有浓痰,而且觉得很虚弱。) (malaise = debility)
He gets a cold with a deep hacking cough. (他伤风咳嗽。)
He has a headache, aching bones and joints. (他头痛,骨头、关节也痛。)
He has a persistent cough. (他不停地在咳。) 或
He has bouts of uncontrollable coughing. (他一阵阵的咳嗽,难以控制。)
He has hoarse and has lost his voice sometimes. (他声音嘶哑,有时失声。)
He has a sore throat and a stuffy nose. (他嗓子疼痛而且鼻子不通。)
His breathing is harsh and wheezy. (他呼吸时,有气喘似的呼哧呼哧作响。)
He has a stabbing pain that comes on suddenly in one or both temples. (有时突然间太阳穴刺痛。)
He has a runny nose, sneezing or a scratchy throat. (他流鼻水,打喷嚏和喉咙沙哑。)
(3) 女性疾病:
She has noticed one lump in her breast. (她发觉乳房有个肿块。)
There is a hard, swollen lump on her right breast. (她右乳房有肿块。)
Her left breast is painful and swollen. (她左乳房疼痛且肿大。)
She has heavy bleeding with her periods. (她月经来的很多。)
Her vaginal discharge is white or greenish-yellow and unpleasant smelling. (她阴道分泌物带白色或绿黄色,而且气味不好。)
She has noticed occasional spotting of blood between periods. (在月经来的前后,她有时也发觉有滴滴达达的流血。)
She has some bleeding after intercourse. (性交后有出血。)
She feels some vaginal itching. (她感到阴部发痒。)
She has painful periods and abnormal vaginal discharge. (她月经来时疼痛,而且阴道有不正常的分泌物。)
(4) 手脚毛病:
His both hands and feet ache all over. (他两手两脚都很酸痛。)
He has pain on the sole of his feet. (他脚底很痛。)
There is a wart-like lump on the sole of right foot. (我右脚底有个像肉疣般的硬块。)
His ankles look puffy and they pit when he presses them with his finger. (他的足踝好象肿了,用手按,就有小坑痕。) (pit = small dent form)
(句里的 they 和 them 都是指 ankles)
The pain in his left foot is accompanied by redness and swelling. (左脚酸痛,并有红肿。)
The joints near his fingernails and knuckles look swollen. (指头和指节旁边的关节,似乎有肿大。)
He has numbness and tingling in his hands and fingers. (他的手和指头感到麻木和刺痛。)
His legs become painful following strenuous exercise. (激烈动后,他的腿就痛。)
His knee is misshapen or unable to move. (他的膝盖有点畸形,也不能动。)
There are some swellings in his armpit. (他的腋窝肿大。)
He is troubled with painful muscles and joints. (他的筋骨和关节都痛。)
She is troubled by the pains in the back and shoulders. (她的后背和肩膀都痛。)
His knee has been bothering him for some time. (他的膝盖不舒服,已有一段时间了。)
(5) 睡眠不好:
He is sleeping poorly.(他睡不好)
He has difficulty in sleeping, inability to concentrate.(他不易入睡,也难集中精神。)
It is usually hard for her to fall asleep when she goes to bed at night.(她晚上就寝,很难入睡。)
He wakes during the night or early morning and finds it difficult to fall asleep again.(他晚间或清早醒来后,再也不能入睡。)
He has nightmares occasionally.(他有时做噩梦。)
(6) 男性疾病:
He urinates more frequently than usual.(他小便比平时多。)
He has difficulty controlling his bladder.(他很难控制小便。)(bladder 是膀胱)
There are some lumps on his testicles. (他的睪丸有些硬块。)
He has had burning or pain when he urinates.(他小便时感到发烫和疼痛。)
He is passing less urine than usual.(他小便比平时少。)
He has had painless swelling in his scrotum.(他的阴囊有不痛的肿大。)
He feels lack of interest in sex.(他自觉对性的兴趣大减。)
He has difficulty starting his urine flow.(他小便不畅通。)
His urine stream is very weak and slow.(他小便流动得很慢很弱。)
He dribbles a little urine after he has finished urinating.(他小便后,还会有少量零星地滴下。)
He has had some discharge from his penis.(他的阴茎排出一些流脓。)
His urine is cloudy and it smells strong.(他的小便混浊,而且气味不好。)
He has a dull heavy ache in the crotch.(他的胯部感到隐痛。)
He has a small leakage of urine when he coughs or sneezes.(他咳嗽或打喷嚏时,会有点泄尿。)
He has trouble urinating.(他小便有困难。)
(7) 呼吸方面:
His breathing has become increasingly difficult.(他呼吸越来越困难。)
He has to breathe through his mouth.(他要用口呼吸。)
He is short of breath, even when he has not been exercising, he is breathless.(他喘气;即使不?#092;\动,他也是上气不接下气。)
His cough is more like wheezing.(他的咳嗽有呼哧呼哧的响声。)
His cough is dry, producing no phlegm.(他是干咳,没有痰。)
He has coughed up blood.(他咳嗽有血。)
His nose stuffed up when he had a cold.(他感冒时鼻子就不通。)
He coughs up a lot of phlegm (thick spit) on most days.(他多半时间咳出浓浓的痰。)
He has a feeling of tightness in the chest or a feeling that he is suffocating.(他胸部觉得闷闷的,好象透不过气来。)
(8)口腔毛病:
He has pain in his teeth or jaw. (他的牙齿和下巴疼痛。)
He has some problems with his teeth. (他牙齿有问题。)
The tooth hurts only when he bites down on it. (他咬东西时,牙齿就痛。)
His gums are red and swollen. (他的牙床红肿。)
His tongue is red and sore all over. (他的舌头到处红和痛。)
His breath smells bad and he has a foul taste in his mouth. (他口里有怪味。)
His gums do bleed. (他牙床有出血。)
He has some sore swellings on his gum or jaw. (他的牙床和下巴肿痛。)
He has sore places on or around the lip. (他的嘴唇和周围都很痛。)
There are cracks at the corners of his mouth. (他的嘴巴角落破了。)
There are some discolored areas inside on his tongue. (他舌头里边有些地方颜色怪怪的。)
(9) 肠胃毛病:
He has a bloated, uncomfortable feeling after meal. (他饭后肚子觉得胀胀的,很不舒服。) 或
He feels bloated after eating.
He has bouts of abdominal pain. (他有一阵阵的肚痛。)
He feels bloated in his abdominal area. (他感到肚子胀胀的。)
(注:胀胀的,像「puff up」,但不是真正的肿「swell up」。)
The pain is mainly in the lower (upper) right part of the abdomen. (痛是在肚子下半部。)
He has nausea and vomiting. (他有恶心和呕吐。)
It is difficult or painful for him to swallow. (他吞下食物时会痛。)
He has passed more gas than usual. (他放…比平常多。)
He has been constipated for a few days. (他便秘了好几天。)
He suffers pains when he moves his bowels. (他大便时很痛。)
He has some bleeding from his rectum. (他的肛门出血。)
He has noticed some blood in his bowel movements. (他发觉大便时有些血。)
His bowel movements are pale, greasy and foul smelling. (他大便呈灰白色,含油脂的恶臭。) 或
His bowel movements are grey (or black) in color. (他的大便呈灰白色。)
He has trouble with diarrhea. (他拉肚子。)
(10) 血压等等:
His blood pressure is really up. (他的血压很高。)
High blood pressure is creeping up on him.
He has noticed frequent urination, increased thirst and unexpected tireness. (他发觉常常小便,非常口渴和更加疲倦。)
It is a chest pain that gets worse when he bends over or lies down. (他弯腰或躺下时,胸部更痛。)
He has noticed excessive sweating and unexplained tireness. (他体会到过度的出汗和难以解释的疲倦。)
He has a sharp pain in one area of his spine. (他的脊椎某部位刺痛。)
He has pain in other joints including hip, knee and ankle. (其它关节疼痛包括臀部、膝盖和脚踝。)
His eyes seem to be bulging. (他的眼睛觉得有点肿胀。)
He has double vision. (他的视线有双重影子。)
He feels there is a film over his eyes. (他觉得眼里有种薄膜似的东西,挡住视线。)
His vision in the right eye blurred. (他右眼视线模糊不清。)
He has had some earaches lately. (他近来耳朵有点痛。)
He has a repeated buzzing or other noises in his ears. (他耳朵常有嗡嗡的声音。)
Posted by Roy at 02:10 PM | Comments (0)
March 01, 2006
The compile error "invalid option `tune=pentium4'"
Note that this error doesn't necessarily relate to perl.
http://www.issociate.de/board/goto/601229/Compile_fails_***_The_httpd_binary_was_not_found.html
Ken Gillett wrote:
> [root [at] neXus mod_perl]# make
> cd "src/modules/perl" && make
> make[1]: Entering directory `/usr/src/mod_perl-2.0.0-RC3/src/modules/perl'
> gcc -I/usr/src/mod_perl-2.0.0-RC3/src/modules/perl
[...]
> -D_SVID_SOURCE -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -fPIC \
> -c mod_perl.c && mv mod_perl.o mod_perl.lo
> cc1: invalid option `tune=pentium4'
that means that your perl wasn't built with the same gcc that you've on
your machine. It's your perl that suggests modperl to use -mtune=pentium
as you can see:
> config_args='-des -Doptimize=-O2 -g -pipe -m32 -march=i386
> -mtune=pentium4 -Dversion=5.8.5 -Dmyh
rebuild perl using the compiler you have on *your* machine and then return
on the modperl build process and you will be fine.
Posted by Roy at 12:58 AM | Comments (0)