Monday, December 14, 2009

useful TCL command


a, wait [args]
delays until a spawned process (or the current process if none is named) terminates.

sample:
spawn telnet 172.18.9.38
expect "login"
send "admin\r"
expect "assword:"
send "1\r"
#expect "accept):"
#send "a"
expect "#"
close
wait
sleep 1

Saturday, December 12, 2009

Vi tutorial

a, how to show line number in vim?
:set number <==> :set nonumber

b, how to open 2 windows:
:split xxx.txt or :vsplit yyy.txt
u can control the size of the new window: :3 split xxx.txt
ctrl-w to switch the active window.

c, where am I?
ctrl-g

d, search the string three?
/three
how to highlight the result?
:set hlsearch
:nohlsearch

Friday, October 30, 2009

How to test proxy's limitation?

1, config
D:/bug config/avalanche/top3_projectxxx
2900/Top3_project/proxy_limit_test

Load: SteadyState/100CPS*100
ActionList:
loop jloop START TIME=3000000
1 get http://172.16.24.254/index.html
think <1000>
loop jloop STOP
Profile: 20Connection/srv; 50000Request/con

Sunday, October 25, 2009

Process of Sponsor Parents.
1, Feb 1, 2007 submitted the sponsor application
2, Oct 23, 2009 got the approve letter from the cic.
"We are pleased to advise that you have met the requirement for eligibility as a sponsor. The undertaking has been forwarded to the Visa Office in BEIJING for further processing...."
https://services3.cic.gc.ca/ecas/?app=ecas&lang=en

3, Should receive an Immigrant Application for PR within 4 weeks. (Waiting) if not recieve, call CIC call center or download from www.cic.gc.ca.
4, in case the immigrant application got refused:
“If you are approved as a sponsor and the person(s) you are sponsoring has her or his application refused, you will be notified and given the reason for the refusal and information about appeal rights. You may be able to appeal the decision to the Immigration Appeal Division of the Immigration and Refugee Board.”

5, all the document need to prepare is in the following website (12 items):
http://www.cic.gc.ca/english/information/applications/famcls.asp
-a,application for PR, imm0008Generic
imm0008 schedule 1,
additional family IMM5406
details of education (在北京的specification中)
-b, 出生公证,结婚公证,户口本复印件,18个月有效的passport出生信息页的copy.
-c, children
-d, non-accompanying
-e, passport. 不放在申请表中,之后会联系申请人
Original passports are required for you and your accompanying dependents in order to process your
application for immigration to Canada. Do not send your passport with your application, we will
request it from you during processing.
-f, PROOF OF RELATIONSHIP TO SPONSOR
such as: 照片,电话单,sponsor护照的每一页。
financial support from sponsor
sponsor's landing paper, PR card...
-g, police 无犯罪
-h, engagement, for person to Qubec
-i, photo,
measure between 25 mm and 30 mm (1” and 1 1/5”) from chin to crown;
• have a 35 mm x 45 mm (1 3/8” x 1 3/4”) finished size.

-j, sponsorship approval letter, photocopy.
-k, 地址和电话的label. 地址要中文和拼音。
-l. checklist



Cli38068106

Friday, September 11, 2009

T992

PC13--(v603)dw1_FGT_dw2(v603)--PC14

issue 1:
a-a mode, the slave send its packet to the master's mac
because the rtcache had been rewritten by the master's bonce
traffic. SO the symptom is when the session handled by the slave,
traffic stop.

5140-slot5 (NBF60301F) # d ip rtcache list

family=02 tab=254 vf=2 type=01 tos=0 flag=80000200
192.168.3.130@0->192.168.3.14@26(Vlan603-north) gwy=0.0.0.0 prefsrc=0.0.0.0
ci: ref=4 lastused=0 expire=0 err=00000000 used=2 br=1 pmtu=1500
00:11:43:eb:86:2d->00:11:43:58:6d:39

family=02 tab=254 vf=2 type=01 tos=0 flag=80000200
192.168.3.14@0->192.168.3.130@27(Vlan603-south) gwy=0.0.0.0 prefsrc=0.0.0.0
ci: ref=195 lastused=0 expire=0 err=00000000 used=2 br=1 pmtu=1500
00:11:43:58:6d:39->00:11:43:eb:86:2d


issue 2:
a-a mode, change server's mac address, the master is able to correct its rtcache
but the slave won't. so when the traffic is handled by the slave,
the slave will send the packets to the server's old mac.

Tuesday, September 8, 2009

Some useful link
http://ieoc.com/forums/

vol_I_lab_13_RouteReflection


router bgp 100
neighbor 150.1.1.1 remote-as 100
neighbor 150.1.1.1 update-source Loopback0
neighbor 150.1.3.3 remote-as 100
neighbor 150.1.3.3 update-source Loopback0
neighbor 150.1.4.4 remote-as 100
neighbor 150.1.4.4 update-source Loopback0
neighbor 150.1.6.6 remote-as 100
neighbor 150.1.6.6 update-source Loopback0
!
address-family ipv4 ===>???Why
neighbor 150.1.1.1 activate
no neighbor 150.1.3.3 activate
no neighbor 150.1.4.4 activate
no neighbor 150.1.6.6 activate
exit-address-family
!
address-family vpnv4
neighbor 150.1.3.3 activate
neighbor 150.1.3.3 send-community extended ==> why not both which is for the =====>other lab
neighbor 150.1.3.3 route-reflector-client
neighbor 150.1.4.4 activate
neighbor 150.1.4.4 send-community extended
neighbor 150.1.4.4 route-reflector-client
neighbor 150.1.6.6 activate
neighbor 150.1.6.6 send-community extended
neighbor 150.1.6.6 route-reflector-client
exit-address-family

Monday, September 7, 2009

vol_I_lab_12_OSPF_Domain_ID

link: http://www.bbfish.net/vpn/vpn_239.html

why domain-id?
如果使用标准的BGP/OSPF,PE2 将把BGP VPN 路由通过Type5 LSAs,即ASE LSAs,发布给CE3 和CE4。但CE1 与CE3、CE4 属于同一个OSPF 域,它们之间的路由发布应该使用Type3 LSAs,即区域间路由(inter-area routes)。
为了解决上述问题,PE 使用一种经过修改的BGP/OSPF 交互过程(简称为BGP/OSPF互操作功能),发布从一个Site 到另一个Site 的路由,将这种路由与真正的ASExternal路由进行区分。这一过程需要BGP 使用扩展团体属性,携带可以标识OSPF属性的信息。
在华为 NE80 的实现中,要求每个OSPF 域有一个可配置的域ID(Domain ID)。一般建议:与每个VPN 实例相关的网络中的所有OSPF 实例要么配置一个相同的域ID,要么都使用缺省的域ID。域ID 作为BGP 的扩展团体属性传播,这样,在收到BGP 的VPN 路由时,域ID 相同的是来自同一VPN 实例的路由。

Friday, August 28, 2009

Wii 软破解

http://www.chinagnet.com/bbs/thread-73748-1-2.html

Tuesday, August 11, 2009

For Ticket 1032

#!/usr/local/bin/expect --
spawn ssh admin@192.168.183.219
expect "#"
log_user 1 ###Log to stdout as well###
log_file -noappend abc.txt ###log to file, working one. no need to set###
send "config v\n"
expect "#"
for {set i 1} {$i < 29} {incr i} {
send "config v\n"
expect "#"
send "edit falcon$i\n"
expect "#"
send "d ip multicast mroute\n"
expect "#"
send "end\n"
expect "#"
}
for {set j 1} {$j < 7} {incr j} {
send "conf g\n"
expect "#"
send "exec npu-cli /dev/xe2_0 \"showmatrix $j\"\n" ##how to handle the special char#
expect "#"
send "end\n"
expect "#"
}
send "d sys top 5\n" #we can use this to collect top infor from DUT
sleep 2
send "q"
expect "#"
send "get sys performance status\n"
expect "#"
send "exec time\n"
expect "#"
send "end\n"
expect "#"
sleep 10

Thursday, August 6, 2009

GNS3

GNS3 Tutorials

Mini Scenario


Only issue on HP touch Smart
Dynamips: the default folder is C:\Program Files\Dynamips\...
Need to change to C:\Program Files (x86)\GNS3\Dynamips\dynamips-wxp.exe

Monday, August 3, 2009

Kid's swapmeet

Link 1

Link 2


http://www.usedvancouver.com/classified-ad/8443475

Thursday, July 30, 2009

T1032- Avalanche VQA: video quality analysis

VQA related setting configure







client action



client profile



client subnet



client association




srv profile, No transaction needed for this testing



Srv subnet



Srv association:

Sunday, July 19, 2009

Breaking Point System

==================================================================

Feature:

# Generates blended Layer 4-7 traffic at up to 20 Gigabits per second per blade without performance degradation.
# Generates 40 Gigabits per second and faster of Layer 2-3 traffic per blade. Q1: multicast

# 75+ application protocols are available, including HTTP, SMTP, AOL® IM, FIX, IBM DB2, VMware® VMotion™, Microsoft® CIFS/SMB, MAPI, Oracle, Encrypted BitTorrent™, eDonkey, RADIUS, SIP, Windows Live Messenger, World of Warcraft®, Yahoo!® Messenger and many others.

=================================================================
Performance

* 15 million concurrent TCP sessions Q2: per blade? one pair port
* 1.5 million TCP sessions per second Q3: concureent? 15M stream?
* 40 Gigabits per second of Layer 4-7 traffic in a 3-slot chassis
* 80 Gigabits per second Layer 2-3 traffic in a 3-slot chassis
* Scales easily with multiple BreakingPoint Elite's to generate an unlimited amount of Layer 2-7 traffic while retaining a single interface, test configuration and reporting

===============================================================
Application

# More than 75 application protocols are available including HTTP, SMTP, AOL® IM, FIX, IBM DB2, VMware® VMotionTM, Microsoft® CIFS/SMB, MAPI, Oracle, Encrypted BitTorrent™, eDonkey, RADIUS, SIP, Windows Live Messenger, World of Warcraft®, Yahoo!® Messenger, and many others.
# New application protocols and security strikes released each week and

==============================================================
Security

Proper network equipment testing must include realistic enterprise network traffic including live security strikes. BreakingPoint products allow you to modify and create difficult-to-detect network security attacks to expose vulnerabilities.

* 4,000+ security strikes and 80+ evasion techniques
* Most comprehensive Microsoft® Tuesday coverage
* SYN Flood attacks with up to 1,000,000 false and valid connections
* Target external servers with security attacks
* Application layer fuzzing for Zero-day detection

WII

刻录机的选择
  
  要安全、完美的翻刻wii的游戏,我们首先要选择一款优秀的刻录机。目前市面上的一些大品牌的刻录机,如先锋(Pioneer)、LG、索尼(sony)、三星(Samsung)等,在这几个品牌里向大家特别推荐LG和先锋的刻录机。

  推荐的型号:LG GSA-H62N 市场零售价:225元左右

  由于wii的正版游戏碟片大多是用LG刻录设备制作出来的,并且LG的光驱能够安全的DUMP正版的wii游戏,所以使用LG的刻录机刻录wii的游戏成功率很高,游戏读取的时候也非常的顺畅。

  推荐的型号:先锋DVR-115CH 市场零售价:270元左右
  
  先锋系列的刻录机一直是DVD刻录存储的领军人物,DVR-115 CH是其最新的第八代刻录机,其拥有先锋特有的“液晶补正”、“激光校正”、“七星稳盘”和“动态谐振吸收机制”四大刻录技术。使用先锋刻录机刻录出来的wii游戏品质稳定,盘片兼容性更高。


======================
盘片与刻录机

  非常配对组合一

  刻录机:LG GSA-H62N
  刻录光盘:TDK 16X DVD-R刻录盘
  TDK是世界首屈一指的电子组件与纪录媒体制造商,这款TDK刻录盘的容量为4.7GB盘片表面摩擦系数仅为0.44,和一般DVD的1.19相比大幅降低了摩擦系数,即使经过多次使用盘片后,碟片的时基误差、内码奇偶校验误差率的上升也是很小的。
  价格:4.9元左右/片
  建议刻录速度:4X-8X


  非常配对组合二

  刻录机:先锋115CH刻录机
  刻录光盘:三菱樱花16X DVD-R
  三菱这款盘片采用了AZO染料,使用了高度专业级的绘图技术,以亚粉油墨印制的盘片表面,宛如多多樱花绽放飞舞。采用的是三菱独有的“DYN-AZO”技术,能有效控制碟片的细微变形,减低高速刻录时的出错率。
  价格:2.4元左右/片
  建议刻录速度:4X-8X


  非常配对组合三

  刻录机:LG GSA-H62N
  刻录光盘:铼德8X +R -R
  铼德是全球第一大光盘制造厂商,,这款盘片就是其最出名的“X”卓越系列。X系列是铼德刻录盘中的最高品质。这款刻录盘采用了铼德标志性的黄金色的涂层、深蓝色的化学染料,同时这款盘片还通过了DVD Forum A级实验室认证。
  价格:1.8元左右/片
  建议刻录速度:4X

=================
刻录软件

ONES

  点击文件ONES.exe后,将空白DVD刻录盘放入刻录机内。在“刻录动作”选项中选择“刻录常见映像”功能。然后在弹出的刻录菜单中点击“映像”右侧的浏览按钮选择需要刻录的wii游戏ISO文件。选择好游戏ISO文件后,将刻录速度调整为4X进行刻录。如果希望再提高刻录的成功率,请勾选“校验”功能,不过这样会花费更多的刻录校验时间。

  优点:软件体积十分小,不需要安装,是非常简单的绿色刻录软件。
  缺点:ONES支持的镜像格式非常有限。
  适用系统:windowsXP/Vista
  推荐系数:★★★★★

  
ImgBurn

  点击imgburn.exe执行主程序,显示界面后,选贼菜单中“模式”栏目中的“写入”按钮。将空白DVD刻录盘放入刻录机中。点击“来源”栏目中的“浏览文件”按钮,选中想要刻录的wii游戏镜像文件后在“目标”栏目理选择刻录机。最后在右侧的“设定”栏目中的“写入速度”选择为4X进行刻录即可。

  优点:支持多种格式的镜像文件,并且连NGC游戏的.gcm格式也可以直接刻录。
  缺点:中规中矩,没有什么缺点。
  适用系统:windowsXP/Vista
  推荐系数:★★★★★

  
Nero8

  选择Nero Burning ROM刻录选项,软件启动后界面会出现“新编辑”向导,点击下方的取消按钮即可。然后将空白DVD刻录盘放入刻录机中,点击选顶菜单中的“文件”选项,选择“打开”。找到需要刻录的wii游戏镜像文件后按“打开”按钮。打开游戏镜像后就会直接进入刻录菜单,同样请将刻录速度选择为4X后,点击下面的“刻录”按钮开始进行刻录。

  优点: Nero8能识别大部分常见的光盘镜像格式,刻录各种功能丰富多样。
  缺点:软件体积非常庞大,如果想体验完整的功能需要进行购买。
  适用系统:windowsXP/Vista
  推荐系数:★★★★

