2006-06-30

wget察看web server header

有时为了调试需要察看web server返回的header,可以在firefox下使用如live http header这样的工具。手边要是没有这样的工具,可以用wget的两个选项来实现:


-S
--server-response
Print the headers sent by HTTP servers and responses sent by FTP servers.


--spider
When invoked with this option, Wget will behave as a Web spider, which means that it will not download the pages, just check that they are there. For example, you can use Wget to check your book-marks:
wget --spider --force-html -i bookmarks.html


比如:
wget -S --spider http://www.uni-trier.de
另外可以用
wget -q -O - http://www.industrial-technology-and-witchcraft.de/index.php/ITW/itw-rss20/ | head -1
来得到xml文件的第一行声明:
< ?xml version="1.0" encoding="iso-8859-1"?>

2006-06-25

映射网络硬盘时的日志警告

在系统类别的日志中发现源自MRxSmb的标示号为3019的警告,查阅微软的文档发现这是从网络映射一个硬盘到本地时,NetBIOS试图通过TCP/IP检测网络硬盘的网络速度引起的。微软告诉大家,完全可以忽略这个警告。

解决标示号为1202的错误

发现日志里有很多源自SceCli的1202错误,查询微软的支持网页找到了下面的解决办法

0x4b8: An extended error has occurred.

