12 2012 档案

摘要:1 /* 首先将窗体的边框样式修改为None,让窗体没有标题栏 2 * 实现这个效果使用了三个事件:鼠标按下、鼠标弹起、鼠标移动 3 * 鼠标按下时更改变量isMouseDown标记窗体可以随鼠标的移动而移动 4 * 鼠标移动时根据鼠标的移动量更改窗体的location属性,实现窗体移动 5 * 鼠标弹起时更改变量isMouseDown标记窗体不可以随鼠标的移动而移动 6 */ 7 private bool isMouseDown = false; 8 private Point FormLocation; //form的location 9 private Point ... 阅读全文
posted @ 2012-12-28 11:19 宁静.致远 阅读(2608) 评论(1) 推荐(0) 编辑
摘要:1 #region 2 public static void ToDownload() 3 { 4 string downloadPath = "f:/temp/eclipse-SDK-3.6.1-win32.zip"; 5 string savename = "eclipse-3.6.1.zip"; 6 ToDownloadOrOpen(downloadPath, savename, "attachment"); 7 //ToDownloadOrOp... 阅读全文
posted @ 2012-12-27 18:16 宁静.致远 阅读(236) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 时间格式转换 3 /// </summary> 4 public static void DateTimeToString() 5 { 6 DateTime dt = DateTime.Now; 7 Console.WriteLine(dt); 8 Console.WriteLine(dt.ToString("yyyy-M-dd h:m:ss")); //12小时制 9 C... 阅读全文
posted @ 2012-12-27 18:14 宁静.致远 阅读(287) 评论(0) 推荐(0) 编辑
摘要:1 public static void Main() 2 { 3 /* 4 * 参数类型分为 in, ref, out 三种,默认为 in。 5 * in 类型在子方法中修改了对应变量后,主方法中的值不会发生改变。 6 * ref 类型在子方法中修改了对应变量后,主方法中的值也会发生改变。 7 * out 主方法中对应的变量不需要初始化。 8 * 9 */10 int a... 阅读全文
posted @ 2012-12-27 18:13 宁静.致远 阅读(229) 评论(0) 推荐(0) 编辑
摘要:View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ActionDelegate 7 { 8 delegate void OutputInfo(string str,int count); 9 10 class Program11 {12 private static string str = "hello world";13 private stati... 阅读全文
posted @ 2012-12-27 18:09 宁静.致远 阅读(155) 评论(0) 推荐(0) 编辑
摘要:View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.IO; 6 7 namespace Files 8 { 9 class Program 10 { 11 static byte[] byDataValue = new byte[200]; 12 static char[] charDataValue = new char[200]; 13 ... 阅读全文
posted @ 2012-12-27 18:08 宁静.致远 阅读(216) 评论(0) 推荐(0) 编辑
摘要:View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace Sort 7 { 8 class Tree 9 { 10 static void Main(string[] args) 11 { 12 BinarySearchTree nums = new BinarySearchTree(); 13 num... 阅读全文
posted @ 2012-12-27 18:06 宁静.致远 阅读(211) 评论(0) 推荐(0) 编辑
摘要:View Code 1 using System; 2 using System.IO; 3 using System.Net; 4 using System.Text; 5 using System.Security; 6 using System.Threading; 7 using System.Collections.Specialized; 8 using Sort; 9 10 namespace Sort 11 { 12 // <summary> 13 /// 记录下载的字节位置 14 /// </summary> 15 pub... 阅读全文
posted @ 2012-12-27 18:04 宁静.致远 阅读(335) 评论(0) 推荐(0) 编辑
摘要:1 #region 堆排序 2 /// <summary> 3 /// array是待调整的堆数组 4 /// i是待调整的数组元素的位置,length是数组的长度 5 /// </summary> 6 /// <param name="array"></param> 7 /// <param name="i"></param> 8 /// <param name="nLength"></param> 9 private static vo 阅读全文
posted @ 2012-12-27 18:02 宁静.致远 阅读(162) 评论(0) 推荐(0) 编辑
摘要:1 #region KMP算法 2 /// <summary> 3 /// KMP算法 4 /// 求一个字符串的回溯函数。 5 /// 约定序列下标从0开始。 6 /// 回溯函数是整数集[0,n-1]到N的映射,n为字符串的长度。 7 /// 回溯函数的定义: 8 /// 设存在非空序列L,i为其合法下标; 9 /// L[i]的前置序列集为:{空集,L中所有以i-1为最后一个元素下标的子序列}10 /// L的前置序列集为... 阅读全文
posted @ 2012-12-27 18:01 宁静.致远 阅读(184) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 动态规划:背包问题 3 /// </summary> 4 private static void MaxVal() 5 { 6 int capacity = 16; //背包负重 7 int[] size = new int[] { 3,4,7,8,9 }; //物品大小 8 int[] values = new int[] { 4,5,10,11,13 }; //物品价值 ... 阅读全文
posted @ 2012-12-27 18:00 宁静.致远 阅读(160) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 希尔排序 3 /// 插入排序改进版本:分区插入 4 /// </summary> 5 /// <param name="list"></param> 6 private static int[] ShellSort(int[] list) 7 { 8 int inc; 9 for (inc = 1; inc <= list.Length / 9; inc = 3 * inc + 1) ;1... 阅读全文
posted @ 2012-12-27 17:59 宁静.致远 阅读(177) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 动态规划:求最大公共子串 3 /// LCS (Longest Common Subsequence) 4 /// </summary> 5 private static string LCS(string str1, string str2) 6 { 7 var d = new int[str1.Length, str2.Length]; 8 var index = 0; 9 ... 阅读全文
posted @ 2012-12-27 17:58 宁静.致远 阅读(316) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 生男生女问题 3 /// 题目:说澳大利亚的父母喜欢女孩,如果生出来的第一个女孩,就不再生了,如果是男孩就继续生, 4 /// 直到生到第一个女孩为止,问若干年后,男女的比例是多少? 5 /// </summary> 6 /// <param name="number"></param> 7 private static void BobyBorn(int number) 8 { 9 int boy... 阅读全文
posted @ 2012-12-27 17:57 宁静.致远 阅读(288) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 上楼梯算法(迭代) 3 /// </summary> 4 /// <param name="n"></param> 5 /// <returns></returns> 6 private static long fib3(int n) 7 { 8 long x = 0, y = 0, z = 1; 9 long w, k;10 11 for (int j = 0; j... 阅读全文
posted @ 2012-12-27 17:56 宁静.致远 阅读(626) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 基数排序 3 /// 原理:首先按个位数进行排序,再以十位数排序 4 /// LSD的排序方式由键值的最右边开始,而MSD则相反,由键值的最左边开始。 5 /// </summary> 6 /// <param name="v"></param> 7 /// <returns></returns> 8 public static int[] RadixSort(int[] v) 9 {10 ... 阅读全文
posted @ 2012-12-27 17:54 宁静.致远 阅读(182) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 归并排序_合并 3 /// </summary> 4 /// <param name="v"></param> 5 /// <param name="first"></param> 6 /// <param name="mid"></param> 7 /// <param name="last"></param> 8 public static int[ 阅读全文
posted @ 2012-12-27 17:53 宁静.致远 阅读(209) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 选择排序 3 /// 原理:每次找出最小的元素排在最前面 4 /// </summary> 5 /// <param name="arr"></param> 6 /// <returns></returns> 7 public static int[] SelectionSort(int[] ary) 8 { 9 int m = 0;10 for (int i = 0; i ... 阅读全文
posted @ 2012-12-27 17:51 宁静.致远 阅读(145) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 快速排序 3 /// 原理:将数组分成两组,前面一组比后面一组小,然后前后两组依次再次划分,直到全部有序 [ref List<int> nums] 4 /// </summary> 5 /// <param name="nums">待排序数组</param> 6 /// <param name="left">数组第一个数下标</param> 7 /// <param name="right">数组 阅读全文
posted @ 2012-12-27 17:50 宁静.致远 阅读(234) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 折半插入排序 3 /// </summary> 4 /// <param name="arr"></param> 5 /// <returns></returns> 6 public static int[] HalfInsertSort(int[] arr) 7 { 8 for (int i = 1; i < arr.Length; i++) 9 {10 i... 阅读全文
posted @ 2012-12-27 17:49 宁静.致远 阅读(254) 评论(0) 推荐(0) 编辑
摘要:1 /// <summary> 2 /// 直接插入排序(升序排列) 3 /// 原理:通过构建有序序列,对于未排序数据,在已排序序列中从后向前扫描,找到相应位置并插入 4 /// </summary> 5 /// <param name="arr"></param> 6 /// <returns></returns> 7 public static int[] InsertSort(int[] arr) 8 { 9 for (int i =... 阅读全文
posted @ 2012-12-27 17:44 宁静.致远 阅读(414) 评论(0) 推荐(0) 编辑
摘要:父对象页Cell cell = new Cell();//居中显示cell.WindowStartupLocation = WindowStartupLocation.CenterScreen;//绑定事件cell.pevent += new Cell.PassResultHandler(RefreshData);事件触发后调用RefreshData() 方法-------------------------子对象页面//申明委托 public delegate void PassResultHandler(List<ArchivesEntity.FileBox> boxlist) 阅读全文
posted @ 2012-12-26 16:10 宁静.致远 阅读(193) 评论(0) 推荐(0) 编辑
摘要:INI就是扩展名为"INI"的文件,其实他本身是个文本文件,可以用记事本打工,主要存放的是用户所做的选择或系统的各种参数. INI文件其实并不是普通的文本文件.它有自己的结构.由若干段落(SECTION)组成,在每个带括号的标题下面,是若干个以单个单词开头的关键字(KEYWORD)和一个等号,等号右边就是关键字的值(VALUE).例如: [Section1] KeyWord1 = Value1 KeyWord2 = Value2 ... [Section2] KeyWord3 = Value3 KeyWord4 = Value4 C#命名空间中没有直接读写INI的类,当然如 阅读全文
posted @ 2012-12-21 15:36 宁静.致远 阅读(1199) 评论(0) 推荐(0) 编辑
摘要:1 通过System.DBNull判断,网上大部分都使用这个方法。[csharp] view plaincopyprint?DataTable dt; //假设字段为name, dt已经保存了数据 dt.rows[0]["name"] == System.DBNull.Value; //判断第一行数据的name字段是否为空 DataTable dt; //假设字段为name, dt已经保存了数据dt.rows[0]["name"] == System.DBNull.Value; //判断第一行数据的name字段是否为空2 通过IsN... 阅读全文
posted @ 2012-12-17 11:22 宁静.致远 阅读(1127) 评论(0) 推荐(0) 编辑
摘要:REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" /v "1406" /t REG_DWORD /d "0" /f 阅读全文
posted @ 2012-12-14 17:55 宁静.致远 阅读(307) 评论(0) 推荐(0) 编辑
摘要:View Code 1 CREATE PROCEDURE dbo.Pr_SplitData 2 3 AS 4 5 DECLARE @Result INT 6 DECLARE @Res INT 7 8 --用于保存TMCountTemp表中的数据 9 DECLARE @UU INT 10 DECLARE @TempUU VARCHAR(8) 11 DECLARE @ComUU INT 12 DECLARE @Time ... 阅读全文
posted @ 2012-12-14 17:36 宁静.致远 阅读(573) 评论(0) 推荐(0) 编辑
摘要:public void WriteMessage(string filename, string message, string method) { string path = GetAssemblyPath() + @"\errorlog.txt"; FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite); using (StreamWriter sw = new StreamWriter(fs)) { sw.BaseStream.Seek(0, SeekOrigi 阅读全文
posted @ 2012-12-14 13:50 宁静.致远 阅读(145) 评论(0) 推荐(0) 编辑
摘要:int aa = 111;string aastr = aa.ToString("0000000");//或string aastr = aa.ToString().PadLeft(7,'0');string.Format(" {0:d7}", i);123.ToString("d7"); 阅读全文
posted @ 2012-12-14 13:36 宁静.致远 阅读(324) 评论(0) 推荐(0) 编辑
摘要:1、需要注意的是导入前需要打开sp_configure,执行以下代码即可ALTER PROCEDURE [dbo].[Openconfigure]ASBEGINexec sp_configure 'show advanced options',1 reconfigure exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure END2、另外还需要将SQL Full-text Filter Daemon Launcher和MSSQLSERVER登录帐户改为LocalSyatem3、最后执行下面sql 阅读全文
posted @ 2012-12-12 21:42 宁静.致远 阅读(300) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示