asp修改sqlserver数据库-日报表流量

<%server.ScriptTimeout=300%>
<%=now()%>
</br>检查流量流速日报表小时数据是否超标,若超标进行处理。</br>
请修改本文件18行中for e=0 to 30 的30为一次执行的天数。19行为起始日期。
<%
dim conn
dim connstr
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Driver={SQL Server};server=.;UID=root;PWD=root;database=UserDatabase"
conn.Open connstr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "连接报表数据库失败"
Response.End
End If
dim sql,a,b,c,d,e,f,g,sql1
for e=0 to 30 ‘一次修改天数
a = "2016-11-1 0:00:00" ‘起始日期
a=dateadd("d", e, a)
for d=0 to 23 ‘每小时的数据
b = dateadd("h", d, a)
c = dateadd("h", 1, b)
sql="SELECT flow_avg FROM 日报表 WHERE (日期时间 BETWEEN ‘"&b&"’ AND ‘"&c&"’)"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
do while not rs.eof
if rs("flow_avg")>160000 then
g=rs("flow_avg")/(150000+int(10000*rnd())) ‘生成15W-16W随机数
sql1="update 日报表 set flow_avg=flow_avg/"&g&",flow_max=flow_max/"&g&",flow_min=flow_min/"&g&",flow_pl=flow_pl/"&g&", velo_avg=velo_avg/"&g&",velo_max=velo_max/"&g&",velo_min=velo_min/"&g&" where (日期时间 BETWEEN ‘"&b&"’ AND ‘"&c&"’)"
conn.Execute(sql1)
response.write sql1
response.write "</br>"
end if
rs.movenext
loop
rs.close
set rs=nothing
next
next
Set Conn = Nothing
Set Connq = Nothing
%>

<%=now()%>

发表在 待分类 | asp修改sqlserver数据库-日报表流量已关闭评论

谷歌浏览器关闭更新提示

最后的支持XP的谷歌浏览器版本是49,但打开总会有提示不会再有更新。关闭这个提示的方法。在快捷方式后输入“ –disable-infobars”最前有个空格。

发表在 网络知识 | 谷歌浏览器关闭更新提示已关闭评论

CISCO2960 光口的使用

最近买了几个便宜的光口模块,想要测试下速度是不是真正的千兆。因为交换机上只有一个千兆口,两台交换机用千兆口连接后没有剩下的千兆口来测试速度。找了条命令

ping 192.168.1.40 repeat 60000 time 0 size 6000

结果如下:

