Friday, May 29, 2009

Editor|Windows 下 22 个实用的代码编辑器

Windows 下 22 个实用的代码编辑器 | Just不咯个

Windows 下 22 个实用的代码编辑器

2009年5月27日

【原创翻译】Windows 下 22 个实用的代码编辑器

虽然 Windows 下的代码编辑器有很多,但只有少数值得一用,而毕竟需要一段时间才能够找到最适合自己的那一个,所以来挑一个你喜欢的吧!

需要指出的是,我所提到的仅仅是每个编辑器最为突出的特点,显然还有很多其他的选择。此外,虽然我只提到了一个编辑器的特性之一,但这并不意味着其他的编辑器就不具备这样的功能了。那么,我们开始吧!

原文链接 http://net.tutsplus.com/articles/web-roundups/22-neat-code-editors-for-windows/

1.Notepad++

官方网站 http://notepad-plus.sourceforge.net

最新版本 v 5.3.2 | 免费版

这可能是 Windows 里最好的免费文本编辑器了,具有简单的功能,从语法高亮、代码折叠到 FTP,Notepad++ 可以应付绝大多数情况,我最喜欢的功能是文件状态自动检测:当 Notepad++ 运行时,它会自动检查所有当前打开文件的变动,让你知道是否有文件被更新或删除。Notepad++ 基于 Scintilla 编辑引擎。

2.JEdit

官方网站 http://jedit.org

最新版本 v 4.20 | 免费版

在我看来,JEdit 是相当丑陋的,但它有一个大方的功能集合,作为一个 Java 程序,它是多平台的,它对超过 130 种语言提供了语法高亮功能。虽然官方网站声称它支持折叠,但我却找不到这个功能。JEdit 还有一个插件库,这可以实现更多的功能。

3.Notepad2

官方网站 http://www.flos-freeware.ch/notepad2.html

最新版本 v 3.0.20 | 免费版

Notepad2 也是基于 Scintilla 编辑引擎的,但是它要比 Notepad++ 简单得多了,它标榜自己快速,轻量并与记事本相似,它提供多种语言的代码高亮。Notepad2 不需要安装,解压后就可以直接运行。还有一些修改后的版本(更多功能和语言支持)。

4.Programmer's Notepad

官方网站 http://pnotepad.org

最新版本 v 2 0.9.926 | 免费版

Programmer's Notepad 与 Notepad2 有着相似的用户界面,它支持多文件同时开启,还有书签、折叠和代码高亮的功能,但除此之外,也没什么了。

5.Crimson Editor

官方网站 http://www.crimsoneditor.com/

最新版本 v 3.7 | 免费版

CrimsonEditor 提供宏支持并能够运行外部程序。它能够通过内置的 FTP 客户端编辑远程文件,还能够进行拼写检查,此外,它还有一个简洁的"列选择"模式。

6.ConTEXT

官方网站 http://www.contexteditor.org/

最新版本 v 0.98.5 | 免费版

ConTEXT 支持许多种语言,不论是人类语言还是机器语言;而且还可以让你定义自己的自定义语言。它可以进行文件比较并将结果导出为 HTML,还包括其他一些有趣的功能。实用功能之一:ConTEXT 能够记忆你关闭文件时的光标位置,并且当再次打开该文件的时候将光标还原。

7.SciTE

官方网站 http://gisdeveloper.tripod.com/scite.html

最新版本 v 1.77 | 免费版

SciTE 是一个非常简单的文本编辑器,同样基于 Scintilla。它非常简单,但支持大约 30 种语言的语法高亮和正则表达式的搜索与替换。

8.Editra

官方网站 http://editra.org/

最新版本 v 0.4.88 | 免费版

Editra 声称还在初级开发阶段,但已经提供了一大堆功能:用户配置文件,自动完成,会话保存和六十多种语言的语法高亮。可通过插件扩展的功能集,提供了综合的 Python 控制台,FTP 客户端,文件浏览器,计算器等等。

9.PSPad

官方网站 http://www.pspad.com/en/

最新版本 v 4.5.3 | 免费版

PSPad 提供了模板,一个有趣的内置网页浏览器,一个宏记录表。它也支持十六进制编辑和某种程度的代码编译。PSPad 同时集成了 TopStyle Lite,假如用它来编辑 CSS 代码的话会派上用场。

10.RJ TextEd

官方网站 http://www.rj-texted.se/

最新版本 v 5.10 | 免费版

RJ TextEd 同样集成了 TopStyle Lite,可以进行 HTML 的验证与格式化。它具有 FTP 客户端,文件浏览器和一个代码浏览器,还有一个字符映射表并支持 E-mail。

11.SourceEdit

官方网站 http://www.brixoft.net/prodinfo.asp?id=1

最新版本 v 4 | 免费版

SourceEdit 具有的功能包括剪贴板历史,语法高亮和一大套语言的自动完成,十六进制编辑器和 FTP 客户端,同样支持宏。

12.TotalEdit

官方网站 http://www.codertools.com/totaledit.aspx

最新版本 v 5.2 | 免费版

TotalEdit 可以进行文件比较,正则表达式搜索与替换,并具有多种方案用于文件备份/版本控制。还能够对 (x)HTML 和 XML 进行自定义格式化,还具有一个拼写检查器。如果需要,可以将其安装在 USB 驱动器上,以随身携带。此外,还能将正在编辑的文件通过 E-mail 发送。

13.Emacs

官方网站 http://www.gnu.org/software/emacs/

最新版本 v 22.3 | 免费版

不只是可以编辑纯文本文件,Emacs 具有特殊的功能帮助你在许多不同的程序里编写并标记语言。Emacs 可以比较并高亮显示两个文件间的异同。Emacs 还是个文件管理器。Emacs 能够阅读新闻,邮件和 RSS 更新。你甚至能在 Emacs 上玩俄罗斯方块。你可能会发现人们不只把 Emacs 看做是文本编辑器,Emacs 几乎是一个完整的操作系统。而有些用户还发现他们可以通过 Emacs 完成绝大部分的工作。

14.Vim

官方网站 http://www.vim.org/

最新版本 v 7.2 | 免费版

Vim 是一个难以置信的复杂的编辑器,在这个编辑器列表上它是与 Emacs 最为相似的了(虽然 Vim 和 Emacs 的用户之间似乎有点儿矛盾)。考虑到有大量的关于它的文章(更不用说我对 Vim 只有粗略的了解了),我不认为短短的几段话能把它表述清楚。我只想说,Vim 具有这篇文章里所提到的所有功能,并且还有几百个以上。对于初学者,看看这个"Vim in 6k"吧。

15.Bespin

官方网站 http://bespin.mozilla.com

最新版本 v 0.2.2 | Free

我知道 Bespin 不是一个通常意义上的 Windows 文本编辑器,而且它几乎没有其他编辑器的那些功能集,但我把它放入这个列表中,因为我真的喜欢在线编辑器的这个概念,并且它有一项其他编辑器都不具有的功能:云存取你的代码。Bespin 还提供了面向 HTML,CSS 和 JavaScript 的语法高亮功能。

16.Textpad

官方网站 http://www.textpad.com/products/textpad/index.html

最新版本 v 5.2.0 | 售价 $24.70

TextPad 是一个相当简单的编辑器:它拥有列选择,文件间文本拖放功能,还支持超级链接。它也支持大型文件(取决于你的虚拟内存设置)。就这么多?哦,功能列表还提到了右键菜单的支持。

17.E-Text Editor

官方网站 http://www.e-texteditor.com/

最新版本 v 1.0.30 | 售价 $34.96

这是最有趣的编辑器之一,主要得益于它为 Windows 带来的"外来化"功能。

与 Cygwin【Windows 下的类 Linux 环境】的紧密结合使你可以使用全部的 Unix Shelll 工具,还可以通过你所选择的语言――例如 Ruby、Perl、Python 等等――扩展功能。

18.In-Type

官方网站 http://intype.info

最新版本 v 03.x (alpha) | 目前免费,预计售价 $25-$45

Intype 是一个仍在开发中的相当简洁的小型编辑器。目前它还没有很多的功能(甚至不能拖放文本),但看起来它将会变得相当出色。它所提供的代码片段很不错,并且已经提供了非常广泛的选择,支持 20 多种语言(支持添加额外的语言)。关注它吧,它是大有前途的。

19.EditPlus

官方网站 http://www.editplus.com/

最新版本 v 3.10 | 售价 $35.00

EditPlus 没有什么独特的功能,但也有值得一提的细节:高亮显示 URL 和 E-mail 地址,Ctrl 键+双击激活它们。它还有一个用来预览 HTML 的内置浏览器,并提供了 FTP 和 SFTP 支持。同样还支持宏和正则表达式查找与替换功能。

20.HippoEDIT

官方网站 http://www.hippoedit.com

最新版本 v 1.42 | 售价 $39.95

针对自动完成 HippoEdit 提供了一些独特的功能:当你输入的时候有"小提示"在光标上以气泡的形式出现,显示对已输入内容的自动完成建议。它能够对 20 多种语言语法高亮,还提供这些语言的代码模板。HippoEdit 还支持自定义键盘快捷键和工作区布局。

21.UltraEdit

官方网站 http://www.ultraedit.com/products/ultraedit.html

最新版本 v 15. | 售价 $49.95

与文本编辑器相比 UltraEdit 更像是一个 IDE;有成百上千种功能融为一体。UltraEdit 是超级可定制的,不仅仅面向 Web 开发者,它有不同的"使用环境"供用户选择,这主要取决于你具体要做什么。看上去"几乎所有编辑任务"都是可自动化完成的。UltraEdit 还支持 FTP 并拥有内置的 SSH/telnet 控制台用于访问你的服务器。

22.Sublime Text

官方网站 http://www.sublimetext.com

最新版本 v 1.05 | 售价 $59.00

SublimeText 可能是我所见过的最有趣的编辑器了,主要是因为它具有超酷的"放大镜"功能,能够自由查看放大了的文件。它有一个缺点:选项界面就是一堆文字,这可能会使用户找不到他所要寻找的,对更改设置造成困难。我喜欢 SublimeText 的右键点击链接打开本地文件的选项,它还有一些自动化的功能。总之,它是一个不能错过的文本编辑器。

