User-agent: *
Disallow: /snapshots/
Disallow: /cgi-bin/
Disallow: /cgi2-bin/在 $HOME/.wgetrc 中加入
robots = off一切OK,镜像sina?
wget -c -m -p -q -b http://www.sina.com-c 是继续传送, -m 是镜像, -p 是下载媒体文件,比如图片, -q 是安静模式, -b 是后台运行
User-agent: *
Disallow: /snapshots/
Disallow: /cgi-bin/
Disallow: /cgi2-bin/robots = offwget -c -m -p -q -b http://www.sina.com
import re
import urllib
import os
import time
from urllib import urlretrieve
def spider_url(url):
r = re.compile('')
page=urllib.urlopen(url).read()
b=r.findall(page)
for x in b:
try:
type, rest = urllib.splittype(x)
host, path = urllib.splithost(rest)
#if not path or path[-1] == "/":
#path = path + "index.html"
#if os.sep != "/":
# path = os.sep.join(path.split("/"))
#if os.name == "mac":
# path = os.sep + path
path = os.path.join(host, path)
dir, base = os.path.split(path)
#i=str(time.time())+".htm"
makedirs("C:/temp/"+dir)
#i="1.htm"
#urlretrieve(x,"C:/temp/"+i)
f = open("C:/temp/"+path, "wb")
page1=urllib.urlopen(x).read()
f.write(page1)
f.close()
#self.message("saved %s", path)
print "saved %s" % x
except:pass
#return b
def makedirs(dir):
if not dir:
return
if os.path.exists(dir):
if not os.path.isdir(dir):
try:
os.rename(dir, dir + ".bak")
os.mkdir(dir)
os.rename(dir + ".bak", os.path.join(dir, "index.html"))
except os.error:
pass
return
head, tail = os.path.split(dir)
if not tail:
print "Huh? Don't know how to make dir", dir
return
makedirs(head)
os.mkdir(dir, 0777)
# -*- encoding:UTF-8 -*-
'''
This is geturl.
Wirtten by yuzebin : yuzebin@gmail.com
Important:this script is running in cygwin or linux,if you run at windows
you need the curl and wget for windows .
'''
class='''
CGetPage is charge of to get a url , it have three methods to get a page : urllib,curl and wget;
CParsePage is charge of to parse the page , and return the match;
CGetMatch is the forcad class to wrap the CGetPage and CParsePage.
'''
history='''
2006.07.10 version 0.0.0.9 :
Publish this code to internet , ;-)
2006.06.27 version 0.0.0.7 :
refrectoring class CParsePage : return re.match only
refrectoring class CGetCount : rename to CGetMatch
2006.06.26 version 0.0.0.3 :
modify class CParsePage , return re.match
2006.06.22 version 0.0.0.2 :
add class CGetCount
this version is the first workable version.
add cnsky.
2006.06.21 initial version 0.0.0.1 :
add class CGetPage and CParsePage
cannot work ;-)
'''
import string,re,os,fnmatch,sys,copy,gzip,time,datetime,urllib
from types import *
isDebugMode = False
funcUrlRead = lambda url: urllib.urlopen(url).read()
def funcOutputMessage(msg):
print str(msg)
def funcDebugInfo(msg):
if(isDebugMode==True):
print str(msg)
class CGetPage:
def __init__(self,url):
if self.urlCheck(url)==True:
self.url=url
else:
return None
def urlCheck(self,url):
#todo , check the url is valid url.
return True
def getPage(self):
self.page = funcUrlRead(self.url)
def curlPage(self):
#call curl to get a page,this requir curl is installed.
self.page = os.popen("curl -A "" -s "" + self.url + """).read()
def setPath(self,path):
self.path = path
def wgetPage(self):
#call wget to download a url to path,this requir wget is installed.
os.chdir(self.path)
os.system('wget -c ' + self.url)
class CParsePage:
def __init__(self,rule,page):
if (self.ruleCompile(rule)!=False):
self.page = page
else:
return None
def ruleCompile(self,rule):
#compile the rule
try:
self.rule = re.compile(rule)
except:
return False
def parsePage(self):
self.match = re.search(self.rule,unicode(self.page,self.getCharset(self.page)))
funcDebugInfo(type(self.match))
def getCharset(self,string):
import chardet
#todo : automatic discern the charset
charset = chardet.detect(string)
return charset['encoding']
class CGetMatch:
def __init__(self,url,rule):
self.url = url
self.rule = rule
self.cgetpage = CGetPage(self.url)
self.cgetpage.getPage()
self.page = self.cgetpage.page
self.cparsepage = CParsePage(self.rule,self.cgetpage.page)
def getMatch(self,url,rule):
self.url = url
self.rule = rule
self.cgetpage.url = url
self.cparsepage.rule = rule
self.cgetpage.getPage()
self.page = self.cgetpage.page
self.cparsepage.page = self.cgetpage.page
self.cparsepage.parsePage()
self.match = self.cparsepage.match
if __name__ == '__main__':
funcOutputMessage('===This is a get url script===')
runTest()
def runTest():
#initialization
ccount = CGetMatch('http://www.sina.com.cn','')
i=0
#1
try:
sitename = 'huajun'
rule = 'hit[587]='47588,([0-9]+)'
url = 'http://www.onlinedown.net/soft/hitjs/hits47.js'
i += 1
ccount.getMatch(url,rule)
funcOutputMessage(str(i).rjust(2) + '.' + sitename.ljust(12) +':' + str(ccount.match.group(1)))
except:
pass
#2
try:
sitename = 'skycn'
rule = u'下载次数: ([0-9]+)'
url = 'http://www.skycn.com/soft/23265.html'
i += 1
ccount.getMatch(url,rule)
funcOutputMessage(str(i).rjust(2) + '.' + sitename.ljust(12) +':' + str(ccount.match.group(1)))
except:
pass
#apt-get install prolog-el C-x C-f /path/to/python-mode.el RET
M-x byte-compile-file RETM-x locate-library RET python-mode RET(setq load-path (cons "/dir/of/python-mode/" load-path))(setq auto-mode-alist
(cons '("\\.py$" . python-mode) auto-mode-alist))
(setq intercodeter-mode-alis
(cons '("python" . python-mode)
intercodeter-mode-alist))(autoload 'python-mode "python-mode" "Python editing mode." t);;; add these lines if you like color-based syntax highlighting
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)(set-language-environment 'Chinese-GB)
(set-keyboard-coding-system 'euc-cn)
(set-clipboard-coding-system 'euc-cn)
(set-terminal-coding-system 'euc-cn)
(set-buffer-file-coding-system 'euc-cn)
(set-selection-coding-system 'euc-cn)
(modify-coding-system-alist 'process "*" 'euc-cn)
(setq default-process-coding-system
'(euc-cn . euc-cn))
(setq-default pathname-coding-system 'euc-cn)$ emacs abc.py
import urllib2
from sgmllib import SGMLParser
class URLLister(SGMLParser):
def reset(self):
SGMLParser.reset(self)
self.urls = []
def start_a(self, attrs):
href = [v for k, v in attrs if k=='href']
if href:
self.urls.extend(href)
f = urllib2.urlopen("http://www.donews.com")
if f.code == 200:
parser = URLLister()
parser.feed(f.read())
f.close()
for url in parser.urls: print url
import win32com.client, pythoncom
import time
ie = win32com.client.DispatchEx('InternetExplorer.Application.1')
ie.Visible = 1
ie.Navigate("http://news.sina.com.cn")
while ie.Busy:
time.sleep(0.05)
doc = ie.Document
for i in doc.images:
print i.src, i.width, i.height
edButtons[edButtons.length] =
new edButton('ed_next'
,'page'
,'<!--nextpage-->'
,''
,'p'
,-1
);
function TinyMCE_wordcodess_getControlHTML(control_name) {
switch (control_name) {
case "wordcodess":
var titleMore = tinyMCE.getLang('lang_wordcodess_more_button');
var titlePage = tinyMCE.getLang('lang_wordcodess_page_button');
var titleHelp = tinyMCE.getLang('lang_wordcodess_help_button');
var buttons = '
';
return buttons;
}
return '';
}








Google发布了其2006度的各种热门搜索,除了一般的年度热门关键字索和热门新闻搜索,这次还包括了 "热门”,“实事”,“重要事件”,“娱乐”,“体育”这几类的搜索排名。其中在“实事”中的三个TOP关键字就是“伊拉克”、“北韩”和“伊朗”。在娱乐方面,看来都是美国人比较喜欢他们"Live Show",TOP的三字关键词是"Dancing With the Stars vs. American Idol vs.Project Runway",虽然这些只是英文世界的TREND,不过有的东西还是可以借鉴一下的,BAIDU的2006度搜索报告呢?不会在那上面出现广告吧? ;)
Array ( [0] => Array ( [HelpClassName] => 常见问题 [HelpClassID] => 1
[Help] => Array ( [0] => Array ( [HelpSubjectName] => PERL! [HelpSubjectID] => 1 ) [1] => Array ( [HelpSubjectName] => PYTHON[HelpSubjectID] => 4 )[2] => Array ( [HelpSubjectName] => RUBY? [HelpSubjectID] => 14 ) ) )
[1] => Array ( [HelpClassName] => 关于概念 [HelpClassID] => 3 [Help] => Array ( [0] => Array ( [HelpSubjectName] => 到底什么是PHP [HelpSubjectID] => 6 ) [1] => Array ( [HelpSubjectName] => php与PYTHON的区别是什么? [HelpSubjectID] => 7 ) ) )
[2] => Array ( [HelpClassName] => 新人必读 [HelpClassID] => 4 [Help] => Array ( [0] => Array ( [HelpSubjectName] => 怎样在PHP? [HelpSubjectID] => 13 ) [1] => Array ( [HelpSubjectName] => PHP使用说明(一) [HelpSubjectID] => 15 ) [2] => Array ( [HelpSubjectName] => PYTHON使用说明(二) [HelpSubjectID] => 16 ) [3] => Array ( [HelpSubjectName] => 如何PHP? [HelpSubjectID] => 17 ) [4] => Array ( [HelpSubjectName] => RUBY(三) [HelpSubjectID] => 18 ) ) ) );
?>




安装Skype For Debian的最新版本(我安装的是1.3.0.53)$wget http://skype.com/go/getskype-linux-deb
$sudo dpkg -i skype_debian-1.3.0.53-1_i386.deb
$ export LANG=c
$ QT_IM_MODULE=xim skype
function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1)
{
c_start=c_start + c_name.length+1
c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))
}
}
return ""
}
function checkCookie()
{
username=getCookie('username')
if (username!=null && username!="")
{alert('Welcome again '+username+'!')}
else
{
username=prompt('Please enter your name:',"")
if (username!=null && username!="")
{
setCookie('username',username,365)
}
}
}
header("Cache-control: private");
session_cache_limiter('nocache'); // 清空表单
session_cache_limiter('private'); //不清空表单,只在session生效期间
session_cache_limiter('public'); //不清空表单,如同没使用session一般
//获得Cookie解码后的值
function GetCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
//设定Cookie值
function SetCookie(name, value) {
var expdate = new Date();
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
+((secure == true) ? "; secure" : "");
}
//删除Cookie
function DelCookie(name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
}
//获得Cookie的原始值
function GetCookie(name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return GetCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
使用Windows上安装Ruby on Rails的时候,在使用gem安装Rails的时候遇到这样的问题gem install rails --include-dependencies
$ perl -MCPAN -e shell
[....]
Can't exec "mysql_config": No such file or directory at Makefile.PL line 76.
Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mysql_config. Resorting to guessed values!
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Failed to determine directory of mysql.h. Use
[....]
$ cd $HOME/.cpan/build/DBD-mysql-3.0008
$ perl --mysql_config=$MYSQL_PREFIX_DIR/bin/mysql_config
$ make
$ make test
$ make install
在测试服务器上安装perl5.8.8
$./configure.gnu --codefix=$HOME/local
make
make[1]: Leaving directory `/home/.salk/ndw/src/perl-5.8.6/x2p'
Making B (dynamic)
opendir(./../../../../..): Permission denied at ../../lib/File/Find.pm line 597
Use of chdir('') or chdir(undef) as chdir() is decodecated at ../../lib/File/Find.pm line 741.
opendir(./..): Permission denied at ../../lib/ExtUtils/MakeMaker.pm line 165
Couldn't change to directory /home/.salk/ndw/C: No such file or directory at Makefile.PL line 18
Writing Makefile for B
Warning: No Makefile!
make[1]: Entering directory `/home/.salk/ndw/src/perl-5.8.6/ext/B'
make[1]: *** No rule to make target `config'. Stop.
make[1]: Leaving directory `/home/.salk/ndw/src/perl-5.8.6/ext/B'
make config failed, continuing anyway...
make[1]: Entering directory `/home/.salk/ndw/src/perl-5.8.6/ext/B'
make[1]: *** No rule to make target `all'. Stop.
make[1]: Leaving directory `/home/.salk/ndw/src/perl-5.8.6/ext/B'
make: *** [lib/auto/B/B.so] Error 2
$make minitest/tmp$ ./configure.gnu --codefix=$HOME/local && make && make test && make install
今天遇到一个PHP下文本的换行替换问题,好无聊,在Windows或者Linux上有区别?不用管,用这个就好了codeg_replace("~(?:\r)?\n~s", "", $str);
QQ2006 Mobile是腾讯最近发布的QQ手机版本,与以前的不同,这个版本几乎拥有的PC版本QQ的所有功能,不过前提是你的手机型号是有要求的,一般来说智能手机是可以用上的,我的N3230当然可以了,现在就在用,在昨天下载的时候却遇到问题,怎么都下不到N3230版本的,后来在ZJ的帮助下,我得到了这个N3230的QQ2006test MOBILE,不需要支持其他费用,只需要支持手机上网的WAP或者GPRS费用就可以了。主要功能:
最近KAKA在DH上搭建了一个Django的测试环境,感觉Python还是很强大,不过似乎做有些小而快速的WEB应用就不那么实在。今天在 Dream Host 上测试 Ruby on Rails,非常成功,安装非常简单,只要在DH的控制面板中把你Domain的FastCGI支持打开就可以了,我使用的是子目录的形式建立Ruby on Rails应用的。Application error (Rails)ruby script/server
周杰伦的新歌《黄金甲》最近发布了,可以点这里观看MV,再按这里收听电台的首播。
Let your Dreamhost hosting as a Youtube? You can upload AVI/MOV/MPEG/MPG media files and Dreamhost can convert it to flv format for you! Like the Youtube, but, you can give faster speed to visitors, and upload media files as much as your Dreamhost space limited! I have 200G~(+1.0 GB / week). BTW, you can get more information about the media tool on Dreamhost, now!

@ECHO OFF
ECHO.如果你msn中修复不了就运行吧.
ECHO *************************************
ECHO * This file is provided by msn-problems.com *
ECHO * Copyright (C) 2004-2005 *
ECHO *************************************
ECHO.
ECHO 等一下.
REM Following files only needed in windows XP
IF NOT "%os%"=="Windows_NT" GOTO WIN9X
regsvr32 Dssenh.dll /s
regsvr32 Gpkcsp.dll /s
regsvr32 Slbcsp.dll /s
regsvr32 Sccbase.dll /s
:WIN9X
IF NOT "%os%"=="Windows_NT" CD %windir%\System\
REM Needed by both XP and 9X
regsvr32 Softpub.dll /s
regsvr32 Wintrust.dll /s
regsvr32 Initpki.dll /s
regsvr32 Rsaenh.dll /s
regsvr32 Mssip32.dll /s
regsvr32 Cryptdlg.dll /s
regsvr32 Msxml3.dll /s
ECHO.
ECHO 搞定,还不可以到这网站的论坛询问 www.msn-problems.com
ECHO.
pause
After a few hours of trial and error using advice from many different sites/posts, this is the process that I found successful in getting Ruby on Rails working with the Apache 2 fcgi module on linux. I hope this helps someone hang onto a few more hair follicles.curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.4.tar.gz
tar xvfz ruby-1.8.4.tar.gz
cd ruby-1.8.4
./configure --codefix=/usr/local
make
make install
cd ..ruby --versionruby 1.8.4 (2005-12-24) [i686-linux]curl -O http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
tar xvfz rubygems-0.8.11.tgz
cd rubygems-0.8.11
ruby setup.rb
cd ..curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar xvfz fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure --codefix=/usr/local
make
make install
cd ..javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0);
含泪播种的人一定能含笑收获
封锁:这几天发生了不少事,Wikipedia再次被封锁,Blogsopt又一次开放,为什么会发生这样的情况,让人觉得生活没有保障,说不定哪天你就会被XX掉,逃亡吧,如果我有实力,早就说拜拜了。
又是两年,品冠终于发行新专辑了,听了5首歌一遍,感觉無“可救藥”很好,然后就是非常品冠式的情歌“我以为”,不知道是落寞来是失望或是后之后觉,我以为我够坚强,却一天一天失望…… 作曲来自品冠的掏心创作,想必很多男生也会或多或少有相同的感受,以为想到做到了却没有办法做到,以为可以作到的却无能为力,原来感情的世界是有难过和痛苦了,怎么偏偏让你遇到,记忆或是忘记,坚持还是放弃,各自选择着,但请别忘记,当你幸福的时候,请把她紧紧握好。妳曾說不想有天讓我知道
妳對他 有那麼好
妳說會懂 我的失落
不是靠寬容 就能夠解脫
我為我出現的時候剛好
妳和他 正說要分開
我以為妳 已對他不再期待
不縱容他 再給妳傷害
我以為我的溫柔 能給你整個宇宙
我以為我能全力填滿妳感情的缺口
專心陪在妳左右 彌補他一切的錯
也許我太過天真 以為奇蹟會發生
他讓妳紅了眼眶 妳卻還笑著原諒
原來妳早就想好妳要留在誰的身旁
我以為我夠堅強 卻一天天的失望(卻輸得那麼絕望
少給我一點希望 希望就不是奢望
我以為終究妳會慢慢明白
他的心 已不在妳身上
我的關心 妳依然無動於衷
我的以為 只是我以為
Haha, use PDA search everything on google now! You can get it on this page , and you can view the smarty news page and gmail page for PDA, fast and small for PDA. Now, you can use "Web", "Images", "Local listings" and " Mobile Web (Beta)" search service on PDA page. and view small page "News", visit "Personalized Home" and "Gmail". Also, you can set your Preferences. Of cource, google build a "Help & Terms" page for the Mobile Web (Beta) service.
find . -name "*.c" | xargs sed -i 's/xxx/yyy/g'$cat toc.html | tr '[:upper:]' '[:lower:]' > toc1.html
$mv toc1.html toc.html
http://blogit.3322.org/weblog/2006/11/10/dreamhost-now/那就会自动重定向到http://fred.oracle1.com/weblog/2006/11/10/dreamhost-now/Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*) http://fred.oracle1.com/$1 [R=301,L]301 redirect: 301代表永久性转移(Permanently Moved),301重定向是网页更改地址后对搜索引擎友好的最好方法,只要不是暂时搬移的情况,都建议使用301来做转址。
302 redirect: 302代表暂时性转移(Temporarily Moved ),在前些年,不少Black Hat SEO曾广泛应用这项技术作弊,目前,各大主要搜索引擎均加强了打击力度,象Google前些年对Business.com以及近来对BMW德国网站的惩罚。即使网站客观上不是spam,也很容易被搜寻引擎容易误判为spam而遭到惩罚。
meta fresh: 这在2000年前比较流行,不过现在已很少见。其具体是通过网页中的meta指令,在特定时间后重定向到新的网页,如果延迟的时间太短(约5秒之內),会被判断为spam。
Now, I'm on Dreamhost, use fred.oracle1.com forever! Becase the old domain "blogit.3322.org" can't use on DreamHost :( , ho, but not so bad. It's only a weblog for me. what should I do? Buy a domain? I link maybe, but I can build some site with webcan.cn domain or the free DreamHost suppor domain. yes, I'm coming the new world, my future!
昨天白天几乎一天都在学习dojo,用 dojo.weight.inlineeditbox 做了一个工作上的东西,感觉还不错,不过发现需要去学习的真的还有很多,总结了一下 inlineeditbox :
"PHP开发团队与Zend放出了PHP 5.2.0,建议使用者进行升级。新版本修正了一些安全漏洞,对之前发现的缓冲溢出打了补丁,还包括了大量库的升级,bug修正,以及捆绑了一个流行扩展JSON可帮助进行AJAX开发。更多的细节可在这里浏览,下载。"
SSH登录RedHat后使用一些命令出现unknown terminal "rxvt-unicode"
export PATH
if [ "$TERM" = "rxvt-unicode" ]; then
TERM="rxvt"
export TERM
fi
# run contents of "my_file" as a program
perl my_file
# run debugger "stand-alone"
perl -d -e 42
# run program, but with warnings
perl -w my_file
# run program under debugger
perl -d my_file
# just check syntax, with warnings
perl -wc my_file
# useful at end of "find foo -print"
perl -nle unlink
# simplest one-liner program
perl -e 'print "hello world!\n"'
# add first and penultimate columns
perl -lane 'print $F[0] + $F[-2]'
# just lines 15 to 17
perl -ne 'print if 15 .. 17' *.pod
# in-place edit of *.c files changing all foo to bar
perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c
# command-line that prints the first 50 lines (cheaply)
perl -pe 'exit if $. > 50' f1 f2 f3 ...
# delete first 10 lines
perl -i.old -ne 'print unless 1 .. 10' foo.txt
# change all the isolated oldvar occurrences to newvar
perl -i.old -pe 's{\boldvar\b}{newvar}g' *.[chy]
# command-line that reverses the whole file by lines
perl -e 'print reverse <>' file1 file2 file3 ....
# find palindromes
perl -lne 'print if $_ eq reverse' /usr/dict/words
# command-line that reverse all the bytes in a file
perl -0777e 'print scalar reverse <>' f1 f2 f3 ...
# command-line that reverses the whole file by paragraphs
perl -00 -e 'print reverse <>' file1 file2 file3 ....
# increment all numbers found in these files
perl i.tiny -pe 's/(\d+)/ 1 + $1 /ge' file1 file2 ....
# command-line that shows each line with its characters backwards
perl -nle 'print scalar reverse $_' file1 file2 file3 ....
# delete all but lines beween START and END
perl -i.old -ne 'print unless /^START$/ .. /^END$/' foo.txt
# binary edit (careful!)
perl -i.bak -pe 's/Mozilla/Slopoke/g' /usr/local/bin/netscape
# look for dup words
perl -0777 -ne 'print "$.: doubled $_\n" while /\b(\w+)\b\s+\b\1\b/gi'
# command-line that prints the last 50 lines (expensively)
perl -e 'lines = <>; print @@lines[ $#lines .. $#lines-50' f1 f2 f3 ...
NameVirtualhost localhost
ServerAdmin root@localhost
DocumentRoot "/opt/httpd/htdocs"
# NameVirtualhost sqladmin.localhost
ServerAdmin webmaster@sqladmin.localhost
DocumentRoot "/opt/www/sqladmin"
ServerPath "/opt/www/sqladmin"
ServerName sqladmin.localhost
# ServerAlias sqladmin.localhost
Options Indexes FollowSymLinks MultiViews
IndexOptions FancyIndexing
AllowOverride None
DirectoryIndex index.php
Order Deny,allow
Allow from all
ErrorLog logs/sqladmin.localhost-error
#
# NameVirtualhost php.localhost
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot /opt/www/php
ServerPath /opt/www/php
Options Indexes FollowSymLinks MultiViews
AllowOverride None
DirectoryIndex /phpinfo.php
Order Deny,allow
Allow from all
ServerName php.localhost
ErrorLog logs/php-error_log
CustomLog logs/php-access_log common
fred@localhost:php$ sudo /opt/httpd/bin/httpd -S
VirtualHost configuration:
127.0.0.1:80 is a NameVirtualHost
default server localhost (/opt/httpd/conf/extra/httpd-vhosts.conf:29)
port 80 namevhost localhost (/opt/httpd/conf/extra/httpd-vhosts.conf:29)
port 80 namevhost sqladmin.localhost (/opt/httpd/conf/extra/httpd-vhosts.conf:35)
port 80 namevhost php.localhost (/opt/httpd/conf/extra/httpd-vhosts.conf:53)
Syntax OK
在Windows上使用Perl的模块怎么办?用CPAN很麻烦的,使用ActivePerl的PPM来管理吧,安装、升级、删除都可以方便的进行,可以使用GUI也可以使用命令行。不过在Cygwin我使用PPM失败了,不知道为什么,一会检查一下,哈哈,休息一下,整理一下心情的碎片,一天接一天,幸福就会一天天接近,不是吗?
现在的PHP+MySQL的博客系统是非常棒的,昨天把google的adsense加入了,并不是为了挣钱,而是为了研究一下adsense。这两天还在研究DreamHost,Ruby on Rails,又是一个十月,有人是幸福的,有人在痛苦着,有人住进了新房子,有人流落街头,有人换了新工作,有人却还在失业,为什么会有诧异,是命运还是人本身,没有人能解释清楚,我想人不能停止奋斗,因为每个人都是去追求幸福的理由,或是为了幸福而去追求。
2005年,吳克群「大頑家」專輯,以「大舌頭」、「周星星」讓人耳目一新,接著「不屑紀念」更攻下KTV點唱冠軍,「我有罪」、「泛泛之輩」等慢歌深情感人,讓吳克群唱片銷量、台灣及內地人氣皆急速升高。2006年5月,克群更以「大頑家」專輯入圍第17屆金曲獎最佳國語男演唱人獎。2006年,吳克群再度推出全新的全創作專輯「將軍令」,以更磅礡的氣勢、更有趣的想法、更感人的情歌,以及吳克群一貫的顛覆性格,要給你絕對不同凡響的吳克群音樂!
来自 solidot.org 的一篇文章:大多数网络社区都有一个1%法则。至于博客,有99%的读者都是个潜伏者,怎么让他们更多的发表评论?
基地组织曾派五人潜入中国制造恐怖事件
一人炸立交桥 结果转晕于桥上;
一人炸公交车 结果没挤上车;
一人炸超市 结果遥控器被盗;
一人炸高楼 结果被保安狂揍:"叫你讨薪 叫你上访";
最后一人成功炸矿,死伤数百人。潜回基地后半年都没见新闻报道,遂被基地组织以"撒谎罪"处决
天啊,难以置信,我居然用 Drivel 在linux下post到wordcodess了,应该是那个XML的问题解决直接导致我可以post文章了,受不了了…… 可是没有添加 Tag 的功能,是不是需要去改改Drivel的源代码呢?
大概是从大四的开始就一直在用的一些配置文件,好象是从gentoo的开发者站点上抓下来的吧 :)set ai nocp digraph ek hid ru sc wmnu noet nosol si
set bs=2 fo=cqrt ls=2 shm=at ww=,h,l ts=4 sw=4
set com=s1:/*,mb:*,ex:*/,://,b:# syn=on filetype=on
set vi=%,'50,\"50,:50 lcs=tab:>-,trail:.,extends:>
set pt= shm=I tm=750 nomore modelines=5 hls!
syn on
ino gj
ino gk
nno gj
nno gk
nno :set hls!set hls?
nno :syn clear
nno :set nu!set nu?
if has("gui_running")
colo darkblue
set gfn=Bitstream\ Vera\ Sans\ Mono\ 8
else
colo ubuntu
" colo desert
" colo elflord
endif
博客的feed(RSS)差不多半年来都是“坏”掉的 ,可能不止半年了吧 :( ,这两天没放假。所以决定把它修复了。