Tuesday, November 27, 2007

Windows to serve? :-(

"Platform independent" indeed is a motto for professional developers, which means quality softwares should be able to move freely between platforms with great ease, not sorrow. And my recent experience proved it right, but in another field, the web service development.

I'm the author of several junky databases and on Monday this week I got a task to "transplant" them on a ThinkPad X31, which runs a windows XP, which is authentic home edition, and which guarantees to be, eh, slow.

After complaining for a couple of hours, I finally settled down to work and analyze the situation I was facing. (Those databases were wrote on a Linux platform, and running on Linux platform. They were never intended to have even a single relationship with Microsoft products!)

Any way, I got to do the task, and two days later now it's nearly finished. I think I should write some lines here, as memoir in case I met similar tasks!!

1. MySQL issue
Mysql databases on linux platform can be dumped out and used to rebuild an identical one on windows like following:
c:\mysql -uroot dbname < dbname.dump
dbname.dump is a dump file generated by mysqldump.
There seemed to be version incompatibility as the mysql on windows is 4.0.1 while on Linux it is 4.1. When dumping on windows, mysql complains unrecognized word like:
"ENGINE=MyISAM DEFAULT CHARSET=latin1;"
They appear after table creation SQL statements. I directly replaced them to "TYPE=MyISAM;" and it simply works.

2. File path in Perl
The header in all Perl CGI program has to be changed to:
#!c:\perl\bin\perl.exe
and absolute directories has to be dealt with care. In open file, DIRs can be specified safely with slash, while in system calls (I frequently call "move"!) backslash has to be used.
For DIRs with space in it (eg, "Program Files"), double quote mark is sometimes necessary. However note following are valid:
require 'C:\Program Files\Apache Software Foundation\Apache2.2\cgi-bin\easygo\code.pl';
my $dir = 'c:\program files\apache software foundation\apache2.2';
system "move script\\funky_stuff \"$dir\\htdocs\"";

3. File path in R
The program needs to call R in batch mode and do some file input/output. On windows, R accepts slash to indicate directories, but space need to be converted by backslash. So to indicate a file, write following in Perl:
$dirInR .= "c:/program\\ files/aaa/bbb/";

Monday, November 19, 2007

Turning to Python

I finally decided to turn to Python, although I've been Perl-lish for 3 years...

However, on my old FC4, Tkinter could not be used...
>>> import Tkinter
^*&**&%^%^&*(%$$$#=
ImportError: No module named Tkinter :-(

I went to Python community for help, but they said Tkinter is "built-in" facility. My Python is 2.4.1, is this an antiquate??
I checked my PC and confirmed that tcl/tk is installed and functional, I even looked the whole file system and found that there's no such file "Tkinter.py"

A friend of one of my friend told me Tkinter is a wrapper for tcl/tk, and tkinter package needs to be installed for use (which has name as "python-tk" on debian/Ubuntu).

I resorted to rpm.pbone.net and downloaded "tkinter-2.4.1-2.i386.rpm" and installed. Then import Tkinter works!

Friday, November 16, 2007

看牙

(好久不用中文写东西啦, 真是不行~得多加练习:)

跟永康口腔的张李华医生有个约定, 来给他们的诊所做下宣传 :) 张大夫现在是我的私人牙医啦!

事情是这样开始的: 我小的时候不老实好动, 结果把一颗门牙摔坏了, 问题一直遗留到最近都没有解决. 我现在25岁啦, 那颗坏牙实在很难看. 在家人的催促下我才决定去看医生. 经过很多比较权衡, 我最终选择到私人牙科诊所就诊, 而不是不像大多数人那样去到公立的大口腔专科医院. 可能是我这人比较懒, 打个电话搞定预约门诊正符合我胃口; 并且专科医院, 名气大的我这种懒人根本挂不上号, 名气稍次的挂号容易, 可是遇到的医生其用心关怀程度还不如出租汽车司机, 着实令我不敢就范!!

我在搜狐社区口腔版查了查, 看到了众多医生对专业知识的介绍, 真让我懂了不少 (其实还是没懂多少:), 就自我评判了一下, 认为我的情况做烤瓷牙还是比较合适的. 于是就选择去刚开张不久的永康口腔万达门诊部就诊. 这个私人诊所的负责人是马强医生, 他在搜狐社区里发布的客观冷静理智又充满见地的言论让我非常欣赏, 这也是促使我选择这家诊所的主要原因!

我立即预约了门诊, 在07年7月12日首次去了永康口腔万达门诊部, 接诊的是张李华医生, 那天马强医生也在诊所. 在仔细检查我的牙齿后, 他们一致认为很适合做烤瓷牙, 但是种植牙应该是最佳的选择. 由于我自己一直倾向于烤瓷牙, 对种植牙没什么了解且心存顾虑, 又不想在一颗牙齿上耗费那么多时间和钱财, 最后向医生表示选择做烤瓷牙. 于是张医生就把我的病齿拔除, 清理牙槽骨(这过程花了不少时间, 因为我的坏牙的情况比较糟糕, 残存的牙根已经发炎并长出肉芽. 张医生告诉我如果任其发展, 会变成病灶还产生肿瘤什么的, 吓死我啦!). 旁边的两颗牙齿也被磨小并装上了临时牙 (好像叫卫生桥). 装烤瓷牙需要磨损旁边的健康牙齿, 这是烤瓷牙被广为垢病的主要理由. 可是我坏牙旁边的牙齿也有缺损, 形态不美观, 使用烤瓷桥能同时修复这些坏处, 使它们恢复形态. 所以我一直觉得做烤瓷牙对我还是非常合适的. 我在张医生的建议下选择金铂合金做支持物, 三颗牙总费用为五千(手术费等全算在内). 若是种植牙加2贴瓷面修复, 费用怎么也得在两万左右吧!

第一次手术之后需要三个月时间来恢复牙龈, 之后就要做检查, 咬牙模, 准备做烤瓷牙. 做好的烤瓷牙试戴后发现牙中线有些斜, 需要仔细看才能发现, 当时张医生把诊所里所有的护士都叫过来观察了并确认是斜的. 我自己已经相当满意了, 可是张医生仍要求把这个存在瑕疵的牙退回工场返工. 第二次试戴就没有任何问题了, 我更是完全满意. 但是张医生仍觉得不完美, 因为坏牙那个地方的牙槽骨缺损过多, 导致牙龈不齐, 修复后的牙难以回复到理想程度.

这段时间内张医生还帮我补了四颗蛀牙, 以及洗牙, 喷沙, 抛光等等. 在补牙时张医生建议我对一颗缺损较大的牙齿做金属嵌体, 但是我为了一次就完事还是坚持补牙. 这导致张医生花了较长时间才完全补好这颗牙, 并确认它以后不会存在塞牙等问题. 现在所有补过的牙用起来没有任何不舒适感, 但想想当时还是应该听从张医生的建议. 我有一颗给我找过麻烦的智齿, 张医生叮嘱我一定要在出国前把它拔除. 总之我非常庆幸我的牙齿问题在这个私人诊所里得到妥善解决, 并且有一位非常用心负责的牙科医生为我服务.

希望我的介绍能对各位牙齿有疾患的朋友有参考价值. 牙齿有问题千万不要忍着! 去找医生看病当然会难受, 但是留着它不管, 以后会给你带来百倍的病痛.

(also posted on sohu club: http://club.health.sohu.com/healthmain.php?c=19&b=teeth&t=0)