| 寂寞的季节's profile冷色调的非情感-BlogPhotosBlogLists | Help |
|
冷色调的非情感-BlogDecember 02 javascript在vs2003中调试随笔[转]以前开发时很少用到javascript,现在由于项目需要得开始学习javascript javascript的调试问题一直困扰我 有没有单步调试脚本的办法呢? 后经过人家指点,知道一简单方法随笔记录如下: 1。设置IE高级选项,把禁止调试去掉 2。让后打开你要调试的页面 3。回到vs2003中,选择工具-调试进程--选择explorer.exe--附加--选择script确定 4.选择debug-window-running document 这样就可以单步运行你的客户端脚本了 在Fitch and Mather 7.0项目中发现2个常用的javascript 1。页面启动时聚焦某一个文本框 例如页面中有一个文本框 <asp:textbox id="b" runat="server">start</asp:textbox> 加入下面的脚本 function window_onload() { if (document.all.b) { document.all.b.select(); document.all.b.focus(); } } 再添加 <body onload="window_onload()"> 2。文本框内容改变时的互清除内容 例如页面中有2个文本框 <asp:textbox id="b" onpropertychange="OnEditHandler()" runat="server"></asp:textbox> <asp:textbox id="a" onpropertychange="OnEditHandler()" runat="server"></asp:textbox> var inHandler=false; function OnEditHandler() { if(inHandler) return; inHandler=true; var srcId = event.srcElement.id;
if( srcId == "a" ) { document.all.b.value = ""; } else if( srcId == "b" ) { document.all.a.value = ""; } inHandler=false; } 这样当a中内容改变时,就清空b中的文本,同样当b中内容改变时,就清空a中的文本 November 25 Asp.net 学习网站名称:快速入门 地址:http://chs.gotdotnet.com/quickstart/ 描述:本站点是微软.NET技术的快速入门网站,我们不必再安装.NET Framework中的快速入门示例程序,直接在网上查看此示例即看。 名称:微软官方.NET指导站点 地址:http://www.gotdotnet.com/ 描述:上面的站点是本站的一个子站点,本站点提供微软.NET官方信息,并且有大量的用户源代码、控件下载,微软.NET开发组的人员也经常在此站点发表一些指导性文章。 名称:SourceForge 地址:http://www.sourceforge.net 描述:世界上最大的Open Source项目在线网站,上面已经有.NET的各种大型Open Source项目上千件,包括SharpDevelop、NDoc、Mono等都是在此站点发布最新源代码信息。 名称:CodeProject 地址:http://www.codeproject.com 描述:很多非官方的中小型示例源代及文章,相当全面,基本上我们想要的各种方面的资料都可以在此处查找。 名称:Fabrice's weblog 地址:http://dotnetweblogs.com/FMARGUERIE/Story/4139.aspx 描述:这是一个WebLog形式的在线日志网站,定期更新,包括.NET相关的工具、混淆器、反编译器等各种信息,十分值得收藏。 名称: 地址:http://www.aspalliance.com/aldotnet/examples/translate.aspx 描述:c#翻译为vb.net,提供一个文本框,将你的C#源代码贴进去,就可以帮你翻译成VB.NET语法。 名称:CSharpHelp 地址:http://www.csharphelp.com 描述: 专业的C#语言在线帮助网站,主要提供C#语言方面的技术文章。专业性很强。 名称:DotNet247 地址:http://www.dotnet247.com 描述:最好的索引网站,分别按照门类及命名空间的索引,也提供了Microsoft KB知识库。 名称:ASP.NET 地址:http://www.asp.net 描述:微软.NET webform的老巢,资料和实例代码都非常难得。 名称:微软.NET Winform 地址:http://www.windowsforms.net/ 描述:微软.NET Winform的老巢。 名称:微软 KnowledgeBase 地址:http://support.microsoft.com/ 描述:微软知识库,开发的时候遇到的怪问题,可能会在这里找到答案。 名称:MSDN 地址:http://msdn.microsoft.com/ 描述:这个就不用多说了吧,虽然出了中文MSDN,但是资料还是不够全,英文的就什么都有了。 名称:HotScripts 地址:http://www.hotscripts.com/ 描述:Welcome to HotScripts.com, the net’s largest PHP, CGI, Perl, javascript and ASP script collection and resource web portal. We currently have 24,004 scripts across 11 different programming languages and 1,240 categories, as well as links to books, articles, as well as programming tips and tutorials. 名称:ASPAlliance 地址:http://www.aspalliance.com/ 描述:提供相当丰富的文章和示例代码,思路匮乏的时候可以找找思路 名称:CSDN文档中心 地址:http://dev.csdn.net/ 描述:中文的,资料还算丰富,可以作为国内首选。 名称:DOTNET中华网 地址:http://www.aspxcn.com/ 描述:2002-2003年的时候这个站点很不错的,不过现在好像管理不得力,有点疲软,资料更新也不过及时,论坛里人也不够热心了,因为希望它好起来,所以列出来。资料都比较老,不过有些D版的东西还可以。提供很多学习代码。 名称:中国DotNet俱乐部 地址:http://www.chinaspx.com/ 描述:有点公司背景的网站,很健壮,资料更新及时,比较丰富。论坛解答也不错。 名称:【孟宪会之精彩世界】 地址:http://dotnet.aspx.cc/ 描述:MS-MVP的个人站点,包括了他所有的经验文章,还是很值得一看的。 名称:dotNET Tools.org 地址:http://www.dotnettools.org 描述:ccboy,也就是CSDN的小气的神的站点,里面有很多关于.NET等的好东东。 名称:博客堂 地址:http://blog.joycode.com/ 描述:半官方性质的MS-MVP汇集blog,大家可以在这里接触到最新的技术,了解发展趋势,对技术的探索等等,优秀的文章。 名称:DotNetBips.com - Applying .NET 地址:http://www.dotnetbips.com/ 描述:该站点的文章,涉及到了整个.NET,从底层的IL到语言到架构,文章很多,质量还不错。 名称:C# Frequently Asked Questions 地址:http://blogs.msdn.com/csharpfaq/ 描述:The C# team posts answers to common questions 名称:正则表达式 地址:http://www.regexplib.com/ 描述: 正则表达式学习站点 名称:WINDOW formS FAQ 地址:http://www.syncfusion.com/FAQ/Winforms/ 描述:常见的forms faq问题,很多问题都可以在这里找到答案。 名称:ASP.NET 常用类库说明 地址:http://www.123aspx.com/rotor/default.aspx 描述:不用多说,看标题就知道是关于asp.net的名称空间的 名称:ASP.NET System.Web.Mail 地址:http://www.systemwebmail.com/faq/3.8.aspx 描述:邮件发送常见问题解决方法 名称:VB.NET & C# 比较 地址:http://www.harding.edu/USER/fmccown/WWW/vbnet_csharp_comparison.html 描述:VB.NET跟C#语法区别 名称:VB.NET架构师 BLOG 地址:http://panopticoncentral.net/ 描述:不用多说,想了解VB.NET的朋友不可不去的站点(PS,不知道我有没有记错是不是这个地址) 名称:索克论坛 地址:http://www.sorke.com/bbs/Boards.asp 描述:我想应该是国内最好的第三方.NET控件的下载基地 November 18 十进制转16进制 、十进制转二进制#include "string.h" November 11 How to call a Visual C# method asynchronouslyHow to call a Visual C# method asynchronously
This article was previously published under Q315582
On This PageSUMMARYThe Microsoft .NET Framework makes it easy to call functions asynchronously. Calling functions asynchronously causes the system to execute them in the background on a secondary thread while the calling function continues to do other work. In a typical (synchronous) function call, the function is executed right away on the same thread that made the call. The calling function waits for the call to complete and receives the results of the call before continuing. By contrast, when you make an asynchronous call, you retrieve the results of the asynchronous call later. This article demonstrates how to do this by using Visual C#. RequirementsThe following list outlines the recommended hardware, software, network infrastructure, and service packs that are required:
How To Make Asynchronous CallsAsynchronous calls are made by using delegates. A delegate is an object that wraps a function. Delegates provide a synchronous function and also provide methods for calling the wrapped function asynchronously. Those methods are BeginInvoke() and EndInvoke(). The parameter lists of these methods vary depending on the signature of the function that the delegate wraps. Note that the Visual Studio .NET IntelliSense feature does not display BeginInvoke() and EndInvoke(), so you do not see them appear in the function lists as you type.BeginInvoke() is used to initiate the asynchronous call. It has the same parameters as the wrapped function, plus two additional parameters that will be described later in this article. BeginInvoke() returns immediately and does not wait for the asynchronous call to complete. BeginInvoke() returns an IAsyncResult object. The EndInvoke() function is used to retrieve the results of the asynchronous call. It can be called anytime after BeginInvoke(). If the asynchronous call has not completed yet, EndInvoke() blocks until it completes. The parameters of the EndInvoke() function includes the out and ref parameters that the wrapped function has, plus the IAsyncResult object that is returned by BeginInvoke(). The following is an example of a delegate and its BeginInvoke() and EndInvoke() methods: There are four common ways to use BeginInvoke() and EndInvoke() to make asynchronous calls. After you call BeginInvoke(), you can:
LongRunningMethod() simulates a function that runs for long time by sleeping. It returns the sleep time and the ID of the thread that executes it. If you call it asynchronously, you find that the thread ID of the executing thread is different from that of the calling thread.The first step is to define the delegate that wraps the function:
Sample 1: Calling A Method SynchronouslyThis sample demonstrates how to call LongRunningMethod() synchronously by using a MethodDelegate delegate. The other samples contrast this by making calls asynchronously.
Sample 2: Calling A Method Asynchronously by Using the EndInvoke() Call PatternIn this section, the sample invokes the same method asynchronously. The call pattern that is used is to call BeginInvoke, do some work on the main thread, and then call EndInvoke(). Note that EndInvoke() does not return until the asynchronous call has completed. This call pattern is useful when you want to have the calling thread do work at the same time that the asynchronous call is executing. Having work occur at the same time can improve the performance of many applications. Common tasks to run asynchronously in this way are file or network operations.
Sample 3: Calling A Method Asynchronously And Using A WaitHandle To Wait For The Call To CompleteIn this section, the sample calls the method asynchronously and waits for a WaitHandle before it calls EndInvoke(). The IAsyncResult that is returned by BeginInvoke() has an AsyncWaitHandle property. This property returns a WaitHandle that is signaled when the asynchronous call completes. Waiting on a WaitHandle is a common thread synchronization technique. The calling thread waits on the WaitHandle by using the WaitOne() method of the WaitHandle. WaitOne() blocks until the WaitHandle is signaled. When WaitOne() returns, you can do some additional work before you call EndInvoke(). As in the previous sample, this technique is useful for executing file or network operations that would otherwise block the calling main thread.
Sample 4: Calling A Method Asynchronously by Using the Polling Call PatternIn this section, the sample polls the IAsyncResult object to find out when the asynchronous call has completed. The IAsyncResult object that is returned by BeginInvoke() has an IsCompleted property that returns True after the asynchronous call completes. You can then call EndInvoke(). This call pattern is useful if your application does ongoing work that you do not want to have blocked by a long-running function call. A Microsoft Windows application is an example of this. The main thread of the Windows application can continue to handle user input while an asynchronous call executes. It can periodically check IsCompleted to see if the call has completed. It calls EndInvoke when IsCompleted returns True. Because EndInvoke() blocks until the asynchronous operation is complete, the application does not call it until it knows that the operation is complete.
Sample 5: Executing a Callback When an Asynchronous Method CompletesIn this section, the sample provides a callback delegate to the BeginInvoke() function that the system executes when the asynchronous call completes. The callback calls EndInvoke() and processes the results of the asynchronous call. This call pattern is useful if the thread that initiates the asynchronous call does not need to process the results of the call. The system invokes the callback on a thread other than the initiating thread when the asynchronous call completes.To use this call pattern, you must pass a delegate of type AsyncCallback as the second-to-last parameter of the BeginInvoke() function. BeginInvoke() also has a final parameter of type object into which you can pass any object. This object is available to your callback function when it is invoked. One important use for this parameter is to pass the delegate that is used to initiate the call. The callback function can then use the EndInvoke() function of that delegate to complete the call. This call pattern is demonstrated below.
AppDomain和Assembly动态装载、卸载DLLtry { //取得类名 string PortOrClass=(string)CfgRow["PortOrClass"]; //创建 AppDomainSetup 对象 AppDomainSetup setup = new AppDomainSetup(); // setup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory; //新域的 config 和本域公用一个 setup.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; //安全级别相同 Evidence adevidence = AppDomain.CurrentDomain.Evidence; //创建新的子,应用程序[域] aDoc = AppDomain.CreateDomain(PortOrClass,adevidence,setup); //用新的域动态加载,dll(dllpath 是完全路径) //动态加载的类必须继承 MarshalByRefObject 要不就是有 out ref 参数的必须,自己试验吧 object o = aDoc.CreateInstanceFromAndUnwrap(dllpath,PortOrClass); //转换为 ILibService 接口(这是一个接口) ilibService =(ILibService)o; //调用函数 ilibService.ServiceExec(inParams,out outParams,acc,AppPath); } catch(Exception ex) { throw ex; } finally { //释放 if (ilibService !=null) { ilibService.Dispose(); } //卸载域,加载的dll也会被释放 if (aDoc !=null) { AppDomain.Unload(aDoc); } } October 25 怎么感觉朋友越来越少了 不知不觉的电话少了,短信少了,QQ也不在跳跃,一切都很安静,不知道是自己把自己给锁起来了 还是正在被外界所排斥.
感觉自责感越来越重,有种说不出的味道!
人与人之间到底是个什么关系,是自己来界定,还是通过世俗连接!
October 09 常用正则表达式常用正则表达式 正则表达式用于字符串处理、表单验证等场合,实用高效。现将一些常用的表达式收集于此,以备不时之需。 匹配中文字符的正则表达式: [\u4e00-\u9fa5] 匹配双字节字符(包括汉字在内):[^\x00-\xff] 匹配空白行的正则表达式:\n\s*\r 匹配HTML标记的正则表达式:<(\S*?)[^>]*>.*?</\1>|<.*? /> 匹配首尾空白字符的正则表达式:^\s*|\s*$ 匹配Email地址的正则表达式:\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* 匹配网址URL的正则表达式:[a-zA-z]+://[^\s]* 匹配帐号是否合法(字母开头,允许5-16字节,允许字母数字下划线):^[a-zA-Z][a-zA-Z0-9_]{4,15}$ 匹配国内电话号码:\d{3}-\d{8}|\d{4}-\d{7} 匹配腾讯QQ号:[1-9][0-9]{4,} 匹配中国邮政编码:[1-9]\d{5}(?!\d) 匹配身份证:\d{15}|\d{18} 匹配ip地址:\d+\.\d+\.\d+\.\d+ 匹配特定数字: 匹配特定字符串: 原载地址:http://lifesinger.3322.org/myblog/?p=185 |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|