shiyan#sh int g0/1//千兆光口
GigabitEthernet0/1 is up, line protocol is up (connected)
Hardware is Gigabit Ethernet, address is 18ef.6364.e809 (bia 18ef.6364.e809)
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,
reliability 255/255, txload 2/255, rxload 2/255
Encapsulation ARPA, loopback not set
Keepalive not set
Full-duplex, 1000Mb/s, link type is auto, media type is 1000BaseBX10-U SFP
input flow-control is off, output flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:05, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 11754000 bits/sec, 1210 packets/sec
5 minute output rate 11753000 bits/sec, 1211 packets/sec
954308 packets input, 1183604020 bytes, 0 no buffer
Received 192 broadcasts (186 multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 186 multicast, 0 pause input
0 input packets with dribble condition detected
955268 packets output, 1183524949 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 PAUSE output
0 output buffer failures, 0 output buffers swapped out
shiyan#sh interfaces fa0/1百兆电口
FastEthernet0/1 is up, line protocol is up (connected)
Hardware is Fast Ethernet, address is 18ef.6364.e801 (bia 18ef.6364.e801)
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 26/255, rxload 26/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 100Mb/s, media type is 10/100BaseTX
input flow-control is off, output flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 10414000 bits/sec, 1075 packets/sec
5 minute output rate 10413000 bits/sec, 1075 packets/sec
627786 packets input, 774598658 bytes, 0 no buffer
Received 17 broadcasts (15 multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 15 multicast, 0 pause input
0 input packets with dribble condition detected
627482 packets output, 773860212 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 PAUSE output
0 output buffer failures, 0 output buffers swapped out

//千兆电口
GigabitEthernet0/1 is up, line protocol is up (connected)
Hardware is Gigabit Ethernet, address is 18ef.6364.e809 (bia 18ef.6364.e809)
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,
reliability 255/255, txload 2/255, rxload 2/255
Encapsulation ARPA, loopback not set
Keepalive not set
Full-duplex, 1000Mb/s, link type is auto, media type is 10/100/1000BaseTX
input flow-control is off, output flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:20, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 11708000 bits/sec, 1204 packets/sec
5 minute output rate 11683000 bits/sec, 1201 packets/sec
2198198 packets input, 2718433681 bytes, 0 no buffer
Received 298 broadcasts (290 multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 290 multicast, 0 pause input
0 input packets with dribble condition detected
2197621 packets output, 2715736455 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 PAUSE output
0 output buffer failures, 0 output buffers swapped out

发现minute input rate的值都差不多。看来这个方法不行了。

光口模块调试最重要的就是看功率

show interfaces gigabitEthernet 0/1 transceiver detail

可以显示出电压、温度、功率等信息。

发表在 网络知识 | CISCO2960 光口的使用已关闭评论

IP PBX

语音交换系统。

今日看讯时的资料,发现了几款免费的ippbx软件,有燃起了我折腾的欲望。

我想要实现的功能是我用手机或者电脑,连接到公司的交换机系统里,能打公司的内线电话。因为有MX8的设备,硬件是具备了,软件就需要学习了。

首先,今日看到的几个文章:

Asterisk十问十答如何用asterisk搭建一个呼叫中心无线路由器集成纯软件VOIP PBX是发展方向freeswitchFreeSWITCH一分钟速成

asterisk的研发者又开发了freeswitch,但freeswitch较新,资料少。

 

发表在 待分类 | IP PBX已关闭评论

生成安卓apk证书

在java目录下有keytool软件

C:\Program Files\Java\jre1.6.0_03\bin

命令行运行
keytool -genkey -alias android.keystore -keyalg RSA -validity 20000 -keystore android.keystore

填写提示即可生成。

发表在 待分类 | 生成安卓apk证书已关闭评论

centos 添加静态路由

在etc/rc.local里添加
route add -net 192.168.200.0 netmask 255.255.255.0 gw 192.168.177.254

这样,每次开机这条静态路由都就生效了。

发表在 待分类 | centos 添加静态路由已关闭评论

centos开机运行PHP

sh.sh脚本内容


cd /www/web/default/
/www/wdlinux/php/bin/php -version
nohup /www/wdlinux/php/bin/php /www/web/default/502.php &? nohup /www/wdlinux/php/bin/php /www/web/default/9501.php & nohup /www/wdlinux/php/bin/php /www/web/default/alm.php &nohup /www/wdlinux/php/bin/php /www/web/default/post.php &

系统需要开机运行一些脚本,测试了多种方法才得到的结果。

首先,因为我的脚本运行的位置有要求,需要在固定的目录下执行,所以,先CD到制定目录。

php命令已经添加到PATH目录,在系统里运行不许要php的绝对地址,但开机运行的话总是提示我找不到目录,所以只能指定了。

&符号可以使其后台运行。nohup会使输出的结果保存下来,关闭命令框也能继续运行。

想要开机自动运行的关键是在etc/rc.local内添加代码:

sudo nohup sh /www/web/default/sh.sh

发表在 网络知识 | centos开机运行PHP已关闭评论

PHP socket收发数据


<?php
/*socket收发数据
@host(string) socket服务器IP
@post(int) 端口
@str(string) 要发送的数据
@back 1|0 socket端是否有数据返回
返回true|false|服务端数据
*/
function sendSocketMsg($host,$port,$str,$back=0){
$socket = socket_create(AF_INET,SOCK_STREAM,0);
if ($socket < 0) return false;
$result = @socket_connect($socket,$host,$port);
if ($result == false)return false;
socket_write($socket,$str,strlen($str));
if($back!=0){
$input = socket_read($socket,1024);
socket_close ($socket);
return $input;
}else{
socket_close ($socket);
return true;
}
}
$r=sendSocketMsg('192.168.1.204',1000,'hello word!',1);
echo $r;
?>

发表在 待分类 | PHP socket收发数据已关闭评论

PHP通过服务器端口数据模拟ping命令


<?php
/*
* @author???? lwl887
* @date?????? 20150705
* @email????? lwl887@163.com
* @function?? 根据服务器web端口模拟ping的php函数
*
*/
error_reporting(E_ERROR);
header("content-Type: text/html; charset=utf-8");
set_time_limit(600);
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
function ping($host,$port)
{
$time_start = microtime_float();
$ip = gethostbyname($host);
$fp = @fsockopen($host,$port,&$errno,&$errstr,1);
if(!$fp) return 'IP: '.$ip.' <font color="#FF0000"> timed out</font>.<br>';
$get = "GET / HTTP/1.1\r\nHost:".$host."\r\nConnection: Close\r\n\r\n";
@fputs($fp,$get);
@fclose($fp);
$time_end = microtime_float();
$time = $time_end - $time_start;
$time = ceil($time * 1000);
return 'IP: '.$ip.' time='.$time.'ms<br>';
}

function check($hostname,$hostIP,$hostport='80')
{
echo $hostname.'?? ';
echo ping($hostIP,$hostport);
}
$t=time();
echo date("Y-m-d H:i:s",$t);
check('服务器','192.168.1.10');
check('虚拟机','192.168.9.10');
check('总变录像机','192.168.168.11');
check('2线录像机','192.168.168.12');
check('3线录像机','192.168.168.13');
check('4线录像机','192.168.168.14');
check('实验线录像机','192.168.168.15');

for($i = 16;$i < 195;$i++)
{
$p='192.168.168.'.$i ;
check(' ',$p);
}
$t=time();
echo date("Y-m-d H:i:s",$t);
?>

发表在 待分类 | PHP通过服务器端口数据模拟ping命令已关闭评论

wincc版本与OPCxml问题

wincc我现在用的版本就是6.2和7.0sp3,这两个版本最好还是用xp来安装。

7.0的基本软件支持win7是没问题的,但是OPCxml就不行了,所以,7.0还是为xp设计的。

那么现在新电脑都装不上xp了,怎么办?想在win7上wincc7.0用opcxml怎么办?

答案是可以的,但是必须要求在安装wincc之前安装好IIS,如果安装过了在装IIS的话,我还没有找到方法。在装好win7后,正常装wincc,发现IIS里并没有OPCxml,因为wincc7.0的设计是xp的iis里的,新版的iis不支持。但是除了iis配置不对,别的都没问题,那就好说,iis恢复一下就可以。用我们的iis备份配置,恢复回去。能用了!

原生支持win7的wincc是7.3版本,因为7.2我也没用过,就且不说了,用wincc7.3的时候,x系统要求是win7sp1以上的,安装完所有组件都是正常的。另外WINCC7.3支持了更多的功能,比如OPC UA,这是最新的OPC标准了,也支持HTML5浏览器访问了,就是说以后手机也能直接访问了。是不是很心动??

wincc7.3的破解与wincc7.0更换文件名的方式又不一样了,必须替换一个文件,但据说还是很稳定的。安装了一下,风格与博途软件又近一步。变量的管理界面改变挺大的。期待应用!

发表在 应用软件 | wincc版本与OPCxml问题已关闭评论