wyingquan的专栏

毋意,毋心,毋固,毋我;积蹞步以致千里,积小流以成江河。

2009年08月02日

转载 6278 - is allocated with array new [], but deleted with scalar delete

6278 - is allocated with array new [], but deleted with scalar delete
ConsequenceDestructors will not be called

The calling function is allocating memory with operatornew[] , but freeing it with the scalar operatordelete .
This is an error. According to the C++ standard and the Microsoft Visual C++ implementation, the result of this inconsistent operation is undefined. In addition, this error can cause the following problems, among others:
The construct阅读全文>

发表于 @ 2009年08月02日 14:37:00 | 评论( loading... ) | 编辑| 举报| 收藏

2009年06月20日

原创 遇到cl : Command line error D8036 错误

IDE的一个bug: - $(ConfigurationName) should automatically be converted to $(Configuration) throughout all the property sheets (looks like we only do this for the project file). Same for $(PlatformName) that should be converted to $(Platform) - $(IntDir) and $(OutDir) must have a \ appended to them during conversion.阅读全文>

发表于 @ 2009年06月20日 23:06:00 | 评论( loading... ) | 编辑| 举报| 收藏

2009年05月21日

原创 使用xmanager远程连接centos5


首先编辑GDM配置文件
vi /etc/gdm/custom.conf
在相关属性里面添加相应的值
[security]
AllowRemoteRoot=true
[xdmcp] Enable=true
重启GDM /usr/sbin/gdm-restart 阅读全文>

发表于 @ 2009年05月21日 22:00:00 | 评论( loading... ) | 编辑| 举报| 收藏

2009年02月12日

原创 生成Unicode汉字表的程序


#include #include #include //GB2312将代码表分为94个区,每个区94位 #define GB2312_MATRIX (94) //第二字节开始编码 #define DELTA (0xA0) //第一字节以0xB0开始 #define FONT_ROW_BEGIN (0xB0) //第一个字节以0xF7结束 #define FONT_ROW_END (0xF7) //第二个字节以0xA1开始 #define FONT_COL_BEGIN (0xA1) //第二个字节以0xFE结束 #define FONT_COL_END (0xFE) //16-87区为汉字区 #define FONT_TOTAL (((87-16)+1) * GB2312_MATRIX) void UnicodeToGB2312(unsigned char* pOut, unsigned short uData); void Gb2312ToUnicode(u阅读全文>

发表于 @ 2009年02月12日 16:41:00 | 评论( loading... ) | 编辑| 举报| 收藏

原创 Unicode编码表到GB2312编码表映射表