==============================

图解教程
link-1

link-2

link-3

link-4

link-5

wiihacks.com
shockk
qaxxxxxx
===================

Forum for WII

a,
Don't worry man, these wii boards rarely flame people lol.

First off, what your going to want to get is some Verbatim -R DVDs. REASON WHY The Wii likes -R dvds and verbatim is the best way to go.

Secondly, you can use imgburn or Nero to burn. People have different opinions on this, but i personally think imgburn is better.

Thirdly, Burn on the lowest speed. 4x preferred.

Lastly, Play & Enjoy
++++++++++++++++++++++
b,
Burning games is different then ripping the games. To rip the games (create a copy) you need a specific DVD drive. To burn them you do not need anything specific. I have even got my backup copies to work with some Ridata +r's that i had left over.
++++++++++++++++++++++++
c,
I have a friend that uses all kinds of crazy cheap discs and most of them work just fine for him. You should really just try small batches from stores near your house to see which one work for you. Stick with DVD-R when possible. I know alot of people can use DVD+R just fine (myself included) but DVD-R has higher compatibility rates and just removes a variable from the "this disc doesn't work" equation when troubleshooting.

Slow is also better, although my wii plays backups fine burned at 16x. My friends entire 100+ discs collection was all burned at 16x and they all work fine, however alot of people complain about having issues, so i always burn at 8x. Others claim they have to burn even slower. Go as slow as you can tolerate. If you have issues with a disc, try slower and see if that solves it.

If you are really concerned about being to keep the stuff you are burning for years and years, you may want to try and stick with Verbatim when posible, or TDK or Maxell. If Sony discs work for you then those will most likley be ok as well.

I have gotten bad discs many a time with memorex. Been doing this for over 10 years, and I still have PS1 games archived on the gold 650MB memorex CD-R's that were the standard until someone figured out how to squeeze another 50 mb onto a CD. These old discs even though they were stored well are slowly falling apart. The verbatims and TDK discs are just fine. They still work, and can also be copied. It's not just the life span of the Memorex discs that are bad. Sometimes they are damaged inside the spindle before you even use them. Tops peeling, errors when you try to burn on them.
++++++++++++++++++++++++++++++++++++
d,
This is what the LG drive is for. If you don't have one of the ones that can read games then you will have to use your Wii to read it using either the Wii DVD Dumper (slower) or the USB Loader (faster) to dump the game somewhere.

Friday, July 17, 2009

TV DeskTop 9.28)
282178498 
247836144 for ver7.


XP in PC15:  224750684
TV TouchSmart
367168564

TV Dell
282824332

CCO
Cisco.com ==> Training and Events ==> Track certificate
http://www.cisco.com/web/learning/index.html
Username: kxxxzhxx
CSCO10947902/same as gmail

Friday, July 10, 2009

T1032 Part TestCenter

a, add the command to send the arp


b, ask the port to send the join


c, training traffic.


d, active stream


e, wait the period


f, 2544 pic A


g, 2544 pic B




h, 2544 pic C


igmp leave




PC14---(dw1/1)Blade6(dw1/2)----IPSEC----(dw1/1)Blade8(dw1/2)------PC12
...........RP, join 226.............................join 225

case 1: for group 225 traffic.
-a, no traffic on B6 side, but static join on B8.
user space:
blade6 (falcon) # get router info multicast pim sparse-mode table
IP Multicast Routing Table

(*,*,RP) Entries: 0
(*,G) Entries: 40
(S,G) Entries: 20
(S,G,rpt) Entries: 40
FCR Entries: 0

(*, 225.0.0.1)
RP: 30.0.0.1
RPF nbr: 0.0.0.0
RPF idx: None
Upstream State: JOINED ===>B8 send join message, from to_server
Local:
Joined:
to_server
Asserted:
FCR:

kernel : Nothing

-b, start sending the traffic. B6 kernel get something
grp=225.0.0.1 src=30.0.0.14 intf=13 flags=(0x10000000)[ ] status=resolved
last_assert=1479361 bytes=2140 pkt=5 wrong_if=0 num_ifs=1
index(ttl)=[15(1),]
offload(ttl)=[15(1),] npu_flags=00000001


user space:
(30.0.0.14, 225.0.0.1, rpt)
RP: 30.0.0.1
RPF nbr: 0.0.0.0
RPF idx: None
Upstream State: NOT PRUNED
Local:
Pruned:
Outgoing:
to_server



case 2: for group 226 traffic

-a, no traffic.
no entry in kernel and user space
-b, pc12 start send traffic to 226.0.0.1
B8 encap the multicast traffic into Register message and send to RP (B6). B6 open the packet and forward the traffic to outgoing interface. and then send join message to B8. By then SPT (shortest path tree) established. B8 put to_cam to outgoing interface. B6 then send register_stop to B8 and B8 start sending the multicast directly to B6.

Tuesday, June 30, 2009

Cherry U-Pick


Sat:
a, Kelowna Lakeshore Inn
3756 Lakeshore Road, Kelowna. (250) 763-4717
www.lakeshoreinn.com

