Monthly Archive for December, 2006

让 wget 忽略 robot.txt

如果想用wget来抓网页或者镜像站点但是遇到 robot.txt 不允许怎么办?比如这样的 robot.txt

1
2
3
4
User-agent: *
Disallow: /snapshots/
Disallow: /cgi-bin/
Disallow: /cgi2-bin/

在 $HOME/.wgetrc 中加入

1
robots = off

一切OK,镜像sina?

1
wget -c -m -p -q -b http://www.sina.com

-c 是继续传送, -m 是镜像, -p 是下载媒体文件,比如图片, -q 是安静模式, -b 是后台运行

SVN服务器搭建完全手册

  1. 准备,下载所需要文件.
  2. 检查已安装的 Apache2 是否已经安装了 mod_dav .
  3. 编译SVN,遇到的问题和解决方法
    1. 使用 默认文件系统(fsfs) 保存数据
    2. 使用 Berkeley DB 保存数据
  4. 配置Apache和SVN,测试.
  5. 其它小结
    1. 从Windows平台上数据转移
    2. 配置文件,使用其支持对文件中的 $Id$ 标签每次提交的时候自动更新版本信息.
    3. 基于路径的权限控制
    4. 常用SVN命令
  6. 相关资源

准备,下载所需要文件

本文测试环境

1
Linux MY_SERVER 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686 i686 i386 GNU/Linux

Apache 2.2.2

最新的版本 Subversion 可以在这里找到 :http://subversion.tigris.org/project_packages.html

检查已安装的 Apache2 是否已经安装了 mod_dav

如果已经成功安装了Apache,使用 httpd -M 来查看有没有安装 dav_module,如果没有的话 必须附加 ‘–enable-dav’ ‘–enable-dav-fs’ 两个参数重新编译 Apache,否则即使编译通过了svn,apache也会启动不起来.

编译APACHE2.2

  1. 修改部分源代码
    1
    # vi server/mpm/worker/worker.c

    找到下面几行,并改成如下的数值,其目的是在源码中修改apache可支持的 最大线程数和最大客户端数目。

    1
    2
    3
    4
    # define DEFAULT_SERVER_LIMIT 256
    # define MAX_SERVER_LIMIT 40000
    # define DEFAULT_THREAD_LIMIT 256
    # define MAX_THREAD_LIMIT 40000
  2. 编译配置
    优化编译选项及配置apache可加载的模块

    1
    2
    3
    4
    5
    # CFLAGS="-O6 -mpentiumpro -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" \
    > ./configure --codefix=/usr/local/apache2.2 --enable-mods-shared=all \
    > --enable-so --with-mpm=worker --enable-deflate \
    > --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache \
    > --enable-proxy --enable-suexec
  3. 编译及安装
    1
    # gmake && make install
  4. 优化apache配置选项
    修改MPM(多道处理器)参数

    1
    2
    # cd /usr/local/apache2.2
    # vi conf/extra/httpd-mpm.conf

    找到如下选项,并改成对应的数值

    1
    2
    3
    4
    5
    6
    7
    8
    ServerLimit 64
    ThreadLimit 128
    StartServers 8
    MaxClients 8192
    MinSpareThreads 50
    MaxSpareThreads 256
    ThreadsPerChild 128
    MaxRequestsPerChild 0

    修改apache2.2子进程所有者

    1
    2
    3
    4
    # vi /usr/local/apache2.2/conf/httpd.conf
    把daemon改为nobody
    User nobody
    Group nobody

编译SVN,遇到的问题和解决方法

使用默认的文件系统保存数据.

最终完整通过安装和测试的编译参数为:

1
2
3
./configure --with-apxs=/usr/local/apache2/bin/apxs \
--with-apr=/home/src/server/httpd-2.2.2/srclib/apr \
--with-apr-util=/home/src/server/httpd-2.2.2/srclib/apr-util
1
2
# make
# make install

其中 /home/src/server/ 为 httpd-2.2.2 源代码所在文件夹,根据实际情况调整一下.

遇到问题
  1. –with-apr 和 –with-apr-util 如果没有加上的话,即使编译成功了也会出现
    1
    Can’t set position pointer in file ‘/home/svn/repos/db/revs/0′: Invalid argument

    这样的错误提示.

  2. 暂时不能使用 Berkeley DB [* 已解决]
    svn保存文件更新数据库的方法有两个,一种是直接使用 fs (filesystem)来保存,另一种是通过Oracle提供支持的开源数据库 Berkeley DB 进行保存。但是如果加上 –with-berkeley-db=/usr/local/BerkeleyDB.4.4 就会configure时就会报错.

    1
    2
    configure: error: APR-UTIL was installed independently, it won’t be
    possible to use the specified Berkeley DB: /usr/local/BerkeleyDB.4.4

    我想 apr-unit 暂时不支持吧,我们就用默认的fs好了.

  3. 在make 的时候可能会遇到缺少 srclib/apr/libapr-1.la,srclib/apr-util/libaprutil-1.la 两个文件,找不到而make error.

    解决办法:/usr/local/apache2/lib/ 中找到,将其复制到源代码文件夹相应的位置中.

