- 200 - 請求已成功,請求所希望的響應頭或數據體將隨此響應返回。
- 206 - 服務器已經成功處理了部分 GET 請求
- 301 - 被請求的資源已永久移動到新位置
- 302 - 請求的資源現在臨時從不同的 URI 響應請求
- 400 - 錯誤的請求。當前請求無法被服務器理解
- 401 - 請求未授權,當前請求需要用戶驗證。
- 403 - 禁止訪問。服務器已經理解請求,但是拒絕執行它。
- 404 - 文件不存在,資源在服務器上未被發現。
- 500 - 服務器遇到了一個未曾預料的狀況,導致了它無法完成對請求的處理。
- 503 - 由于臨時的服務器維護或者過載,服務器當前無法處理請求。
HTTP 協議狀態碼定義可以參閱:Hypertext Transfer Protocol -- HTTP/1.1
posted @
2013-01-05 12:11 一凡 閱讀(242) |
評論 (0) |
編輯 收藏
Shell 調用系統時間變量 獲取今天時期:`date +%Y%m%d` 或 `date +%F` 或 $(date +%y%m%d) 獲取昨天時期:`date -d yesterday +%Y%m%d` 獲取前天日期:`date -d -2day +%Y%m%d` 依次類推比如獲取10天前的日期:`date -d -10day +%Y%m%d` 或n天前的 `date -d "n days ago" +%y%m%d` 明天:`date -d tomorrow +%y%m%d` 注意以上中間有空格 時間域 % H 小時(00..23) % I 小時(01..12) % k 小時(0..23) % l 小時(1..12) % M 分(00..59) % p 顯示出AM或PM % r 時間(hh:mm:ss AM或PM),12小時 % s 從1970年1月1日00:00:00到目前經歷的秒數 % S 秒(00..59) % T 時間(24小時制)(hh:mm:ss) % X 顯示時間的格式(%H:%M:%S) % Z 時區 日期域 % a 星期幾的簡稱( Sun..Sat) % A 星期幾的全稱( Sunday..Saturday) % b 月的簡稱(Jan..Dec) % B 月的全稱(January..December) % c 日期和時間( Mon Nov 8 14:12:46 CST 1999) % d 一個月的第幾天(01..31) % D 日期(mm/dd/yy) % h 和%b選項相同 % j 一年的第幾天(001..366) % m 月(01..12) % w 一個星期的第幾天(0代表星期天) % W 一年的第幾個星期(00..53,星期一為第一天) % x 顯示日期的格式(mm/dd/yy) % y 年的最后兩個數字( 1999則是99) % Y 年(例如:1970,1996等) 注意:只有超級用戶才有權限使用date命令設置時間,一般用戶只能使用date命令顯示時間。
posted @
2012-11-05 15:32 一凡 閱讀(4974) |
評論 (0) |
編輯 收藏
#/bin/bash
del_user() {
echo "請輸入用戶名:"
read user
echo "請確認是否刪除(y/n)?"
read isDel
if [ $isDel = 'y' ]; then
userdel -r $user
echo -e "\t\t\t\t|------------------------------|"
echo -e "\t\t\t\t|------- 用戶 '$user' 已刪除 ------|"
echo -e "\t\t\t\t|------------------------------|"
fi
}
add_user() {
echo "請輸入用戶名:"
read user
useradd $user -d /work/$user
passwd $user
echo -e "\t\t\t\t|------------------------------|"
echo -e "\t\t\t\t|------- 用戶 "$user" 已創建 ------|"
echo -e "\t\t\t\t|------------------------------|"
}
menu() {
while :
do
echo "1.添加用戶"
echo "2.刪除用戶"
echo "0.退出"
echo -e "\n請選擇:"
read choice
case $choice in
1) add_user;;
2) del_user;;
0) exit;;
*) menu;;
esac
done
}
menu
posted @
2012-10-17 11:25 一凡 閱讀(267) |
評論 (0) |
編輯 收藏
git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
打開vim,執行如下命令:
:BundleInstall
:BundleSearch
:BundleClean
.vimrc
" For vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" vim-scripts repos
Bundle 'bash-support.vim'
Bundle 'perl-support.vim'
filetype plugin indent on
"let g:winManagerWindowLayout = "FileExplorer"
let g:winManagerWindowLayout = "FileExplorer|TagList"
map <c-w><c-f> :FirstExplorerWindow<cr>
map <c-w><c-b> :BottomExplorerWindow<cr>
map <c-w><c-t> : WMToggle<cr>
let g:persistentBehaviour=0
let g:winManagerWidth=30
nmap <silent><F8> :WMToggle<cr>
posted @
2012-08-24 18:23 一凡 閱讀(1450) |
評論 (0) |
編輯 收藏
sed -i "s/zhangsan/lisi/g" `grep -l zhangsan zzzzz_*`
posted @
2012-08-10 17:40 一凡 閱讀(215) |
評論 (0) |
編輯 收藏
1、修改機器名
$sudo vi /etc/hostname
2、修改時區
$rm /etc/localetime
$ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localetime
posted @
2012-07-12 11:33 一凡 閱讀(788) |
評論 (1) |
編輯 收藏
引自:http://blog.csdn.net/lyuan13141234/article/details/5667570
在linux下,編譯鏈接的時候,經常會遇到這樣一個問題,undefined reference to.....,引起這個問題的原因在于在鏈接的時候缺少選項。下面舉幾個例子,并給出解決辦法。
1、undefined reference to `dlerror'
undefined reference to `dlopen'
undefined reference to `dlerror'
解決辦法:在makefile的LDFLAGS后面把選項 -ldl 添加上即可。
2、undefined reference to `main'
解決辦法:在makefile的LDFLAGS后面添加 -nostartfiles 選項。
3、undefined reference to `pthread_setspecific'
undefined reference to `pthread_key_delete'
undefined reference to `pthread_key_create'
解決辦法:在makefile的LDFLAGS后面添加 -lpthread 選項。
4、undefined reference to `clock_gettime'
解決辦法:在makefile的LDFLAGS后面添加 -lrt 選項。
不過要注意的是,如果undefined reference to后面的內容是在自己的文件中聲明或定義的東西,就不能用這種方法來解決了。這時就需要檢查一下自己的makefile涉及到源文件、頭文件的地方是否出錯了,也有可能是其他的原因。
posted @
2012-07-04 17:29 一凡 閱讀(5306) |
評論 (1) |
編輯 收藏
注意:如果找不到google.protobuf,在protobuf目錄下執行
$ find . -name *.egg
./python/setuptools-0.6c11-py2.7.egg
./python/dist/protobuf-2.4.1-py2.7.egg
將這兩個文件加用戶環境
export PYTHONPATH=$SRC_DIR/protobuf-2.3.0-py2.5.egg:$SRC_DIR/setuptools-0.6c9-py2.5.egg
protocol buffer的安裝
$ wget "http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2"
$ tar jxvf protobuf-2.4.1.tar.bz2
$ cd protobuf-2.4.1
$ ./configure
$ make
$ make check
$ make install
protocol buffer對python的支持
$ cd python/
$ python setup.py test
$ python setup.py install
python需2.5以上版本1、下載最新版:http://www.python.org/download/
2、安裝
$./configure
$make
$make install
與google Ad Exchange 代表處索取requester.tar.gz
$tar zxvf requester.tar.gz
$cd requester
$make
$python2.7 requester.py --url=http://127.0.0.1:8000 --max_qps=1 --requests=1
posted @
2012-07-03 15:27 一凡 閱讀(1391) |
評論 (0) |
編輯 收藏
代碼如下:(
說明:在車東代碼的基礎上加了ie和firefox兼容部分及html)測了幾款手機:
小米:: 自帶瀏覽器:
支持 iphone4s:: safari:
不支持 QQ瀏覽器:
不支持 UC8.3.1:
不支持NOKIA5238::自帶瀏覽器:
支持 UC8.3:
不支持<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script defer language="javascript" type="text/javascript">
document.onclick = clickStat;
function clickStat() {
// 創建空html標簽
e=arguments[0]||window.event;
var image=document.createElement("img");
//image.alt="abc";
image.height=0;
image.width=0;
x=e.clientX;
y=e.clientY;
//記錄點擊坐標
image.src="http://localhost:8080/r?width=" + screen.width + "&x=" + x + "&y=" + y;
//向服務器發送數據
document.body.insertBefore(image);
return true;
}
</script>
</head>
<body>
測試abc
</body>
</html>
posted @
2012-04-26 17:01 一凡 閱讀(3828) |
評論 (1) |
編輯 收藏
本文實現二叉樹的遞歸創建、遍歷及深度計算。即輸入:abd##e##cf###(按二叉樹結構輸入)
二叉樹:

返回結果如下:

完整代碼如下:
#include <stdio.h>
//樹結構
typedef struct tree {
char data;
struct tree *lchild, *rchild;
} tree;
//創建樹
struct tree* create_tree() {
char node_data;
scanf("%c", &node_data);
if(node_data == '#') {
return NULL;
} else {
struct tree *T = NULL;
T = (struct tree*)malloc(sizeof(struct tree));
T->data = node_data;
T->lchild = create_tree();
T->rchild = create_tree();
return T;
}
}
//先序遍歷
void pre_traverse(struct tree *T) {
if(T == NULL) {
return;
} else {
printf("%c\t", T->data);
pre_traverse(T->lchild);
pre_traverse(T->rchild);
}
}
//中序遍歷
void mid_traverse(struct tree *T) {
if(T == NULL) {
return;
} else {
mid_traverse(T->lchild);
printf("%c\t", T->data);
mid_traverse(T->rchild);
}
}
//后序遍歷
void aft_traverse(struct tree *T) {
if(T == NULL) {
return;
} else {
aft_traverse(T->lchild);
aft_traverse(T->rchild);
printf("%c\t", T->data);
}
}
//深度
int tree_deepth(struct tree *T) {
int i,j;
if(!T) {
return 0;
} else {
if(T->lchild)
i = tree_deepth(T->lchild);
else
i = 0;
if(T->rchild)
j = tree_deepth(T->rchild);
else
j = 0;
return i > j ? (i + 1) : (j + 1);
}
}
int main(int argc, char **argv) {
struct tree *T = create_tree();
if(T) {
printf("%s\n", "先序:");
pre_traverse(T);
printf("\n%s\n", "中序:");
mid_traverse(T);
printf("\n%s\n", "后序:");
aft_traverse(T);
printf("\n%s\n", "深度:");
int deepth = tree_deepth(T);
printf("%d\n", deepth);
printf("\n");
}
return 0;
}
posted @
2012-04-09 17:19 一凡 閱讀(305) |
評論 (0) |
編輯 收藏