const unsinged short uni_table[]= {
    0x4E00, /* GB2312 Code: 0xD2BB ==>一 Row:50 Col:27 */
    0x4E01, /* GB2312 Code: 0xB6A1 ==>丁 Row:22 Col:01 */
    0x4E03, /* GB2312 Code: 0xC6DF ==>七 Row:38 Col:63 */
    0x4E07, /* GB2312 Code: 0xCDF2 ==>万 Row:45 Col:82 */
    0x4E08, /* GB2312 Code: 0xD5C9 ==>丈 Row:53 Col:41 */
    0x4E09, /* GB2312 Code: 0xC8FD ==>三 Row:40 Col:93 */
    0x4E0A, /* GB2312 Code: 0xC9CF ==>上 Row:41 Col:47 */
    0x4E0B, /* GB23阅读全文>

发表于 @ 2009年02月12日 16:34:00 | 评论( loading... ) | 编辑| 举报| 收藏

2009年01月26日

原创 VC中使用使用CRT调试内存泄漏总结


1、加入新的宏和头文件的引用
     #define _CRTDBG_MAP_ALLOC
     #include
     #include
包含 crtdbg.h 头文件,可以将 malloc 和 free 函数映射到其“调试”版本 _malloc_dbg 和 _free_dbg,这些函数会跟踪内存分配和释放。
2、在需要检测内存泄漏的地方加入以下语句输出内存泄漏信息
     _CrtDumpMemoryLeaks();
3、在不确定程序出口时使用以下语句
     _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
4、设置CRT报告模式
    _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );
5、根据泄漏信息让程序在发生泄漏的位置启动断点
    A、在Watch窗阅读全文>

发表于 @ 2009年01月26日 04:03:00 | 评论( loading... ) | 编辑| 举报| 收藏

2008年12月20日

翻译 MYSQL的空间查询

Mysql空间查询及空间数据库的建立。阅读全文>

发表于 @ 2008年12月20日 22:35:00 | 评论( loading... ) | 编辑| 举报| 收藏

原创 用python实现crc32求字符串校验码


用python自带的binascii模块计算字符串的校验码,出来的是负值,与用c写的程序得出的校验码不一样,所以就研究了一下。发现别人用的python3.0版本binascii模块计算出的crc32校验码是我想要的,没办法只好自己用python实现一下crc32的算法了。发现算法很简单,就是某些实现里面弄了好几个函数倒搞复杂了,其实按核心算法算法走一边很容易就理解和应用了。
因为直接从c程序转过来的,结果发现python2.5(我用的版本ActivePython 2.5.2.2 (ActiveState Software Inc.) based on
Python 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit (Intel)] on win32)里面的按位取反尽然不是按位取反,网上搜出好多文章都说~在python中是按位取反,自己测试了下:
>>> ~3,~2,~1,~0,~-1,~-2,~3
(-4, -3, -2, -1, 0, 1, -4)
阅读全文>

发表于 @ 2008年12月20日 00:35:00 | 评论( loading... ) | 编辑| 举报| 收藏

2008年12月07日

转载 BOM(Byte-order Mark)

Byte-order Mark
Always prefix a Unicode plain text file with a byte-order mark. Because Unicode plain text is a sequence of 16-bit code values, it is sensitive to the byte ordering used when the text was written.
A byte-order mark is not a control character that selects the byte order of the text; it simply informs an application receiving the file that the file is byte ordered.
Ideally, all Unicode text would follow only one set of byte-ordering rules. This is not possible, how阅读全文>

发表于 @ 2008年12月07日 04:16:00 | 评论( loading... ) | 编辑| 举报| 收藏

转载 Unicode编程资料

1. 如何取得一个既包含单字节字符又包含双字节字符的字符串的字符个数?可以调用Microsoft Visual C++的运行期库包含函数_mbslen来操作多字节(既包括单字节也包括双字节)字符串。调用strlen函数,无法真正了解字符串中究竟有多少字符,它只能告诉你到达结尾的0之前有多少个字节。2. 如何对DBCS(双字节字符集)字符串进行操作?函数 描述PTSTR CharNext ( LPCTSTR ); 返回字符串中下一个字符的地址PTSTR CharPrev ( LPCTSTR, LPCTSTR ); 返回字符串中上一个字符的地址BOOL IsDBCSLeadByte( BYTE ); 如果该字节是DBCS字符的第一个字节,则返回非0值3. 为什么要使用Unicode?(1) 可以很容易地在不同语言之间进行数据交换。(2) 使你能够分配支持所有语言的单个二进制.exe文件或DLL文件。(3) 提高应用程序的运行效率。阅读全文>

发表于 @ 2008年12月07日 03:47:00 | 评论( loading... ) | 编辑| 举报| 收藏

2008年11月28日

原创 Python访问google


搞了超过4个小时才搞定的,对web cookie访问这块不熟,发现增加【opener.addheaders = [('User-agent', 'Opera/9.23')] 】就可以正常访问了。这里记录一下。
import urllib,urllib2,cookielib
cj = cookielib.CookieJar()
url = 'http://www.google.cn/search?hl=zh-CN&q=test&meta=&aq=f&oq='
opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('User-agent', 'Opera/9.23')]
urllib2.install_opener(opener)
req=urllib2.Request(url)
response =urllib2.urlopen(req)
content = res阅读全文>

发表于 @ 2008年11月28日 17:19:00 | 评论( loading... ) | 编辑| 举报| 收藏

2008年10月01日

原创 Python字符串操作

1、复制字符串    str2 = str12、链接字符串    str += "abc"3、查找字符串    string.find(sub)阅读全文>

发表于 @ 2008年10月01日 22:58:00 | 评论( loading... ) | 编辑| 举报| 收藏

2008年06月23日

原创 道格拉斯-普克抽稀算法

道格拉斯-普克抽稀算法,是用来对大量冗余的图形数据点进行压缩以提取必要的数据点。该算法实现抽稀的过程是:先将一条曲线首尾点虚连一条直线,求其余各点到该直线的距离,取其最大者与规定的临界值相比较,若小于临界值,则将直线两端间各点全部舍去,否则将离该直线距离最大的点保留,并将原线条分成两部分,对每部分线条再实施该抽稀过程,直到结束。抽稀结果点数随选取限差临界值的增大而减少,应用时应根据精度来选取限差临界值,以获得最好的效果。阅读全文>

发表于 @ 2008年06月23日 15:31:00 | 评论( loading... ) | 编辑| 举报| 收藏

2008年06月14日

原创 有关压缩的一些东西

有关开源压缩库的简要介绍阅读全文>

发表于 @ 2008年06月14日 21:19:00 | 评论( loading... ) | 编辑| 举报| 收藏

2008年05月16日

原创 File Handling

文件处理函数阅读全文>

发表于 @ 2008年05月16日 00:42:00 | 评论( loading... ) | 编辑| 举报| 收藏

Copyright © wyingquan
Powered by CSDN Blog