Archive for 三月, 2010
PXELinux深度配置
参考资料的文档完整而且详细,不再啰嗦一遍。
这儿只罗列一些要点:
- PXELinux如何查找配置文件?查找配置文件使用pxelinux.0的相对路径。按照下列顺序:
-
- 首先在pxelinux.cfg目录中,尝试查找按照短线分割的小写十六进制mac命名的配置文件
- 然后尝试查找IP对应的大写十六进制数字,可以用gethostip来算。如果没有找到则删掉最后一位,
继续查找。直到只剩最后一位为止。 如果最后一位也没有找到,
则最后查找default 文件。比如: 192.168.100.2-> C0A86402 会按照下面来查找
pxelinux.cfg/00-24-e8-6e-2d-fe
pxelinux.cfg/C0A86402
pxelinux.cfg/C0A8640
pxelinux.cfg/C0A864
pxelinux.cfg/C0A86
pxelinux.cfg/C0A8
pxelinux.cfg/C0A
pxelinux.cfg/C0
pxelinux.cfg/C
pxelinux.cfg/default
- 如何修改默认的pxelinux.cfg目录名?
在dhcpd.conf中使用 option pxelinux.pathprefix custom_config_dir 来指定,比如:
option pxelinux.pathprefix “redhat/”; - 如何指定规则1的默认配置文件?
在dhcpd.conf中使用 option pxelinux.configfile “custom_config_file“;来指定,比如:
option pxelinux.configfile “pxelinux.5Client_64.cfg”;
参考资料:
救助和犀利哥
前日颇为关注犀利哥,对于潮人盲,最开始被吸引的只是那段恶搞的旁白:
“欧美粗线条搭配中有着日泛儿的细腻,绝对日本混搭风格,绝对不输藤原浩之流。
发型是日本最流行的牛郎发型,外着中古店淘来的二手衣服搭配LV最新款的纸袋。
绝对谙熟混搭之道,从视觉色彩搭配上讲,腰带绝对是画龙点睛之笔。
然而这根腰带绝非那些上班族小白领所得承受得起的,全球限量发行的GUCCIxclot
混色系腰带,只有那些敢于为潮流献身的人才能懂得”
原以为,此事会一如既往的淡出我的视线,淡出大家的视线。
事实证明,这事却激起千层浪:
有恶搞型:继续杜撰旁白或者甚至找他合影的,看到两个傻冒V字型的手势,整他妈想抽两
大嘴巴: 人皆有悲悯之心,此两傻冒却以风雨中的流浪汉来取景,以人的标准来批判之,
实在太高要求它们了。
有专注型:不断挖掘、披露犀利哥身后故事的:诸如曾是98抗洪抢险的二等功功臣,
未婚妻王君以及被杀的细节,甚至主动上门的”犀利嫂”。真假难辨的如今,权当饭后谈资
有引伸型:基于此感言:网络已无可真言、可畅言之处,唯有侃侃”犀利哥”,还真担心
往后会不会连犀利哥也没有地方可以谈,因为这会严重影响城市的形象,极大的挑战管理者
的政绩,所谓官威难测,此类话题难免不被设为关键字,不被曝光,不被大众知道,便和谐了
有积极型: 要决绝的解决事情,送他去救助站,被救助。看着猪多电视台妓者围着某位前来救助
官员的报道,从这位老爷身上丝毫没有看到任何的仁慈和关爱,只看到施舍慈悲的一副高高在上 ,
甚至询问犀利哥”官方认可”的朋友起来,也是一副官老爷模样,厌恶之心,油然而生。
http://baike.baidu.com/view/1465055.htm
soap学习笔记
参考资料:
soap是什么之类的废话就不扯了,直奔主题,按图索骥:
<?xml version=”1.0″?>
<soap:Envelope
xmlns:soap=”http://www.w3.org/2001/12/soap-envelope”
soap:encodingStyle=”http://www.w3.org/2001/12/soap-encoding”>
<soap:Header>
<m:Trans
xmlns:m=”http://www.w3school.com.cn/transaction/”
soap:mustUnderstand=”1″>234</m:Trans>
</soap:Header>
<soap:Body>
<m:GetPrice xmlns:m=”http://www.w3school.com.cn/prices”>
<m:Item>Apples</m:Item>
</m:GetPrice>
</soap:Body>
</soap:Envelope>
soap必须:
- 使用命名空间: http://www.w3.org/2001/12/soap-envelope。 参见的命名是: soap-envelope或者soap 或者env
- 使用soap-envelope:encodingStyle指定文档中使用的数据类型: http://www.w3.org/2001/12/soap-encoding
- 必须使用Envelop根元素
- 可选的soap:Header元素。
上面的例子包含了一个带有一个 “Trans” 元素的头部,它的值是 234,此元素的 “mustUnderstand” 属性的值是 “1″。
SOAP 在默认的命名空间中 (“http://www.w3.org/2001/12/soap-envelope”) 定义了三个属性。这三个属性是:actor、
mustUnderstand 以及 encodingStyle -
- actor:
通过沿着消息路径经过不同的端点,SOAP 消息可从某个发送者传播到某个接收者。
并非 SOAP 消息的所有部分均打算传送到 SOAP 消息的最终端点,不过,另一个方面,
也许打算传送给消息路径上的一个或多个端点。SOAP 的 actor 属性可被用于将 Header 元素寻址到一个特定的端点。 - mustUnderstand 。
SOAP 的 mustUnderstand 属性可用于标识标题项对于要对其进行处理的接收者来说是强制的还是可选的。
假如您向 Header 元素的某个子元素添加了 “mustUnderstand=”1″,则它可指示处理此头部的接收者必须认可此元素。
假如此接收者无法认可此元素,则在处理此头部时必须失效。 - encodingStyle。的 encodingStyle 属性在上一节中已解释过了
- actor:
- 必需的 SOAP Body 元素可包含打算传送到消息最终端点的实际 SOAP 消息。必须
使用http://schemas.xmlsoap.org/soap/encoding/这一命名空间作为encodingStyle
比如下面这个Request:
<?xml version=”1.0″ encoding=”utf-8″ ?>
<env:Envelope xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:env=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“>
<env:Header>
<n1:wsse xmlns:n1=”http://schemas.xmlsoap.org/ws/2002/07/secext”
env:mustUnderstand=”1″>
<n1:sessionid>828000</n1:sessionid>
</n1:wsse>
</env:Header>
<env:Body>
<n2:withdrawal xmlns:n2=”http://tempuri.org/authHeaderPort”
env:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/“>
<amt xsi:type=”xsd:int”>120</amt>
</n2:withdrawal>
</env:Body>
</env:Envelope>
他的response是:
<?xml version=”1.0″ encoding=”utf-8″ ?>
<env:Envelope xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:env=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“>
<env:Header>
<n1:wsse xmlns:n1=”http://schemas.xmlsoap.org/ws/2002/07/secext”
env:mustUnderstand=”0″>
<n1:sessionid>0</n1:sessionid>
</n1:wsse>
</env:Header>
<env:Body>
<n2:withdrawalResponse xmlns:n2=”http://tempuri.org/authHeaderPort”
env:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/“>
<return xsi:type=”xsd:string”>withdrawal 120 OK</return>
</n2:withdrawalResponse>
</env:Body>
</env:Envelope> - 可选的Fault元素用来指示错误的
soap响应看起来是这样的:
<?xml version=”1.0″?>
<soap:Envelope
xmlns:soap=”http://www.w3.org/2001/12/soap-envelope”
soap:encodingStyle=”http://www.w3.org/2001/12/soap-encoding”>
<soap:Body>
<m:GetPriceResponse xmlns:m=”http://www.w3school.com.cn/prices”>
<m:Price>1.90</m:Price>
</m:GetPriceResponse>
</soap:Body>
</soap:Envelope>
wsdl学习笔记
主要参考:
http://www.w3school.com.cn/wsdl/wsdl_documents.asp
WSDL 文档是利用这些主要的元素来描述某个 web service 的:
| 元素 | 定义 |
|---|---|
| <portType> | web service 执行的操作 |
| <message> | web service 使用的消息 |
| <types> | web service 使用的数据类型 |
| <binding> | web service 使用的通信协议 |
WSDL 端口
<portType> 元素是最重要的 WSDL 元素。
它可描述一个 web service、可被执行的操作,以及相关的消息。
可以把 <portType> 元素比作传统编程语言中的一个函数库(或一个模块、或一个类)。
WSDL 消息
<message> 元素定义一个操作的数据元素。
每个消息均由一个或多个部件组成。可以把这些部件比作传统编程语言中一个函数调用的参数。
WSDL types
<types> 元素定义 web service 使用的数据类型。
为了最大程度的平台中立性,WSDL 使用 XML Schema 语法来定义数据类型。
WSDL Bindings
<binding> 元素为每个端口定义消息格式和协议细节。
举例:
<message name=”getTermRequest”>
<part name=”from” type=”xsd:string”/>
</message>
<message name=”hello_worldResponse”>
<part name=”from” type=”xsd:string”/>
</message>
<portType name=”hwsPort”>
<operation name=”hello_world”>
<input message=”getTermRequest”/>
<output message=”hello_worldResponse”/>
</operation>
</portType>
<binding name=”hwsBinding” type=”tns:hwsPort”>
<soap:binding style=”rpc” transport=”http://schemas.xmlsoap.org/soap/http”/>
<operation name=”hello_world”>
<soap:operation soapAction=”http://localhost:2000/wsdl/hws.wsdl#hello_world” style=”rpc”/>
<input>
<soap:body use=”encoded” namespace=”http://localhost:2000/wsdl/hws.wsdl” encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”/>
</input>
<output>
<soap:body use=”encoded” namespace=”http://localhost:2000/wsdl/hws.wsdl” encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”/>
</output>
</operation>
</binding>
<service name=”hws”>
<documentation>The service simply says hello world from something supplied</documentation>
<port name=”hwsPort” binding=”tns:hwsBinding”>
<soap:address location=”http://localhost:2000/”/>
</port>
</service>
hwsPort是该服务的名字,hello_world为该服务中的一个操作,getTermRequest是hello_world操作的输入消息
hello_worldResponse是该操作的输出消息。
binding有两个属性:name和type;name标识该绑定的名称,type为绑定的服务类型名字(hwsPort)。
soap:binding有两个属性: style和transport。 style可取的有rpc和document两个。
transport指明了传输的协议,http://schemas.xmlsoap.org/soap/http表示使用http。
operation 指明了每个服务提供的操作。
moin wiki农场
two parts:
- step 0-2. all are required
- step 3,4,5. web server configration, you only need one of them.
all these installation are done in $HOME , so don’t need any root prerogative
step 0. install/upgrade Moin to 1.9.2 (when upgrade,
recommend to delete the old release, I didn’t do this before , that cause a big problem )
install new moin ignore.
this is the upgrade:
1.8.3->1.9.2
python setup.py install
gavin_kou@shadow:~/downloads/python/moin-1.9.2$ ll /home/gavin_kou/local/lib/python2.5/site-packages/moin-* -d
drwxrwxr-x 6 gavin_kou pg2184500 4096 2009-06-03 02:32 /home/gavin_kou/local/lib/python2.5/site-packages/moin-1.8.3-py2.5.egg
-rw-rw-r– 1 gavin_kou pg2184500 3183 2010-03-10 02:26 /home/gavin_kou/local/lib/python2.5/site-packages/moin-1.9.2-py2.5.egg-info
>>> import MoinMoin.version
>>> MoinMoin.version.release
’1.9.2′
there are a special directory: ~/local/share/moin/ ,it contains all of wiki initialization data, especially the data and underlay directory and
some files in the server and config directory: server(eg: moin.fcgi is the server of fcgi ENV, and moin.cgi is the cgi script , etc ) and
config( eg: config/wikifarm/farmconfig.py is the wiki farm configuration sample )
gavin_kou@shadow:~/sites/wiki/bin$ ll ~/local/share/moin/
total 16
drwxrwxr-x 5 gavin_kou pg2184500 4096 2010-03-10 02:26 config
drwxrwxr-x 7 gavin_kou pg2184500 4096 2010-03-10 02:26 data
drwxrwxr-x 2 gavin_kou pg2184500 4096 2010-03-10 02:26 server
drwxrwxr-x 3 gavin_kou pg2184500 4096 2010-03-10 02:26 underlay
step 1. design the directory structure, all the setting are based on this stucture. if change the structure ,
DO NOT forget to change the corresponding setting files.
wiki/
├─bin/
│ ├─mointwisted
│ ├─mointwisted.py
│ ├─moin.fcgi
│ ├─moin.cgi
│ └─moin
├─config/
│ ├─farmconfig.py
│ ├─hackgou.py
│ └─hiking.py
├─data/
│ ├─hackgou
│ │ ├─data/
│ │ └─underlay/
│ ├─hiking/
│ │ ├─data/
│ │ └─underlay/
│ └─user/
└─static/
└─htdocs/
and create it by:
mkdir -p wiki/{bin,config,data/hackgou,data/hiking,static}
step1. copy data ( the data and underlay dir)
cp -rp ~/local/share/moin/data ~/local/share/moin/underlay wiki/data/hackgou
cp -rp ~/local/share/moin/data ~/local/share/moin/underlay wiki/data/hiking
step2. copy the ~/local/share/moin/config/wikifarm/farmconfig.py and ~/local/share/moin/config/wikifarm/mywiki.py to your config dir
mywiki.py
cp ~/local/share/moin/config/wikifarm/farmconfig.py wiki/config/
cp ~/local/share/moin/config/wikifarm/mywiki.py wiki/config/hackgou.py
cp ~/local/share/moin/config/wikifarm/mywiki.py wiki/config/hiking.py
and change the farmconfig.py:
wikis = [
("hiking", r'^http://hackgou.itbbq.com/wiki/hiking.*$'),
("hackgou", r'^http://hackgou.itbbq.com/.*$'),
]
add the following code into the hackgou.py and hiking.py(Both of them):
import os
app_root=os.path.realpath( os.path.join( os.path.dirname( os.path.realpath(__file__) ) ,’..’) )
data_root=os.path.join(app_root, ‘data’)
data_dir = os.path.join(data_root, __name__, ‘data’ )
data_underlay_dir = os.path.join(data_root, __name__, ‘underlay’ )
step3. config the mointwisted ,
add the following lines into mointwisted.py
import sys, os
app_root=os.path.realpath( os.path.join( os.path.dirname( os.path.realpath(__file__) ) ,’..’) )
sys.path.insert(0, os.path.join(app_root, ‘config’) )
step4. config the WSGI
cp ~/local/share/moin/server/moin.wsgi bin/
change the following codes:
app_root=os.path.realpath( os.path.join( os.path.dirname( os.path.realpath(__file__) ) ,’..’) )
sys.path.insert(0, os.path.join(app_root, ‘config’) )
application = make_application(shared=os.path.join(app_root,’static’,'htdocs’))
setp5. config the FCGI, two files: moin.fcgi and .htaccess
cp ~/local/share/moin/server/moin.fcgi and change it.
change the following line
import sys, os
sys.path.insert(0, ‘/home/gavin_kou/local/lib/python2.5/site-packages’)
app_root=os.path.realpath( os.path.join( os.path.dirname( os.path.realpath(__file__) ) ,’..’,'wiki’) ) # based the above directory structure
sys.path.insert(0, os.path.join(app_root, ‘config’) )
from MoinMoin import log
#enable the log, for trouble shooting. the log.conf is the logger config file,
# if enable it , please make sure it’s right
log.load_config( os.path.join( app_root,’config’,'log.conf’) )
logging = log.getLogger(__name__)
from MoinMoin.web.serving import make_application
app = make_application( shared = os.path.join(app_root,’static’,'htdocs’) ) # <– adapt here as above directory structure
fix_script_name = ‘/wiki’
.htaccess add the following lines:
AddHandler fastcgi-script .fcgi
RewriteRule wiki(/?.*) /moin.fcgi/$1 [L]
other advanced setting:
user_dir=os.path.join(app_root, ‘data’, ‘user’)
#session data stored in cache_dir/__session_. so
# if shared the cache_dir, shared the login information(SSO)
cache_dir=os.path.join(app_root,’var’,'cache’)