Sunday, July 27, 2008

心目中的编程高手

Bill Joy MIT BBS上说微软电话面试的一道题就是“Who do you think is the best coder, and why?”。我觉得挺有意思的,也来凑个热闹。排名不分先后。

Bill Joy,前任Sun的首席科学家
当年在Berkeley时主持开发了最早版本的BSD。他还是vi和csh的作者。当然,Csh Programming Considered Harmful是另一个话题乐。据说他想看看自己能不能写个操作系统,就在三天里写了个自己的Unix, 也就是BSD的前身。当然是传说了,但足见他的功力。另一个传说是,1980年初的时候,DARPA让BBN在Berkeley Unix里加上BBN开发的TCP/IP代码。但当时还是研究生的B伯伯怒了,拒绝把BBN TCP/IP加入BSD,因为他觉得BBN的TCP/IP写得不好。于是B伯伯出手了,端的是一箭封喉,很快就写出了高性能的伯克利版TCP/IP。当时 BBN和DARPA签了巨额合同开发TCP/IP Stack,谁知他们的代码还不如一个研究生的好。于是他们开会。只见当时B伯伯穿个T-shirt出现在会议室(当时穿T-shirt不象现在,还是相 当散漫的哈)只见BBN问:你怎么写出来的?而B伯伯答:简单,你读协议,然后编程就行了。最令偶晕倒的是,B伯伯硕士毕业后决定到工业界发展,于是就 到了当时只有一间办公室的Sun, 然后他就把Sparc设计出来乐... 象这种软硬通吃的牛人,想不佩服都不行的说。据Bill Joy的同事说,一般开会的时候B伯伯总是拿一堆杂志漫不经心地读。但往往在关键之处,B伯伯发言,直切要害,提出漂亮的构想,让同事们彻底崩溃。对了,他还是Java Spec和JINI的主要作者之一。

John Carmack,ID Software的founder和Lead Programmer
上个月和一个搞图形的师兄聊天,他竟然不知道John Carmack, 也让偶大大地晕了一把。不过也许搞研究的和搞实战的多少有些隔吧。想必喜欢第一人称射击游戏的都知道J哥哥。90年代初只要能在PC上搞个小动画都能让人 惊叹一番的时候,J哥哥就推出了石破天惊的Castle Wolfstein, 然后再接再励,doom, doomII, Quake...每次都把3-D技术推到极致。J哥哥的简历上说自己的专长是"Exhaust 3-D technology",真是牛人之言不我欺的说。做J哥哥这样的人是很幸福的,因为各大图形卡厂家一有了新产品就要向他“进贡”,不然如果他的游戏不支 持哪种卡,哪种卡基本就会夭折乐。当初MS的Direct3D也得听取他的意见,修改了不少API。当然,J哥哥在结婚前十数年如一日地每天编程14小时 以上,也是偶们凡人望尘莫及的。,J哥哥高中肆业(?!),可以说是自学成才。不过呢,谁要用这个例子来为自己学习不好辩护,就大错特错了。那 Leonardo Da Vinci还是自学成才呢(人是私生子,不能上学)。普通人和天才还是有区别的。对了,其实偶们叫“达分奇”是相当不对的,因为Vinci是地名,而Da Vinci就是从Vinci来的人的意思。换句话说,Leonardo Da Vinci就是“从Vinci来的Leonardo”的意思。叫别人“Da Vinci”就不知所谓乐。嗯,扯远了,打住。

David Cutler,VMS 和Windows NT的首席设计师
去微软前号称硅谷最牛的kernel开发员。当初他和他的手下在微软一周内把一个具备基本功能的bootable kernel写出来,然后说:"who can't write an OS in a week?",也是牛气冲天的说。顺便说一句,D爷爷到NT3.5时,管理1500名开发员,自己还兼做设计和编程,不改coder本色啊。D爷爷天生脾 气火爆,和人争论时喜欢双手猛击桌子以壮声势。:-) 日常交谈F-word不离口。他面试秘书时必问:"what do you think of the word '***'?",让无数美女刹羽而归。终于有一天,一个同样火爆的女面对这个问题脱口而出:"That's my favorite word"。于是她被录取乐,为D爷爷工作到NT3.5发布。

