Max Terentiev
-
Content Count
6 -
Joined
-
Last visited
Posts posted by Max Terentiev
-
-
So, I can destroy TsslHttpCli from any another application event (like CancelButton.OnClick, Form.OnClose, etc) without any special care ? No matter is TsslHttpCli idle or process some request ?
-
Hi,
I create and use TsslHttpCli like this:
Http=new TSslHttpCli(NULL); SslContext=new TSslContext(NULL); Http->SslContext=SslContext; Http->OnRequestDone=HttpRequestDone; Http->URL="https://api.server.ru/api/data-list/"; Http->GetASync();
If I call GetASync() can I destroy TsslHttpCli at any time before they fire OnRequestDone event ? For example, if user close program can I run code like this:
delete Http; // or Http.Free; on pascal
Or I must call TsslHttpCli.Abort or AbortComponent and wait until they ready for destruction (in this case - how to understand is it's ready for destruction)?
Thanks for help !
-
I solve problem by overriding setting/getting fields content like this:
TUTF8StringField = class(TStringField)
private
FAutoUtf8Conversion: Boolean;
protected
function GetAsString: string; override;
function GetAsVariant: Variant; override;
procedure SetAsString(const Value: string); override;
public
constructor Create(AOwner: TComponent); override;
published
property AutoUtf8Conversion: Boolean read FAutoUtf8Conversion write FAutoUtf8Conversion;
end;
//=============================================================constructor TUTF8StringField.Create(AOwner: TComponent);
begin
FAutoUtf8Conversion:=false;
inherited Create(AOwner);
end;
//------------------------------------------------------------------------------function TUTF8StringField.GetAsString: string;
begin
if FAutoUtf8Conversion then
Result:=UTF8ToString(GetAsAnsiString)
else
Result:=inherited GetAsString;
end;
//------------------------------------------------------------------------------function TUTF8StringField.GetAsVariant: Variant;
begin
if FAutoUtf8Conversion then
Result:=UTF8ToString(AnsiString(inherited GetAsVariant))
else
Result:=inherited GetAsVariant;
end;
//------------------------------------------------------------------------------procedure TUTF8StringField.SetAsString(const Value: string);
begin
if FAutoUtf8Conversion then
inherited SetAsAnsiString(UTF8Encode(Value))
else
Inherited SetAsString(Value);
end;
//------------------------------------------------------------------------------ -
Hi,
I moving my project from D2007 to Rio. My project uses ElevateSoftware DBISAM database engine. I was very happy with it but it's not support unicode and I got problems with saving string data from new unicode-enabled delphi controls to TDBISAMTable: i got ???? instead of unicode symbols. I can handle this problem by manually encode/decode string fields values to/from UTF8. But I need to do it in several thousands places in my code :((((
Maybe somebody already found elegant solution for this problem ? Maybe overriding some methods in TDataSet ?
I found TStringField.Transliterate and TDataSet.Translate it's almost that I need but function
function TDataSet.Translate(Src, Dest: PAnsiChar; ToOem: Boolean): Integer;
have PAnsiChar params and I have data loss (???? instead of unicode) here, so I can't use it for background UTF8 conversions. But I need something similar !
Thanks for help !
-
What about IOCP sockets (on windows) and EPOLL (on linux) for better performance and scale on multi-core CPU ?
Is it's safe to destroy TSslHttpCli while http request in progress ?
in ICS - Internet Component Suite
Posted
Thank you very much for help !