2012年11月6日

摘要: 先准备一段代码using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DotTraceTestDemo { class Program { static void Main(string[] args) { var start = Environment.TickCount; var array = Enumerable.Range(1, 5).Select(i ... 阅读全文
posted @ 2012-11-06 14:37 HTTP500 阅读(220) 评论(0) 推荐(0)
摘要: .NET开发环境安装最佳顺序Windows操作系统Internet Information Server(IIS)SQL ServerOfficeVisual Studio(VS)引用:http://minglu.blog.51cto.com/5430123/1033392 阅读全文
posted @ 2012-11-06 13:24 HTTP500 阅读(159) 评论(0) 推荐(0)
摘要: 使用ApacheBench做网站压力测试http://blog.csdn.net/paulluo0739/article/details/4335948使用ApacheBench进行网站压力测试,是较为简单方便的方法。该工具软件可在Apache的bin目录下找到,文件名为ab,用法介绍如下:Usage: ./ab [options] [http://]hostname[:port]/pathOptions are:-n requests 全部请求数-c concurrency 并发数-t timelimit 最传等待回应时间-p postfile POST数据文件-T content... 阅读全文
posted @ 2012-11-06 11:18 HTTP500 阅读(164) 评论(0) 推荐(0)
摘要: 临时表与永久表相似,但临时表存储在 tempdb 中,当不再使用时会自动删除。临时表有两种类型:本地和全局。它们在名称、可见性以及可用性上有区别。本地临时表的名称以单个数字符号 (#) 打头;它们仅对当前的用户连接是可见的;当用户从 SQL Server 实例断开连接时被删除。全局临时表的名称以两个数字符号 (##) 打头,创建后对任何用户都是可见的,当所有引用该表的用户从 SQL Server 断开连接时被删除。例如,如果创建了 employees 表,则任何在数据库中有使用该表的安全权限的用户都可以使用该表,除非已将其删除。如果数据库会话创建了本地临时表 #employees,则仅会话可以 阅读全文
posted @ 2012-11-06 11:16 HTTP500 阅读(210) 评论(0) 推荐(0)
摘要: USE [master]GOcreate procedure [sp_who_lock]asbegindeclare @spid int,@bl int, @intCountProperties int, @intCounter int create table #tmp_lock_who (id int identity(1,1),spid smallint,bl smallint) IF @@ERROR<>0 RETURN @@ERROR insert into #tmp_lock_who(spid,bl) select 0 ,blocked ... 阅读全文
posted @ 2012-11-06 09:57 HTTP500 阅读(190) 评论(0) 推荐(0)
摘要: "随机产生不重复的N个数字"在笔试中这类题目出现的概率很高,一般可以使用如下算法解答: int n = 20; IList<int> nums = new List<int>(); while (nums.Count < n) { int number = new Random().Next(n); if (!nums.Contains(number)) { nums... 阅读全文
posted @ 2012-11-06 09:37 HTTP500 阅读(152) 评论(0) 推荐(0)

2012年11月5日

摘要: 转自:http://blog.csdn.net/chen_xizhang/article/details/5952416http://msdn.microsoft.com/zh-cn/library/ms979205(en-us).aspx演示程序using System; public class ProfilerSample1 { static void Main(string[] args) { int start = Environment.TickCount; for (int i = 0; i < 1000; i++) ... 阅读全文
posted @ 2012-11-05 18:26 HTTP500 阅读(216) 评论(0) 推荐(0)
摘要: 前几天看到一个有趣的算法题,”随机产生26个数,使其总和等于301“,代码如下:using System;using System.Collections.Generic;using System.Data;using System.Data.SqlClient;using System.Linq;using System.Text;namespace ConsoleApplication6{ class Program { static void Main(string[] args) { int[] arryRandom = new int[26]; v... 阅读全文
posted @ 2012-11-05 18:23 HTTP500 阅读(177) 评论(0) 推荐(0)
摘要: 1.将图片保存为文本文件 var ms = new MemoryStream(); pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); var buffer = new byte[ms.Length]; ms.Position = 0; ms.Read(buffer, 0, buffer.Length); ms.Close(); File.WriteAllText("demobase64.txt", Convert.ToBase64String(bu... 阅读全文
posted @ 2012-11-05 18:16 HTTP500 阅读(123) 评论(0) 推荐(0)

2011年8月1日

摘要: using System;using System.Collections.Generic;using System.IO;using System.Xml.Serialization;namespace Demo026{ class Program { static void Main(string[] args) { var person = new Person() { Id = 1, Name = "这个测试" }; var orders = new List<Order>() { new Order() {Id = 1, PersonId = 1}, 阅读全文
posted @ 2011-08-01 09:35 HTTP500 阅读(169) 评论(0) 推荐(0)