在调研这篇文章的时候,我发现了其他一些相关的东西。文本编辑器并不只是用于编写代码,它们也为写东西提供了一个良好的环境,出于这种目的,可以看看 WriteMonkeyQ10 或是 DarkRoom。这几种编辑器不是很擅于编写代码,但能够使人在写作时不再容易分心。

如果想要找一些文本编辑方面的有趣提示,点击如下链接欣赏由 Vim 的作者所制作的视频:"Seven Habits for effective Text Editing 2.0"

我很想知道,你用的是哪一种文本编辑器与你用它的理由,假如我漏掉了哪种优秀的文本编辑器,请在评论里告诉我!

Thursday, May 28, 2009

Australia|澳洲中文报纸大全

这是一篇很老的关于澳洲中文报纸业界的文章 - 澳洲中文报纸大全 - 留澳网首页 - 澳洲中文博客 澳大利亚

这是一篇很老的关于澳洲中文报纸业界的文章

上一篇 / 下一篇  2008-08-12 02:57:26

 我们生活在一个全球化的时代,同样生活在一个媒体时代。生活与文化有着不解之缘。有华人生活的地方就有中华文化。伴随着移民留学热潮,移居海外的中国人 日益增多。尽管生活繁碌紧张,但生活在海外的游子对自身文化需求并没有因去国离乡而消失,有歌词道:“洋装虽然穿在身,我心依然是中国心!”大多数人对衣 食住行、游艺交际的要求,再也不满足于简单的生活需求。丰富文化生活、美化精神生活,成为他们的普遍愿望,而且永远无法改变。

  我们知道,海外华文传媒是华侨、华人社会的三大支柱(华侨社团、华文学校、华文报刊) 之一。在新闻传播史上,它的地位也不容忽略。

  首先,它是世界新闻传播领域中的一个重要支系。

  据统计,目前世界华侨华人已近3000万,他们分布在140多个国家和地区,形成了一个庞大的群体。他们既与中华民族一脉相承,保持着血缘亲情,又融入当地社会,为所在国的经济发展和社会进步作着贡献。而为数众多的华侨华人媒体在其中起着重要的作用。[1]

  由此可见,这不仅是一个经济能力的问题,而且是跨国与跨文化传播中深受人们关注的一个领域,也是海外一种特殊的文化现象,而文化必有民族的传统、民族 的心理,其表现是一种内在的韵趣。“她们是海外炎黄子孙艰苦奋斗历史的见证者和记录者,是海外华人华侨社会维系华夏文化,增加凝聚力的重要支柱,是海外华 人华侨发表政见维护族群利益的舆论载体,是世界新闻传播体系中,极具民族特色的一个重要的分支。”[2]

  澳洲是一个以英语为主的国度。自废除白澳政策之后,代之以多元文化为重心。早期的华人屈指可数,谈不上创报办刊,只利用周末或周日开设中文补习学校以 延续华文的发展。曾几何时,尤其是20世纪90年代以来,在澳洲大地上,华文报刊庶几达到泛滥的地步,而且背景各不相同,实力悬殊,各领风骚,竞争激烈, 前景不容乐观。在庞大的华文报业背后,有着某些政治的、经济的、社会的等因素驱动,这同时也联结着中国未来的走向。真可谓此一时彼一时也。

一、华人剧增华文报刊群雄并起

  据不完全统计,澳洲华人现已达到七八十万左右,仅悉尼市就占了一大半。讲华语在悉尼已跃居为除讲英文外的第一大语言。漫步在唐人街、卡市 (CABRAMATTA)、艾士菲(ASHFIELD)镇等区,中华文化的浓厚气息已渗透到让人好像生活在故乡一样,走在大街小巷,随处可见黄皮肤黑头发 的人群。无论是来自香港、台湾或大陆,还是来自印支、新马或斐济,这些华人大多已加入该国国籍或逐步融进了澳洲主流社会,由于澳洲推行多元文化政策,提供 不同文化背景民族以发展条件,因此,华文文化的传播也日趋繁荣,随之涌现的中文报刊杂志吸引了不同层次的华人读者群。

  在远离母体境况下的澳洲华文媒体,经过业者的辛勤耕耘,拓出一片新天地。不过,华文媒体的荣枯,同澳洲华人移民的兴衰紧紧地维系在一起,而且走过一段不同寻常的沧桑岁月。

  澳洲的华文报刊历史可以追溯到19世纪,据华侨华人研究专家刘渭平称,澳洲第一张华文报是《广益华报》(英文名为:The Chinese Australian Herald),早在1892年就开始筹办,1894年9月1日在悉尼正式出版。而在《自立快报》创刊之际,当时的联邦移民部长鲍格斯称,早在1884 年,澳洲就有首份华文报纸,比《广益华报》提早了10年。

  《广益华报》之后,又有《东华报》、《警东新报》、《民国报》、《平报》和《民报》等等。不过,蓦然回首,华文报纸的成长道路并不平坦。在20世纪70年代“白澳政策”废除之前,华文报刊几近式微。[3]

  直至1982年《星岛日报》(澳洲版)创刊发行,犹如一阵春风,给当地华人带来了福音,澳洲华人从此便有了自己的一份正规日报。之后由于大批印支难民 的涌入,华人的队伍日益壮大。1986年,一份新的周报即《华声报》终于诞生了。1987年,《新报》澳洲版崛起,翌年,《海潮报》又在墨尔本创刊。至 此,华文报业在澳洲便初具阵容。

  据最新文献资料发现,有学者经过论证指出,最早的澳洲中文报应是《唐人新文纸》(英文“THE CHINESE ADVERTISER”),实物证据目前所见最早一期是1856年8月30日的第二十期,而发现同时产生的历史文献明确记述为1856年4月,由是推算, 每周一期,第一期应为1856年4月19日。从现存实物看,此报最先,中文名叫《唐人新文纸》,然后改为《番唐人新文纸》,最后改为《英唐招贴》。这是至 今发现的(打破以往观点)最早的澳洲中文报纸,可能也是现存最早的澳洲中文印刷品,并很可能是海外华人淘金地最早的中文报,也许是世界上最早的中英文报纸 (报内有英文标题)。[4]

  随着留学潮的汹涌而至,数万名来自中国大陆的留学生怀着对故国文化的依恋,带着犁铧、种子和追求,在澳洲土地上掀起了一阵阵文化的热潮。他们中大多受 过高等教育,人才济济。他们对自身文化的渴求远远超乎于当地华人,部分从事过文化教育工作的人才跃跃欲试,在立足生存的同时,自觉地把华文文化推广到另一 个高度和层面上。顿时,许多中文报刊如雨后春笋般拔地而起。于是,澳洲的华文文化出现了一片前所未有的喜人景象,澳洲华文文学从此抒写了新篇章。在林林总 总的书报摊上,华文报纸与英文报刊比肩而立,成为都市的一道风景线。难怪乎纽省省长卡卜发出惊叹:悉尼的华文日报比英文日报还要多!

二、澳洲华文传媒知多少

  在澳洲,目前华文报刊杂志不算少,现存的大大小小报刊有二三十种。单日报有五家(其中一家《自立快报》已告停办)。最大且覆盖面最广的两家当数《澳洲 新报》和《星岛日报》(它们与香港版有别,周末、周日合在一起出版),还有《澳洲日报》、《华人日报》;周报有十几家——悉尼出版的《新时代报》和墨尔本 的《大洋报》、《华夏周报》(上述三家为收费周报),此外,免费周报有: 《海天物业报》、《华声地产》、《社区周报》、《华商报》、《今日新女性/车天 车地周报》、《华文镜报》、《雪梨导报》(以上均在悉尼),《新海潮报》、《澳洲侨报》、《澳华导报》、《大华时代》、《广告天下》(以上均在墨尔本), 《多元文化报》、《华人商报》、《大洋报》(以上均在布里斯班),还有堪培拉的《首都华文报》,阿德雷得的《南澳时报》以及《澳大利亚时报》等。

  杂志有:《汉声》、《动态》、《综合周刊》、《好杂志》、《原乡》、《女友》以及2008年黑马《留澳网》旗下的《the city》杂志等。

  广播电台、电视台有:澳大利亚中文广播电台、2AC澳大利亚华人电台、新世界电视台、悉尼中文电视台和政府资助的SBS电台华语组等。如流星般曾经辉 煌闪烁过光芒的部分报刊杂志,因种种因素制约,处于“冬眠”状,如《自立快报》(已易手,改名为《华人日报》),杂志中90年代之初中期的两大重镇《满江 红》杂志、《大世界》月刊亦然。此外,还有同一时期的几份由留学生和新移民创办的杂志如墨尔本的《焦点》、《新移民》,悉尼的《中国文摘》、《潮流》等, 周报中有《华联时报》(后转手易名《澳华时报》)、《东方邮报》(后转让易名《东华时报》)、《唐人商报》、《时代报》及一些免费周报均悄悄地来了,悄悄 地去了,“不带走一丝云彩”。但它们曾一度为华文文化在澳洲的弘扬,为华文文学的形成和发展起到历史性的推动作用。

  在高科技浪潮中,澳洲华文网络的人士也不甘让华文报纸一枝独秀。前几年已有先行者创立网络版和网站。在报纸方面,前述的《澳洲日服》的www.ausdail.com.au先走一步。而悉尼也有“网上唐人街”、“澳大利亚新闻网www.acnews.com.au”,墨尔本有 “www.eyah.com.au”等。这些先行者有的属玩票性质的,有的属于懂电脑和融资的,刚开始均不容易。传闻“咿呀”网站经营者连电话费支出都成问题,后来它得到澳洲主流社会投资方的支持,便有了发展机遇。

  进入1999年末和2000年初,澳洲华文网站日益兴盛。如“全球华人新闻网标榜www.ccee.com.au”是中英双语新闻网;“你好网站www.nihao.com”,以中国新闻为主。此外,还有“国家连线网站www.ccee.com.au”,以及后来居上且属同一网络的“上上全球中文网www.uptopup.com.au”以及财经、地产、旅游、华人社区团体等网站,如常在报上宣传的“佳来财经网站www.cinon.com.au”等。  有人估计,澳洲中文网站不下百个,至于自己搞个人网页玩玩的,更是不计其数。这等热闹情景,就像此间一篇文章所说的:澳洲中文网站的发展势头, 就像悉尼的冬季一样,还是那般阳光灿烂,温暖甚至有点酷热。翻开中文报纸的社团版,时不时有新网站创办的消息,与各个大大小小的社团一样,点缀着华人社区 的繁荣。到了2008年, 最惹人注目的应该是《留澳网》(www.6aoo.cn)的创办与崛起, 以思乡为主题, 汗颜的采用了中国CN域名, 以体现炎黄子孙的海外华人心情。但更令人称奇的是发展势头之猛烈, 短短的几个月内横扫澳洲中文网站, 是所有华人网中最值得注目的一个。[5]