UPDATE!!!

使用 BerkeleyDB 保存数据

  1. 安装 BerkeleyDB
    1
    2
    3
    4
    5
    6
    7
    cd /usr/local/src
    $ wget http://downloads.sleepycat.com/db-4.3.29.tar.gz
    $ tar xzvf db-4.3.29.tar.gz
    $ cd /usr/local/src/db-4.3.29/build_unix
    $ ../dist/configure --enable-compat185
    $ make
    $ make install
  2. 更新apr和apr-util源代码
    1
    2
    3
    4
    5
    6
    7
    8
    # 清理编译后的.la文件
    $ cd /usr/local/src/httpd-2.2.3
    $ make clean
    $ cd /usr/local/src/subversion-1.3.2
    $ rm -rf apr
    $ rm -rf apr-util
    $ cp -rf /usr/local/src/httpd-2.2.3/srclib/apr ./
    $ cp -rf /usr/local/src/httpd-2.2.3/srclib/apr-util/ ./
  3. 编译安装
    1
    2
    3
    4
    5
    # /configure --with-apxs=/usr/local/apache2/bin/apxs \
    > --with-berkeley-db=/usr/local/BerkeleyDB.4.3 \
    > --with-ssl
    # make
    # make install
遇到问题
  1. BerkeleyDB 版本不能大于 4.3.否则同样会出现以下错误.
    1
    2
    configure: error: APR-UTIL was installed independently, it won’t be
    possible to use the specified Berkeley DB: /usr/local/BerkeleyDB.4.4

    主要是apr-util 暂时不支持4.4的版本.

  2. 必须更新apr,apr-util 源代码.
    subversion-1.3.2 自带的 apr-util 的版本是0.9.6的,必须升级为 1.2.7 虽然能编译过去。但在 svn checkout 的时候会提示

    1
    2
    svn: REPORT request failed on ‘/!svn/vcc/default’
    svn: REPORT of ‘/!svn/vcc/default’: Could not read status line: connection was closed by server.

    这个问题困扰了我很长时间,Google和官方论坛都无结果。后来昨天竟然自己无意中解决了,感动的得哭了:)

配置Apache和SVN,测试

成功编译svn后会在 httpd.conf 中自动加上

1
2
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

两个模块,没有的话,自行加上或检测是否真的编译成功.

假设我们现在要将一个名为 Lair 的项目导入到 SVN中

  1. Apache的配置
    在 conf/httpd.conf 或 conf/extra/httpd-vhosts.conf 中加入

    1
    2
    3
    4
    <Location /svn/Lair>
    DAV svn
    SVNPath /home/svn/Lair
    </Location>

    可以参考以下apache的配置,实现数据加密传输,用户身份验证.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    Listen 443

    AddType application/x-x509-ca-cert .crt
    AddType application/x-pkcs7-crl .crl.

    SSLPassPhraseDialog exec:/etc/sendsslpwd
    SSLSessionCache shmcb:/usr/local/apache2/logs/ssl_scache(512000)
    SSLSessionCacheTimeout 300
    SSLMutex file:/usr/local/apache2/logs/ssl_mutex

    <VirtualHost _default_:443>
    DocumentRoot /var/SVNRoot
    ServerName svn.yousite.com:443
    ServerAdmin [email protected]
    <Location />

    DAV svn
    SVNPath /var/SVNRoot
    AuthzSVNAccessFile /etc/svnserve.conf
    Satisfy Any
    AuthType Basic
    AuthName “yousite SVN Repository”
    AuthUserFile /etc/httpd-passwords.txt
    Require valid-user

    </Location>
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /etc/ssl/server.crt
    SSLCertificateKeyFile /etc/ssl/server.key

    </VirtualHost>

    更详细的配置说明文档 http://svnbook.red-bean.com/nightly/en/svn.ref.mod_dav_svn.conf.html

  2. 配置,并且测试SVN,

    创建一个新用户,用了保存仓库.

    1
    useradd -m svn

    创建一个新模块

    1
    2
    # su daemon #(apache是以daemon用户运行的,所以要切换身份,否则可能会报目录访问权限错误)
    # svnadmin create --fs-type fsfs /home/svn/Lair

    导入原来的项目

    1
    svn import /var/www/Lair http://localhost/svn/Lair -m ‘Initial import’

    重新建立工作目录

    1
    2
    # rm -rf /var/www/Lair  ##(注意备份!!)
    # svn checkout http://localhost/svn/Lair

    测试打开 http://localhost/svn/Lair

    如能看到一个你项目录列表,说明您成功了。

