ITeye博客

c#

共 20 篇文章

单线程 文件查找

using System; using System.Collections.Generic; using System.Text; using System.IO; namespace ThreadTest { public class SingleFileSearch { private long c = 0; public void Search(string dir, string fileName) { string[] fileList = Directory.GetFiles(dir); foreach (string file in fileList) { int start…

2010-02-06 17:14 · c# · C · C++ · C#

多线程 多线程文件查找

using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.IO; namespace ThreadTest { public class FileSearch { private int threadCount; object obj = new object(); private Stack<string> fileList; private List<Thread> tlist; private string serachStr; priv…

2010-02-06 17:13 · c# · C · C++ · C# · thread · 多线程

C# BCD编码解码

(1)BCD码(二到十进制编码) 人们通常习惯使用十进制数,而计算机内部多采用二进制表示和处理数值数据, 因此在计算机输入和输出数据时,就要进行由十进制到二进制的转换处理。 把十进制数的每一位分别写成二进制形式的编码,称为二进制编码的十进制数, 即二到十进制编码或BCD(Binary Coded Decimal)编码。 BCD码编码方法很多,通常采用8421编码,这种编码方法最自然简单。 其方法使用四位二进制数表示一位十进制数,从左到右每一位对应的权分别是 23、22、21、20,即8、4、2、1。例如十进制数1975的8421码可以这样得出 1975(D)=0001 1001 0111 0…

2010-01-13 15:21 · c# · C · C++ · C#

chm

经常碰到一些 CHM 格式的帮助文档出现乱码无法阅读的情况,而且 CHM 文档不像浏览器一样,右键可以选择字符编码,非常不便。究其原因,主要就是 CHM 文档在页面中没有指定合适的字符编码所致。 CHM 的实质是 HTML 文件。一般情况下没有指定字符编码的 CHM 是调用 Internet Explorer 浏览器的字符编码设定来显示 CHM 文件的。 在注册表 HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International 下有 AutoDetect 和 Default_CodePage 2个键名,就是 IE 浏览…

2009-12-24 09:10 · c# · HTML · 浏览器 · Windows · Microsoft · IE

mapInfo

mapINfo 2005

2009-12-04 17:57 · c#

Asp.Net中Excel操作权限的问题

原创 Asp.Net中Excel操作权限的问题 收藏 提示权限不足,具体的提示内容如下: 检索 COM 类工厂中 CLSID 为 {00024500-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 80070005。 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.UnauthorizedAccessException: 检索 COM 类工厂中 CLSID 为 {00024500-0000-0000-C000-000000000046} …

2009-12-03 20:58 · c# · ASP.net · ASP · .net · IIS · Excel

How to configure Office applications to run under the interactive user account

We do not recommend or support Automation to a Microsoft Office application from an unattended user account. For more information about why we do not recommend Automation in this context, click the following article number to view the article in the Microsoft Knowledge Base: 257757 (http://support.…

2009-12-03 20:48 · c# · VBA · Microsoft · Access · Office · Excel

c# 操作Excel 权限问题

Web.config上添加了“” 近日在打开原来写的一个网页程序运行时,出现了Excel操作权限的问题,具体的说就是在代码中调用下面这段与Excel操作有关的语句时, Application curExcelApp = new ApplicationClass(); 提示权限不足,具体的提示内容如下: 检索 COM 类工厂中 CLSID 为 {00024500-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 80070005。 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细…

2009-12-03 20:46 · c# · C · C++ · ASP.net · C# · Excel

C#操作excel sheet

[code="java"] C#操作excel sheet 这里有个VB.NET利用数组的例子,自己改改好了 .NET下 从 DataView DataSet DataTable 导出数据至Excel Public Sub Exports2Excel(ByVal Dtg As DataGrid) If Dtg.VisibleRowCount > 0 Then Try Me.Cursor = Cursors.WaitCursor Dim datav As New DataView If TypeOf Dtg.DataSource Is DataView Then datav = CType(D…

2009-12-01 20:58 · c# · C · C++ · C# · Microsoft · Excel

C# 对Excel表格的操作

using Excel; using System.Reflection; namespace getData { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { //1.创建Exl应用程序对象,并显示与否. Excel.Application xApp = ne…

2009-12-01 20:52 · c# · C · C++ · C# · Excel

C# 版芊芊静听

/Files/hcmfys/csttplayer.rar

2009-09-11 15:05 · c# · C · C++ · C#

c# 屏幕截屏工具

最近没事,开发了个截屏工具 模仿qq截屏功能!! 下载地址 /Files/hcmfys/CsSreenCutImage.rar

2009-09-03 16:19 · c# · C · C++ · C# · QQ

c++ point

介绍 曾碰到过让您迷惑不解、类似于int * (* (*fp1) (int) ) [10];这样的变量声明吗?本文将由易到难,一步一步教会您如何理解这种复杂的C/C 声明:我们将从每天都能碰到的较简单的声明入手,然后逐步加入const修饰符和typedef,更有函数指针,最后介绍一个能够让您准确地理解任何C/C 声明的“右左法则”。需要强调一下的是,复杂的C/C 声明并不是好的编程风格;我这里仅仅是教您如何去理解这些声明。注意:为了确保能够在同一行上显示代码和相关注释,本文最好在至少1024x768分辨率的显示器上阅读。 基础 让我们从一个很简单的例子开始,如下: int n; 这个应该被理…

2009-05-06 12:15 · c# · C · C++ · C++Builder · C# · XP

代码格式化 JAVA c# CodeFormat

using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace jsCodeFormater { /// <summary> /// 代码格式化工具 V 0.1 /// Author:hcmfys@163.com 小光棍 /// 2008-11-11 光棍节 /// 还有错误 /// </summary> public class CodeFormater { private Hashtable _choiceElement; private Hash…

2008-11-11 17:50 · c# · C · Java · C++ · C#

ASP.Net中自定义Http处理及应用之HttpModule篇 (转载)

HttpHandler实现了类似于ISAPI Extention的功能,他处理请求(Request)的信息和发送响应(Response)。HttpHandler功能的实现通过实现IHttpHandler接口来达到。而HttpModule实现了类似于ISAPI Filter的功能。 HttpModule的实现 HttpModules实现了类似于ISAPI Filter的功能,在开发上,通常需要经过以下步骤: 1.编写一个类,实现IhttpModule接口 2.实现Init 方法,并且注册需要的方法 3.实现注册的方法 4.实现Dispose方法,如果需要手工为类做一些清除工作,可以添加Disp…

2008-09-17 16:14 · c# · 应用服务器 · ASP.net · ASP · .net · Web

c# Dos Tree

用法DOS 命令 发现 Tree 命令很有趣 就用C# 写了一个 写得不好请指教 http://files.cnblogs.com/hcmfys/code.rar using System; using System.Collections.Generic; using System.Text; using System.IO; namespace com.qiuSmile { public class FileTree { /// <summary> /// 此程序是模仿DOS tree功能 /// 作者 相思雨 hcmfys@163.com /// 2008-09-14 中秋节 // 使…

2008-09-15 18:31 · c# · C · C++ · J# · C# · DOS

ASP.net防止SQL注入方法

1、sql注入比较难防,需要替换select,delete等一打字符 其实对于字符型替换再多都没有替换单引号为两个单引号来的好!对于数字型替换再多都没有用,一定要类型转换。 2、忽略DropDownList传来的东西 其实是不对的,一切客户端的东西都是不可信任的,select下拉框也是!因为可以自己做一个htm提交到服务器。 3、access比sqlserver不安全 安全不安全关键看怎么用,如果sqlserver还是像access一样用,一个sa帐户的话,很明显,sqlserver比access不安全,可以直接得到表名和字段名!access反而倒安全点了,因为只能通过逐位猜解得到。 4、网…

2008-07-11 15:22 · c# · ASP.net · ASP · SQL · .net · Access

FTPFactory.cs

using System; using System.Net; using System.IO; using System.Text; using System.Net.Sockets; namespace FtpLib { public class FTPFactory { private string remoteHost, remotePath, remoteUser, remotePass, mes; private int remotePort, bytes; private Socket clientSocket; private int retValue; private Bo…

2008-06-12 09:27 · c# · Socket · REST · .net

c#.net常用函数和方法集

、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=currentTime.Month; 1.4 取当前日 int 日=currentTime.Day; 1.5 取当前时 int 时=currentTime.Hour; 1.6 取当前分 int 分=currentTime.Minute; 1.7 取当前秒 int 秒=curre…

2008-05-27 11:43 · c# · C · C++ · 中国移动 · C# · .net

c# 生成小图

/// <summary> /// /// </summary> /// <param name="img">图片对象</param> /// <param name="fileName">将要保传的文件路径</param> /// <param name="targetX">要生成图片的宽度</param> /// <param name="targetY">要生成图片的高度<</param> private void genreateSmallImage(Bitmap img, string fileName, int targetX, int targetY) { int w = im…

2008-05-22 11:39 · c# · C · C++ · C#