三、澳洲华文报刊的特点管窥

  已经形成自身格局的澳洲华人报刊各具特色。从整体上看,几乎仍停留在俗文化的层次上,从个体而言,又各有千秋,但它们都拥有各自的读者群。

  在海外,尤其在商业社会中,要办好办妥一份报刊谈何容易?从上述介绍便可看到,一些报刊能持久办至今日,一些报刊却几经波折而再度复生,一些报刊却半 途而废而一蹶不振,一些报刊可能还在酝酿创办之中。但无论如何,能投身于此行业者其精神都是难能可贵的。办报纸有办报者的苦衷,办刊物有办刊者的难处,能 生存下来本身是极不容易的。除两家大报《星岛日报》、《澳洲新报》具备一定的经济实力支撑着外,《澳洲日报》(原《华声报》系周报)一改过去乏善足陈的局 势,是从摇摇晃晃中慢慢蜕变成日报的。《华人日报》属新生事物,还在考验中尝试,其锋头甚劲,尤其是文艺副刊最本土化也最丰富。其他的报刊杂志,经济实力 并不怎样,个别甚至是白手起家,支撑它们更多的是凭主办人的耐力和毅力。

  以竖排(近年则横竖兼顾)设计版面的《星岛日报》,倚恃着星岛集团本身在海外建立起的崇高威望,依然老成持重,在新闻报道和采编上保持自己的传统。其 主要读者群大多来自港台的移民和海外的老华侨。其副刊从香港版拿来为主,另辟少许版面刊登本地作者文章,旨在争夺读者市场,从其中占很大分量和篇幅的“香 港新闻”和“港台娱乐”版可以看得出,它仍然是一份“香港式”的澳洲华文日报。以横排设计版面的《新报》,其中的副刊虽然也采用香港版,但在采编上较为新 颖现代,它面向的读者群主要是来自各地的新移民,目前每周辟一文艺副刊版“澳华新文苑”。曾几何时,它成为中国大陆移民和留学生的首选,该报对澳洲当地新 闻和华人社会的消息反映迅捷,生活资讯分类广告傲视同群。尤其是《新报周刊》,往往抓住每周的热点话题或新闻焦点进行探究追踪报道,颇具代表性,给读者留 下良好的印象。此外,《澳洲日报》也在寻找和把握机会来满足读者的需求,屡变戏路,处在一种不确定性状态。从新闻采编的准绳来看,似乎还缺乏自己固有的特 点,其潜力有待挖掘。《华人日报》则在寻找自己的新思路、新定位,着力开辟新市场。

  在众多的杂志中,最具有特色和层次的当算曾经风靡一时的《满江红》。这份从月刊走向双周刊的杂志,创办五年多时间,始终倡导文艺性,“文心诗弦”每期 必有,这是其他报刊所缺乏的。在澳洲华文文学还处于沉寂的局面中,率先力倡文艺性,独标风采,这是需要冒风险的。作为一家最早创刊之一的杂志,《满江红》 杂志曾拥有自己的读者群和作者群,在华人社会中影响广泛。1994年1月初该杂志率先在悉尼举办“首届中国图书文化展览会”,为广大读者提供和了解祖国文 化出版界的最新成果打开了通道。另一家由数位热心文化的留学生创办的,在读者中反映较好的《大世界》月刊,其特点在于能紧密联系当地华人与留学生关心的本 地时事消息,并加以追踪报道,其中刊登的部分文章和文摘受到读者的欢迎。另一家在墨尔本创办的《新移民》杂志,则注重以反映新移民在澳洲生活工作和学习的 种种风貌为己任,并提供许多有关移民政策的信息,为新移民在澳生活排忧解难,是一本融实用和信息于一炉的月刊。遗憾的是,这三家当时最叫响的杂志,皆因种 种遭遇和因素而先后收场。此外,还需一提的是两本在墨尔本出版的免费双月刊《汉声》和季刊《海外风》,这两本杂志的共同点是较偏重于对传统文化的发掘,它 们是来自印支的一批热爱民族文化的老华侨创办的,为一批老华侨文化人提供了自由的园地。尽管这两本杂志有点老气横秋,但水准尚高,每期的时事评述和文艺园 地皆有精到的篇什,最近似乎也不见露面。不得不说的进来讨论风风火火的留澳网, 其发展确实令人称奇, 网站旗下的《The city》杂志弃用了传统媒体,一律使用电子版本, 其网址为:http://www.6aoo.cn/magazine/为澳洲华人媒体界先河!

  在林立的报刊中,周报、周刊可谓最多。单以提供商业性信息为主的免费报刊就有十多家。其中《综合周刊》除了刊登广告外,还有部分篇幅登载每周专题和特稿。由留学生创办的《信报》,除刊登商业广告外,多少刊登一些时事新闻。

  同样的,创办不久的《大洋报》,也在苦苦挣扎中过日子,这与资历最老的周报《新海潮报》在办报的方针策略上泾渭分明。前者较注重于对东方文化讯息的介 绍,后者则在民俗文化方面做了大量的推广和传播;前者的读者对象似乎偏重于留学生新移民中的文化人,后者涉及面较广,主要面对印支华侨读者兼及留学生。它 们各有其长短处。

  “他山之石,可以攻玉”。在澳洲多元文化的社会中,各大小华文报刊在艰难中经营,努力开拓,多已具有一定的成绩。只有具备相对稳定的质素,既不哗众取宠,又适应于不同层次的读者,否则将失去其吸引力。

四、竞争激烈的澳华传媒前景堪忧

  澳洲华文媒介之所以在十多年间,如波浪此起彼伏,喘息着阵阵涛声,可以说是一家躺下去另一家又站起来,个中缘由相当复杂。据中新社原任澳洲首席记者王 永志先生观察分析,大致有如下几个因素:①澳洲多元国策给华文媒体发展提供了契机、创造了条件;②华人移民急剧增加,华人经济、文化力量全面提升,为华文 媒体的崛起提供了物质、人才和市场等必备条件,拓宽了发展空间。③华人在英语主流社会存有身份焦虑,因而对拥有自己“话事权”的华文传媒有所倚重,而趋同 意识又使华文传媒业呈“滚雪球”般的发展态势。[6]

  在这个高度商业化娱乐化的消费时代里,一切似乎都陷入了光怪陆离的喧嚣中。澳洲华文媒体固然有它存在的基础和原因,然而,一个严峻的事实摆在面前: “叫你上天堂,让你去办报;叫你下地狱,让你去办报。”这句俚语便是对海外报人最巧妙的形容,相信传媒同行是感同身受的。而且,它必须承受市场和读者的大 浪淘沙,接受同行的竞争和挑战。因此,对于大多数传媒来说,要站稳脚跟谈何容易。即便是目前已立足的报刊,从长远看,也喜忧参半,夜长梦多。

  首先,在澳洲工资等各种开销极贵,而且高税率,假如一旦新闻纸类涨价,这对那些同仁报尤其是Free(即免费赠阅)者的报刊打击最重。尽管有的报刊及 时应付,担心因为影响力和发行量而影响到广告效益,硬着头皮强撑,吃力又不讨好。从新闻质量上看,所有报刊与主流报刊还相差甚远,究其源盖于真正吸引读者 的内容还是故国家乡的人和事。至于一些小报小刊,主要靠大量摘抄国内和港台报刊的文章,有的现在可以直接通过网络转载下来(一无版权纠纷,二不用付稿酬, 能省就省)。但这不是解决问题的办法,加上上网的人数日益攀升,读者需要的是有独家新闻和自家特色的报刊,对传媒的要求即期望值在不断增加。

  其次,从以上分析观察,问题的最大症结便是读者市场难以扩大。尽管近些年来尚有大量中国人移居或留学海外,但新世纪以来几乎所有西方的移民国家皆开始 缩减移民数量,澳洲更是充当马前卒,而且对新移民设置更为苛刻的经济限制等条例。可以预见的是,中国人向海外寻找发展机会不可能再像从前那样热衷,而在海 外读中文的人数(包括洋人)固然有呈上升的趋势,但毕竟还是有限,对华文报刊来说难成大气候。那些“变异”的第二、第三代华人庶几已成“香蕉人”,能说中 文却根本无法专心或真正去读,对他们的期望只能是能忆认做为父母的是侨居国的国民的同时,也能知道自己是黄皮肤黑眼睛就够了,因为对于他们,所谓故乡的兴 趣和情感远没有他们的父母等前辈来得强烈。如是,对华文报刊无疑是一种最现实的困惑和挑战。

  再者,即便是现在,大多中文报刊也不过是依靠着华人这一边缘族群的惯便,才得以维持。边缘社区相对于主流社会而言,其中的惯例说得通俗一些就是什么都 便宜(节省),首先广告便宜(比英文主流报刊便宜程度有天壤之别);另外是工资便宜,几乎所有华文报刊的从业人员,其工资水准均处于下游,与主流社会同业 人员相距千里。虽然现在的劳资纠纷尚不多闻,但总体而言,华人因经营市场的局限,基本学会从(澳洲)现行的法律中赢得自己的权益。其实,在海外,无论吃文 化(餐饮业等),还是读文化(报刊业等),华人经营者每走出一步,都是备尝艰辛的。赢了固然幸运,输了大不了兜着走。

  世纪之交,澳洲政府宣布了一项新的政策,对亚洲语言教师进行招聘,让50%的高中毕业生,可以学到六种亚洲语言中的一种。因为多掌握一种语言技能能使 澳洲下一代有更多的机会富强。由于近年来华人移民迅速增加和政府采取“面向亚洲”的政策,政府拨出专款在全国23所大学开设中文、日文等亚洲语言系,不少 中小学还将中文列为第一外国语。华语同时也成为一些大企业求才的重要条件之一及在职训练的重要课程。据此可以预见,在不久的将来,澳洲认识中文的人将会更 多,况且来自大陆的数万名中国留学生已基本定居澳洲,但愿那时中文报刊将会为更多以英语为母语的澳洲人所熟悉和喜欢,并对中华文化在澳洲的真正弘扬和发展 畅通渠道。

  然而,作为曾在澳华传媒领域叱咤风云,也在艰难中折腾过的一名同行,本人深有感触并且认为,澳华媒体(报业),看上去欣欣向荣、场面热烈,其实却暗藏 危机。譬如《自立快报》因亏损惨重而易主,《东华时报》也突然关闭,《澳华时报》因经济不支亦告休眠,《澳洲侨报》则因销售问题而改成免费赠阅。因此,与 其说澳华媒体在澳洲的传播是一个“异数”,还不如说是一个“变数”。我们甚至可以这样预言,华文报刊的美丽前景不在海外,而在海峡两岸四地(大陆暨港台 澳)。

