Solaris查找文本内容

没有评论 2010年4月13日

查找包含hello内容的文件,递归子目录:

$ find . xargs | grep "hello"

查找包含hello内容的文件,当前目录:

$ grep "hello" /directory/*

Windows 7 远程桌面

没有评论 2010年3月29日

修改远程桌面端口

修改 Windows 远程桌面端口,需要修改注册表中以下两项的 PortNumber 值:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp
HKEY_LOCAL_MACHINE\SYSTEM\CurrentContro1Set\Control\Tenninal Server\WinStations\RDP-Tcp

多用户登陆破解

在 Windows 7 中,远程登录默认只支持一个用户登陆。如果在登录时发现当前电脑已经有其他用户使用,会弹出提示,继续后会中断当前用户的操作。打开类似 Windows Server 的多用户登陆支持,需要修改 Windows\System32\ 的 termsrv.dll 文件。通过十六进制编辑器执行如下替换操作:

x86 版本:

替换 3B86200300000F84574B01
为 B800010000908986200300

替换 85E0FEFFFF43
为 85E0FEFFFF90

替换 7C34397DF874
为 7C34397DF8EB

x64 版本:

替换 8B873806000039873C0600000F849ACE0000
为 B80001000090898738060000909090909090

替换 488D4C2460BB01
为 488D4C2460BB00

替换 1F837C24500074
为 1F837C245000EB

或直接下载附件:Concurrent_RDP_Win7

远程登陆 console 界面

在 Windows Server 中,用户已经本地登陆之后再在远程登录,远程会话和本地会话会出现不一致的情况。这时,通过在远程访问地址后面加 /admin 参数,登录到本地的 console 会话。另外,也可以直接运行命令行 mstsc /admin。当然,在 Windows 任务管理器中,直接选择想到登陆的会话,然后右键菜单选择“连接”也可以。

Apache禁止列目录

没有评论 2010年3月23日

修改 httpd.conf 配置文件:
查找 Options Indexes FollowSymLinks,修改为 Options -Indexes。

或者,www 目录下的修改 .htaccess 配置文件:
加入 Options -Indexes

解决WordPress的Warning: Cannot modify header information

没有评论 2010年2月10日

在从自己的 Windows 服务器迁移到远程的 Linux 服务器过程中,出现 "Warning: Cannot modify header information – headers already sent by (***)" 错误。

这很可能是由于在 Windows 下用记事本修改过 wp-config.php 文件,导致该文件出现 BOM 字符,而 PHP 无法识别。

解决方法:将 wp-config.php 文件用记事本打开,另存为 ANSI 编码格式,重新上传覆盖,搞定。

飞信用户已停机

没有评论 2010年2月6日

刚刚登陆飞信,提示“用户已停机”,网上充值重开机之后,仍提示停机无法登陆。打10086,得到“您再等等”的扯蛋答复。

解决方法:点飞信上的“设置密码”,发送验证码,重置密码,重新登录,恢复正常。

再见了,Sun

没有评论 2010年1月28日

Subject: Thanks for a great 28 years
Date: Tue, 26 Jan 2010
From: Scott McNealy
To: [all Sun employees]

Gang,

When I interviewed many of you for employment at Sun over the years, one commitment often made was that things will change above, below, and around you faster than any place you have ever been. Looks like this was one area we exceeded plan for 28 years. While it was never the primary vision to be acquired by Oracle, it was always an interesting option. And this huge event is upon us now. Let's all embrace it with all of the enthusiasm and class and talent that we have to offer.

This combination has the potential to put Sun, its people, and its technology at the center of yet another industry and game-changing inflection point. The opportunity is well-documented and articulated by Larry and the Oracle folks. Not much I can add on this score. This is a very powerful merger. And way better than some of the alternatives we were facing.

So what do I say to all of you, now this is happening?

It turns out that one simple message to the large and diverse Sun community is actually quite hard to craft. Even for a big mouth who is always ready with a clever quip. The community includes our resellers and customers, our current and former employees, their friends and families who supported our employees on their mission to change the industry, our investors, our supply and service partners, students and educators, and even our competitors with whom we often collaborated.

But let me try. Though nothing I could write comes close to matching the unbelievably strong and positive emotions I have for you all. See, I never was able to master dispassion. I truly loved starting, running, and living Sun. And the last four years have not been without serious withdrawal. And the EU approval rocked me more than it should have.

So, to be honest, this is not a note this founder wants to write. Sun, in my mind, should have been the great and surviving consolidator. But I love the market economy and capitalism more than I love my company.

And I sure "hope" America regains its love affair with capitalism. And except for the auto industry, financial industry, health care, and some other places (I digress), the invisible hand is doing its thing quite efficiently. So I am more than willing to accept this outcome.

And my hat is off to one of the greatest capitalists I have ever met, Larry Ellison. He will do well with the assets that Sun brings to Oracle.

What we did right and wrong at Sun over the years might make for interesting reading. However, I am not a book writer. I am a husband, father of four, and a builder and leader of people who want to make a difference.

But spare me a bit of nostalgia. Not of the mistakes we made, and lord knows I made a ton. But of the things we did right and well.

First and foremost, Sun innovated like crazy. We took it to the limit (see Eagles). And though we did not monetize our inventions as well as we could have, few companies have the track record in R&D that we had over the last 28 years. This made working at Sun really cool. Thanks to all of you inventors and risk takers who changed how we live.

Sun cared about its customers. Even more than we cared about our own company at times. We looked at our customer's mission as more important than ours. Maybe we should have asked for more revenue in return, but our employees were always ready to help first. I love this about Sun, which I guess makes me a good capitalist, if not a great capitalist.

Sun did not cheat, lie, or break the rule of law or decency. While we enjoyed breaking the rules of conventional wisdom and archaic business practice, and for sure loved to win in the market, we did so with a solid reputation for integrity. Nearly three decades of competing without a notable incident of our folks going off course morally or legally. Not all executives and big companies are bad. Really. There are good companies out there. Special thanks to all of my employees for this. I never had to hide the newspaper in shame from my children.

Sun was a financial success. We paid billions in taxes, salaries, purchases, leases, training, and even lawyers and accountants for devastatingly cumbersome SOX and legal compliance (oops, more classic digression). Long-term and smart investors made billions in SUNW. And our customers generated revenue and savings using our equipment in countless ways. Many employees started families, bought homes, and put them through school while working at Sun. Our revenues over 28 years exceeded $200B. Few companies make it to the F200. We did. Nice.

Sun employees had way more fun than any other company. By far. From our dress code ("You must!") to beer busts to our April Fools' pranks to SunRise to our quiet enjoyment at night of a long, hard, well-done day of work, no company enjoyed "work" more than Sun. Thanks to all of our employees past and present for making Sun such a blast.

I could go on for a long time reminiscing about the good and great stuff we did at Sun, but just allow me one last one. We shared. Not the greatest attribute for a capitalist. But one I could not change and was not willing to change about Sun while I was in charge. We shared in the success of Sun with our resellers. With our employees through stock options, SunShare, beer busts, and the like (for as long as Congress would allow) and through our efforts to keep as many of them on board for as long as possible during the inevitable down cycles. With our partners through the Java Community Process, through our open-source collaborations, and licensing strategies. With our customers through our commitments to low barriers to exit. Sun was never just about us. It was about we. And that may be a bit of the reason we are where we are today.

But I have few regrets (see Sinatra's "My Way") and will always look back at Sun and its gang with only pride. Enormous pride. You are the best this industry ever had, though few outside of Sun recognized it.

And what we are about will live on in Sparc, Solaris, Java, our products, and our spirit. Well past everyone's recollections of what we did together. I will never forget, though.

Oracle is getting a crown jewel of the technology industry. They will do great things with Sun. Do your best to support them, and keep the Sun spirit alive and well in the industry. Our children will be better for it.

Thanks for the off-the-charts support to everyone who ever carried a Sun badge, used our products, or helped our company through the years.

And thanks to my wonderful wife, Susan, who gave this desperado (see Eagles) a chance to choose the Queen of Hearts before it was too late.

Someday, hopefully, you will all get to see or meet her and my other life's works named Maverick, Dakota, Colt, and Scout. If you do, perhaps you will understand why I stepped back from the CEO role four years ago. And why I feel like the luckiest guy in the whole world.

My best to all of you, and remember:

Kick butt and have fun!

Scott

神雕侠侣

没有评论 2010年1月23日

Leonard Bosack和他的前妻Sandra Lerner一起,是Cisco Systems公司的创建者。

1969年,Bosack毕业于宾夕法尼亚州的一所名叫La Salle的高中,同年进入宾州大学,并且在1973年获得学士学位。毕业后,他进入了Digital Equipment Corporation (DEC)公司并参与一个和36bit系统有关的项目。1979年,Bosack离开DEC公司进入斯坦福大学并于之后的1981年获得计算机科学专业硕士学位。在那里,他遇到了他的同学Sandra Lerner并于1980年与之结婚。

Cisco Systems公司的创建者 Leonard Bosack和他当时的妻子, Sandra Lerner,被认为是为完善有史以来第一台路由器的设计做出了主要的贡献,正是路由器使得构建internet成为了可能。不过,发明第一台路由器的殊荣并不属于这对夫妇,它属于一个叫William Yeager的人,他是当时斯坦福医学中心的工程师。正是此人写出了一个名叫Internetwork Operating System (IOS)的软件来控制一种专用的计算机使之可以实现路由的功能。Bosack和他的小组接手了这个软件的源代码并完善了其中的设计思路,最终利用它造出了成功商用的路由器。

设计有史以来第一台路由器的诱因源于当时的Bosack管理着斯坦福大学计算机科学系的电脑,而他的妻子Lerner管理着远在校园另一头的商业研究所的电脑。他们之间可以利用校园局域网(campus LAN)收发Email,但他们的电脑由于分别使用不同的操作系统因而不能直接连通。于是,两人在自己的电脑上使用了一块由后来的SUN Microsystems的创始人Andy Bechtolsheim设计的网卡并使用了经过升级的IMP操作系统,在大楼之间架设网线并且使电脑之间直接相连。

在架网的过程中,Bosack和Lerner的团队不断地改进整个系统的连通性以使得它可以连接不同的网络、不同的计算机操作系统和不同的协议。很快,消息不胫而走,很多其他大学的机构开始向他们索要这种全新的改进的系统,当时,这台机器被称为“multiprotocol router”。

Bosack和Lerner夫妇意识到了这台新机器背后可能蕴藏的巨大商机,他们开始向斯坦福大学申请将这台机器以及相关技术投入正式的商业销售。由于斯坦福大学是非赢利性机构,它不能够进入一个商业投机领域,因此它理所当然地拒绝了这个要求并禁止这个小组出售这个技术。

关于这个故事还有许多有趣的有争议版本,包括斯坦福大学自己。它在之后宣布Bosack和其他人篡夺了原本属于自己的路由器设计理念并非法地投入商用。在提出诉讼之余,斯坦福大学于1987年的4月就路由器软件的license和两块电脑主板向Cisco公司收取了19300美元的现金和150000美元的版税,并且还能享有在Bosack夫妇离开之后使用Cisco公司产品的折扣,服务,以及产品的完善升级之类的特权。

1984年,Bosack和Lerner夫妇正式组建了Cisco Systems公司并且开始在他们家的客厅制造路由器。Cisco这个名字取自美国城市San Francisco,其公司Logo也来自那个著名的金门大桥。1986年,Bosack正式从斯坦福辞职。同年,Bosack和Lerner得到了Sequoia Capital公司二百五十万美金的风投,这是他们俩经历了77次在其他风投公司申请失败之后才得到的。

从1984年到1992年,Cisco以平均每年200%的速度增长,而这些增长是在几乎没有做任何广告的条件下取得的。1990年8月28日,公司的管理层解雇了Lerner。在得知这个消息后,Bosack立刻主动辞职以示对妻子的支持。他们俩也立即卖掉了属于自己的Cisco股票并获利一亿七千万美金。第二年,Bosack在华盛顿Redmond创建了自己的公司名叫XKL (http://www.xkl.com/),他在那里工作至今。

- Hshen2007 选译自维基百科公开发表文章:http://en.wikipedia.org/wiki/Len_Bosack

Tomcat 无法启动

没有评论 2010年1月20日

Windows 环境中 Tomcat 无法正常启动。查看日志文件,报错:Failed creating java e:\jdk1.6\jre\bin\server\jvm.dll

解决方法:复制 jdk\bin\msvcr71.dll 到 tomcat 安装目录下的 bin 目录。

Solaris 网络监控

没有评论 2010年1月13日

刚在外面有人问 Solaris 网络监控,一时有点犯懵,在回家的路上想起来了 snoop 和 netstat 命令。一个是用来抓包的,一个是用来查看连接状况的。其实当时也想到了 netstat,就是只在 Windows 上用过。另外在 Solaris/Linux 上可以借助 chaosreader 分析网络数据包日志。

IIS FastCGI PHP 环境下搭建 WordPress

没有评论 2010年1月12日

2009年年底最郁闷的事情除了离开 Sun 以外莫过于自己的博客站点被无故关停。服务商给的解释是 CPU 和流量超负荷。这个理由非常搞笑,因为我的站点上只放了一个 WordPress 博客程序。如果我的博客 CPU 和流量能达到超负荷的级别,那这个站点绝对 PR >=4 了。

几经波折,从服务商那边要回了站点文件和数据库备份脚本。新申请了 DreamHost,但是至今状态还在 pending。正值前段时间在家里部署了一台 Windows Server 2008,遂尝试在自己的服务器上恢复博客应用。

Windows Server 2008 (SP2) + IIS 7

添加 Web 服务器角色,需要安装 CGI 扩展支持。

FastCGI + PHP (5.2.12) + MySQL (5.1) + Zend (3.3)

先从 php.net 官网下载Windows 版本安装程序,这里使用的版本是 5.2.12。本人 5.2 和 5.3 版本均做过尝试,发现 5.3 非常不稳定,会出现程序卡住的现象,建议还是 5.2 版本。另外压缩版本的配置文件也不太好用,调整的地方过多,建议使用 MSI 版本。安装的时候在向导中选择 IIS FastCGI,扩展 ext 不要乱选,有些组件还需要下载其他文件支持,容易出现缺少文件的问题。

安装后,打开 PHP.ini 配置如下选项,注意把前面的;注释去掉:

fastcgi.impersonate = 1
cgi.fix_pathinfo = 1
cgi.force_redirect = 0
open_basedir = Web 根目录
date.timezone ="Asia/Shanghai"
short_open_tag = On

其中后两个配置选项是在部署 WordPress 碰到问题时需要添加的。

“开始” - “运行” - 进入 PHP 安装目录,运行:php -info,正常情况下会输出各种参数变量。

打开 IIS 管理器,找到“处理程序映射”,右侧面板中选择“添加模块映射”,路径 *.php,模块 FastCgiModule,可执行文件 php-cgi.exe 所在路径,名称可以写为 PHP_via_FastCGI。弹出提示选择“是”。PHP 支持添加完成。

注意,wwwroot 文件权限需要设定好,否则应用将无法正常上传或修改文件。

MySQL 和 Zend 的安装比较轻松,根据向导一路 Next 即可。

MySQL 数据库中涉及到 WordPress 域名变换的问题,可以使用 mysqldump 先导出 SQL,文本替换旧域名,然后 mysqlimport 导入。

Serv-U (9.2) PASV 设定

IIS 的 FTP 服务器比较简单,Serv-U 更为强大,而且支持 FTPS 和 SFTP。在 Serv-U 搭建中一个比较常见的问题是“被动模式”端口因为防火墙而无法正常访问。这将导致 WordPress 不能自动更新和自动安装插件。建议在设置中设定 PASV 端口范围,并添加防火墙例外。

其他尚待解决的问题
WordPress Flash 上传图片组件运行不正常。
WordPress XML-RPC 不正常,无法使用 Windows Live Writer。