Donald E. Knuth
高爷爷其实用不着偶多说。学编程的不知道他就好像学物理的不知道牛顿,学数学的不知道欧拉,学音乐的不知道莫扎特,学Delphi的不知到Anders Hejlsberg,或者学Linux不知道Linus Torvalds一样,不可原谅啊。:-) 为了让文章完整,就再罗唆几句吧。高爷爷本科时就开始给行行色色的公司写各种稀奇古怪的编译器挣外快了。他卖给别人时收一两千美元,那些公司拿了 code,加工一下卖出去就是上万上十万。不过也没见高爷爷不爽过,学者本色的说。想想那可是60年代初啊,高爷爷写编译器写多了,顺带就搞出了个 Attribute Grammar和LR(k),大大地造福后人啊。至于高爷爷在CalTech的编程比赛(有Alan Kay得众多高高手参加)总是第一,写的Tex到86年就code freeze,还附带2^n美分奖励等等都是耳熟能详,偶就不饶舌乐。顺便说一下,高老大爷是无可争议的写作高手。他给Concrete Mathematics写的前言可谓字字铿锵,堪为前言的典范。他的技术文章也是一绝,文风细致,解释精当,而且没有学究气,不失轻快跳脱。记得几年前读 Concrete Mathematics,时不时开怀大笑,让老妈极其郁闷,觉得我nerdy到家,不可救药。其实呢,子非鱼,安知鱼之乐,更不知那完全是高爷爷的功劳。 说到写作高手,不能不提Stephen A. Cook。他的文章当年就被我们的写作老师极力推荐,号称典雅文风的样本。库爷爷一头银发,身材颀长,总是面带谦和的微笑,颇有仙风道骨,正好和他的仙文 相配的说。高爷爷其实还是开源运动的先驱。虽然他没有象Richard Stallman那样八方奔走,但他捐献了好多作品,都可以在网上看到,比如著名的Mathematical Writing,MMIXWare,The Tex Book等,更不用说足以让他流芳百世的Tex乐。

Ken Thompson,C 语言前身B语言的作者,Unix的发明人之一
(另 一个是Dennis M. Riche老大,被尊为DMR),Belle(一个厉害的国际象棋程序)的作者之一,操作系统Plan 9的主要作者(另一个是大牛人Rob Pike, 前不久被google挖走了)。Ken爷爷也算是计算机历史上开天辟地的人物了。1969年还是计算机史前时代,普通人都认为只有大型机才能运行通用的操 作系统,小型机只有高山仰止的份儿。至于用高级语言来写操作系统,更是笑谈。Ken爷爷自然不是池中物,于是他和DMR怒了,在1969年到1970间用 汇编在PDP-7上写出了UNIX的第一个版本。他们并不知道,一场轰轰烈烈的UNIX传奇由此拉开了序幕。Ken爷爷在1971年又把Unix用C重 写,于是C在随后20年成就了不知多少豪杰的梦想和光荣。Ken爷爷还有段佳话:装了UNIX的PDP-11最早被安装在Bell Lab里供大家日常使用。很快大家就发现Ken爷爷总能进入他们的帐户,获得最高权限。Bell Lab里的科学家都心比天高,当然被搞得郁闷无比。于是有高手怒了,跳出来分析了UNIX代码,找到后门,修改代码,然后重新编译了整个UNIX。就在大 家都以为“这个世界清净了”的时候,他们发现Ken爷爷还是轻而易举地拿到他们的帐户权限,百思不解后,只好继续郁闷。谁知道这一郁闷,就郁闷了14年, 直到Ken爷爷道出个中缘由。原来,代码里的确有后门,但后门不在Unix代码,而在编译Unix代码的C编译器里。每次C编译器编译UNIX的代码, 就自动生成后门代码。而整个Bell Lab的人,都是用Ken爷爷的C编译器。

