Git Merge详解

git merge 用来做分支合并,将其他分支中的内容合并到当前分支中。比如分支结构如下:
[codesyntax lang=”text”]

                        master
                         /
C0 ---- C1 ---- C2 ---- C4
                         \
                         C3 ---- C5
                                  \
                                issueFix

[/codesyntax]
当前分支是master
$ git checkout master

把issueFix中的内容Merge进来:
$ git merge issueFix

如果没有冲突的话,merge完成。有冲突的话,git会提示那个文件中有冲突,比如有如下冲突:

<<<<<<< HEAD:test.c

printf (“test1″);

=======

printf (“test2″);

>>>>>>> issueFix:test.c

可以看到 ======= 隔开的上半部分,是 HEAD(即 master 分支,在运行 merge 命令时检出的分支)中的内容,下半部分是在 issueFix 分支中的内容。解决冲突的办法无非是二者选其一或者由你亲自整合到一起。比如你可以通过把这段内容替换为下面这样来解决:

printf (“test2″);

这个解决方案各采纳了两个分支中的一部分内容,而且删除了 <<<<<<<,=======,和>>>>>>> 这些行。在解决了所有文件里的所有冲突后,运行 git add 将把它们标记为已解决(resolved)。因为一旦暂存,就表示冲突已经解决。如果你想用一个有图形界面的工具来解决这些问题,不妨运行 git mergetool,它会调用一个可视化的合并工具并引导你解决所有冲突:

$ git mergetool
merge tool candidates: kdiff3 tkdiff xxdiff meld gvimdiff opendiff emerge vimdiff
Merging the files: index.html

Normal merge conflict for ‘test.c’:
{local}: modified
{remote}: modified
Hit return to start merge resolution tool (kdiff3):

合并后的分支图如下:
[codesyntax lang=”text”]

                               master
                                 /
C0 ---- C1 ---- C2 ---- C4 ---- C6
                        \       /
                        C3 ----C5
                                \
                              issueFix

[/codesyntax]
注意,这次合并的实现,由于当前 master 分支所指向的 commit (C4)并非想要并入分支(issueFix)的直接祖先,Git 不得不进行一些处理。就此例而言,Git 会用两个分支的末端(C4 和 C5)和它们的共同祖先(C2)进行一次简单的三方合并。对三方合并的结果作一新的快照,并自动创建一个指向它的 commit(C6)

退出合并工具以后,Git 会询问你合并是否成功。如果回答是,它会为你把相关文件暂存起来,以表明状态为已解决。然后可以用 git commit 来完成这次合并提交。

Eclipse使用技巧

文件比较

Eclipse列编辑模式

Search功能(还有一个是Find/Replace)

一个文件打开多次,这样在你写代码时,需要参考文件的不同部分时,就不需要滚上滚下了

提取公共代码到私有的公共方法

eclipse显示启动时间的插件:
看这里http://www.blogjava.net/shenh062326/archive/2011/10/16/361360.html

37个常用Shell组合命令

序号

任务

命令组合

1

删除0字节文件

find . -type f -size 0 -exec rm -rf {} \;
find . type f -size 0 -delete

2

查看进程,按内存从大到小排列

ps -e -o “%C : %p : %z : %a”|sort -k5 -nr

3

按cpu利用率从大到小排列

ps -e -o “%C : %p : %z : %a”|sort -nr

4

打印说cache里的URL

