BackgroundWorker用于在另一个线程里执行一些操作。以前经常在UI thread启动一个workder对象,去完成一个耗时操作。然后在其ProgressChanged事件的EventHandler中去更新UI. 在.net 中,创建UI control和access的线程必须是同一个线程,否则操作是非法的。在文档中可以查到在ProgressChanged的EventHandler中是可以安全的更新UI的。那么在BackgroundWorker中是如何做的呢?
配置git使用socks5代理
最近github网站经常抽风(当然是你懂的的原因),网页上通过配置科学上网之后有所改善。但是在使用git clone时还是经常性失败。在网上找了一波解决方案,发现配置下git代理,很简单,效果立竿见影。
关于git stash的使用小结
以前使用svn作为版本控制时,每个branch都在本地有一份代码,这样可以同时打开好多个分支。在一个分支加feature,可以很方便的另一个分支上修bug。在切换为git之后,默认所有branch都在本地只有一份copy,有的时候需要临时切换下分支,但不想提交还未完工的代码,会使用到git stash来暂存下代码。然后bug修改之后,再使用git stash pop将暂存的代码恢复过来。
但是在使用了几次git stach之后,经常会遇到一些问题:忘记pop或者pop到了错误的分支导致冲突。本文结合再v2ex上的一些回答,建议最好不要使用git stash,直接通过commit然后最后再通过git reset来回到原来的commit点,完成之后重新commit。
Dependency walker的简单介绍
在c++中可以使用LoadLibrary来动态加载dll,最近遇到了一个跟发布有关的问题。在自己的电脑上运行没问题,但是在客户机上却LoadLibrary失败,返回126的错误。使用Dependency walker分析之后,发现是要动态加载的类库依赖另外一个类库,客户机找不到该类库,所以失败。下面简单介绍一下Dependency walker的使用方法。
Dependency walker是一个可以用来查看windows上可执行文件依赖库的工具。可以用来分析库的装载相关的错误。
Dependency Walker is a free utility that scans any 32-bit or 64-bit Windows module (exe, dll, ocx, sys, etc.) and builds a hierarchical tree diagram of all dependent modules. For each module found, it lists all the functions that are exported by that module, and which of those functions are actually being called by other modules. Another view displays the minimum set of required files, along with detailed information about each file including a full path to the file, base address, version numbers, machine type, debug information, and more.
What are TCHAR, WCHAR, LPSTR, LPWSTR, LPCTSTR
前段时间看到一篇关于C++中TCHAR,LPSTR的基础知识的文章,写的非常清晰易懂,看完之后觉得解决了以前一直郁结在心中的一些问题。推荐去看下原文:What are TCHAR, WCHAR, LPSTR, LPWSTR, LPCTSTR 。本文简单归纳总结下。
浅谈MemoryMappedFile
c#中使用RegisterNotification来接收特定GUID的设备消息
在WIN32 API中提供了一个RegisterNotification函数来接收系统发过来的message。本文介绍一下在csharp中调用该接口来监听特定GUID的设备消息。