其它小结

  1. 数据转移:

    从 Windows 平台 SVN 服务器转移
    如果windows svn储存的格式也是dbd的话,直接将SVN的文件夹copy过来即可.然后
    执行 svnadmin recover /var/SVNRoot 检查一下数据库是否损坏.

    最后注意权限,确保 db 目录下的所有文件可写。

    1
    2
    chmod 755 db
    chmod 666 db/*

    否则checkout时出现以下错误,多数是因为 文件或者目录权限问题 引起的,可以尝试用 chown 或者 chmod 命令修改一下权限

    1
    2
    3
    4
    5
    6
    7
    8
    <m:human-readable errcode=”160029″>

    Could not open the requested SVN filesystem
    </m:human-readable>

    <m:human-readable errcode=”13″>
    Could not open the requested SVN filesystem
    </m:human-readable>

    另外一种方法没有测试过,原理大致和mysqldump一样,将svn导出为文本文件,然后重新导入,好处是可以避免因为存储格式不同而导致的数据转移困难。

    1
    2
    3
    4
    5
    6
    7
    # dump data to file (assuming a repo @ c:\repo):

    svnadmin dump c:\repo > c:\repo.txt
    # Copy the file over to linux:
    mkdir /repo
    svnadmin create /repo
    svnadmin load /repo < /repo.txt
  2. 设置访问控制

    当 httpd.conf 中 设置 AuthzSVNAccessFile 时,可以设置不同用户对不同目录的访问控制.以下是一个例子.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    [groups]
    root = admin.root
    web = user1,user2
    soft = user3,user4

    [/]
    @root = rw

    [/www]

    @web = rw

    [/soft]
    @soft = rw
  3. 详细的说明文档:http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html

  4. 配置文件,使用其支持对文件中的 $Id$ 标签每次提交的时候自动更新版本信息(自动属性).
    1
    2
    3
    4
    5
    6
    7
    8
    Windows : C:\Documents and Settings\%USERNAME%\Application Data\Subversion\config
    Linux : ~\.subversion\config
    [miscellany]

    enable-auto-props = yes
    [auto-props]
    *.php=svn:keywords=Id
    *.html=svn:keywords=Id

    关于自动属性的更高级讨论

  5. 几条常用svn 命令
    1
    2
    3
    $ svn update
    $ svn add “filename”
    $ svn commit

参考

用正则表达式抓取网页

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import re
import urllib
import os
import time
from urllib import urlretrieve
def spider_url(url):
    r = re.compile('<a\s+href="(.*?)".*?>')
    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)

python抓取网页代码实例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# -*- encoding:UTF-8 -*-
'''
    This is geturl.
    Wirtten by yuzebin : [email protected]
    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'
下载次数:</b>&nbsp;&nbsp;([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

使用Emacs作为Python开发环境

Emacs号称是编辑器之王,无所不能。可把他作为一个Python的集成开发环境

尽管Emacs那么的牛,但是从前用的多的还是简单的 vi。受不了吸引,决定开始使用Emacs进行Python的编程。

python.org上emacs的主页和对应wiki中,对python-mode竟然没有太多的介绍,反而在另外一个网站上找到了一些 emac 的资料,特别是 安装过程

安装过程总结一下:

  1. 使用最新的emacs:大于21.1的XEmacsen,或者大于20.7的Emacsen.
  2. 确保安装了prog-modes这个包,在debian中很简单:
    1
    #apt-get install prolog-el
  3. python-mode项目中,下载python-mode.el
  4. 字节编译,在emacs中输入命令(警告信息可忽略):
    1
    2
    C-x C-f /path/to/python-mode.el RET
    M-x byte-compile-file RET
  5. 确保python-mode.el在加载路径中,测试方法:
    1
    M-x locate-library RET python-mode RET

    如果没有,加入下行到自己的.emacs文件中:

    1
    (setq load-path (cons "/dir/of/python-mode/" load-path))
  6. 文件关联,自动将py后缀的文件和pyhton-mod关联,在自己的.emacs文件中添加:
    1
    2
    3
    4
    5
    (setq auto-mode-alist
    (cons '("\\.py$" . python-mode) auto-mode-alist))
    (setq intercodeter-mode-alis
    (cons '("python" . python-mode)
    intercodeter-mode-alist))
  7. 自动加载,将 python-mode 和文件 python-mode.elc关联,在自己的.emacs文件中添加:
    1
    (autoload 'python-mode "python-mode" "Python editing mode." t)
  8. 语法加亮,这个功能可不能少哟:) 同样在自己的.emacs文件中添加:
    1
    2
    3
    ;;; add these lines if you like color-based syntax highlighting
    (global-font-lock-mode t)
    (setq font-lock-maximum-decoration t)
  9. 支持中文,在.emacs中添加:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    (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)
  10. 好了!进入emacs试验一下:

    1
    $ emacs abc.py

    可以看到emacs的底部显示:Using the CPython shell。可以试着输入一些代码,加亮显示没有问题,支持自动缩进,支持自动括号匹配提示…. 使用C-h m你可以看到python模式的详细帮助文件,功能果然很强大!

Python 网页抓取

PythonGoogle公司最重要的三大开发语言之一(C++, Java, Python)

用Python语言写搜索引擎蜘蛛的脚本非常简单、轻松。给大家分享两种抓网页内容的方法

一、用urllib2/sgmllib包,将目标网页的所有URL列出。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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

二、用python调用IE抓取目标网页(Require win32com, pythoncom)的所有图像的url和大小

1
2
3
4
5
6
7
8
9
10
11
12
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

这种方法可以利用IE本身的Javascript. DHTML的支持,来做自动提交Form,和处理Javascript。
有关样例可以参考http://win32com.de

WordPress分页标签

用过wordcodess 1.5版本的朋友应该都知道编辑器有个默认的”page”按钮,这是长文章分页用的,到了wordcodess 2.0版本之后,这个默认的”page”按钮就没有了,被”more”按钮取代了,其实我们还是可以使用他,<!–nextpage–> 这个分页标签就可以做到,如果想要添加编辑器按钮,在tinymce或者简单的编辑环境中都可以,只要取掉注释就可以了

  1. 在简单的编辑环境中,wp-includes/js/quicktags.js 文件中找到
    1
    2
    3
    4
    5
    6
    7
    8
    edButtons[edButtons.length] =
    new edButton('ed_next'
    ,'page'
    ,'&lt;!--nextpage--&gt;'
    ,''
    ,'p'
    ,-1
    );

    去掉注释代码就可以了

  2. 在TinyMCE环境中,wp-includes/js/tinymce/plugins/wordcodess/editor_plugin.js,找到 TinyMCE_wordcodess_getControlHTML 函数,替换为
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    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 = '<a href="javascript:tinyMCE.execInstanceCommand(\'mce_editor_0\',\'mcewordcodessmore\')" mce_href="javascript:tinyMCE.execInstanceCommand(\'mce_editor_0\',\'mcewordcodessmore\')" target="_self" onclick="tinyMCE.execInstanceCommand(\'mce_editor_0\',\'mcewordcodessmore\');return false;"><img id="mce_editor_0_wordcodess_more" src="{$pluginurl}/images/more.gif" mce_src="{$pluginurl}/images/more.gif" title="'+titleMore+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><a href="javascript:tinyMCE.execInstanceCommand(\'mce_editor_0\',\'mcewordcodesspage\')" mce_href="javascript:tinyMCE.execInstanceCommand(\'mce_editor_0\',\'mcewordcodesspage\')" target="_self" onclick="javascript:tinyMCE.execInstanceCommand(\'mce_editor_0\',\'mcewordcodesspage\');return false;"><img id="mce_editor_0_wordcodess_page" src="{$pluginurl}/images/page.gif" mce_src="{$pluginurl}/images/page.gif" title="'+titlePage+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
                            return buttons;
            }
            return '';
    }

    就可以了

PSP版[地牢围攻:痛苦王座]图文攻略

本作流程和“大菠萝”(暗黑破坏神)类似,共分三大幕,每一大幕里主线任务和分支任务穿插进行。当然你也可以完全忽略分支任务,但这样做的结果就是你将失去很多得到高级装备的机会,而庞大的装备库系统则是这款游戏的一大亮点。

斜体字部分是地名,可以参照我的大地图。

A C T . 1 THE BROKEN LANDS大地图一

psp

  1. (1)OUT OF THE FRYING PAN… 接任务处:自带。
  2. 游戏开始的一个小任务,很简单。地图右边有个BOSS。可以杀也可以不杀,出口在地图左端。
  3. 来到大地图后去SEAHAVEN VILLAGE。找到队长谈话,然后找到HENDRICK谈话,任务完成。
  4. (2)Healing the Forest 接任务处:TAAR
  5. (3)Feeding The Village 接任务处:HENDRICK
  6. (5)Big Game Hunter 接任务处:ARENA

这三个任务可以一起接了,顺路一起完成。TAAR在村庄地图右下。

  1. 出村庄后,上面有个圣坛—SHRINE OF LIFE,站在圣坛上按→键调出道具栏,选STUFF按X使用EMPTY VIAL,装买圣水。
  2. 来到左上的SCORCHED HAMLET,进去后一路向上,找到如下图的七个箱子,拿光里面的物品。返回原路出地图。
    psp
  3. 来到地图右下角的RAPTORS NEST,找到RAPTOR并杀够一定的量既可。怪物长相见下图,地图里有很多RAPTOR,一路杀过来打到小BOSS这基本就能完成任务了。够没够量可以查看任务日志,或是屏幕出现your quests have been updated这句英文都可。
    psp
  4. 初期没回城卷轴可让怪物打死快速回城。当你挂了后选择REVIVE IN SEAHAVEN这句就直接回城了。
  5. 任务奖励:一些钱、装备,和一个新随从TAAR(自然系法师,辅助MM,很有用)。

(7)Trcaking The Hunters 接任务处:HENDRICK

去地图东部找幸存者。具体位置看我的大地图,搜索位置⑥,或看下图。完成任务后回城交任务。

4.jpg

(6)LOST SETTLERS 接任务处:HENDRICK

进入地图WEEPING FOREST,找到幸存者(位置如下图),在其旁边按→键调出道具栏,选STUFF按X使用PORTAL GEM,幸存者被传送回去,回城交任务,任务完成。

psp

(10)SIN OF PRIDE 接任务处:HENDRICK

  1. 先和卖药水的NPC(ABBOT FARNS)谈话。
  2. 进入地图WINDSTONE ABBEY (这个地图没截到,不好意思,大家看自己的大地图就OK)。注:先找到下图的小山洞(CRATER RIM)然后方可传到上面去。(山洞在大地图一⑤处)
  3. 在第一层左侧找到GORVINUS并干掉它。位置见下图。
    psp
  4. 在左边找到第二层入口(DEFILED SANCTUARY)进去。在右下处可找到一祭坛(见下图),这里有4个15级的BOSS守护着,打的时候用远程攻击一个一个的消灭。 PS:我是为了截图才站这,你也站着打那就等着躺吧。。
    psp game
  5. 然后去左边的小道一直走,在下图的一个房间里还有一个BOSS,消灭它。
    game PSP

Continue reading ‘PSP版[地牢围攻:痛苦王座]图文攻略’

Google发布2006度的各种热门搜索

googleGoogle发布了其2006度的各种热门搜索,除了一般的年度热门关键字索和热门新闻搜索,这次还包括了 “热门”,“实事”,“重要事件”,“娱乐”,“体育”这几类的搜索排名。其中在“实事”中的三个TOP关键字就是“伊拉克”、“北韩”和“伊朗”。在娱乐方面,看来都是美国人比较喜欢他们”Live Show”,TOP的三字关键词是”Dancing With the Stars vs. American Idol vs.Project Runway”,虽然这些只是英文世界的TREND,不过有的东西还是可以借鉴一下的,BAIDU的2006度搜索报告呢?不会在那上面出现广告吧? ;)

Google.com – Top Searches in 2006

  1. bebo
  2. myspace
  3. world cup
  4. metacafe
  5. radioblog
  6. wikipedia
  7. video
  8. rebelde
  9. mininova
  10. wiki

Google News – Top Searches in 2006

  1. paris hilton
  2. orlando bloom
  3. cancer
  4. podcasting
  5. hurricane katrina
  6. bankruptcy
  7. martina hingis
  8. autism
  9. 2006 nfl draft
  10. celebrity big brother 2006

Smarty的section镶套

数组

1
2
3
4
5
6
7
8
9
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 ) ) ) );

?>

smarty,section镶套

1
2
3
4
5
6
7
8
9
10
 <!-- section name=class loop=$HelpClass -->

<div class="class_name">
<div class="class_list"><!-- $HelpClass[class].HelpClassName --></div>
    <ul>
   <!-- section name=text loop=$Help[class].Help -->
      <li><a href="./?Op=Help&Do=Detail&KeyID=<!-- $Help[class].Help[text].HelpSubjectID -->"><!-- $Help[class].Help[text].HelpSubjectName --></a> </li>
   <!-- /section -->
    </ul>
</div>

Continue reading ‘Smarty的section镶套’