[1]程曼丽:《海外华文传媒研究》,北京,新华出版社2001年6月版,第1页。
[2]方汉奇:《海外华文传媒研究•序》,转引自程曼丽《海外华文传媒研究》,北京,新华出版社2001年6月版。
[3]澳芭子、芮珠兰:《唐人新文纸:最早澳洲中文报研究》,载墨尔本,《新海潮报》1997年8月21日。
[4][5][6]参见王永志:《走近唐人街》,见《澳洲飞去来》,北京,华文出版社2002年1月版。

(作者单位:澳中经济文化艺术推广中心)

Wednesday, May 27, 2009

SEO|Google Sitelinks 网站链接

 本日志标题:Google Sitelinks 网站链接 扬州分类信息        [2008-9-11]

有的时候在Google搜索某些关键词时,排名在第一位的网站相比较第一页的其他网站具备了更详细的扩展链接:即除了网站本身以外的标题和信息描述以外,还显示了多个该网站下的标题及链接。这些链接就是Google Sitelinks,Google管理员工具中称之为“网站链接”。

Google Sitelinks对于网站吸引用户注意提高网站点击有重要作用,同时由于这样的站点在Google不算太多,一般都是大站、名站比如(“新浪”、“蓝色理想”)等,在此情况下,说该站点被视做Google认可的该关键词行业代表也是无可厚非的。

今天偶然在Google搜索“扬州分类信息”,我们的“小艾生活网 www.i0514.cn”已被Google添加了相关的“Sitelinks”,比较惊喜。一直以来,我们做的工作首先就是将网站频道文件夹化,即比如将原来的租房页面 zufang.php 调整为 “/zufang” ,然后最大重点是在网站内容的建设上,确保信息的频率和真实性……接着就是Google给我们的这个惊喜了。



在论坛里面简单交流了下,也大致了解到有关Google Sitelinks的一些基础信息参考,整理如下:
http://www.dunsh.org/2006/09/28/google-sitelinks-2/
http://www.seotest.cn/blog/google-sitelink-yuanyin.html

Google在其帮助中是这样描述的:一般认为,Google Sitelinks与网站的结构、多关键词间联系的“紧密”程度有关,但最主要的决定因素则可能是访问量,只有那些访问量较高的网站及网站内的分类页面,才说明对用户而言有价值,Google才会为该网站提供Sitelinks或将相应访问量较大的页面作为Sitelinks中4个链接的对象。

既然Google Sitelinks是通过算法自动得出的,那么,肯定有些较重要的因素能够帮助网站获得Sitelinks,也许,这是下一步网站建设者努力的一个方向,毕竟,与单纯的所谓排名优化相比,让更多的用户点击访问网站才是实现SEO目标的真正保障。

在获得Google Sitelinks的绝对性条件上有这样几条值得注意:

点石认为 首先要在特定的搜索项中排名第一,这是最根本的,因为Sitelinks只向在SERP中排名第一的网站提供。
Kyw认为 在某个关键词排名第一,并且稳定10个月以上;

点石还认为 使用网站名称或名称中的一部分作为主关键词,将是获得Sitelinks的决定性因素。

仔细撰写网页的描述与内容部分,对被DMOZ收录的网站,应考虑是否使用NOODP标签。据大多数人观察,Google Sitelinks与网页在SERP中的点击量有关,也即是说,单纯排名是不够的,必须能在SERP页中引起用户的注意并点击。

网站的内部链接也相当重要,并要保证Googlebot对网站深层页面的访问。此外,通过对大多数Sitelink页面的观察,内部链接与导航出现在网页HTML代码靠前位置具有一定优势。

Kyw认为 站内链接结构清晰。

点石认为 很多人推测Google Sitelinks可能使用Google toolbar (工具条)数据来采集数据,包括用户对特定网页的访问情况、收藏情况等等,这就又回到了SEO的老问题上,即让用户感到有用,感到有价值而收藏并多次访问。

Kyw还提出了 网站年龄要超过1年;

当然,获得Sitelink还可能需要的因素推测有:

在现阶段,仍然没有太肯定的关于Sitelinks实现机制的结论,但一般说来,如果某个网站在Google的SERP中拥有Sitelinks,可以认为Google将该网站判定为该搜索项方面的权威网站。

此外,在Sitelinks中,链接采用的方式使得玩味:SERP中的其他链接均是直接指向目标地址,而4个Sitelinks则采取类似JavaScript实现的302跳转,联系到Google说明中的“and we may incorporate webmaster input in the future”,说明了什么?

Kyw还认为

1. 网站权重要高,外链不低于5000个;
2. 被DMOZ收录超过半年;
3. 网站核心关键词排名在前十;
4. 超过50%的原创文章;
5. 在某关键词SERP的第一页中,同一个站获得连续的2个排名;
6. 该关键词需要有一定的搜索量;或许搜索“扬州分类信息”的要多于“小艾生活网”,所以我们的网站名称搜索是没有Sitelinks的。

在百度搜索完整的Google Sitelinks 网站链接 扬州分类信息内容,或者用Google搜索相关的更多内容

Saturday, May 23, 2009

Python| How to access ssh with pexpect? ssh automation

Python: How to access ssh with pexpect? » Linux by Examples

