只是为了好奇,
为什么在Delphi中,如果我们通过以下方式定义一个空char:
a:Char;
a:='';
Run Code Online (Sandbox Code Playgroud)
我们得到一个错误:不兼容的类型:'Char'和'string'
但是,如果我们放置
a:='a';
Run Code Online (Sandbox Code Playgroud)
没事的?
是否有必要通过定义一个空字符:a:=#0?
经过一些实验后,我最终得到了以下代码,以便在MSWord中执行搜索和替换.此代码在页眉和页脚中也能很好地工作,包括第一页或奇数/偶数页面的页眉和/或页脚不同的情况.
问题是我需要调用MSWordSearchAndReplaceInAllDocumentParts我替换的每个字符串,并且我得到一个不可接受的性能(在4页doc字中大约50个字符串2分钟).理想情况下,它当然应该是"瞬时的".
在处理页眉和页脚之前,我只是在主文档中进行搜索和替换(使用wdSeekMainDocument).在这种情况下,perofmrance是可以接受的(即使很慢).我只是想知道它为什么这么慢:切换视图需要时间吗?通常页眉或页脚包含的单词很少,所以我预计页眉和页脚中的所有搜索和替换都不会使整体性能变得更糟.但这不是我观察到的.
这是代码,在底部我放置了探查器结果:
// global variable (just for convenience of posting to Stack Overflow)
var
aWordApp: OLEVariant; // global
// This is the function that is executed once per every string I replace
function MSWordSearchAndReplaceInAllDocumentParts;
begin
try
iseekValue := aWordApp.ActiveWindow.ActivePane.View.SeekView;
iViewType := aWordApp.ActiveWindow.ActivePane.View.Type;
if iViewType <> wdPrintView then
aWordApp.ActiveWindow.ActivePane.View.Type := wdPrintView;
if aWordApp.ActiveDocument.PageSetup.OddAndEvenPagesHeaderFooter then
begin
Try
aWordApp.ActiveWindow.ActivePane.View.SeekView := wdSeekEvenPagesFooter;
SearchAndReplaceInADocumentPart;
Except
// do nothing ..it was not able to set above view
end;
Try
aWordApp.ActiveWindow.ActivePane.View.SeekView := wdSeekEvenPagesHeader; …Run Code Online (Sandbox Code Playgroud) 我有用户登录/注销应用程序:我想破坏会话,当我关闭浏览器((所有标签)),IE,Firefox工作时它的工作正常.但是当用户关闭单个选项卡时,我想破坏会话.我在用 :
session_set_cookie_params(0);
session_start();
Run Code Online (Sandbox Code Playgroud) 我想编写一个包来计算某个输入公式的结果值,
我创建了解析器,因为Shunting-Yard算法(Dijikstra),我想创建用户将被允许使用的函数的库(对于ex:sin()和cos()函数)然后我想知道我的下一步应该是什么; 所以我有一些问题:
什么更简单的使用,Shunting Yard算法,或递归下降算法解析公式?
我会在工作的某个阶段到达口译员的工作吗?
谢谢...
请注意,我正在使用Delphi编程
两个或多个应用程序如何使用单个ASPState数据库.
我实现了SQL服务器会话管理.我在我的IIS上部署了一些asp.net应用程序,我想实现SQL服务器会话管理,所以我有ASPState DB,我想为所有应用程序共享这个数据库.
DB-数据库
我不知道我的Delphi发生了什么.它不响应我的要求:
这只发生在这个项目中,因为我开了一个新项目并且行动很好.这个项目有没有损坏的东西?(它被编译并构建没有错误.)