Virgo
Members-
Content Count
86 -
Joined
-
Last visited
Everything posted by Virgo
-
Unfortunately I do not have Delphi version new enough. But maybe there is an overloaded version, that allows required parameters? Indy own TIdSocketHandle.SetScokOpot also has AOptVal:Integer... But GStack.SetSocketOption seems to have required version.
-
What SetSockOpt are you using? In Linux SO_RCVTIMEO parameter is supposed to be a pointer to timeval record. Not Int.
-
function SHA1ofStr or Base64Encode fault output
Virgo replied to xauxag's topic in ICS - Internet Component Suite
What I ment was, that I got an impression, that SHA1ofStr and Base64Encode functions were originally written for pre-Unicode Delphi. And to make them work on Unicode Delphi version String was just replaced with AnsiString. And on old Delphi versions it was usual to use string as byte buffer. Event Delphi itself did it. -
function SHA1ofStr or Base64Encode fault output
Virgo replied to xauxag's topic in ICS - Internet Component Suite
Since hash function results binary hash and not hexencoded one and the function predates Unicodestring Ansistring result makes sense. UnicodeString for binary hash would be the worst type. -
function SHA1ofStr or Base64Encode fault output
Virgo replied to xauxag's topic in ICS - Internet Component Suite
Really strange... That output value decodes to hexencoded value 1d29ab734b0c9585240069a6e4e3e91b613f69 Correct value would be 1d29ab734b0c9585240069a6e4e3e91b61da1969 So da19 to 3f or lead surrogate-da19 to question mark? Some sort weird unicode issue? -
SSLHandler variable is not initialized... So Access Violation is mandatory.
-
Embedded web server at random port and use http://localhost:port/ as redirect url...
-
Semicolon is also forbidden before else...
-
delphi Exception illegal instruction (0xc000001d) in Windows Preinstallation Environment 8.1
Virgo replied to hoaque's topic in Software Testing and Quality Assurance
Which part of this would apply to sample program in original post? Windows 8.1 is not listed as supported platform, but if Windows 7 is supported, then that should not be an issue. And if it works Windows 10 PE, then that makes it unlikely, that it uses something like AVX. Although, compiling it with all optimizations off would be something to try. Other thing would be to remove SysUtils usage... Just in case, that it is something in SysUtils initialization. As I understand, problem is not with IDE but with statically linked command line program, that only uses System and SysUtils units. -
Problems with Delphi class structure / visibility
Virgo replied to Willicious's topic in Delphi IDE and APIs
What kind of programming languages have you actually used before? Because you would have same issues in most languages... Event in javascript or python you need an instance to actually use it. -
How can I allocate memory without raising exceptions ?
Virgo replied to Marus's topic in General Help
Lets not forgot overcommit . On some platforms allocating memory from OS can succeed, but later writing that memory can fail, because no memory is available. -
Without those quotes the code would not compile...
-
Right... Actually with owner set only overriding notification is needed... And assigning OnClose and OnDestroy from owner form is probably simpler idea.. with assigned OnDestroy clearing handles instead Notification. I mean we actually use OnDestroy to clear global form variables in form units, when form is free (with check, if Self is same as variable).
-
ChildForm sest Action to caFree on OnClose event handler Owner calls FreeNotification(ChildForm) after creating the childform. Owner overrides Notification() and when it receives notification, that childform is freed, then sets variable to nil (or whatever needs to be done). Owner calls RemoveFreeNotification(ChildForm) when it is going to manually free childform or when owner itself is going to be freed.
-
software research - looking for Delphi5 logging tool SilentDD
Virgo replied to David Dyck's topic in General Help
There is always possibility, that it was old internal utility created by some developer. -
Is there a Delphi equivalent of WriteStr ?
Virgo replied to Martin Liddle's topic in RTL and Delphi Object Pascal
I somehow managed to miss width parameter. With it it is really possible to rewrite WriteStr as format and since Delphi does not have WriteStr, it is best solution. Better than trying to hack around with file. So: s2 := format('x = %10.4f, y = %10d, s = %20s', [x, y, s]); would be same as WriteStr(s2, 'x = ', x:10:4, ', y = ', y:10, ', s = ', s:20); -
Is there a Delphi equivalent of WriteStr ?
Virgo replied to Martin Liddle's topic in RTL and Delphi Object Pascal
That only applies, if goal is to write to file or stdout. My example code did writeln to result string just to get, what the value was. Real use can be different. But depending, what WriteStr features were used it should be possible to rewrite it in Delphi. -
Is there a Delphi equivalent of WriteStr ?
Virgo replied to Martin Liddle's topic in RTL and Delphi Object Pascal
No it is not. TWriter.WriteString writes strings. example: program writeStrTest; {$mode objfpc} {$H+} var x: extended; y: Int64; s, s2: string; begin x := 193.17; y := 123746214; s := 'Some tekst'; WriteStr(s2, 'x = ', x:10:4, ', y = ', y:10, ', s = ', s:20); WriteLn(s2); end. will output x = 193.1700, y = 123746214, s = Some tekst format is closest thing in Delphi, but format does not have ability to pad values with spaces (if user requires it). -
Is there a Delphi equivalent of WriteStr ?
Virgo replied to Martin Liddle's topic in RTL and Delphi Object Pascal
Str just converts number to string.... As David Schwartz writes, format is functionally similar, but it has different syntax (format is more like C printf than Pascal Write). But unlike fpc Delphi does not seem to have WriteStr. -
And I managed to miss, that Anders Melander had already posted link to explanation....
-
32 bit programs show contents of C:\Windows\SYSWOW64, when looking at C:\Windows\SYSTEM32. 64 bit programs show contents of C:\Windows\SYSTEM32, when looking at C:\Windows\SYSTEM32. Basic 64 bit Windows thing.
-
From Delphi+PostgresDAC (PostgresSQL) To Delphi+FireDAC (PostgresSQL)
Virgo replied to Squamis's topic in Databases
TFDScript is for executing SQL scripts AFAIK. https://docwiki.embarcadero.com/RADStudio/Sydney/en/Executing_SQL_Scripts_(FireDAC) -
FireMonkey designer does not implement Shift-F10 for context menu
Virgo replied to eivindbakkestuen's topic in Delphi IDE and APIs
I would suggest actually reading original post you are responding to...:) Posted with keyboard without "Context Menu key" -
Indeed. And it is quite likely, that actual problem is invalid JSON. Besides strings with quotes in them additional possible problem is, if decimal separator is not dot.
-
Sample for doing same thing with Synapse THTTPSend: procedure TestPost; var H: THTTPSend; S: UTF8String; Res: Boolean; begin H := THTTPSend.Create; try S := '{"recipient":"testing@checkbook.io","name":"Widgets Inc.","amount":5,"description":"Test Payment"}'; H.MimeType := 'application/json'; //synapse has separate propery for content-type header H.Headers.Add('accept: application/json'); H.Headers.Add('Authorization: XXXXX'); H.Document.Write(S[1], Length(S)); Res := H.HTTPMethod('POST', 'https://demo.checkbook.io/v3/check/digital'); if Res then begin SetLength(S, H.Document.Size); if H.Document.Size > 0 then H.Document.Read(S[1], H.Document.Size); ShowMessage(format('%d: %s', [H.ResultCode, S])); end else ShowMessage(H.Sock.LastErrorDesc); finally H.Free; end; end; ends with 400: {"error":"Invalid authorization header"} Because sample XXXXX authorization header is not correct obviously....