Rob Pike, AT&T Bell Lab前Member of Technical Staff
现在google研究操作系统。罗伯伯是Unix的先驱,是贝尔实验室最早和Ken Thompson以及Dennis M. Ritche开发Unix的猛人,UTF-8的设计人。他还在美国名嘴David Letterman的晚间节目上露了一小脸,一脸憨厚地帮一胖子吹牛搞怪。让偶佩服不已的是,罗伯伯还是1980年奥运会射箭的银牌得主。他也是个颇为厉 害的业余天文学家,设计的珈玛射线望远镜差点被NASA用在航天飞机上。他还是两本经典,The Unix Programming Environment 和 The Practice of Programming 的作者之一。如果初学者想在编程方面精益求精,实在该好好读这两本书。它们都有中文版的说。罗伯伯还写出了Unix下第一个基于位图的窗口系统,并且是 著名的blit终端的作者。当然了,罗伯伯还是号称锐意革新的操作系统,Plan9,的主要作者。可惜的是,Plan9并没有引起多少人的注意。罗伯伯一 怒之下,写出了振聋发聩的雄文 Systems Software Research is Irrelevant,痛斥当下系统开发不思进取,固步自封的弊病。虽然这篇文章是罗伯伯含忿出手,颇有偏激之词,但确实道出了系统开发的无奈:开发周期 越来越长,代价越来越大,用户被统一到少数几个系统上,结果越来越多的活动是测量和修补,而真正的革新越来越少。就在罗伯伯郁闷之极的时候,google 登门求贤来乐。如果说现在还有一家大众公司在不遗余力地把系统开发推向极致的话,也就是google乐。随便看看google的成果就知道了。具有超强容 错和负载平衡能力的分布式文件系统GFS(现在能够用100,000台廉价PC搭起一个巨型分布系统,并且高效便宜地进行管理的系统也不多哈),大规模机 器学习系统(拼写检查,广告匹配,拼音搜寻。。。哪个都很牛的说),更不用说处理海量并行计算的各式google服务了。Rob在System Software Research is Irrelevant里萧瑟地说现在没有人再关心系统研究的前沿成果了。想不到他错了,因为google关心。google网络了大批功成名就的牛人,还 有大量初生牛犊般博士做开发,显然不是没事耍酷,而是因为它们的开发总是试图吸取系统研究的最新成果。想必Rob Pike在google很幸福。愿他做出更棒的系统。

Dennis M. Ritchie
既然Ken Thompson是我的偶像,新闻组上人称DMR的Dennis M. Ritchie自然也是,毕竟两人共同缔造了UNIX,而Dennis几乎独力把C搞大(当然,C的前身是B,而B是Ken Thompson一手做出来的)。J D两人1983年分享图灵奖,是有史以来少数几个因工程项目得奖的工程师(本来是唯一的一对儿,但Alan Kay才因为SmallTalk得奖,所以就成了唯二的乐)。一个人一生能做出一个卓越的系统已经不易,DMR的C和UNIX长盛不衰近30年,至今生机 勃勃,DMR此生可以无憾的说。D爷爷也算有家学渊源:他老爸在AT&T贝尔实验室工作了一辈子,并在电路设计方面卓有成就,还出了本颇有影响的 书The Design of Switching Circuits,据说在交换理论和逻辑设计方面有独到的论述。当然,D爷爷和他老爸是不同时代的人:他老爸的研究成形于晶体管发明之前,而D爷爷的工作 离了晶体管就玩儿不转乐。:-D不要看D爷爷搞出了C,其实他最爱的编程语言是Alef,在Plan9上运行,支持并行编程。Alef的语法和C相似,但 数据类型和执行方式都和C大大不同。说到语言,D爷爷对后来人有非常中肯的建议:抱着学习的目的来开发你自己的语言,不要冀望于它被众人接受。这个建议不 光对语言开发有用,也适用于其它大型系统的开发。别的不说,DMR后来领导自己的团队在1995年和1996分别推出了Plan9和Inferno操作系 统,又用多少人知道呢?其实,D爷爷当初也没想过C会风行世界。他开发C的初衷和Eric S. Raymond在Cathedral and Bazaar里阐述的一样,就是要消除自己对现有工具的不爽之处。谁知D爷爷无心插柳,C竟然受到众多程序员的狂热拥戴,连D爷爷自己都大惑不解。在一次 采访中D爷爷说大概那是因为C的抽象程度碰巧既满足了程序员的要求,又容易实现。当然C一度是Unix上的通用语言也是原因。但不管怎么说,D爷爷对编程 语言出色的审美意识奠定了C广为流传的基础。最后八卦一下。D爷爷的业余爱好和NBA大牛Karl Malone一样:开卡车。不过D爷爷更喜欢开NASCAR,而KM独爱巨无霸。J D爷爷自称心中不供偶像,如果一定要说一个,那就是Ken Thompson了。现在Ken爷爷退休当飞机教练去了,而D爷爷当了贝尔实验室系统开发部的头,整日忙于开支票。他俩合作20年,屡屡创造历史。这段令 人神往的佳话,也就长留你我心中乐。P.S.,很多人都以为Brian W. Kernighan是C的作者。其实BWK只是写了那本经典K&R C。据D爷爷说,他,Ken和Kernighan三人中,Kernighan最能写文章,他次之,而Ken写得最少;但说到编程,Ken爷爷才是当之无愧 的老大。