The 0x4b8 error is generic and can be caused by a number of different problems. To troubleshoot these errors, follow these steps:
1.Enable debug logging for the Security Configuration client-side extension. To do this:
a. Start Registry Editor.
b. Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions\{827D319E-6EAC-11D2-A4EA-00C04F7 9F83A}
c. On the Edit menu, click Add Value, and then add the following registry value:
Value name: ExtensionDebugLevel
Data type: DWORD
Value data: 2
d. Quit Registry Editor.
2.Refresh the policy settings to reproduce the failure. To refresh the policy settings, type the following at the command prompt, and then press ENTER:
secedit /refreshpolicy machine_policy /enforce
This creates a file that is named Winlogon.log in the %SYSTEMROOT%\Security\Logs folder.
3.See the following Microsoft Knowledge Base articles. These articles describe known issues that cause the 0x4b8 error. Click the following article numbers to view the articles in the Microsoft Knowledge Base:
260715 (http://support.microsoft.com/kb/260715/EN-US/) Event ID 1000 and 1202 After Configuring Policies
278316 (http://support.microsoft.com/kb/278316/) ESENT Event IDs 1000, 1202, 412, and 454 Are Logged Repeatedly in the Application Event Log

Windows 下的tree命令

在Windows XP Pro下如果想列出某个目录下所有的子目录以及子目录包含的文件可以使用tree命令:
D:\>tree /?
Zeigt die Ordnerstruktur eines Laufwerks oder Pfads grafisch an.

TREE [Laufwerk:][Pfad] [/F] [/A]

  /F        Zeigt die Namen der Dateien in jedem Ordner an.
  /A        Verwendet den ASCII- statt des erweiterten Zeichensatzes.

可是发现尽管使用了/F选项,仍然不能显示以点号开始的文件,如.raidenftpd.acl这样的文件。不知道这是tree这个命令的一个bug,还是有其他的选项可以用。

2006-06-23

ACL的常见操作

Linux传统上只支持UGO(user,group,other)权限管理,但是Linux 2.6 内核版本开始支持ACL,即Access Control List,而在Solaris和Windows 2000/XP上ACL早就得到了支持。在维护StudIP和Ilias Server的时候都经常要用到ACL,下面总结一下如何在Linux下对ACL进行操作。

学习XSP 2


  • xsp:page — XSP 文档的根元素,它必须只包含一个用户元素

  • xsp:structure、xsp:include — 允许将附加的 Java 类导入到 XSP 的已编译版本中

  • xsp:logic — 允许在 XSP 的已编译版本中包含附加的编程代码块;这可以包含成员变量、方法或应用程序逻辑

  • xsp:expr — 允许对 Java 表达式求值,并将它们的值添加到文档

  • xsp:element — 允许 XSP 动态创建元素;这些元素可以用任意名称创建,并且可以与任何名称空间和前缀关联

  • xsp:attribute — 允许将属性动态地添加到元素;这些属性可以用任意名称和值创建,并且可以与任何名称空间关联

  • xsp:comment — 允许将注释添加到已生成的文档

  • xsp:pi — 允许动态创建处理指令,并将之添加到已生成的文档

  • xsp:parameter -- 允许为元素或属性生成名称


见识一下超级计算机

今天有两个朋友上我这儿来吃晚饭,其中一位在德国的马普所做博士,研究生物和力学的边沿性学科。他们经常要做大量的计算,这就离不开超级计算机。吃完饭让他远程登录位于慕尼黑Garcing的马普所的计算机中心的电脑上,看了一眼他们计算用的IBM的Power PC,见识了一下,下面是用llq命令查看的结果:


Name MaxJobCPU MaxProcCPU Free Max Description
d+hh:mm:ss d+hh:mm:ss Slots Slots
--------------- -------------- -------------- ----- ----- ---------------------
rp5_fatl undefined undefined 0 16 Power5, 8 PEs, 60 GB memory, 72h, reserved queue
rp5_fat undefined undefined 0 16 Power5, 8 PEs, 60 GB memory, 24h
dgrid_large undefined undefined 0 120 Power5, 8 PEs, 30 GB memory, 6h, DGRID
ipp undefined undefined 24 136 Power5, 8 PEs, 30 GB memory, 12h, reserved queue
lsingle undefined undefined 0 120 Power5, 1 PE, 2 GB memory, 6d, reserved queue
single undefined undefined 3 68 Power5, 1 PE, 16 GB memory, 12h
small undefined undefined 3 132 Power5, 4 PEs, 16 GB memory, 12h
rp5_long undefined undefined 30 136 Power5, 8 PEs, 30 GB memory, 6d, reserved queue
rp5 undefined undefined 30 136 Power5, 8 PEs, 30 GB memory, 24h
chubby undefined undefined 0 64 Power4, 32 PEs, 248 GB memory, 24h
p4_small undefined undefined 4 4 Power4, 4 PEs, 16 GB memory, 6h, DEISA
p4_short undefined undefined 8 8 Power4, 8 PEs, 30 GB memory, 1h, DEISA
p4_single undefined undefined 2 2 Power4, 1 PE, 16 GB memory, 6h, DEISA
mbp undefined undefined 0 128 Power4, 32 PEs, 60 GB memory, 72h, reserved queue
monster undefined undefined 0 864 Power4, 512 PEs, 960 GB memory, 18h
deci undefined undefined 0 864 Power4, 256 PEs, 480 GB memory, 60h, DECI
dino undefined undefined 0 864 Power4, 256 PEs, 480 GB memory, 18h
jumbo undefined undefined 0 864 Power4, 128 PEs, 240 GB memory, 18h
big undefined undefined 0 864 Power4, 64 PEs, 120 GB memory, 12h
lhuge undefined undefined 0 864 Power4, 32 PEs, 60 GB memory, 12h
huge undefined undefined 0 864 Power4, 32 PEs, 60 GB memory, 6h
short undefined undefined 16 1000 Power5, 8 PEs, 30 GB memory, 1h
deisa undefined undefined 0 0 DEISA pipe queue
test undefined undefined 0 866 restricted
dgrid_small undefined undefined 0 64 Power5, 4 PEs, 7 GB memory, 6h, DGRID
dgrid_single undefined undefined 1 1 Power5, 1 PE, 7 GB memory, 6h, DGRID
mp5_long undefined undefined 86 120 Power5, 8 PEs, 30 GB memory, 72h, reserved queue
mp5 undefined undefined 86 120 Power5, 8 PEs, 30 GB memory, 24h, reserved queue
fp5_big undefined undefined 23 416 Power5, 32 PEs, 120 GB memory, 72h, reserved queue
fp5 undefined undefined 23 416 Power5, 8 PEs, 30 GB memory, 24h, reserved queue
p5test undefined undefined 0 684 restricted
inter_class undefined undefined 0 1580 Interactive - 360 min. wall clock limit
--------------------------------------------------------------------------------
"Maximum Slots" values of the classes "deisa", "test", "p5test" are constrained by the MAX_STARTERS limit(s).
"Free Slots" values of the classes "rp5_fatl", "rp5_fat", "dgrid_large", "ipp", "lsingle", "single", "small", "rp5_long", "rp5", "chubby", "mbp", "monster", "deci", "dino", "jumbo", "big", "lhuge", "huge", "short", "deisa", "test", "dgrid_small", "mp5_long", "mp5", "fp5_big", "fp5", "p5test", "inter_class" are constrained by the MAX_STARTERS limit(s).

2006-06-22

germa128的问题

Vera的那台电脑germa128出毛病了,点很多程序都没有反应,使用右键菜单总是得到错误提示:
Der Zugriff auf das angegebenes Gerät, den Pfad oder die Datei wurde verweigert.
奇怪的是,可以毫无问题的打开Mirosoft的Office中的如Word,Excel等程序。
我怀疑是注册表遭到了破坏,于是用windows 2000 pro + sp4 光盘修复安装,问题没有得到解决。于是再用ghost恢复了一个做好的镜像过去,问题竟然没有解决。这就不好办了。难道这和硬件有关系,可是为什么又能打开Word,再说从错误提示来看也不应该和硬件有关。在MS的网页上仅仅查到2003年的一篇文章,可惜对germa128这台电脑的这种情况毫无帮助。事件日志也没有记录值得可查看的事件,只是在“安全”那个类别里有一项以前没见过的纪录,说安全监控成功。也许和这个有什么关系?

2006-06-21

在XSP中嵌入Javascript的例子

XSP支持多种语言,下面是在XSP页面中嵌入Javascript的例子。



1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <xsp:page language="javascript"
4 xmlns:xsp="http://apache.org/xsp"
5 xmlns:xsp-request="http://apache.org/xsp/request/2.0"
6 xmlns:xsp-session="http://apache.org/xsp/session/2.0"
7 >
8
9 <page>
10
11 <xsp:logic>
12 msg = "boo";
13 user = <xsp-request:get-parameter name="user"/>;
14 pwd = <xsp-request:get-parameter name="pass"/>;
15
16 if (user.equals("BigCorp") &amp;&amp; pwd.equals("secret")) {
17 msg = "User '" + user + "' has been authenticated" +
18 " - you can now proceed to the support page.";
19 <xsp-session:set-attribute name="user"><xsp:expr>user</xsp:expr></xsp-session:set-attribute>;
20 } else {
21 msg = "Login failed";
22 }
23
24 </xsp:logic>
25
26 <page-title>Login results</page-title>
27 <content>
28 <title>Login results</title>
29 <paragraph>
30 <xsp:expr>msg</xsp:expr>
31 </paragraph>
32 </content>
33 </page>
34
35 </xsp:page>

除此之外,还要在sitemap的相应的<map:generate>中添上
<map:parameter name="programming-language" value="js">
否则cocoon会使用默认的java编译器来处理XSP文件而引起错误。

2006-06-19

学习XSP 1

XSP (eXtensible Server Page )作为Cocoon的一个重要的组成部分可以为Cocoon的pipeline生成XML文件。XSP文件本身是XML文件,遵循XML的规范,但是支持在XML文件中包含程序代码。XSP借助Bean Scripting Framework支持多种语言,包括Java,Javascript,Python 等。

XSP文件的根元素为<page>,通常使用xsp名字空间(<xsp:page>)。
一个简单的例子如:

Cocoon URIs

To give you flexibility in where you place resources that you might need in Cocoon, Cocoon adds some URL schemes to the commonly available ones:

  • http://hostname:port/resource—This is a standard HTTP URL. A sample URL is http://localhost:8080/myxml.xml.

Serializers in Cocoon

Serializers transform a SAX event stream into binary or character streams for output. If a pipeline contains a generator, it should also contain a serializer. You can get full details on any serializer in the components appendix of the Cocoon user manual:

  • XML serializer—This Serializer serves as the basis for a number of the other serializers. It generates an XML document from the input SAX event stream. This serializer is in the class org.apache.cocoon.serialization.XMLSerializer under the name xml. You can provide a number of configuration parameters when you use the serializer from a <serialize> tag:

Transformers in Cocoon

Transformers are the components that get the job done. Without them, a pipeline could only generate some SAX events and serialize them back out. You’d get a little functionality, but not much. The standard Cocoon distribution includes a number of transformers; the following list gives you an overview of those that are built in. Some of these transformers are quite sophisticated, so we’ll provide a general description of how the transformers work. You’ll need to look at the components appendix of the Cocoon manual to learn about all the features of a particular transformer:

Generator in Cocoon

Cocoon 中事先定义了一系列的Generator,可以直接使用。这是一个简单的介绍,摘自Professional XML Development with Apache Tools: Xerces, Xalan, FOP, Cocoon, Axis, Xindice。

2006-06-18

configure Outlook 2003 to block additional attachment file name extensions

配置Outlook 2003 以阻止其他附件文件扩展名

1. Click Start, click Run, type regedit, and then click OK.
2. Locate and then click the following key in the registry:
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Security
3. On the Edit menu, point to New, and then click String Value.
4. Type Level1Add, and then press ENTER.
5. On the Edit menu, click Modify.
6. Type , and then click OK.

Notefile_name_extensions is a list of the attachment file name extensions. Each attachment file name extension is separated by a semicolon. For example, type .zip; .gif if you want to block both .zip and .gif files from appearing in the e-mail message as an attachment.

参考:http://support.microsoft.com/kb/837388

cocoon输出文件的编码设置

发现Cocoon输出html文件的默认编码设置为ISO-8859-1,这是在cocoon的配置文件cocoon/WEB-INF/web.xml中默认定义的。


<!--
Set encoding used by the container. If not set the ISO-8859-1 encoding
will be assumed.
Since the servlet specification requires that the ISO-8859-1 encoding
is used (by default), you should never change this value unless
you have a buggy servlet container.
-->
<init-param>
<param-name>container-encoding</param-name>
<param-value>ISO-8859-1</param-value>
</init-param>

要修改生成的HTML文件的默认编码,可以在Cocoon的sitemap文件里修改HTML的Serializer,修改后如下面例子所示:

<map:serializers default="html">
<map:serializer logger="sitemap.serializer.links" name="links" src="org.apache.cocoon.serialization.LinkSerializer"/>
<map:serializer logger="sitemap.serializer.xml" mime-type="text/xml" name="xml" src="org.apache.cocoon.serialization.XMLSerializer"/>
<map:serializer logger="sitemap.serializer.html" mime-type="text/html" name="html" pool-max="${html-serializer.pool-max}" src="org.apache.cocoon.serialization.HTMLSerializer">
<doctype-public>-//W3C//DTD HTML 4.01 Transitional//EN</doctype-public>
<doctype-system>http://www.w3.org/TR/html4/loose.dtd</doctype-system>
<encoding>UTF-8</encoding><!-- this encoding is added by Dingjun Jia -->
</map:serializer>

2006-06-17

cocoon连接MySQL数据库

今天下午花了不少时间才设置好cocoon与MySQL数据库的连接。要设置cocoon和MySQL可大致分为3步:



  1. 让cocoon能找到JDBC的 jar文件

  2. 让cocoon预先加载JDBC driver

  3. 设定连接池


我没有用cocoon自带的java web server,而是用的Tomcat 5.5.17。下载MySQL Connector/J 3.1.12后把mysql-connector-java-3.1.12-bin.jar文件先后复制到了多个目录:



  • $JAVA_HOME/jre/lib/ext

  • $CATALINA_HOME/common/lib

  • $CATALINA_HOME/webapps/cocoon/WEB-INF/lib


重新启动tomcat后日志仍然报告:
cocoon java.sql.SQLException: No suitable driver
意思是cocoon仍然找不到MySQL的MySQL Connector/J 3.1.12。
后来在$CATALINA_HOME/webapps/cocoon/WEB-INF/web.xml文件里第195行添上
com.mysql.jdbc.Driver
就能与MySQL进行连接了。


下面是设定一个连接池的例子:
在cocoon.xconf文件里加上:



<!-- added by Dingjun Jia, mysql connection pool in cocoon.conf -->
<jdbc name="abc" logger="core.datasources.abc">
<pool-controller min="5" max="10"/>
<!-- <auto-commit>false</auto-commit> -->
<!-- 此行若不注释掉,总会得到错误:
Not allowed to define mixed content in the element match at file:/opt/tomcat/webapps/cocoon/abc/sitemap.xmap:80:36 -->
<dburl>jdbc:mysql://localhost/abc</dburl>
<user>jia</user>
<password>password</password>
</jdbc>



P.S:

If we want to use non-latin characters in mySQL, Greek for example, we need to have a more specific connection string: jdbc:mysql://YourHostName:3360/YourDataBaseName?useUnicode=true&amp;characterEncoding=YourEncoding for example: (cocoon.xconf)


  <jdbc name="pool_name">
<pool-controller min="5" max="10"/>
<dburl>jdbc:mysql://YourHostName:3360/YourDataBaseName?useUnicode=true&amp;characterEncoding=ISO-8859-7</dburl>
<user>database_user</user>
<password>database_password</password>

</jdbc>

2006-06-16

Cocoon的sitemap引擎

Cocoon有两种不同的sitemap引擎,一种是编译(compiled)过的,另外一种是解释型(interpreted)的。两个都在Cocoon的配置文件$CATALINA_HOME/webapps/cocoon/cocoon.xconf里被定义,其中编译过的版本是cocoon默认的sitemap engine(check-reload和reload-method的值都为yes)。Cocoon监视sitemaps,当发现sitemaps发生变化时,Cocoon会重新加载配置文件。当Cocoon重新载入sitemap时,可以以同步或异步两种不同的方式来工作。

2006-06-15

windows下的同步工具robocopy

今天在浏览精品论坛的时候有个关于windows下同步文件夹的帖子引起了我的兴趣。我只知道在unix/linux下可以用rsync,还不知道windows下有个命令行工具robocopy也具有文件备份同步的功能。这个程序是Windows Server 2003 Resource Kit Tools中的一部分。网上说Windows XP Resource Kit Tools中也包含,可是我找来Win XP的光盘完整安装Windows Support Tools后却没有发现robocopy。于是从网上下载并安装了Windows Server 2003 Resource Kit Tools(12M)。这个小工具有很多选项可用,微软提供了一份36页的Word帮助文档。
Robocopy is a 32-bit command-line tool used for file replication. This tool helps maintain identical copies of a directory structure on a single computer or in separate network locations. Robocopy is included in the Microsoft® Windows® Resource Kit.

2006-06-14

Finanzamt的开放时间

今天上午去Finanzamt把2005年的报税单交了。虽然这已经是第五次去Finanzamt,可是对它的工作时间没放在心上。因为担心去早了还没开门(大学注册那个terminal得上午10点以后才能用,两次赶上去早了,印象深刻!),所以9点多才赶过去。一看工作时间竟然是从早上07:30开始。这可是政府部门工作时间中罕见的早啊。
周一 到周三:07:30 - 17:30
周四:07:30 - 18:00
周五:07:30 - 13:00
不过明年再报税已经全部改成网上报税了,到时候Finanzamt的工作人员不用这么早上班了。

2006-06-13

停止"磁盘空间不足"警告功能

停止"磁盘空间不足"警告功能

  当磁盘驱动器的容量少于 200MB 时,Windows XP 便会发出"磁盘空间不足"的通知。如需停止此功能,可按下步骤更改注册表。

  在“开始”菜单选择"运行",输入"Regedit",进入"HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion",在〔Policies〕下增加一个项"Explorer"(如果已有便不用增加),然后在"Explorer"增加一个 DWORD 值"NoLowDiskSpaceChecks",数值资料为〔1〕= 停止通知,值资料为〔0〕= 默认值启动通知。

拷贝DVD影片

早在VCD格式光盘流行的年代,电脑爱好者们就经常将光盘中Mpegav目录下的影音文件直接拷贝到硬盘上,然后再进行影片的播放,以此来减少光驱的耗损。虽然DVD影片光盘在制定标准时就考虑到要通过技术措施来防止拷贝,但DeCSS软件的出现使得其保护措施形同虚设,因此我们现在见到的绝大多数DVD影片光盘中的文件都是可以直接进行拷贝的。与此同时,电脑上DVD光驱的普及率越来越高,其数据读取速度已经高达16倍速(21MB/s),而硬盘的容量也越来越大,80GB已经成为了标准配置,这一切都为我们将DVD影片拷贝到硬盘上播放提供了很好的条件。

2006-06-03

Komodo 3.5.3终于修复code browser的一个bug

Komodo 3.5.2在Win XP Pro下有一个bug,表现为打开一个文件时,code browser功能不能使用,表现为程序一直显示Code scanning。Komodo 3.5.3终于修复这个bug。在2006年1月份就有人提交了Bug 43866报告了这个问题,可是等了这么久才出来。3.5.3什么时候发布的不知道,不过build的时间在5月份,“Built on Wed May 03 11:29:40 2006”。

1GB的免费存储空间

Gmail虽然提供了很大的存储空间,但是对邮件的附件大小却有所限制。今天在网上发现了一个站点Box.net能提供1GB的免费存储空间,并且还提供文件共享服务,即由用户来选择共享那些文件。注册试用以后感觉速度还不错。如果推荐了5个朋友注册还可以免费升级到5GB,想试用的朋友不妨点击这儿注册一个,帮助我免费升级。

2006-06-02

Update Wordpress to 2.0.3

这几天系里的web server总是不太正常,尽管MySQL正常运行,但是php/MySQL的页面总是不能正常打开。今天没有问题了,把Wordpress 升级到了2.0.3,据说是修正了一些安全漏洞。