YMLib Systems Librarian

一些設定的記錄

我的相片
名稱:
位置: WuGu, Taipei, Taiwan

我是個大光頭,因我的頭型適合這一型。I have a perfect head style.

星期三, 9月 27, 2006

如何從主機名稱找到該domain

從perlmonks.org找到:
http://perlmonks.org/?node_id=44456
Extracting domain names from FQDNs

sub parse_fqdn {
my $fqdn = shift;
my @tlds = (
[qw(com net org)], # common
[qw(gov edu co\.uk co\.jp gov\.tw edu\.tw com\.tw)], # not-so-common
[qw(la li it po)] # downright odd (long list)
);

foreach my $level (@tlds) {
#warn "pass ". ++$pass;
for(@{$level}) {
return $1 if $fqdn =~ /\.(\w+?\.$_)$/;
}
}

warn "unable to find domain from $fqdn\n";
return $fqdn;
}
my $domain = parse_fqdn("$ARGV[0]");
print "$ARGV[0] => $domain\n";

標籤: ,

星期二, 9月 19, 2006

mysql中顯示幾日內的記錄

回傳公元0年到今日的總日數:
mysql>select to_days(now(0));

回傳公元0年到前三天的總日數:
mysql>select to_days(now()) - 3;

$sql="select * from books where to_days(dateandtime) >= (to_days(now()) - 3)

星期一, 9月 18, 2006

解決office符號表出現不了正確符號的方法

工具列上的插入->特殊符號->顯示符號表
再到檢視->工具列叫出符號表

星期四, 9月 14, 2006

停掉solaris 10的不必要服務

Harden Solaris 10
Created by cclausen. Last edited by cclausen

# Setting up sendmail on Solaris 10
# set LOG_FROM_REMOTE=NO in /etc/default/syslogd
# disable unneeded services
svcadm disable mpxio-upgrade keyserv nisplus nis/client ldap/client nfs/cbd
svcadm disable nfs/mapid inetd-upgrade print/server dns/server
svcadm disable bootparams kadmin krb5kdc nfs/server rarp ipfilter slp consadm
svcadm disable zones rcap gss ocfserv rex rstat rusers spray wall
svcadm disable tname telnet apocd/udp chargen:dgram chargen:stream
svcadm disable daytime:dgram daytime:stream discard:dgram discard:stream
svcadm disable echo:dgram echo:stream ftp time:dgram time:stream
svcadm disable comsat finger login:klogin login:eklogin login:rlogin
svcadm disable rexec shell:kshell shell:default talk rpc_ticotsord smserver mdcomm
svcadm disable meta metamed metamh print/rfc1179 xfs nlockmgr bind
svcadm disable pfil print/cleanup fc-fabric autofs
svcadm enable -r console-login

星期四, 9月 07, 2006

在x86的solaris 10中gcc編譯的問題

在x86的solaris 10中gcc編譯的問題,
總會有錯誤訊息,只要照著:
http://www.sunfreeware.com/sol10rightintel10.html
中gcc相關的訊息就解決。

Note that this version of gcc was created on build 60 of Solaris 10. If you are using a higher version, you will need to redo some of the header files. This is done by doing the following steps:

cd /usr/local/lib/gcc-lib/i386-pc-solaris2.10/3.3.2/install-tools/

Put the line SHELL=/bin/sh on the first line of the mkheaders.conf
file. Then run

./mkheaders

This will correct some files and make the build 60 gcc usable on
higher builds. I have tested this on build 72 and it works fine.