Edsger Wybe Dijkstra
对,就是E.W. Dijkstra. 一提到EWD,很多人就会想起找最短路径的Dijkstra Algorithm,就好像一提到Sir. Tony Hoare,就想起Quick Sort一样。其实这些个算法不过是两个牛人在他们职业生涯中最琐碎的贡献。比如Dijkstra算法,无非是戴爷爷在1956年为了展示新计算机 ARMAC的计算能力,初试身手的成果,属于他的算法处女作。据戴爷爷自述,他搞出最短路径算法的时候连纸笔都没用。当时他和他老婆在阿姆斯特丹一家咖啡 厅的阳台上晒太阳喝咖啡,突然就把这个算法想出来乐。而且当时的算法研究还比较原始,牛人们忙着用计算机搞数值计算,对离散算法不屑一顾。那时连一个象样 的专注于离散算法的专业期刊都没有。戴爷爷于是推迟发表这个算法。直到1959年,他才把这个算法发表在Numerische Mathematik的创刊号上,权为捧场。:-) EWD在多个领域牛气冲天,端的是理论和编程两手硬的高手。只不过他的很多工作比较深刻,学校的老先生们觉得本科生接受不了,不给本科生讲而已。戴爷爷大 概因为最短路径算法一战成名,于是有人请他参加另一台计算机X1的设计工作,并且把设计实时中断系统的任务派给了他。现在看来实时中断也许不算什么,但要 知到,X1前根本就没有实时中断的概念。实现它简直就是一场豪赌。戴爷爷起初还不情愿,但经不住项目负责人Bram和Carel的轮番“吹捧”:我们知道 实时中断让您工作变得非常困难,但象您这样的牛人肯定能做出来的说。结果戴爷爷被糖衣炮弹彻底击穿,接下了这个烫手山芋。两三年后,他不仅搞出了实时中 断,还围绕这个写出了自己的博士论文,顺利戴上博士帽。让戴爷爷真正成名立万的还是在X1上开发的Algo60,最早的高级语言之一。戴爷爷没日没夜地工 作了8个月,就搞出了Algo60,也因此获得了1972年的图灵奖。因为Algo60,戴爷爷发表了一篇石破天惊的文章:Recursive Programming,于是人们才知道,原来高级语言也可以高效地实现递归,原来从此以后,所有程序员都不可避免地和戴爷爷发明的一个词(应该说是概 念)打交道:堆栈。而且Algo60还让戴爷爷深入地思考多道程序设计的问题,最终发明了每个系统程序员都绕不开的概念:semaphore。当然,戴爷 爷总是把他发明的概念严格形式化,极具科学家本色的说。和这些成就想比,他提出的吃饭的哲学家问题,也就没什么好说的了。说来好笑,当时的大学(忘了哪所 了)还是觉得戴爷爷没有受过正统的数学训练,也不是专门搞数值分析的,所以最后不太情愿地给了他一个教职。这种小挫折并不能妨碍象戴爷爷这样的牛人创造历 史。他一边教数值分析(:-D),一边开始开发一个新的操作系统,并培养计算机科学家。几年后,THE Multiprogramming System横空出世。THE是第一个支持松散耦合,显式同步的进程并由此使得严格证明系统没有死锁变得容易的操作系统。可惜戴爷爷任职的系不识货,还强 行解散了他的研究小组(1972年戴爷爷给他的系主任说他得了图灵奖,系主任的第一反应是你们搞计算机就喜欢乱发奖)。这让戴爷爷相当郁闷,得了抑郁症。 在极度郁闷之中,戴爷爷决定用写作来治疗自己的抑郁症。于是经典就诞生乐:Notes on Structured Programming。戴爷爷从此被尊为结构化编程的奠基人,而且他的抑郁症也被治好乐。EWD太牛,结果他的故事也太多。先到这里吧。1973起,他 的故事就在美国发生了。

Anders Hejlsberg, 微软.NET的首席架构师,编程语言设计和实现的顶尖高手
他一手做出了Turbo Pascal,也是Delphi, J++(尤其是WFC),C#和.NET的主要作者。这些作品的名字足以为他立传。作为一个程序员,我在这样的大师面前实在无语。生子当如Anders的 说。李维的《Borland传奇》里已详细讲述了Anders的传奇故事,我就不用费舌了:http://java.mblogger.cn/iexploiter/posts/1505.aspx。Artima上有Anders谈C#的系列访谈。MSDN上有一段Anders导游的录像。有兴趣可以去看看牛人的丰采。

最近10年计算机专业图书中的50强

美国著名图书频道Book Pool集结最权威的62位作者评选出了最近10年计算机专业图书中的50强。

