旌旗博客

2007-02-27

.NET Framework doesn’t work

归类于: I.T. — 标签: — rocky @ 18:03

    My Windows XP SP2 got update notification of Visual Studio 2005 SP1, but it failed to install. And after that, my .NET applications don’t work any more. I uninstalled all my .NET frameworks and visual studio 2005, but I cannot install .NET framework 2.0 anymore. The setup program complains that “Error occurred while initializing fusion. Fusion could not load fusion with LoadLibraryShim()”. This occurs when installing Microsoft.VisualBasic.Vsa.dll. After struggling for several hours, finally I found a cleanup tool to resolve this problem: http://astebner.sts.winisp.net/Tools/dotnetfx_cleanup_tool.zip. Thanks to astebner

2007-02-15

在网上买到票了

归类于: I.T. — rocky @ 13:22

    垂直搜索网站的确给了用户很大的方便。推荐一下:http://piao.qikoo.com/

    列一下网上转让信息的统计信息,不难看出车票最紧张的时候同时也是转让最多的时候。n多人手上拿了两张甚至三、四张票,人为造成车票紧张的现象。黄牛党害死人啊。

 

转让票数

北京始发线路 2007-02-15 2007-02-16 2007-02-17
北京 - 上海 1050张 843张 44张

情人节的玫瑰花

归类于: Life — rocky @ 09:46

      坐班车的时候听人说蓝色妖姬卖到260一枝,疯了。

2007-02-09

系统监控使用短信进行通知

归类于: I.T. — 标签: — rocky @ 18:11

code.screen, div.codescreen{
font-family: monospace;
font-size: 1em;
display: block;
padding: 10px;
border: 1px solid #bbb;
background-color: #eee;
color: #000;
overflow: auto;
border-radius: 2.5px;
-moz-border-radius: 2.5px;
margin: 0.5em 2em;
}

1、发送短信:

       原来我是利用bj1860的邮箱的短信通知进行发短信,调用sendmail发送邮件就可以了。这个是要一条1毛钱的,现在公司有了移动的信息机,自然要好好利用了。只是信息机不是托管在IDC,也没有固定IP。没关系,劳动人民的力量是无穷的。

       1.1 我们先来做个动态dns。外面有些做DDNS服务的,但是也是要钱的。穷人有穷人的活法:
         在信息机上做个计划任务,每10分钟执行一次这个批处理:

d:\\cygwin\\bin\\wget -O ip.txt http://穷人的服务器/ddns/registerip.php

         穷人的服务器上有个registerip.php:

<?php    
   echo $_SERVER["REMOTE_ADDR"];
   $handle = fopen ("ip.txt","w");
   fwrite($handle,$_SERVER["REMOTE_ADDR"]);
   fclose ($handle); 
?> 

         这样就在服务器上生成了一个记录了信息机网关IP的文件http://穷人的服务器/ddns/ip.txt。在服务器上要想访问信息机,还需要在信息机的网关的上做端口映射才行。             

       1.2 在服务器上做个shell程序以方便的调用信息机上的发送短信接口:

         信息机上的发送短信接口为:http://信息机IP/sendSMS.php?phoneNumber=手机号&content=短信内容。于是向单个手机号发送短信的shell程序sendsms.sh:


#!/bin/bash
declare -a smscontent=`echo $2 | sed -e "s/\ /+/g"`         #URL中的参数里用+代替空格
`wget -q -O - http://穷人的服务器/ddns/ip.txt | sed -e "s/^/wget -q -O - http:\/\//g" | sed -e "s/$/\/sendSMS.jsp?phoneNumber=$1\&content=$smscontent/g" | sed -e "s/\&/\\\&/g" `  #从ip.txt取得IP地址,然后再前面加上"wget -q -O - http://",在后面加上"\sendSMS.jsp?phoneNumber=$1\&content=$smscontent",再执行这条命令

         我们有多个人想得到通知,简单,再做个多发送的shell程序sendsms2.sh:


#!/bin/bash
echo $1 | awk -F";" '{for (i=NF;i>0;--i) print "/home/rocky/sendsms.sh ",$i," "}' | sed -e "s/$/$2;/g" | csh

         这样向多个手机号发送短信就这样写就行了:


sendsms2.sh "13910920000;13911060000" "短信内容"

 

2、定期监控:

    1.1 监控磁盘空间:

          监控如果/var空间使用率超过85%则发送告警,使用crontab -e增加一条,每天9点15分检查:


15 09 * * * df | grep "/var" | awk '{ print $5 }' | awk -F"\%" '{print $1}' | awk '{ if ($1 > 85){print "/usr/local/bin/sendsms2.sh \"13910920000;13911060000\" \"insufficient+disk+space+on+server\" "} }' | csh

    1.1 监控oracle连接数如果超过100则告警,9点到23点之间每半小时检查一次:

*/30 9-23 * * * ps -ef | grep oracle | wc -l | awk '{ if ($1 > 100){print "/usr/local/bin/sendsms2.sh \"13910920000;13911060000\" \"too many oracle connections\" "} }' | csh

2007-02-07

2007年2月6日

归类于: Life — rocky @ 10:53

      从相识、相知、相爱,一路走来已经有十余载,终于领到了红灿灿的结婚证,从此两个人的命运维系在了一起。

2007-02-01

Upload image with Windows Live Writer

归类于: I.T. — 标签: — rocky @ 17:37

Windows Live Writer (wlw) is a cool blog tool. But sometimes I got a error message from wlw while my post had an image within. My blog system is WordPress 2.1 running on PHP 5.20. Here is a solution:

Modify from line 138 of wp-includes/class-IXR.php as below:

 

    function parse() {
        // first remove the XML declaration
       $rx = '/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m';
       if (preg_match($rx, $this->message, $m)) {
               $encoding = strtoupper($m[1]);
       } else {
               $encoding = "UTF-8";
       }
//        $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message);
//        if (trim($this->message) == '') {
//            return false;
//        }
        $this->_parser = xml_parser_create($encoding);

    
Now I succeeded in uploading those magnificent pictures which have special characters in its file name.

Powered by WordPress