grep -r -a jpg /data/cache/* | strings | grep “http:” | awk -F’http:’ ‘{print “http:”$2;}’

5

查看http的并发请求数及其TCP连接状态

netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’

6

sed在这个文里Root的一行,匹配Root一行,将no替换成yes。

sed -i ‘/Root/s/no/yes/’ /etc/ssh/sshd_config

7

如何杀掉mysql进程

ps aux |grep mysql |grep -v grep  |awk ‘{print $2}’ |xargs kill -9
killall -TERM mysqld
kill -9 `cat /usr/local/apache2/logs/httpd.pid`

8

显示运行3级别开启的服务(从中了解到cut的用途,截取数据)

ls /etc/rc3.d/S* |cut -c 15-

9

如何在编写SHELL显示多个信息,用EOF

cat << EOF
+————————————————————–+
|   === Welcome to Tunoff services ===                         |
+————————————————————–+
EOF

10

for的用法(如给mysql建软链接)

cd /usr/local/mysql/bin
for i in *
do ln /usr/local/mysql/bin/$i /usr/bin/$i
done

11

取IP地址

ifconfig eth0 |grep “inet addr:” |awk ‘{print $2}’|cut -c 6-
ifconfig | grep ‘inet addr:’| grep -v ’127.0.0.1′ |cut -d: -f2 | awk ‘{ print $1}’

12

内存的大小

free -m |grep “Mem” | awk ‘{print $2}’

13

查看80端口的连接,并排序

netstat -an -t | grep “:80″ | grep ESTABLISHED | awk ‘{printf “%s %s\n”,$5,$6}’ | sort

14

查看Apache的并发请求数及其TCP连接状态

netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’

15

统计一下服务器下面所有的jpg的文件的大小

find / -name *.jpg -exec wc -c {} \;|awk ‘{print $1}’|awk ‘{a+=$1}END{print a}’

16

CPU的数量

cat /proc/cpuinfo |grep -c processor

17

CPU负载

cat /proc/loadavg

18

CPU负载

mpstat 1 1

19

内存空间

free

20

磁盘空间

df -h

21

如发现某个分区空间接近用尽,可以进入该分区的挂载点,用以下命令找出占用空间最多的文件或目录

du -cks * | sort -rn | head -n 10

22

磁盘I/O负载

iostat -x 1 2

23

网络负载

sar -n DEV

24

网络错误

netstat -i
cat /proc/net/dev

25

网络连接数目

netstat -an | grep -E “^(tcp)” | cut -c 68- | sort | uniq -c | sort -n

26

进程总数

ps aux | wc -l

27

查看进程树

ps aufx

28

可运行进程数目

vmwtat 1 5

29

检查DNS Server工作是否正常,这里以61.139.2.69为例

dig www.baidu.com @61.139.2.69

30

检查当前登录的用户个数

who | wc -l

31

日志查看、搜索

cat /var/log/rflogview/*errors
grep -i error /var/log/messages
grep -i fail /var/log/messages
tail -f -n 2000 /var/log/messages

32

内核日志

dmesg

33

时间

date

34

已经打开的句柄数

lsof | wc -l

35

网络抓包,直接输出摘要信息到文件。

tcpdump -c 10000 -i eth0 -n dst port 80 > /root/pkts

36

然后检查IP的重复数 并从小到大排序 注意 “-t\  +0″ 中间是两个空格,less命令的用法。

less pkts | awk {‘printf $3″\n”‘} | cut -d. -f 1-4 | sort | uniq -c | awk {‘printf $1″ “$2″\n”‘} | sort -n -t\  +0

37

kudzu查看网卡型号

kudzu –probe –class=network

 

iptables详解

iptables防火墙可以用于创建过滤(filter)与NAT规则。所有Linux发行版都能使用iptables,因此理解如何配置iptables将会帮助你更有效地管理Linux防火墙。如果你是第一次接触iptables,你会觉得它很复杂,但是一旦你理解iptables的工作原理,你会发现其实它很简单。
首先介绍iptables的结构:iptables -> Tables -> Chains -> Rules. 简单地讲,tables由chains组成,而chains又由rules组成。如下图所示。iptables-table-chain-rule-structure
图: IPTables Table, Chain, and Rule Structure

一、iptables的表与链

iptables具有Filter, NAT, Mangle, Raw四种内建表:

1. Filter表

Filter表示iptables的默认表,因此如果你没有自定义表,那么就默认使用filter表,它具有以下三种内建链:

INPUT链 – 处理来自外部的数据。
OUTPUT链 – 处理向外发送的数据。
FORWARD链 – 将数据转发到本机的其他网卡设备上。

2. NAT表

NAT表有三种内建链:

PREROUTING链 – 处理刚到达本机并在路由转发前的数据包。它会转换数据包中的目标IP地址(destination ip address),通常用于DNAT(destination NAT)。
POSTROUTING链 – 处理即将离开本机的数据包。它会转换数据包中的源IP地址(source ip address),通常用于SNAT(source NAT)。
OUTPUT链 – 处理本机产生的数据包。

3. Mangle表

Mangle表用于指定如何处理数据包。它能改变TCP头中的QoS位。Mangle表具有5个内建链:

PREROUTING
OUTPUT
FORWARD
INPUT
POSTROUTING

4. Raw表

Raw表用于处理异常,它具有2个内建链:

PREROUTING chain
OUTPUT chain

5.小结

下图展示了iptables的三个内建表:
iptables-filter-nat-mangle-tables

图: IPTables 内建表

二、IPTABLES 规则(Rules)

牢记以下三点式理解iptables规则的关键:

Rules包括一个条件和一个目标(target)
如果满足条件,就执行目标(target)中的规则或者特定值。
如果不满足条件,就判断下一条Rules。

目标值(Target Values)

下面是你可以在target里指定的特殊值:

ACCEPT – 允许防火墙接收数据包
DROP – 防火墙丢弃包
QUEUE – 防火墙将数据包移交到用户空间
RETURN – 防火墙停止执行当前链中的后续Rules,并返回到调用链(the calling chain)中

如果你执行iptables –list你将看到防火墙上的可用规则。下例说明当前系统没有定义防火墙,你可以看到,它显示了默认的filter表,以及表内默认的input链, forward链, output链。
# iptables -t filter –list
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

查看mangle表:
# iptables -t mangle –list
查看NAT表:
# iptables -t nat –list
查看RAW表:
# iptables -t raw –list
!注意:如果不指定-t选项,就只会显示默认的filter表。因此,以下两种命令形式是一个意思:
# iptables -t filter –list
(or)
# iptables –list
以下例子表明在filter表的input链, forward链, output链中存在规则:

[
iptables –list
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 RH-Firewall-1-INPUT all — 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 RH-Firewall-1-INPUT all – 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination

Chain RH-Firewall-1-INPUT (2 references)
num target prot opt source destination
1 ACCEPT all – 0.0.0.0/0 0.0.0.0/0
2 ACCEPT icmp – 0.0.0.0/0 0.0.0.0/0 icmp type 255
3 ACCEPT esp – 0.0.0.0/0 0.0.0.0/0
4 ACCEPT ah – 0.0.0.0/0 0.0.0.0/0
5 ACCEPT udp – 0.0.0.0/0 224.0.0.251 udp dpt:5353
6 ACCEPT udp – 0.0.0.0/0 0.0.0.0/0 udp dpt:631
7 ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:631
8 ACCEPT all – 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
9 ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
10 REJECT all – 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

以上输出包含下列字段:
num – 指定链中的规则编号
target – 前面提到的target的特殊值
prot – 协议:tcp, udp, icmp等
source – 数据包的源IP地址
destination – 数据包的目标IP地址
三、清空所有iptables规则
在配置iptables之前,你通常需要用iptables –list命令或者iptables-save命令查看有无现存规则,因为有时需要删除现有的iptables规则:
iptables –flush
或者
iptables -F
这两条命令是等效的。但是并非执行后就万事大吉了。你仍然需要检查规则是不是真的清空了,因为有的linux发行版上这个命令不会清除NAT表中的规则,此时只能手动清除:
iptables -t NAT -F
四、永久生效
当你删除、添加规则后,这些更改并不能永久生效,这些规则很有可能在系统重启后恢复原样。为了让配置永久生效,根据平台的不同,具体操作也不同。下面进行简单介绍:
1.Ubuntu
首先,保存现有的规则:
iptables-save > /etc/iptables.rules
然后新建一个bash脚本,并保存到/etc/network/if-pre-up.d/目录下:
#!/bin/bash
iptables-restore < /etc/iptables.rules
这样,每次系统重启后iptables规则都会被自动加载。
!注意:不要尝试在.bashrc或者.profile中执行以上命令,因为用户通常不是root,而且这只能在登录时加载iptables规则。
2.CentOS, RedHat
# 保存iptables规则
service iptables save
# 重启iptables服务
service iptables stop
service iptables start

查看当前规则:
cat /etc/sysconfig/iptables
五、追加iptables规则
可以使用iptables -A命令追加新规则,其中-A表示Append。因此,新的规则将追加到链尾。
一般而言,最后一条规则用于丢弃(DROP)所有数据包。如果你已经有这样的规则了,并且使用-A参数添加新规则,那么就是无用功。
1.语法
iptables -A chain firewall-rule
-A chain – 指定要追加规则的链
firewall-rule – 具体的规则参数
2.描述规则的基本参数
以下这些规则参数用于描述数据包的协议、源地址、目的地址、允许经过的网络接口,以及如何处理这些数据包。这些描述是对规则的基本描述。
-p 协议(protocol)
指定规则的协议,如tcp, udp, icmp等,可以使用all来指定所有协议。
如果不指定-p参数,则默认是all值。这并不明智,请总是明确指定协议名称。
可以使用协议名(如tcp),或者是协议值(比如6代表tcp)来指定协议。映射关系请查看/etc/protocols
还可以使用–protocol参数代替-p参数
-s 源地址(source)
指定数据包的源地址
参数可以使IP地址、网络地址、主机名
例如:-s 192.168.1.101指定IP地址
例如:-s 192.168.1.10/24指定网络地址
如果不指定-s参数,就代表所有地址
还可以使用–src或者–source
-d 目的地址(destination)
指定目的地址
参数和-s相同
还可以使用–dst或者–destination
-j 执行目标(jump to target)
-j代表”jump to target”
-j指定了当与规则(Rule)匹配时如何处理数据包
可能的值是ACCEPT, DROP, QUEUE, RETURN
还可以指定其他链(Chain)作为目标
-i 输入接口(input interface)
-i代表输入接口(input interface)
-i指定了要处理来自哪个接口的数据包
这些数据包即将进入INPUT, FORWARD, PREROUTE链
例如:-i eth0指定了要处理经由eth0进入的数据包
如果不指定-i参数,那么将处理进入所有接口的数据包
如果出现! -i eth0,那么将处理所有经由eth0以外的接口进入的数据包
如果出现-i eth+,那么将处理所有经由eth开头的接口进入的数据包
还可以使用–in-interface参数
-o 输出(out interface)
-o代表”output interface”
-o指定了数据包由哪个接口输出
这些数据包即将进入FORWARD, OUTPUT, POSTROUTING链
如果不指定-o选项,那么系统上的所有接口都可以作为输出接口
如果出现! -o eth0,那么将从eth0以外的接口输出
如果出现-i eth+,那么将仅从eth开头的接口输出
还可以使用–out-interface参数
3.描述规则的扩展参数
对规则有了一个基本描述之后,有时候我们还希望指定端口、TCP标志、ICMP类型等内容。
–sport 源端口(source port)针对 -p tcp 或者 -p udp
缺省情况下,将匹配所有端口
可以指定端口号或者端口名称,例如”–sport 22″与”–sport ssh”。
/etc/services文件描述了上述映射关系。
从性能上讲,使用端口号更好
使用冒号可以匹配端口范围,如”–sport 22:100″
还可以使用”–source-port”
–-dport 目的端口(destination port)针对-p tcp 或者 -p udp
参数和–sport类似
还可以使用”–destination-port”
-–tcp-flags TCP标志 针对-p tcp
可以指定由逗号分隔的多个参数
有效值可以是:SYN, ACK, FIN, RST, URG, PSH
可以使用ALL或者NONE
-–icmp-type ICMP类型 针对-p icmp
–icmp-type 0 表示Echo Reply
–icmp-type 8 表示Echo
4.追加规则的完整实例:仅允许SSH服务
本例实现的规则将仅允许SSH数据包通过本地计算机,其他一切连接(包括ping)都将被拒绝。
# 1.清空所有iptables规则
iptables -F
# 2.接收目标端口为22的数据包
iptables -A INPUT -i eth0 -p tcp –dport 22 -j ACCEPT

# 3.拒绝所有其他数据包
iptables -A INPUT -j DROP

六、更改默认策略
上例的例子仅对接收的数据包过滤,而对于要发送出去的数据包却没有任何限制。本节主要介绍如何更改链策略,以改变链的行为。
1. 默认链策略
/!\警告:请勿在远程连接的服务器、虚拟机上测试!
当我们使用-L选项验证当前规则是发现,所有的链旁边都有policy ACCEPT标注,这表明当前链的默认策略为ACCEPT:
# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp – anywhere anywhere tcp dpt:ssh
DROP all – anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

这种情况下,如果没有明确添加DROP规则,那么默认情况下将采用ACCEPT策略进行过滤。除非:
a)为以上三个链单独添加DROP规则:
iptables -A INPUT -j DROP
iptables -A OUTPUT -j DROP
iptables -A FORWARD -j DROP
b)更改默认策略:
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
糟糕!!如果你严格按照上一节的例子配置了iptables,并且现在使用的是SSH进行连接的,那么会话恐怕已经被迫终止了!
为什么呢?因为我们已经把OUTPUT链策略更改为DROP了。此时虽然服务器能接收数据,但是无法发送数据:
# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp – anywhere anywhere tcp dpt:ssh
DROP all – anywhere anywhere
Chain FORWARD (policy DROP)
target prot opt source destination

Chain OUTPUT (policy DROP)
target prot opt source destination

七、配置应用程序规则
尽管5.4节已经介绍了如何初步限制除SSH以外的其他连接,但是那是在链默认策略为ACCEPT的情况下实现的,并且没有对输出数据包进行限制。本节在上一节基础上,以SSH和HTTP所使用的端口为例,教大家如何在默认链策略为DROP的情况下,进行防火墙设置。在这里,我们将引进一种新的参数-m state,并检查数据包的状态字段。
1.SSH
# 1.允许接收远程主机的SSH请求
iptables -A INPUT -i eth0 -p tcp –dport 22 -m state –state NEW,ESTABLISHED -j ACCEPT
# 2.允许发送本地主机的SSH响应
iptables -A OUTPUT -o eth0 -p tcp –sport 22 -m state –state ESTABLISHED -j ACCEPT

-m state: 启用状态匹配模块(state matching module)
–-state: 状态匹配模块的参数。当SSH客户端第一个数据包到达服务器时,状态字段为NEW;建立连接后数据包的状态字段都是ESTABLISHED
–sport 22: sshd监听22端口,同时也通过该端口和客户端建立连接、传送数据。因此对于SSH服务器而言,源端口就是22
–dport 22: ssh客户端程序可以从本机的随机端口与SSH服务器的22端口建立连接。因此对于SSH客户端而言,目的端口就是22
如果服务器也需要使用SSH连接其他远程主机,则还需要增加以下配置:
# 1.送出的数据包目的端口为22
iptables -A OUTPUT -o eth0 -p tcp –dport 22 -m state –state NEW,ESTABLISHED -j ACCEPT
# 2.接收的数据包源端口为22
iptables -A INPUT -i eth0 -p tcp –sport 22 -m state –state ESTABLISHED -j ACCEPT

2.HTTP
HTTP的配置与SSH类似:
# 1.允许接收远程主机的HTTP请求
iptables -A INPUT -i eth0 -p tcp –dport 80 -m state –state NEW,ESTABLISHED -j ACCEPT
# 1.允许发送本地主机的HTTP响应
iptables -A OUTPUT -o eth0 -p tcp –sport 80 -m state –state ESTABLISHED -j ACCEPT

3.完整的配置
# 1.删除现有规则
iptables -F
# 2.配置默认链策略
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP

# 3.允许远程主机进行SSH连接
iptables -A INPUT -i eth0 -p tcp –dport 22 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp –sport 22 -m state –state ESTABLISHED -j ACCEPT

# 4.允许本地主机进行SSH连接
iptables -A OUTPUT -o eth0 -p tcp –dport 22 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp –sport 22 -m state –state ESTABLISHED -j ACCEPT

# 5.允许HTTP请求
iptables -A INPUT -i eth0 -p tcp –dport 80 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp –sport 80 -m state –state ESTABLISHED -j ACCEPT

References
[1] Linux Firewall Tutorial: IPTables Tables, Chains, Rules Fundamentals
[2] IPTables Flush: Delete / Remove All Rules On RedHat and CentOS Linux
[3] Linux IPTables: How to Add Firewall Rules (With Allow SSH Example)
[4] Linux IPTables: Incoming and Outgoing Rule Examples (SSH and HTTP)
[5] 25 Most Frequently Used Linux IPTables Rules Examples
[6] man 8 iptables

本文参考至: Keep Fighting

网络爬虫(二):利用urllib2通过指定的URL抓取网页内容

版本号:Python2.7.5,Python3改动较大,各位另寻教程。
所谓网页抓取,就是把URL地址中指定的网络资源从网络流中读取出来,保存到本地。
类似于使用程序模拟IE浏览器的功能,把URL作为HTTP请求的内容发送到服务器端, 然后读取服务器端的响应资源。
继续阅读网络爬虫(二):利用urllib2通过指定的URL抓取网页内容

免费在线网站速度测试服务

新上线的服务器,或许自个儿访问速度飞快,然而还是有人会抱怨网站打开缓慢,甚至是打不开。
为了能够准确评估网站在联通、电信、移动等不同网络环境的访问速度,以及在国内外不同地区的访问速度,虽然我们可以采用分布式ping的方法来进行验证服务器的访问速度,但是其实我们更需要一个专业的网站速度测试平台。

众所周知,一个网页会包含图片、CSS、JS等各种各样的因素。
而我们在打开网页时经常会遇到卡、顿等现象,排除本地网络不稳定的情况,多数是由于网页中的JS和图片等外在因素导致的。
尤其是那些外部设定的JS及图片,虽然他们可能用到了云加速,但只要一个节点出问题,站点的访问效果一下在就给拉下来了~~~

通过专业的网站速度测试平台,我们可以掌握不同的网络环境访问网站的速度效果,根据网站速度测试服务提供了网页加载过程分析数据,从而找出导致网页打不开或者加载缓慢的“罪魁祸首”。根据所反馈出来的结果,最终我们可以从调整网站服务器网络环境、修改和完善程序代码来达到网站加速的目的。

本篇文章就来介绍八个免费的在线网站速度测试服务,帮助你全面分析自己的网站在世界各地和国内各个省份地区的访问情况,找出拖慢网页加载速度的“因子”,对症下药,让网站访问速度飞一会儿。

一、PageSpeed Insights 谷歌网站性能工具可优化PC和手机网页

1、PageSpeed Insights 网站:

官网:https://developers.google.com/speed/pagespeed/insights/

免费在线网站速度测试服务

PageSpeed Insights是谷歌推出的网站性能优化工具,它可以分析网页的性能并给出提升性能的建议和措施,PageSpeed Insights还提供Chrome浏览器插件。利用它可以帮助网站开发者找出到底是哪些地方影响的了网站的载入速度。

免费在线网站速度测试服务

根据PageSpeed Insights 给出的网站速度优化建议,我们就可以有针对性调整程序代码了。不过个人建议,PageSpeed Insights 只能是作为网站速度优化的参考,有些修改建议不是很准确。

免费在线网站速度测试服务

PageSpeed Insights 另一大特色就是专门为手机浏览网页提供优化建议,预览图可以实时看到网页在手机中的展示效果,点击修复建议,可以直观地看到要修改的地方,一目了然,非常地方便。

免费在线网站速度测试服务

二、Load Impact 在线网站服务器压力测试和网页分析工具

官网:http://loadimpact.com

免费在线网站速度测试服务

Load Impact是一个在线的网站压力测试服务,它会自动生成模拟用户去访问你的网站,并记录网站在不同的模拟用户访问的情况下,网站服务器响应时间和网页加载时间。Load Impact在世界各地都有测试节点,完全可以通过对比,综合评定网站响应速度。

免费在线网站速度测试服务

下图表示模拟用户从0增加到24时网站的响应时间。

免费在线网站速度测试服务

Load Impact还会给出网页加载数据分析,帮助你找出网页加载最慢的部分。
Load Impact还可以为电子商务网站和B2B网站进行负载测试和报告。

免费在线网站速度测试服务

免费在线网站速度测试服务

三、Gtmetrix 老牌优秀的网页性能测试网站-整合了Yahoo! YSlow

官网:http://gtmetrix.com/

免费在线网站速度测试服务

Gtmetrix 是国外一个老牌的网页性能测试网站。以前他主要用来做网站页面载入速度因素免费在线分析,现在Gtmetrix整合了Google Page Speed 和 Yahoo! YSlow 来对你的网站进行评级。

根据Gtmetrix 提供的可行性建议,来帮助改善你的网站性能。

四、奇云测 360站长工具网速测试平台

官网:http://ce.cloud.360.cn/

免费在线网站速度测试服务

奇云测是360推出的在线网站测试平台,有GET检测和PING检测,目前监测节有76个,覆盖了25个省份,同时根据检测结果,还会给网站打出综合分。所以,如果你的站点主要访问对象为国内用户的话,不妨试试看这个工具哦~~
虽然360总闹出一些新闻,但是不可否认的是他在中国IT业内也还是带来了一些积极方面的影响的……

奇云测网站速度测试还加入了瀑布流图,能精确地描述每一个页面元素的加载情况,能够方便你找出网页中哪些部分加载的速度比较慢。

免费在线网站速度测试服务

五、17CE 国内免费的网速测试平台

官网:http://www.17ce.com/

免费在线网站速度测试服务

17CE是国内一个提供网站速度测试服务的网站,目前节点有82个,覆盖了24个省份。除了GET网站速度测试、PING速度测试、DNS解析检查、TraceRoute路由跟踪。

免费在线网站速度测试服务

17CE有全面的报表功能、对比功能、地图展示、柱型图展示等,基本上可以直观地看出自己的网站在哪些地方访问得快,哪些地方访问得慢。

免费在线网站速度测试服务

六、Webkaka 卡卡网即时测试网站访问速度

官网:http://www.webkaka.com/

免费在线网站速度测试服务

Webkaka 卡卡网算是一个比较老牌的网站速度测试网站了网,站功能比较齐全。包括网站测速、压力测试、ping测试、DNS查询等等,唯一吐槽的就是Webkaka的网页广告是这十个在线网站速度测试网站中最多的。

免费在线网站速度测试服务

Webkaka 卡卡网网站测速分为国内节点和国外节点,国内又可以分为移动、联通、电信等线路统计数据。

免费在线网站速度测试服务

七、WebPagetest 多节点全方位地测试网站加载速度

官网:http://www.webpagetest.org/

免费在线网站速度测试服务

WebPagetest是国外一个网站速度测试平台,支持选择测试地点和浏览器种类的网站速度测试工具。而且更让人惊奇的是,在这里居然能找到国内的节点。
你可以更真实的测试你网站的目标群体打开你网站的速度和看到的界面,也可以更有针对性的优化你的网站,WebPagetest测试还包括视频采集、内容拦截等其他测试项目。

八、Whichloadsfaster 快速对比网页加载速度

官网:http://whichloadsfaster.com/

免费在线网站速度测试服务

Whichloadsfaster是一个能够快速对比网页加载速度的网站,功能很简单,但是却非常地有用。
例如当你对某一个网站优化后,想要知道优化手段有没有效果,这时用Whichloadsfaster测试一下即可。

打开Whichloadsfaster,直接输入你想要对比两个网站地址,点击Go按钮,Whichloadsfaster会给出两个网站的打开时间,多次测试后,取平均值。

免费在线网站速度测试服务

在线网站速度测试平台使用小结

1、奇云测、17CE 、Webkaka这三个适合国内的网站主机进行速度测试,也可以作为国内用户访问网站的速度参考依据,PageSpeed Insights 、Load Impact、Gtmetrix 则可以用来改善网页加载效率。

2、在线的网站速度测试平台的测试数据还会受到网络环境因素的影响,为了能够更加准确地得出网站的客户访问体验,我们可以整合本地与在线、国内与国外、多个测试平台等测试数据,综合测出网站速度。

标准string中常用数据处理函数

C++标准库的string类提供了3个成员函数来从一个string得到c类型的字符数组:c_str()、data()、copy(p,n)。
这三个函数都可以从字符串中获取其直接的内容,但是针对每一个函数,其中又有略微不同之处
好吧 直接详解他们的不同之处吧~~

1. c_str():生成一个const char*指针,指向以空字符终止的数组。

注:

①这个数组的数据是临时的,当有一个改变这些数据的成员函数被调用后,其中的数据就会失效。因此要么现用先转换,要么把它的数据复制到用户自己可以管理的内存中。看下例:

const char* c;
string s="1234";
c = s.c_str(); 
cout<<c<<endl; //输出:1234
s="abcd";
cout<<c<<endl; //输出:abcd

上面如果继续用c指针的话,导致的错误将是不可想象的。就如:1234变为abcd

其实上面的c = s.c_str(); 不是一个好习惯。既然c指针指向的内容容易失效,我们就应该按照上面的方法,那怎么把数据复制出来呢?这就要用到strcpy等函数(推荐)。

//const char* c; //①
//char* c;       //②
//char c[20]; 
char* c=new char[20];
string s="1234";
//c = s.c_str(); 
strcpy(c,s.c_str());
cout<<c<<endl; //输出:1234
s="abcd";
cout<<c<<endl; //输出:1234

注意:不能再像上面一样①所示了,const还怎么向里面写入值啊;也不能②所示,使用了未初始化的局部变量“c”,运行会出错的 。

② c_str()返回一个客户程序可读不可改的指向字符数组的指针,不需要手动释放或删除这个指针。

2. data():与c_str()类似,但是返回的数组不以空字符终止。

3. copy(p,n,size_type _Off = 0):从string类型对象中至多复制n个字符到字符指针p指向的空间中。

默认从首字符开始,但是也可以指定,开始的位置(记住从0开始)。返回真正从对象中复制的字符。
用户要确保p指向的空间足够保存n个字符。

// basic_string_copy.cpp
// compile with: /EHsc /W3
#include <string>
#include <iostream>

int main( )
{
	using namespace std;
	string str1 ( "1234567890" );
	basic_string <char>::iterator str_Iter;
	char array1 [ 20 ] = { 0 };
	char array2 [ 10 ] = { 0 };
	basic_string <char>:: pointer array1Ptr = array1;
	basic_string <char>:: value_type *array2Ptr = array2;

	cout << "The original string str1 is: ";
	for ( str_Iter = str1.begin( ); str_Iter != str1.end( ); str_Iter++ )
		cout << *str_Iter;
	cout << endl;

	basic_string <char>:: size_type nArray1;
	// Note: string::copy is potentially unsafe, consider
	// using string::_Copy_s instead.
	nArray1 = str1.copy ( array1Ptr , 12 );  // C4996
	cout << "The number of copied characters in array1 is: "
		<< nArray1 << endl;
	cout << "The copied characters array1 is: " << array1Ptr << endl;

	basic_string <char>:: size_type nArray2;
	// Note: string::copy is potentially unsafe, consider
	// using string::_Copy_s instead.
	nArray2 = str1.copy ( array2Ptr , 5 , 6  );  // C4996
	cout << "The number of copied characters in array2 is: "
		<< nArray2 << endl;
	cout << "The copied characters array2 is: " << array2Ptr << endl;

	////注意一定要使array3有足够的空间
	//char array3[5]={0};
	//basic_string<char>::pointer array3Ptr=array3;
	//basic_string<char>::size_type nArray3;
	//nArray3 = str1.copy(array3,9); //错误!!!!
	//cout<<"The number of copied characters in array3 is: "
	//  <<nArray3<<endl;
	//cout<<"The copied characters array3 is: "<<array3Ptr<<endl;
}

一定要注意在使用数组的时候需要申请足够的空间,否则系统会报Stack around the variable ‘array3’ was corrupted.【数组越界】的错误哦~~~

本文参考至:csqlwy

2014考研英语(一)试题与参考答案

Section I Use of English

Directions:
Read the followingtext. Choose the best word(s) for each numbered blank and mark A,B,C or D onthe ANSWER SHEET.(10 points)
As many people hitmiddle age, they often start to notice that their memory and mental clarity arenot what they used to be. We suddenly can’t remember___1___ we put the keys just a moment ago, or an old acquaintance’s name, or the name of an old band we used to love. As the brain___2___, we refer to these occurrences as “senior moments.” ___3___seemingly innocent, this loss of mental focus can potentially have a (n)___4___ impact on our professional, social, and personal ___5___.
Neuroscientists,experts who study the nervous system, are increasingly showing that there’s actually a lot that can be done. It ___6___ out that the brainneeds exercise in much the same way our muscles do, and the right mental___7___ can significantly improve our basic cognitive ___8___. Thinking isessentially a ___9___ of making connections in the brain. To a certain extent,our ability to ___10___ in making the connections that drive intelligence isinherited. ___11___, because these connections are made through effort andpractice, scientists believe that intelligence can expand and fluctuate___12___ mental effort.
Now, a new Web-basedcompany has taken it a step ___13___ and developed the first “braintraining program” designed to actually help people improve and regaintheir mental ___14___.
The Web-based program___15___ you to systematically improve your memory and attention skills. Theprogram keeps ___16___ of your progress and provides detailed feedback ___17___your performance and improvement. Most importantly, it ___18___modifies andenhances the games you play to ___19___ on the strengths you are developing—much like a(n) ___20___exercise routine requires you to increaseresistance and vary your muscle use.

1 [A]where [B]when [C]that [D]why
2 [A]improves [B]fades [C]recovers [D]collapses
3 [A]If [B]Unless [C]Once [D]While
4 [A]uneven [B]limited [C]damaging [D]obscure
5 [A]wellbeing [B]environment [C]relationship [D]outlook
6 [A]turns [B]finds [C]points [D]figures
7 [A]roundabouts [B]responses [C]workouts [D]associations
8 [A]genre [B]functions [C]circumstances [D]criterion
9 [A]channel [B]condition [C]sequence [D]process
10 [A]persist [B]believe [C]excel [D]feature
11 [A]Therefore [B]Moreover [C]Otherwise [D]However
12 [A]accordingto [B]regardlessof [C]apartfrom [D]insteadof
13 [A]back [B]further [C]aside [D]around
14 [A]sharpness [B]stability [C]framework [D]flexibility
15 [A]forces [B]reminds [C]hurries [D]allows
16 [A]hold [B]track [C]order [D]pace
17 [A]to [B]with [C]for [D]on
18 [A]irregularly [B]habitually [C]constantly [D]unusually
19 [A]carry [B]put [C]build [D]take
20 [A]risky [B]effective [C]idle [D]familiar

Section Ⅱ Reading Comprehension

Part A
Directions:
Read the following four texts.Answer the questions below each text by choosing A, B, C or D. Mark youranswers on the ANSWER SHEET. (40 points)

Text 1

  In order to”change lives for the better” and reduce “dependency”George Osborne, Chancellor of the Exchequer, introduced the “upfront worksearch” scheme. Only if the jobless arrive at the jobcentre with a CV,register for online job search, and start looking for work will they be eligiblefor benefit and then they should report weekly rather than fortnightly. Whatcould be more reasonable?
More apparentreasonableness followed. There will now be a seven-day wait for the jobseeker’s allowance. “Those first few days should be spent looking forwork, not looking to sign on.” he claimed. “We’re doing these things because we know they help people stay offbenefits and help those on benefits get into work faster.” Help? Really?On first hearing, this was the socially concerned chancellor, trying to changelives for the better, complete with “reforms” to an obviouslyindulgent system that demands too little effort from the newly unemployed tofind work, and subsidises laziness. What motivated him, we were to understand,was his zeal for “fundamental fairness”—protecting the taxpayer, controlling spending and ensuring that only the mostdeserving claimants received their benefits.
Losing a job ishurting: you don’t skip down to the jobcentre with asong in your heart, delighted at the prospect of doubling your income from thegenerous state. It is financially terrifying, psychologically embarrassing andyou know that support is minimal and extraordinarily hard to get. You are nownot wanted; you support is minimal and extraordinarily hard to get. You are nownot wanted; you are now excluded from the work environment that offers purposeand structure in your life. Worse, the crucial income to feed yourself and yourfamily and pay the bills has disappeared. Ask anyone newly unemployed what theywant and the answer is always: a job.
But in Osborneland,your first instinct is to fall into dependency —permanent dependency if you can get it — supported by astate only too ready to indulge your falsehood. It is as though 20 years ofever-tougher reforms of the job search and benefit administration system neverhappened. The principle of British welfare is no longer that you can insureyourself against the risk of unemployment and receive unconditional payments ifthe disaster happens. Even the very phrase “jobseeker’s allowance” — invented in 1996 — is about redefining the unemployed as a “jobseeker” whohad no mandatory right to a benefit he or she has earned through makingnational insurance contributions. Instead, the claimant receives a time-limited”allowance,” conditional on actively seeking a job; no entitlementand no insurance, at £71.70 aweek, one of the least generous in the EU.
21. George Osborne’s scheme was intended to
[A]provide theunemployed with easier access to benefits.
[B]encourage jobseekers’ active engagement in job seeking.
[C]motivate theunemployed to report voluntarily.
[D]guaranteejobseekers’legitimate right to benefits.
22. The phrase, “to signon” (Line 3, Para. 2) most probably means
[A]to check on theavailability of jobs at the jobcentre.
[B]to accept thegovernment’s restrictions on the allowance.
 [C]to register for anallowance from the government.
[D]to attend agovernmental job-training program.
23. What prompted thechancellor to develop his scheme?
[A]A desire to secure abetter life for all.
[B]An eagerness toprotect the unemployed.
[C]An urge to begenerous to the claimants.
  [D]A passion to ensurefairness for taxpayers.
24. According to Paragraph 3,being unemployed makes one feel
 [A]uneasy
[B]enraged.
[C]insulted.
[D]guilty.
25. To which of the followingwould the author most probably agree?
[A]The British welfaresystem indulges jobseekers’ laziness.
[B]Osborne’s reforms will reduce the risk of unemployment.
[C]The jobseekers’ allowance has met their actual needs.
 [D]Unemploymentbenefits should not be made conditional.

Text 2

  All around the world,lawyers generate more hostility than the members of any other profession—with the possible exception of journalism. But there are few placeswhere clients have more grounds for complaint than America.
During the decadebefore the economic crisis, spending on legal services in America grewtwice as fast as inflation. The best lawyers made skyscrapers-full of money,tempting ever more students to pile into law schools. But most law graduatesnever get a big-firm job. Many of them instead become the kind ofnuisance-lawsuit filer that makes the tort system a costly nightmare.
There are many reasonsfor this. One is the excessive costs of a legal education. There is just onepath for a lawyer in most American states: a four-year undergraduate degree insome unrelated subject, then a three-year law degree at one of 200 law schoolsauthorized by the American Bar Association and an expensive preparation for thebar exam. This leaves today’s average law-schoolgraduate with $100,000 of debt on top of undergraduate debts. Law-school debtmeans that many cannot afford to go into government or non-profit work, andthat they have to work fearsomely hard.
Reforming the systemwould help both lawyers and their customers. Sensible ideas have been aroundfor a long time, but the state-level bodies that govern the profession havebeen too conservative to implement them. One idea is to allow people to studylaw as an undergraduate degree. Another is to let students sit for the barafter only two years of law school. If the bar exam is truly a stern enoughtest for a would-be lawyer, those who can sit it earlier should be allowed to doso. Students who do not need the extra training could cut their debt mountainby a third.
The other reason whycosts are so high is the restrictive guild-like ownership structure of thebusiness. Except in the District of — Columbia, non-lawyers may not own any share of a lawfirm. This keeps fees high and innovation slow. There is pressure for changefrom within the profession, but opponents of change among the regulators insistthat keeping outsiders out of a law firm isolates lawyers from the pressure tomake money rather than serve clients ethically.
In fact, allowingnon-lawyers to own shares in law firms would reduce costs and improve servicesto customers, by encouraging law firms to use technology and to employprofessional managers to focus on improving firms’efficiency. After all, other countries, such as Australiaand Britain,have started liberalizing their legal professions. America should follow.
26.a lot of students take uplaw as their profession due to
[A]the growing demandfrom clients.
[B]the increasingpressure of inflation.
[C]the prospect ofworking in big firms.
  [D]the attraction offinancial rewards.
27.Which of the following addsto the costs of legal education in most American states?
[A]Higher tuition feesfor undergraduate studies.
[B]Admissions approvalfrom the bar association.
[C]Pursuing a bachelor’s degree in another major.
[D]Receiving trainingby professional associations.
28.Hindrance to the reform ofthe legal system originates from
[A]lawyers’ and clients’ strong resistance.
[B]the rigid bodiesgoverning the profession.
[C]the stem exam forwould-be lawyers.
[D]non-professionals’sharp criticism.
29.The guild-like ownershipstructure is considered “restrictive”partly because it
[A]bans outsiders’ involvement in the profession.
[B]keeps lawyers fromholding law-firm shares.
[C]aggravates theethical situation in the trade.
[D]prevents lawyers fromgaining due profits.
30.In this text, the authormainly discusses
[A]flawed ownership ofAmerica’s law firms and its causes.
[B]the factors thathelp make a successful lawyer in America.
[C]a problem in America’s legal profession and solutions to it.
[D]the role ofundergraduate studies in America’s legal education.

Text 3

  The US$3-millionFundamental physics prize is indeed an interesting experiment, as AlexanderPolyakov said when he accepted this year’s award inMarch. And it is far from the only one of its type. As a News Feature articlein Nature discusses, a string of lucrative awards for researchers have joinedthe Nobel Prizes in recent years. Many, like the Fundamental Physics Prize, arefunded from the telephone-number-sized bank accounts of Internet entrepreneurs.These benefactors have succeeded in their chosen fields, they say, and theywant to use their wealth to draw attention to those who have succeeded inscience.
What’s not to like? Quite a lot, according to a handful of scientistsquoted in the News Feature. You cannot buy class, as the old saying goes, andthese upstart entrepreneurs cannot buy their prizes the prestige of the Nobels,The new awards are an exercise in self-promotion for those behind them, sayscientists. They could distort the achievement-based system of peer-review-ledresearch. They could cement the status quo of peer-reviewed research. They donot fund peer-reviewed research. They perpetuate the myth of the lone genius.
The goals of theprize-givers seem as scattered as the criticism. Some want to shock, others todraw people into science, or to better reward those who have made their careersin research.
As Nature has pointedout before, there are some legitimate concerns about how science prizes—both new and old—are distributed. TheBreakthrough Prize in Life Sciences, launched this year, takes anunrepresentative view of what the life sciences include. But the NobelFoundation’s limit of three recipients per prize, eachof whom must still be living, has long been outgrown by the collaborativenature of modern research—as will be demonstrated bythe inevitable row over who is ignored when it comes to acknowledging thediscovery of the Higgs boson. The Nobels were, of course, themselves set up bya very rich individual who had decided what he wanted to do with his own money.Time, rather than intention, has given them legitimacy.
As much as somescientists may complain about the new awards, two things seem clear. First,most researchers would accept such a prize if they were offered one. Second, itis surely a good thing that the money and attention come to science rather thango elsewhere, It is fair to criticize and question the mechanism—that is the culture of research, after all—butit is the prize-givers’ money to do with as theyplease. It is wise to take such gifts with gratitude and grace.
31. The Fundamental PhysicsPrize is seen as
[A]a symbol of theentrepreneurs’ wealth.
[B]a possiblereplacement of the Nobel Prizes.
[C]an example ofbankers’ investments.
[D]a handsome rewardfor researchers.
32. The critics think that thenew awards will most benefit
[A]the profit-orientedscientists.
[B]the founders of thenew awards.
[C]theachievement-based system.
[D]peer-review-ledresearch.
33. The discovery of the Higgsboson is a typical case which involves
[A]controversies overthe recipients’ status.
[B]the joint effort ofmodern researchers.
[C]legitimate concernsover the new prizes.
[D]the demonstration ofresearch findings.
34. According to Paragraph4,which of the following is true of the Nobels?
[A]Their endurance hasdone justice to them.
[B]Their legitimacy haslong been in dispute.
[C]They are the mostrepresentative honor.
[D]History has nevercast doubt on them.
35.The author believes that thenow awards are
 [A]acceptable despitethe criticism.
[B]harmful to theculture of research.
[C]subject toundesirable changes.
[D]unworthy of publicattention.

Text 4

  ”The Heart of theMatter,” the just-released report by the AmericanAcademy of Arts and Sciences (AAAS),deserves praise for affirming the importance of the humanities and social sciencesto the prosperity and security of liberal democracy in America. Regrettably, however, thereport’s failure to address the true nature of thecrisis facing liberal education may cause more harm than good.
In 2010, leadingcongressional Democrats and Republicans sent letters to the AAAS asking that itidentify actions that could be taken by “federal, state and localgovernments, universities, foundations, educators, individual benefactors andothers” to “maintain national excellence in humanities and socialscientific scholarship and education.” In response, the American Academyformed the Commission on the Humanities and Social Sciences. Among thecommission’s 51 members are top-tier-universitypresidents, scholars, lawyers, judges, and business executives, as well asprominent figures from diplomacy, filmmaking, music and journalism.
The goals identified inthe report are generally admirable. Because representative governmentpresupposes an informed citizenry, the report supports full literacy; stressesthe study of history and government, particularly American history and Americangovernment; and encourages the use of new digital technologies. To encourageinnovation and competition, the report calls for increased investment inresearch, the crafting of coherent curricula that improve students’ ability to solve problems and communicate effectively in the 21stcentury, increased funding for teachers and the encouragement of scholars tobring their learning to bear on the great challenges of the day. The reportalso advocates greater study of foreign languages, international affairs andthe expansion of study abroad programs.
Unfortunately, despite2&frac12; years in the making, “The Heart of theMatter” never gets to the heart of the matter: the illiberal nature ofliberal education at our leading colleges and universities. The commissionignores that for several decades America’s colleges and universities haveproduced graduates who don’t know the content andcharacter of liberal education and are thus deprived of its benefits. Sadly,the spirit of inquiry once at home on campus has been replaced by the use ofthe humanities and social sciences as vehicles for publicizing”progressive,” or left-liberal propaganda.
Today, professorsroutinely treat the progressive interpretation of history and progressivepublic policy as the proper subject of study while portraying conservative orclassical liberal ideas—such as free markets andself-reliance—as falling outside the boundaries ofroutine, and sometimes legitimate, intellectual investigation.
The AAAS displays greatenthusiasm for liberal education. Yet its report may well set back reform byobscuring the depth and breadth of the challenge that Congress asked it toilluminate.
36. According to Paragraph 1,what is the author’s attitude toward the AAAS’s report?
[A] Critical
[B] Appreciative
[C] Contemptuous
[D] Tolerant
37. Influential figures in theCongress required that the AAAS report on how to
[A] retain people’s interest in liberal education
[B] define thegovernment’s role in education
 [C] keep a leadingposition in liberal education
[D] safeguardindividuals’ rights to education
38. According to Paragraph 3,the report suggests
[A] an exclusive studyof American history
[B] a greater emphasison theoretical subjects
[C] the application ofemerging technologies
[D] funding for thestudy of foreign languages
39. The author implies inParagraph 5 that professors are
[A] supportive of freemarkets
[B] cautious aboutintellectual investigation
[C] conservative aboutpublic policy
[D] biased againstclassical liberal ideas
40. Which of the followingwould be the best title for the text?
[A] Ways to Grasp”The Heart of the Matter”
[B] Illiberal Educationand “The Heart of the Matter”
[C] The AAAS’s Contribution to Liberal Education
[D] Progressive Policyvs. Liberal Education
Part B
Directions:
The following paragraphs aregiven in a wrong order. For Questions 41-45, you are required to reorganizethese paragraphs into a coherent text by choosing from the list A-G and fillingthem into the numbered boxes. Paragraphs A and E have been correctly placedMark your answers on the ANSWER SHEET (10 points)
[A] Some archaeological sites have always been easily observable—for example, theParthenon in Athens, Greece, the pyramids of Giza in Egypt; and the megalithsof Stonehenge in southern England.But these sites are exceptions to the norm. Most archaeological sites have beenlocated by means of careful searching, while many others have been discoveredby accident. Olduvai Gorge, an early hominid site in Tanzania, was found by a butterflyhunter who literally fell into its deep valley in 1911. Thousands of Aztecartifacts came to light during the digging of the Mexico City subway in the 1970s.
[B]In another case, American archaeologists Rene Million andGeorge Cowgill spent years systematically mapping the entire city of Teotihuacan in the Valleyof Mexico near what is now Mexico City. At its peakaround AD 600, this city was one of the largest human settlements in the world.The researchers mapped not only the city’s vast and ornate ceremonial areas, but alsohundreds of simpler apartment complexes where common people lived.
[C] How do archaeologists know where to find what they are lookingfor when there is nothing visible on the surface of the ground? Typically, theysurvey and sample (make test excavations on) large areas of terrain todetermine where excavation will yield useful information. Surveys and test sampleshave also become important for understanding the larger landscapes that containarchaeological sites.
[D] Surveys can cover a single large settlement or entirelandscapes. In one case, many researchers working around the ancient Maya cityof Copan, Honduras, have located hundreds ofsmall rural villages and individual dwellings by using aerial photographs andby making surveys on foot. The resulting settlement maps show how thedistribution and density of the rural population around the city changed dramaticallybetween AD 500 and 850, when Copancollapsed.
[E] To find their sites, archaeologists today rely heavily onsystematic survey methods and a variety of high-technology tools andtechniques. Airborne technologies, such as different types of radar andphotographic equipment carried by airplanes or spacecraft, allow archaeologiststo learn about what lies beneath the ground without digging. Aerial surveyslocate general areas of interest or larger buried features, such as ancientbuildings or fields.
[F] Most archaeological sites, however, are discovered byarchaeologists who have set out to look for them. Such searches can take years.British archaeologist Howard Carter knew that the tomb of the Egyptian pharaohTutankhamun existed from information found in other sites. Carter siftedthrough rubble in the Valley of the Kings for seven years before he located thetomb in 1922. In the late 1800s British archaeologist Sir Arthur Evan combedantique dealers’ stores in Athens, Greece. He was searching for tiny engraved sealsattributed to the ancient Mycenaean culture that dominated Greece from the1400s to 1200s BC. Evans’s interpretations of theseengravings eventually led him to find the Minoan palace at Knossos (Knossós) on the island of Crete, in 1900.
[G] Ground surveys allow archaeologists to pinpoint the placeswhere digs will be successful. Most ground surveys involve a lot of walking,looking for surface clues such as small fragments of pottery. They ofteninclude a certain amount of digging to test for buried materials at selectedpoints across a landscape. Archaeologists also may locate buried remains byusing such technologies as ground radar, magnetic-field recording, and metaldetectors. Archaeologists commonly use computers to map sites and thelandscapes around sites. Two and three-dimensional maps are helpful tools inplanning excavations, illustrating how sites look, and presenting the resultsof archaeological research.
41. → A →42. → E →43. → 44. →45.
  C → A → F → E → G → D → B
Part C
Directions:
Read the following textcarefully and then translate the underlined segments into Chinese. Yourtranslation should be written neatly on the ANSWER SHEET. (10 points)
Music means differentthings to different people and sometimes even different things to the sameperson at different moments of his life. It might be poetic, philosophical,sensual, or mathematical, but in any case it must, in my view, have somethingto do with the soul of the human being. Hence it is metaphysical; but the meansof expression is purely and exclusively physical: sound. I believe it isprecisely this permanent coexistence of metaphysical message through physicalmeans that is the strength of music. (46)It is also the reason why when wetry to describe music with words, all we can do is articulate our reactions toit, and not grasp music itself.
Beethoven’s importance in music has been principally defined by therevolutionary nature of his compositions. He freed music from hithertoprevailing conventions of harmony and structure. Sometimes I feel in his lateworks a will to break all signs of continuity. The music is abrupt andseemingly disconnected, as in the last piano sonata. In musical expression, hedid not feel restrained by the weight of convention. (47)By all accounts hewas a freethinking person, and a courageous one, and I find courage anessential quality for the understanding, let alone the performance, of hisworks.
This courageousattitude in fact becomes a requirement for the performers of Beethoven’s music. His compositions demand the performer to show courage, forexample in the use of dynamics. (48)Beethoven’s habit of increasing the volume with an intense crescendo and thenabruptly following it with a sudden soft passage was only rarely used bycomposers before him.
Beethoven was a deeplypolitical man in the broadest sense of the word. He was not interested in dailypolitics, but concerned with questions of moral behavior and the largerquestions of right and wrong affecting the entire society. (49)Especially significantwas his view of freedom, which, for him, was associated with the rights andresponsibilities of the individual: he advocated freedom of thought and ofpersonal expression.
Beethoven’s music tends to move from chaos to order as if order were an imperativeof human existence. For him, order does not result from forgetting or ignoringthe disorders that plague our existence; order is a necessary development, animprovement that may lead to the Greek ideal of spiritual elevation. It is notby chance that the Funeral March is not the last movement of the EroicaSymphony, but the second, so that suffering does not have the last word. (50)Onecould interpret much of the work of Beethoven by saying that suffering isinevitable, but the courage to fight it renders life worth living.
译文:
(46)也正是因为如此,当我们试图用言语描述音乐的时候,我们所能做的,只是去说明我们对于音乐的反应,而非去把握音乐本身。
(47)无论如何,他是一个自由思考的人,一个充满勇气的人。并且,我认为,要理解贝多芬音乐,勇气是必不可少的,更不要提演绎其音乐。
(48)贝多芬习惯用密集的、渐强的音符增加音量,继而突然接续一段轻柔的乐章,这种手法此前的作曲家几乎没有用过。
(49)尤为重要的是他对自由的看法,自由于他而言,与个人权责息息相关,因此,他一直倡导自由的思考,自由的个人表达。
(50)也许人们会这样去理解贝多芬作品,认为痛苦是必不可少的,但实际上,只有具有与痛苦抗争的勇气,才会拥有值得一过的人生。

Section Ⅲ Writing

Part A
51. Directions:
Write a letter of about 100 words to the president ofyour university, suggesting how to improve students’physical condition.
You should include the details you think necessary.
You should write neatly on the ANSWER SHEET.
Do not sign your own name at the end of the letter. Use”Li Ming” instead.
Do not write the address. (10 points)

<>NBF优秀范文:
Dear Mr. President,
I am a student from the department of chemistry. I find it is necessary to improve students’ physical conditions and I would like to propose some suggestions it in this letter.
Following are my suggestions on it. Firstly, the awareness of this issue should be enhanced, which is of utmost importance. Nowadays, intellectual abilities are greatly emphasized while the physical training has been more or less neglected. Secondly, I suggest that some specific measures should be taken, such as doing morning exercise every day and encouraging students to participate in the sports events on the campus, to improve the situation. Last and not least, an optimistic attitude should be held towards it. Confidence will help us deal with this situation.
I hope you will find these suggestions useful. I have good reasons to expect a bright future if we address this issue with due emphasis.

?Yours sincerely,
Li Ming

Part B
52. Directions:  Write an essay of 160-200 words based on the followingdrawing. In your essay, you should  1) describe the drawing briefly,  2) interpret its intended meaning, and  3) give your comments.  You should write neatly on the ANSWER SHEET(20 points)

考研

左图的文字:三十年前
右图的文字:现在
图底的文字:相携

NBF优秀范文:
The pictures above vividly portray the scenes of a girl being together with her mother. The picture on the left side describes the situation thirty years ago when the girl was little and the mother was young. The one on the right side depicts that now the girl has grown up, holding her mother arm in arm. At the bottom of the picture, a line of words read “holding each other in your life”.
The picture above reveals to us such a phenomenon: more and more young people realize how much their parents have devoted to them and try to return the parental love. This phenomenon occurs at least for the following reasons. Firstly, the harmonious atmosphere of the society has left its imprint on one’s family, which is the cell of the society. Children’s consideration of the aged parents is a good example. Secondly, family means a lot for everyone. Therefore, parents tend to think of their children when they make a plan for their life, and vice versa. Thirdly, the traditional Chinese culture has always put great emphasis on family, which partially explains one’s great sense of responsibility to their family members.
In sum, a healthy relationship between children and parents should be maintained. In my opinion, people should take the welfare of family as a whole into consideration as the pictures show. Otherwise, a harmonious relationship among family members cannot be kept and a happy life cannot be guaranteed.

网页版的看的不爽?可以尝试一下下载PDF版本的哦…. ?本文参考至:NBF考研