Smarty 2.6.5 Released!

Posted on 21st September 2004 by Nio in 程序人生

由于手头事太多,所以最近对这些都关心得少了些,其实 Smarty 2.6.5 在 9.13 就已经发布了。
[13-September-2004] This release fixes object syntax parsing issues introduced in 2.6.4. If you are using 2.6.4, it is highly recommended to update. Also when template security is enabled, direct access to PHP constants is now disabled by default.
ChangeLog here. download it here.

加入了 Chinese Tea

Posted on 20th September 2004 by Nio in BLOG

一直对 Chinese Tea 比较感兴趣,那里有各式各样的文,很有意思。本来先前就想过加入其中,与大家一起写些东东,但后来觉得自己写得 BLOG 都过于偏技术,另外也怕自己没有太多时间去写,所以也就作罢。这个世界上的事情就是这样鬼使神差,越控制自己不为之的事情,内心却越有冲动去为之,今天还是在那里注册了个帐号,没想到的是才相隔没几个小时,Christina 就已经让我的帐号通过了,在这里感谢这位 PPMM,让我成为了 Chinese Tea 的一员。

PHP :: 获取计算机 IP 地址及网卡 MAC 地址

Posted on 16th September 2004 by Nio in 程序人生

用 PHP 写了个函数,在 Linux 下使用命令行运行方式,获取当前计算机的 IP 地址及网卡 MAC 地址。

<?php
//    filename: get_eth.php
function get_network_interface()
{
    $ips = array();
    $info = `/sbin/ifconfig -a`;
    $infos = explode("\n\n", $info);
    foreach ($infos as $info) {
        $info = trim($info);
        if (substr($info, 0, 3) == 'eth') {
            $lines = explode("\n", $info);
            $interface = substr($lines[0], 0, strpos($lines[0], ' '));
            $mac = substr($lines[0], strlen($lines[0])-19);
            preg_match('/addr:([0-9\.]+)/i', $lines[1], $matches);
            $ip = $matches[1];
            $ips[$interface] = array('ip' => $ip, 'mac' => $mac);
        }   //end if
    }   //end foreach
    return $ips;
}   //end function
$interfaces = get_network_interface();
print_r($interfaces);
?>

运行输出结果如下:

$ php get_eth.php
Array
(
    [eth0] => Array
        (
            [ip] => 192.168.212.68
            [mac] => 00:0C:29:F7:3D:38
        )

)

UPDATE 4:50 pm: 加入了 Windows 下的兼容性代码,修改之后的函数为:

(more…)

XMLRPC :: Java/JSP 实现的应用

Posted on 15th September 2004 by Nio in 程序人生

应客户要求,为其编写 JSP 调用 XMLRPC 方法的示例代码,从中也收获不小,具体过程记录如下。

下载安装 XMLRPC 的 Java 实现类

我用的是 Apache 提供的 XMLRPC Web Service 实现,包含了服务器端及客户端的实现,在这里我只对客户端进行操作。下载之后将其解压缩,然后使用 ant 进行 build,生产 xmlrpc.jar 文件:

$ tar xzf xmlrpc-1.2-b1-src.tar.gz
$ cd xmlrpc-1.2-b1
$ ant -Dsrc.dir=./src -Dbuild.dest=./dest -Dbuild.dir=./ -Dfinal.name=xmlrpc

在 Apache Tomcat 发布目录下创建 xmlrpc、xmlrpc/WEB-INF 及 xmlrpc/WEB-INF/lib 目录,然后将 xmlrpc.jar 文件放入 xmlrpc/WEB-INF/lib 目录下,这样在 xmlrpc 目录下的 jsp 文件就可以使用 jar 包中的类了,目录结构如下:

ROOT  
  |-- xmlrpc/
  |    +-- test.jsp
  |    +-- WEB-INF/
  |         |-- web.xml
  |         +-- lib/
  |              +-- xmlrpc.jar
  +-- ....

结构中的 test.jsp 即是用来实现 XMLRPC 客户端调用的 JSP 文件。

(more…)

诸事不顺,哎哟!!!

Posted on 15th September 2004 by shxll in 日常生活

这两天阴阴的,还下雨,本来就让人心情很闷,正好配合了我这两天的状态,那就是诸事不顺,郁闷啊!!

首先就是昨天,莫名其妙的戴了两年的手表,带子竟然断了,而且是从中间生生的断开的,难道说突然之间我的胳膊蹭蹭的长了几公分?真是见了鬼了。。。

今天给同事下载她一直想看的红粉世家,后来想挪到其他目录下面去,结果有一个文件总说正在占用,发现已经挪过去了,只留个目录在那,怎么删都删不掉,想想就算了。后来鬼使神差的又去删,竟然发现删掉了,正高兴了,一看把刚刚下载的删掉了。。。555555,还是按着shift+del删的。。。完蛋。。。郁闷之下,又见鬼了,我辛辛苦苦下的电视剧竟然都在刚刚那一下中被删掉了。。。无语啊。。。看来该去拜拜黄大仙了。。。。