比如以下的代码就是用来测试用正则表达式匹配从0xff到0xffff的字符。而值范围在0到0xfe的所有字符是不能被匹配的。 以下为引用的内容:[code]Regexregex=newRegex(@"[/u00FF-/uFFFF]+"); //Thecharacters,whoesvaluearesmallerthan0xff, //arenotexpectedtobematched. for(inti=0;i<0xff;i++){ strings=newstring(newchar[]{(char)i}); Debug.Assert(!regex.IsMatch(s),stri...
http://www.jb51.net//article/16278.htm
Parseerror:syntaxerror,unexpected$endinscript.phponlinexx调试了一会后发现产生错误的行是文件中间某行//$str.="?>\n";想起来了PHP解释器允许的结尾标记那行还可以用单行注释,即//$str.="?>\n";被解释成结尾标记前有注释,注释的内容是//$str.=",而?>后面的\n";会被解释作PHP块外的内容按HTML输出出去!结果是给$str.="?>\n";这行添加//成注释后,反而多了个?>的结束标记,造成原来真正的结束标记成了意料之外的(unexpected)了。解决办法就是直接删掉这一行...
http://www.jb51.net//article/16273.htm
新建一个专门用来创建验证码图片的页面ValidateCode.aspx它的后台cs文件代码如下:PageLoad[code]privatevoidPage_Load(objectsender,System.EventArgse){stringcheckCode=CreateRandomCode(4);Session["CheckCode"]=checkCode;CreateImage(checkCode);}[/code]其中CreateRandomCode是自定义的函数,参数代表验证码位数[code]privatestringCreateRandomCode(intcodeCount){st...
http://www.jb51.net//article/16239.htm
一Undefined类型只有一种值undefined以下三种情况typeof返回类型为undefined1.当变量未初始化时2.变量未定义时3.函数无明确返回值时(函数没有返回值时返回的都是undefined)undefined并不等同于未定义的值typeof并不真正区分是否是未定义看以下示例代码:varoTemp;alert(typeofoTemp);//outputs"undefined"alert(typeofoTemp2);//outputs"undefined"alert(oTemp2==undefined);//错误oTemp2未定义不能使用除了typeof之外的不能用来oTemp...
http://www.jb51.net//article/16238.htm
不过写的时候倒是按传统C式语法结构写的,.net中的一些方便的数据结构倒是没有使用,偶然看到.net2.0支持泛型,用了一下,呵呵,不错!我这个懒人可有福了!这就写下来,做个笔记!程序代码[code]Console.WriteLine("ListTest:");//声明一个整型的ListList<int>lsTest=newList<int>();lsTest.Add(7);lsTest.Add(5);lsTest.Add(1);lsTest.Add(3);stringstrTest="";//list的排序lsTest.Sort();//list的遍历foreach(...
http://www.jb51.net//article/16234.htm
拖一个gridview控件上去,然后在Page_Load里编写代码,当然我是手动用代码绑定的,这里使用了DataAdapter,它的构造函数接受了一个sql字符串和Connection对象,用它可以不必打开和关闭Connection对象,DataAdapter会自行处理,还用到了DateSet,这里新建了一个空的DateSet对象,并调用DataAdapter的Fill方法填充数据,然后通过设定GridView的数据源,调用它的DataBind方法就实现了数据绑定。程序代码[code]OleDbConnectionconn=newOleDbConnection();conn.Connectio...
http://www.jb51.net//article/16233.htm
ASP.net处理文件上传就简单的多了,我呢也是在学习中,顺便写写学习笔记。先在表单中添加enctype="multipart/form-data"再拖一个FileUpload和一个Button控件,接下来写代码,单文件上传就三句代码:程序代码[code]protectedvoidPage_Load(objectsender,EventArgse){if(FileUpload1.HasFile){FileUpload1.SaveAs(Server.MapPath(FileUpload1.FileName));Response.Redirect(Request.Url.ToString());}...
http://www.jb51.net//article/16232.htm
无奈之下,基于现实的考虑,看来还是选.NET吧,起码在我所处的这个城市,这个平台可以给我带来工资上的微薄提升!说开始就开始,先来熟悉数据库的操作,慢慢将ASP的操作用ASP.NET过一遍操作:连接数据库,读取表中数据采用的是OLEDB方式读取Access数据库,需要引入System.Data.OleDb[code]protectedvoidPage_Load(objectsender,EventArgse){OleDbConnectionconn=newOleDbConnection();conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4...
http://www.jb51.net//article/16231.htm
连接数据库只要在web.config中:<appSettings><addkey="SocutDataLink"value="data.mdb"/></appSettings>下面我记下每个小例子的主要代码过程:1、ACCESS+GridView+数据读取+简单分页例子。aspx文件:<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default"%><%@RegisterAssembly="AspNetPager"Namespac...
http://www.jb51.net//article/16227.htm
使用方法:IpSearch.GetAddressWithIP("202.96.128.167")CS类代码[code]usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;//引入的命名空间usingSystem.IO...
http://www.jb51.net//article/16197.htm
[code]usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usingSystem.IO;usingSystem.Collections.Generic;using...
http://www.jb51.net//article/16193.htm
