porting win console app to MONO

MONO为.net程序提供了在linux等平台下运行的可能。一个简单的win console程序也可能会出现一些问题:

  • P/I
  • path separator
  • case sensitivity

比如.net代码引用了非托管代码,而非托管代码是不能在linux下运行的。这时会出现P/Invoke的问题。我不知道如何解决,重写吧。
linux下的路径分隔符与win下不一样,建议.net下的全部写成 /,或者用 Path.SeparatorChar,否则会出现在linux下找不到文件的问题
linux下大小写敏感,所以在.net代码里也要注意文件写的大小写问题,应当严格一致。

对winform情况更为复杂,一些.net下的功能可能在MONO下还没有完全支持,所以在porting的时候应当注意这些功能。
看官方网站,目前MONO处在1.x到2.0中间的某阶段,这意味着MONO还没有完全支持2.0,一个复杂的项目从.net到mono还是需要efforts才能搞定。

钱学森过世了?

门户网站上还没有消息,BBS上已经有了,而且得到一些人的证实。钱尽管有些事情做的不合适,但真还是一个很伟大的人了。想想当初在美国拿tenure的professor,即使在现在都没有几个愿意回国的,他能毅然回家报效国家,真是太了不起。

估计是谣言,前两天还看到新华网关于钱先生96大寿的新闻。

外面好大的雪

今天下了好大的雪,住的地方门前已经积了10公分了,跟兰州的雪不一样,兰州的雪鲜有这么干净雪白的。路上车也少,开的也慢,老美好路开习惯了,下雪下雨一些人就不大敢开车出门。

Qt integration for Eclipse

Trolltech finally organized technicals to develop integration with Eclipse, the popular C++ development environment in open source community. A version of 1.0 RC2 has come out and can be found from Trolltech offical FTP server at ftp.trolltech.com. I tried this integration tool to develop a small console tool. It features some interesting things. But it is not very stable yet. Hope 1.0 release version will be more stable and more user friendly.

Pm v2.25

一个俺用Qt写的用于记录你平时遇到的精彩英语句子的小软件。我感觉对于大家平时需要积累英语表达来撰写科技论文很有帮助,我一般在看英文文章时,这个小东西都是打开的,看到好的地道的表达方式就记录下来,等自己写的时候如果想不起来就查一下,反正我的经验是经常感觉类似句子表达以前在某地方看过但死活想不起来,这时候这东西就发挥作用了。没有批量导入功能,有朋友请求过,实现起来并不难,但我不想做,因为这小东西本来就是为了帮大家提高英语的,如果能强迫大家敲一遍那就起来作用了。不要向我请求什么功能,又不是商用了,我没有太多时间来改善这东西,功能够用就好。

请点击这里下载Pm v2.25安装文件

MD5 sum: f9d813cbf325c3eb93beb35f1335e1b3

Shugong’s baby girl

Today I went to see Shugong, and had a look at his lovely baby girl. She was born around one week ago. I asked Shugong how he feels as a daddy. He said he was proud but very tired. The little baby wakes up every hour in night that making the couples can not even go to sleep. His wife said yesterday she cannot awake him up possibly he was too tired in past days. I experienced those tough time when Duoduo was younger than 1 year old. Anyway, all of us are not regrettable to our initial decision to have a baby.

Qt for VS c++ 2005 EE

Qt 4.3.2 已经支持 Visual Studio C++ 2005 Express Edition了,但不提供Integration,要使用的话,大概使用makefile project再加一点定制,比如使用qmake .pro来生成makefile,通过一些配置,Qt就可以使用VS这个稳定和强大的平台了(比如Intellisense, Debug等都比其它如Eclipse出色,毕竟是商业的)

To install it, download Qt 4.3.2 open source from its ftp at ftp.trolltech.com, configure it using a -platform win32-msvc2005, then compile/link by running nmake.

One thing to be noted is we have to install Windows Core SDK, IE SDK (If no IE SDK, prompting by missing shlwapi.h), and optionally MDAC SDK if you are going to install ODBC, prior to configure Qt. VC++ 2005 Express Edition does not come with SDK. We should install SDK seperately. One way is to install this package by appropriate customing.  

After installation, configure vcvar32.bat under "C:Program FilesMicrosoft Visual Studio 8Common7Tools" by adding "C:Program FilesMicrosoft Platform SDK for Windows Server 2003 R2Bin", "C:Program FilesMicrosoft Platform SDK for Windows Server 2003 R2Include",  and  "C:Program FilesMicrosoft Platform SDK for Windows Server 2003 R2Lib" to #path, #include and #lib respectively. Otherwise the compilation will complain it cannot find necessary header files.

完成了一个雷达数据到水文模型时间序列的转换程序包

这边的一个韩国同事前面写了一个Python版本的,在Linux下可以运行。我在Windows下对它进行了改进,并做了一些优化。结果在正式计算的时候,发现Ohio流域的一个子流域(2560个HRAP网格)10年逐小时估计要花上233天以上,同时需要空间也达100G以上。所以尽管该Python可用,但基本上对于大流域属于不实用的。为了完成工作,与梁讨论了以后,决定结合GIS和自己写代码,大概Coding了两周吧,现在终于完成了好几个小工具。在性能上进行了大量的优化(前一版本在转换到一半的时候出现内存不够,所以调试要花十分多的时间)。
我写了一个Instruction,大概从原始下载过来的XMRG二进制文件到可用的水文模型(如VIC)的时间序列大概要经过近10个步骤。不过实现了一个有意思的内插方法(与前Python算法相同),从HRAP网格到1/8度的转换时,由于每个1/8度网格覆盖多个HRAP格子,这个算法使用了面积加权来计算1/8度网格的平均降水。
现在完成上述任务大概需要2天。大家就可以在自己的桌面机器上用了,而不必一定要使用服务器(有大内存)。
没有时间做多线程或者并行优化,估计那样异步或并行处理性能会得到更好的提升。