光这62位作者阵营就非常强大,我们熟悉的就有:
  • Francesco Balena《Microsoft.NET框架程序设计——Visual Basic.NET语言描述》作者)
  • Bert Bates《Head First Design Patterns》作者)
  • Joshua Bloch《Effective Java》作者)
  • Kalen Delaney《Microsoft SQL Server 2000技术内幕》作者)
  • Stephen C. Dewhurst《C++ Gotchas》作者)
  • Bill Evjen《Visual Basic.NET宝典》作者)
  • Dino Esposito《构建Web解决方案——应用ASP.NET和ADO.NET、Microsoft .NET XML程序设计》作者)
  • Andy HuntPragmatic Programmer系列图书作者)
  • Gary McGraw《Exploiting Software: How to Break Code》作者)
  • Steve McConnell《Code Complete》作者)
  • Christian Nagel《Enterprise Services with the .NET Framework》作者)
  • Arnold Robbins《Linux程序设计》作者)
  • Tim O'Reilly(O'Reilly媒体集团创始人)
  • Chris Sells《Windows Forms程序设计、.NET本质论》作者)
  • Stephen Walther《设计模式——可复用面向对象软件的基础》作者)
  • John Vlissides《ASP.NET揭秘》作者)
由此可见这次评选的权威性,还是让我们来看看这50本书的分布吧:

软件工程类

