There are two good articles on the web that discuss this issue, but none of them is perfect for me. So I tried to add my stuff here.
The first is about installing sqlplus: http://www.danilovizzarro.it/2008/07/how-to-install-sqlplus-and-the-oracle-client-v102-on-a-mac-os-x-leopard-1054/
The second is about installing DBD::Oracle: http://blacka.com/david/2008/11/12/how-to-install-dbdoracle-on-mac-os-x/
To install sqlplus, you need download instantclient form oracle site, the following (64-bit) packages:
To install DBD::Oracle, you need one more package:
Once you download and unzip them, all the files will go to a directory called instantclient_10_2. Move this folder to something like /opt/oracle
$ sudo mv instantclient_10_2 /opt/oracle
You should set unix environment variable like the following:
DYLD_LIBRARY_PATH="/opt/oracle/instantclient_10_2"
export DYLD_LIBRARY_PATH
TNS_ADMIN="/opt/oracle/tns"
export TNS_ADMIN
ORACLE_HOME="/opt/oracle/instantclient_10_2"
export ORACLE_HOME
To connect to the an Oracle via sqlplus you can run the following command:
# sqlplus DB_USER/DB_PASS@//DB_HOST:DB_PORT/DB_SID
To install DBD::Oracle, you will need to download perl DBD package from CPAN, I chose version 1.32.
After you download the package, unzip it to ~/Download/DBD-Oracle-1.32, make sure you have set ORACLE_HOME and DYLD_LIBRARY_PATH correctly.
You need to set some soft link in $ORACLE_HOME (This is the key step most readme files failed to mention.)
$ cd /opt/oracle/instantclient_10_2/
$ sudo ln -s /opt/oracle/instantclient_10_2/ lib
$ sudo ln -s libclntsh.dylib.10.1 libclntsh.dylib
$ ls -l
lrwxr-xr-x 1 root admin 31 Oct 19 16:36 lib -> /opt/oracle/instantclient_10_2/
lrwxr-xr-x 1 root admin 20 Oct 19 16:32 libclntsh.dylib -> libclntsh.dylib.10.1
Now you can compile the DBD::Oracle Package now:
$ cd ~/Download/DBD-Oracle-1.32
$ perl Makefile.PL
$ make
$ sudo make install
In perl script you connect to oracle server using the following code:
#! /usr/bin/perl -w
use warnings;
use strict;
use Data::Dumper;
use DBI;
my $sid = "host=host.xyz.com;sid=DBSID;port=1521"
my $dbh = DBI->connect("dbi:Oracle:$sid", $user, $pass) or die "ERROR: failed to connect db: $@\n";
And you are likely see the following error:
dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.16.dylib
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
You need to set the following in your .profile or .bash_profile
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
see also http://lightyearsoftware.com/2011/02/mysql-5-5-on-mac-os-x/
]]>Exit either Sand Hill Rd or Woodside Rd from I-280, the park is only about 5 minutes away, with a relatively small sign at the entrance of the park.
I went there at around 7:00AM in the morning. The weather was fabulous and there were not many cars in the parking lot. The park is actually a very popular destination, you can hardly find a parking if you get there after 8:30AM :-)
Overall, the hike is fairly easy. I started from the parking lot and walk to the south corner. Alambique Trail starts to the left and Bear Gluch Trail begins to the right. Bear right to the Bear Gluch Trail. 
The trail was fully covered by shades. After ascending 0.7 mile, I past Redwood Flat. There are lots of redwood trees on both side of the trail.
After another 0.8 mile, I suddenly noticed the sky became much brighter. That was “the Meadows.”
The Meadow Trail is on the left while Bear Gluch Trail continues to the right heading to the Alambique Creek. After about 0.5 mile, I got to the Alambique Flat, a quite shady spot where one can hear the creek trickling by.
Then I turned onto the Alambique Trail and the rest of the journey became easy descending path.
It took me less than 2 hours before I got back to the parking lot. I really enjoyed the sunshine coming through the shady redwood trees!
]]>$ sort -n -k 1 -k 2 src.tsv > des.tsv (sort by number value)
$ sort -k 1 -k 2 src.tsv > des.tsv (sort by text value)
vim: change file format: dos/unix/mac
$ vim +"argdo set ff=" +wqa <files>
$ vim +"argdo set ff=unix" +wqa <files>
$ vim +"argdo set ff=dos" +wqa <files>
$ vim +"argdo set ff=mac" +wqa <files>
vi/vim remove ^M
:%s/^V^M//g
ls absolute path
$ls -d $PWD/*
1.有较高水平的高密度脂蛋白
全球每年约有35.6万名男性死于心脏疾病。心血管病专家指出,如果血液中有充足的HDL(高密度脂蛋白),基本上就不用担心了。
要增加体内的HDL水平,需要至少每周4次、每次20分钟的中等强度锻炼。正常人血液中的HDL是40毫克/分升左右,最好能达到该数字的两倍。
2.有两个亲密的哥们儿
这两个哥们儿不包括目前的同事、邻居、健身教练等,总之不能为任何固定出现在生活中的人。
心理学家认为,如果一个35岁以上的男人符合这一标准,表明他拥有健康的社会联系,他会比2/3的男人更长寿。
3.对以下两个问题回答“是”
“每天早晨,你期待着去工作吗?”
“每天下午,你期待着回家吗?”
经过长达30年的实践研究发现,持肯定答案的人死于心脏疾病的风险非常低。
4.前列腺特异性抗原值低于2.5纳克/毫升
前列腺癌专家指出,这个指标表明他患前列腺癌的危险性比较低。
5.能在28分钟内步行3公里
能否在相当长的一段时间里保持轻快、有力的步伐,是衡量身体健康的一个好方法。
根据瑞典研究者的结论,一个健康的40岁男人,应该能在28分钟之内走完3公里,相当于正常步幅每分钟走134步。
6.平衡的肌肉力量
大多数男人热衷于让肌肉做过度的外推运动,例如俯卧撑,而真正具有平衡力量的男人则比较少。
理想状况是他的肱二头肌和肱三头肌的力量比率应为1∶1,也就是说,如果他能够拉开25公斤的拉力器10次,也就应该能推开25公斤的推力器10次;他的股四头肌和腘绳肌的力量比率应是3∶2,也就是说,若他能够负重30公斤抬腿10次,就可以用腿压下20公斤重物恰好10次。
7.比例匀称的头颅
在临床上,面部宽度是长度的60%为最佳,具有这样标准的男人不但容貌俊美,而且对呼吸道、下颌及牙齿方面的疾病也有很好的免疫力。
8.能快速爬坡
让他在跑步机上行走,逐步增加跑步机的倾斜度,直到再也迈不动步子。大部分30~40岁的男人能够坚持9分钟,若能达到12分钟就很了不起了。如果能达到15分钟,那意味着极佳的心血管健康状况。如果心脏曾经有过问题,做这个试验前一定要征得医生的同意。
9.将线穿入针孔,一次成功
这意味着他有非常好的感知力和立体敏锐性。如果穿不上针或者打球时总接不到球,应该考虑看看眼科医生。另外,每年的眼科检查中也需要特别做一下青光眼的检验。
10.左右完美对称
拿软尺量一量他的手腕、耳朵以及鼻孔的周长。如果这些地方左右对称或相差在1毫米内,说明身体很匀称、很均衡,这样的男人跑得最快,做剧烈运动时的自我控制力也好。任民
]]>