我的应用程序使用一个TClientDataSet和一个TDataSource集合。不DataBase涉及。将TClientDataSet被保存在XML格式。我TClientDataSet使用DataSet.SaveToFile方法保存,并且这样做,保存的文件保留了增量更改。我不能使用该DataSet.UpplyUpdates方法,因为如前所述,没有DataBase 因此也没有Provider。
DataSet.SaveToFile ('SavedFile.XML') // this retains Delta changes
DataSet.ApplyUpdates (0) // can't use it (no Provider)
我的问题是:在将 Delta 更改TClientDataSet保存到文件之前,如何强制对其应用 Delta 更改?如果保存为某种binary格式,是否会应用 Delta 更改?。注意:关闭并随后打开TClientDataSet也不起作用。
我正在研究一个程序,我需要通过http将'log.txt'上传到网络服务器
我搜索并得到了这个: -
德尔福XE:
procedure TForm1.Button1Click(Sender: TObject);
begin
idhttp1.Post('http://127.0.0.1/GET2.php', 'C:\Users\Someone\Desktop\log.txt')
end;
Run Code Online (Sandbox Code Playgroud)
php: -
<?php
$uploaddir = "uploads/";
$uploadfile = $uploaddir . basename( $_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile))
{
echo "The file has been uploaded successfully";
}
else
{
echo "There was an error uploading the file";
}
?>
Run Code Online (Sandbox Code Playgroud)
但没有上传文件
谢谢你的帮助
我正在使用Indy 10.5.7
我最近看到了如何使用Indy登录具有有效凭据的网站.现在我可以执行搜索并返回我需要的结果.
但是,我还是有问题.我必须理所当然地认为我已成功登录页面重定向,因为我无法获得200以外的响应代码.
我的意思是,我想处理用户输入用户名或密码输入错误的情况,并至少告诉他们有什么不对劲.
为了这个问题,我把Indy设置如下......
var
client : TidHTTP;
cookieMan : TidCookieManager;
params : TStringList;
response : string;
begin
cookieMan := TidCookieManager.Create(nil);
client := TidHTTP.Create(nil);
params := TStringList.Create;
try
with client do
begin
ProtocolVersion := pv1_1;
HTTPOptions := [hoForceEncodeParams, hoKeepOrigProtocol];
AllowCookies := True;
cookieManager := cookieMan;
HandleRedirects := True;
//Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0';
//Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36';
Request.UserAgent := 'Mozilla/5.0 (X11; U; Linux i586; …Run Code Online (Sandbox Code Playgroud) 我正在用 Delphi 开发组件。我被某些事情困住了,需要你的帮助。在我的组件中创建属性值时,我需要一个子属性。
简而言之,我希望它在ide上是这样的。我为此编写了以下示例代码。我在为测试目的编写的代码中遇到了一个我无法理解的问题。我的代码;
type
TCheckValue = class(TPersistent)
private
FValue1: Boolean;
FValue2: Boolean;
FOnChange: TNotifyEvent;
procedure Changed;
procedure SetValue1(Value: Boolean);
procedure SetValue2(Value: Boolean);
public
procedure Assign(Source : TPersistent); override;
property OnChange : TNotifyEvent read FOnChange write FOnChange;
published
property Value1: Boolean read FValue1 write SetValue1 default true;
property Value2: Boolean read FValue2 write SetValue2 default true;
end;
Run Code Online (Sandbox Code Playgroud)
成分:
type
THBComp = class(TComponent)
constructor create;
destructor destroy; override;
private
FCheckValue: TCheckValue;
procedure setCheckValue(Value: TCheckValue);
published
property CheckValue: TCheckValue read FCheckValue write …Run Code Online (Sandbox Code Playgroud) 当尝试使用 TLS v1.2 方法并使用端口 465 连接到 SMTP 服务器时,我的程序无限挂起。我在 mail.org 上创建了一个测试邮件帐户(TLS 1.2 强制)并尝试使用提供的数据。
环境:Delphi XE、Indy 10.6.2、OpenSSL 1.0.2u 程序文件夹中的DLL 文件。
源代码:
try
IdSMTPReport.IOHandler := FormMain.IdSSLIOHandlerSocketMail;
IdSMTPReport.UseTLS := utUseExplicitTLS;
IdSSLIOHandlerSocketMail.SSLOptions.Method := sslvTLSv1_2;
IdSMTPReport.Host := ###;
IdSMTPReport.Username := ###;
IdSMTPReport.Password := ###;
IdSMTPReport.Port := 465;
IdMessageReport.ContentType := 'text/plain; charset=UTF-8';
IdMessageReport.Sender.Address := IdMessageReport.From.Address;
IdMessageReport.Sender.Name := IdMessageReport.From.Name;
IdMessageReport.Recipients.Clear;
IdMessageReport.Recipients.EMailAddresses := ###;
IdMessageReport.Subject := 'Test';
IdMessageReport.Body.Clear;
IdMessageReport.Body := MailReport;
IdSMTPReport.Connect;
IdSMTPReport.Send(IdMessageReport);
IdSMTPReport.Disconnect;
except
try
IdSMTPReport.Disconnect;
except
end;
end;
Run Code Online (Sandbox Code Playgroud)
对象检查器中的 IdSSLIOHandlerSocketMail 设置
它在将任何状态文本/信息消息发送到OnStatus/OnStatusInfo事件之前挂起。
SMTP …
有关于如何安装和设置SubVersion服务器的任何文档?并通过网络与Delphi XE一起使用.
换句话说:我已经安装了Delphi XE,Subversion Client和Server.怎么办?我不明白他们是如何工作的.
我有这个程序:
procedure TMainForm.ExtractActor(const actor_id : string);
var
mystream : TStringStream;
js : TlkJSONobject;
begin
mystream:= TStringStream.Create('');
idHTTP1.Get(TIdURI.URLEncode('some dynamic url'),mystream);
js := TlkJSON.ParseText( mystream.DataString ) as TlkJsonObject;
//insert
if UniConnection1.Connected then
begin
UniQuery3.Params[0].Value:= StrToInt(js.getString('id'));
UniQuery3.Open;
if (UniQuery3.RecordCount = 0) then
begin
Uniquery2.Params[0].Value:= StrToInt(js.getString('id'));
Uniquery2.Params[1].Text:= js.getString('name');
Uniquery2.Params[2].Text:= js.getString('locale');
Uniquery2.Params[3].Text:= js.getString('gender');
Uniquery2.Params[4].Text:= js.getString('username');
Uniquery2.Execute;
end;
UniQuery3.Close;
end;
mystream.Free;
end;
Run Code Online (Sandbox Code Playgroud)
监视Windows任务管理器我看到进程内存不断增加.大约一天后,我将收到Out of Memory错误,应用程序将崩溃.我究竟做错了什么?我假设JSON或Devart UniDAC库都没有泄漏.
我在Delphi XE中遇到这个有趣的问题,我在其中创建了一个try/except/finally语句,当应用程序生成异常时,except块从不被调用,它直接跳转到finally块,我尝试了一些事情,比如反转try /除了/最后尝试/ finally/except,尝试将try块更改为不同的地方,清理代码并重新编译,以防Delphi问题,但注意似乎工作.
我在这里要完成的是向用户显示一条对话框消息,并在发生崩溃后清理代码.
procedure CallbackExport(Sender: TObject);
var
SaveDlg: TSaveDialog;
FileName: string;
begin
SaveDlg := TSaveDialog.Create (nil);
try
try
SaveDlg.Title := 'Export';
SaveDlg.InitialDir := GetSystemPath(CSIDL_DESKTOP);
SaveDlg.Options := [ofOverwritePrompt, ofEnableSizing];
case (Sender as TMenuItem).Tag of
cnExcel: begin
SaveDlg.Filter := 'Excel File (*.xls)|*.xls';
end;
cnHtml: begin
SaveDlg.Filter := 'HTML File (*.html)|*.html';
end;
cnTxt: begin
SaveDlg.Filter := 'Text File (*.txt)|*.txt';
end;
cnCsv: begin
SaveDlg.Filter := 'Comma Seperated File (*.csv)';
end;
cnXml: begin
SaveDlg.Filter := 'XML file (*.xml)|*.xml';
end;
end;
if not SaveDlg.Execute(self.Handle) …Run Code Online (Sandbox Code Playgroud) 我想用文件夹中的.DBF文件的名称填充此ListBox.
例如:我有文件夹C:/Kassendaten包含IArtikel.dbf,IBediener.dbf,等等
我需要这个让用户选择一个dbf文件.
我是Delphi的新手,不知道我是怎么做的.
任何人都可以帮助比较两个stringlist并从中获得差异的最佳方法是什么?
例如,如果我有AList和BList之类的话
一个列表
BList
如果我比较他们就好
for i := 0 to BList.count-1 do
if AList.indexof(BList[i]) < 0 then
ResultList.Add(BList[i]);
Run Code Online (Sandbox Code Playgroud)
结果是:
我只需要一次元素.我怎样才能避免多件物品?有没有比制作从List中删除多个项目的过程更好的解决方案?对不起我的英文,谢谢你的帮助!