按照现代计算机技术的发展,《人月神话》应该称得骨灰级图书了,计算机图书能够流行30年,Frederick Brooks确实让人刮目相看。这种现象往往出现在软件工程类和算法类的图书上,这些理论和技术往往经久不衰。比如:
  • 《设计模式:可复用面向对象软件的基础》1994年出版(多位大师创作)
  • 《人件》1987年出版(Tom DeMarcoTimothy Lister
Martin FowlerKent Beck是软件工程领域最有名的技术作家,剩下的4本上榜图书全部是他们所写:
  • 《企业应用架构模式》Martin Fowler
  • 《重构——改善既有代码的设计》Martin Fowler
  • 《解析极限编程》Kent Beck
  • 《UML精粹:标准对象建模语言简明教程》Martin Fowler
看看这个领域还漏掉哪些经典:
Robert C. Martin《敏捷软件开发:原则、模式与实践》或者是其他?

C/C++类

C语言的设计者Brian W. Kernighan《C程序设计语言》确实经典,超过C++之父Bjarne Stroustrup《C++程序设计语言》进入名单榜中。

此外,Scott Meyers《Effective C++》众望所归,他的《More Effective C++》《Effective STL》也同样精彩。

Stan Lippman《C++ Primer》不在榜单,有点可惜。

Java类

不 知道什么原因,Java类图书的排名比较靠后,《Head First Java》是一本不错的教材,不过国内好像还未引进,《Java 2核心技术 卷I:基础知识》已经出第7版了,可见受欢迎的程度。Sun的Joshua Bloch《Effective Java》采用Scott Meyers的风格,使本书成为真正的Effective Java Book。

不过《Java编程思想》《J2EE核心模式》《Contributing to Eclipse》《Expert One-on-One J2EE Development without EJB》落榜有点意外。

Windows/.NET类

Charles Petzold《Windows程序设计》是尽人皆知的Win32 API编程经典,也称为“Petzold Book”。由Anders Hejlsberg来写《C#编程语言详解 》,谁说不是经典?不过《ADO.NET实用指南》上榜有点出乎我的意料,为什么不是Jeffrey Richter《Microsoft .NET框架程序设计》

Linux/Unix类

这类只有一本《UNIX环境高级编程》,漏掉了《UNIX 编程艺术》是否可惜?

Web开发类

有3本书上榜,Perl之父Larry Wall《Perl语言编程》是经典的教程,《网站重构》上榜在情理之中,Jeffrey Zeldman一直走在Web标准制定的最前沿。

ASP.NET Page Framework负责人Nikhil Kothari《ASP.NET服务器控件与组件开发》讲解ASP.NET模式非常清晰,不过,如果是ASP.NET入门的话,我倒是推荐另外一本——《ASP.NET揭秘》

还有没有漏掉什么啦?《JavaScript权威指南》是不是也很好?

网络通讯类

这类图书上榜比较多,TCP/IP如此的重要,《TCP/IP详解 卷I:协议》《TCP/IP路由技术(第一卷)》同时上榜。其他的还有《Internet路由结构》《计算机网络(第四版)》《DNS与BIND》

数据库类

数据库类评选结果不太好评点,《Transact-SQL权威指南》是一本标准的T-SQL教材,进一步实践,还是建议看邹建最新出版的中文版《SQL Server 2000 开发与管理应用实例》

其 他上榜的都没有中文版:《A First Look at SQL Server 2005 for Developers》(FirstLook系列过时太快,基本上没有引进)、《Expert Oracle, Signature Edition (One-on-One)》(2005年的新书,作者Thomas Kyte是Oracle的VP)、《Joe Celko's SQL for Smarties : Advanced SQL Programming》(作者Joe Celko是ANSI SQL标准委员会成员)。

安全类

网络社会没有比安全更重要的了,这类图书上榜就有5本,分别是: 《编写安全的代码》《黑客大曝光》《信息安全工程》《网络信息安全的真相》《应用密码学》。 后2本都是国际公认密码和信息安全专家Bruce Schneier的大作。

算法和代码类

提到算法,没有人不想到Donald E. Knuth《计算机程序设计艺术》,据说Bill Gates曾放言,做对该书所有习题就能到微软来报到上班,可见此书探讨算法的深度。相比Donald的巨著,《算法导论》更适合做为算法教材。

《代码大全》上榜在预料之中,这本书曾经有过中文版,不过现在已经绝版了,有点可惜。

综合类

不 好归类的都叫综合类吧,《程序员修炼之道》书名翻译不太恰当,《Pragmatic Programmer》代表注重实效的程序员,程序员如何注重实效?全书就围绕这个话题在谈。不过,因为这本书出版时间较早(1999年),我更愿意看《Joel说软件》,这种Blog的写作风格更加通俗易懂。

《编程珠玑》《程序设计实践》是2本讲解编程技巧的图书,如果说软件是工艺的话,你对这门手艺掌握的如何了?

Merrill R. Chapman作为老资格的程序员、销售主管,在《IT大败局》中以事件亲历的方式来剖析Ashton-Tate等公司的失败案例的时候显得特别具有说服力。前车之鉴、后车之师,何必自己花钱买教训呢?

综合类还有很多好书,比如,Gerald M.Weinberg《你的灯亮着吗?》David Kushner《DOOM启世录》都值得一读。国内的读者还不应该放过李维《Borland传奇》蔡学镛《爪哇夜未眠》

其他一些上榜图书没有中文版,不太好点评,分别是:
  • 《Microsoft SharePoint: Building Office 2003 Solutions》
  • 《Group Policy, Profiles, and IntelliMirror for Windows 2003, Windows XP, and Windows 2000》
  • 《Don't Make Me Think》
  • 《The Design of Everyday Things》
  • 《The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography》
  • 《Mac OS X: The Missing Manual, Panther Edition》
  • 《The Elements of Style, 4th Edition》
  • 《Godel, Escher, Bach: An Eternal Golden Braid》

Thursday, July 24, 2008

Enable Math Rendering in MediaWiki

1. Install OCaml.
2. Install texlive-latex
3. Download and install AMS-latex:
ftp://ftp.ams.org/pub/tex/amslatex.zip
ftp://ftp.ams.org/pub/tex/amsrefs/amsrefs-tds.zip
3. Install texvc (/wiki/math/README)
4. edit LocalSettings.php:
$wgMathPath = "../images/math";
$wgMathDirectory = "{$IP}/images/math";
$wgTmpDirectory = "{$IP}/images/tmp";
$wgUseTeX = true;


Thursday, July 17, 2008

Oracle 10g Installation

Groups:
  • oinstall, gid=2000
  • dba, gid=3000
  • oper, gid=4000
User:
  • oracle, password=orapass, g=oinstall, G=dba,oper, uid=2001
Directories:
  • Oracle Base Directory=/u00/app/oracle
  • Database File Directory = /u01/oradata
  • Recovery File Directory = /u02/oradata
  • Inventory Directory=/home/oracle/oraInventory
Evironment Variables:
  • ORACLE_BASE=/u00/app/oracle
  • ORACLE_SID=vrlab
  • Installation Name=OraDb10g_home1, Installation Path=/u00/app/oracle
Database:
  • Global Database Name=cad
  • System Identifier(SID)=cad
  • Server Parameter Filename=/u00/app/oracle/dbs/spfilecad.ora
  • Dababase Accounts=SYS, SYSTEM, DBSNMP, SYSMAN/orapass
  • iSQL*Plus URL=http://<host_name>:5560/isqlplus
  • iSQL*Plus DBA URL=http://<host_name>:5560/isqlplus/dba
  • Database Control URL=http://<hostname>:1158/em

Monday, July 14, 2008

Install WordPress & MediaWiki

1. Create the group and user for mysql users:
# groupadd -g 1000 mysql
# useradd -G mysql -d /home/mysql -m -u 1001 mysql
# passwd mysql
New Password: mypass
Reenter New Password: mypass
2.
# gzip -d mysql-5.0.51a-linux-i686-icc-glibc23.tar.gz
# tar -xvf mysql-5.0.51a-linux-i686-icc-glibc23.tar
# mv mysql-5.0.51a-linux-i686-icc-glibc23 mysql
# mv mysql /usr/local
3.
# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h opensuse password 'new-password'

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
# chown -R root .
# chown -R mysql data
4. Start the MySQL server.
# bin/mysqld_safe --user=mysql &
5. Accounts with the username root are created. These are superuser accounts that can do anything. The initial root account passwords are empty, so anyone can connect to the MySQL server as root — without a password — and be granted all privileges.
On Unix, both root accounts are for connections from the local host. Connections must be made from the local host by specifying a hostname of localhost for one of the accounts, or the actual hostname or IP number for the other.
Two anonymous-user accounts are created, each with an empty username. The anonymous accounts have no password, so anyone can use them to connect to the MySQL server.
On Unix, both anonymous accounts are for connections from the local host. Connections must be made from the local host by specifying a hostname of localhost for one of the accounts, or the actual hostname or IP number for the other. These accounts have all privileges for the test database and for other databases with names that start with test_.

1) remove the anonymous accounts:
# mysql -u root
mysql> drop user '';
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ''@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ''@'opensuse';
Query OK, 0 rows affected (0.00 sec)
2) assign passwords to the root accounts:
# mysql -u root
mysql> set password for 'root'@'localhost' = password( 'mypass' );
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'opensuse' = password( 'mypass' );
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'127.0.0.1' = password( 'mypass' );
Query OK, 0 rows affected (0.00 sec)
3) allow root account connecting from any host:
# mysql -u root -p
Enter password: mypass
mysql> create user 'root'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'%' = password( 'mypass' );
Query OK, 0 rows affected (0.00 sec)
4) grant privileges to root@%
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD '*CDC006E5FCB22B379747AF6E75DF97FB503F11B3' WITH GRANT OPTION
6. Use mysqladmin to verify that the server is running.
# bin/mysqladmin version - p
Enter password: mypass
bin/mysqladmin Ver 8.41 Distrib 5.0.51a, for redhat-linux-gnu on i686
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version 5.0.51a
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 3 hours 18 min 27 sec

