[wordpress]update to 2.1

昨天wordpress进行的版本升级,今天将自己、herbert和实施部的wordpress都进行了升级。升级的程序做的不错,很简单。
将原来的改个目录,解开新的2.1版本的tar.gz包,将wp-config.php拷贝过去,将plugins和themes里面的新添加的目录拷贝过去;然后运行wp-admin/upgrade.php,点击升级即可。
目前位置,现有的themes和插件看起来运行都是正常的。

[Perl] LWP模块功能

一 LWP::Simple 功能

1. 如何在Perl中使用该模块?

use LWP::Simple;

2. 如何获取一个页面内容?

my $content = get(‘http://www.yahoo.com.cn’);

get函数把从www.yahoo.com.cn上获取得页面内容全部赋给$content这个变量,如果获取失败将返回一个undef的值。

3. 如何获取头(Header)?

my (b, d, $e) = header(‘http://www.yahoo.com.cn’);

如果获取成功header函数将返回五个变量,$a-e分别代表内容类型,文档长度,最后更新的时间,过期和服务器名称。

4. 如何输出指定页面内容?

my $code = getprint(‘http://www.yahoo.com.cn’);

getprint将试图打印www.yahoo.com.cn的内容,然后返回一个状态号,比如成功将返回200,文件没有找到将返回404。

5. 如何把获取的内容保存到一个文件中?

my $code = getstore(‘http://www.yahoo.com.cn’, ‘/path/file.html’);

getstore将试图把获取的内容保存到第二个参数指定的文件中,返回一个状态号,状态号的形式如上。

6. 如何同步远程和本地文件?

my $code = mirror(‘http://www.yahoo.com.cn’,’/path/file.html’);

mirror函数将比较远程和本地文件的一致性,然后返回一个状态号,比如文件相同将返回304,如果本地文件同步成功将返回200。

7. 如何测试返回状态的正确性?

is_success($code)
is_error($code)

is_success和is_error这两个函数可以传递一个状态号为参数,程序会判断返回的是否为成功状态。比如is_success(403)将返回假。

二 LWP::UserAgent 功能
1、取得页面头信息

#!/usr/bin/perluse strict;
use warnings;
use LWP::UserAgent;my $ua = LWP::UserAgent->new;
$ua->agent(‘spider name’);
my $res = $ua->head(‘http://www.yahoo.com.cn’);
foreach ($res->header_field_names) { print “$_: “, $res->header($_), “\n”;}

2、获取指定页面

my $ua = LWP::UserAgent->new;
$ua->agent(‘spider name’);
my $response = $ua->get(‘http://www.yahoo.com.cn’);

3、POST方式提交数据

use strict;
  use warnings;
  use LWP 5.64;
  my $browser = LWP::UserAgent->new;  my $word = ‘tarragon’;  my $url = ‘http://www.altavista.com/sites/search/web’;
  my $response = $browser->post( $url,
    [ ‘q’ => $word,  # the Altavista query string
      ‘pg’ => ‘q’, ‘avkw’ => ‘tgz’, ‘kl’ => ‘XX’,
    ]
  );
  die “$url error: “, $response->status_line
   unless $response->is_success;
  die “Weird content type at $url — “, $response->content_type
   unless $response->content_type eq ‘text/html’;

4、通过get方式提交数据

use URI;
  my $url = URI->new( ‘http://us.imdb.com/Tsearch’ );
    # makes an object representing the URL  $url->query_form(  # And here the form data pairs:
    ‘title’    => ‘Blade Runner’,
    ‘restrict’ => ‘Movies and TV’,
  );  my $response = $browser->get($url);

三、HTTPS的支持
需要安装Crypt::SSLeay协议,以便支持加密传输。
命令行PPM下的安装:
ppm> install http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd
图形化下面的安装:
点击Edit->Preferences, Add Repository,添加http://theoryx5.uwinnipeg.ca/ppms/作为安装源。再选择Crypt-SSLeay即可。
测试代码:

use strict;
use warnings;
use LWP::UserAgent;my $url = ‘https://www.helsinki.fi/’;my $ua = LWP::UserAgent->new;
my $response = $ua->get( $url );$response->is_success or
    die “Failed to GET ‘$url’: “, $response->status_line;
print $response->as_string;

更多的信息可以见官方的文档,点击此处

网络的问题,好像又修好了一根吧

刚刚ping我的北美主机服务提供商,虽然有些不连续,但ping值已经在300以内了,昨天还在800多的,看样子距离完全恢复越来越近了,不知道是否能接着修的时候把速度再提高一下:-)。
2007年1月8日北京时间9:30:
Ping statistics for 64.191.xx.xxx:
    Packets: Sent = 20, Received = 18, Lost = 2 (10% loss),
Approximate round trip times in milli-seconds:
    Minimum = 263ms, Maximum = 270ms, Average = 264ms

安装dokeos1.8bata2

此前就安装过dokeos的1.6版本,相对而言,其国际化做的还是不错的,不过1.6版本的菜单部分还是会出现中文乱码,按理说使用了UTF-8的,不应该会出现这类的问题,不过页面的显示编码并不完全是UTF8,估计也可能是这个原因。
今天安装了1.8bata2,这个版本已经很好的解决了中文菜单显示乱码,建议尝试者都升级上来吧。另外,根据dokeos的roadmap,在1月会推出1.8的正式版本,正在运行的用户还是稍微等一下正式的版本吧。

背景:Dokeos 是数字化学习和课程管理网络应用程序,是Claroline的一个分支.其设计的习惯比较适合国人。可以用34种语言使用,帮助机构管理学习和协作活动。