Hunter的大杂烩 技术学习笔记

2014-12-15

SuseLinux ganglia 图片出错处理

Filed under: 技术话题 — hunter @ 4:52 pm

apache error_log文件中

1.  出现:sh: /usr/bin/rrdtool: No such file or directory
修改  conf_default.php,

$conf[‘rrdtool’] = “/usr/local/rrdtool/bin/rrdtool”;

2. 出现:

(process:4017): Pango-CRITICAL **: No fonts found:
This probably means that the fontconfig
library is not correctly configured. You may need to
(more…)

2014-12-09

获取百度查询结果的真实链接脚本

Filed under: 技术话题 — hunter @ 2:56 pm

#!/bin/sh

page=0

echo > 3.txt

for (( page = 0; page < 70; page=page+10)) do urlStr="http://www.baidu.com/s?wd=keyword%20site%3Aicaifu.com&pn=”$page”&rsv_spt=1&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8″

(more…)

bash shell script sample

Filed under: 技术话题 — hunter @ 2:54 pm

用来提取sql中的两个变量值

sql:UPDATE XXXX SET `SEQ` = ‘123456’, yyy=’xxx’ where SEQ = 123457
#!/bin/sh

int_regex=([0-9]+)

grep UPDATE pg.sql |grep HK_SAKCHMJSHH|while read line
do
first_seq_pos=`echo $line|awk ‘{print index($0,”x60SEQx60 = x27″)}’`
second_seq_pos=`echo $line|awk ‘{print index($0, “SEQ = “)}’`

if [ $first_seq_pos -ne $second_seq_pos ];then
((first_seq_pos=$first_seq_pos+9))
((second_seq_pos=$second_seq_pos+6))
first_seq=`echo $line |awk -v pos=”$first_seq_pos” ‘{print substr($0, pos, 8) }’`
second_seq=`echo $line |awk -v pos=”$second_seq_pos” ‘{print substr($0, pos, 8) }’`
echo $first_seq
if [[ $first_seq =~ ([0-9]+) ]];then
echo “match:”${BASH_REMATCH[1]}
fi
echo $second_seq
exit
fi

done

2014-09-15

异常处理之ThreadException、unhandledException及多线程异常处理[转]

Filed under: 技术话题 — hunter @ 12:52 pm

from:http://www.cnblogs.com/luminji/archive/2011/01/05/1926033.html

异常处理之ThreadException、unhandledException及多线程异常处理

 

一:ThreadException和unhandledException的区别

处理未捕获的异常是每个应用程序起码有的功能,C#在AppDomain提供了UnhandledException 事件来接收未捕获到的异常的通知。常见的应用如下: 

(more…)

2014-09-11

bash flock

Filed under: 技术话题 — hunter @ 9:34 pm
#!/bin/bash
{
flock -xn 3
if [ $? -ne 0 ];then
echo “Aready runing…”
exit 1
fi
do some thing here

} 3<>/tmp/`basename $0`.lock


« Newer PostsOlder Posts »

Powered by WordPress