随笔 - 850  文章 - 37  评论 - 173  阅读 - 287万
08 2013 档案
pop3
摘要:POP3_Client pop3 = new POP3_Client();pop3.Connect("mail.fetag.net", 110, false);pop3.Authenticate("username", "password", false);POP3_ClientMessageCollection cmc = pop3.Messages;foreach (POP3_ClientMessage cm in cmc){ byte[] bytes = cm.MessageToByte(); Mail_Message m = 阅读全文
posted @ 2013-08-31 20:50 武胜-阿伟 阅读(717) 评论(0) 推荐(0) 编辑
Exception
摘要:库:http://crashreporterdotnet.codeplex.com/documentationprivate void ThrowException(string message, params object[] values) where T : Exception, new(){ // NOTE Cannot provide arguments when creating an instance of a type parameter T. var exception = (T)Activator.CreateInstance(typeof(T), string... 阅读全文
posted @ 2013-08-30 20:03 武胜-阿伟 阅读(430) 评论(0) 推荐(0) 编辑
NET中的引用类型和值类型 zt
摘要:.NET中的类型分为值类型和引用类型,他们在内存布局,分配,相等性,赋值,存储以及一些其他的特性上有很多不同,这些不同将会直接影响到我们应用程序 的效率。本文视图对.NET 基础类型中的值类型和引用类型在内存中的布局,方法的调用,值类型如何实现接口,以及其他一些细节问题进行一些简要的讨论,文章主要参考《Pro .NET Performance》 和 《Advanced .NET Debugging》 ,希望给大家一点儿帮助。一 简单例子 举一个简单的例子,我们有一个名为Point2D的对象,用来表示二维空间中的坐标,每一个坐标值x,y都用一个short类型表示,整个对象占4个字 节。现在假设我 阅读全文
posted @ 2013-08-29 09:02 武胜-阿伟 阅读(827) 评论(0) 推荐(0) 编辑
The Task: Events, Asynchronous Calls, Async and Await
摘要:The Task: Events, Asynchronous Calls, Async and AwaitAlmost any software application today will likely contain a long-running process. “Long-running” may be a relative term but in the Windows Runtime it is specifically anything that could take longer than 50ms to execute. That’s a fairly small windo 阅读全文
posted @ 2013-08-27 20:18 武胜-阿伟 阅读(429) 评论(0) 推荐(0) 编辑
Using the Task Parallel Library (TPL) for Events
摘要:Using the Task Parallel Library (TPL) for EventsThe parallel tasks library was introduced with the .NET Framework 4.0 and is designed to simplify parallelism and concurrency. The API is very straightforward and usually involves passing in an Action to execute. Things get a little more interesting wh 阅读全文
posted @ 2013-08-27 20:11 武胜-阿伟 阅读(445) 评论(0) 推荐(0) 编辑
CCR源码分析-CCR架构
摘要:CCR,并发与协调运行时(Concurrency and Coordination Runtime)。从名字里我们就可以知道,这个东东是用来简化并发程序设计的。为何要并发呢?因为我们有多个任务需要处理,如果能同时做就会充分利用硬 件而减少处理的时间。自然的,CCR也是以“任务”为核心进行设计的,CCR中的代码也可以分为如下几个功能:描述任务、生成任务、调度任务和执行任务。描述任务对于计算机来说一个任务就是一段需要执行的代码,于是CCR有一个对任务的最抽象描述:ITask接口任务被封装在ITask实例中,当CCR调度这个任务实例去执行之后,CCR会调用ITask.Execute方法来执行该任务。 阅读全文
posted @ 2013-08-27 20:08 武胜-阿伟 阅读(1002) 评论(0) 推荐(0) 编辑
ccr1
摘要:Concurrency and Coordination RuntimeJeffrey RichterCode download available at:ConcurrentAffairs2006_09.exe(154 KB) Contents The Dispatcher ClassThe DispatcherQueue ClassThe Port and Arbiter ClassesThe Arbiter ClassCode ExamplesCoordinating Several I/O OperationsConclusionMicrosoft recently announce. 阅读全文
posted @ 2013-08-27 20:06 武胜-阿伟 阅读(520) 评论(0) 推荐(0) 编辑
与非CCR代码互操作
摘要:导读:CCR可以轻松的承载STA组件或者与它互操作:组件应该创建一个只有一个线程的CCR Dispatcher实例,并且在Dispatcher的构造函数中指定线程套间策略。DispatcherQueue实例就可以在与需要和遗留代码交互 的地方使用这个dispatcher来激活处理函数(activating handlers)。这些处理函数就可以安全的访问COM或者WinForm对象,同时对其他的CCR组件隐藏它们的STA关系,以便其他CCR组件可以 简单的投递元素到常规的CCR ports而不需要关心port上的处理函数使用的是什么dispatcher。原文链接线程套间约束当与某些遗留的Win 阅读全文
posted @ 2013-08-27 20:03 武胜-阿伟 阅读(351) 评论(0) 推荐(0) 编辑
ccr test
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;using Microsoft.Ccr.Core;namespace ccrTest{ class Program { static void Main(string[] args) { int maxiQueueDepth = 10; // step1: 创建一个Dispatcher对象 ... 阅读全文
posted @ 2013-08-27 19:45 武胜-阿伟 阅读(337) 评论(0) 推荐(0) 编辑
CCR
摘要:不用任何与创建线程、资源互斥有关系的API写多线程程序 这次的例子,是一个很简单的控制台,她将面对瞬间提交的百万的数据,而面不改色(CPU、内存非常平稳),队列中始终只保存最新的数据,每次只处理cpu 个数据(我的机器是双核的,所以,在我这里,就是每个CPU一个线程,真正的并行运行哦....),OK不废话,进入正题: 呃,既然是实例,那么就直接看代码好了:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading;usingMicrosoft.Ccr.Co 阅读全文
posted @ 2013-08-27 19:36 武胜-阿伟 阅读(672) 评论(0) 推荐(0) 编辑
tpl + ccr
摘要:不是非此即彼的场景。如下混合使用CCR+TPL的代码说明问题:It's not an either/or scenario.You can intermix CCR and TPL code like this, here is a Parallel.For inside of a Receive delegate:usingSystem;usingSystem.Threading;usingSystem.Threading.Tasks;usingMicrosoft.Ccr.Core;namespaceDemo{ publicclassProgram { publicstaticvoi 阅读全文
posted @ 2013-08-27 19:23 武胜-阿伟 阅读(198) 评论(0) 推荐(0) 编辑
TPL
摘要:namespace TPLTest{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //var list = testFillParallel(); //int i = list.Count(); Stop... 阅读全文
posted @ 2013-08-27 18:21 武胜-阿伟 阅读(468) 评论(0) 推荐(0) 编辑
c# 发送邮件
摘要:using System.Net;using System.Net.Mail;public void SendMail(){ string m_strSMTPserver = string.Empty; string m_strSMTPuser = string.Empty; string m_strSMTPpwd = string.Empty; string m_strSMTPsendto = string.Empty; string m_strSMTPFrom = string.Empty; lock (ma_ptr.m_cs) { ... 阅读全文
posted @ 2013-08-26 17:19 武胜-阿伟 阅读(316) 评论(0) 推荐(0) 编辑
SmartThreadPool
摘要:https://github.com/amibar/SmartThreadPool首先是实例化的时候的参数的解释//Initialize SmartThreadPool & Make logs//SmartThreadPool m_hThreadPool;//m_hThreadPool = new SmartThreadPool();//声明一个线程池STPStartInfo stp = new STPStartInfo();//线程详细配置参数//m_hThreadPool.STPStartInfo这个属性是只读属性,所以只能在实例化的时候设置{ stp.AsReadOnly();/ 阅读全文
posted @ 2013-08-26 17:12 武胜-阿伟 阅读(6086) 评论(3) 推荐(3) 编辑
虚拟机
摘要:VMware.Workstation.v9.0.2.1031769.Incl.Keymaker-ZWT最新虚拟机工作站,推荐win8用户更新http://pan.baidu.com/share/link?shareid=350568&uk=1477297255解压密码:1介绍就不说了.需要的下载...kg通用9.0.x版本http://www.iplaysoft.com/vmware-workstation.html***************中文名:应用程序虚拟化工具英文名:VMWare ThinApp EnterpriseVMware ThinApp Enterprise 4.7 阅读全文
posted @ 2013-08-24 07:30 武胜-阿伟 阅读(531) 评论(0) 推荐(0) 编辑
相关系数
摘要:相关系数相关系数(Correlation coefficient)目录[隐藏]1 什么是相关系数2 相关系数的几种定义3 相关系数的性质[1]4 相关系数的计算方法5 相关系数的应用[1]6 相关系数的缺点7 参考文献[编辑]什么是相关系数 相关表和相关图可反映两个变量之间的相互关系及其相关方向,但无法确切地表明两个变量之间相关的程度。 著名统计学家卡尔·皮尔逊设计了统计指标——相关系数。相关系数是用以反映变量之间相关关系密切程度的统计指标。相关系数是按积差方法计算,同样以两变量与各自平均值的离差为基础,通过两个离差相乘来反映两变量之间相关程度;着重研究线性的单相关系数。 依据相关现 阅读全文
posted @ 2013-08-17 10:18 武胜-阿伟 阅读(1807) 评论(0) 推荐(0) 编辑
为枚举类型添加说明 zt
摘要:enum Orientation { [DescriptionAttribute("东")] East, [DescriptionAttribute("南")] South, [DescriptionAttribute("西")] West, [DescriptionAttribute("北")] North }但又如何获取DescriptionAttribute的内容呢?呵呵,答案就是通过反... 阅读全文
posted @ 2013-08-16 09:35 武胜-阿伟 阅读(199) 评论(0) 推荐(0) 编辑
MD5
摘要:/// 获得指定文件的Hash值 /// 文件路径 /// public static string GetFileHash(string filePath) { var cpter = System.Security.Cryptography.MD5.Create(); return BitConverter.ToString(cpter.ComputeHash(System.IO.File.ReadAllBytes(filePath))).Replace("-", "").ToUpper(); } 阅读全文
posted @ 2013-08-15 10:49 武胜-阿伟 阅读(222) 评论(0) 推荐(0) 编辑
hashcode
摘要:hash code的原因只有一个:效率。理论的说法它的复杂度只有O(1)。试想我们把元素放在线性表里面,每次要找一个元素必须从头一个一个的找它的复杂度有O(n)。如果放在平衡二叉树,复杂度也有O(log n)。 为啥很多地方说“覆写equals的时候一定要覆写hashCode”。说到这里我知道很多人知道有个原则:如果a.equals(b)那么要确保a.hashCode()==b.hashCode()。为什么?hashCode和我写的程序的业务逻辑毫无关系,为啥我要override? 要我说如果你的class永远不可能放在hash code为基础的容器内,不必劳神,您真的不必override.. 阅读全文
posted @ 2013-08-14 14:03 武胜-阿伟 阅读(1477) 评论(0) 推荐(0) 编辑
the type initializer for '' threw an exception
摘要:the type initializer for '' threw an exception问题:程序启动时初始化主窗口类时,弹出该错误。调查:查看类的构造函数是否会有异常抛出。解决:去掉类的构造函数中可能出现的异常。//////////////////////环境:windows 2003 x64,Oracle 10g x64,odp.net(正确安装),.net framework 4问题:.net应用程序通过Oracle.DataAccess.dll访问64位的Oracle服务器,在连接时出现以下异常:“System.TypeInitializationException 阅读全文
posted @ 2013-08-10 11:20 武胜-阿伟 阅读(29234) 评论(0) 推荐(0) 编辑
A Pretty Good Splash Screen in C#
摘要:http://www.codeproject.com/Articles/5454/A-Pretty-Good-Splash-Screen-in-C 阅读全文
posted @ 2013-08-10 08:22 武胜-阿伟 阅读(211) 评论(0) 推荐(0) 编辑
Mtom Encoding in WCF
摘要:http://www.codeproject.com/Articles/632101/Mtom-Encoding-in-WCFhttp://msdn.microsoft.com/zh-cn/library/aa395209.aspx 阅读全文
posted @ 2013-08-10 08:13 武胜-阿伟 阅读(243) 评论(0) 推荐(0) 编辑
A Fast Priority Queue Implementation of the Dijkstra Shortest Path Algorithm
摘要:http://www.codeproject.com/Articles/24816/A-Fast-Priority-Queue-Implementation-of-the-Dijksthttp://zh.wikipedia.org/wiki/%E8%BF%AA%E7%A7%91%E6%96%AF%E5%BD%BB%E7%AE%97%E6%B3%95 阅读全文
posted @ 2013-08-10 08:07 武胜-阿伟 阅读(234) 评论(0) 推荐(0) 编辑
Peer to Peer File Sharing Through WCF
摘要:http://www.codeproject.com/Articles/614028/Peer-to-Peer-File-Sharing-Through-WCFhttps://github.com/amirjalilifard/FreeFilesProjecthttp://www.codeproject.com/Tips/629916/WCF-Transactions-in-Five-Easy-Steps-With-Example 阅读全文
posted @ 2013-08-10 07:44 武胜-阿伟 阅读(294) 评论(0) 推荐(0) 编辑
交易的成功 = 60%的资金管理 + 40%出入场信号 zt
摘要:交易的成功 = 60%的资金管理 + 40%出入场信号。资金管理 = 60%的风险分散 + 40%的适度重或轻仓。出入场信号 = 60%的出场信号 + 40%的入场信号。交易的成功 = 36%的风险分散+24%的适度重或轻仓+16%的入场信号+24%的出场信号。可90%的人却苦苦思索这16%的入场信号,如何买。。。而忽略了36%的风险分散和24%的适度重或轻仓。可见,出场比入场重要,适度重或轻仓比出场信号重要,而风险资产的分散比适度的重仓或轻仓重要。以上是资金管理诠释。 阅读全文
posted @ 2013-08-04 17:57 武胜-阿伟 阅读(382) 评论(0) 推荐(0) 编辑
mysql 交叉表
摘要:交叉表,但在MySQL中却没有这个功能,但网上看到有不少朋友想找出一个解决方法,特发贴集思广义。http://topic.csdn.net/u/20090530/23/0b782674-4b0b-4cf5-bc1a-e8914aaee5ab.html?96198现整理解法如下:数据样本: create table tx( id int primary key, c1 char(2), c2 char(2), c3 int ); insert into tx values (1 ,'A1','B1',9), (2 ,'A2','B1' 阅读全文
posted @ 2013-08-04 10:37 武胜-阿伟 阅读(4740) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

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