2013年6月25日 星期二
Bottle SimpleTemplate Engine if... else... condition
{{ 'checked' if (user.activited == 1) else '' }}
Reference :
python - handling undefined values in bottle's SimpleTemplate Engine templates - Stack Overflow
2013年6月24日 星期一
2013年6月19日 星期三
Python check if string is JSON format
def isJSON(s):
import json
try:
json_object = json.loads(s)
except ValueError, e:
# invalid json
return False
else:
# valid json
return True
2013年6月18日 星期二
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
在套件庫端設定
$ git config receive.denyCurrentBranch ignore
or
$ git config --global receive.denyCurrentBranch ignore
Linux 使用 sshfs 連結 Android 4.0
Android :
(WIFI 順暢狀態)
安裝 SSHelper
啟動後會監聽在 WIFI 界面上
Username : root
Password : admin
Post : 2222
Linux :
// mount
(WIFI 順暢狀態)
安裝 SSHelper
啟動後會監聽在 WIFI 界面上
Username : root
Password : admin
Post : 2222
Linux :
// mount
$ sshfs -o port=2222,idmap=user,uid=1000,gid=1000 root@192.168.99.100:/ ./Your_SmartPhone_Mount_Point// umount
$ fusermount -u ./Your_SmartPhone_Mount_Point
2013年6月14日 星期五
Xen with IPv6
請先確認 Dom0 已經建立好 IPv6 連線
Dom0 :
已建立好與 Server 連接的端點 (sit0、sit1),另外有另外可以使用的網段,把他設定在 DomU 網路的共用接口
DomU :
Dom0 :
已建立好與 Server 連接的端點 (sit0、sit1),另外有另外可以使用的網段,把他設定在 DomU 網路的共用接口
# ifconfig eth0 inet6 add 2001:470:f902::1/48
// radvd - Router Advertisement Daemon
# apt-get install radvd
# vi /etc/radvd.conf
interface eth0 #The interface used to send ADV# /etc/init.d/radvd restart
{
AdvSendAdvert on; #Enable Advertisements
#AdvManagedFlag on; #Enable Managed bit
#AdvOtherConfigFlag on; #Enable Other Configure bit
MinRtrAdvInterval 3; #Set min. interval to send adv.
MaxRtrAdvInterval 10; #Set max. interval to send adv.
prefix 2001:470:f902::/48 #Prefix
{
AdvOnLink on; #Adv. Using Link Layer
AdvAutonomous on; #Autonomous Flag
#AdvRouterAddr on;
};
};# echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
DomU :
# ifconfig eth0 inet6 add 2001:470:f902::2/48
# route -A inet6 add ::/0 dev eth0
# route -A inet6 // show ipv6 route
$ ping6 2001:470:f902::2/48 // gateway
$ ping6 2600::
訂閱:
文章 (Atom)