Threads: 2 Questions: 300 Slow queries: 0 Opens: 24 Flush tables: 1 Open tables: 17 Queries per second avg: 0.025
# bin/mysqladmin variables -p
+---------------------------------+----------------------------------------+
| Variable_name | Value |
+---------------------------------+----------------------------------------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| automatic_sp_privileges | ON |
| back_log | 50 |
| basedir | /usr/local/mysql/ |
| binlog_cache_size | 32768 |
| bulk_insert_buffer_size | 8388608 |
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
......
| tmp_table_size | 33554432 |
| tmpdir | /tmp/ |
| transaction_alloc_block_size | 8192 |
| transaction_prealloc_size | 4096 |
| tx_isolation | REPEATABLE-READ |
| updatable_views_with_limit | YES |
| version | 5.0.51a |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | i686 |
| version_compile_os | redhat-linux-gnu |
| wait_timeout | 28800 |
+---------------------------------+----------------------------------------+
7. Verify that you can shut down the server:
# bin/mysqladmin -u root shutdown -p
Enter password: mypass
8. Verify that you can start the server again. Do this by using mysqld_safe or by invoking mysqld directly. For example:
# bin/mysqld_safe --user=mysql --log &
[1] 27927
opensuse:/usr/local/mysql # nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /usr/local/mysql/data
9. Run some simple tests to verify that you can retrieve information from the server. The output should be similar to what is shown here:
# bin/mysqlshow -p
# bin/mysqlshow mysql -p
# bin/mysql -e "select * from user" mysql -p
10.
# gzip -d httpd-2.2.9.tar.gz
# tar -xvf httpd-2.2.9.tar
# cd httpd-2.2.9
# ./configure --enable-so
# make
# make install
Now you have httpd-2.2.9 available under /usr/local/apache2, configured with loadable module support and the standard MPM prefork. To test the installation use your normal procedure for starting the Apache server, e.g.:
# /usr/local/apache2/bin/apachectl start
and stop the server to go on with the configuration for PHP:
# /usr/local/apache2/bin/apachectl stop.
11.
# gzip -d php-5.2.6.tar.gz
# tar -xvf php-5.2.6.tar
# cd php-5.2.6
Now, configure your PHP. This is where you customize your PHP with various options, like which extensions will be enabled. Do a ./configure --help for a list of available options. In our example we'll do a simple configure with Apache 2 and MySQL support. Your path to apxs may differ, in fact, the binary may even be named apxs2 on your system.
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql
# make
# make install
If you decide to change your configure options after installation, you only need to repeat the last three steps. You only need to restart apache for the new module to take effect. A recompile of
Apache is not needed.
Note that unless told otherwise, 'make install' will also install PEAR, various PHP tools such as phpize, install the PHP CLI, and more.

