Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/04/22 in all areas

  1. Angus Robertson

    ICS V8.70 announced

    ICS V8.70 has been released at: http://wiki.overbyte.eu/wiki/index.php/ICS_Download ICS is a free internet component library for Delphi 7, 2006 to 2010, XE to XE8, 10 Seattle, 10.1 Berlin, 10.2 Tokyo, 10.3 Rio, 10.4 Sydney and 11.0 and C++ Builder 2006 to XE3, 10.2 Tokyo, 10.3 Rio, 10.4 Sydney and 11. ICS supports VCL and FMX, Win32, Win64 and MacOS 32-bit targets. The distribution zip includes the latest OpenSSL 3.0.7 win32, with other versions of OpenSSL being available from the download page. Major Changes in ICS V8.70 include: 1 - V8.70 has various minor improvements providing better compatibility with modern compilers such as more unicode overloads to avoid ANSI string warnings and casts, and more use of TBytes to avoid ANSI strings. Updated various samples to use TIcsRestEmail to support OAuth2 authentication for GMail and Outlook that no longer allow old authentication protocols. 2 - The TIcsFileCopy, TIcsFtpMulti and TIcsHttpMulti file transfer components now support file zipping and unzipping using System.Zip in recent Delphi compilers, instead of the obsolete VclZip which is no longer available. Before a file copy or FTP upload, files may be automatically zipped, useful for large log files, after a file copy, FTP or HTTP download, files may be unzipped in various ways. 3 - Added support to TIcsFileCopy to copy file names longer than 259 characters by adding \\?\ to the start of long names passed to Windows APIs, if supported by the disk file system, unicode APIs only. Fixed a problem deleting empty directories after copying. Fixed a problem with BuildDirList2 with COMPILER16_UP. 4 - The OverbyteIcsXferTst sample has a new tabs, 'Single File Copy' to test the CopyOneFile method and 'Zip/Unzipping Files' to test zipping and unzipping that has always been supported by the components but not this demo. 5 - Allow content compression for HTTP and FTP using System.Zlib in newer versions of Delphi instead of the OverbyteIcsZLibObj unit to avoid duplication. Only Delphi 11.1 and later have the same ZLIB 1.2.12 as ICS, so will automatically used System.Zip. Beware a new version of OverbyteIcsDefs.inc is required to allow ZLIB to work correctly, otherwise it will default to using the DLL which is unlikely to be available, it is not in the distribution. So either install the new inc file and customise it, or copy the ZLIB changes to your own inc file. 6 - In TWsocket, added ReceiveTB(var Data : TBytes; MaxLen : Integer = -1): Integer; where MaxLen is optional, to receive TCP data into a TBytes dynamic array of bytes. Also ReceiveFromTB and ReceiveFrom6TB for UDP datagrams. The last release added similar SendTB functions, so buffer pointers and ANSI strings can now be avoided. 7 - Added UTF-8 support to TIcsIpStrmLog, to convert received lines from UTF-8 to Unicode with unicode compilers (as String) and converts sent data to UTF-8. Changed FRxBuffer to TBytes, use SendTB and ReceiveTB methods with TBytes. 8 - Updated OpenSSL to 3.0.7 and 1.1.1s. OpenSSL 3.0.6 was withdrawn shortly after release, we never distributed it. 9 - In OverbyteIcsSslHttpOAuth, added an OAuth2 and Rest Email Microsoft User Authority property to access different user authorities, defaults to 'consumers' but can be changed to 'common' or an Azure Active Directory tenant GUID for corporate accounts. 10 - Added TIcsRestEmail to support OAuth2 authentication to the OverbyteIcsSslMultiWebServ, OverbyteIcsSslMultiFtpServ and OverbyteIcsDDWebService samples, since GMail and Outlook that no longer allow old authentication protocols. 11 - In the TIcsInetAlive component, added a new method AliveMethEither so internet alive checking works if either ping or HTTP works, instead of one or the other. More detailed release notes are at http://wiki.overbyte.eu/wiki/index.php/ICS_V8.70 Angus
  2. dummzeuch

    A gem from the past (Goto)

    I actually used a goto for debugging today. The reason was that at the end of a function I check the result and for a particular result I want to repeat the code in the function in order to step through it: function whatever: SomeType; label RepeatMe; begin RepeatMe: // some code that generates the result if Result = ResultIWantToDebug then goto RepeatMe; // <== put a breakpoint here // some more code end;
  3. Brian Evans

    A gem from the past (Goto)

    If the code still makes sense to you years latter and you can follow it without difficulty then there should be no complaints. Applying a rule or guideline too rigidly before the skill or knowledge to do so has been acquired often makes things worse. In your example learning how to use continue; or break; to control the flow of a for loop would be best but applying a no goto rule and using multiple cascading IF's around a large blocks of code could be worse than just using a goto. The top hall of shame code I have ever seen was due to developers rigidly applying rules before the skill and knowledge to do so was acquired. It made the code more complex and a lot harder to follow to the point is was often easier to just re-write it from scratch.
  4. Rollo62

    Split String

    How about something like TStringHelper.Split ? use System.SysUtils , System.Generics.Collections ; ... var LInput : String; LArray : TArray<String>; LElem : String; LStrQuo : String; begin LInput := '22-1, 22-2, 22-3'; LArray := LInput.Split( [ ',' ], TStringSplitOptions.ExcludeEmpty ); // Ignore empty elements for LElem in LArray do begin LStrQuo := LElem.Trim.QuotedString( '"' ); ... // Do something with the quoted in SQL end; end.
  5. OpenSSL has released new versions of the two supported branches, 3.0.7 and 1.1.1s, Windows binaries are available from http://wiki.overbyte.eu/wiki/index.php/ICS_Download or https://www.magsys.co.uk/delphi/magics.asp . OpenSSL 3.0.7 fixes two serious security bugs in 3.0.0 and later relating to verifying X509 certificates with email punycode (non-ASCII characters) name constraint checking, that can cause a crash. These bugs can only happen after a certificate chain has been successfully checked, mainly in client applications (or servers that request and verify client certificates) so should not happen with self signed certificates. Another security bug fixed related to using null encryption, which ICS doesn't use. Also, the RIPEMD160 hash no longer requires the legacy provider. OpenSSL 1.1.1s has general bug fixes. Separately YuOpenSSL has released both these versions as commercial DCUs allowing applications to be used with OpenSSL without needing separate DLLs. Angus
  6. In my opinion, this is a typical example of failure - bad logic. Simply, the user cannot/must not enter such a combination. You have to solve that on the client.
  7. hi, https://github.com/RDP1974/DelphiMSHeap please can somebody do a speed test for single thread application? I did a test, see attachment, and single thread performances are identical (and with multithreaded web app it's quicker than intel tbbmalloc) thank you btw. I did small changes as inline directive and zeromemory on sysalloc within the api call top = 32bit down = 64bit sx = default MM delphi dx = MSHeap delphi (delphi 11.2 i9 cpu windows 10) pokerBench.rar webbroker test (see first post at begin) Concurrency Level: 100 Time taken for tests: 0.269 seconds Complete requests: 1000 Failed requests: 0 Keep-Alive requests: 0 Total transferred: 250000 bytes HTML transferred: 114000 bytes Requests per second: 3716.52 [#/sec] (mean) Time per request: 26.907 [ms] (mean) Time per request: 0.269 [ms] (mean, across all concurrent requests) Transfer rate: 907.35 [Kbytes/sec] received
  8. Then please put the DLL projects into the repo with documentation on how to get the missing pieces to produce them ourselves instead of distributing binaries. As for the RTL routines - as mentioned FillChar already has been improved in 11.1 (and hopefully will get another final improvements - some of which are detailed here: https://msrc-blog.microsoft.com/2021/01/11/building-faster-amd64-memset-routines/). Pos has also been improved (mostly Win64 is affected by this as the new code is basically the purepascal code of what was the asm implementation for Win32). Hopefully for 12, we will get an improved Move I was working on (using SSE2 as that is the supported instruction set RTL can assume). Because Move handles forward/backward and overlap it covers what memcopy and memmove do. That leaves CompareMem which I already looked into in context of faster string comparison, UpperCase and Replace.
  9. Uwe Raabe

    How to deal with different types of Variant?

    There are several functions to simplify your task. You can use VarIsStr to check for string variants and VasIsOrdinal for the Integer case. Also there is VarToStr to convert a Variant to string. With this you can strip down your compare function to function CompareValues(const aValue1, aValue2: Variant): integer; overload; Begin Result := 0; // if ANY of the values is string, should compare as strings! if VarIsStr(aValue1) or VarIsStr(aValue2) then Result := CompareValues(VarToStr(aValue1), VarToStr(aValue2)) else if VarIsOrdinal(aValue1) and VarIsOrdinal(aValue2) then // Make sure that the following cast succeeds! Result := CompareValues(Integer(aValue1), Integer(aValue2)); End;
×