哥从即日起,戒网 3+23+3+3 天,庆祝某歌最终走出局域网!期待腾讯退出天朝!
哥从即日起,戒网 3+23+3+3 天,庆祝某歌最终走出局域网!期待腾讯退出天朝!
杯具的VFP字符串替换函数
工作的原因,一直无法摆脱使用Visual Foxpro,然而杯具也就次成型…….
源于一个小小的错别字,1000多条记录,在采集的过程中把“杯具”两个字竟然弄成“洗具”了
然而,看上去现实无法接受这个结果,我得把“洗具”改回“杯具”
于是我找到了VFP的Help文件,查到了CHRTRAN这个字符串替换函数
看了他的说明和例子,发现这家伙的替换的确不如其他语言的Replace工作起来那样简单明了
为了确保替换的准确性,俺又用了OCCURS先准确地判断“洗具”这两个字出现
然后才用CHRTRAN进行替换,一切看起来工作地相当正常~~
然而杯具也就此发生了。
你会发现在替换过的记录中,其他的极少的字莫名其妙地变成了另外的字,甚至一些不认识的东东。
我有替换其他字吗?没有。那杯具是如何发生的?
经过Google之后,才发现CHRTRAN只处理ASCII,那您明白了,杯具就是这样发生的。
而后,Google告诉我,在中文的时候应该使用CHRTRANC,That’s it is。
[C++]char*、TCHAR*、wxString之间的相互转换
char*->TCHAR*
| char *ansii_string = “some text”;
int size = strlen(ansii_string); TCHAR unicode_string[30]; mbstowcs(unicode_string, ansii_string, size+1); |
TCHAR*->char*
| TCHAR* unicode_string=_T(“unicode string”);
int size= wcslen(unicode_string); char ansi_string[30]; wcstombs(ansi_string, unicode_string, size+1); |
wxString->char*
| wxString wx_string=_T(“wx string”);
char ansi_string[30]; strcpy(ansi_string,wx_string.mb_str()); |
char*->wxString
| char *ansii_string = “some text”;
wxString wx_string(ansii_string,wxConvUTF8); |
wxString->TCHAR*
| wxString wx_string=_T(“wx string”);
TCHAR wchar_string[30]; wcscpy(wchar_string,wx_string.wc_str()); |
TCHAR*->wxString
| TCHAR *tchar_string = _T(“some text”);
wxString wx_string(tchar_string,wxConvUTF8); |
Migrating Existing Delphi Applications to Unicode-enabled Delphi
Over the life of an application it is often necessary or desirable to migrate the application to a newer version of the development environment. By doing so, the application can take advantage of a more modern interface, improvements in performance or memory management, as well as new or improved features.
It comes as no surprise, therefore, that there are many Delphi applications that have been converted, upgraded, and migrated through two or more versions of Delphi.
There is one migration, however, that stands out from the rest. That is the migration of a native code application written in Delphi 2007 or earlier to the latest version. What makes this one so different is that a number of the fundamental data types, types that have been around since the Delphi 1 and Delphi 2 days, have changed. I am talking about String, Char, and PChar, and I am referring to their support for Unicode.
In late 2009, Michael Rozlog, Senior Directory of Delphi Solutions, contacted me to see if I was interested in writing a white paper about migrating Delphi applications to Unicode-enabled Delphi. Ironically, I was in the midst of writing training material about what Unicode support meant for application development. And, I was keenly aware that a Unicode migration white paper, if it was to be effective, needed to rely on much more than just my personal experience. This really was a job for the greater RAD Studio community.
Here was my thinking. Delphi 2009 had been out for almost a year and a half, and Delphi 2010 had shipped three months earlier. As a result, many developers had been through the process of migrating existing applications to the Unicode enabled versions. And, if there was some way of collecting their stories, a clear picture of the migration process would emerge.
The call for stories, code samples, and advice on Unicode migration went out using blogs, tweets, the Embarcadero Developer Network, and some gentle personal prodding of various Delphi experts. And during 6 weeks in October of November I was fortunate enough receive a lot of input. In all, more than 20 contributors provided material, sometimes with a single, valuable code sample, and in other cases, with extensive narratives describing the preparation, process, and techniques used to migrate their applications.
And what a group of contributors this was. A number of them are the innovators behind some of the most popular third-party tools available to Delphi Developers. I also received input from well-known authors, trainers, bloggers, and authorities in the Delphi community. Everyone had something valuable to say, and it all contributed nicely to the paper.
This material is now available in the white paper Delphi Unicode Migration for Mere Mortals: Stories and Advice from the Front Lines. This paper begins with a brief overview of some of the technical aspects of Delphi’s Unicode support. It then addresses specific areas of application development that may be affected by the changes to Delphi’s default string types.
Throughout the paper you will find direct quotes from the contributors, and in most cases you will also find code samples that reflect the kind of changes that you may have to make to your code as you upgrade existing applications (as well as possible changes to some of the core techniques you are accustom to using). I tried hard to give credit where credit was due, as I strongly feel that a paper of this scope and breadth would be nearly impossible were it not for the generous contributions of the contributors.
To everyone who contributed material, and especially to those brave individuals who agreed to review the paper for technical accuracy, thank you.
If you are preparing to migrate an existing application to Delphi 2010 (or Delphi 2009), or are in the midst of your own migration, you will hopefully find a lot of valuable information in this white paper. I do have one request, however. When you are ready to read the white paper, please download it right before reading. I hope to update this paper sometime in the future with additional material, if it makes sense to do so. In fact, the version of this paper that out there at the time of this writing (January 9th, 2010) includes two corrections that were reported by readers. If you downloaded the PDF prior to January 8th, you have the older version. Get the newer version.
One final note. If you also have stories, advise, or code samples that are not reflected in the current version of the white paper, and would like to have your material considered for a future revision, please do not hesitate to send it to me. I cannot promise that new contributions will actually appear in the paper (there was some nice material that didn’t fit into this version), but I would like to consider it.
点这里下载:Migrating Existing Delphi Applications to Unicode-enabled Delphi
2009最后一博,迎接开源2010
时间是在2009年12月31日 18:01分。
手机里已经有好多祝福元旦的信息了,眼见的2010年还有几个小时了,借用一句俗不可耐的话,人活着,时间没了~哈~
不想在老套的总结了,原因吗,很简单~,这一年忽忽悠悠就过了,貌似啥也没干
就在2009的最后几天,才是我从开始学计算机以来最有意义的日子。
1998年,和蜜蜂一起执著地翻外文的网页,申请免费的.com的米,尽管一直没有成功。
1999年,好像第一次见到HTML,把玩之后,感觉这个东东是个好玩意。
2000年,貌似已经开始做了个人主页,亿唐的免费空间和邮箱~~呵呵,计数器还不断往上涨
2001年,花了一个通宵,在赛扬466的机器上安装了一个盗版的Windows 2000。瀑布汗一个~~~~~后来就开始阅读一些源代码了,尽管一开始从来没看懂过
2002年,把Windows 98已经玩的很烂了
2003年,学习了简单的C和Java。第一次认识面向对象
2004年,有一个完整假期实践了Coding。
2005年,有一个完整的假期实践了逆向工程,俗些就是破解了一些软件。
2006年,开始走向工作岗位,教了初中数学,思想品德,生物……
2007年,接触了远程教育,细细把玩了远程教育设备和配套的软件的等等的东东,制作一套系统恢复盘
2008年,呼呼悠悠的一年,都在催我找个善良的女孩做朋友了,实在无奈之下,问起的时候我总是假装豪情万丈的告诉人家,我肯定在09年把这事情搞定
……
2009年,就在这几天,认识了wxWidgets,认识了freepascal,认识了codelite,认识了mingw32,我才真正认识到,原来软件的发展之路在开源。然而就在写博文是,我同时意识到,我依然是光棍1根…….
2010,迎接蜕变,迎接开源2010
qfly 写在2009的最后一天。
Utilities that come with Free Pascal 之 h2pas系列
偶然从freepascal的官网上下载了本手册。阅读到了本章节一直比较关注的问题,这里做个小小的笔记,以备查阅。
想学pcre呢,用CMake和MingW编译后,可用的lib和dll是有了,但问题是没有“头文件”。
缺那个呢?pcre.h要转成pas的申明,还是有相当难度的。
看见了h2pas工具后,这一切就变的简单了,呵呵。
什么,你急着用h2pas pcre.h?那么,嘿嘿,恭喜你,一堆错误。
一定是这个工具有问题吧?我一开始也是这么想的。
直到我发现h2paspp后,这个工具是先把头文件的预处理指令给处理了,您在用h2pas试试?
怎么样,成功了吧。呵呵~不过这只是转成功了,能不能用,还要在看了。
文件批量改名工具 优秀教程 整理
时间过去好久了,久的我几乎要忘记文件批量改名工具 3.0beta。
然而让人激动的是,尽管是个不完善的软件,还有一些很关注的人,在这许久之后,还会给我发Email,会写如此优秀的教程。
每一次看到这些热情的文章,都会让人感动。真心的感谢,感谢曾经或正在关注文件批量改名工具的人,感谢所有为此默默奉献的人。 阅读全文…
VIM命令详解

一位大牛的vim命令图解。貌似该牛现在在MIT,膜拜个。
上面是截图,看不太清。
下面的PDF版是绝对的原版,可以打印出来贴在墙上,咯咯~~
点我下载:
http://www.qfly.cn/wp-content/uploads/2009/12/vgod-vim-cheat-sheet-full.pdf
最新评论