Archive for April, 2002

泛系、自由与“一、百、万”工程

由 洪峰 发表于 2002年04月26日 12:33。

徐永久注:洪峰先生是我国自由软件界的先锋人物,今年开始独立发行 Free Software 杂志。本文以回忆录的形式,叙述了他自己从大学毕业以来,走向事业成功所经历的酸甜苦辣。本文是征得他同意后,发表在本网站的。
(more…)

Post to Twitter

Linux 系统的优化和微调

由 徐永久 发表于 2002年04月19日 12:31。

针对系统的优化工作需要根据不同的系统采用不同的办法。本文旨在描述通用的优化 Linux 的一些办法。
一、编译选项

当我们采用 -O9 来编译程序时,或许文件字节数是最大的,但是往往其运行速度也是最快的。
根据不同的机器架构,你可以把下面的语句加入 /etc/profile 。

i686:
(more…)

Post to Twitter

SOAP Google API for PHP 发布

由 徐永久 发表于 2002年04月17日 15:08。

SOAP_Google 类让 PHP 开发者和 Google 的WebService 交互,并利用 Google 巨大的搜索数据库技术。

SOAP_Google.php

//
// +———————————————————————-+
// | PHP Interface to the Google API |
// +———————————————————————-+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +———————————————————————-+
// | Author: Sebastian Bergmann |
// +———————————————————————-+
//

require_once ‘SOAP/Client.php’;

/**
* PHP Interface to the Google API
*
* @author Sebastian Bergmann
* @access public
*/
class SOAP_Google {
/**
* @var string
* @access private
*/
var $_licenseKey = ”;

/**
* @var object
* @access private
*/
var $_soapClient = NULL;

/**
* Constructor.
*
* @param string
* @access public
*/
function SOAP_Google($licenseKey) {
$this->_licenseKey = $licenseKey;

$this->_soapClient = new SOAP_Client(
‘http://api.google.com/search/beta2′
);
}

/**
* Retrieves a page by URL from the Google Cache.
*
* @param string
* @return mixed
* @access public
*/
function getCachedPage($url) {
$result = $this->_performAPICall(
‘doGetCachedPage’,

array(
‘key’ => $this->_licenseKey,
‘url’ => $url
)
);

if ($result) {
$result = base64_decode($result);
}

return $result;
}

/**
* Retrieves a spelling suggestion for a phrase.
*
* @param string
* @return mixed
* @access public
*/
function getSpellingSuggestion($phrase) {
return $this->_performAPICall(
‘doSpellingSuggestion’,

array(
‘key’ => $this->_licenseKey,
‘phrase’ => $phrase
)
);
}

/**
* Performs a web search.
*
* @param array
* @return mixed
* @access public
*/
function search($parameters = array()) {
if (!isset($parameters['query'])) {
return false;
}

return $this->_performAPICall(
‘doGoogleSearch’,

array(
‘key’ => $this->_licenseKey,
‘q’ => $parameters['query'],
‘start’ => isset($parameters['start']) ? $parameters['start'] : 0,
‘maxResults’ => isset($parameters['maxResults']) ? $parameters['maxResults'] : 10,
‘filter’ => isset($parameters['filter']) ? $parameters['filter'] : false,
‘restrict’ => isset($parameters['restrict']) ? $parameters['restrict'] : ”,
‘safeSearch’ => isset($parameters['safeSearch']) ? $parameters['safeSearch'] : false,
‘lr’ => isset($parameters['lr']) ? $parameters['lr'] : ”,
‘ie’ => isset($parameters['ie']) ? $parameters['ie'] : ”,
‘oe’ => isset($parameters['oe']) ? $parameters['oe'] : ”
)
);
}

/**
* @param string
* @param array
* @return mixed
* @access private
*/
function _performAPICall($apiCall, $parameters) {
$result = $this->_soapClient->call(
$apiCall,
$parameters,
‘urn:GoogleSearch’
);

if (!PEAR::isError($result)) {
return $result;
} else {
return false;
}
}
}
?>

程序示范:

require_once ‘SOAP_Google.php’;

$google = new SOAP_Google(‘your license key’);

$result = $google->search(
array(
‘query’ => ‘sebastian bergmann’
)
);

if (false !== $result) {
print_r($result);
} else {
echo ‘Query failed.’;
}
?>

Post to Twitter

PHP 和 MySQL 开发的 8 个技巧

由 徐永久 发表于 2002年04月12日 12:53。

LAMP 架构的网站,我以前注重的多是安装/配置方面的,讲述开发的相对较少,因为自己从事开发也少。本文的原文当然也来自:

Published on The O’Reilly Network (http://www.oreillynet.com/)

http://www.oreillynet.com/pub/a/onlamp/2002/04/04/webdb.html

(more…)

Post to Twitter

Apache 2.0.35 和最新版本的 PHP 4.3-Dev 的集成

由 徐永久 发表于 2002年04月10日 14:05。

当 Apache 2.0.35 以正式版本发布时,发现网络上很少有提起能成功集成 Apache 2 和 PHP 4 的。就连著名的 PhpBuilder.com 上的论坛里也充满了消极的讨论。我是属于那种不敢气馁的家伙,昨天晚上工作到 2:00 AM 没有成果后,今天继续苦战,从晚上 9:00 到 0:00 基本有了眉目,但是由于 FreeLAMP.com 采用了 Zope+Fast_CGI 的组合和 Apache 集成,而 Fast_CGI 的 Apache 2 版本还在开发中,所以目前本网站运行的版本依然为 1.3.24。

(more…)

Post to Twitter

为 MyDowns 的图书所作的序

由 徐永久 发表于 2002年04月09日 11:13。

认识 MyDowns.com 的站长何国忠先生还是 2000 年我在奥索网作系统维护的时候,那个时候的奥索网撑起开放源码的大旗,美其名曰:“Open Source Online”,抓住了火爆的 PHP 流行热潮,免费提供 PHP+MySQL 的个人主页空间,并提供类似 yourname.oso.com.cn 的三级域名的解析。那个时候何国忠先生就是注册在奥索网上的用户 MyDowns,后来成为奥索网积分第三名的用户,下面他的帖子或许能说明一些他当时的心情:

(more…)

Post to Twitter

JVM 性能调整的一些基本概念

本文是我在工作中调整 Solaris 8 上的 WebLogic 6.0SP2 中遇到诸多问题后,查阅相关资料而产生的一些概念,罗列出来,或许对您有所帮助。这并不代表,笔者推荐您使用 WebLogic 和 Solaris 的组合,相反,笔者欢迎相关 Tomcat 性能调整方面的心得。笔者在 Sun Tech Day 上和 Bea 公司的相关人员讨论后,认为 Bea 对 Open Source 和 Free Software 缺乏必要的远见。

另外,其中一些术语的翻译,是我自己的”创作“,我不知道别人是怎样翻译的。如果有不当的地方,希望指正。
(more…)

Post to Twitter