Author Archives: nanzt

Pm v2.23

仍没有帮助,有时间的朋友可以帮我写,我目前是补不上了,没有时间
也没有中文界面,既然是帮助大家学英语的,界面上的这点英语不算什么大问题吧,
如果有英语错误请帮我指出来
 
v2.2.3 [Sep-08-05]
# fixed typing a dir path in destination dir of pm tools will activate the Apply button when selecting either the backup or the restore option.
+ new Phrase Memo v2 toolkit, functioning with rebuild, back up and restore backed databases.
 
v2.2.2 [Aug-26-05]
# recompiled QtGui4.dll, to fix a popup menu bug which make menu cannot show on the taskbar.
+ singleton support.
+ double clicking the tray icon will bring up the window.
+ added system tray support. Now minimizing behavior will cause the windows hidden into system tray.
* rearrange the context menu of text edit.
# fixed when reverse selecting an underlined text then move the cursor to unformated text, the underline button will not changed simultaneously.
# fixed the cursor still keeps visible changed to read only mode.
* the cursor keep in the same position on save
 
下载请到 http://503.mygis.org,进去后,进入tags/rls-mmdd/,mmdd表示build的日期,选择离现在最近的日期,进入该目录,请下载 *_setup.exe。如果需要验证其合法性,请下载*_setup_md5.txt,内含该可执行文件的md5 hash码。你如果认为你的朋友也能用,just feel free to distribute it.
用户密码按已知的来,没有的请给我写信 giscn_at_msn[dot]com
 

在qt里实现access数据库的compact和repair

增加2个#import,
#import "C:Program FilesCommon FilesSystemadomsado27.tlb" no_namespace rename("EOF","adoEOF")
#import "C:Program FilesCommon FilesSystemadomsjro.dll"
增加从QString到BSTR的转换函数
static inline BSTR QStringToBSTR(const QString &str)
{
 return SysAllocStringLen((OLECHAR*)str.unicode(), str.length());
以下主要代码,注意在srcConnection和desConnection不能指向同一个数据源。
//compact the db
 JRO::IJetEnginePtr jet(__uuidof(JRO::JetEngine));
 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 QString srcConnection=QString("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%1;")
  .arg(dbqPath);
 QString desConnection=QString("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%1;")
  .arg(dbqPath+".tmp");
 jet->CompactDatabase(QStringToBSTR(srcConnection), QStringToBSTR(desConnection));
 bool renameError=false;
 if ( !QFile::rename(dbqPath, dbqPath+"k")) renameError=true;
  
 if (!QFile::rename(dbqPath+".tmp", dbqPath)) renameError=true;
    QApplication::restoreOverrideCursor();

雨天

昨天是Labor Day,在apartment里呆了一天。早上醒的早,出来,发现居然是阴天。不过到Union Park,可能因为工人在除草的关系,迎面都是绿草的味道,感觉好极了。只不过将到办公室时,雨下大了,弄湿了,希望不会感冒。

Hurricane and Typhoon

Katrina抵达new orleans风速达62m/s左右,按台风的定义属于super typhoon,如果要折算成风速级别的话,大概是Beanfort level 17左右。
  作为对比,Typhoon Talim登陆福建时是45 m/s,TY Haitang登陆福建大概30m/s,去年的 TY Rananim(云娜)登陆的时候大概也是45m/s多些。

STAR WARS in ASCII

做的很不错。但可能要先看过星战后才能看懂。
请使用telnet登陆到 towel.blinkenlights.nl
具体步骤:
1. 开始 > 运行
2. 键入cmd,找开命令窗口
3. 在命令窗口提示符下,键入 telnet towel.blinkenlights.nl
4. enjoy it!

如何在Qt程序里关闭另一个程序?

好象Qt是没有提供好的方案了。
(1)另一个程序在运行时,在某个地方写一些特殊的东西,Qt程序可以根据这些特殊的
东西进行判断该程序是否正在运行。正如qtcn群上一位同志讲的,如果该程序没有正常
退出的话,Qt程序的判断就会有问题。此外,这种solution的一个前提是Qt程序和该程
序都应该是有源码可以修改的。一个好处是绝对是cross platform的。
(2)应用独立于platform的代码。比如可以用win32 api来枚举进程,但问题是相对比较
复杂,比如在winxp和nt上的枚举相关api都不一样,在linux, mac等平台上的实现更是
不容易。
(3)msdn上给出一种相对简便的方法(http://support.microsoft.com/?kbid=153463),
也是应用win32 api。先使用findWindow,输入窗口的title,得到该程序的handler,
然后向应用postMessage向该程序发送WM_QUIT(eggheadcafe.com上有人建议用
WM_CLOSE
(http://support.microsoft.com/default.aspx?scid=kb;en-us;178893)),来关闭该
程序。缺陷,一个也是独立于平台的,另外一个,应用FindWindow,不排除有窗口
title相同的程序,这样返回的handler未必正确。

qDebug()引起的一连串free溢出

调用类似 qDebug()<"main(), db.dbConnect() ="<<db.dbConnect();
引起程序在关闭的时候,free.c内存溢出。
qDebug doc讲,在一些平台,如果输入const char* =0的时候,可能crash掉
但现在不是这个问题,
最后发现原因是 在连接的时候输入库写成 release版本了,选择对应的debug版本就ok了(QtSql4.lib->QtSqld4.lib)。
此为记!