选择try unlisted linux iso (new syslinux)
这里测试是xenserver 6.1
http://www.pendrivelinux.com/
http://blogs.citrix.com/2010/11/19/xenclient-create-your-usb-install-stick/
选择try unlisted linux iso (new syslinux)
这里测试是xenserver 6.1
http://www.pendrivelinux.com/
http://blogs.citrix.com/2010/11/19/xenclient-create-your-usb-install-stick/
用版本控制就是想要有回滚的快感
现在的条件是我处于版本 20,现在要查看版本 10
方法1:
用svn merge
先 svn up,保证更新到最新的版本
比较两个版本的差异
svn diff -r 10:20 [文件或目录]
回滚到版本号10,注意版本号之间的顺序,这个叫反向合并
svn merge -r 20:10 [文件或目录]
现在文件都是版本 10 时候的文件,如果想比较已经改动过的文件,与版本 10 的差别:
svn diff -r 10 test.cpp
5) 改好后提交:
svn ci -m "back to r 10,xxxxx" [文件或目录]
这时svn库中会生成新的版本,如21。
方法2:
用svn up
前2步如方法1,然后直接
svn up -r 10
当前的工作版本就是版本10了。但是注意,这时svn库中会并不会生成新的版本,下次在本地svn up之后,还是会回到之前的版本。
将一个数组中能被 3 整除的数保留下来,需要写回调函数,满足条件的返回 true,否则返回 false
$arr = array(1,261,262,263,264,265,266,267,268,269,270,271,272,273,275,274,276,279,277,280,278,281,282,287,283,288,289);
function myFun($var){
if($var%3==0)
return true;
else
return false;
}
$filtered = array_filter($arr,"myFun");
print_r($filtered);
上面针对的是 value, 可以只针对 key 或针对 key, value 进行过滤
http://php.net/manual/en/function.array-filter.php
racktables 用到了 ldap 认证,对已经编译好的 php-5.3.28,缺少这个模块
现在需要加载 ldap.so
首先准备依赖库
yum安装依赖
yum install -y cyrus-sasl-ldap.x86_64 yum install -y openldap-devel.x86_64 yum install -y openldap.x86_64 yum install -y openldap-devel.i686
下载源码 php-5.3.28.tar.gz
cd ./ext/ldap /usr/local/php-5.3.28/bin/phpize ./configure --php-config=/usr/local/php-5.3.28/bin/php-config make make install
最后在php.ini启用此扩展
extension = "ldap.so"
重启 php
方法一:
ip_list = ['192.168.1.100', '192.168.10.3', '192.168.8.1']
ip_list.sort(lambda x,y: cmp(''.join( [ i.rjust(3, '0') for i in x.split('.')] ), ''.join( [ i.rjust(3, '0') for i in y.split('.')] ) ) )
结果
['192.168.1.100', '192.168.8.1', '192.168.10.3']
方法二:
转换成 int 型,用 int 来比较
import struct
import socket
def ip2int(addr):
return struct.unpack("!I", socket.inet_aton(addr))[0]
def int2ip(addr):
return socket.inet_ntoa(struct.pack("!I", addr))
ip_list = ['192.168.1.100', '192.168.10.3', '192.168.8.1']
# 构建 int_ip:ip 形式的 key:value, 并对 key 排序
ip_unsorted_dict = {}
for ip in ip_list:
int_ip = ip2int(ip)
ip_unsorted_dict[int_ip] = ip
keys = ip_unsorted_dict.keys()
keys.sort()
ip_sorted_list=[]
for key in keys:
ip_sorted_list.append(ip_unsorted_dict[key])
print ip_sorted_list
结果:
['192.168.1.100', '192.168.8.1', '192.168.10.3']
参考:
http://blog.csdn.net/hong201/article/details/3119519
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream proxy_stomp {
server 192.168.1.1:3000;
}
server {
listen 3001;
server_name proxy.abc.com;
location / {
proxy_pass http://proxy_stomp;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
upgrade 意思为升级为其他协议
http://nginx.org/en/docs/http/websocket.html