04 2011 档案

摘要:代码摘自 http://topic.csdn.net/u/20101231/09/039bdd22-3f0a-4bbb-908e-d887b4d7bbfe.html?19933public static class Util{ // <summary> /// 检查身份证信息是否合法 /// 2010-10-13 jorln /// </summary> /// <param name="num">身份证号</param> /// <param name="sex">性别</param&g 阅读全文
posted @ 2011-04-18 20:00 梦幻泡影 阅读(418) 评论(0) 推荐(0) 编辑
摘要:public static class Util{ /// <summary> /// MBD compact method (c) 2004 Alexander Youmashev /// !!IMPORTANT!! /// !确保调用此方法前要压缩的数据库没有打开的连接,为防止万一,应在压缩前进行备份。 /// !!IMPORTANT!! /// </summary> /// <param name="connectionString">到源数据库的连接字符串,源数据库是指要压缩的数据库</param> /// <p 阅读全文
posted @ 2011-04-18 18:54 梦幻泡影 阅读(426) 评论(0) 推荐(0) 编辑
摘要:摘自 http://topic.csdn.net/u/20101231/09/039bdd22-3f0a-4bbb-908e-d887b4d7bbfe.html?19933"^\d+$" //非负整数(正整数 + 0)"^[0-9]*[1-9][0-9]*$" //正整数"^((-\d+)|(0+))$" //非正整数(负整数 + 0)"^-[0-9]*[1-9][0-9]*$" //负整数"^-?\d+$" //整数"^\d+(\.\d+)?$" //非负浮点数(正浮点数 阅读全文
posted @ 2011-04-17 19:33 梦幻泡影 阅读(304) 评论(1) 推荐(0) 编辑
摘要:/*----------------*//*** DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)*/// Declaring valid date character, minimum year and maximum yearvar dtCh= "/";var minYear=1900;var maxYear=2100;function isInteger(s){ var i; for (i = 0; i < s.length; i 阅读全文
posted @ 2011-04-17 14:47 梦幻泡影 阅读(689) 评论(0) 推荐(0) 编辑
摘要:可以在 Medium Trust Level 下运行的配置声明配置节<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" requirePermission="false"/>配置 <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <bytecode-pr 阅读全文
posted @ 2011-04-17 14:42 梦幻泡影 阅读(247) 评论(0) 推荐(0) 编辑
摘要:Process open = new Process();open.StartInfo.FileName = "explorer";open.StartInfo.Arguments = @"/select," + location;open.Start(); 阅读全文
posted @ 2011-04-16 11:30 梦幻泡影 阅读(779) 评论(0) 推荐(0) 编辑
摘要:/// <summary> /// Rar 是调用 rar 命令行的工具。 /// </summary> public class Rar { /// <summary> /// /// </summary> /// <param name="rarCommandPath">rar命令行工具在路径,例如:"C:\Program Files\WinRAR\rar.exe"</param> public Rar(string rarCommandPath) { this._RarComm 阅读全文
posted @ 2011-04-16 11:19 梦幻泡影 阅读(1090) 评论(0) 推荐(0) 编辑
摘要:<script type="text/javascript"> // // javascript 判断一个数字是不是身份证号 // 代码摘自 http: //topic.csdn.net/u/20110102/22/e79df4e8-7b0a-4c65-9490-1ef39837ff36.html?8841 function isChinaIDCard(StrNo) { StrNo = StrNo.toString() if (StrNo.length == 18) { var a, b, c if (!isInteger(StrNo.substr(0, 17) 阅读全文
posted @ 2011-04-16 11:15 梦幻泡影 阅读(869) 评论(0) 推荐(1) 编辑
摘要:代码从csdn复制,未做测试public static class ChineseNumberUtil{ /// <summary> /// 将中文数字转换成阿拉伯数字 /// </summary> /// <param name="cnNumber"></param> /// <returns></returns> static int ConverToDigit(string cnNumber) { int result = 0; int temp = 0; foreach (char c in c 阅读全文
posted @ 2011-04-15 14:55 梦幻泡影 阅读(914) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Text;using System.IO;using System.Linq;using System.Net;/// <summary>/// 实用工具类。这个类支持以get和post方法读取网页, 支持代理和cookie/// </summary>public class PageLoader{ public string _proxy = null; public string Proxy { get { return _proxy; } set { _proxy = value; } } class Trust 阅读全文
posted @ 2011-04-15 14:50 梦幻泡影 阅读(424) 评论(0) 推荐(0) 编辑
摘要:支持 info.A.B.C 这样的排序表达式 /// <summary> /// 在 linq 查询中使用字符串表达式进行排序 /// </summary> public static class OrderByStringExpressionExtensions { public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> source, string property) { return ApplyOrder<T>(source, property 阅读全文
posted @ 2011-04-14 19:04 梦幻泡影 阅读(678) 评论(0) 推荐(0) 编辑
摘要:namespace ExtensionMethods{ using System; using System.Collections.Generic; using System.Linq; public static class IEnumerableExtensions { /// <summary> /// Invokes a transform function on each element of a sequence and returns the minimum Double value /// if the sequence is not empty; otherwi 阅读全文
posted @ 2011-04-14 18:51 梦幻泡影 阅读(511) 评论(2) 推荐(0) 编辑
摘要:select id from infoid-----------123567810111215(11 行受影响)方法一:select (select max(id)+1 from Info where id<a.id) as beginId,(id-1) as endIdfrom Info awherea.id>(select max(id)+1 from Info where id<a.id)beginId endId----------- -----------4 49 913 14(3 行受影响)方法二:select beginId,(select min(id)-1 阅读全文
posted @ 2011-04-14 18:40 梦幻泡影 阅读(515) 评论(1) 推荐(0) 编辑
摘要:摘自 http://www.cnblogs.com/ejiyuan/archive/2009/07/20/1527224.html[代码] 阅读全文
posted @ 2011-04-14 17:03 梦幻泡影 阅读(329) 评论(0) 推荐(0) 编辑
摘要:///<summary> /// equiv of PHP's var dump for an object’s properties because i cbf writing all the properties out. ///</summary> ///<param name="info"></param> private static string var_dump(object info) { StringBuilder sb = new StringBuilder(); Type t = info.Get 阅读全文
posted @ 2011-04-14 16:59 梦幻泡影 阅读(1580) 评论(0) 推荐(0) 编辑
摘要:出处:http://blogs.thesitedoctor.co.uk/tim/2010/02/27/Collapse+All+Solution+Explorer+Items+In+Visual+Studio+2010.aspxImports SystemImports EnvDTEImports EnvDTE80Imports EnvDTE90Imports System.Diagnostics'-----------------------------------------------------------' CollapseAll Module'------- 阅读全文
posted @ 2011-04-14 16:42 梦幻泡影 阅读(686) 评论(0) 推荐(0) 编辑
摘要:public class ExportDataGirdViewToExcel { /// <summary> /// 将DataGirdView数据,导出EXCEL文件。需要下载 MyXls。 /// 代码摘自 http://topic.csdn.net/u/20101231/09/039bdd22-3f0a-4bbb-908e-d887b4d7bbfe.html?19933 /// </summary> /// <param name="dgv">DataGridView控件名称</param> /// <param 阅读全文
posted @ 2011-04-14 16:27 梦幻泡影 阅读(684) 评论(0) 推荐(0) 编辑
摘要:public static class ProtectConfigFileUtil{ /// <summary> /// 加密配置节示例,加密 ConnectionStrings 和 AppSettings /// </summary> [Obsolete("这个方法只是示例")] public static void ProtectConnectionStringsAndAppSettings(HttpContext context) { Configuration config = WebConfigurationManager.OpenWebC 阅读全文
posted @ 2011-04-14 08:11 梦幻泡影 阅读(289) 评论(0) 推荐(0) 编辑
摘要:/// <summary> /// Form1 的构造函数 /// </summary> public Form1() { InitializeComponent(); this.Left = Screen.PrimaryScreen.WorkingArea.Right - this.Width; this.Top = Screen.PrimaryScreen.WorkingArea.Bottom - this.Height; } 阅读全文
posted @ 2011-04-14 07:52 梦幻泡影 阅读(714) 评论(1) 推荐(0) 编辑
摘要:摘自 csdn// 看了看别的资料有提取CPU,MAC的现成代码却没有硬盘序列号,找了好久才找到提取硬盘序列号的参数。于是自己给补上了。 <script> function disk() {//硬盘序列号 信息 var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); var properties = service.ExecQuery("SELECT * FROM Win32_D 阅读全文
posted @ 2011-04-13 16:39 梦幻泡影 阅读(1619) 评论(0) 推荐(0) 编辑
摘要:/// <summary> /// ChunkHelper 帮助将序列分成若干块。 /// /// 如果 totalItemCount 是 11,chunkSize 是 5,则: /// chunk[0] 0, 1, 2, 3, 4 /// chunk[1] 5, 6, 7, 8, 9 /// chunk[2] 10 /// </summary> public class ChunkHelper { /// <summary> /// /// </summary> /// <param name="totalItemCount&q 阅读全文
posted @ 2011-04-13 16:27 梦幻泡影 阅读(272) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Text;using System.IO;using System.Linq;public static partial class FileUtil{ #region 删除目录和文件 /// <summary> /// 删除目录及其下面的所有子目录和文件。如果目录有只读属性,则先去掉只读属性,然后删除。 /// </summary> /// <param name="path"></param> public static void DeleteDirectory(stri 阅读全文
posted @ 2011-04-13 14:12 梦幻泡影 阅读(501) 评论(0) 推荐(0) 编辑
摘要:use my_databasego--删除外键约束DECLARE c1 cursor forselect 'alter table ['+ object_name(parent_obj) + '] drop constraint ['+name+']; 'from sysobjectswhere xtype = 'F'open c1declare @c1 varchar(8000)fetch next from c1 into @c1while(@@fetch_status=0)beginexec(@c1)fetch next f 阅读全文
posted @ 2011-04-13 13:49 梦幻泡影 阅读(206) 评论(0) 推荐(0) 编辑
摘要:%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /u pathpausepath 是 exe 文件的路径 阅读全文
posted @ 2011-04-13 13:16 梦幻泡影 阅读(193) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Text;using System.Security.Cryptography;using System.IO;using System.Linq;//摘自 http://topic.csdn.net/u/20101231/09/039bdd22-3f0a-4bbb-908e-d887b4d7bbfe.html?19933#region 对称加密类 /// <summary> /// 对称加密解密类 /// </summary> public static class SymmetricEncryptClass { # 阅读全文
posted @ 2011-04-12 15:57 梦幻泡影 阅读(330) 评论(0) 推荐(0) 编辑
摘要:摘自http://topic.csdn.net/u/20101231/09/039bdd22-3f0a-4bbb-908e-d887b4d7bbfe.html?19933using System;using System.Text;using System.Security.Cryptography;/// <summary>/// 非对称加密类/// </summary>public static class AsymmetricEncrytClass{ #region 自动生成公钥、私钥方法 /// <summary> /// 自动生成非对称公钥、私钥 阅读全文
posted @ 2011-04-12 13:16 梦幻泡影 阅读(255) 评论(0) 推荐(0) 编辑
摘要:HttpResponse 的 Filter 属性是一个 Stream,通过重写这个流的方法,可以对 response 对象的输出进行修改。自定义 filter 时,如果直接从 Stream 派生新类,则必须要实现 Stream 的全部抽象方法,而实际应用中,只有 Write 方法才是创建过滤器时最关心的。这里的 HttpResponseFilter抽象类可以提供一点方便。 /// <summary> /// ResponseFilter 提供一个基类,从此类继承可以方便地创建筛选器类。 /// 子类只须实现 Write 方法,而不必费心于 Stream 类其他抽象方法的实现。 // 阅读全文
posted @ 2011-04-11 15:30 梦幻泡影 阅读(890) 评论(1) 推荐(1) 编辑