RSS 2.0 Feed
2003-10 Entries
摘要:     以前在开发进总是把一些版权信息以及更新信息忘记。虽然有Ctrl+C(V) 但总是感觉很麻烦。今天看了一下VS.NET 的结构,找到可以解决这个问题的方法。原来,VS.NET 在添加类时是使用很多向导模板。不同的语言也有不同的模板,如C# 的所有模板在 X:\Program Files\Microsoft Visual Studio .NET 2003\VC#  中 。那我就可以开始动手了 找到 VC#目录下的  VC#Wizards\CSharpAddClassWiz 里面有一个 Template 目录,打开,又是一个 叫 2052 的目录(2052 是中文 ID ),目录里有我们要的 NewCSharpFile.cs 文件,打开它进行修改。 /*功能说明:最后更新: 点缀 更新时间: CopyRight 2003 Weblogs.3322.orgTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALLTHE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ORSERVICES; LOSS OF USE, DATA, OR PROFITS;......[阅读全文]

posted @ | Feedback (2) | Filed Under [ C# 工作日记 ]

摘要:    很多域名注册服务商都有一个很COOL的服务,就是搜索某个域名得到它的详细注册信息。其实我们也能做到这一点。以下是一些重要性步骤: 1.得到你的Whois 服务器的地址:    Dns.Resolve(cc + ".whois-servers.net").AddressList[0]  //cc 为一级域名。如 COM,NET,ORG等2.连接Whois 服务器的 43 端口:    s.Connect(new IPEndPoint(Dns.Resolve(cc + ".whois-servers.net").AddressList[0], 43));3.最后发送你要查询的域名,以及回车结束:    s.Send(Encoding.ASCII.GetBytes(domain + "\r\n"));4.你就能收到域名的详细信息了。 你也可以使用telnet 来实现。如我要查询 www.163.com 的注册信息。  telnet com.whois-servers.net 43[enter]  163.com[enter] ...[阅读全文]

posted @ | Feedback (7) | Filed Under [ MS DotNET ]

摘要:FxCop 1.23     FxCop is a code analysis tool that checks .NET managed code assemblies for conformance to the Microsoft .NET Framework Design Guidelines. It uses reflection, MSIL parsing, and callgraph analysis to inspect assemblies for more than 200 defects in the following areas: naming conventions, library design, localization, security, and performance . FxCop includes both GUI and command line versions of the tool, as well as an SDK to create your own rules. For use with .NET Framework version 1.0 (4.20 MB) For use with .NET Framework version 1.1 (4.20 MB) Reflector for .NET     Reflector is a class browser,......[阅读全文]

posted @ | Feedback (2) | Filed Under [ ASP.Net C# MS DotNET ]

摘要:最近在开发一个专业的网站,在工作完成后对性能进行了一些测试与分析。发现很多值得我们注意的地方。   系统有三层:Control (UI ) 、DataProvider (Data) 、Components (Base)     后台使用MS Sql Server 2000 ,数据层通过 存储过程来完成所有的数据操作。并编写了一个IDataProvider 接口来定义所有的操作。UI 层只是通过调用IDataProvider 来实现所有的功能。 一开始我们使用的方法: SqlDataProvider dp = new SqlDataProvider();dp.Data_registerUser (User user);   这样就有了一个问题,当一个页面包含大量控件时,会产生很多的SqlDataProvider 对象,而SqlDataProvider 运行库到项目后期已经非常庞大(已经达到250K左右)。这样在.NET 中已经算80K以上的大对象了。大量创建大对象会非常严重地影响性能。    那就没有好的方法来解决一下吗?其实,我们不需要创建怎么多对象的。只要有一个SqlDataProvider 对象在内存中就可以了。这样我们想到了 ASP.NET 中的 System.Web.Caching.Cache 类,我们对代码进行了修改。添加了一个类。 //---------------  缓冲 SqlDataProvider.SqlDataProvide ----public class DataProvider {public static IDataProvide Instance() {Cache cache = System.Web.HttpContext.Current.Cache;if ( cache["IDataProviderBase"] == null ) {String assemblyPath = "SqlDataPrvider.dll";  String className = "SqlDataProvider.SqlDataProvide";assemblyPath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath + "/bin/" + assemblyPath); try {cache.Insert( "IDataProvide", Assembly.LoadFrom( assemblyPath).GetType( className ).GetConstructor(new Type[0]), new CacheDependency( assemblyPath ) );}catch (Exception) {HttpContext.Current.Response.Write("<b>ERROR:</b> Could not locate file: <code>" + assemblyPath + "</code> or could not locate class <code>" + className......[阅读全文]

posted @ | Feedback (11) | Filed Under [ ASP.Net C# ]

摘要:新的方法,通过JScript 来读取服务端文件的方法。 <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><script language=jscript >function init(){divBuildStamp.startDownload( "buildnumber.txt", onDownloadDone );}function onDownloadDone { divBuildStamp.innerText = "Build: " + s;}</script><body onload="init()"><SPAN ID="divBuildStamp" STYLE="behavior: url(#default#download); color: silver; font-size: 8pt;"></SPAN></body></html>...[阅读全文]

posted @ | Feedback (8) | Filed Under [ 工作日记 ]

摘要:Add a combobox to the form.Add a textbox to the form.Size of combobox = x, y (eg. 100, 22)Size of textbox = x-12, y (eg. 88, 20)Location needs to match. (eg. 70, 124)this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e){textBox1.Text = comboBox1.Text;}Add the following to the form load event:comboBox1.Items.Add("Item 1");comboBox1.Items.Add("Item 2");comboBox1.Items.Add("Item 3");Issues:You have to double click textbox to give it focus.SelectAll method doesn't work.Notes:You can also use a textbox, listbox, and a button to create a virutal editable combobox.Consider adding the following to the load event to advoid specifing the width and location of the controls:textBox1.Bounds = comboBox1.Bounds;textBox1.Width =......[阅读全文]

posted @ | Feedback (2) | Filed Under [ 工作日记 ]

摘要: 很多开发者都想要一个非常强大的程序日志管理库,能够了解用户对应用程序的使用情况。当程序出现问题时,可以通过分析日志来了解问题之所在。    过去我们总是用一种很简单的方式来处理日志,即:使用一个日志文件,当程序有问题时就要求用户提供这个文件。但常常日志文件不是没有,就是已经被删除。  Log4net 是著名的 log4j for Java 项目的一部分。它是由 www.neoworks.com 的一个团队开发出来,支持多种方式的日志。如 ADO (MS Sql Server 等),File (文件), Console (控制台),EventLog (系统日志),SMTP(邮件方式)... 而且支持所有的.Net 平台: Microsoft .Net Framework 1.0 (1.0.3705) Microsoft .Net Framework 1.1 (1.1.4322) Microsoft .Net Compact Framework 1.0 (1.0.5000) Mono 0.25 or higher (Linux 下的) Microsoft Shared Source CLI 1.0 (就是MS 开发源代码的 .Net 运行库)  如果你要了解更详细的信息:  log4net Site  (好象下载有点问题,怎么也下载不了。也有可能是我这边网络的问题)  Using  log4Net  (一篇很专业的使用指南,花了不少时间才找到的)  log4net.dll  (我找到的编译好的 log4net.dll 文件,可以直接加入你的工程。)...[阅读全文]

posted @ | Feedback (6) | Filed Under [ ASP.Net MS DotNET ]