When I debug one .Net 4.0 program with SOS. After .loadby sos clr then run any SOS command results in following errors:
Failed to load data access DLL, 0x80004005 Verify that
1) you have a recent build of the debugger (6.2.14 or newer)
2) the file mscordacwks.dll that matches your version of mscorwks.dll is in the version directory
3) or, if you are debugging a dump file, verify that the file mscordacwks_.dll is on your symbol path.
4) you are debugging on the same architecture as the dump file. For example, an IA64 dump file must be debugged on an IA64 machine.
You can also run the debugger command .cordll to control the debugger's load of mscordacwks.dll. .cordll -ve -u -l will do a verbose reload. If that succeeds, the SOS command should work on retry.
If you are debugging a minidump, you need to make sure that your executable path is pointing to mscorwks.dll as well.
By google, some posts were found with same error info. But most of them are focus on the debugging dump on another machine with differnt mscordacwks version. This is not the case as I’m doing living debug. From the 1) hint of the error message I check the Windbg version is 6.6 and then install the newest version 6.13.0006. It works!
~~~~~~~
The same error happened during debug a Waston dump. The solution is
0:000> .cordll -ve -u -l
CLRDLL: Unable to find mscordacwks_AMD64_AMD64_2.0.50727.5005.dll by mscorwks search
CLRDLL: Unable to find 'mscordacwks_AMD64_AMD64_2.0.50727.5005.dll' on the path
CLRDLL: Unable to find mscorwks.dll by search
CLRDLL: ERROR: Unable to load DLL mscordacwks_AMD64_AMD64_2.0.50727.5005.dll, Win32 error 0n2
CLR DLL status: ERROR: Unable to load DLL mscordacwks_AMD64_AMD64_2.0.50727.5005.dll, Win32 error 0n2
The version we are trying to find is 2.0.50727.5005, while check the attribute of file mscordacwks.dll under D:\Windows\Microsoft.NET\Framework64\v2.0.50727 it turns out its version is 2.0.50727.4454. Copying the mscordacwks.dll from the machine where the dump was generated to the root path where Windbg is installed and rename it to mscordacwks_AMD64_AMD64_2.0.50727.5005.dll. It works!
蛊
器久而不用之而蛊生,人久宴溺而疾生,天下久安无为而弊生。
蛊之灾非一日之故也,比世而后见。
柔弱不争,久必见咎。
掩耳盗铃
Patterns of Enterprise Application Architecture Chapter 1&2
After reading several design pattern books including “Head first design pattern” and “Java and Pattern” I turned my focus to one new book named Patterns of Enterprise Application Architecture. From the comments of amazon it seems that it’s one pretty good book. Considering the limited memory now, writing down some key ideas from the book should be able to keep the reading more interesting.
The preface section defines the scope of this book which is architecture for enterprise application. The common patterns of enterprise applications include data persistence, concurrent access, huge data process, complex UI, and integration to other enterprise application. Here the UI involves Web and traditional rich client application. Also the authors gives some points on the measurement for performance. Finally the form of pattern is given which contains name, intention, summary, how it works, when to use it and further reading, also some examples maybe also presented for better understanding.
The first chapter talks about layering. This topic starts from the evolution from the Client/Server model to three principal layers. One problem of the traditional C/S model is that the domain logic is hard to organized. It’s a bad idea to mix the logic in client UI directly which may easily causes duplicated code and maintain issues. Alternative way is putting them to the server side which usually presented as database store procedure. Here the store procedure is limited and may causes difficulty to switch to different database.
These short comes naturally involves idea to separate the domain logic in the object oriented world. This results in the new three principle layers including Presentation, Domain and Data source. one interesting point raised by author to think about the Presentation and Data source layer is that “Presentation is an external interface for a service your system offers to someone else, whether it be a complex human or a simple remote program. Data source is the interface to things that are providing a service to you”. Also one principle here is “The domain and data source should never be dependent on the presentation” which means we should be able to easily change our presentation layer without requiring changes in domain logic layer.
The benefits of layering contains: Easy to understand separated layer, minimize dependencies between different layers, substitute layers with alternative implementations of the same basic services. One obvious drawback of layering is that performance as we need to pass data to different layers. But compare to the benefits usually the cost is worthwhile.
The chapter 2 discusses about the way to organize domain logic. Transaction Scripts, Domain Model, and Table Module. They all have pros and cons. The recommended way is Domain Model which is good at complexity when the problems scope increase.
以卜筮者尚其占
最近在读《后汉书》比较靠后面的一些文章,是一些综合性的介绍某一方面人物的,比如循吏,酷吏,儒林,文苑,独行,方术等等。其中最没有意思的文章当属儒林和文苑了,不得不说读书人的事情实在是没有意思,无聊的很,全是诗词歌赋,可惜我要读的是历史。读方术列传的时候,突然有种感觉,似乎自己在读的不是历史,而是神话小说,但至少还算有趣。
题目卜筮者以尚其占是这一篇文章引用易经的一段话,“易有圣人之道四焉:以言者尚其辞,以动者尚其变,以制器者尚其象,以卜筮者尚其占”,就是圣人会用卜筮来预测未来,查了下,这个卜筮是不过三次,就是第一次如果不吉,可以第二次,再不吉可以第三次,但是不可超过三次,就是所谓“筮不过三”,后来的“事不过三”据说就是从这个来的。
文章介绍了不少善于预测事情的人物,估计也的确有一些是真实的事情吧,当然必定也有一些以讹传讹的故事,只是占卜似乎也的确是很有技术含量的一件事情,不知道如果自己花费些时间读易经,能否也能学个几招,然后去摆个地摊算命,哈哈。
疑留不断,至于殄败
题目是后汉书宦官列传里面提到窦武和何进时候的感慨,倒也非常贴切。
窦武的长女被立为皇后,作为外戚而被封侯,为人“清身疾恶,礼赂不通,妻子衣食裁充足而已”。首先是上书救了党锢之祸的士族李膺,杜密,后面参与立灵帝,他的长女也就成为了太后。因为看不惯宦官弄权,于是借太后诏除掉了宦官管霸,苏康,但是要杀另一个曹节的时候,太后不忍,于是“事久不发”。后面计划泄露,于是宦官曹节,王甫劫持灵帝,窦武发兵但最终兵败被枭首示众,诛九族。这里面还提到了一个传说,窦武在出生的时候他的母亲同时产一蛇,蛇被送到森林里面去了。后来他母亲过世的时候,这个蛇在墓前“若哀戚之容”。这个说明史书有时候也会八卦。
何进,就比较有名了,还是因为三国演义的缘故。他的同父异母的妹妹被立为皇后,因为剿灭黄巾起义被封侯。这个何皇后生的是刘辩,但是灵帝觉得他轻佻没有威仪,倾向于刘协,就是后来的汉献帝。但是皇后有宠,何进又有重权,所以一直到死都没有立太子,其实这个汉献帝也够惨的,小时候他的生母就被何皇后给杀了,他实际上和董太后抚养的,这也是后来董卓立他的原因之一。灵帝死的时候把刘协托付给了宦官蹇硕,蹇硕准备杀了何进立刘协,但是何进知道了计划,不去皇宫,所以还是刘辩即位,蹇硕被别的宦官出卖被杀。后来何进准备杀其他宦官但是何太后不同意,最终也是拖了很久没有决断,最终宦官决定先下手为强,何进又没有听进别人的劝告又去了皇宫劝说何太后,结果被杀。这也引发了何进手下领兵进宫屠杀宦官,最终董卓之乱起。
历史有时候或许真的是必然和偶然的结合体。就那个时代而言,汉朝灭亡是必然的,但是窦武,何进的死却是其自身的一念之间的失误,所谓当断不断反受其乱,然也。
新和谐关键词: "诺*贝*尔*和*平*奖”
今天看到诺*贝*尔$和*平*奖公布了,得主是刘*晓*波,心里觉得不妙,估计有新的关键词要出来了。果然很快各大网站就撤下了诺贝尔奖的专题,用Google搜诺*贝*尔$和*平*奖立即被盾,用wikipedia搜刘*晓*波也一样的结局。水木上有人开玩笑说估计诺贝尔瓷砖也快要完蛋了,呵呵。
第一次关注这个人是因为*零*八*宪*章的事情,在一个神奇星球的神奇国度里面,很多宪法中的东西能写,但是你不能宣传,不然就是煽动颠覆国家政权罪,似乎还记得当年的不锈钢老鼠上街宣传马克思主义的事情,而如今类似的事情便不断上演。想起网络上一个经典帖子的回复:“不顶不是中国人”,下面有人回“Re, 不顶下辈子还是中国人!”,接着有人回“顶!不顶下辈子中朝轮换!”。
也许历史总是这么的相似吧,道路以目,焚书坑儒,党锢之祸,文字狱,所谓“防民之口甚于防川”总会被人们忘记。不禁想起前几天YD在接受CNN采访时还指出言论自由在任何国家不可或缺的,他和中国人民都相信,中国将继续进步,人民对民主及自由的渴求和需要是不可抗拒的,可惜当我用“温家宝 民主 自由 不可抗拒”搜索Google,结果又被盾了!
士虽以正立,亦以谋济
十一假期的确成了读书的好时间,如果不出去玩的话。今天读了后汉书卷六十六《陈王列传》,记载的是陈蕃和王允的事迹,后者是大大有名的,不过应该都是三国演义的功劳。
陈蕃这个人首先出名的就是不打扫庭院,“大丈夫处世,当埽除天下,安事一室乎?”,于是来访的客人“知其有清世志”。有趣的是,这里根本就就没有我们所熟知的“一屋不扫,何以扫天下”,搜了半天也没有找到后面这句话的出处,或许只是后人的凭空编造,也许是劝诫世人不要好高鹜远,做事情要从小事做起,但是牵强附会还是不好的。当然现在的人,想打扫个自己的屋子可不是那么容易的,感谢郭嘉!陈蕃在当官的时候处理了一件很有趣的事情,民间有个叫赵宣的人,以孝著称,他父母去世后,就住在墓道里面守孝二十馀年,有人推荐给了陈蕃。结果一问到这个人的老婆孩子,发现这个人有五个孩子都是在这个时候生的,于是陈蕃大怒,以“寝宿冢藏,孕育其中,诳时惑众,诬污鬼神”给定罪关起来了。古代守孝三年,是不能有夫妻生活的。陈蕃这个人也颇为耿直,“性方峻,不接宾客”,经常上书惹恼皇帝,被罢官了好几次。其实皇帝似乎也的确不容易做,这个陈蕃就曾经上书劝皇帝不要在后宫样太多妃子,所谓“盗不过五女门,以女贫家也。今后宫之女,岂不贫国乎!”;还要皇帝不要去打猎;劝皇帝要“诚不爱己,不当年先帝得知勤苦?”,“明鉴未远,覆车如昨”。最后和窦武一起准备诛除宦官,没有得到太后的支持,最终事情泄露,被宦官先下手为强遇害。后汉书赞曰“以遁世为非义,故屡退而不去;以仁心为己任,虽道远而弥历”。
王允,这个人是大大的有名,在我看来是个非常悲剧性的人物,本来是有机会做出一番大事业的,性格使然。这个人小的时候就被人称赞为“一日千里,王佐才也”,年轻的时候也颇为正直,得罪了太守差点被杀,后来讨伐黄巾贼的时候大获全胜,得到了宦官张让和黄巾贼交往的书信,交给了皇帝,结果皇帝只是责备了这个宦官,并没有定罪。于是就得罪了张让,被诬陷下狱,后来遇到大赦复官了,结果不到一个月,又被以其他罪名给抓起来了,有人就劝他还是自杀为好,免得被折磨侮辱而死,甚至把毒药都给送上来了,结果王允“吾为人臣,获罪于君,当服大辟以谢天下,岂有乳药求死乎!”,最后还是命大加三公都为他求情,结果最终被减死释放了。后来就是熟悉的和董卓的故事了,“矫情屈意,每相承附”,当然没有小说那样精彩,只是“乃潜结卓部吕布,使为内应。会卓入贺,吕布因刺杀之”。在董卓死后,如何收拾残局是一件很考量政治智谋的事情,本来是准备赦免董卓的部下们,但是王允有犹豫是否这样反而让他们猜疑,吕布建议用董卓的财物来赏赐大臣安定人心,王允也不同意,而且也只是视吕布一介武夫,吕布也觉得自己功劳大,所以关系也不好,这样最终大家都不太依附王允。最终董卓的部将李傕(que)郭汜等看到自己没有被赦免又要被解除兵权,于是起兵造反,吕布不敌,在逃走的时候叫王允一起,但是王允还是决定留下“如其不获,则奉身以死之”,“临难苟免,吾不忍也”,最终被杀。后汉书论曰“士虽以正立,亦以谋济”,的确是非常中肯的评价。
读完颇有些感慨,不管结果如何,至少他们的气节还是让人非常钦佩,只是不知道多少年后,会不会也有人读本朝的历史,有同样的感慨?
完成BLOG的迁移
微软终于还是决定把Windows Live Spaces服务关闭了,不知道到底是出于怎么样的考虑,就使用起来而言,的确有些糟糕,但是和Windows Live Messenger的集成让我一直还是在使用它,也许公司大了反而难以作出很好的个人用户体验的产品。
按照说明的步骤把BLOG给迁移到了wordpress.com上面来,在迁移开始的时候可以下载备份文件,结果我下载了好多次都没有成功,烂,真的很烂。wordpress的风格个人还是颇为喜欢的,可以使用不同的外观,就是可惜免费用户似乎不能自己安装插件。
在搬完后突然想起来自己以前读书的时候在实验室的机器上曾经搭过Wordpress,后来毕业的时候把数据库给备份了下来,其中还有几篇文章,于是在千辛万苦之后终于成功地也给搬移到新的BLOG了。主要是通过在虚拟机Debian上面自己搭建Apache+MySQL+WordPress,导入数据库文件,再通过Wordpress的导出为WXR文件,再导入就好了,这个过程最大的问题就是中文乱码,不过还是最终搞定了。
Financial Market: Debt Markets: Term Structure Note
Today I spent some time to learn the Financial Market Lesson 10 from the Yale Open Course, which is about the Debt market and term structure given by Robert J. Shiller. http://www.tudou.com/playlist/playindex.do?lid=8813050&iid=57503786&cid=25. Followings are the Lecture Notes in order to help me remember the key ideas.
First of first, following new words to me are recorded:
coupon: 股息. auction: 拍卖. treasury: 国库券. depicted: 描绘. monolith: 整体材料. unseen rule: 潜规则. gobble-up: 吞并. down to earth: 实际. maturity: 到期,成熟
At the beginning of the lecture, bond is introduced divided as three categories:
1) Discount bonds, also named bills which is paid within 1 years. There’s no coupon carried with this bonds, rather it’s sold with a discount rate against 60 days. Let’s suppose the Discount Rate is r = 2.51, then it will be sold at price 100 – 2.51*60/360 = 99.58. It’s a history tradition to use 360 rather than 365 here, for it’s inconvenience to divide 365 when all these things are calculated by hands in the early ages. But we should notice that when the year’s investment rate of return is calculated, 365 must be used with formula as (1/r – 1) * 365/60, which is about 2.563% for above example. This kind of bonds usually is only sold periodically to certain certificated dealer, who may later sell them to public at bid price and buy them from public at ask price.
2) Coupon-carried bonds, with time limit between 1 and 10 years are called Notes, with more than 10 years usually named bonds. The coupon is named due to history reason when there were indeed coupons attached to paper, with which people needed to tear down to go to bank to get their pay based on half year interval. There is on formula for the price of such bonds as
Price = Current Value (Principal, C) = Current Value of ( C/2 at 0.5 Year, C/2 at 1 Year, …., Principal at N year, C/2 at N Year).
Another important concept introduced here is term structure, which also named yield curve and used to describe the relationship between the interest rate and time to maturity of debt. With such difference interest rates, it’s kindly like that the time “price” for bonds, and we can calculate “forward rate” based on these differences.
3) Inflation bonds. This is bonds with couple considered the inflation rate. Suppose the inflation rate is Pi, then the real rate = 1 -(1+Rnormal) / (1+Pi) ~= Rnormal – Pi.
That’s all.