- 博客(125)
- 资源 (2)
- 收藏
- 关注
原创 SQL Execpt over
select count(1) over(partition by date) from tablename等价于select count(1),date from tablename group by dateselect asofdate from tableaexceptselect asofdate form tableb
2017-01-11 21:55:06 394
原创 WCF学习 Demo
WCFService创建接口类using System;using System.Collections.Generic;using System.Linq;using System.Runtime.Serialization;using System.ServiceModel;using System.Text;namespace WcfServiceLibrary{
2016-12-19 21:16:18 545
原创 git 学习
git reflog:查看 提交 记录090cca3 HEAD@{0}: commit: modified3bf7ab0 HEAD@{1}: commit (initial): initlize将第二次提交回滚,hard参数会同时改变暂存区和工作git reset --hard HEAD@{1}HEAD is now at 3bf7ab0 initlize此时再查看
2016-10-16 18:58:29 387
转载 MVC学习笔记
载自 asp.net MVC2开发实战 一.Asp.net web from 和mvc在查找文件位置时的区别MVC的网址路径与文件路径的对应关系是通过网址路由来定义的。可以从Global.asax.cs文件RegisterRoutes()方法。{controller}/{action}/{id}当输入 http://localhost/Home/About时,通过Routing
2016-09-09 09:58:59 639
原创 Lamda表达式分组计算
根据不同的term 计算每项的权重 即, weight/sum(weight) Result r = new Result(); r.altid="001"; r.term=21; r.weight = 0.1; list.Add(r);
2016-08-14 11:35:15 987
原创 将WPF转为PDF
利用第三方插件PDFSARP项目截图启动项目,model类准备数据,WPF窗体展示数据,最后利用pdfsharp转为pdf文件namespace Engine{ class Program { [STAThread] static void Main(string[] args) { Progra
2016-07-11 09:07:04 5352 1
原创 SQL Case When 嵌套
select name,case when CODE='ST' then ... else (case when numbers is null then 1 else numbersnew/numbersold end)end as times from TABLENAME where ConditionSELECT CASE WHEN (CASE WH
2016-06-30 10:42:13 53534
原创 xpstopdf
XMLtoXPS public MainWindow() { InitializeComponent(); Stream srcXamlStream = new FileStream(@"D:\LZ21674\XAMLtoXPS\WpfBrowserApplication1\Page1.xaml", File
2016-05-20 16:44:26 771
原创 TempDailyMonitor
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Model;using RunRules;using System.Reflection;using System.IO;namespace RunRules{
2016-04-30 21:40:10 313
转载 反射(五)ORM
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace SimpleORM{ public class PropertyAttribute : Attribute { public string tableName
2016-03-30 15:51:09 341
原创 反射(四)CustomAttributes
namespace CustomerAttribute{ [System.AttributeUsage(System.AttributeTargets.Property)]//只能对属性 (Property) 应用属性 (Attribute)。 class DataFieldAttribute : System.Attribute { priva
2016-03-30 15:47:25 519
转载 反射(三)利用反射部分更新UI界面
public partial class Form1 : Form { public Form1() { InitializeComponent(); /* Example 3 UI*/ Type[] typePublic = null; Type typeIExec
2016-03-30 15:45:04 500
转载 反射(二)反射工厂
string Name = "IMPORT_JOB"; Object obj= QSDBFactoryReflection.Instance.Create("Factory." + Name);//利用反射 // QSDBFactory.Instance.Create(Name);//不用反射 namespace Factory{
2016-03-30 15:41:59 469
转载 反射(一)GetProperty
/*Example 1 M_People mp = new M_People(); mp.PL_Age = 30; mp.Pl_ID = "001"; mp.Pl_LoginName = "Test1"; mp.PL_Pwd = "123";
2016-03-30 15:40:16 423
转载 讲义 Reflection
语法:1. Activator.CreateInstance (Type)2. Activator.CreateInstance (Type, Object[])两种方法区别仅为:创建无参数的构造方法和创建有参数的构造函数。例子一 实现简单工厂模式传统的简单工厂模式的缺点:由于工厂类集中了所有实例的创建逻辑,工厂类就需要判断何时创建何种种类的产品, 导致系
2016-03-27 16:31:22 309
转载 使用反射--完成三层架构
项目结构图:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace XU.Model{ public abstract class BaseModel { }}using System;using System.
2016-03-13 17:14:46 869
原创 通过反射加载DLL部分更新应用程序(winform)
方法:加载dll,再界面创建控件,注册控件的点击事件 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Wi
2016-03-11 17:35:08 578
转载 反射 界面控件赋值
public partial class Form1 : Form { public Form1() { InitializeComponent(); } public EntityMan GetEntity() { EntityMan man =
2016-03-10 17:56:59 521
转载 GetCustomAttributes获得自定义属性
namespace Reflection{ [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple = true) ]
2016-03-10 15:39:46 3256
原创 使用反射查看调用方法
一。查看方法获取方法的相关信息一旦有了Type对象,就可以使用GetMethods()方法来获取此类型支持的方法的列表。它的一种形式为:MethodInfo[] GetMethods()MethodInfo对象描述了主调类型所支持的方法,因此可以通过它的Name属性获得方法的名称。同时它还有两个重要的方法,ReturnType和GetParameters()这里ob是一
2016-03-08 17:59:23 358
转载 Assembly.LoadFrom和Activator.CreateInstance
在动态创建时,可能会动态使用到外部应用的DLL中类的实例,则此时需要进行反编译操作,使用Reflection命名控件下的Assembly类。 Assembly tempAssembly = Assembly.LoadFrom("FruitClass.dll"); Type typeofControl = tempAssembly.Get
2016-03-07 17:16:36 830
转载 反射实现简单工厂模式
namespace NewFeatureStudy{ public interface IFruit { } public class Orange : IFruit { public Orange() { Console.WriteLine("Orange"); } } p
2016-03-05 09:47:51 620 3
转载 4.0 高级编程 Reflection
System.type类1.属性许多布尔属性表示这种类型是一个类还是一个枚举等等。这些特性包括IsAbstract,IsClass等等Type vecType = typeof(Vector); Console.WriteLine(vecType.IsAbstract);//return false Console.WriteLine
2016-03-03 17:37:57 358
转载 4.0 第十一章 Linq
数据来源public class Team { public Team(string name, params int[] years) { this.Name = name; this.Years = years; } public string Name { get; pr
2016-02-28 15:23:15 346
原创 temp records
Dictionary SqlDic = new Dictionary(); XmlDocument xmldoc = new XmlDocument(); xmldoc.Load("../../SQLScript/SqlQuery.xml"); foreach (XmlNode item in x
2016-02-17 22:07:03 299
转载 4.0 第八章 委托 lamdba表达式和事件
第八章 委托 lamdba表达式和事件委托只是一种特殊类型的对象,其特殊之处在于,我们以前定义的所有对象都包含数据,而委托包含的只是一个或多个方法的地址。1.声明委托delegate void IntMethodDelegate(int x);在这个示例中,定义了一个委托htMethodhvoker,并指定该委托的每个实例都可以包含一个方法的引用,该方法带有一个血参数,并返
2016-01-30 11:59:21 273
转载 4.0 第三十三章 XML
使用XMLReader类XMLReader是一个抽象类,直接使用XMLReader必须使用静态方法Create,返回XMLReader对象在读每个节点时,都要检查Nodetype属性,如果是文本就输出 XmlReader reader = XmlReader.Create("books.xml"); while (reader.Read())
2016-01-28 17:54:55 328
转载 4.0十九章 检测----性能计数器
计数器是用以收集性能数据的机制。注册表存储所有计数器的名称,每个计数器均与系统功能的一个特定区域相关。示例包括处理器繁忙时间、内存占用情况或通过某个网络连接接收的字节数。通过计数器的名称和位置可唯一地标识每个计数器。与文件路径包括驱动器、目录、一个或多个子目录和文件名一样,计数器信息由四个元素组成:计算机、对象、对象实例和计数器名称。///事例演示了多长时间才能进一次:j
2016-01-28 14:35:13 321
转载 4.0第二十章 线程,任务和同步
.net 4.0新的名称空间system.threading.tasks1)启动新任务的方式,第一种是实例化的TaskFactory类,把方法传递给StartNew方法,就会立即启动线程TaskFactory tf=new TaskFactory();Task t1=tf.StartNew(TaskMethod);Task t1=Task.Factory.StartNew(Ta
2016-01-24 16:55:25 257
转载 .net 4.0新增性能----Task
一:Task1. 最简单的使用 开启task有两种方式: 实例化Task var task1 = new Task(() => { StartAdd(); }); task1.Start(); public static void StartAdd()
2016-01-22 17:46:19 538
转载 C#AutoResetEvent和ManualResetEvent的区别
一:终止状态和非终止状态 首先说说线程的终止状态和非终止状态。AutoResetEvent和ManualResetEvent的构造函数中,都有bool变量来指明线程的终止状态和非终止状态。true表示终止状态,false表示非终止状态。看代码片段1:代码片段1: AutoResetEvent _autoResetEvent = new AutoResetEvent
2016-01-20 17:28:01 307
转载 讲义
浅谈多线程好处1.多线程程序一般被用来在后台执行耗时的任务2.在方法中完成一个复杂的计算工作3. 在没有用户界面的程序里,比如说Windows Service, 多线程在当一个任务有潜在的耗时,因为它在等待另台电脑的响应(比如一个应用服务器,数据库服务器,或者一个客户端)的实现特别有意义。用工作线程完成任务意味着主线程可以立即做其它的事情。概念用法:Th
2016-01-17 20:03:22 402
转载 SQL数据库缓存
们的服务器性能损耗还是在查询数据库的时候,所以对数据库的缓存还是显得特别重要,上面几种方式都可以实现部分数据缓存功能。但问题是我们的数据有时候是在变化的,这样用户可能在缓存期间查询的数据就是老的数据,从而导致数据的不一致。那有没有办法做到,数据如果不变化,用户就一直从缓存中取数据,一旦数据变化,系统能自动更新缓存中的数据,从而让用户得到更好的用户体验。 答案是肯定的!.NET已经为我们
2016-01-16 14:04:24 851
原创 多线程分段下载DownLoader代码
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using Sy
2015-12-27 20:46:07 778
原创 利用linq把List分段(可以用来分页)
public static List> BatchList(string strTick) { List> listgroup = new List>(); List TickList = strTick.Split(',').ToList(); int BatchCount = 5;//Batch的大
2015-12-26 11:51:39 1309
原创 记录高级编程一些东西
线程池使用起来简单,但是它有一些限制线程池中的所有线程都是后台线程,不能给线程池中的线程设置优先级和名称入池的线程只能用于时间较短的任务,如果线程要一直运行(如word的拼写检查器线程)就应该使用Thread类Thread类给线程传递数据可以采用两种方法。一种是使用带ParameterizedThreadStart委托参数的Thread构造参数,另一种方式是创建一个自定义类,把线程
2015-12-21 14:17:21 339
转载 Mutex和AutoResetEvent综合例子(总结)
Mutex的wait和release必须成对出现,如果在一个类中调用mutex的wait方法没有release,则会报AbandonedMutexException错误 Mutex对象等待互斥对象的方法有:Mutex.WaitAll、WaitOne、Mutex.WaitAny 每个对象的release方法略有区别 方法如下 * (1)、WaitOne()
2015-12-17 15:28:33 622
转载 多线程的自动管理各类锁的不同 线程池例子
Lock锁定一个引用对象,(不能锁定值类型,因为值类型传递的是拷贝,所以每次都是不同的值,没法lock)lock(expression) statement_block expression代表你希望跟踪的对象,通常是对象引用。如果你想保护一个类的实例,一般地,你可以使用this;如果你想保护一个静态变量(如互斥代码段在一个静态方法内部),一般使用类名就可以了。而stateme
2015-12-16 11:42:25 421
转载 操纵一个线程
static void Main(string[] args) { Alpha oAlpha = new Alpha(); Thread oThread = new Thread(new ThreadStart(oAlpha.Beta)); oThread.Start();
2015-12-15 17:09:12 294
原创 note2
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.SqlClient;using System.Data;namespace DAL{ public class DBHelper {
2015-12-09 22:40:11 316
Advanced UNIX Prigramming
2014-08-04
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人