I have research on how to access ssh using scripting language for quite sometimes. For python, there are three libs is in my list:

  • Twisted - an event-driven networking engine written in Python.
  • Paramiko - implements the SSH2 protocol for secure connections to remote machines.
  • Pexpect - spawn a child application and control it as if a human were typing commands.
  • Three libraries have used different approach to gain access to ssh, and finally I choose pexpect for the simplicity. This post will briefly shows you how easy you can access ssh with pexpect lib.

    Pexpect allows you to wait for certain STDOUT, and reacts back by sending your lines back to the 'shell'. There are three situation while accessing ssh:

    1. Ssh to the remote site for the first time will trigger this:

    The authenticity of host 'myremote (192.168.1.133)' can't be established. RSA key fingerprint is 4d:78:9b:c2:6d:d7:dc:c2:96:f2:95:69:6a:08:f5:1b. Are you sure you want to continue connecting (yes/no)?


    So you are suppose to answer yes.

    2. Next it will ask you for password:

    mysurface@myremote's password:

    3. No password is needed at all, because you have already have the key.

    To cater all thiese three scenarios, lets look at the python script

     #!/usr/bin/env python import pexpect  ssh_newkey = 'Are you sure you want to continue connecting' # my ssh command line p=pexpect.spawn('ssh mysurface@192.168.1.105 uname -a')  i=p.expect([ssh_newkey,'password:',pexpect.EOF]) if i==0:     print "I say yes"     p.sendline('yes')     i=p.expect([ssh_newkey,'password:',pexpect.EOF]) if i==1:     print "I give password",     p.sendline("mypassword")     p.expect(pexpect.EOF) elif i==2:     print "I either got key or connection timeout"     pass print p.before # print out the result 

    If connection failed, EOF will be captured and you message as below will be print.

    ssh: connect to host 192.168.1.105 port 22: No route to host

    Else, results of uname -a will be print out by print p.before.

    What If I wanna stay connect to ssh, and able to send my input myself?
    You need to enable interactive mode,

    #!/usr/bin/env python import pexpect import struct, fcntl, os, sys, signal  def sigwinch_passthrough (sig, data):     # Check for buggy platforms (see pexpect.setwinsize()).     if 'TIOCGWINSZ' in dir(termios):         TIOCGWINSZ = termios.TIOCGWINSZ     else:         TIOCGWINSZ = 1074295912 # assume     s = struct.pack ("HHHH", 0, 0, 0, 0)     a = struct.unpack ('HHHH', fcntl.ioctl(sys.stdout.fileno(), TIOCGWINSZ , s))     global global_pexpect_instance     global_pexpect_instance.setwinsize(a[0],a[1])  ssh_newkey = 'Are you sure you want to continue connecting' p=pexpect.spawn('ssh mysurface@192.168.1.105') i=p.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT],1) if i==0:     print "I say yes"     p.sendline('yes')     i=p.expect([ssh_newkey,'password:',pexpect.EOF]) if i==1:     print "I give password",     p.sendline("mypassword") elif i==2:     print "I either got key or connection timeout"     pass elif i==3: #timeout     pass p.sendline("\r") global global_pexpect_instance global_pexpect_instance = p signal.signal(signal.SIGWINCH, sigwinch_passthrough)  try:     p.interact()     sys.exit(0) except:     sys.exit(1) 

    It seems complicated, yes it is. Pexpect bundle with a lots of examples that illustrate on how to make use of it. The method sigwinch_passthrough is rip out from one of the examples - script.py.

    Download pexpect and start to experience it :D

    Pexpect does not have native support for windows yet, but it works fine on cygwin under windows.

    Unix CMD|rsync - exclude files and folders

    Slicehost Articles: rsync - exclude files and folders

    rsync - exclude files and folders

    rsync is cool. What would be even cooler would be excluding particular files or even a whole folder from the backup process.

    That's no problem using the rsync '--exclude' option.


    Why?

    In the previous article, we looked at backing up files and folders to another server.

    This was easily completed but there may well be some time sensitive files that are not needed such as log files. Sure, there are some log files (perhaps Apache logs) that you want to keep but others you won't such as a Ruby on Rails production log.

    Perhaps there are files containing your DB password, such as a PHP mysqli connection file. Although needed on the main server, it is not needed on the backup.

    A folder I always exclude when completing an rsync on my home folder is the 'sources' directory: I don't need copies of the source code I have download.

    Let's see how to exclude that directory.

    Single files and folders

    The original command was like this:

    rsync -e 'ssh -p 30000' -avl --delete --stats --progress demo@123.45.67.890:/home/demo /backup/

    To exclude the sources directory we simply add the '--exclude' option:

    --exclude 'sources'

    Note: the directory path is relative to the folder you are backing up.

    So looking at the original command, I am backing up /home/demo. Adding the name 'sources' to the exclude pattern will exclude the 'home/demo/sources' folder.

    As such, the final command would look like this:

    rsync -e 'ssh -p 30000' -avl --delete --stats --progress --exclude 'sources' demo@123.45.67.890:/home/demo /backup/

    The same can be applied to files. I have decided that in addition to the sources folder, I want to exclude the file named 'database.txt' which resides in the public_html folder. So I add this:

    --exclude 'public_html/database.txt'

    So now the command looks like:

    rsync -e 'ssh -p 30000' -avl --delete --stats --progress --exclude 'sources' --exclude 'public_html/database.txt' demo@123.45.67.890:/home/demo /backup/

    Multiple files and folders

    Unfortunately, I have a load of files and folders I don't want to backup and adding each one like that will get tedious very quickly.

    Not only will it get boring, it will make the command super long and prone to easy mistakes.

    That's OK as I can define all the files and folders I want exclude in a single file and have rsync read that.

    To do this create a file called 'exclude.txt' on the destination machine (the system you give the rsync command on):

    nano /home/backup/exclude.txt

    Define

    Then define the files and folders you want to exclude from the rsync:

    sources public_html/database.* downloads/test/*

    As you can see, you can define patterns.

    The first entry is straight forward. It will exclude any file or folder called 'sources' (remember the path is relative).

    The second entry will look int the public_html folder and exclude any files (or folders) that begin with 'database.'. The * at the end indicates a wild card, so 'public_html/database.txt' and 'public_html/database.yaml' will be excluded from the backup.

    Using a wildcard, the final entry will exclude the contents of the 'downloads/test/' but still download the folder (in other words, I will end up with an empty 'test' folder).

    Final command

    Now we have defined what to exclude we can direct rsync to the file with:

    --exclude-from '/home/backup/exclude.txt'

    Note: the path for this file is absolute. You are defining where in the file system rsync should look for the exclude patterns.

    So, this time the final command would be:

    rsync -e 'ssh -p 30000' -avl --delete --stats --progress --exclude-from '/home/backup/exclude.txt' demo@123.45.67.890:/home/demo /backup/

    That's better.

    Summary

    Excluding files from a backup can be time and space saver. They usually include superfluous downloads or files that contain sensitive information such as passwords that just don't need to be in several locations.

    Using the exclude-from option allows for easy control over the exclude patterns - you can even define several exclude files and simply point rsync to the one that is convenient.

    PickledOnion.

    Unix CMD|Rsync

    Rsync - Luke Jackson

    Rsync

    From Luke Jackson

    Jump to: navigation, search

    Contents

    [hide]

    Summary

    rsync is a program that behaves in much the same way that rcp does, but has many more options and uses the rsync remote-update protocol to greatly speed up file transfers when the destination file is being updated.

    The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network connection, using an efficient checksum-search algorithm described in the technical report that accompanies this package.

    Some of the additional features of rsync are:

    • support for copying links, devices, owners, groups, and permissions
    • exclude and exclude-from options similar to GNU tar
    • a CVS exclude mode for ignoring the same files that CVS would ignore
    • can use any transparent remote shell, including ssh or rsh
    • does not require root privileges
    • pipelining of file transfers to minimize latency costs
    • support for anonymous or authenticated rsync servers (ideal for mirroring)

    Usage

    The basic syntax for rsync is simple enough -- just run rsync [options] source destination to copy the file or files provided as the source argument to the destination.

    So, for example, if you want to copy some files under your home directory to a USB storage device, you might use rsync -a /home/user/dir/ /media/disk/dir/. By the way, "/home/user/dir/" and "/home/usr/dir" are not the same thing to rsync. Without the final slash, rsync will copy the directory in its entirety. With the trailing slash, it will copy the contents of the directory but won't recreate the directory. If you're trying to replicate a directory structure with rsync, you should omit the trailing slash -- for instance, if you're mirroring /var/www on another machine or something like that.

    In this example, I included the archive option (-a), which actually combines several rsync options. It combines the recursive and copy symlinks options, preserves group and owner, and generally makes rsync suitable for making archive copies. Note that it doesn't preserve hardlinks; if you want to preserve them, you will need to add the hardlinks option (-H).

    Another option you'll probably want to use most of the time is verbose (-v), which tells rsync to report lots of information about what it's doing. You can double and triple up on this option -- so using -v will give you some information, using -vv will give more, and using -vvv will tell you everything that rsync is doing.

    rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST 
    rsync [OPTION]... [USER@]HOST:SRC DEST 
    rsync [OPTION]... SRC [SRC]... DEST 
    rsync [OPTION]... [USER@]HOST::SRC [DEST] 
    rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST 
    rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST] 
    rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST 

    Options

    Here is a short summary of the options available in rsync. Please refer to the detailed description below for a complete description.

            -v, --verbose               increase verbosity         -q, --quiet                 decrease verbosity         -c, --checksum              always checksum         -a, --archive               archive mode, equivalent to -rlptgoD         -r, --recursive             recurse into directories         -R, --relative              use relative path names             --no-relative           turn off --relative             --no-implied-dirs       don't send implied dirs with -R         -b, --backup                make backups (see --suffix & --backup-dir)             --backup-dir            make backups into this directory             --suffix=SUFFIX         backup suffix (default ~ w/o --backup-dir)         -u, --update                update only (don't overwrite newer files)             --inplace               update the destination files inplace         -K, --keep-dirlinks         treat symlinked dir on receiver as dir         -l, --links                 copy symlinks as symlinks         -L, --copy-links            copy the referent of all symlinks             --copy-unsafe-links     copy the referent of "unsafe" symlinks             --safe-links            ignore "unsafe" symlinks         -H, --hard-links            preserve hard links         -p, --perms                 preserve permissions         -o, --owner                 preserve owner (root only)         -g, --group                 preserve group         -D, --devices               preserve devices (root only)         -t, --times                 preserve times         -S, --sparse                handle sparse files efficiently         -n, --dry-run               show what would have been transferred         -W, --whole-file            copy whole files, no incremental checks             --no-whole-file         turn off --whole-file         -x, --one-file-system       don't cross filesystem boundaries         -B, --block-size=SIZE       force a fixed checksum block-size         -e, --rsh=COMMAND           specify the remote shell             --rsync-path=PATH       specify path to rsync on the remote machine             --existing              only update files that already exist             --ignore-existing       ignore files that already exist on receiver             --delete                delete files that don't exist on sender             --delete-excluded       also delete excluded files on receiver             --delete-after          receiver deletes after transfer, not before             --ignore-errors         delete even if there are I/O errors             --max-delete=NUM        don't delete more than NUM files             --partial               keep partially transferred files             --partial-dir=DIR       put a partially transferred file into DIR             --force                 force deletion of dirs even if not empty             --numeric-ids           don't map uid/gid values by user/group name             --timeout=TIME          set I/O timeout in seconds         -I, --ignore-times          turn off mod time & file size quick check             --size-only             ignore mod time for quick check (use size)             --modify-window=NUM     compare mod times with reduced accuracy         -T  --temp-dir=DIR          create temporary files in directory DIR             --compare-dest=DIR      also compare received files relative to DIR             --link-dest=DIR         create hardlinks to DIR for unchanged files         -P                          equivalent to --partial --progress         -z, --compress              compress file data         -C, --cvs-exclude           auto ignore files in the same way CVS does             --exclude=PATTERN       exclude files matching PATTERN             --exclude-from=FILE     exclude patterns listed in FILE             --include=PATTERN       don't exclude files matching PATTERN             --include-from=FILE     don't exclude patterns listed in FILE             --files-from=FILE       read FILE for list of source-file names         -0  --from0                 all file lists are delimited by nulls             --version               print version number             --daemon                run as an rsync daemon             --no-detach             do not detach from the parent             --address=ADDRESS       bind to the specified address             --config=FILE           specify alternate rsyncd.conf file             --port=PORT             specify alternate rsyncd port number             --blocking-io           use blocking I/O for the remote shell             --no-blocking-io        turn off --blocking-io             --stats                 give some file transfer stats             --progress              show progress during transfer             --log-format=FORMAT     log file transfers using specified format             --password-file=FILE    get password from FILE             --bwlimit=KBPS          limit I/O bandwidth, KBytes per second             --write-batch=FILE      write a batch to FILE             --read-batch=FILE       read a batch from FILE             --checksum-seed=NUM     set block/file checksum seed         -4  --ipv4                  prefer IPv4         -6  --ipv6                  prefer IPv6         -h, --help                  show this help screen 

    Hidden Files

    rsync will move hidden files (files whose names begin with a .) by default. If you want to exclude (ignore) hidden files, you can use this option:

    --exclude=".*/" 

    You can also use the --exclude option to prevent copying things like Vim's swap files (.swp) and automatic backups (.bak) created by some programs.

    Examples

    Echo all files from source location to target.

    • Recursively sync files.
    • Preserve Permissions.
    • Preserve Owner.
    • Preserve Group.
    • Copy Whole File don't check for file updates.
    • Delete all files that no longer exist on source.
    • Ignore Existing files on target.
    • Exclude specified folders.
    • Exclude hidden files
    rsync -vrpogW --ignore-existing --delete --exclude ".*" --exclude "System Volume Information" --exclude "RECYCLER" /SOURCE_MP3/ /TARGET_MP3 

    Making local copies

    Suppose you have an external USB or FireWire drive, and you want to copy data from your home directory to your external drive. A good way to do this would be to keep all your important data under a single top-level directory and then copy it to a backup directory on the external drive using a command like:

    rsync -avh /home/usr/dir/ /media/disk/backup/ 

    If you want to make sure that local files you've deleted since the last time you ran rsync are deleted from the external system as well, you'll want to add the --deleted option, like so:

    rsync -avh --delete /home/user/dir/ /media/disk/backup 

    Be very careful with the delete option; with it, you can whack a bunch of files without meaning to. In fact, while you're getting used to rsync, it's probably a good idea to use the --dry-run option with your commands to run through the transfer first, without actually copying or synching files. If you do start an rsync transfer and realize that you've botched the command in some way that might result in the destruction of data, press Ctrl-c immediately to terminate the transfer. Some files may be gone, but you may be able to save the rest. Making remote copies

    What if you want to copy files offsite to a remote host? No problem -- all you need to do is add the host and user information. So, for instance, if you want to copy the same directory to a remote host, you'd use:

    rsync -avhe ssh --delete /home/user/dir/ user@remote.host.com:dir/ 

    If you want to know how fast the transfer is going, and how much remains to be copied, add the --progress option:

    rsync --progress -avhe ssh --delete /home/user/dir/ user@remote.host.com:dir/ 

    If you don't want to be prompted for a password each time rsync makes a connection -- and you don't -- make sure that you have rsync set up to log in using an SSH key rather than a password. To do this, create an SSH key on the local machine using ssh-keygen -t dsa, and press Enter when prompted for a passphrase. After the key is created, use ssh-copy-id -i .ssh/id_dsa.pub user@remote.host.com to copy the public key to the remote host.

    What if you need to bring back some of the files you copied using rsync? Use the following syntax:

    rsync -avze ssh remote.host.com:/home/user/dir/ /local/path/ 

    The z option compresses data during the transfer. If the file you are copying exists on the local host, then rsync will just leave it alone -- the same as if you were copying files to a remote host. Wrapping it up with a script

    Once you've figured out what directory or directories you want to sync up, and you've gotten the commands you need to sync everything, it's easy to wrap it all up with a simple script. Here's a short sample:

    rsync --progress -avze ssh --delete /home/user/bin/ user@remote.host.com:bin/ rsync --progress -avze ssh --delete /home/user/local/data/ user@remote.host.com:local/data/ rsync --progress -avze ssh --delete /home/user/.tomboy/ user@remote.host.com:/.tomboy/ 

    Use the --progress option if you're going to be running rsync interactively. If not, there's no need for it.

    If you look at the rsync man page, you can easily be confused. However, after a little practice with rsync, you'll find that it's not hard to set up rsync jobs that will help you prepare for the day that your disk drive craps out and you need access to your data right away

    Unix CMD|Using Rsync and SSH

    Using Rsync and SSH

    Using Rsync and SSH
    Keys, Validating, and Automation
    This document covers using cron, ssh, and rsync to backup files over a local network or the Internet. Part of my goal is to ensure no user intervention is required when the computer is restarted (for passwords, keys, or key managers).
    I like to backup some logging, mail, and configuration information sometimes on hosts across the network and Internet, and here is a way I have found to do it. You'll need these packages installed:
    • rsync
    • openssh
    • cron (or vixie-cron)
    Please note these instructions may be specific to Red Hat Linux versions 7.3, 9, and Fedora Core 3, but I hope they won't be too hard to adapt to almost any *NIX type OS. The man pages for 'ssh' and 'rsync' should be helpful to you if you need to change some things (use the "man ssh" and "man rsync" commands).
    First, I'll define some variables. In my explanation, I will be synchronizing files (copying only new or changed files) one way, and I will be starting this process from the host I want to copy things to. In other words, I will be syncing files from /remote/dir/ on remotehost, as remoteuser, to /this/dir/ on thishost, as thisuser.
    I want to make sure that 'rsync' over 'ssh' works at all before I begin to automate the process, so I test it first as thisuser:
    $ rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/
    and type in remoteuser@remotehost's password when prompted. I do need to make sure that remoteuser has read permissions to /remote/dir/ on remotehost, and that thisuser has write permissions to /this/dir/ on thishost. Also, 'rsync' and 'ssh' should be in thisuser's path (use "which ssh" and "which rsync"), 'rsync' should be in remoteuser's path, and 'sshd' should be running on remotehost.
    Configuring thishost

    If that all worked out, or I eventually made it work, I am ready for the next step. I need to generate a private/public pair of keys to allow a 'ssh' connection without asking for a password. This may sound dangerous, and it is, but it is better than storing a user password (or key password) as clear text in the script [0]. I can also put limitations on where connections made with this key can come from, and on what they can do when connected. Anyway, I generate the key I will use on thishost (as thisuser):
    $ ssh-keygen -t dsa -b 2048 -f /home/thisuser/cron/thishost-rsync-key
    Generating public/private dsa key pair.
    Enter passphrase (empty for no passphrase): [press enter here]
    Enter same passphrase again: [press enter here]
    Your identification has been saved in /home/thisuser/cron/thishost-rsync-key.
    Your public key has been saved in /home/thisuser/cron/thishost-rsync-key.pub.
    The key fingerprint is:
    2e:28:d9:ec:85:21:e7:ff:73:df:2e:07:78:f0:d0:a0 thisuser@thishost
    and now we have a key with no password in the two files mentioned above [1]. Make sure that no other unauthorized user can read the private key file (the one without the '.pub' extension).
    This key serves no purpose until we put the public portion into the 'authorized_keys' file [2] on remotehost, specifically the one for remoteuser:
    /home/remoteuser/.ssh/authorized_keys
    I use scp to get the file over to remotehost:
    $ scp /home/thisuser/cron/thishost-rsync-key.pub remoteuser@remotehost:/home/remoteuser/
    and then I can prepare things on remotehost.
    Configuring remotehost

    I 'ssh' over to remotehost:
    $ ssh remoteuser@remotehost
    remoteuser@remotehost's password: [type correct password here]
    $ echo I am now $USER at $HOSTNAME
    I am now remoteuser at remotehost
    to do some work.
    I need to make sure I have the directory and files I need to authorize connections with this key [3]:
    $ if [ ! -d .ssh ]; then mkdir .ssh ; chmod 700 .ssh ; fi
    $ mv thishost-rsync-key.pub .ssh/
    $ cd .ssh/
    $ if [ ! -f authorized_keys ]; then touch authorized_keys ; chmod 600 authorized_keys ; fi
    $ cat thishost-rsync-key.pub >> authorized_keys
    Now the key can be used to make connections to this host, but these connections can be from anywhere (that the ssh daemon on remotehost allows connections from) and they can do anything (that remoteuser can do), and I don't want that. I edit the 'authorized_keys' file (with vi) and modify the line with 'thishost-rsync-key.pub' information on it. I will only be adding a few things in front of what is already there, changing the line from this:
    ssh-dss AAAAB3NzaC1kc3MAAAEBAKYJenaYvMG3nHwWxKwlWLjHb77CT2hXwmC8Ap+fG8wjlaY/9t4u
    A+2qx9JNorgdrWKhHSKHokFFlWRj+qk3q+lGHS+hsXuvta44W0yD0y0sW62wrEVegz+JVmntxeYc0nDz
    5tVGfZe6ydlgomzj1bhfdpYe+BAwop8L+EMqKLS4iSacNjoPlHsmqHMnbibn3tBqJEq2QJjEPaiYj1iP
    5IaCuYBhuTKQGa+oyH3mXEif5CKdsIKBj46B0tCy0/GC7oWcUN92QdLrUyTeRJZsTWsxKpRbMliD2pBh
    4oyX/aXEf8+HZBrO5vQjDBCfTFQA+35Xrd3eTVEjkGkncI0SAeUAAAAVAMZSASmQ9Pi38mdm6oiVXD55
    Kk2rAAABAE/bA402VuCsOLg9YS0NKxugT+o4UuIjyl6b2/cMmBVWO39lWAjcsKK/zEdJbrOdt/sKsxIK
    1/ZIvtl92DLlMhci5c4tBjCODey4yjLhApjWgvX9D5OPp89qhah4zu509uNX7uH58Zw/+m6ZOLHN28mV
    5KLUl7FTL2KZ583KrcWkUA0Id4ptUa9CAkcqn/gWkHMptgVwaZKlqZ+QtEa0V2IwUDWS097p3SlLvozw
    46+ucWxwTJttCHLzUmNN7w1cIv0w/OHh5IGh+wWjV9pbO0VT3/r2jxkzqksKOYAb5CYzSNRyEwp+NIKr
    Y+aJz7myu4Unn9de4cYsuXoAB6FQ5I8AAAEBAJSmDndXJCm7G66qdu3ElsLT0Jlz/es9F27r+xrg5pZ5
    GjfBCRvHNo2DF4YW9MKdUQiv+ILMY8OISduTeu32nyA7dwx7z5M8b+DtasRAa1U03EfpvRQps6ovu79m
    bt1OE8LS9ql8trx8qyIpYmJxmzIdBQ+kzkY+9ZlaXsaU0Ssuda7xPrX4405CbnKcpvM6q6okMP86Ejjn
    75Cfzhv65hJkCjbiF7FZxosCRIuYbhEEKu2Z9Dgh+ZbsZ+9FETZVzKBs4fySA6dIw6zmGINd+KY6umMW
    yJNej2Sia70fu3XLHj2yBgN5cy8arlZ80q1Mcy763RjYGkR/FkLJ611HWIA= thisuser@thishost
    to this [4]:
    from="10.1.1.1",command="/home/remoteuser/cron/validate-rsync" ssh-dss AAAAB3Nza
    C1kc3MAAAEBAKYJenaYvMG3nHwWxKwlWLjHb77CT2hXwmC8Ap+fG8wjlaY/9t4uA+2qx9JNorgdrWKhH
    SKHokFFlWRj+qk3q+lGHS+hsXuvta44W0yD0y0sW62wrEVegz+JVmntxeYc0nDz5tVGfZe6ydlgomzj1
    bhfdpYe+BAwop8L+EMqKLS4iSacNjoPlHsmqHMnbibn3tBqJEq2QJjEPaiYj1iP5IaCuYBhuTKQGa+oy
    H3mXEif5CKdsIKBj46B0tCy0/GC7oWcUN92QdLrUyTeRJZsTWsxKpRbMliD2pBh4oyX/aXEf8+HZBrO5
    vQjDBCfTFQA+35Xrd3eTVEjkGkncI0SAeUAAAAVAMZSASmQ9Pi38mdm6oiVXD55Kk2rAAABAE/bA402V
    uCsOLg9YS0NKxugT+o4UuIjyl6b2/cMmBVWO39lWAjcsKK/zEdJbrOdt/sKsxIK1/ZIvtl92DLlMhci5
    c4tBjCODey4yjLhApjWgvX9D5OPp89qhah4zu509uNX7uH58Zw/+m6ZOLHN28mV5KLUl7FTL2KZ583Kr
    cWkUA0Id4ptUa9CAkcqn/gWkHMptgVwaZKlqZ+QtEa0V2IwUDWS097p3SlLvozw46+ucWxwTJttCHLzU
    mNN7w1cIv0w/OHh5IGh+wWjV9pbO0VT3/r2jxkzqksKOYAb5CYzSNRyEwp+NIKrY+aJz7myu4Unn9de4
    cYsuXoAB6FQ5I8AAAEBAJSmDndXJCm7G66qdu3ElsLT0Jlz/es9F27r+xrg5pZ5GjfBCRvHNo2DF4YW9
    MKdUQiv+ILMY8OISduTeu32nyA7dwx7z5M8b+DtasRAa1U03EfpvRQps6ovu79mbt1OE8LS9ql8trx8q
    yIpYmJxmzIdBQ+kzkY+9ZlaXsaU0Ssuda7xPrX4405CbnKcpvM6q6okMP86Ejjn75Cfzhv65hJkCjbiF
    7FZxosCRIuYbhEEKu2Z9Dgh+ZbsZ+9FETZVzKBs4fySA6dIw6zmGINd+KY6umMWyJNej2Sia70fu3XLH
    j2yBgN5cy8arlZ80q1Mcy763RjYGkR/FkLJ611HWIA= thisuser@thishost
    where "10.1.1.1" is the IP (version 4 [5]) address of thishost, and "/home/remoteuser/cron/validate-rsync" is a script that looks something like this [6] [7]:
    #!/bin/sh

    case "$SSH_ORIGINAL_COMMAND" in
    *\&*)
    echo "Rejected"
    ;;
    *\(*)
    echo "Rejected"
    ;;
    *\{*)
    echo "Rejected"
    ;;
    *\;*)
    echo "Rejected"
    ;;
    *\<*)
    echo "Rejected"
    ;;
    *\`*)
    echo "Rejected"
    ;;
    *\|*)
    echo "Rejected"
    ;;
    rsync\ --server*)
    $SSH_ORIGINAL_COMMAND
    ;;
    *)
    echo "Rejected"
    ;;
    esac
    If thishost has a variable address, or shares its address (via NAT or something similar) with hosts you do not trust, omit the 'from="10.1.1.1",' part of the line (including the comma), but leave the 'command' portion. This way, only the 'rsync' will be possible from connections using this key. Make certain that the 'validate-rsync' script is executable by remoteuser on remotehost and test it.
    PLEASE NOTE: The private key, though now somewhat limited in what it can do (and hopefully where it can be done from), allows the possessor to copy any file from remotehost that remoteuser has access to. This is dangerous, and I should take whatever precautions I deem necessary to maintain the security and secrecy of this key. Some possibilities would be ensuring proper file permissions are assigned, consider using a key caching daemon, and consider if I really need this process automated verses the risk.
    ALSO NOTE: Another security detail to consider is the SSH daemon configuration on remotehost. This example focuses on a user (remoteuser) who is not root. I recommend not using root as the remote user because root has access to every file on remotehost. That capability alone is very dangerous, and the penalties for a mistake or misconfiguration can be far steeper than those for a 'normal' user. If you do not use root as your remote user (ever), and you make security decisions for remotehost, I recommend either:
    PermitRootLogin no
    or:
    PermitRootLogin forced-commands-only
    be included in the '/etc/ssh/sshd_config' file on remotehost. These are global settings, not just related to this connection, so be sure you do not need the capability these configuration options prohibit. [8].
    The 'AllowUsers', 'AllowGroups', 'DenyUsers', and 'DenyGroups' key words can be used to restrict SSH access to particular users and groups. They are documented in the man page for "sshd_config", but I will mention that they all can use '*' and '?' as wildcards to allow and deny access to users and groups that match patterns. 'AllowUsers' and 'DenyUsers' can also restrict by host when the pattern is in USER@HOST form.
    Troubleshooting

    Now that I have the key with no password in place and configured, I need to test it out before putting it in a cron job (which has its own small set of baggage). I exit from the ssh session to remotehost and try:
    $ rsync -avz -e "ssh -i /home/thisuser/cron/thishost-rsync-key" remoteuser@remotehost:/remote/dir /this/dir/
    If this doesn't work, I will take off the "command" restriction on the key and try again. If it asks for a password, I will check permissions on the private key file (on thishost, should be 600), on 'authorized_keys' and (on remotehost, should be 600), and on the '~/.ssh/' directory (on both hosts, should be 700). If some cryptic 'rsync' protocol error occurs mentioning the 'validate-rsync' script, I will make sure the permissions on 'validate-rsync' (on remotehost, may be 755 if every remotehost user is trusted) allow remoteuser to read and execute it.
    If things still aren't working out, some useful information may be found in log files. Log files usually found in the /var/log/ directory on most linux hosts, and in the /var/log/secure log file on Red Hat-ish linux hosts. The most useful logfiles in this instance will be found on remotehost, but localhost may provide some client side information in its logs [9] . If you can't get to the logs, or are just impatient, you can tell the 'ssh' executable to provide some logging with the 'verbose' commands: '-v', '-vv', '-vvv'. The more v's, the more verbose the output. One is in the command above, but the one below should provide much more output:
    $ rsync -avvvz -e "ssh -i /home/thisuser/cron/thishost-rsync-key" remoteuser@remotehost:/remote/dir /this/dir/
    Hopefully, it will always just work flawlessly so I never have to extend the troubleshooting information listed here [10] .
    Cron Job Setup

    The last step is the cron script. I use something like this:
    #!/bin/sh

    RSYNC=/usr/bin/rsync
    SSH=/usr/bin/ssh
    KEY=/home/thisuser/cron/thishost-rsync-key
    RUSER=remoteuser
    RHOST=remotehost
    RPATH=/remote/dir
    LPATH=/this/dir/

    $RSYNC -az -e "$SSH -i $KEY" $RUSER@$RHOST:$RPATH $LPATH
    because it is easy to modify the bits and pieces of the command line for different hosts and paths. I will usually call it something like 'rsync-remotehost-backups' if it contains backups. I test the script too, just in case I carefully inserted an error somewhere.
    When I get the script running successfully, I use 'crontab -e' to insert a line for this new cron job:
    0 5 * * * /home/thisuser/cron/rsync-remotehost-backups
    for a daily 5 AM sync, or:
    0 5 * * 5 /home/thisuser/cron/rsync-remotehost-backups
    for a weekly (5 AM on Fridays). Monthly and yearly ones are rarer for me, so look at "man crontab" or here for advice on those.

    Unix CMD|Remote Backups With Rsync

    Remote Backups With Rsync

    Remote Backups With Rsync

    By Noel Davis

    In this article we explain how to automate the backup of files on remote machines to a centralized server using rsync.

    rsync is a command line utility that is used to synchronize files between two computers over a network to synchronize files between two filesystems. It was written as a replacement for rcp but with many new features. For example it uses an algorithm that will only transfer files that have been modified. SSH will be used to authenticate between the machines and to encrypt the network traffic.

    The situation: We have four machines named: server, machine1, machine2, and machine3. The server has a tape drive that is used to do nightly backups. machine1 is used as a development box and has files that need to be backed up in /src and in /home. machine2 is used for mail and needs /home and /mail to be backed up. machine3 is a web server and needs /home, /var/www, and /etc/httpd backed up.

    Create a shell script for each machine. Simplify your maintenance by placing the scripts in a central location. I like to use /root/scripts. Decide on where you want to log your output. I like /root/logs but another common option is to have the script mail you the output.

    Add entries to your crontab to call the scripts. Make sure you leave enough time before your normal backups of the server that the rsync jobs complete.

    Each night the following will occur:

    1. rsync machine1 -> Server
    2. rsync machine2 -> Server
    3. rsync machine3 -> Server
    4. backup server to tape
    Let's take a look at the flags used for rsync in the examples:

    rsync -ave ssh --numeric-ids --delete machine1:/home /machine1

    • -a:
      Archive mode
    • -v:
      Verbose output
    • -e ssh:
      Specify the remote shell as ssh
    • --numeric-ids:
      Tells rsync to not map user and group id numbers local user and group names
    • --delete:
      Makes server copy an exact copy of the source by removing any files that have been removed on the remote machine
    • machine1:/home:
      The remote machine name, then the directory to be backed up
    • /machine1:
      The directory to place the backup

    Next generate a public private key pair with ssh. Place the public key in the ~/.ssh/authorized_keys file in an account on machine1, machine2, and machine3 that has read access to the directories that need to be backed up. It is best not to use the root account on the remote machines, but you should evaluate the risk in your environment. Test that you can login to these accounts using ssh without using a password.

    Test each one of the rsync scripts. The first time you run rsync will take the longest as it will need to copy all the files from the remote machines and not just the files that have changed.

    Add the /machine1, /machine2, and /machine3 (or whatever you have named them) directories to the servers backup script.

    While this process does not backup the entire remote machine, it will ensure that you will not lose irreplaceable data.

    Starting with the example scripts included in this tutorial there are many changes that can be made to fit your specific circumstances.

    The frequency of the rsyncs can be modified to occur more often or at different times. Simply by adding additional crontab lines the backup from the remote machines could be done everyday at lunch, multiple times a day or even hourly.

    The scripts could also be changed to rotate between multiple backups on the server or could be changed to do some sort of processing on the files before they are backed up. For example if the home directories you are backing up contain web browser caches, they could be removed after the rsync but before the system backup.

    Using this article as a starting point you should create a backup plan that fit your needs.


    Example rsync script for machine1:
    #!/bin/bash  rsync -ave ssh --numeric-ids --delete machine1:/home /machine1 rsync -ave ssh --numeric-ids --delete machine1:/src /machine1  

    Example rsync script for machine2:
    #!/bin/bash  rsync -ave ssh --numeric-ids --delete machine2:/home /machine2 rsync -ave ssh --numeric-ids --delete machine2:/mail /machine2  

    Example rsync script for machine3:
    #!/bin/bash  rsync -ave ssh --numeric-ids --delete machine3:/home /machine3 rsync -ave ssh --numeric-ids --delete machine3:/var/www /machine3 rsync -ave ssh --numeric-ids --delete machine3:/etc/httpd /machine3   

    Example crontab file logging to a directory:
    # Scripts to rsync machines 59 20 * * * /root/scripts/sync-machine1.sh >/root/logs/sync-machine1.log 2>&1 59 21 * * * /root/scripts/sync-machine2.sh >/root/logs/sync-machine2.log 2>&1 59 22 * * * /root/scripts/sync-machine3.sh >/root/logs/sync-machine3.log 2>&1 # # Nightly Backup script 59 23  * * * /root/scripts/backup.sh > /root/logs/backup.log 2>&1 

    Example crontab file mailing the output:


    # Scripts to rsync machines 59 20 * * * /root/scripts/sync-machine1.sh 59 21 * * * /root/scripts/sync-machine2.sh 59 22 * * * /root/scripts/sync-machine3.sh # # Nightly Backup script 59 23  * * * /root/scripts/backup.sh 

    Tuesday, May 19, 2009

    Test|开源性能测试工具 - Apache ab 介绍

    开源性能测试工具 - Apache ab 介绍 - Jackei 的测试生活与人文社会读本 - 博客园

    引子

    按照原定计划,今天开始研究 JMeter,一天的时间看完了大半的 User Manual,发现原来只要沉住气,学习效率还是蛮高的,而且大堆的英文文档也没有那么可怕 ^_^

    本来想顺便把文档翻译一下,不过后来想了想,看懂是一回事,全部翻译出来又是另外一回事了,工作量太大,而且这也不是我一开始要研究 JMeter 的本意。不如大家有兴趣一起研究的遇到问题再一起讨论吧。

    开源工具通常都是为了某个特定的目的而开发出来的,所以如果想找到一个开源的性能测试工具去与LoadRunner 或者 QALoad 之类去比较,实在有些勉强。但是开源工具也有它自己的优势:小巧、轻便,在自己擅长的领域可以提供优秀的解决方案。所以,我们可以考虑准备一个自己的“开源测试工具箱”,平时利用空闲时间了解各种工具所适用的环境和目的,知识慢慢积累下来以后,就可以在遇到问题时顺手拈来轻松化解 ^_^

    另外,如果8月份和9月份的空闲时间足够多,我想我会写一个系列文章来讲述在实际的开发和测试过程中引入开源性能测试工具的情况。如果有朋友感兴趣,希望大家可以一起研究和讨论。

    简介

    ab的全称是ApacheBench Apache 附带的一个小工具专门用于 HTTP Server benchmark testing可以同时模拟多个并发请求。前段时间看到公司的开发人员也在用它作一些测试,看起来也不错,很简单,也很容易使用,所以今天花一点时间看了一下。

    通过下面的一个简单的例子和注释,相信大家可以更容易理解这个工具的使用。

    一个简单的例子

    /*在这个例子的一开始,我执行了这样一个命令 ab -n 10 -c 10 http://www.google.com/这个命令的意思是启动 ab ,向 www.google.com 发送10个请求(-n 10) ,并每次发送10个请求(-c 10)——也就是说一次都发过去了。跟着下面的是 ab 输出的测试报告,红色部分是我添加的注释。*/

    C:\Program Files\Apache Software Foundation\Apache2.2\bin>ab -n 10 -c 10 http

    ://www.google.com/

    This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0

    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

    Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/

     

    Benchmarking www.google.com (be patient).....done

     

     

    Server Software:        GWS/2.1

    Server Hostname:        www.google.com

    Server Port:            80

     

    Document Path:          /

    Document Length:        230 bytes

     

    Concurrency Level:      10

    /*整个测试持续的时间*/

    Time taken for tests:   3.234651 seconds

    /*完成的请求数量*/

    Complete requests:      10

    /*失败的请求数量*/

    Failed requests:        0

    Write errors:           0

    Non-2xx responses:      10

    Keep-Alive requests:    10

    /*整个场景中的网络传输量*/

    Total transferred:      6020 bytes

    /*整个场景中的HTML内容传输量*/

    HTML transferred:       2300 bytes

    /*大家最关心的指标之一,相当于 LR 中的 每秒事务数 ,后面括号中的 mean 表示这是一个平均值*/

    Requests per second:    3.09 [#/sec] (mean)

    /*大家最关心的指标之二,相当于 LR 中的 平均事务响应时间 ,后面括号中的 mean 表示这是一个平均值*/

    Time per request:       3234.651 [ms] (mean)

    /*这个还不知道是什么意思,有知道的朋友请留言,谢谢 ^_^ */

    Time per request:       323.465 [ms] (mean, across all concurrent requests)

    /*平均每秒网络上的流量,可以帮助排除是否存在网络流量过大导致响应时间延长的问题*/

    Transfer rate:          1.55 [Kbytes/sec] received

    /*网络上消耗的时间的分解,各项数据的具体算法还不是很清楚*/

    Connection Times (ms)

                  min  mean[+/-sd] median   max

    Connect:       20  318 926.1     30    2954

    Processing:    40 2160 1462.0   3034    3154

    Waiting:       40 2160 1462.0   3034    3154

    Total:         60 2479 1276.4   3064    3184

     

    /*下面的内容为整个场景中所有请求的响应情况。在场景中每个请求都有一个响应时间,其中 50 的用户响应时间小于 3064 毫秒,60 的用户响应时间小于 3094 毫秒,最大的响应时间小于 3184 毫秒*/

    Percentage of the requests served within a certain time (ms)

      50%   3064

      66%   3094

      75%   3124

      80%   3154

      90%   3184

      95%   3184

      98%   3184

      99%   3184

     100%   3184 (longest request)

     

    更多信息

    ab 不像 LR 那么强大,但是它足够轻便,如果只是在开发过程中想检查一下某个模块的响应情况,或者做一些场景比较简单的测试,ab 还是一个不错的选择——至少不用花费很多时间去学习 LR 那些复杂的功能,就更别说那 License 的价格了。



    英文看着不好看,给个中文的

    ab - Apache HTTP服务器性能测试工具
    ab是Apache超文本传输协议(HTTP)的性能测试工具。其设计意图是描绘当前所安装的Apache的执行性能,主要是显示你安装的Apache每秒可以处理多少个请求。


    语法
    ab [ -A auth-username:password ] [ -c concurrency ] [ -C cookie-name=value ] [ -d ] [ -e csv-file ] [ -g gnuplot-file ] [ -h ] [ -H custom-header ] [ -i ] [ -k ] [ -n requests ] [ -p POST-file ] [ -P proxy-auth-username:password ] [ -q ] [ -s ] [ -S ] [ -t timelimit ] [ -T content-type ] [ -v verbosity] [ -V ] [ -w ] [ -x <table>-attributes ] [ -X proxy[:port] ] [ -y <tr>-attributes ] [ -z <td>-attributes ] [http://]hostname[:port]/path


    选项
    -A auth-username:password
    向服务器提供基本认证信息。用户名和密码之间由一个":"隔开,并将被以base64编码形式发送。无论服务器是否需要(即是否发送了401认证需求代码),此字符串都会被发送。
    -c concurrency
    一次产生的请求个数。默认是一次一个。
    -C cookie-name=value
    对请求附加一个"Cookie:"头行。其典型形式是 name=value 的一个参数对。此参数可以重复。
    -d
    不显示"percentage served within XX [ms] table"消息(为以前的版本提供支持)。
    -e csv-file
    产生一个逗号分隔(CSV)文件,其中包含了处理每个相应百分比请求(从1%到100%)所需要的相应百分比时间(以微秒为单位)。由于这种格式已经"二进制化",所以比"gnuplot"格式更有用。
    -g gnuplot-file
    把所有测试结果写入一个"gnuplot"或者TSV(以Tab分隔)文件。此文件可以方便地导入到 Gnuplot, IDL, Mathematica, Excel中。其中的第一行为标题。
    -h
    显示使用方法的帮助信息。
    -H custom-header
    对请求附加额外的头信息。此参数的典型形式是一个有效的头信息行,其中包含了以冒号分隔的字段和值(如:"Accept-Encoding: zip/zop;8bit")。
    -i
    执行HEAD请求,而不是GET 。
    -k
    启用KeepAlive功能,即在一个HTTP会话中执行多个请求。默认不启用KeepAlive功能。
    -n requests
    在测试会话中所执行的请求个数。默认仅执行一个请求,此时其结果不具有意义。
    -p POST-file
    包含了POST数据的文件。
    -P proxy-auth-username:password
    对一个中转代理提供基本认证信息。用户名和密码由一个":"隔开,并将被以base64编码形式发送。无论服务器是否需要(即是否发送了407代理认证需求代码),此字符串都会被发送。
    -q
    如果处理的请求数大于150,ab每处理大约10%或者100个请求时,会在stderr输出一个进度计数。此 -q 标记可以屏蔽这些信息。
    -s
    用于编译中(ab -h 会告诉你)使用了SSL的受保护的https ,而不是http协议的时候。此功能是实验性的,最好不要用。
    -S
    不显示中值和标准偏差值,而且在均值和中值为标准偏差值的1到2倍时,也不显示警告或出错信息。默认时,会显示最小值/均值/最大值等数值。(为以前的版本提供支持)
    -t timelimit
    测试所进行的最大秒数。内部隐含值是"-n 50000"。它可以使对服务器的测试限制在一个固定的总时间以内。默认时,没有时间限制。
    -T content-type
    POST数据时所使用的"Content-type"头信息。
    -v verbosity
    设置显示信息的详细程度,4或更大值会显示头信息,3或更大值可以显示响应代码(404,200等),2或更大值可以显示警告和其他信息。
    -V
    显示版本号并退出。
    -w
    以HTML表格形式输出结果。默认时,它是白色背景的两列宽度的一张表。
    -x <table>-attributes
    设置<table>属性的字符串。此属性被填入<table 这里 > 。
    -X proxy[:port]
    对请求使用代理服务器。
    -y <tr>-attributes
    设置<tr>属性的字符串。
    -z <td>-attributes
    设置<td>属性的字符串。