b, official recommendation (farm)
1409 teasdale Road, Kelowna. 250)765-1797
579 Barnaby Road, Kelowna. 250)765-1820
3687 Paynter Road, Westbank 250-768-7313 (apricots, cherries,)
3690 Berard Road, Kelowna (mcmillan Farms apricots

c, winery
mission hill road, Westbank-- Mission Hill Winery
4870 Chute Lake Road Kelowna -- Summer Hill Winery
5445 Lakeshore Road Kelowna --- CedarCreek Estate Winery

SUN

a, http://hillsideorchards.farmvisit.com/ oliver apricot
b, 17208 Bentley Rd. Summerland, B.C apricot 2

b, steven's u pick
# Steven's U-Pick Cherries - cherries, and prepicked produce
Hwy #97 Across Deadmans lake, Osoyoos, BC V0H1T0. Phone: 250-498-1013Directions: Hwy #97, Between Oliver & Osoyoos B.C across Deadmans Lake Open: 7 Days a week , 8 am to 5 pm We start picking our first cherries the May long weekend and continue picking till August. Payment: Cash, only. We are the largest U-pick cherry Orchard in the Sunny Okanogan !! We Have Over 6 varieties of cherries that last from May till August. So come out and have some fun!
# Stewart's Berry Patch - blueberries, raspberries, tayberries,

c, http://www.env.gov.bc.ca/bcparks/explore/parkpgs/ecmanning/manning.pdf
manning park





phone: http://www.tourismkelowna.com/visitors/thingstodo/u-pick.php

http://www.bccherry.com/orchard-listings.asp

winery tour and wine tasting
http://www.missionhillwinery.com/guest_experience/publicTours.html

http://www.summerhill.bc.ca/visiting-summerhill/tours-and-tastings

plan:
A, Stop 1:Paynter's Fruit Market
13 mins from kelowna

* Paynter's Fruit Market - apricots, cherries, pears, peaches, Honey from hives on the farm, prepicked produce, gift shop, snacks and refreshment stand, restrooms, picnic area
3687 Paynter Road, Westbank , BC V4T 1R1. Phone: 250-768-7313. Fax: 850-768-7313. Email: info@payntersfruitmarket.ca. And for a map to our farm, click here. Crops are usually available in July, August, September. Open: July and August - 8am to 8pm, 7 days a week Sept and October - 9am to 6pm 7 days a week. Paynter's is open late June - early November; Pick your own cherries start early July, Pick your own peaches mid August Also many in season veggies and local products along with 26 flavors of Hard Ice Cream. Payment: Cash, Check, Visa/MasterCard. (ADDED: September 21, 2008)


Kempf Orchards
U-Pick Cherries
Phone: (250) 765-1797


ken去年的经验

just came back from Osoyoos now. It was around 4 hrs drive(one way). There were many cherry U pick farms on the way from Osoyoos to Oliver. The farm's name which we went into was Gill Farm Produce, phone# was 250-495-5342. It was about 8 KM from Osoyoos,and it was $0.8/pound. Those guys at that farm were very nice. There was another farm after Gill, but don't get into this one. That farm would charge $2/pound.

by the way, it was very easy to drive to Osoyoos. Just drive on HYW#1, then go to HYW#3 and keep driving on this road, then u will be there. When u r on HYW#3, u can look at the road signs. They were very clear, and they will take u all the way to Osoyoos.

http://www.westca.com/Forums/viewtopic/t=40904.html
=================================================

route 2:
To Osoyoos:

1. Starting in VANCOUVER, BC on WOLFE AVE - go < 0.1 km
2. Head left on W 16TH AVE - go 0.3 km
3. Turn left on OAK ST - go 0.3 km
4. Turn right on 12TH AVE - go 4.7 km
5. 12TH AVE becomes GRANDVIEW HWY - go 3.1 km
6. Take ramp onto T-C HWY 1 - go 141.4 km
7. T-C HWY 1 becomes BC-3 - go 246.2 km
8. Turn right on BC-97 - go < 0.1 km
9. Continue on MAIN ST[BC-3] - go 1.0 km
10. Turn left on 85ST ST - go < 0.1 km
11. Arrive at the centre of OSOYOOS, BC

==============================

route 3
To Olive

1. Starting in VANCOUVER, BC on WOLFE AVE - go < 0.1 km
2. Head left on W 16TH AVE - go 0.3 km
3. Turn left on OAK ST - go 0.3 km
4. Turn right on 12TH AVE - go 4.7 km
5. 12TH AVE becomes GRANDVIEW HWY - go 3.1 km
6. Take ramp onto T-C HWY 1 - go 141.4 km
7. T-C HWY 1 becomes BC-3 - go 198.4 km
8. Turn left on BC-3A - go 31.7 km
9. Take ramp toward BC-97 - go 0.2 km
10. Turn right on BC-97 - go 26.9 km
11. Turn right on 356TH AVE - go 0.2 km
12. Arrive at the centre of OLIVER, BC

=====================

WWW.OSOYOOSINFO.COM

=====================

上周末一行五人,去Okanagan逗了一大圈,行程差不多1000公里,玩得很尽兴。相信长周末一定有不少人都会去那边采樱桃,说一说我们的路线,供大家参考。

周五:
路线:hope - merritt - kelowna
5点出发,上1号高速。不巧的是,遇到1号高速chilliwack段发生了一起严重车祸,1人死亡,多人受伤。幸运的是我们在abbotsford的时候正好听到广播,所以在abbotsford下了1号,从yale路转到了1号旁边的小路上。看到我们旁边的1号路上车子动弹不得,真实庆幸阿!虽然后来小路上也出现了一些拥堵,比正常情况多花一小时,但总比1号路后来被封闭长达5小时强多了。
到了hope,转到往北的5号路上,也就是唯一的那段收费路。过了merritt后,转到往东的97c,大约10点就到了kelowna。

当晚我们住在kelowna湖对岸的westbank区,位于山上的一个b&b,一幢两层楼的房子,楼上是主人住,楼下就是 B&B,为独立出入的两室一厅,房间很干净很漂亮很舒适,而且东西都很齐全,还可以眺望到一些湖景。更值得称赞的是他家的花园,相当美丽,种了好多不同品种的花草。而且周围的人家的花园也大多都布置得很美,应该是个比较富裕的社区。收拾了一下,打了打升级,然后就睡了。

补充:我们是通过ownerdirect.com找到这个房子,两晚一共才200左右,最多可住6人。联系信息:Rick &Sandy Macdonald,2608 Copperridge drive,Westbank,tel: 250 768 2781,假如直接跟他们联系可以省掉付给网站的手续费。



----------
周六(6/24):
舒舒服服的睡到9点,吃了早饭后出发开始kelowna一日游。
沿97号过floating bridge,过了湖,转到ellis路,往北开到底,就来到knox mountain山脚下。knox mountain是俯瞰kelowna的地方,里面也有很多trails,当地人爬它就像vancouverites爬grouse一样。要是没时间没体力爬trail,也可以沿山后的一条公路一直开到山顶,几分钟就到了。来到山顶,整个kelowna还有okanagan lake的风光一览无遗。


从knox mountain下来后,去waterfront逛逛。天气炎热,好多市民都来到了湖边,散布、游泳、驾船。我们预先就计划要坐船到湖上兜一兜,比较了一下cruise和自己驾驶的boat,觉得还是boat好玩,也不会贵很多,所以在码头找了一家租船的,1小时$68+tax+gas,最多可载6人,总共花费不超过$100,也不需要驾驶执照,我们每个人都去过了过开船的瘾,好爽。才发现开这种船很简单,有名言道:你不可能在一分钟内学会开车,但是一定可以在一分钟内学会开船。


okanagan是加拿大两大葡萄酒产区之一,加拿大唯一的沙漠性气候地带,炎热的夏季、寒冷的冬季,还有干燥的气候和沙质的土壤,造就了闻名遐迩的酒乡,孕育了漂亮的葡萄酒庄园。Mission Hill Winery就是这当中最有名的一家,位于Westbank离湖边不远Mission Hill山顶上,宜人的风景、诱人的酒香,在这里品品酒、吃吃饭,甚至是举行party,都是很棒的选择。

--------------------------
早上9点Westbank出发,上97号路一直往南,大约只开了20分钟就到了Peachland。Peachland只是一个很小的小镇,沿湖而建,看到一个Market马上要开市,有个摊位标着 Cherry,过去问多少钱,竟然要4刀,不知道是不是因为我们是游客的关系?!
这条线上的市镇间隔很密集,Summerland离Peachland也不远,也是个湖边小镇。在一个湖边公园稍作停留,看到一些当地的老头老太在那里摆好东西,似乎打算在湖边享受一整天的样子。

下一站Penticton,可能是规模仅次于Kelowna的一个城市了。Okanagan Lake在Penticton的北端结束,而Skaha Lake则在它的南端开始,所以整个Penticton就是位于两湖中间。这里有条Channel,Okanagan湖的水通过它流向Skaha湖,水流平静却急促,可以玩Floating,$11/人,每人一个橡皮圈,大约1个半小时,不过喜欢刺激一点的Rafting的人可能会觉得有些Boring。 Floating起点在97号刚进入Penticton的地方的东面,随便问个当地人都知道。——注意防晒哦!

继续南行,在skaha lake南端结束的地方,97号左边的低洼地里出现了一个很美的小镇,应该就是Okanagan Falls。湖边有座木头长桥,小镇上树木密集,感觉和这一地区其它的市镇都不一样。如果时间充足,很值得多停留一下,里面还有些hiking的 trails,也有不少漂亮的vineyards。

这之后是Oliver,从这里到osoyoos一路就没有湖景了,两边全是果园,樱桃园很多,但是写有u-pick牌子的并不多,所以要留心一点看,也许今年偏冷的关系,我们碰到的樱桃还有很多都没熟,而且没找到特别好的品种。听说有种大个儿的okanagan樱桃,叫做2-bites樱桃,但是没有发现,也没有看到黄樱桃。采樱桃的时候蚊子很多,小心被咬!

关于采樱桃的价格,在visitors information centre打听的是$1/lbs,但是我们没找到那么便宜的,最低都是$1.25/lbs,也许又是欺负外地人把。采之前最好先跟主人说先尝尝再决定。有的果园还要求客人最少采20lbs,我们就碰到一个,那家主人是个手很大的老头,脾气很糟糕,我们倏忽了一下,没有尝就进去了,进去采之后发现他的樱桃成熟度不是很好,采不了20lbs,所以告诉他不采了,结果他就跟我们发脾气了。
相信长周末以后,樱桃的成熟度就会好很多。黄樱桃也应该会慢慢出来了。
假如懒得采了,可以在97旁边的一些农场market买采好的,价格从$1.75~$2

大约还有12公里到osoyoos的地方,有个薰衣草园,在97的东面,很大的牌子上面写着lavender,园子不算大,允许客人自己去采花,一束好像是$10。他们还有个商店,卖薰衣草的各种东西。

过了osoyoos,转右上3号路,就往温哥华的方向了。从osoyoos出来大约15分钟,在路的左手边,一眼就可以看到spotted lake,没有任何标志,但是我们事先看过别人的游记,所以知道大概位置,特别留意了一下。听说过湖畔很泥泞,所以没下去,就在近处的荒草地上看了一下,确实很特别的一个小湖。就是水多了一点,我看到过别人拍的照片,水比较少,更漂亮些。
过了spotted lake后,3号路有一段非常漂亮,两边山坡上有很多沙漠里才有的植物,谷地里是大片的农田,绿一块黄一块,和中国川西的一些景色有些相似。——经过的时候相机时刻准备着哦!

经过manning park有些晚了,否则还可以去lightning lake转转。

吃了樱桃,载着樱桃,高高兴兴回到温哥华。

Thursday, May 7, 2009

西雅图之旅

波音飞机厂(Boeing Factory)
官方网站:http://www.boeing.com/
地址:3003 W Casino Rd,Everett, WA

波音飞机厂是世界最大的飞机制造厂,位于西雅图近郊 Everett,在 Highway 5 出口 (EX.189)。从西雅图开车约 40分钟.由温哥华开车约两小时到达。

游客进入波音飞机厂后会看两部影片(1.飞机历史 2.在7分钟快速拼出飞机 (Qick Put Together)),之后有专业解说员带领乘车围著占地 365 公顷,有 36 个足球馆那么大的厂区游览,途中将参观巨大无比的机棚、试验跑道和一个看上去比超级体育馆还大的喷漆车间。

波音飞机厂的厂房给游客极大视觉上的震撼,它的厂房一排有六扇大门,每个高25米,宽107米,相当于一个美式足球场大小,人和车在它的面前都显得非常渺小。这个总面积400万平方米的厂房被记入了吉尼斯世界大全,至今没有被打破。由于面积太大,工人在里面穿行时,不少人以自行车或三轮车代步。厂房里回响著机器转动的嘈杂声,隐隐约约还能听到从下面的工作站里传来爵士乐的节奏声。穿著 T 恤衫、身材魁梧的机械师们嘴里说著“让一让”之类的话,骑著公司发给的三轮车穿过有巨大无比的车间,看上去就像小小的蚂蚁一样。

波音飞机厂每年要接待将近 10 万名参观者,沿途都设有固定的导游,用非常有趣的滑稽表演做介绍(“记住,伙计们,不是波音飞机我不坐!”)。同时游客还会了解到一些惊人的细节,并懂得如何区别波音 777 和波音 767等。波音飞机厂之旅不仅给每一位游客留下深刻的印象,同时还将使大家增长不少知识,扩大视野,非常值得一游。

如果自己参加波音飞机厂的旅行注意要提前预约,可以通过以下网址在波音飞机厂的网站上提前预约:http://www.boeing.com/companyoffices/aboutus/tours/。另外注意不要将波音飞机厂与Seattle南面的航空博物馆(Museum of Flight) 混淆。

西 雅 图 中 心 Seattle Center

此 中 心 为 1962年 西 雅 图 万 国 博 览 会 的 会 址 , 终 年 娱 乐 不 间 断 , 提 供 购 物 、 餐 饮 , 以 及 艺 术 、 教 育 、 文 化 等 活 动 。 内 部 游 乐 景 点 包 括 太 空 针 塔 、 太 平 洋 科 学 中 心 、 儿 童 馆 及 各 国 食 品 展 示 场 (Food Circus), 此 外 , 西 雅 图 观 光 局 办 事 处 并 在 该 中 心 内 提 供 谘 询 服 务 。

地址 : 2002 2nd Ave., N., Seattle.
交通 : 西 湖 购 物 中 心 (400 Pine St.)四 楼 顶 楼 搭 乘 单 轨 电 车 。
电话: (206)684-7600


太 空 针 塔 Space Needle
塔 高 180公 尺 , 是 西 雅 图 最 显 着 的 地 标 。 游 客 可 登 上 观 景 台 , 三 百 六 十 度 浏 览 西 雅 图 全 貌 , 或 至 两 家 餐 厅 The Space Needle及 The Emerald Suite品 尝 鲜 美 海 鲜 大 餐 , 亦 可 在 一 楼 纪 念 品 店 选 购 此 地 特 有 的 艺 品 。

电话: (206)443-2100
票价 : 大 人 5.5美 元 , 5-12岁 免 费 。用 餐 客 人 免 费 , 但 如 只 利 用 酒 吧 则 要 收 费 。

大 学 区 University District
此 区 类 似 台 北 的 公 馆 , 书 店 、 餐 厅 、 服 饰 店 沿 University Way林 立 , 兼 有 戏 院 与 艺 品 店 。 华 盛 顿 大 学 是 美 国 西 部 最 大 的 公 立 大 学 , 占 地 约 2.4平 方 公 里 , 校 区 建 筑 物 超 过 一 百 座 以 上 , 包 括 亨 利 美 术 馆 、 州 立 博 物 馆 、 竺 朗 海 喷 泉 及 爱 斯 基 摩 大 体 育 场 等 。
地 : 环 绕 华 盛 顿 大 学 , 在 州 际 公 路 1-5之 东 。
 

Woodland Park Zoo
名 列 为 全 国 十 大 动 物 园 之 一 , 有 近 300种 野 生 动 物 , 园 内 动 物 都 居 住 在 模 拟 自 然 生 态 的 环 境 中 , 规 划 有 亚 洲 象 森 林 区 、 本 地 难 得 一 见 的 热 带 雨 林 区 等 。

地址 : 5500 Phinney Ave., North, Seattle
电话 : (206)684-4800
交通 : 在 3rd Ave.及 Pine St.N.55TH St. N.55TH St.& Phinney Ave. N.下 车
时间 : 三 月 十 五 日 ~ 十 月 三 十 日 09:30-18:00, 十 月 三 十 一 日 ~ 三 月 十 四 日 09:30-16:00。
 


派 克 地 市 场 Pike Place Market
是 美 国 着 名 的 农 产 品 市 集 , 有 二 百 多 家 商 店 , 供 应 各 类 生 鲜 蔬 果 , 以 及 各 地 风 俗 的 手 工 艺 品 ; 另 外 充 满 异 国 情 调 的 餐 厅 , 亦 沿 街 林 立 。 市 场 内 洋 溢 一 片 热 闹 蓬 勃 的 气 氛 , 是 西 雅 图 当 地 居 民 及 游 客 最 喜 爱 的 地 方 。

地址 : 位 于 Alaskan Way Vinduct, Ist St.,Lenora &Union Aves.之 间 。



==========================
海岸码头区The Waterfront

从派克市场的Pike Hillclimb (Pier 59对面)或者从University Street上的Harbor Steps(Pier 56对面)沿着台阶走下来,跨过马路就来到了海边的码头区。这是一个非常繁忙的码头区,共有20多个码头,从Pier 48一直到Pier 70,许多国际渡轮,华盛顿州的交通渡轮以及各种观光渡轮都从这里进出。其中从54号到59号码头是以观光和休闲旅游为主的,水族馆,立体电影院,海鲜餐厅,礼品店等都设在这些码头上。



Ye Olde Curiosity Shop(Pier 54)

这是一家有着超过百年历史的工艺品店,店里有不少该店创始人Mr.Joe Standley收藏的各种不同风格的古董和稀奇古怪的物品。这家店是码头区一带最有名的工艺品店,虽然名气大,但价位平实,且种类繁多,挑选范围大,如果想要买一些富有地方特色的纪念品,这家百年老店绝对是首选。



Ivar's Acres of Clams(Pier 54)

这是一家非常有名的海鲜餐厅。来到码头区,自然要品尝一下这里的海鲜,尤其是地道的美味海鲜浓汤Chowder,那才是不虚此行。Chowder大致可分为白色的Cream Chowder和红色的Chowder两种,一般菜单上Chowder都会注明是White还是Red.两种Chowder的主料都是马铃薯,鲜奶油和洋葱,并加上新鲜的鱼肉,蛤肉,蚌肉,牡蛎,蟹,虾,以及切碎的培根,芹菜,胡萝卜或其它蔬菜,还有一些面粉烹煮而成,因此汤非常的浓绸且营养丰富。红色 Chowder则在此基础上再加上一些番茄和番茄酱,味道有些酸甜,这是华盛顿州的特有风味。由于各家餐厅Chowder的配料和调料都不一样,每家餐厅均有其自己特有的招牌Chowder。而一年一度的西雅图海洋节(Seattle Maritime Festival)还要举行Chowder大赛呢,每个参加活动的游客都有投票权。Ivar's最著名的Chowder是Smoked Salmon Chowder,白色的浓汤非常鲜美,不愧是其招牌Chowder.码头区的海鲜餐厅因为都有无敌的view,所以价格比普通餐厅都要贵上二至三成,但不少餐厅都提供外卖的吧台,例如这家Ivar's餐厅就是其中之一。你可以买一份海鲜套餐(Oyster&Chips,Prawn&Chips,etc $5.49),再点一杯Chowder($2.95),然后坐在露天的长椅上享受美味的海鲜,吹着清凉的海风,也是挺不错的。这里的海鲜无论是清蒸的蛤,还是油炸的牡蛎,扇贝或鱼排都非常的美味,我想这可那是原料极其新鲜的缘故吧,总之点菜时无论点那一种都不会点错,尽管放心品尝美食好了。



Pier 55,56

这两个码头是Argosy Cruise公司所有观光渡轮出发的码头,包括去Blake Island上地Tillicum Village(印地安文化村)的渡轮也从这里出发,行程为4小时,包括往返航程,三文鱼大餐,原著民舞蹈欣赏及岛上漫步。其它观光渡轮包括1小时或2小时的Elliott Bay环游,可以从海上眺望如海市蜃楼般崛起的西雅图Downtown以及奥林匹克群山Olympic Mountain Ranges.



Bay Pavilion(Pier 57)

这家位于57号码头上的室内游乐场是最受小朋友们欢迎的小型乐园,里面有各种电动游戏和漂亮的旋转木马,另外冰淇淋和热狗等美式小吃也样样俱全,其中尤以冰淇淋店提供的二十多种不同口味的冰淇淋最受欢迎。当然这里也有餐厅和工艺品店,其中Pirate's Plunder Souvenirs店专卖一些海盗船或与航海相关的纪念品和手工艺品,蛮特别的,值得逛一逛。



The Seattle Aquarium(Pier 59)

西雅图水族馆就位于59号码头上,它于立体电影院Imax-Dome Theater 连在一起。水族馆内展出各种鱼类及海洋哺乳类动物,种类繁多,令人目不暇接,尤其是那些五颜六色,奇形怪状的鱼类真是薇为奇观。水族馆最特别之处是它有一个巨大的球形透明玻璃视窗,人站在中央可以抬头或四面观看海水中的那些自然生态,另外水族馆还是世界上唯一展示三文鱼繁殖过程的水族馆,馆内有一个专供三文鱼回流的鱼梯。水族馆还开发出人工养殖海獭的技术,在户外的水池中还可以看到正在享受日光浴的海狮。



Odyssey Maritime Discovery Center(Pier 66)

这是美国西北地区唯一的一座海事博物馆,馆藏极为丰富,馆内共分为4大区和44个展览厅,里面展示了许多和海上贸易及渔业相关的内容,并且介绍海湾居民生活的环境特色,还有独木舟的实际操作等,非常祥实地呈现了海洋与人类生活息息相关的重要性以及海湾的生态环境。

===========================
华盛顿湖Lake Washington

西雅图是一个被山水环抱的城市,即使在热闹繁华的市区,不仅能享受到迷人的海滨风光,还能欣赏到美丽的湖光山色。华盛顿湖因为面积广阔,感觉就象是一个海。沿着蜿蜒狭长的Lake Washington Blvd在湖边一直开,会经过好几个公园,例如Denny Blaine Park, Madrona Park, Leschi Park和Colman Park.这些公园有不少绿茵茵的草坪,小型的儿童游乐场,专用的单车道,因此不仅是欣赏漂亮的华盛顿湖的好地方,也是当地居民进行户外休闲活动的绝佳场所。湖边有不少的游艇码头,夏日一到,各种水上活动都会在湖面上展开。


沿着湖边有许多造型别致的住宅,其中不乏豪华别墅,比尔盖茨新建的千万豪宅就位于华盛顿湖畔。华盛顿湖与联合湖畔一样有许多各式各样的船屋Houseboat,这些水上人家的屋子多半都是木造的,有整排公寓式的,也有独栋豪华级的,不少都有私人游艇码头停靠着自己的游艇。


沿着520号高速公路一直朝东面开,很快就会经过华盛顿湖上有名的浮桥Evergreen Point Floating Bridge。大桥虽是钢筋水泥建筑,但没有桥墩,整个桥浮在华盛顿湖的湖面上。浮桥的两端各有一个小小的下坡,当车子从高处往下开时,感觉眼前突然豁然开朗起来,湛蓝的湖水,波光嶙嶙的湖面尽收眼底,而对面在晴空映衬下显得更加雄伟的雪山似乎近在咫尺,这海(湖)天一色的美景实在令人震撼。随着车子在桥上高速奔驰,心也在随之飞腾,真希望这浮桥没有尽头,那样就可以尽情享受这难得的人间美景了。


=============================
SEATTLE PREMIUM OUTLET
SEATTLE PREMIUM OUTLET,可在逾百个名牌店购物。

================================
西雅图的另类走法-美丽的海天景致(亦工原创) 打印 E-mail
跳转
西雅图的另类走法-美丽的海天景致(亦工原创)
页面 2
页面 1 / 2
西雅图去过多次,都是沿着5号公路走,比较单调。这次另辟途径,感觉比5号公路好很多。

过边境后沿5号公路到Bellingham,在250出口拐出,然后上11号公路(Chuckanut Dr.),沿着海岸线走,边走边观赏海景。Chuckanut Dr比之BC的Sea-to-Sky Highway在气势上要小,但沿路停车较为方便,有很多观景点。


====================

标题 English Name 点击
太空针塔 Space Needle 7455
西雅图中心 Seattle Center 7149
先锋广场 Pioneer Square 4701
西雅图渔人码头 The Waterfront 6287
华盛顿大学 The University of Washington 5163
华盛顿湖运河与区腾登水闸 Lake Washington Ship Canal & Hiram M. Chittenden Government 4257
波音飞机厂 Boeing Factory 7187
卢高美瀑布 Snoqualmie Fall 5002
西雅图地图 (请点击地图上的标记查看具体景点信息)


1.
来到Seattle Center,最不能错过的当然就是现在西雅图的象征-太空针塔了。太空针塔的高度是605英尺,在距离地面520英尺处是观景台和旋转餐厅。搭乘透明电梯从地面到观景台只需40秒钟,登上观景台可以俯瞰西雅图360度的全景,包括Mt.Rainier, Puget Sound和漂亮的湖泊等尽收眼底。人们常说到西雅图没有到过太空针塔,就象到巴黎没有到过埃菲尔铁塔一样,这使得太空针塔成为西雅图最热门的旅游景点之一。
2.
Seattle Center占地74英亩,是西雅图1962年举办世界博览会的地方,当时这个盛大的国际活动以'迎向21世纪'为展览主题,吸引了近1000万人次的参观群众。虽然博览会已经是四十多年前的事情了,但当初的各种展览场所与博物馆已经被改建成不同用途的集科教与娱乐为一体的各种设施,成为西雅图的文化中心。
3,
从派克市场的Pike Hillclimb (Pier 59对面)或者从University Street上的Harbor Steps(Pier 56对面)沿着台阶走下来,跨过马路就来到了海边的渔人码头区。这是一个非常繁忙的码头区,共有20多个码头,从Pier 48一直到Pier 70,许多国际渡轮,华盛顿州的交通渡轮以及各种观光渡轮都从这里进出。其中从54号到59号码头是以观光和休闲旅游为主的,水族馆,立体电影院,海鲜餐厅,礼品店等都设在这些码头上。
4
华盛顿大学占地极为广阔,其地理位置非常好,不仅濒临Portage Bay和Union Bay,面对着广阔如海的华盛顿湖,而距离市中心也只有15分钟的车程。

华盛顿大学的正门有几个高大的图腾柱,这是华盛顿大学的特有景致,也是美国西北部原著民的特有象征。华盛顿大学被称为拥有全美最漂亮的校舍,一走进大学,立刻就会为那一栋栋美轮美奂的欧式建筑所倾倒,就象是置身于欧洲的某一个城市一样。在这里不仅能看到歌德式尖顶造型的建筑,还有有着巴洛克式华丽装饰风格的大楼,有的气派宏伟,有的精致典雅,但无不透露着浓厚的古典气息。

5,

长达8哩的华盛顿湖运河是连接西雅图附近主要湖泊及港湾的信道,运河连接普杰特湾与华盛顿湖。区腾登水闸的主要功用在于以水闸升降的方式调节水位以利远洋轮船进入淡水湖。每年约有100,000辆的船只通过此运河,现在不仅是交通要道更是全家出游的好处所。每年十月鲑鱼回到此地产卵,顺着鱼梯跳跃的奇观,总吸引许多游客前来观赏。湖上有二座浮桥(520公里)是世界上最长 、没有桥墩的浮桥,主要连接西雅图与新兴城市 Bellevue。
6

卢高美瀑布(Snoqualmie Fall)距离西雅图仅25英里,是华盛顿州著名的自然景观之一。瀑布每年吸引150万人前来游览,尤其在春夏,慕名前来观赏瀑布的游客络绎不绝。该瀑布高达二百七十尺,虽然没有尼亚加拉瀑布那么气势磅礴,但比尼亚加拉瀑布还要高出一百尺,因而景象也颇为壮观。

卢高美瀑布方圆两英亩都被开辟作公园,从公园内的停车场下车,经过一段小小的天桥时,即可到达瀑布。走在天桥上,虽未看见瀑布,却已经能听到轰隆隆的水声,并感到空中弥漫的水气袭面而来。走不远,即到达专门建造的观景亭。观景亭建在瀑布对面的山上,位于Snoqualmie River上空300英尺处,在这里可以清楚地欣赏到壮观的瀑布。瀑布从悬崖顶端凌空飞流而下,倾入底下的幽谷中,势如翻江倒海,同时发出震天巨响。急速直下的水流在幽谷中溅起一片水雾,在阳光照射下,水雾又化作道道彩虹,奇妙而美丽。从近三百英尺高空垂直飞泻而下的瀑布真让游人产生"疑是银河落九天"的幻觉。

Monday, May 4, 2009

chap 2 TCL-Introduction and Overview

Expression:
set x "the answer is 1 + 3"
set y "the answer is [1 + 3]" ; #wrong, 1 is not a command
set y "the answer is [expr 1 + 3]"


=====================
Source command:
source ~/def.tcl; #if the file include the procedure, it is callable.

=====================
file I/O
set file [open /tmp/stuff w]
puts -nonewline $file "Hello World"

++++++++++++++++++++++++++++++++++++++

Chap 3 Getting started with Expect
Once expect has matched data to a pattern, it moves the data to the expect_out array.
the matched data is no longer eligible to be matched.

set timeout 60; #by default, expect only wait for 10 sec

=======================
interact command
Expect provides a command that turn control from the script over to u.





++++++++++++++++++++++++++++++++++++++++++

Chap 4 Glob patterns and other Basic

Wednesday, March 25, 2009

Link To Check Status

Tuesday, March 24, 2009

Virtual Router Concept




Thursday, March 19, 2009

Sample for MultiSpawn
#!/usr/bin/expect --
set timeout 3600
set username admin
set password ""
set h3600 7
set l3600 2
log_user 1

proc clear_line {line} {
spawn telnet 172.18.9.29
expect "#"
send "clear line $line\r"
expect "confirm"
send "y\r"
exec sleep 2
expect "#"
send "exit\r"
expect "#"
}


clear_line $h3600
clear_line $l3600

spawn telnet 172.18.9.29 200$h3600
set id1 $spawn_id
expect "]"

spawn telnet 172.18.9.29 200$l3600
set id2 $spawn_id
expect "]"

proc login_fw_id1 { } {
global id1
set spawn_id $id1
send "\r"
exec sleep 5
expect {
"login" {send "admin\r"
expect "assword"
send "\r"
expect "#"
}
"#" {send "end\r"
expect "#"}
"assword" {send "aaa\r"
expect "login"
send "admin\r"
expect "assword"
send "\r"}
expect "#"
}
return $spawn_id
}

proc login_fw_id2 { } {
global id2
set spawn_id $id2
send "\r"
exec sleep 5
expect {
"login" {send "admin\r"
expect "assword"
send "\r"
expect "#"
}
"#" {send "end\r"
expect "#"}
"assword" {send "aaa\r"
expect "login"
send "admin\r"
expect "assword"
send "\r"}
expect "#"
}
return $spawn_id
}

proc GetStatus-1 { } {
set spawn_id [login_fw_id1]
send "get sys status\r"
expect "#"
}


proc GetStatus-2 { } {
set spawn_id [login_fw_id2]
send "get sys status\r"
expect "#"
}


GetStatus-1
GetStatus-2

Tuesday, March 10, 2009

Skype in FC10

yum --nogpg install Name_of_Skype_rpm

Monday, February 23, 2009

Perl In 24

目 录
译者序
前言
第一部分 Perl基础
第1学时 Perl入门 3
1.1 安装Perl 3
1.1.1 等一等,也许你已经安装了Perl 4
#perl -v
1.1.2 在Windows 95/98/NT上安装Perl 5
1.1.3 在UNIX上安装Perl 6
1.1.4 在Macintosh系统上安装Perl 7
1.2 文档资料 7
1.2.1 某些特殊的文档资料举例 8
1.2.2 如果无法找到文档该怎么办 9
1.3 编写你的第一个Perl程序 9
1.3.1 键入程序 9
#!/usr/bin/perl
print "Hello, World\n";
1.3.2 运行程序 9
1.3.3 程序正确将会发生什么情况 10
1.3.4 Perl程序的具体运行过程 10
1.3.5 必须知道的一些情况 11
#man perlstyle > 建议打开-w 即warning

第2学时 Perl的基本构件:数字和字符串 14

2.1 直接量 14
字符串加双引号和单引号的主要差别是:使用单引号的字符串含义是非常直观的,单
引号字符串中的每个字符就是表示它自己的含义。在双引号中的字符串中, P e r l要查看是否存
在变量名或转义序列。

$name="James";
print "I met $name\n"; #James will be printed
print 'I met $name'; #won't print James
print "i met \$name'; #neither will this
2.1.1 数字 14
2.1.2 字符串 15
\ n 换行
\ r 回车
#如何砍掉\r. $r=; chomp $r;
\ t 制表符
\ b 退格
\ u 将下一个字符改为大写
\ l 将下一个字符改为小写
\ \ 直接量反斜杠字符
\ ' 用单引号( ' ')括起来的字符串中的直接量'
\ " 用引号括起来的字符串中的直接量"


2.2 标量变量 , such as $value, 大小写敏感
P e r l中的标量变量在你使用它们之前,不必预先进行声明或
初始化。若要创建一个标量变量,只要使用它就行了。

2.3 表达式和运算符 18
2.3.1 基本运算符 18
2.3.2 数字运算符 19

5 + $t 加 5与$ t相加的和
$y - $x 减 $ y与$ x的差
$e * $pi 乘 $ e与$ p i的积
$f / 6 除 $ f除以6得出的商
24 % 5 求余数2 4除以5得出的余数( 4)

$x = $x + 2; ==> $x += 2;
$x = $x - 2; ==> $x -= 2;
4 * * 2 取幂取4的二次方


2.3.3 字符串运算符 19
2.4 其他运算符 20
r a n d r a n d(5) 返回从0到小于该参数值之间的一个随机数
字。如果该参数被省略,则返回0至1之间的
一个数字
2.4.1 单参数运算符 20
2.4.2 递增和递减 21
2.4.3 尖括号运算符 21
print "what is ur size?";
$size=; #wait for the typing in


2.4.4 其他赋值运算符 22
2.4.5 关于字符串和数字的一些说明 22

[from BlackBook]
逻辑与4.2.20 和逻辑或4.2.21
&&; ||;
print "enter positive number up to 100\n";
while (<>) {
chomp;
if ($_>0 && $_<100 {
print "thank you\n";
}

其他运算符: .. ?: += -= <> ==> <>是的简写


第3学时 控制程序流 26

3.1 语句块 26
3.2 if语句 27
3.2.1 其他关系运算符 28
3.2.2 “真”对于Perl意味着什么 29
3.2.3 逻辑运算符 30
3.3 循环 32
3.3.1 用while进行循环 32
3.3.2 使用for循环 33
for ($a=0; $a<10; $a=$a+2) {
xxx}

,f o r语句的3个组成部分中的每一个都是可有可无的,但是两个分号是必不可少的。
for ( ; $a<10; ) {}

3.4 其他流控制工具 33
3.4.1 奇特的执行顺序 33
3.4.2 明细控制 34
3.4.3 标号 35 label
3.4.4 退出Perl 35
last 推出当前loop; exit;

Note 1:
请注意,在上面这个例子中,为了将一个值赋予$ r,使用一个赋值运算
符=。为了测试$ r的值,使用等式运算符= =。这两个运算符有着很大的差别,
其作用是不同的。在你的程序中不要混淆它们的用法,因为调试非常困难。
请记住,运算符=用于赋值,而= =则用于测试一个等式。
<<<比较数字>>>

= = $x == $y 如果$ x等于$ y,则为真
> $x > $y 如果$ x大于$ y,则为真
< $x < $y 如果$ x小于$ y,则为真
>= $x >= $y 如果$ x大于或者等于$ y,则为真
< = $x <= $y 如果$ x小于或者等于$ y,则为真
! = $x != $y 如果$ x不等于$ y,则为真

<<<比较字母>>>
e q $s eq $t 如果$ s等于$ t,则为真
g t $s gt $t 如果$ s大于$ t,则为真
l t $s lt $t 如果$ s小于$ t,则为真
g e $s ge $t 如果$ s大于或者等于$ t,则为真
l e $s le $t 如果$ s小于或者等于$ t,则为真
n e $s ne $t 如果$ s不等于$ t,则为真



#!/usr/bin/perl -w
############## Structure IF###################
$im=int(rand 10);
print "Pick a number:";
$guess=;
chomp $guess; #don't forget to remove the new line.
if ($guess>$im) {
print "you guess too high\n"
} elsif ($guess<$im) {
print "u guess too low\n"
} else {
print "u got it right\n"
}

$old=0;
$new=$old || "default"; #if old is fault, new equal default
print "$new\n"
#############Loop While #################
$counter=0;
while ($counter < 10> {
print "still countering...\n"
$counter++
}

#############Loop for #################
for {$a=0; $a<10; $a=$a+2) {
print "a is now $a\n"
}

############Easy way################
if (test_expression) {
expression;
}
same as:
expression if (test_expression)

############last : jump out the loop###########
for ($i=0; $i<100; $i++) {
for ($j=0; $j<100; $j++) {
if ($i*$j ==1400) {
print "the produce is 1400\n";
last
} } }

###########My block############
MYBLOCK: while (1) {
last MYBLOCK;
}


###############EXIT PERL###############

while (1) {
exit 0;
}

第4学时 基本构件的堆栈:列表与数组 39
4.1 将数据放入列表和数组 39
若要创建一个新数组,并用一个项目列表填入该数组,只要编写下面这个代码即可:
@boy=qw(Greg Peter Bobby);
使用该运算符后,你就不必键入6个引号和2个逗号
数组变量可以与标量变量使用相同的名字,例如,$ n a m e s与@ n a m e s可以指不同的东西,$ n a m e s指一个标量变量,而@ n a m e s则指一个数组
4.2 从数组中取出元素 41
@trees=qw(oad cedar maple);
print $trees[2];
print "@trees"; #print whole array
4.2.1 寻找结尾 42=> $#array is the last member of the array.
4.2.2 关于上下文的详细说明 43
$a=$b; # Scalar on the left: this is scalar context.
@foo=@bar; # Array on the left: this is list context
($a)=@foo; # List on the left: this is also list context.
$b=@bar; # Scalar on the left: this is scalar context. 数组bar的最后element的索引号。

例子2;
$a=@foo;
$b=$#foo;
print "$a\n";
print "$b\n";
在该代码的结尾, $ a包含数字4,$ b包含数字3。为什么会出现这个差别呢?因为@ f o o是
在标量上下文中运行的,它返回$ a的元素的数量。$ b设置为最后一个元素的索引号,而索引
是从0开始计数的。

4.2.3 回顾以前的几个功能 44
4.3 对数组进行操作 45
4.3.1 遍历数组 46
4.3.2 在数组与标量之间进行转换 46
4.3.3 给数组重新排序 48

#!/usr/bin/perl -w
@foo=qw(water pepsi coke lemonade );
$a=@foo; #number of the list, 4
$b=$#foo; #number of last items in the list
print "$a\n";
print "$b\n";

if (@foo) { #array has 4 elements, true
print "the array has elements\n";
}

#############
@pets=('cat', 'dog', 'fish',);#understood
$last_pets=('cat', 'dog', 'fish',); #when left side is scalar, that means the last items in the list


#########
foreach $cone (@flavor) {
print "i's like a cone of $cone\n";
}



第5学时 进行文件操作 53
5.1 打开文件 53
P e r l中的文件句柄实际上是另一种类型的变量;,不同之处是句柄的名字前面没有类型标识符( $、@)。由
于这个原因,句柄名字最好使用大写字母
open (FILEHANDLER, pathname)
ex: open(MYTEXT, "novel.txt") ||die
close (MYTEXT);
5.1.1 路径名 54
5.1.2 出色的防错措施 55
5.1.3 以适当的方式运行die函数 56
5.2 读取文件 56
5.3 写入文件 58
5.4 自由文件、测试文件和二进制数据 60
5.4.1 自由文件句柄 60
5.4.2 二进制文件 60
5.4.3 文件测试运算符 61

open (MYFILE, "novel.txt") || die "Can't open: $!";
$line=;

######samele : FILE in WHILE loop#######
while () {
print $_;
}

sample 2:
open (MYFILE, "novel.txt") || die "Can't open: $!";
@contents=;
close (MYFILE);

####write to or append to#####
open (NEWFILE, ">output.txt");
open (NEWFILE, ">>output.txt");



####STDIN, STDOUT and STDERR####
$guess=;
...



第6学时 模式匹配 64
6.1 简单的模式 64
$pat=; chomp $pat;
$_="The phrase that pays";
if (/$pat/) { #Look for the user's pattern
print "\"$_\" contains the pattern $pat\n";
}

sample from BlackBook
[root@localhost ~]# perl -
while(<>) {
if (m/exit/i) {exit;} #/i, means don't care small or capital.
}
__END__
abc
exi
exit

=====
sample 2:
while ($line = <>) {
if ($line =~ m/exit/i) {exit;}
}
__END__
abc
exit



6.2 元字符 66
6.2.1 一个简单的元字符 66
6.2.2 非输出字符 66
6.2.3 通配符 66
6.2.4 字符类 68
6.2.5 分组和选择 69
6.2.6 位置通配符 69
6.3 替换 70
s/searchpattern/replacement/;
6.4 练习:清除输入数据 70
6.5 关于模式匹配的其他问题 71
6.5.1 对其他变量进行操作 71
6.5.2 修饰符与多次匹配 72
6.5.3 反向引用 73
6.5.4 一个新函数:grep 73
1, easy mode:
m/Simon/: find Simon in $_. 标量变量$
m/I won \$10 at the fair/; #the $ is treated as a literal dollar-sign.
if (m:/usr/local/bin/hangman:) { printn "found the hangmann game"}
if (/$pat/) #
如果将模式括起来的字符(称为界限符)是斜杠,那么编写模式匹配代码时也可以不带m。
因此,也可以将m / C h e e t o s写成/ C h e e t o s /

/ x { 5,10}/ x至少出现5次,但是不超过1 0次。

2, 分组和选择
if (/dogs|cats/) {
print "\$_ contains a ets"
}

第7学时 哈希结构 77

数组与哈希的差别是:哈希是按照名字来访问它们的标量的,而不是像数组那样使用数字标号进行访问

7.1 将数据填入哈希结构 77
$food{'apple'} = 'fruit';
$food{'pear'} = 'fruit';
$food{'carrot'} = 'vegetable';
7.2 从哈希结构中取出数据 78
%Movies = ( 'The Shining' => 'Kubrick', 'Ten Commandments' => 'DeMille', Goonies =>
'Spielberg');
print $Movies{'The Shining'};

7.3 列表与哈希结构 80
7.4 关于哈希结构的补充说明 81
7.4.1 测试哈希结构中的关键字 81
7.4.2 从哈希结构中删除关键字 81
7.5 用哈希结构进行的有用操作 81
7.5.1 确定频率分布 82
7.5.2 在数组中寻找惟一的元素 82
7.5.3 寻找两个数组之间的交汇部分
和不同部分 83
7.5.4 对哈希结构进行排序 84

$book {Dune}='Frank";
%food=(apple => 'fruint,, pear => 'fruit,);
=> 逗号箭头运算符之所以叫做这个名字,原因是它的作用类似于逗号(当
它用于分隔列表的项目时),并且它看上去像个箭头。


第8学时 函数 89
8.1 创建和调用子例程 89
8.1.1 返回子例程的值 90
8.1.2 参数 91
在子例程中,被传递的参数可以通过P e r l的特殊变量@ 来访问。下面这个代码段显示了
为函数传递参数(3个字符串直接量)和输出参数的情况:
sub printargs {
print join(',', @_); #将传递进来的参数放入数组@_中
}
printargs('market', 'home', 'roast beef');

访问数组元素: print $_[2]
若要像下面这个例子中那样,访问传递过来的各个参数,可以使用数组@ 上的下标,就
像你对任何其他数组操作时那样。请记住, $ [ 0 ](@ 的一个下标)与标量变量$ 毫不相干:

8.1.3 传递数组和哈希结构 91
sub Subroutine_name {
statementn1;
:
statementnx;
}

sample:
sub yesno {
print "r u sure";
$annswer=
}

yesno ();

============
sub two_by_four {
2*4;
}
print 8*two_by_four ();



===========
要传递子例程的参数
被传递的参数可以通过P e r l的特殊变量@ 来访问。
请记住, $ [ 0 ](@ 的一个下标)与标量变量$ 毫不相干:
sub print_3_argumennt {
print $_[2];
}

sub display_score {
($hits, $bat)=@_;
}
display_score (50, 210);

===
sub moonweight {
($weight)= @_;
return ($weight/6);
}
print moonweight (150);
。按照默认设置,
在你的程序的主体中和子例程中, P e r l的变量是可视的,这些类型的变量称为全局变量。
你要做的工作是使变量成为函数的专用变量。为此,必须使用m y操作符:

8.2 作用域 92
8.3 练习:统计数字 94
8.4 函数的脚注 96
8.4.1 声明local变量 96
8.4.2 使Perl变得更加严格 97
8.4.3 递归函数 98
8.5 课时小结 99
8.6 课外作业 99
8.6.1 专家答疑 99
8.6.2 思考题 99
8.6.3 解答 100
8.6.4 实习 100


第二部分 高级特性
第9学时 其他函数和运算符 103
9.1 搜索标量 103
9.1.1 用index进行搜索 103可以给i n d e x函数规定一个字符串中开始进行搜索的起始位置,如下面的例子
显示的那样。若要从左边开始搜索,使用的起始位置是0:
$reindeer="dasher dancer prancer vixen";
index($reindeer, "da"); # Returns 0, 默认从0开始
index($reindeer, "da", 1); # Returns 7, 从1开始
9.1.2 用rindex向后搜索 104
9.1.3 用substr分割标量 104
s u b s t r函数取出s t r i n g,从位置o ff s e t开始运行,并返回从o ff s e t到结尾的字符串的剩余部分
#Character positions in $a
# 0 10 20 30
$a="I do not like green eggs and ham.";
print substr($a, 25); # prints "and ham."
print substr($a, 14, 5); # prints "green"

9.2 转换而不是替换 105
9.3 功能更强的print函数 106
9.4 练习:格式化报表 107
9.5 堆栈形式的列表 109
9.6 课时小结 110
9.7 课外作业 111
9.7.1 专家答疑 111
9.7.2 思考题 111
9.7.3 解答 112
9.7.4 实习 112

第10学时 文件与目录 113
10.1 获得目录列表 113
10.2 练习:UNIX的grep 116
1: #!/usr/bin/perl -w #-w, warning
2:
3: use strict; #strict mode, 要先声明标量
4:
5: print "Directory to search: ";
6: my $dir=; chomp $dir;
7: print "Pattern to look for: ";
8: my $pat=; chomp $pat;
9:
10: my($file);
11:
12: opendir(DH, $dir) || die "Cannot open $dir: $!";
13: while ($file=readdir DH) { #readdir, 函数名
14: next if (-d "$dir/$file"); #确实是目录本身( - d)的任何目录条目均被拒绝。请注意,被核实的路 径名 是$ d i r / $ f i l e。核实该路径是必要的,因为当前目录中不一定存在$ f i l e,它存在于$ d i r中。因此该文件的全路径名是$ d i r / $ f i l e
15: if (! open(F, "$dir/$file") ) { #如果无法打开文件
16: warn "Cannot search $file: $!";
17: next;
18: }
19: while() {
20: if (/$pat/) {
21: print "$file: $_";
22: }
23: }
24: close(F);
25: }
26: closedir(DH);
10.3 目录 117
10.3.1 浏览目录 117
10.3.2 创建和删除目录 118
10.3.3 删除文件 119
10.3.4 给文件改名 119
10.4 UNIX系统 120
10.5 你应该了解的关于文件的所有信息 121
10.6 练习:对整个文件改名 122
1: #!/usr/bin/perl -w
2:
3: use strict;
4:
5: my($dir, $oldpat, $newpat);
6: print "Directory: ";
7: chomp($dir=);
8: print "Old pattern: ";
9: chomp($oldpat=);
10: print "New pattern: ";
11: chomp($newpat=);
12:
13: opendir(DH, $dir) || die "Cannot open $dir: $!";
14: my @files=readdir DH; #第1 3 ~ 1 5行:$ d i r指明的目录中的条目被读入@ f i l e s。
15: close(DH);
16: my $oldname;
17: foreach(@files) {
18: $oldname=$_;
19: s/$oldpat/$newpat/;
#第1 7 ~ 1 9行:来自@ f i l e s的每个文件均被赋给$ _,并且该名字被保存在$ o l d n a m e中。然
后,$_中的原始文件名被改为1 9行上的新名字。
20: next if (-e "$dir/$_");
21: if (! rename "$dir/$oldname", "$dir/$_") {
22: warn "Could not rename $oldname to $_: $!"
23: } else {
24: print "File $oldname renamed to $_\n";
25: }
26: }

第11学时 系统之间的互操作性 126
11.1 system()函数 126
11.2 捕获输出 128
11.3 管道 129
11.4 可移植性入门 131

system command

system ("ls -l");

这个方法很麻烦,不是一个十分聪明的办法。P e r l有另外一个方法处理这个问题,即反引
号。用反引号( ` `)括起来的任何命令均由P e r l作为外部命令来运行,就像通过s y s t e m运行的
一样,其输出被捕获,并且作为反引号的返回值返回。

$directory=`dir`;
@dir=`dir`;
foreach (@dir) {
#process each line
}
======
管道

dir > oldfile
sort oldfile > newfile
more newfile

====> Better way:
dir | sort | more

第12学时 使用Perl的命令行工具 137
12.1 什么是调试程序 137
12.1.1 启动调试程序 137
12.1.2 调试程序的基本命令 138
12.1.3 断点 139
12.1.4 其他调试程序命令 140
12.2 练习:查找错误 141
12.3 其他命令行特性 142
12.3.1 单命令行程序 142
12.3.2 其他开关 143
12.3.3 空的尖括号与更多的单命令
行程序 144
12.4 课时小结 145
12.5 课外作业 145
12.5.1 专家答疑 145
12.5.2 思考题 146
12.5.3 解答 146

第13学时 引用与结构 147
13.1 引用的基本概念 147
13.1.1 对数组的引用 149
13.1.2 对哈希结构的引用 149
13.1.3 作为参数的引用 150
13.1.4 创建各种结构 151
13.2 结构的配置方法 152
13.2.1 一个例子:列表中的列表 152
13.2.2 其他结构 153
13.2.3 使用引用来调试程序 154
13.3 练习:另一个游戏——迷宫 155
13.4 课时小结 157
13.5 课外作业 157
13.5.1 专家答疑 157
13.5.2 思考题 158
13.5.3 解答 158
13.5.4 实习 158

第14学时 使用模块 159
14.1 模块的概述 159
14.1.1 读取关于模块的文档 160
#perldoc Cwd
#perldoc Socket
在这个例子中,C w d模块实际上允许你使用3个新函数,即c w d、g e t c w d和f a s t g e t c w d。如
果你想使用这些函数,请阅读关于C w d模块的文档。

14.1.2 什么地方可能出错 161
14.2 已安装模块简介 162
14.2.1 文件和目录简介 162
14.2.2 拷贝文件 164
14.2.3 用于通信的Perl模块 164
14.2.4 使用English模块 165
14.2.5 diagnostics模块 165
14.3 标准模块的完整列表 166
14.4 课时小结 167
14.5 课外作业 167
14.5.1 专家答疑 167
14.5.2 思考题 168
14.5.3 解答 168
14.5.4 实习 168


第15学时 了解程序的运行性能 169
15.1 DBM文件 169
15.1.1 需要了解的重点 170
15.1.2 遍历与DBM文件相连接的哈
希结构 170
15.2 练习:一种自由格式备忘记事板 171
15.3 将文本文件用作数据库 173
15.4 随机访问文件 175
15.4.1 打开文件进行读写操作 175
15.4.2 在读写文件中移动 176
15.5 锁定文件 176
15.5.1 锁定UNIX和NT下的文件 178
15.5.2 在加锁情况下进行读写操作 179
15.5.3 Windows 95和Windows 98下的
加锁问题 180 15.5.4 在其他地方使用文件锁的问题 181
15.6 课时小结 181
15.7 课外作业 181
15.7.1 专家答疑 181
15.7.2 思考题 182
15.7.3 解答 182
15.7.4 实习 182


第16学时 Perl语言开发界 183
16.1 Perl究竟是一种什么语言 183
16.1.1 Perl的简单发展历史 183
16.1.2 开放源 184
16.1.3 Perl的开发 185
16.2 Perl综合存档文件网 185
16.2.1 什么是CPAN 186
16.2.2 为什么人们愿意提供自己的开
发成果 186
16.3 下一步你要做的工作 187
16.3.1 要做的第一步工作 187
16.3.2 最有用的工具 187
16.3.3 查找程序中的错误 188
16.3.4 首先要靠自己来解决问题 188
16.3.5 从别人的程序错误中吸取教训 189
16.3.6 请求他人的帮助 190
16.4 其他资源 191
16.5 课时小结 192
16.6 课外作业 192
16.6.1 专家答疑 192
16.6.2 思考题 192
16.6.3 解答 192

第三部分 将Perl用于CGI
第17学时 CGI概述 195
17.1 浏览Web 195
17.1.1 检索一个静态Web页 196
17.1.2 动态Web页—使用CGI 197
17.2 不要跳过这一节内容 198
17.3 编写你的第一个CGI程序 199
17.3.1 在服务器上安装CGI程序 200
17.3.2 运行你的CGI程序 201
17.4 CGI程序无法运行时怎么办 201
17.4.1 这是你的CGI程序吗 201
17.4.2 服务器存在的问题 202
17.4.3 排除服务器内部错误或500错误 203
17.5 课时小结 204
17.6 课外作业 204
17.6.1 专家答疑 204
17.6.2 思考题 205
17.6.3 解答 205
17.6.4 实习 206


第18学时 基本窗体 207
18.1 窗体是如何运行的 207
18.1.1 HTML窗体元素概述 207
18.1.2 单击submit时出现的情况 208
18.2 将信息传递给你的CGI程序 209
18.3 Web安全性 211
18.3.1 建立传输明码文本的连接 211
18.3.2 注意不安全数据 212
18.3.3 从事无法执行的操作 213
18.3.4 拒绝服务 213
18.4 宾客留言簿 214
18.5 课时小结 215
18.6 课外作业 215
18.6.1 专家答疑 215
18.6.2 思考题 216
18.6.3 解答 216
18.6.4 实习 216


第19学时 复杂窗体 217
19.1 复杂的多页窗体 217
19.2 隐藏域 217
19.3 多页调查窗体 219
19.4 课时小结 224
19.5 课外作业 224
19.5.1 专家答疑 224
19.5.2 思考题 225
19.5.3 解答 225
19.5.4 实习 225

第20学时 对HTTP和CGI进行操作 226
20.1 HTTP通信概述 226
20.1.1 举例:人工检索Web页 227
20.1.2 举例:返回非文本信息 228
20.2 如何调用CGI程序的详细说明 230
20.2.1 将参数传递给CGI程序 230
20.2.2 特殊参数 231
20.3 服务器端的包含程序 232
20.4 部分环境函数简介 234
20.5 重定向 235
20.6 课时小结 237
20.7 课外作业 237
20.7.1 专家答疑 237
20.7.2 思考题 237
20.7.3 解答 238
20.7.4 实习 238


第21学时 cookie 239
21.1 什么是cookie 239
21.1.1 如何创建cookie 240
21.1.2 举例:使用cookie 241
21.1.3 另一个例子:cookie查看器 242
21.2 高级cookie特性 243
21.2.1 设置cookie终止运行的时间 243
21.2.2 cookie的局限性 244
21.2.3 将cookie发送到其他地方 244
21.2.4 限制cookie返回到的位置 246
21.2.5 带有安全性的cookie 247
21.3 cookie存在的问题 247
21.3.1 cookie的生存期很短 247
21.3.2 并非所有浏览器都支持cookie 247
21.3.3 有些人不喜欢cookie 247
21.4 课时小结 248
21.5 课外作业 248
21.5.1 专家答疑 248
21.5.2 思考题 249
21.5.3 解答 250
21.5.4 实习 250


第22学时 使用CGI程序发送电子邮件 251
22.1 Internet邮件入门 251
22.1.1 发送电子邮件 252
22.1.2 发送邮件时首先应该注意的问题 252
22.2 邮件发送函数 253
22.2.1 用于UNIX系统的邮件函数 254
22.2.2 用于非UNIX系统的邮件函数 255
22.3 从Web页发送邮件 257
22.4 课时小结 259
22.5 课外作业 259
22.5.1 专家答疑 259
22.5.2 思考题 260
22.5.3 解答 260
22.5.4 实习 260


第23学时 服务器推送和访问次数计数器 261
23.1 什么是服务器推送 261
23.1.1 激活服务器推送特性 262
23.1.2 一个小例子:更新Web页上
的时钟 262
23.1.3 另一个例子:动画 263
23.1.4 客户机拖拉技术 264
23.2 访问次数计数器 264
23.2.1 编写一个访问次数计数器程序 266
23.2.2 图形访问次数计数器 267
23.3 课时小结 268
23.4 课外作业 269
23.4 1 专家答疑 269
23.4.2 思考题 269
23.4.3 解答 269
23.4.4 实习 270


第24学时 建立交互式Web站点 271
24.1 借用另一个站点的内容 271
24.1.1 注意内容的版权问题 271
24.1.2 举例:检索标题 272
24.2 调查窗体 275
24.2.1 调查窗体程序的第一部分:
提出问题 276
24.2.2 调查窗体程序的第二部分:
计算调查结果 277
24.3 课时小结 280
24.4 课外作业 280
24.4.1 专家答疑 280
24.4.2 思考题 281
24.4.3 解答 281
24.4.4 实习 281

第四部分 附录
附录 安装模块 285

a, perl -MCPAN -e shell (error: can't locate CPAN.pm)
#yum install perl-CPAN

Q&A
1, 如何检查语法?
a, perl -
print "hello\n";
__END__
==>hello
b, perl -e 'print "hello "; "there\n"'
==>hello there
c, perl -c firemissile.pl
==>只检查,不执行

2, 表和字符串
由表到串join =》 print join (":", "12","00");
12:00
由串到表split=>print ((split " ", "now is the time")[3]);
time

Howto sendmail on FC6

Link

-a, make sure DNS works fine first
-b, GUI install sendmail (m4, sendmail-cf and sendmail)
-c, service sendmail restart
-d, make sendmail to listen NICs
Edit /etc/mail/sendmail.mc To Make Sendmail Listen On NICs Too

To correct this you'll have to comment out the daemon_options line in the /etc/mail/sendmail.mc file with "dnl" statements. It is also good practice to take precautions against SPAM by not accepting mail from domains that don't exist by commenting out the "accept_unresolvable_domains" feature too. See the italicized lines in the example below.



dnl This changes sendmail to only listen on the loopback device 127.0.0.1
dnl and not on any other network devices. Comment this out if you want
dnl to accept email over the network.
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
dnl NOTE: binding both IPv4 and IPv6 daemon to the same port requires
dnl a kernel patch
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')
dnl We strongly recommend to comment this one out if you want to protect
dnl yourself from spam. However, the laptop and users on computers that do
dnl not have 24x7 DNS do need this.
dnl FEATURE(`accept_unresolvable_domains')dnl
dnl FEATURE(`relay_based_on_MX')dnl



-e, Regenerate The sendmail.cf File
[root@bigboy tmp]# m4 /etc/mail/sendmail.mc > /etc/sendmail.cf.



-f, support SMTPs on sendmail: EASY!!!
for FC6, 1,#cd /etc/pki/tls/certs
2, make sendmail.pem
3, Carefully edit the corresponding lines in /etc/mail/sendmail.mc to match the following:

define(`confAUTH_OPTIONS', `A p y')dnl
TRUST_AUTH_MECH(`LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl
define(`confCACERT_PATH',`/usr/share/ssl/certs')
define(`confCACERT',`/usr/share/ssl/certs/ca-bundle.crt')
define(`confSERVER_CERT',`/usr/share/ssl/certs/sendmail.pem')
define(`confSERVER_KEY',`/usr/share/ssl/certs/sendmail.pem')

4, regenerate the config file and restart the service
LINK

Friday, February 20, 2009

Howto resize the VNC window on FC6

a, uncomment the first 2 lines in /root/.vnc/xstart
if no this folder, try the command vncserver -geometry xx

b, #vncserver -geometry 1024x768
c, kill -9 vncProcess
d, [root@localhost .vnc]# rm -f /tmp/.X1-lock
[root@localhost .vnc]# rm -f /tmp/.X11-unix/X1
[root@localhost .vnc]# vncserver -geometry 1024x768
e, try again

Thursday, January 29, 2009

Howto DNS on FC6
a, Start the daemon==> service named restart
b, check the log ==> grep named /var/log/messages

loading configuration from '/etc/named.caching-nameserver.conf'
Jan 29 14:52:57 localhost named[1042]: listening on IPv6 interface lo, ::1#53
Jan 29 14:52:57 localhost named[1042]: listening on IPv4 interface lo, 127.0.0.1#53
Jan 29 14:52:57 localhost named[1042]: command channel listening on 127.0.0.1#953
Jan 29 14:52:57 localhost named[1042]: command channel listening on ::1#953
Jan 29 14:52:57 localhost named[1042]: zone 0.in-addr.arpa/IN: loaded serial 42
Jan 29 14:52:57 localhost named[1042]: zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
Jan 29 14:52:57 localhost named[1042]: zone 255.in-addr.arpa/IN: loaded serial 42
Jan 29 14:52:57 localhost named[1042]: zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded
serial 1997022700
Jan 29 14:52:57 localhost named[1042]: zone example.com/IN: loaded serial 2004121302
Jan 29 14:52:57 localhost named[1042]: zone qa-test.com/IN: loaded serial 2004121302
Jan 29 14:52:57 localhost named[1042]: zone localdomain/IN: loaded serial 42
Jan 29 14:52:57 localhost named[1042]: zone localhost/IN: loaded serial 42
Jan 29 14:52:57 localhost named[1042]: running

c, so the config is /etc/named.caching-nameserver.conf
d, add the zone you need to resolve in the above config
zone "example.com" {
type master;
file "pri.example.com";
};

zone "qa-test.com" {
type master;
file "qa-test.com";
};

zone "9.18.172.in-addr.arpa" IN {
type master;
file "172.18.9";
};

include "/etc/rndc.key";
==================================
e, add the file under the folder /var/named/chroot/var/named==> qa-test.com;pri.example.com
[root@localhost named]# more qa-test.com
$TTL 86400
@ IN SOA ns1.qa-test.com. hostmaster.qa-test.com. (
2004121302 ; serial, todays date + todays serial #
28800 ; refresh, seconds
7200 ; retry, seconds
604800 ; expire, seconds
86400 ) ; minimum, seconds
;
NS ns1.qa-test.com. ; Inet Address of name server 1
NS ns2.qa-test.com. ; Inet Address of name server 2
;

MX 10 mail.qa-test.com.

qa-test.com. A 172.18.9.28
bigsrv A 172.18.9.154
fc4 A 172.18.9.24




root@localhost named]# pwd
/var/named/chroot/var/named
[root@localhost named]# more 172.18.9
$TTL 86400
@ IN SOA fc4.qa-test.com. root.fc4.qa-test.com (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS fc4.qa-test.com
154 IN PTR bigsrv.qa-test.com
24 IN PTR fc4.qa-test.com

[root@localhost named]#


==================
f, the meaning of domain in the resolve.conf
without it:
[root@localhost ~]# nslookup bigsrv
Server: 127.0.0.1
Address: 127.0.0.1#53

** server can't find bigsrv: NXDOMAIN

[root@localhost ~]#

Add it:
domain qa-test.com
nameserver 127.0.0.1

[root@localhost ~]# nslookup bigsrv
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: bigsrv.qa-test.com
Address: 172.18.9.154
===================================

Monday, January 26, 2009

Howto SNMP in FortiOS


1, the command to check all OID with one command:
snmpwalk -v2c -c public 172.18.9.105
SNMPv2-MIB::sysDescr.0 = STRING: abc
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.12356.101.1.50011
SNMPv2-MIB::sysUpTime.0 = Timeticks: (24974276) 2 days, 21:22:22.76
SNMPv2-MIB::sysContact.0 = STRING: abcd
SNMPv2-MIB::sysName.0 = STRING: 5050-slot5
SNMPv2-MIB::sysLocation.0 = STRING: abc
SNMPv2-MIB::sysServices.0 = INTEGER: 78
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORIndex.1 = INTEGER: 1


2, SNMP trap:
fortimangager trapconsole

3, get FortiOS-MIB from snmpwalk
-a, copy the mib file to /usr/share/snmp/mibs
-b, snmpwalk -v2c -m FORTIOS-300-MIB.mib -c public 172.18.9.105
-c, [root@localhost mibs]# snmpwalk -m ./FORTIOS-300-MIB.mib -v2c -c public 172.18.9.103 fnIntf
-d, snmpwalk -v2c -c public 172.18.9.103 mib-2

Sample:
[root@localhost mibs]# snmpwalk -m ./FORTIOS-300-MIB.mib -v2c -c public 172.18.9.105 fortinet
FORTIOS-300-MIB::fnSysModel.0 = INTEGER: fgt5001A(50011)
FORTIOS-300-MIB::fnSysSerial.0 = STRING: FG5A013E08600068
FORTIOS-300-MIB::fnSysVersion.0 = STRING: Fortigate-5001A 3.00,build6421,090107
FORTIOS-300-MIB::fnSysVersionAv.0 = STRING: 9.00795(2008-12-08 15:09)
FORTIOS-300-MIB::fnSysVersionNids.0 = STRING: 2.00461(2008-01-18 11:23)
FORTIOS-300-MIB::fnSysHaMode.0 = INTEGER: standalone(1)
FORTIOS-300-MIB::fnSysOpMode.0 = INTEGER: nat(1)
FORTIOS-300-MIB::fnSysCpuUsage.0 = Gauge32: 1
FORTIOS-300-MIB::fnSysMemUsage.0 = Gauge32: 10
FORTIOS-300-MIB::fnSysSesCount.0 = Gauge32: 5
FORTIOS-300-MIB::fnSysDiskCapacity.0 = Gauge32: 0
FORTIOS-300-MIB::fnSysDiskUsage.0 = Gauge32: 0
FORTIOS-300-MIB::fnSysMemCapacity.0 = Gauge32: 3092960
FORTIOS-300-MIB::fnHaGroupId.0 = INTEGER: 0
FORTIOS-300-MIB::fnHaPriority.0 = INTEGER: 128
FORTIOS-300-MIB::fnHaOverride.0 = INTEGER: disabled(1)
FORTIOS-300-MIB::fnHaAutoSync.0 = INTEGER: enabled(2)
FORTIOS-300-MIB::fnHaSchedule.0 = INTEGER: 2147480725
FORTIOS-300-MIB::fnHaStatsIndex.1 = INTEGER: 1
FORTIOS-300-MIB::fnHaStatsSerial.1 = STRING: FG5A013E08600068
FORTIOS-300-MIB::fnHaStatsCpuUsage.1 = Gauge32: 1
FORTIOS-300-MIB::fnHaStatsMemUsage.1 = Gauge32: 10
FORTIOS-300-MIB::fnHaStatsNetUsage.1 = Gauge32: 12
FORTIOS-300-MIB::fnHaStatsSesCount.1 = Gauge32: 5
FORTIOS-300-MIB::fnHaStatsPktCount.1 = Counter32: 19204
FORTIOS-300-MIB::fnHaStatsByteCount.1 = Counter32: 1507380
FORTIOS-300-MIB::fnHaStatsIdsCount.1 = Counter32: 0
FORTIOS-300-MIB::fnHaStatsAvCount.1 = Counter32: 0
FORTIOS-300-MIB::fnHaStatsHostname.1 = STRING:
FORTIOS-300-MIB::fnHaGroupName.0 = STRING: FGT-HA
FORTIOS-300-MIB::fnAdminNumber.0 = INTEGER: 1
FORTIOS-300-MIB::fnAdminIndex.1 = INTEGER: 1
FORTIOS-300-MIB::fnAdminName.1 = STRING: admin
FORTIOS-300-MIB::fnAdminAddr.1 = IpAddress: 0.0.0.0
FORTIOS-300-MIB::fnAdminMask.1 = IpAddress: 0.0.0.0
FORTIOS-300-MIB::fnAdminVdom.1 = INTEGER: 1
FORTIOS-300-MIB::fnUserNumber.0 = INTEGER: 0
FORTIOS-300-MIB::fnOptIdleTimeout.0 = INTEGER: 480
FORTIOS-300-MIB::fnOptAuthTimeout.0 = INTEGER: 5
FORTIOS-300-MIB::fnOptLanguage.0 = INTEGER: english(1)
FORTIOS-300-MIB::fnOptLcdProtection.0 = INTEGER: disabled(1)
FORTIOS-300-MIB::fnHwSensorCount.0 = INTEGER: 0
FORTIOS-300-MIB::fnVdNumber.0 = INTEGER: 2
FORTIOS-300-MIB::fnVdEntIndex.1 = INTEGER: 1
FORTIOS-300-MIB::fnVdEntIndex.2 = INTEGER: 2
FORTIOS-300-MIB::fnVdEntName.1 = STRING: root
FORTIOS-300-MIB::fnVdEntName.2 = STRING: top3-967
FORTIOS-300-MIB::fnVdEntOpMode.1 = INTEGER: nat(1)
FORTIOS-300-MIB::fnVdEntOpMode.2 = INTEGER: nat(1)
FORTIOS-300-MIB::fnVdMaxVdoms.0 = INTEGER: 10
FORTIOS-300-MIB::fnVdEnabled.0 = INTEGER: enabled(2)
FORTIOS-300-MIB::fnIntfEntVdom.1 = INTEGER: 1
FORTIOS-300-MIB::fnIntfEntVdom.2 = INTEGER: 1
FORTIOS-300-MIB::fnIntfEntVdom.3 = INTEGER: 1
FORTIOS-300-MIB::fnIntfEntVdom.4 = INTEGER: 1
FORTIOS-300-MIB::fnIntfEntVdom.5 = INTEGER: 1
FORTIOS-300-MIB::fnIntfEntVdom.6 = INTEGER: 1
FORTIOS-300-MIB::fnIntfEntVdom.7 = INTEGER: 1
FORTIOS-300-MIB::fnIntfEntVdom.8 = INTEGER: 1
FORTIOS-300-MIB::fnIntfEntVdom.9 = INTEGER: 2
FORTIOS-300-MIB::fnIntfEntVdom.10 = INTEGER: 1
FORTIOS-300-MIB::fnIntfEntVdom.11 = INTEGER: 1
FORTIOS-300-MIB::fnIntfEntVdom.12 = INTEGER: 2
FORTIOS-300-MIB::fnIntfEntVdom.13 = INTEGER: 2
FORTIOS-300-MIB::fnFwPolicyPktCount.2.1 = Counter32: 0
FORTIOS-300-MIB::fnFwPolicyPktCount.2.2 = Counter32: 0
FORTIOS-300-MIB::fnFwPolicyByteCount.2.1 = Counter32: 0
FORTIOS-300-MIB::fnFwPolicyByteCount.2.2 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsVdomIndex.1 = INTEGER: 1
FORTIOS-300-MIB::fnVpnSslStatsVdomIndex.2 = INTEGER: 2
FORTIOS-300-MIB::fnVpnSslState.1 = INTEGER: disabled(1)
FORTIOS-300-MIB::fnVpnSslState.2 = INTEGER: disabled(1)
FORTIOS-300-MIB::fnVpnSslStatsLoginUsers.1 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsLoginUsers.2 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsMaxUsers.1 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsMaxUsers.2 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsActiveWebSessions.1 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsActiveWebSessions.2 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsMaxWebSessions.1 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsMaxWebSessions.2 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsActiveTunnels.1 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsActiveTunnels.2 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsMaxTunnels.1 = Counter32: 0
FORTIOS-300-MIB::fnVpnSslStatsMaxTunnels.2 = Counter32: 0
Error in packet.
Reason: (genError) A general failure occured
Failed object: FORTIOS-300-MIB::fnVpnSslStatsMaxTunnels.2

Friday, January 23, 2009

http://www.goldfish.org/books/TCPIP%20Illustrated%20Vol%201/index.htm

Wednesday, January 21, 2009

Inauguration speech from CNN

Link For Download youtube

My fellow citizens:
我的同胞们:


I stand here today humbled by the task before us, grateful for the trust you have bestowed, mindful of the sacrifices borne by our ancestors. I thank President Bush for his service to our nation, as well as the generosity and cooperation he has shown throughout this transition.
今天我站在这里,看到眼前面临的重大任务,深感卑微。我感谢你们对我的信任,也知道先辈们为了这个国家所作的牺牲。我要感谢布什总统为国家做出的贡献,以及感谢他在两届政府过渡期间给与的慷慨协作。


Forty-four Americans have now taken the presidential oath. The words have been spoken during rising tides of prosperity and the still waters of peace. Yet, every so often the oath is taken amidst gathering clouds and raging storms. At these moments, America has carried on not simply because of the skill or vision of those in high office, but because We the People have remained faithful to the ideals of our forbearers, and true to our founding documents.
迄今为止,已经有44个美国总统宣誓就职。总统的宣誓有时面对的是国家的和平繁荣,但通常面临的是乌云密布的紧张形势。在紧张的形势中,支持美国前进的不仅仅是领导人的能力和远见,也在于美国人民对国家先驱者理想的信仰,以及对美国立国文件的忠诚。


So it has been. So it must be with this generation of Americans.
前辈们如此,我们这一代美国人也要如此。


That we are in the midst of crisis is now well understood. Our nation is at war, against a far-reaching network of violence and hatred. Our economy is badly weakened, a consequence of greed and irresponsibility on the part of some, but also our collective failure to make hard choices and prepare the nation for a new age. Homes have been lost; jobs shed; businesses shuttered. Our health care is too costly; our schools fail too many; and each day brings further evidence that the ways we use energy strengthen our adversaries and threaten our planet.
现在我们都深知,我们身处危机之中。我们的国家在战斗,对手是影响深远的暴力和憎恨;国家的经济也受到严重的削弱,原因虽有一些人的贪婪和不负责任,但更为重要的是我们作为一个整体在一些重大问题上决策失误,同时也未能做好应对新时代的准备。我们的人民正在失去家园,失去工作,很多且要倒闭。社会的医疗过于昂贵、学校教育让许多人失望,而且每天都会有新的证据显示,我们利用能源的方式助长了我们的敌对势力,同时也威胁着我们的星球。


These are the indicators of crisis, subject to data and statistics. Less measurable but no less profound is a sapping of confidence across our land - a nagging fear that America’s decline is inevitable, and that the next generation must lower its sights.
统计数据的指标传达着危机的消息。危机难以测量,但更难以测量的是其对美国人国家自信的侵蚀——现在一种认为美国衰落不可避免,我们的下一代必须低调的言论正在吞噬着人们的自信。


Today I say to you that the challenges we face are real. They are serious and they are many. They will not be met easily or in a short span of time. But know this, America - they will be met.
今天我要说,我们的确面临着很多严峻的挑战,而且在短期内不大可能轻易解决。但是我们要相信,我们一定会度过难关。


On this day, we gather because we have chosen hope over fear, unity of purpose over conflict and discord.
今天,我们在这里齐聚一堂,因为我们战胜恐惧选择了希望,摒弃了冲突和矛盾而选择了团结。


On this day, we come to proclaim an end to the petty grievances and false promises, the recriminations and worn out dogmas, that for far too long have strangled our politics.
今天,我们宣布要为无谓的摩擦、不实的承诺和指责画上句号,我们要打破牵制美国政治发展的若干陈旧教条。



We remain a young nation, but in the words of Scripture, the time has come to set aside childish things. The time has come to reaffirm our enduring spirit; to choose our better history; to carry forward that precious gift, that noble idea, passed on from generation to generation: the God-given promise that all are equal, all are free, and all deserve a chance to pursue their full measure of happiness.
美国仍是一个年轻的国家,借用《圣经》的话说,放弃幼稚的时代已经到来了。重拾坚韧精神的时代已经到来,我们要为历史作出更好的选择,我们要秉承历史赋予的宝贵权利,秉承那种代代相传的高贵理念:上帝赋予我们每个人以平等和自由,以及每个人尽全力去追求幸福的机会。



In reaffirming the greatness of our nation, we understand that greatness is never a given. It must be earned. Our journey has never been one of short-cuts or settling for less. It has not been the path for the faint-hearted - for those who prefer leisure over work, or seek only the pleasures of riches and fame. Rather, it has been the risk-takers, the doers, the makers of things - some celebrated but more often men and women obscure in their labor, who have carried us up the long, rugged path towards prosperity and freedom.
在重申我们国家伟大之处的同时,我们深知伟大从来不是上天赐予的,伟大需要努力赢得。(我们的民族一路走来),这旅途之中从未有过捷径或者妥协,这旅途也不适合胆怯之人、或者爱安逸胜过爱工作之人、或者单单追求名利之人。这条路是勇于承担风险者之路,是实干家、创造者之路。这其中有一些人名留青史,但是更多的人却在默默无闻地工作着。正是这些人带领我们走过了漫长崎岖的旅行,带领我们走向富强和自由。


For us, they packed up their few worldly possessions and traveled across oceans in search of a new life.
为了我们,先辈们带着微薄的细软,横渡大洋,寻找新生活;


For us, they toiled in sweatshops and settled the West; endured the lash of the whip and plowed the hard earth.
为了我们,先辈们忍辱负重,用血汗浇铸工厂;为了我们,先辈们在荒芜的西部大地辛勤耕作,定居他乡;


For us, they fought and died, in places like Concord and Gettysburg; Normandy and Khe Sanh.
为了我们,先辈们奔赴(独立战争中的)康科德城和葛底斯堡、(二战中的)诺曼底、(越战中的)Khe Sahn,他们征战、死去。


Time and again these men and women struggled and sacrificed and worked till their hands were raw so that we might live a better life. They saw America as bigger than the sum of our individual ambitions; greater than all the differences of birth or wealth or faction.
一次又一次,我们的先辈们战斗着、牺牲着、操劳着,只为了我们可以生活得更好。在他们看来,美国的强盛与伟大超越了个人雄心,也超越了个人的出身、贫富和派别差异。



This is the journey we continue today. We remain the most prosperous, powerful nation on Earth. Our workers are no less productive than when this crisis began. Our minds are no less inventive, our goods and services no less needed than they were last week or last month or last year. Our capacity remains undiminished. But our time of standing pat, of protecting narrow interests and putting off unpleasant decisions - that time has surely passed. Starting today, we must pick ourselves up, dust ourselves off, and begin again the work of remaking America.
今天我们继续先辈们的旅途。美国依然是地球上最富裕、最强大的国家。同危机初露端倪之时相比,美国人民的生产力依然旺盛;与上周、上个月或者去年相比,我们的头脑依然富于创造力,我们的商品和服务依然很有市场,我们的实力不曾削弱。但是,可以肯定的是,轻歌曼舞的时代、保护狭隘利益的时代以及对艰难决定犹豫不决的时代已经过去了。从今天开始,我们必须跌倒后爬起来,拍拍身上的泥土,重新开始工作,重塑美国。



For everywhere we look, there is work to be done. The state of the economy calls for action, bold and swift, and we will act - not only to create new jobs, but to lay a new foundation for growth. We will build the roads and bridges, the electric grids and digital lines that feed our commerce and bind us together. We will restore science to its rightful place, and wield technology’s wonders to raise health care’s quality and lower its cost. We will harness the sun and the winds and the soil to fuel our cars and run our factories. And we will transform our schools and colleges and universities to meet the demands of a new age. All this we can do. And all this we will do.
我目之所及,都有工作有待完成。国家的经济情况要求我们采取大胆且快速的行动,我们的确是要行动,不仅是要创造就业,更要为(下一轮经济)增长打下新的基础。我们将造桥铺路,为企业铺设电网和数字线路,将我们联系在一起。我们将回归科学,运用科技的奇迹提高医疗质量,降低医疗费用。我们将利用风能、太阳能和土壤驱动车辆,为工厂提供能源。我们将改革中小学以及大专院校,以适应新时代的要求。这一切,我们都能做到,而且我们都将会做到。



Now, there are some who question the scale of our ambitions - who suggest that our system cannot tolerate too many big plans. Their memories are short. For they have forgotten what this country has already done; what free men and women can achieve when imagination is joined to common purpose, and necessity to courage.
现在,有一些人开始质疑我们的野心是不是太大了,他们认为我们的体制承载不了太多的宏伟计划。他们是健忘了。他们已经忘了这个国家已经取得的成就;他们已经忘了当创造力与共同目标以及必要的勇气结合起来时,自由的美国人民所能发挥的能量。


What the cynics fail to understand is that the ground has shifted beneath them - that the stale political arguments that have consumed us for so long no longer apply. The question we ask today is not whether our government is too big or too small, but whether it works - whether it helps families find jobs at a decent wage, care they can afford, a retirement that is dignified. Where the answer is yes, we intend to move forward. Where the answer is no, programs will end. And those of us who manage the public’s dollars will be held to account - to spend wisely, reform bad habits, and do our business in the light of day - because only then can we restore the vital trust between a people and their government.
这些怀疑论者的错误在于,他们没有意识到政治现实已经发生了变化,长期以来耗掉我们太多精力的陈腐政治论争已经不再适用。今天,我们的问题不在于政府的大小,而在于政府能否起作用,政府能否帮助家庭找到薪水合适的工作、给他们可以负担得起的医疗保障并让他们体面地退休。哪个方案能给与肯定的答案,我们就推进哪个方案。哪个方案的答案是否定的,我们就选择终止。而掌管纳税人税金的人应当承担起责任,合理支出,摒弃陋习,磊落做事,这有这样才能在政府和人民之间重建至关重要的相互信任。


Nor is the question before us whether the market is a force for good or ill. Its power to generate wealth and expand freedom is unmatched, but this crisis has reminded us that without a watchful eye, the market can spin out of control - and that a nation cannot prosper long when it favors only the prosperous. The success of our economy has always depended not just on the size of our Gross Domestic Product, but on the reach of our prosperity; on our ability to extend opportunity to every willing heart - not out of charity, but because it is the surest route to our common good.
我们面临的问题也不是市场好坏的问题。市场创造财富、拓展自由的能力无可匹敌,但是这场危机提醒我们,如果没有监管,市场很可能就会失去控制,而且偏袒富人国家的繁荣无法持久。国家经济的成败不仅仅取决于国内生产总值的大小,而且取决于繁荣的覆盖面,取决于我们是否有能力让所有有意愿的人都有机会走向富裕。我们这样做不是慈善,而是因为这是确保实现共同利益的途径。


As for our common defense, we reject as false the choice between our safety and our ideals. Our Founding Fathers, faced with perils we can scarcely imagine, drafted a charter to assure the rule of law and the rights of man, a charter expanded by the blood of generations. Those ideals still light the world, and we will not give them up for expedience’s sake. And so to all other peoples and governments who are watching today, from the grandest capitals to the small village where my father was born: know that America is a friend of each nation and every man, woman, and child who seeks a future of peace and dignity, and that we are ready to lead once more.
就共同防御而言,我们认为国家安全与国家理想的只能选其一的排他选择是错的。面对我们几乎无法想像的危险,我们的先辈们起草了确保法治和个人权利的宪章。一代代人民的鲜血夯实了这一宪章。宪章中的理想依然照亮着世界,我们不能以经验之谈放弃这些理想。因此我想对正在观看这一仪式的其他国家的人民和政府说,不论他们现在各国伟大的首府还是在如同我父亲出生地一般的小村落,我想让他们知道:对于每个追求和平和自尊的国家和个人而言,美国都是朋友,我们愿意再次领导大家踏上追寻之旅。



We are the keepers of this legacy. Guided by these principles once more, we can meet those new threats that demand even greater effort - even greater cooperation and understanding between nations. We will begin to responsibly leave Iraq to its people, and forge a hard-earned peace in Afghanistan. With old friends and former foes, we will work tirelessly to lessen the nuclear threat, and roll back the specter of a warming planet. We will not apologize for our way of life, nor will we waver in its defense, and for those who seek to advance their aims by inducing terror and slaughtering innocents, we say to you now that our spirit is stronger and cannot be broken; you cannot outlast us, and we will defeat you.
环顾四周,有无数工作等着我们。经济状况期待着我们大胆和快速的行动。我们会付诸行动--不仅仅是创造就业机会,同时还要为未来的增长打下新的基础。我们将建设公路、桥梁和电网,以及将我们紧密联系起来、提供商业信息的数字高速公路。我们会重新树立科学应有的地位,并利用技术手段提高医疗保障的质量,同时降低其费用。我们将利用太阳、风与土壤,来驱动我们的汽车和工厂。我们将改革我们的学校和大学,以满足新时代的需要。这些都有可能实现,更会去实现。



Now, there are some who question the scale of our ambitions - who suggest that our system cannot tolerate too many big plans. Their memories are short. For they have forgotten what this country has already done; what free men and women can achieve when imagination is joined to common purpose, and necessity to courage.
现在,有人还在怀疑我们的信心──他们认为我们的国家无法承担这样的重大计划。他们太健忘了,他们忘记了这个国家曾经取得的成就,他们忘记了当拥有了理想、共同的目标和必要的勇气,这些自由的人民曾经取得的辉煌成就。


What the cynics fail to understand is that the ground has shifted beneath them - that the stale political arguments that have consumed us for so long no longer apply. The question we ask today is not whether our government is too big or too small, but whether it works - whether it helps families find jobs at a decent wage, care they can afford, a retirement that is dignified. Where the answer is yes, we intend to move forward. Where the answer is no, programs will end. And those of us who manage the public’s dollars will be held to account - to spend wisely, reform bad habits, and do our business in the light of day - because only then can we restore the vital trust between a people and their government.
这些愤世嫉俗的人无法理解这个国家所发生的转变──那些陈腐的政治已经缠绕了我们太久太长。我们现在面临的问题不是政府太大还是太小,而是政府所扮演的角色──应该帮助家庭获得体面的收入,购买他们的所需,有尊严地退休。当这些答案都是肯定的时,我们才能继续前进。如果答案是否定的,一切都将不复存在。我们这些管理公共财产的人应该负起责任──把钱花在刀刃上、改掉恶习、光明正大地行事──因为只有这样我们才能重塑人民和政府之间的信任。


Nor is the question before us whether the market is a force for good or ill. Its power to generate wealth and expand freedom is unmatched, but this crisis has reminded us that without a watchful eye, the market can spin out of control - and that a nation cannot prosper long when it favors only the prosperous. The success of our economy has always depended not just on the size of our Gross Domestic Product, but on the reach of our prosperity; on our ability to extend opportunity to every willing heart - not out of charity, but because it is the surest route to our common good.
市场力量的好坏不是我们的问题。市场在创造财富和推进自由进程方面是无可代替的,但是这场危机也提醒了我们没有审慎的监管,市场的力量将如野马一样脱缰 ──一个仅有财富的国家不可能持续繁荣。我们在经济上所取得的成功不仅体现在我们的经济总量上,也体现在我们的繁荣程度上,体现在我们为每个渴望成功的心灵所提供的机会上─这并非出自恻隐之心,而是我们实现共同利益的必经之路。


========================
As for our common defense, we reject as false the choice between our safety and our ideals. Our Founding Fathers, faced with perils we can scarcely imagine, drafted a charter to assure the rule of law and the rights of man, a charter expanded by the blood of generations. Those ideals still light the world, and we will not give them up for expedience’s sake. And so to all other peoples and governments who are watching today, from the grandest capitals to the small village where my father was born: know that America is a friend of each nation and every man, woman, and child who seeks a future of peace and dignity, and that we are ready to lead once more.
我们拒绝在安全和理想之间妥协。我们的建国先辈们,面对我们无法想象的凶险,却依然用几代人的鲜血维护了神圣的法律和人权。那些理想依然在照亮着这个世界,我们不会因一时的困难而放弃这些理想。我要对那些正在看着我们的国家和人民说,无论你身处繁华的都市还是像养育了我父亲那样的小村庄:对于那些追求和平与尊严的男人、女人和孩子,美国将永远是你们的朋友,我们将继续和你们一起前进。




We are the keepers of this legacy. Guided by these principles once more, we can meet those new threats that demand even greater effort - even greater cooperation and understanding between nations. We will begin to responsibly leave Iraq to its people, and forge a hard-earned peace in Afghanistan. With old friends and former foes, we will work tirelessly to lessen the nuclear threat, and roll back the specter of a warming planet. We will not apologize for our way of life, nor will we waver in its defense, and for those who seek to advance their aims by inducing terror and slaughtering innocents, we say to you now that our spirit is stronger and cannot be broken; you cannot outlast us, and we will defeat you.
我们是这种传统的捍卫者。我们继续追寻这些信念的指引,我们将直面这些挑战并更加努力─更多的沟通与合作。我们会负责地将伊拉克还给当地的人民,并在阿富汗保卫来之不易的和平。我们将与老朋友和原来的敌人一道,共同消除核威胁,解决全球变暖的根源。我们不会为自己的做法道歉,更不会动摇捍卫和平的决心,对于那些崇尚恐怖、滥杀无辜的人,我们的精神是强大而不可战胜的。你拖不垮我们,我们将会打败你。


For we know that our patchwork heritage is a strength, not a weakness. We are a nation of Christians and Muslims, Jews and Hindus - and non-believers. We are shaped by every language and culture, drawn from every end of this Earth; and because we have tasted the bitter swill of civil war and segregation, and emerged from that dark chapter stronger and more united, we cannot help but believe that the old hatreds shall someday pass; that the lines of tribe shall soon dissolve; that as the world grows smaller, our common humanity shall reveal itself; and that America must play its role in ushering in a new era of peace.
我们多种族混居是一种优势。我们是一个由基督徒、穆斯林、犹太教徒、印度教徒和无神论者共同组成的国家。我们吸收了各种文化的精髓,从世界的每个角落学习。因为我们经历过内战和种族隔离的痛苦洗礼,并在黑暗中更加坚强和团结,我们无法保证,但是我们相信憎恨终将消弭,分隔终将散去。随着世界越来越紧密地联系在一起,我们共同的人性将显露出来,美国必须承担引领新时代和平的重任。


To the Muslim world, we seek a new way forward, based on mutual interest and mutual respect. To those leaders around the globe who seek to sow conflict, or blame their society’s ills on the West - know that your people will judge you on what you can build, not what you destroy. To those who cling to power through corruption and deceit and the silencing of dissent, know that you are on the wrong side of history; but that we will extend a hand if you are willing to unclench your fist.
对于穆斯林世界,我们将基于共同的利益和信仰,寻找更好的合作之路。对于那些在世界各个地方挑起冲突或一味批评西方不良影响的领导者:你的人民评判你的依据是你建立了什么,而不是破坏了什么。对于那些依靠腐败和欺骗并压制异议而追求权利的人们:你们站在了人类历史的对立面。如果你们能张开紧握的拳头,我们也将伸出友谊之手。


To the people of poor nations, we pledge to work alongside you to make your farms flourish and let clean waters flow; to nourish starved bodies and feed hungry minds. And to those nations like ours that enjoy relative plenty, we say we can no longer afford indifference to suffering outside our borders; nor can we consume the world’s resources without regard to effect. For the world has changed, and we must change with it.
对于那些贫穷的人们,我们保证和你们一起建设繁茂的农场和干净的水源,滋养那些饥寒交迫的身体和心灵。对于那些与我们一样相对富裕的国家,我们不能再对外界的苦难漠不关心,更不能继续大肆索取世界的资源。世界必须改变,我们都必须改变。




As we consider the road that unfolds before us, we remember with humble gratitude those brave Americans who, at this very hour, patrol far-off deserts and distant mountains. They have something to tell us today, just as the fallen heroes who lie in Arlington whisper through the ages. We honor them not only because they are guardians of our liberty, but because they embody the spirit of service; a willingness to find meaning in something greater than themselves. And yet, at this moment - a moment that will define a generation - it is precisely this spirit that must inhabit us all.
当我们审视前方的道路时,我们会感激那些跨越千山万水来到这里的人们。今天,他们有话对我们说,也是安息在阿林顿国家公墓里的先烈们时刻提醒我们的。我们尊敬他们不仅因为是他们捍卫了我们的自由,更因为他们正是奉献精神的化身;他们致力于寻找远高于自身的生命真谛。而此时,在这个特殊的时代,我们更需让这种精神长存。

For as much as government can do and must do, it is ultimately the faith and determination of the American people upon which this nation relies. It is the kindness to take in a stranger when the levees break, the selflessness of workers who would rather cut their hours than see a friend lose their job which sees us through our darkest hours. It is the firefighter’s courage to storm a stairway filled with smoke, but also a parent’s willingness to nurture a child, that finally decides our fate.
因为归根结底,政府所能做的,也是必须做到的,是体现每个美国人的信念和决心,这也是这个国家赖以生存的精神力量。这种力量是洪灾泛滥时,陌生人之间的温暖善举;是经济困难时期,人们自损利益保全朋友工作的无私忘我。这是消防员们毅然冲入浓烟火海的勇气,也是父母培养孩子的无私之心,这些都决定了我们的命运。



Our challenges may be new. The instruments with which we meet them may be new. But those values upon which our success depends - hard work and honesty, courage and fair play, tolerance and curiosity, loyalty and patriotism - these things are old. These things are true. They have been the quiet force of progress throughout our history. What is demanded then is a return to these truths. What is required of us now is a new era of responsibility - a recognition, on the part of every American, that we have duties to ourselves, our nation, and the world, duties that we do not grudgingly accept but rather seize gladly, firm in the knowledge that there is nothing so satisfying to the spirit, so defining of our character, than giving our all to a difficult task.
或许,我们今日遇到挑战前所未有,所有的情况完全陌生。但是,我们赖以走向成功的价值观从未改变——诚实、勤勉、勇敢、公正、宽容、好学、忠贞和爱国。我们的历史亦由这些真理推进,亘古不变。如今,我们面对的是一个全新的责任时代——人人都需重视,对我们自己,我们的国家乃至整个世界,都有一份责任。我们会欣然接受这份责任,人生也正因此而充实。



This is the price and the promise of citizenship.
这是公民的价值和承诺。



This is the source of our confidence - the knowledge that God calls on us to shape an uncertain destiny.
这是我们信心的源泉——上帝赐予我们知识以应对无常的命运。


This is the meaning of our liberty and our creed - why men and women and children of every race and every faith can join in celebration across this magnificent mall, and why a man whose father less than sixty years ago might not have been served at a local restaurant can now stand before you to take a most sacred oath.
这是我们所崇尚的自由与信念的真谛——这就是为什么今天,不同肤色,不同信仰的男女老少在此汇聚一堂;这就是为什么六十年前,一位父亲走入餐厅甚至无人理睬,而今天他的儿子可以站在这里,在你们面前许下最庄严的誓言。



So let us mark this day with remembrance, of who we are and how far we have traveled. In the year of America’s birth, in the coldest of months, a small band of patriots huddled by dying campfires on the shores of an icy river. The capital was abandoned. The enemy was advancing. The snow was stained with blood. At a moment when the outcome of our revolution was most in doubt, the father of our nation ordered these words be read to the people:
所以让我们记住这一天,记住自己,记住为此的付出。在我们的国家诞生之初,先辈们在最寒冷的日子里,围聚在结冰的河边靠微弱的篝火取暖。离乡背井,后有敌军,鲜血染红了白雪。就在革命的道路如此模糊,意志也开始踌躇之时,我们的国父有这样几句话:



"Let it be told to the future world...that in the depth of winter, when nothing but hope and virtue could survive...that the city and the country, alarmed at one common danger, came forth to meet [it]."
“告诉未来的世界……当一切陷入寒冬,万物俱灭,只有希望和勇气可以长存……这座城市和这个国家,在共同的危机下团结起来,共同面对前方的艰难。”



America. In the face of our common dangers, in this winter of our hardship, let us remember these timeless words. With hope and virtue, let us brave once more the icy currents, and endure what storms may come. Let it be said by our children’s children that when we were tested we refused to let this journey end, that we did not turn back nor did we falter; and with eyes fixed on the horizon and God’s grace upon us, we carried forth that great gift of freedom and delivered it safely to future generations.
美国,面对我们共同的危机,在这艰难的寒冬,让我们牢记那些永恒的字句。怀着希望和美德,让我们再一次勇敢地面对冰冷的现实,迎接任何可能的风浪。让我们的子孙传唱,当我们面对挑战时,我们没有怯懦、没有退缩,更没有踟蹰不前。我们在上帝的关爱下眺望远方,我们在自由的道路上继续前进,我们的精神将永远闪耀着光芒。