现在位置: 首页 > 所有 2007年12月 文章
Perl — Getopt::Std
Getopt::Std模块的使用:
初始设置:
在程序中加入如下代码:
3
4
5
use Getopt::Std;
use vars qw($opt_d $opt_f $opt_p);
...
Perl — use vars
vars 是一个Perl的pragma,用来预定义全局变量。这些预定义后的全局变量qw()列表中的在整个Perl文件中皆可使用,使用了use strict也不会报警:
use strict;
$string = "Hello,Perl";
print $string...
Perl — Pragma in Perl
Pragma in Perl
In a,hopefully futile, effort to confuse programmers, the use directive, was given a second job to do. It turns other compiler directives on and off. For example, you might want to force Perl to use integer math instead of floati...
HTTP Header about on LoadBalance and Reverse Proxy environment
http://atman.memoab.com/articles/92
收藏、分享这篇文章!
...IE的域名不支持_
I use name-based virtual hosting on Linux with Apache and PHP 4.3.2.
Every time when I refreshed (by pressing F5 in Internet Explorer) I noticed that I got a new session_id. Simultaneously browsing the same site with Netscape didn't give me that...
Perl注意事项
1、Perl参数:$ARGV
$ARGV[0]....$ARGV[n]
$ARG[0]是第一个参数,不是脚本文件名,和C不一样。参数个数:$ARGV+1
2.while....continue
continue作为while或者foreach的一个尾巴,常常附在这些的末...
sendmail tips
您遇過這樣的狀況嗎:
無法寄信
在.bsdlab.idv.tw網域中使用Win95/98之Outlook Express透過mail.lab.mlc.edu.tw主機寄信給kemin.lin@msa.hinet.net時,發生錯誤:
無法傳送郵件,因為有一位收件...
FR-o /etc/mail/relay-domains
- 以網域名稱方式指定:
dnes.mlc.edu.tw - 以主機名稱方式指定:
pc123.dnes.mlc.edu.tw - 以IP位址或區段方式:
163.19.224.65
192.168.1.
/etc/mail/relay-domains 這個檔案的內容建議僅設定自己的網域名稱就好。
- access的權限設定有下列幾種:
- OK
Accept mail even if other rules in the running ruleset would reject it, for example, if the domain name is unresolvable. - RELAY
Accept mail addressed to the indicated domain or received from the indicated domain for relaying through your SMTP server. RELAY also serves as an implicit OK for the other checks. - REJECT
Reject the sender or recipient with a general purpose message. - DISCARD
Discard the message completely using the $#discard mailer. This only works for sender addresses (i.e., it indicates that you should discard anything received from the indicated domain). - ### any text
where ### is an RFC 821 compliant error code and "any text" is a message to return for the command.
- OK
- 針對「進、出主機的信件」,其處理方式舉例:
- Connect:.dnes.mlc.edu.tw RELAY
connection information. 包含client address及client name。
從.dnes.mlc.edu.tw連線過來的信件,允許relay。 - From:someUser@seed.net.tw OK
針對sender設定。
寄件者為someUser@seed.net.tw,就幫他處理所託負的信件。 - To:badlocaluser@dnes.mlc.edu.tw DISCARD
寄給badlocaluser@dnes.mlc.edu.tw的信件,直接丟掉。
recipient
- Connect:.dnes.mlc.edu.tw RELAY
設定aliases。
實際的設定方式我還不很清楚,但是沒有做處理的話,容易發生狀況:
/usr/sbin/makemap hash mailertable < /dev/null
建個空空的資料庫。如果您知道這個檔案的功能與設定方式,請告訴我。我從網路上找到一段敘述:
發信人: flatfish.bbs@bbs.csie.nctu.edu.tw (比目魚), 看板: Linux 標 題: Sendmail 設定範例 發信站: 交大資工鳳凰城資訊站 (Sun Feb 20 15:11:37 2000) 轉信站: Cynix!netnews.hinet.net!spring!ctu-peer!news.nctu!freebsd.ntu!netnews.c 看了一下很多人在問 Sendmail 的問題所以我希望這封信可以幫助大家 先說明一下 ! 這是很久以前收集到的 , 希望作者別生氣◎ Mail Server - Sendmail 設定 [略] e.指定部份信件的轉信主機 若有部份網域的信件想指定轉信路徑, 可透過 /etc/mailertable 達成. 其內容 如下: .my.domain xnet:%1.my.domain uuhost1.my.domain suucp:uuhost1 .bitnet smtp:relay.bit.net .edu.tw esmtp:mail.seed.net.tw .org.tw esmtp:[139.175.70.43] 左邊為要寄送的網域或主機, 右邊為mailer:host的配對. 注意, 若指定IP, 格式 如最後一行所示. 要使設定生效必須執行下列指令: # cd /etc/mail; make -or- # makemap hash /etc/mail/mailertable.db < /etc/mail/mailertable ---> 將mailertable轉為mailertable.db # kill -1 `head -1 /var/run/sendmail.pid` ---> 重新讀取mailertable.db檔
※ 引述《可樂狙擊渣 <Mustang.bbs@bbs.civil.ncku.edu.tw>》之銘言:
sendmail.cw 是 8.9.x 以前的稱呼, 從 8.10.x開始該稱為 local-host-names
該檔內所列的 host 都會被視為 local, 通常和 DNS 的 MX 搭配使用..
※ From: sun.civil.ncku.edu.tw
※ Origin: 成大土木大地雕塑家 telnet://bbs.civil.ncku.edu.tw
- /etc/mail/sendmail.cf檔案中有下列敘述
Fw-o /etc/mail/local-host-names
或是
Fw-o /etc/mail/sendmail.cw - 不論sendmail.cf指定的檔名為何(因新舊版本不同),/etc/mail/local-host-names這個檔案至少應設定:
- DNS中的MX值,如DNS之正解檔有下列之設定:
dnes.mlc.edu.tw. IN MX 10 dns.dnes.mlc.edu.tw.
dns IN A 163.19.224.120
mail IN CNAME dns - 這部主機的名稱(或者,這部主機要收哪些網域名稱的信)。
- 根據前面兩點,/etc/mail/local-host-names實際設定的內容為:
dnes.mlc.edu.tw
mail.dnes.mlc.edu.tw
dns.dnes.mlc.edu.tw
virtualhost.idv.tw - 第四行的意思是說,寄給USER@virtualhost.idv.tw的信件由本主機收件,要達到此功能,必須在該網域的DNS正解檔中設定MX值:
virtualhost.idv.tw. IN MX 10 dns.dnes.mlc.edu.tw.
可能是該網域並無實際運作的Mail Server主機,而必須委由他人代收。 - 如果你的這部主機也架了虛擬網站,幾十個domain都集中在這裡;把這幾十個domain都加進去,Sendmail會把信全給收下來。但是,那些個domain的DNS正解檔最好都把MX值給設定好來,並且指向這部機器。
- DNS中的MX值,如DNS之正解檔有下列之設定:
- local-host-names實例:
sendmail.cf中有一項"Smart" relay host的設定,其功用是當我們的頻寬較小時,可以請上游的ISP的Mail-Server來代送信件。
初始值是空白:
DS
我的設定如下:
DSmail.mlc.edu.tw
外送的信件先送到上游縣網中心的mail.mlc.edu.tw主機請它代送,藉助其有較大的頻寬。
/etc/mail/sendmail.cf
# who I masquerade as (null for no masquerading) (see also $=M)
DMbsdlab.idv.tw在DM後面加入所欲顯示的名稱,以下是www.bsdlab.idv.tw主機修改前、後的信件表頭資料:
Return-Path: <tim@www.bsdlab.idv.tw> Received: from ms24.hinet.net (root@ms24.hinet.net [168.95.4.24]) by dns.lab.mlc.edu.tw (8.11.1/8.11.1) with ESMTP id f6HCFNS86587 for <tim@lab.mlc.edu.tw>; Tue, 17 Jul 2001 20:15:23 +0800 (CST) (envelope-from tim@www.bsdlab.idv.tw) Received: from www.bsdlab.idv.tw (www.bsdlab.idv.tw [211.75.215.107]) by ms24.hinet.net (8.8.8/8.8.8) with ESMTP id UAA07885 for <tim@lab.mlc.edu.tw>; Tue, 17 Jul 2001 20:15:22 +0800 (CST) Received: (from root@localhost) by www.bsdlab.idv.tw (8.11.4/8.11.4) id f6HCFKT11365 for tim@lab.mlc.edu.tw; Tue, 17 Jul 2001 20:15:20 +0800 (CST) Date: Tue, 17 Jul 2001 20:15:20 +0800 (CST) From: 林克敏 <tim@www.bsdlab.idv.tw> Message-Id: <200107171215.f6HCFKT11365@www.bsdlab.idv.tw> To: tim@lab.mlc.edu.tw Subject: a X-UIDL: #IL"!S7N"!R*U!!``Q!! a Return-Path: <tim@www.bsdlab.idv.tw> Received: from ms24.hinet.net (root@ms24.hinet.net [168.95.4.24]) by dns.lab.mlc.edu.tw (8.11.1/8.11.1) with ESMTP id f6HCDmS86568 for <tim@lab.mlc.edu.tw>; Tue, 17 Jul 2001 20:13:48 +0800 (CST) (envelope-from tim@www.bsdlab.idv.tw) Received: from www.bsdlab.idv.tw (www.bsdlab.idv.tw [211.75.215.107]) by ms24.hinet.net (8.8.8/8.8.8) with ESMTP id UAA06886 for <tim@lab.mlc.edu.tw>; Tue, 17 Jul 2001 20:13:47 +0800 (CST) Received: (from root@localhost) by www.bsdlab.idv.tw (8.11.4/8.11.4) id f6HCDkD11351 for tim@lab.mlc.edu.tw; Tue, 17 Jul 2001 20:13:46 +0800 (CST) Date: Tue, 17 Jul 2001 20:13:46 +0800 (CST) From: 林克敏 <tim@bsdlab.idv.tw> Message-Id: <200107171213.f6HCDkD11351@www.bsdlab.idv.tw> To: tim@lab.mlc.edu.tw Subject: b X-UIDL: RLf!!Za8!!O#/"!`_##! b
- kill -KILL `cat /var/run/sendmail.pid`
- /usr/sbin/sendmail -bd -q30m
默认情况下,sendmail并不解析/etc/hosts,因此在hosts中设置的relay不会生效。需要设置此文件:
hosts files
aliases files
htmldoc能够将html转换成PDF文件
htmldoc能够将html转换成PDF文件
htmldoc 包括2个版本,开源版本和商业版本。 ubuntu上是可直接使用 sudo apt-get install htmldoc 安装的。 Windows上的用户如果不想出点血,就得自己去编译了吧...
htmldoc能够将html转换成PDF文件
htmldoc 包括2个版本,开源版本和商业版本。 ubuntu上是可直接使用 sudo apt-get install htmldoc 安装的。 Windows上的用户如果不想出点血,就得自己去编译了吧...
htmldoc有个很好的web界面,但是我主要是想在服务器上使用,因此我对其命令行使用更感兴趣。
要将页面filename.html,转换成PDF,执行这个就可以了:
htmldoc --webpage -f output.pdf filename.html
要将file1.html, file2.html组装成一个分页的PDF,可执行这个:
htmldoc --webpage -f output.pdf file1.html file2.html
最酷的在这里了,要把slashdot.org的首页转换成PDF,很轻松:
htmldoc --webpage -f output.pdf http://slashdot.org/
想制作一本带目录的书,很容易:
htmldoc --book -f output.pdf file1.html file2.html
想增加一个漂亮的图片做封皮?这样的:
htmldoc --book -f 12book.pdf 1book.html 2book.html --titlefile bookcover.jpg
说了这么多好,最大的问题却遗漏了,支持中文吗?非常遗憾,还不支持UTF-8/Unicode/Chinese/Japanese。看到有文章说1.9版本会支持UTF8,1.9也还没正式release. 具体如何,还不得而知。
又想起了 ReportLab , 2.0版本最大的特性就是支持unicode,但是我现在已经忘记上次评测的结果了。
中文PDF生成是心中永远的痛。
对了,前2天研究了下openoffice的转换机制,有个oooconv的产品,在这里:
但是它只能在Linux上运行,而且安装很麻烦,不过这个方法还是很值得跟踪的。
如要在首页显示图片可以用此替换上句-->
HTML/XHTML
http://www.dreamdu.com/xhtml/
什么是XHTML?
XHTML是EXtensible HyperText Markup Language的英文缩写,即可扩展的超文本标记语言.
XHTML语言是一种标记语言,它不需要编译,可以直接由浏览器执行(属...
Subversion 安装
安装subversion-1.4.3
#cd /root/soft
#tar jxvf subversion-1.4.3.tar.bz2
#tar jxvf subversion-deps-1.4.3.tar.bz2
#cd /root/soft/subversion-1.4.3
#./configure --prefix=/opt/subversion --with-apxs=/opt/httpd-2.0.61/bin/apxs...

最新评论
测试
恭喜.不过这个blog不是很
设置成功了,很好用
听说谷歌准备开路了,谷歌开路
003和005是重复的,00
5 和2 一样的
第四篇看不到
谢谢finalbsd 第5