07 2013 档案

摘要:HL7 v2中的MSH,MSA段都有Message Control ID。 有几点需要注意:1.所有的MessageControlID必须唯一2.对于MSH中的MessageControlID, 发送方自己产生, 保证唯一性。(不管是不是Ack消息)3.对于Ack消息, MSH中的Message control id和规则2相同(自己产生), 但MSA中MessageControlID 应为接收... 阅读全文
posted @ 2013-07-31 14:25 muzizongheng 阅读(494) 评论(0) 推荐(0) 编辑
摘要:最近在准备PIX的认证, 需要进行mesa测试。 但是Mesa的标准测试工具中没有针对PIX的TestCase, 只是提到NIST的web测试。路径为:http://pixpdqtests.nist.gov:8080/#tests%2Fdriver%2Fversion.htm在此页面中可以选择PIX需要测试的角色,版本等等。 测试步骤:1.选择版本,被测试角色(Actor)2.选择测试事务类型(... 阅读全文
posted @ 2013-07-31 14:23 muzizongheng 阅读(153) 评论(0) 推荐(0) 编辑
摘要:1.清理缓存 2.安装好抓包工具,比如Fiddler2, 或者F12打开浏览器调试3.安装好Beyond Compare,这样可以利用BC来对比自己程序模拟发送的http包是否和正常的包一致! 阅读全文
posted @ 2013-07-19 09:18 muzizongheng 阅读(528) 评论(0) 推荐(0) 编辑
摘要:python中的print有几种常用的用法: 1. print("first example")2. print("second", "example")3. print("%s"%("third example"))4.print("%(forth)s"%{'forth':'forth example'})5.fifth = "fifth example" print("%(fifth)s"%... 阅读全文
posted @ 2013-07-18 16:33 muzizongheng 阅读(2361) 评论(0) 推荐(0) 编辑
摘要:用python进行OO编程时, 经常会用到类的构造函数来初始化一些变量。 class FileData: def __init__(self, data, name, type): self.bits = base64.encodestring(data) self.name = name self.type = type其中self类似c++或者c#的this指针。 阅读全文
posted @ 2013-07-18 16:32 muzizongheng 阅读(979) 评论(0) 推荐(0) 编辑
摘要:我们有时写的python模块需要自己测试, 简单方法就是定义main函数, 然后测试自己的模块接口。 def main(): test_yourCode() if __name__ == "__main__": main() 阅读全文
posted @ 2013-07-18 16:31 muzizongheng 阅读(1920) 评论(0) 推荐(0) 编辑
摘要:我们经常会用python来进行抓包,模拟登陆等等, 势必要构造http请求包。 http的request通常有4个方法get,post,put,delete,分别对应于查询,更新,添加,删除。我们经常用到的也就get,post。1.用python构造get#build request for accessed url homeReq = urllib.request.Request( url... 阅读全文
posted @ 2013-07-18 16:30 muzizongheng 阅读(2309) 评论(0) 推荐(0) 编辑
摘要:python3中构造http的Request需要用到urllib.request.有时会用到cookie。比如在访问网站首页得到cookie,通过下面代码添加cookie: #install cookie cj = cookiejar.CookieJar(); opener = urllib.request.build_opener(urllib.request.HTTPCookieProce... 阅读全文
posted @ 2013-07-18 16:29 muzizongheng 阅读(3176) 评论(0) 推荐(0) 编辑
摘要:http的数据需要2种编码解码。 1. url中的特殊字符转换, 比如”,‘, :,//等python3中通过urllib.parse.quote(..)和urllib.parse.unquote(..)来编码解码。如:import urllib.parse url = "http://blog.csdn.net/muzizongheng" en = urllib.parse.quote(url... 阅读全文
posted @ 2013-07-18 15:20 muzizongheng 阅读(544) 评论(0) 推荐(0) 编辑
摘要:python中字符串“True” 和 “False"转为bool类型时, 不能通过bool(xx)强转。 注意是因为在python中,除了''、""、0、()、[]、{}、None为False, 其他转换都为True。 也就是说字符串如果不为空,则永远转换为True。好吧, 只能通过这样了:data = "True"isTrue = data == str(True) 阅读全文
posted @ 2013-07-18 15:19 muzizongheng 阅读(3644) 评论(0) 推荐(0) 编辑
摘要:python中在module定义的变量可以认为是全局变量, 而对于全局变量的赋值有个地方需要注意。 test.py--------------------------------------------------import sysusername = "muzizongheng"password = "xxxx"def Login(u, p): username = u password... 阅读全文
posted @ 2013-07-18 15:18 muzizongheng 阅读(325) 评论(0) 推荐(0) 编辑
摘要:snoop是开发wpf应用程序的利器。用它可以观察WPF的可视树,监听事件,更改元素属性等。 下面我介绍下snoop一些用法。1.获取指定应用程序的UI 打开snoop,选择“Drag and Drop this crosshairs over wpf window inorder to snoop it” 按钮, 拖动它到你要观察的wpf窗体上。 你会发现 十字准线 会标出窗体的名字及进程号。... 阅读全文
posted @ 2013-07-16 10:58 muzizongheng 阅读(532) 评论(0) 推荐(0) 编辑
摘要:开发wpf时我们经常遇到一个xaml文件在设计时显示解析错误(比如在:VS或者Blend)而编译正常运行正常。 原因是:xaml的在Debug版本下必须为anyCPU。解决办法:1.打开工程文件xxx.csproj,2.找到含有 Debug的PropertyGroup节点3.将此PropertyGroup节点中的改为anyCPU。示例: Debug anyCPU 阅读全文
posted @ 2013-07-15 14:28 muzizongheng 阅读(414) 评论(0) 推荐(0) 编辑
摘要:最近CM(Configuration Management) 的同事在自定义开发TFS的过程中遇到一个问题。 领导要求快速开发一个工具, 可以自动连接TFS,然后自动Check out一些word文件, 然后程序修改后自动check in。(比如签名)这个实现的话,需要3个方面:1.根据现有TFS界面抽出可以使用的UI, 然后找到对应dll2.利用C#的反射, 获取到对应字段或者属性, 进行更改... 阅读全文
posted @ 2013-07-10 16:20 muzizongheng 阅读(211) 评论(0) 推荐(0) 编辑
摘要:最近在写一个关于如何上传文件到skydrive的demo, 用REST上传失败。 安装Telerik的Fiddler后, 可以监听http或者https通信, 然后可以在软件中看到返回的json数据或者其他详细信息。 阅读全文
posted @ 2013-07-10 16:18 muzizongheng 阅读(203) 评论(0) 推荐(0) 编辑
摘要:#coding:utf-8 import sys sys.path.append("lib") import thrift.protocol.TBinaryProtocol as TBinaryProtocol import thrift.transport.THttpClient as THttpClient import evernote.edam.userstore.UserStore as... 阅读全文
posted @ 2013-07-05 13:58 muzizongheng 阅读(399) 评论(0) 推荐(0) 编辑
摘要:Sublime Text2是个强大的编辑器, 有好多插件供我们使用, 其中有个插件SublimeEvernote, 可以把代码发送到Evernote里。 但是没找见使用说明, 今天看了下Sublime_Evernote.py源码, 配置如下:/* Sublime evernote default settings */ { "authToken": "your dev authToken", ... 阅读全文
posted @ 2013-07-05 13:50 muzizongheng 阅读(791) 评论(0) 推荐(0) 编辑
摘要:我们编译python代码时, 经常出现各种因为tab和空格的问题, 例如:IndentationError: unindent does not match any outer indentation level有个简便的办法:用python的IDLE打开python 代码, 选中所有代码, 点击菜单项Format/Untabify Region 阅读全文
posted @ 2013-07-05 09:31 muzizongheng 阅读(593) 评论(0) 推荐(0) 编辑
摘要:Python的list,dictionary可以写入file, 也可以从file中读取。 关于list:1)写入文件 self.existedBlog.write("your item data" + "\n")2)读取 self.existedBlog = open("existedBlog", "r+") self.existedBlog.seek(0) currentBlog... 阅读全文
posted @ 2013-07-05 09:30 muzizongheng 阅读(329) 评论(0) 推荐(0) 编辑
摘要:import module与from module import funtion区别:import module导入模块后你需要使用module.function()来调用一个函数from module import function导入一个function后你可以直接使用它请在你经常要使用这个function或者你确认你的代码中不会与导入的function冲突时使用from module imp... 阅读全文
posted @ 2013-07-05 09:29 muzizongheng 阅读(279) 评论(0) 推荐(0) 编辑
摘要:尽量使用using语句块和finally (实现IDisposable) 尽量使用单个大程序集而不是多个小程序集 (使用NGen.exe)使用sealed关键字权衡虚函数使用弱引用 阅读全文
posted @ 2013-07-05 09:28 muzizongheng 阅读(229) 评论(0) 推荐(0) 编辑
摘要:1.下载ODB library:ODB Compiler,Common Runtime Library,Database Runtime Library。 http://www.codesynthesis.com/products/odb/download.xhtml(注意:ODB Compiler为odb-x.x.x-i686-windows, Database Runtime Librari... 阅读全文
posted @ 2013-07-05 09:27 muzizongheng 阅读(890) 评论(0) 推荐(0) 编辑
摘要:今天同事问在一个WCF server的解决方案里调试时如何禁止Server自动启动。 经过调查发现, VS的工具WcfSvcHost会在调试时自动扫描工程里的WCF server, 然后启动起来。如果需要禁止其工作, 解决方法:在工程文件(csproj)里的节点中删除{3D9AD99F-2412-4246-B90B-4EAA41C64699} 阅读全文
posted @ 2013-07-05 09:07 muzizongheng 阅读(249) 评论(0) 推荐(0) 编辑
摘要:今天在用python3的getattr时遇到一个问题, 就是老提示传入参数和函数前面不一致, 代码为: class Test: def __init__(self, name): self.name = name def execute(self, methodname, *args): print(args) print(self.name) print(getattr(self.... 阅读全文
posted @ 2013-07-05 09:06 muzizongheng 阅读(1197) 评论(0) 推荐(0) 编辑
摘要:进行在用python的list结构时, 发现一个问题: methods =['blogger.deletePost', 'blogger.getUsersBlogs', 'metaWeblog.editPost', 'metaWeblog.getCategories', 'metaWeblog.getPost', 'metaWeblog.getRecentPosts', 'metaWeblog.... 阅读全文
posted @ 2013-07-05 09:05 muzizongheng 阅读(1273) 评论(0) 推荐(0) 编辑
摘要:w代表清空后写入 r代表打开后追查+代表可以写b代表二进制写入 阅读全文
posted @ 2013-07-05 09:04 muzizongheng 阅读(344) 评论(0) 推荐(0) 编辑
摘要:今天在把Evenote的笔记内容写为文件时出错: f.write(content) UnicodeEncodeError: 'gbk' codec can't encode character '\xa0' in position 135: illegal multibyte sequence经过调查,发现应该在打开文件时设置编码格式。解决办法: f = open(n.guid, "w... 阅读全文
posted @ 2013-07-05 09:03 muzizongheng 阅读(807) 评论(0) 推荐(0) 编辑
摘要:今天编译Python时, 输出窗口信息出现: [Decode error - output not utf-8] [Decode error - output not utf-8]发现是print不支持中文字符的输出, 需要修改python的build的setting, 打开Python.sublime-build,修改为:{ "cmd": ["C:/Python33/python.exe",... 阅读全文
posted @ 2013-07-05 09:02 muzizongheng 阅读(11246) 评论(1) 推荐(1) 编辑
摘要:今天在调试Evernote SDK时, 遇到PythonPath的问题。 查了很多资料,有说用系统环境变量添加PythonPath, 有说在注册表中的PythonPath添加新Default字段, 但是对于我来说都没有效果, 很奇怪。 最后还是在代码里显式添加sys.path才好用: import sys import hashlib import binascii import time if... 阅读全文
posted @ 2013-07-05 09:01 muzizongheng 阅读(740) 评论(0) 推荐(0) 编辑
摘要:1.下载开发版:http://www.sublimetext.com/dev2.安装Package control: (1)按键ctrl+~ (2)在命令行中输入:import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if no... 阅读全文
posted @ 2013-07-05 09:00 muzizongheng 阅读(369) 评论(0) 推荐(0) 编辑
摘要:在做WPFMVVM中经常会遇到一些Model、ViewModel的属性添加添加私有字段和更改通知方法来支持Binding。比如把:public class Test{ public string TestData1{get; set;} public string TestData2{get;set;}}变为:public class Test : INotifyPropertyChanged{ ... 阅读全文
posted @ 2013-07-05 08:59 muzizongheng 阅读(751) 评论(0) 推荐(0) 编辑
摘要:因为以前一直在用TSVN, 对其界面操作比较熟悉。 因此,决定不用Git Gui而是用TortoiseGit来访问GitHub。 安装TortoiseGit成功后,1.运行PuTTY Key Generator2.如果GitHub上已经有SSH key,本地也有对应的私钥请在菜单项Conversions/Import key, 导入现有私钥文件,导入后:3.如果没有现成的私钥公钥, 请点击Gen... 阅读全文
posted @ 2013-07-04 09:49 muzizongheng 阅读(427) 评论(0) 推荐(0) 编辑
摘要:我们在用WPF时, 经常会对系统控件的默认高亮等等颜色进行更改。 以前通常是用controlTemplate来实现。 今天发现一个更合理或者简单的方法:用系统默认颜色的key, 比如 SystemColors.HighlightBrushKey 此资源可以动态引用和改变。而SystemColors.HighlightBrush只能用于静态资源。 example: http://msdn.... 阅读全文
posted @ 2013-07-04 09:48 muzizongheng 阅读(1574) 评论(0) 推荐(0) 编辑
摘要:TreeView控件可以通过HierarchicalDataTemplate 和DataTemplate来自定义。1)HierarchicalDataTemplate用来支持HeaderedItemsControl,其中DataType指定当前的数据类型, 只有符合这个类型才使用HierarchicalDataTemplate;ItemsSource用来指定ItemsHost;内部的自定义实现(T... 阅读全文
posted @ 2013-07-04 09:48 muzizongheng 阅读(287) 评论(0) 推荐(0) 编辑
摘要:DataGrid支持截断时, 需要分2部分, DataGridColumnHeader和DataGridCell。 1)创建上述2部分的ControlTemplate 。2)把其中的ContentPresenter改为TextBlock3)使用TextTrimming属性xaml code like this: 阅读全文
posted @ 2013-07-04 09:47 muzizongheng 阅读(478) 评论(0) 推荐(0) 编辑
摘要:添加: TextTrimming="CharacterEllipsis"到TextBlock中, 即可让TextBlock 支持截断字符显示为。。。 阅读全文
posted @ 2013-07-04 09:46 muzizongheng 阅读(322) 评论(0) 推荐(0) 编辑
摘要:今天帮忙同事调试一个自定义Panel的问题, 很奇怪, 利用Binding可以通过ItemSource来添加控件,但是在Listbox的xaml里添加几个ListboxItem却报异常: VisualTree of ItemsPanelTemplate must be a single element.原因有2:1)ListBox的ItemPanelTemplate使用自定义Panel时, 需要... 阅读全文
posted @ 2013-07-04 09:45 muzizongheng 阅读(269) 评论(0) 推荐(0) 编辑
摘要:c#中有Expression,即表达式。 通过Expression可以动态构造代码,并编译执行。比如:1.创建参数表达式:ParameterExpression numParam = Expression.Parameter(typeof(int), "num");、创建常量表达式:ConstantExpression five = Expression.Constant(5, typeof(i... 阅读全文
posted @ 2013-07-04 09:44 muzizongheng 阅读(1021) 评论(0) 推荐(0) 编辑
摘要:前段时间做了一个worklist的项目,有部分是利用xml配置DICOM的tag,然后根据xml把DICOM的Dataset转为实体类,或者把实体类转为Dataset。 当中主要应用了反射来调用Dataset的put方法, 但是发现性能很慢, 一个解析映射花了几百毫秒。解决办法:利用dynamic来替换反射:dynamic temp = new ExampleClass();temp.someM... 阅读全文
posted @ 2013-07-04 09:43 muzizongheng 阅读(343) 评论(0) 推荐(0) 编辑
摘要:最近做项目时,用到了xml的序列化与反序列化, 发现最好用xsd来验证xml, 因为反序列化xml不校验xsd。 方法:xmlData变量为xml字符串MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xmlData)); ms.Position = 0; ... 阅读全文
posted @ 2013-07-04 09:29 muzizongheng 阅读(543) 评论(0) 推荐(0) 编辑
摘要:https://github.com/OSEHRA/mdo C# http://sourceforge.net/p/nhapi/code/HEAD/tree/NHapi20/ C# 阅读全文
posted @ 2013-07-04 09:28 muzizongheng 阅读(2315) 评论(0) 推荐(0) 编辑
摘要:1. 代码中使用配置文件: log4net.Config.DOMConfigurator.Configure(new FileInfo("log4netConfig.xml")); 2.配置文件样例: --> --> ... 阅读全文
posted @ 2013-07-04 09:28 muzizongheng 阅读(272) 评论(0) 推荐(0) 编辑
摘要:利用xs:unique关键字。在xs:element里添加unique节点,任意命名,然后用xs:selector来选择需要唯一的域, xs:field 里指定特定的字段。 例如:定义所有Item里的Key为唯一, 阅读全文
posted @ 2013-07-04 09:27 muzizongheng 阅读(373) 评论(0) 推荐(0) 编辑
摘要:EF中设计数据库表结构时,在Designer UI中无法调整添加好的字段顺序。 方法:1.在Solution Explorer中右击XXX.edmx文件, 选择“Open With”, 用XML Editor打开。2.在edmx:ConceptualModels (即:CSDL content)节点内,找到对应Table及Property, 调整Property节点顺序。 阅读全文
posted @ 2013-07-04 09:27 muzizongheng 阅读(356) 评论(0) 推荐(0) 编辑
摘要:Delimiter CharactersCharacterPurpose0x0DMarks the end of each segment.|Composite delimiter.^Sub-composite delimiter.&Sub-sub-composite delimiter.~Separates repeating fields.\Escape character. The foll... 阅读全文
posted @ 2013-07-04 09:26 muzizongheng 阅读(944) 评论(0) 推荐(0) 编辑
摘要:IHE给出了各个Actor之间如何通讯的建议:1. 应用程序通讯时必须用MLLP包装或者解析。2. 客户端建立连接后,服务器端必须用此连接进行应答。客户端可以继续用此连接启动新事务原文如下:1. Applications shall use the Minimal Lower Layer Protocol defined in Appendix C of theHL7 Implementation... 阅读全文
posted @ 2013-07-04 09:25 muzizongheng 阅读(469) 评论(0) 推荐(0) 编辑
摘要:OracleSQL ServerDB2!@@IDENTITY DETERMINISTIC&ADD DISALLOW(ALL DISCONNECT)ALTER DISTINCT*AND DO+ANY DOUBLE,AS DROP-ASC DSNHATTR.AUTHORIZATION DSSIZE/AVG DYNAMIC:BACKUP EACHBROWSE ENCODING@BULK ENDABY E... 阅读全文
posted @ 2013-07-04 09:24 muzizongheng 阅读(1201) 评论(0) 推荐(0) 编辑
摘要:今天用EF遇到一个问题,The specified named connection is either not found in the configuration, not intended to be used。。。。。。。 原因是我的EF中数据库连接字符串放到App.Config文件中, 而我另一个工程使用此工程时没有添加App.Config 或者Web.Config解决办法:在调用工程... 阅读全文
posted @ 2013-07-04 09:23 muzizongheng 阅读(191) 评论(0) 推荐(0) 编辑
摘要:http://pixpdqtests.nist.gov:8080/#tests%2Fdriver%2Fversion.htm可以打开上述连接, 选中version和actor, 然后获取对于sample message, 保存为hl7文件, 用hl7spy来完整测试。http://gazelle.ihe.net/PatientManager/systemConfigurations.seamPIX... 阅读全文
posted @ 2013-07-04 09:23 muzizongheng 阅读(1313) 评论(0) 推荐(0) 编辑
摘要:Table 0003 - Event typeValueDescriptionA01ADT/ACK - Admit / visit notificationA02ADT/ACK - Transfer a patientA03ADT/ACK - Discharge/end visitA04ADT/ACK - Register a patientA05ADT/ACK - Pre-admit a pat... 阅读全文
posted @ 2013-07-04 09:22 muzizongheng 阅读(873) 评论(0) 推荐(0) 编辑
摘要:1. 创建VS工程 2.添加新项, 选中ADO.Net Entity Data Model模板3.填入Host及数据库名字, 如果没有此数据库, 会提示创建4.添加edmx后, 右击选择属性,配置相关属性, 如下:5.双击edmx文件, 在空白面板上右击, 选择添加entity6.右击创建的entity, 选择添加scalar 或者 complex property7. 右击空白面板, 选择Ge... 阅读全文
posted @ 2013-07-04 09:21 muzizongheng 阅读(307) 评论(0) 推荐(0) 编辑
摘要:最近在做区域医疗中PIX时, 需要让PIX Manager同时支持HL7的V2和V3版本。思路是利用WCF来同时支持V2版本的c/s架构式的消息协议和V3版本WebService的Soap协议。 实现步骤 1.发现WCF默认不支持原始字节流传输, 即访问WCF的Server端的消息都已被MSFT封装(内部是xml),即使用各种MessageEncoder也不可以, WCF会把需要传输的数据封装... 阅读全文
posted @ 2013-07-04 09:21 muzizongheng 阅读(934) 评论(0) 推荐(0) 编辑
摘要:今天帮忙同事解决在后台绑定时,动态更改控件(Grid)的Background。 有个陷阱,C#有2个命名空间有Brush和Color, 分别为System.Drawing和System.Window.Media.说到这里大家应该明白了, Grid的Background的类型为Media命名空间里Brush,而我后台设置了Drawing命名空间里的Brush, 而且没报错。导致出现设置无效 阅读全文
posted @ 2013-07-04 09:20 muzizongheng 阅读(568) 评论(1) 推荐(1) 编辑
摘要:HL7的官网有很多开源工具, 比如:RoseTree,V3Generator,RMIM Designer, Design Repository, V2 & V3 Mapping Tools等。 http://gforge.hl7.org/gf/安装操作:HL7Tools_ComprehensiveGuideR2.doc 阅读全文
posted @ 2013-07-04 09:19 muzizongheng 阅读(517) 评论(0) 推荐(0) 编辑
摘要:最近在优化WPF性能时, 发现在特定条件下BindingList比ObservableCollection性能更高, 因为它提供Disable/Enable 更改通知的方法。这样我们可以不需要很频繁的通知UI去更新, 而是等所有操作都做完后再通知。 然而, 默认的BindingList不支持Sort, 需要我们实现。 public class SortableBindingList : Bin... 阅读全文
posted @ 2013-07-04 09:18 muzizongheng 阅读(555) 评论(0) 推荐(0) 编辑
摘要:•初步了解PIX V2和V3:“IHE_ITI_TF_Rev8-0_Vol1_FT_2011-08-19”中第5章和第23章•了解PIX V2相关事务: “IHE_ITI_TF_Rev8-0_Vol2a_FT_2011-08-19”中3.8,3.9,3.10•了解PIX V3相关事务: “IHE_ITI_TF_Rev8-0_Vol2b_FT_2011-08-19”中3.44,3.45,3.46•了... 阅读全文
posted @ 2013-07-04 09:18 muzizongheng 阅读(368) 评论(0) 推荐(0) 编辑
摘要:今天帮忙修了一个bug, 在拖动TreeViewItem时,需要滚动TreeView向前翻页,或向后翻页。 思路: 1.找到TreeView控件里的ItemsControl 2.找到ItemsControl里的ScrollViewer 3.判断当前每个Item的高度 4.通过GetCursorPos获取屏幕绝对坐标 5.通过ItemsControl的PointFromScreen把... 阅读全文
posted @ 2013-07-04 09:17 muzizongheng 阅读(866) 评论(1) 推荐(1) 编辑
摘要:通过FlagsAttribute可以实现。 // A bit field or flag enumeration of harvesting seasons. [Flags] public enum Seasons { None = 0, Summer = 1, Autumn = 2, Winter = 4, Spring = 8, All = S... 阅读全文
posted @ 2013-07-04 09:16 muzizongheng 阅读(336) 评论(0) 推荐(0) 编辑
摘要:[StructLayout(LayoutKind.Sequential)] public struct POINT { public int X; public int Y; public POINT(int x, int y) { ... 阅读全文
posted @ 2013-07-04 09:16 muzizongheng 阅读(3486) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-07-04 09:15 muzizongheng 阅读(173) 评论(0) 推荐(0) 编辑
摘要:http://msdn.microsoft.com/zh-cn/vstudio/aa497289(en-us).aspxPerformance This section includes information on logging, tracing, profiling, and other diagnostic techniques for analyzing and monitoring y... 阅读全文
posted @ 2013-07-04 09:13 muzizongheng 阅读(893) 评论(0) 推荐(0) 编辑
摘要:主要是利用DependencyPropertyDescriptor的AddValueChanged方法, 比如下面的例子为DataGridColumn的VisibilityProperty添加了值更改事件DependencyPropertyDescriptordpd=DependencyPropertyDescriptor.FromProperty(DataGridColumn.Visi... 阅读全文
posted @ 2013-07-04 09:13 muzizongheng 阅读(697) 评论(0) 推荐(0) 编辑
摘要:1.DisptcherObject提供了线程和并发模型,实现了消息系统。 2.DependencyObject提供了更改通知,实现了绑定,样式。3.Visual是托管API和非托管API(milcore)的之间的关键点。4.UIElement定义了Layout,Input和Events等核心子系统。Measure让一个组件来决定自己想要的size,而Arrange让父组件放置子组件并决定子组件的... 阅读全文
posted @ 2013-07-04 09:12 muzizongheng 阅读(830) 评论(0) 推荐(1) 编辑
摘要:1.尽量和Blend统一 2.兄弟元素之间需要空行 4.父子元素之间不需要空格 3.每行尽量单个属性5.Grid的Row和Column定义不需要空行6.Style里的Setter中不需要单行一个属性7.Trigger里的Binding和Conditions中不需要单行一个属性8.Converter和Setter中兄弟之间不需要空行 示例: 阅读全文
posted @ 2013-07-04 09:11 muzizongheng 阅读(302) 评论(0) 推荐(0) 编辑
摘要:1.把对象赋值为null 2.立即调用GC.Collect();注意:这个也只是强制垃圾回收器去回收,但具体什么时候执行不确定。代码: class Test { ~Test() { Console.WriteLine("DeConstructor."); } } class Program... 阅读全文
posted @ 2013-07-04 09:10 muzizongheng 阅读(528) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-07-04 09:10 muzizongheng 阅读(144) 评论(0) 推荐(0) 编辑
摘要:单例模式 (Singleton)单例讲的是当一个类被初次调用时,会产生一个类的实例, 而这个类的实例会贯穿程序的整个生命周期。单例提供了一个全局、唯一的实例。步骤:1.让类自己创建一个实例;2.提供一个全局访问这个实例的方法;3.声明这个类的构造为私有,防止其他对象创建一个新实例。C#示例: publicclassSingleton{privatestaticSingletoninstance;p... 阅读全文
posted @ 2013-07-04 09:09 muzizongheng 阅读(1112) 评论(0) 推荐(0) 编辑
摘要:1.下载NodePad++, 2.选择菜单Plugins/Plugin Manager/Show Plugin Manager3.勾选UniversalIndentGUI,点击Install4.下载uncrustify5.集成uncrustify到Visual Studio里:1)选择Tools/External Tools...2) 点击Add,记得勾选Use Output windowTit... 阅读全文
posted @ 2013-07-04 09:08 muzizongheng 阅读(2669) 评论(0) 推荐(0) 编辑
摘要:Go to the desktop version of IE10, hit the click ALT button on your keyboard, click on and then Compatibility View settings.Uncheck the last checkbox: “Download updated compatibility list from Microso... 阅读全文
posted @ 2013-07-04 09:07 muzizongheng 阅读(685) 评论(0) 推荐(0) 编辑
摘要:章节:线程与线程处理讨论多线程的优缺点,并概括了可以创建线程或使用线程池线程的几种情形。托管线程中的异常描述不同版本 .NET Framework 的线程中的未经处理的异常的行为,尤其是导致应用程序终止时的行为。为多线程处理同步数据描述将用于多线程的同步类中的数据的策略。托管线程状态描述基本的线程状态,并解释如何检测一个线程是否在运行。前台和后台线程解释了前台和后台线程的区别。Microsoft ... 阅读全文
posted @ 2013-07-04 09:07 muzizongheng 阅读(213) 评论(0) 推荐(0) 编辑
摘要:1.利用lock, 如: public class TestThreading { private System.Object lockThis = new System.Object(); public void Process() { lock (lockThis) { // Access thread-se... 阅读全文
posted @ 2013-07-04 09:06 muzizongheng 阅读(233) 评论(0) 推荐(0) 编辑
摘要:今天遇到一个奇怪的问题, 在给一个控件内的子元素绑定事件时,失败。 发现原因是,这个控件初始化时Visible=“Collapse”,这时控件内的可视树就没有生成。导致绑定事件失败。解决办法:如果想要初始隐藏这个控件, 可以设为Hidden。 阅读全文
posted @ 2013-07-04 09:05 muzizongheng 阅读(465) 评论(0) 推荐(0) 编辑
摘要:今天调试一个WPF程序时,出现一个问题。 程序运行后抛出异常, "Set connectionId threw an exception. XXXXXXXXXX",原因是依赖的一个dll运行出现问题。解决办法:在抛出异常时,可以在调试窗口local里输入$exception , 然后看innerException就可以知道是哪个dll出现问题。我的程序原因是dll内部自引用了一些资源,当我改了d... 阅读全文
posted @ 2013-07-04 09:04 muzizongheng 阅读(395) 评论(0) 推荐(0) 编辑
摘要:wpf中的控件模板里的元素有自己独立的命名域。 因此不能通过FindName来根据x:Name来查找子节点。 自己写了一个方法, 通过可视树遍历子节点,然后匹配名字。 如下: private static ChildItem FindVisualChildItem(DependencyObject obj) where ChildItem : DependencyObject ... 阅读全文
posted @ 2013-07-04 09:03 muzizongheng 阅读(2693) 评论(0) 推荐(1) 编辑
摘要:关于IDisposable的Dispose方法.Net中GC会自动回收托管资源, 对于非托管资源应该使用Dispose方法。 在使用Dispose方法时,应注意避免在Dispose内部中继续释放托管资源, 即防止Finalize方法被调用(SuppressFinalize)。 结构不支持继承,可以实现接口。 结构不支持析构函数。析构函数既没有修饰符,也没有参数。可以通过调用Collect强制进... 阅读全文
posted @ 2013-07-04 09:03 muzizongheng 阅读(195) 评论(0) 推荐(0) 编辑
摘要:附件是DataGrid支持滚动条的文件。具体使用如下: 1)DataGrid使用控件模板 --> --> 2)实例化ValueConverter,类似: 3)使用此类,类似: privateDataGridScrollbarHelper... 阅读全文
posted @ 2013-07-04 09:02 muzizongheng 阅读(1078) 评论(0) 推荐(0) 编辑
摘要:最近在做PACS的项目中想利用插件来加载各个不同的SCP的操作实现。比如Worklist的查询数据库,可以有多个实现。 比如MPPS的更新,也可以有多个实现。 为了统一弹性处理插件模块,增加了类型输入,用来只加载特定的服务的实现。 [InheritedExport(typeof(ISCPBase))] public interface ISCPBase { ... 阅读全文
posted @ 2013-07-04 09:01 muzizongheng 阅读(465) 评论(0) 推荐(0) 编辑
摘要:在做RIS的项目中遇到一个问题, 因为Worklist要兼容各个RIS数据库, 因此设计了目前这个架构。 1.xml文件来配置RIS数据库的数据源, 2.xml文件来存储关于查询/更新数据库的SQL语句, 其中参数/值输入可用用{x}来代替。 如{0}代表第一个参数 3.xml来配置Worklist SCU的query的字段和数据库字段的映射, 可以用Tag ID或者Tag Name与... 阅读全文
posted @ 2013-07-04 09:00 muzizongheng 阅读(547) 评论(0) 推荐(0) 编辑
摘要:最近优化EF的性能时遇到一个问题, 当在EF生成的Entityes的构造里加上: this.protocolnodes.MergeOption = MergeOption.NoTracking;this.protocolversionhistories.MergeOption = MergeOption.NoTracking; 调用DeleteObject时,会导致"The object can... 阅读全文
posted @ 2013-07-03 18:33 muzizongheng 阅读(642) 评论(0) 推荐(0) 编辑
摘要:DELIMITER // use protocoldb// drop procedure if exists sp_protocol_Update// create procedure sp_protocol_Update ( in p_ProtocolNodeUID varchar(64), in p_VersionUID varchar(64), in p_ParentProtocolN... 阅读全文
posted @ 2013-07-03 18:33 muzizongheng 阅读(592) 评论(0) 推荐(0) 编辑
摘要:今天遇到一个超级bug, Textbox做了限制, 只能输入数字。 结果在搜狗输入法输入中文时导致崩溃, 出错信息如下: 未处理 System.InvalidOperationException Message=无法关闭撤消单元,因为不存在已打开的单元。 Source=PresentationFramework StackTrace: 在 MS.Internal.Documents.... 阅读全文
posted @ 2013-07-03 16:49 muzizongheng 阅读(983) 评论(0) 推荐(0) 编辑
摘要:Subject: C#中如何获取其他进程的命令行参数 ( How to get other processes's command line argument )From: jiangong.li_SWTo: dongpo.zhu_SWDate Sent: 12/29/2012 10:42:37 AMprivatestaticIEnumerableGetCommandLines(stringpro... 阅读全文
posted @ 2013-07-03 16:49 muzizongheng 阅读(1963) 评论(0) 推荐(0) 编辑
摘要:C#中索引器是个好东西, 可以允许类或者结构的实例像数组一样进行索引。 在foreach或者直接索引时很有用。 使用索引器可以简化客户端代码, 即调用者可以简化语法,直观理解类及其用途。索引器只能根据声明的形参类型及数量进行区别, 形参命名不能作为区分。概述:使用索引器可以用类似于数组的方式为对象建立索引。get访问器返回值。set访问器分配值。this关键字用于定义索引器。value关键字用... 阅读全文
posted @ 2013-07-03 16:49 muzizongheng 阅读(300) 评论(0) 推荐(0) 编辑
摘要:1. 创建存储过程, DELIMITER // use protocoldb// drop procedure if exists sp_protocol_Update// create procedure sp_protocol_Update ( in p_ProtocolNodeUID varchar(64), in p_VersionUID varchar(64), in p_Pare... 阅读全文
posted @ 2013-07-03 16:48 muzizongheng 阅读(348) 评论(0) 推荐(0) 编辑
摘要:1. 接口为ExecuteStoredProcedure(string storedProcedureName, params ObjectParameter[] parameters) 2. 参数为存储过程名字, 及输入值。 3. 思路:创建连接(连接中指定了是Sql/MySql/ODBC等等); 创建通用DbCommand;更改Text以及Type;添加通用Parameter(DBPara... 阅读全文
posted @ 2013-07-03 16:48 muzizongheng 阅读(996) 评论(0) 推荐(0) 编辑
摘要:xml schema中有hexBinary类型, 我们在实现C#的Serialization时,一般默认把hexBinary映射为byte[],但是有些情况我们需要把 hexBinary映射为uint、int等等这样的类型。 这样我们就需要包装下, 如下: xml schema中定义ID节点, 类型为hexBinary。我们通过中间byte[] IDBinary转为uint ID, 实际使用中直... 阅读全文
posted @ 2013-07-03 16:48 muzizongheng 阅读(452) 评论(0) 推荐(0) 编辑
摘要:Entity Framework的性能优化: 1.使用MergeOption.NoTracking(发现添加这个代码后, 导致"The object cannot be deleted because it was not found in the ObjectStateManager."错误,解决办法为, 先调用entity实例的Attach(deleteObj),参数为要删除的对象,然后调用... 阅读全文
posted @ 2013-07-03 16:47 muzizongheng 阅读(556) 评论(0) 推荐(0) 编辑
摘要:1. 用Html.BeginForm(ActionName,ControllerName,Post)来实现controller-action的路由, 2. Form里的每个input的name值统一,比如都命名为commandName, 每个input的value设为不同值。3. 更改Action处理方法的参数, 添加一个参数为commandName,则commandName的值为input设置... 阅读全文
posted @ 2013-07-03 16:47 muzizongheng 阅读(715) 评论(0) 推荐(0) 编辑
摘要:其中Customers为数据库的某个表名,Custom自动被默认为单条记录的对象, 利用构造,InsertOnSubmit, 以及SubmitChanges实现插入数据。注意:linqpad的language选择为C# Statement(s)Customer cust = new Customer { ID=1000, Name="Bloggs" };Customers.InsertOnSubm... 阅读全文
posted @ 2013-07-03 16:46 muzizongheng 阅读(484) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-07-03 16:13 muzizongheng 阅读(324) 评论(0) 推荐(0) 编辑
摘要:项目中遇到一个问题, 有4张表, 然后相互之间有3张关系表关联, 一共七张表。 想要从顶层表查询最底层表的记录,不能写7层嵌套。 用Linq实现特别简单,表:User,Role,Module,Function以及User_Role,Role_Module, Module_Function, var fs = (from r in DB.user_role ... 阅读全文
posted @ 2013-07-03 16:11 muzizongheng 阅读(557) 评论(0) 推荐(0) 编辑
摘要:添加ExpectedException属性, 然后指定异常类型, catch后决定Assert.IsTrueThe following class contains the method to test:C#VBusing System; namespace MyCSNamespace { public class DivisionClass { public ... 阅读全文
posted @ 2013-07-03 15:05 muzizongheng 阅读(1135) 评论(0) 推荐(0) 编辑
摘要:TextBox txtTest;System.Windows.Input.InputMethod.SetIsInputMethodEnabled(txtTest, false); 阅读全文
posted @ 2013-07-03 14:35 muzizongheng 阅读(403) 评论(0) 推荐(0) 编辑
摘要:private void SetEnglishInputLanguage() { _inputLanguageBackup = System.Windows.Forms.InputLanguage.CurrentInputLanguage; System.Windows.Forms.InputLanguage.Cur... 阅读全文
posted @ 2013-07-03 14:34 muzizongheng 阅读(163) 评论(0) 推荐(0) 编辑
摘要:1.针对整个ContextMenu, 自定义一个Style,去掉竖分割线 ... 阅读全文
posted @ 2013-07-03 14:33 muzizongheng 阅读(644) 评论(0) 推荐(0) 编辑
摘要:主要是针对DataGridCellsPresenter而不是SelectiveScrollingGrid,使用时DataGridRow应用这个style就可以了。 阅读全文
posted @ 2013-07-03 14:32 muzizongheng 阅读(466) 评论(0) 推荐(0) 编辑
摘要:System.Windows.Interactivity.Interaction.GetTriggers(sender as DependencyObject)[0].Actions 阅读全文
posted @ 2013-07-03 14:31 muzizongheng 阅读(370) 评论(0) 推荐(0) 编辑
摘要:今天调试自己写的WPF的Behavior, 是关于TextBox只能输入数据或者小数点的。 发现有个问题, 就是英文IME下字母等等都能过滤, 但是一旦切换到中文输入法, 就会发现在OnPreviewTextInput处理 时Textbox.Text已经得到中文输入的值,导致就算PreviewTextInput响应了,而且当前的中文也被过滤了,但是TextBox.Text已经有同样的中文存在,... 阅读全文
posted @ 2013-07-03 14:30 muzizongheng 阅读(1518) 评论(0) 推荐(0) 编辑
摘要:Datagrid或者listview 中想要把相应的项 滚动到当前可见的位置, 必须满足2个条件: 1) 必须去掉虚拟化 VirtualizingStackPanel.IsVirtualizing ="False"2) 调用ScrollToView //Bring current selected item to view if(null != grdStudyList. Selected... 阅读全文
posted @ 2013-07-03 14:29 muzizongheng 阅读(634) 评论(0) 推荐(0) 编辑
摘要:Datagrid有多个bug;1,不支持DynamicResource的东西2, 在Column隐藏后再显示, ColumnHeader的Tag或者DataContext为null。解决办法:用StaticResource ,如下面的StaticResourceDGC_ContentTemplate;用DataGridColumnHeader的Column,来取得上层的datacontext。如,... 阅读全文
posted @ 2013-07-03 14:27 muzizongheng 阅读(353) 评论(0) 推荐(0) 编辑
摘要:using System ;using System .Diagnostics;using System .IO;class Program{ static void Main() { // // Setup the process with the ProcessStartInfo class. ... 阅读全文
posted @ 2013-07-03 11:42 muzizongheng 阅读(1508) 评论(0) 推荐(0) 编辑
摘要:Collection was modified; enumeration operation may not execute”这次项目中遇到一个问题, 就是C#程序随机崩溃, 抛出上面的异常。经过debug后,发现原因是:c#的linq用Where关键字查询列表时,其他线程在操作此列表, 导致Where查询转换为Foreach时抛出异常。解决办法: 应该有个全局的信号量来负责同步对列表的操作。 在... 阅读全文
posted @ 2013-07-03 11:41 muzizongheng 阅读(492) 评论(0) 推荐(0) 编辑
摘要:现在我们同时在主干和分支上进行开发, 当你需要将主干上某一工程代码 Merge到分支上(或者相反)时, 不要用check out 然后全部覆盖的方法, 这样不会关联源上的任何 history, 而且需要对每个被覆盖的文件进行比较。正确操作如下图:好处是:一是以前的 history还在, 二是Merge时 TFS也会提示到底哪些改动了。 阅读全文
posted @ 2013-07-03 11:40 muzizongheng 阅读(299) 评论(0) 推荐(0) 编辑
摘要:以下的这个类实现了 2个含有部分字段名字相同 的对象的 赋值拷贝。public class ShallowCopyHelper { public static void CopyPropertiesValue(object objFrom, object objTo) { if (null == objFrom) { return; } if (null == objTo) { return;... 阅读全文
posted @ 2013-07-03 11:39 muzizongheng 阅读(345) 评论(0) 推荐(0) 编辑
摘要:@Echo Off Set _Date=%date% If "%_Date%A" LSS "A" (Set _NumTok=1-3) Else (Set _NumTok=2-4) :: Default Delimiter of TAB and Space are used For /F "TOKENS=2*" %%A In ('REG QUERY "HKCU\Control Panel\Inte... 阅读全文
posted @ 2013-07-03 11:38 muzizongheng 阅读(1035) 评论(0) 推荐(0) 编辑
摘要:1,更改任何文件, 先checkout, 再继续更改。2. 更新sln时, 一定要更新include文件3. 每次提交代码放到shelf上, 自己本地建立2个workspace, 来进行codereview, 完成后让龙海进行测试。 一定要告诉龙海影响了哪些功能, 需要不需要进行完整的回归测试。4. 解决bug时, 应该关联changeset。Template when solve a DIM b... 阅读全文
posted @ 2013-07-03 11:15 muzizongheng 阅读(563) 评论(2) 推荐(0) 编辑
摘要:1. 首先到官网下载http://threadpool.sourceforge.net/2. 包含头文件#include "../boost/threadpool.hpp"3. 声明threadpool对象,boost::threadpool::fifo_pool m_poolCmdProcess;上面声明了一个FIFO线程池, 即先进先出4. 声明一个Runnable适配类 来包装你的类及成员函... 阅读全文
posted @ 2013-07-03 11:13 muzizongheng 阅读(746) 评论(0) 推荐(0) 编辑
摘要:1. 首先引用boost::function和boost::bind的头文件和库;#include "boost/bind.hpp"#include "boost/function.hpp" 2. 声明自己的function模板typedef boost::function CMDHANDLER;3. 写出自己类及成员函数class CCommunicationMap{public:CComm... 阅读全文
posted @ 2013-07-03 11:12 muzizongheng 阅读(1343) 评论(0) 推荐(0) 编辑
摘要:最近做一个ListView的Style时,发现一个问题, 就是我的GridView的GridViewColumn的CellTemplate无论是用StaticResource还是DynamicResource,都是没有效果。原因:GridViewColumn用了DisplayMemberBinding 使得CellTemplate失效。解决办法: 去掉DisplayMemberBinding, ... 阅读全文
posted @ 2013-07-03 11:11 muzizongheng 阅读(818) 评论(0) 推荐(0) 编辑
摘要:最近做WPF项目遇到一个问题, 我有2个process, 一个Process里只有Usercontrol, 另一个Process获取前一个Process中Usercontrol并host到当前的window里。 结果Usercontrol里的ErrorTemplate默认的红框没有出现, 但是ValidationRule已经触发。 原因找见: Window类默认的Style包含AdornerDe... 阅读全文
posted @ 2013-07-03 11:10 muzizongheng 阅读(430) 评论(0) 推荐(0) 编辑
摘要:WPF error: does not contain a static 'Main' method suitable for an entry pointdoes not contain a static 'Main' method suitable for an entry point在Visual Studio中删除App.xaml从别的位置拷贝一个后会出现的编译错误,原因在于默认的App.... 阅读全文
posted @ 2013-07-03 11:08 muzizongheng 阅读(189) 评论(0) 推荐(0) 编辑
摘要:'System.Collections.Generic.IEnumerable' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be ... 阅读全文
posted @ 2013-07-03 11:06 muzizongheng 阅读(826) 评论(0) 推荐(0) 编辑
摘要:以下是一个包装的用于序列化反序列化XML和C# 对象的类。public class XmlSerializeHelper { #region Serialize/Deserialize private static System.Xml.Serialization.XmlSerializer serializer; private static System.Xml.Serialization.X... 阅读全文
posted @ 2013-07-03 11:04 muzizongheng 阅读(495) 评论(0) 推荐(0) 编辑
摘要:以下方法实现了遍历一个class中所有的字段, 并且递归遍历sub class。private StringBuilder _properties = new StringBuilder(); public MainView() { TraversalProperties(typeof(StudyInfoModel)); File.WriteAllText("Properties.txt", _... 阅读全文
posted @ 2013-07-03 11:02 muzizongheng 阅读(571) 评论(0) 推荐(0) 编辑
摘要:今天遇到一个很火的问题, 一个c#的class 序列化成xml后抛出异常, 信息为: XmlSerialize error: There was an error generating the XML document.然后看了下异常的内部原因, 是一个类型不匹配的问题, 把X转为Y的序列化。 阅读全文
posted @ 2013-07-03 10:28 muzizongheng 阅读(530) 评论(0) 推荐(0) 编辑
摘要:No overload for 'OnStartup' matches delegate 'System.Windows.StartupEventHandler' 今天wpf工程的App.xaml爆出这个问题, 明明cs理由事件处理函数OnStartUp,却无法编译。原因是App.xaml声明的类名和App.xaml.cs中的类名不同。修改一直, 并确认Event Hanlder存在。 阅读全文
posted @ 2013-07-02 17:40 muzizongheng 阅读(971) 评论(0) 推荐(0) 编辑
摘要:Linq 支持动态字查询集合, 也就是说根据传入的值进行查询。 比如我们有个类Patient, 其中有个字段PatientName, 现在有Patient集合, 想要查询PatientName为“John”的。 代码如下:class Patient{public string PatientName = "";}List patients = new List;Patient p1 = new ... 阅读全文
posted @ 2013-07-02 17:34 muzizongheng 阅读(320) 评论(0) 推荐(0) 编辑
摘要:1. arrayValue 和 vector的转换 // Json::Value root; vectorm_vctProcedureUID;for(std::vector::iterator iter = m_vctProcedureUID.begin(); iter!=m_vctProcedureUID.end(); iter++){root... 阅读全文
posted @ 2013-07-02 16:54 muzizongheng 阅读(299) 评论(0) 推荐(0) 编辑
摘要:#include #ifdef _UNICODE#define tstring std::wstring#define __T(quote) L##quote#else#define tstring string#define __T(quote) quote#endif#define _T(quote) __T(quote)#define _TEXT(quote) __T(quote)#defi... 阅读全文
posted @ 2013-07-02 16:50 muzizongheng 阅读(336) 评论(0) 推荐(0) 编辑
摘要:比如namespace A, 内部Class A, 那么调用class A的方法只能通过A.A.XXX来访问。 或者说实例化一个class A,A a = new A(); // compile errorA a = new A.A(); //Ok 阅读全文
posted @ 2013-07-02 16:38 muzizongheng 阅读(249) 评论(0) 推荐(0) 编辑
摘要:Visual Studio 编译后去掉只读属性attrib $(TargetPath) -Rattrib $(TargetDir)$(TargetName).pdb -R 阅读全文
posted @ 2013-07-02 16:37 muzizongheng 阅读(267) 评论(0) 推荐(0) 编辑
摘要:火车票提前11天电话95105105订票流程~预知步骤节省时间2011-09-18 14:42:31 根据语音提示选择, 电话接通,一长串通知,可按任意键跳过; 一、订票---1, 订单查询/取消---2, (3没听清) 二、承接上一步“订票”, 又一波长串通知,可按任意键跳过 订票须知---1, 动车/直达车/高铁---2,普通车次---4, 学生票---6, 不限车次---... 阅读全文
posted @ 2013-07-02 16:36 muzizongheng 阅读(262) 评论(0) 推荐(0) 编辑
摘要:The following module was built either with optimizations enabled or without debug information今天同事的项目在Debug时遇到一个问题,添加断点,提示:断点在当前文本无效,给调试同昨带来一个问题,经研究发现,这个与Debug的模式有关。前提:VS2005 sp1,Debug模式。运行时提示如下信息:根... 阅读全文
posted @ 2013-07-02 16:35 muzizongheng 阅读(351) 评论(0) 推荐(0) 编辑
摘要:-sem(std::auto_ptr::auto_ptr,custodial(1)) // the auto_ptr class type // handles custody automagically比如说在一个函数A里面分配了内存,这时调用了另一个函数AddNode将分配的内存保存起来了,因此在函数A里面没有... 阅读全文
posted @ 2013-07-02 16:34 muzizongheng 阅读(630) 评论(0) 推荐(0) 编辑
摘要:C#工程引用需要注意的事项: ..\..\..\..\..\Output\win7_64bit\bin\Debug\McsfCLRNetBase64d.dll True ..\..\..\..\..\Output\win7_64bit\bin\Release\McsfCLRNetBase64.dll True 我们现在所有的C#的工程引用其他组的dll 的路径为 ..\... 阅读全文
posted @ 2013-07-02 16:32 muzizongheng 阅读(1152) 评论(0) 推荐(0) 编辑
摘要:我们经常会用到linq 来查询 一个数组中和另一个数组中相同的项, 这个时候就会用到IEqualityComparer接口。public class StudyInfoModel{ public string InstanceUID = "";}public class StudyCompare : IEqualityComparer{ // StudyInfoModel are equal ... 阅读全文
posted @ 2013-07-02 16:30 muzizongheng 阅读(907) 评论(0) 推荐(0) 编辑
摘要:1. 添加鼠标左键处理 AddHandler(DataGrid.MouseLeftButtonDownEvent, new RoutedEventHandler(grdStudyList_MouseLeftButtonDown), true);2. 命中测试private void grdStudyList_MouseLeftButtonDown(object sender, RoutedEve... 阅读全文
posted @ 2013-07-02 16:29 muzizongheng 阅读(550) 评论(0) 推荐(0) 编辑
摘要:1. UT工程的编译一定要让依赖的dll在同一目录,即和测试目标dll运行的环境一样。 比如 Demo—UT测试Demo工程, 则Demo工程依赖的所有dll必须和Demo输出的可执行环境Demo.dll/Demo.exe在同一目录。这样Demo-UT才能编译通过2.UT工程会生成XXX.testsettings文件,双击这个文件可以配置选项Hosts里 配置是测试32位 还是 64位进程。3.... 阅读全文
posted @ 2013-07-02 16:28 muzizongheng 阅读(310) 评论(0) 推荐(0) 编辑
摘要:DataGrid 滚动特定的行或者列。 DataGrid.ScrollIntoView Method (Object, DataGridColumn).NET Framework 4.5SilverlightScrolls the DataGrid vertically and horizontally to display a cell for the specified data item ... 阅读全文
posted @ 2013-07-02 16:27 muzizongheng 阅读(399) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-07-02 13:13 muzizongheng 阅读(372) 评论(0) 推荐(0) 编辑
摘要:如何在kindle 3上无法进入 http://www.google.com/reader, 先登陆www.google.com, 然后选择阅读器。 阅读全文
posted @ 2013-07-02 13:12 muzizongheng 阅读(216) 评论(0) 推荐(0) 编辑
摘要:在万能的链接里下载kindle-fonts-4.4.N-k3.zip,update后kindle里出现linkfonts/fonts,这里就是存放字体的位置,字体格式需用.ttf。在linkfonts/里中的fonts和etc就是破解自带的字体, 在网上下载其他的字体,解压覆盖这2个文件。如:http://dl.dbank.com/c08fuv6dms引用(2)原系统中文优化,越狱@字体自定义 优... 阅读全文
posted @ 2013-07-02 13:10 muzizongheng 阅读(692) 评论(0) 推荐(0) 编辑
摘要:/// /// /// /// 20110122 /// private string ConverterRISDateToValidDate(string orignalData) { string result = ""; DateTime dtResult = new DateTime(); bool isRight = DateTime.TryParseExact(origna... 阅读全文
posted @ 2013-07-02 13:09 muzizongheng 阅读(298) 评论(0) 推荐(0) 编辑
摘要:因为WaiAll需要多线程支持, 而WPF是STA模式, 可以通过以下方式实现WaitAll ManualResetEvent[] events;foreach (ManualResetEvent e in events) { e.WaitOne(); } 阅读全文
posted @ 2013-07-02 13:08 muzizongheng 阅读(243) 评论(0) 推荐(0) 编辑
摘要:private DelegateCommand searchCommand; public DelegateCommand SearchCommand { get { if (null == searchCommand) { searchCommand = new DelegateCommand(Search, CanSearchExecute); } return searchCommand; ... 阅读全文
posted @ 2013-07-02 13:07 muzizongheng 阅读(687) 评论(0) 推荐(0) 编辑
摘要:我们可以通过ManualResetEvent类来实现。 声明, 初始化时不执行private static ManualResetEvent _eventWorkList = new ManualResetEvent(false);Thead里的信号等待, 放在要控制的线程内, 当外部调用Reset时,线程暂停;当外部调用Set时,线程继续执行;_eventWorkList.WaitOne();... 阅读全文
posted @ 2013-07-02 13:06 muzizongheng 阅读(3741) 评论(0) 推荐(0) 编辑
摘要:ValidationRule 验证时, 当验证失败后,再次验证成功, errorTemplate 还是触发, 不会被清掉。 因此需要主动调用Validation.ClearInvalid(dtpTest.GetBindingExpression(DatePicker.TextProperty)); 阅读全文
posted @ 2013-07-02 13:05 muzizongheng 阅读(757) 评论(0) 推荐(0) 编辑
摘要:wpf中有validateRule类, 用于界面元素的验证, 如何后台去控制validateRule呢? 1. UI层要binding写好的ValidateRule,分为Binding和MultiBinding, 如下面分别实现了Combobox的SelectedValuePropperty的Binding 和TextBox的TextProperty的MultiBinding。其中都有Vali... 阅读全文
posted @ 2013-07-02 13:03 muzizongheng 阅读(1166) 评论(0) 推荐(0) 编辑
摘要:wpf 拿到某个control的multibinding以及其中每个Binding 1. 拿到multibinding MultiBindingExpressionmbe = BindingOperations.GetMultiBindingExpression((child as TextBox), TextBox.TextProperty);2. 拿到其中每个Binding的Path ... 阅读全文
posted @ 2013-07-02 11:43 muzizongheng 阅读(340) 评论(0) 推荐(0) 编辑
摘要:wpf的GridViewColumn的排序要用到ICollectionView 的SortDescriptions.SortDescriptions数组里是SortDescription, SortDescription有2个参数, 第一个为属性, 第二个为升序降序的选择。难点主要是第一个, 什么为属性? 属性就是你单条记录所绑定的数据层, 然后在里面选择你想要通过数据层的哪个字段来排序。示例... 阅读全文
posted @ 2013-07-02 11:42 muzizongheng 阅读(491) 评论(0) 推荐(0) 编辑
摘要:private TreeViewItem FindTreeViewItem(ItemsControl container, object item) { if (null == container || null == item) { return null; } if (container.DataContext == item) { return container as TreeViewI... 阅读全文
posted @ 2013-07-02 11:40 muzizongheng 阅读(3757) 评论(0) 推荐(0) 编辑
摘要:当wpf使用multibinding时, 其内部的validaterule的value 是其多个Binding的值, 要根据情况去验证, 还有就是在做IMultiConverter的ConvertBack时注意TargetType 如: 以下是一个Textbox通过MultiBinding绑定到后台 的字段, 以及前台的一个radiobutton, 该textbox有个validaterule。... 阅读全文
posted @ 2013-07-02 11:39 muzizongheng 阅读(760) 评论(0) 推荐(0) 编辑
摘要:要得到DatePicker的textchange属性, 必须通过TextBoxBase.TextChanged 事件来处理。 想要判断是否当前DatePicker的textbox获取到焦点, 可以通过以下代码:private void dtpBirth_TextChanged(object sender, TextChangedEventArgs e) { // IInputElement ch... 阅读全文
posted @ 2013-07-02 11:38 muzizongheng 阅读(845) 评论(0) 推荐(0) 编辑
摘要:json 正常情况下不会对私有成员进行序列化和反序列化, 因此在用json做深拷贝时, 就会丢失数据。 解决办法: 声明成公有成员。json在序列化和反序列化时, 如果类中有ICommand 成员, 可能会序列化失败。 因此json的应用在wpf中尽量只对Model层进行。json在对一个基类对象声明,而实际是派生类对象 进行序列化反序列化时, 序列化时的字符串正确, 但是反序列化因为声明的是... 阅读全文
posted @ 2013-07-02 11:37 muzizongheng 阅读(412) 评论(0) 推荐(0) 编辑
摘要:int count = System. ComponentModel.TypeDescriptor .GetProperties( StudyInfo).Count ; System.Diagnostics .Debug. WriteLine(count .ToString()); 阅读全文
posted @ 2013-07-02 11:36 muzizongheng 阅读(306) 评论(0) 推荐(0) 编辑
摘要:#define SPCAT_VOICES L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices"#define SPKEY_ATTRIBUTES L"Attributes"#define SPVALUE_LANGUAGE L"Language"BOOL CActionCenter::InitializeSAPI(){ReleaseSAP... 阅读全文
posted @ 2013-07-02 11:35 muzizongheng 阅读(925) 评论(0) 推荐(0) 编辑

如果我们时时忙着展现自己的知识, 将何从忆起成长所需的无知?