12. Setup your php.ini
# cp php.ini-dist /usr/local/lib/php.ini
You may edit your .ini file to set PHP options. If you prefer having php.ini in another location, use --with-config-file-path=/some/path in step 11.
If you instead choose php.ini-recommended, be certain to read the list of changes within, as they affect how PHP behaves.
13. Edit your httpd.conf to load the PHP module. The path on the right hand side of the LoadModule statement must point to the path of the PHP module on your system. The make install from above may have already added this for you, but be sure to check.
For PHP 4:
LoadModule php4_module modules/libphp4.so
For PHP 5:
LoadModule php5_module modules/libphp5.so
14. Tell Apache to parse certain extensions as PHP. For example, let's have Apache parse .php files as PHP. Instead of only using the Apache AddType directive, we want to avoid potentially dangerous uploads and created files such as exploit.php.jpg from being executed as PHP. Using this example, you could have any extension(s) parse as PHP by simply adding them. We'll add .phtml to demonstrate.
SetHandler application/x-httpd-php
Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP, but nothing else, we'd use this:

SetHandler application/x-httpd-php
And to allow .phps files to be executed as PHP source files, add this:
SetHandler application/x-httpd-php-source
15.
DirectoryIndex index.php index.html
16. Use your normal procedure for starting the Apache server, e.g.:
# /usr/local/apache2/bin/apachectl start
- OR -
# service httpd restart
17.
1) Download and unzip the WordPress package, if you haven't already.
2) Create a database for WordPress on your web server, as well as a MySQL user who has all privileges for accessing and modifying it.

mysql> create database wordpress character set gbk collate gbk_chinese_ci;
Query OK, 1 row affected (0.02 sec)

mysql> create user 'wordpress'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> set password for 'wordpress'@'%' = password( 'wordpress' );
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on wordpress.* to 'wordpress'@'%';
Query OK, 0 rows affected (0.04 sec)

3) Rename the wp-config-sample.php file to wp-config.php.
4) Open wp-config.php in your favorite text editor and fill in your database details.
5) Place the WordPress files in the desired location on your web server:

* If you want to integrate WordPress into the root of your domain (e.g. http://example.com/), move or upload all contents of the unzipped WordPress directory (but excluding the directory itself) into the root directory of your web server.
* If you want to have your WordPress installation in its own subdirectory on your web site (e.g. http://example.com/blog/), rename the directory wordpress to the name you'd like the subdirectory to have and move or upload it to your web server. For example if you want the WordPress installation in a subdirectory called "blog", you should rename the directory called "wordpress" to "blog" and upload it to the root directory of your web server.

Hint: If your FTP transfer is too slow read how to avoid FTPing at : Step 1: Download and Extract.

6) Run the WordPress installation script by accessing wp-admin/install.php in your favorite web browser.

* If you installed WordPress in the root directory, you should visit: http://example.com/wp-admin/install.php
* If you installed WordPress in its own subdirectory called blog, for example, you should visit: http://example.com/blog/wp-admin/install.php

18. Change the password for admin: <default>

19. Install MediaWiki:

1) Install ImageMagick:
# gzip -d ImageMagick-6.4.2-3.tar.gz
# tar -xvf ImageMagick-6.4.2-3.tar
# cd ImageMagick-6.4.2
# ./configure
# make
# make install
2) Prepare the Directories:
# chmod 777 config
3) Use your web browser to browse to the main wiki page. Click on the link to begin the configuration script.
* PHP 5.2.6 installed
* Found database drivers for: MySQL
* PHP server API is apache2handler; ok, using pretty URLs (index.php/Page_Title)
* Have XML / Latin1-UTF-8 conversion support.
* Warning: A value for session.save_path has not been set in PHP.ini. If the default value causes problems with saving session data, set it to a valid path which is read/write/execute for the user your web server is running under.
* PHP's memory_limit is 128M.
* Couldn't find Turck MMCache, eAccelerator, APC or XCache; cannot use these for object caching.
* Found GNU diff3: /usr/bin/diff3.
* Found ImageMagick: /usr/bin/convert; image thumbnailing will be enabled if you enable uploads.
* Installation directory: /usr/local/apache2/htdocs
* Script URI path:
* Installing MediaWiki with php file extensions
* Environment checked. You can install MediaWiki.
*** Admin Username: WikiSysop
*** Password: mediawiki

*** Database Name: wikidb
*** DB Username: wikiuser
*** DB Password: mediawiki