Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 02/23/19 in Posts

  1. Welcome Everyone! Welcome to this forum intended for ICS support. Feel free to ask your ICS questions here. Before asking, search this forum and also check http://wiki.overbyte.be Please stay on topic. Use other forums for subjects not directly related to ICS. --- François PIETTE The author of the freeware Internet Component Suite (ICS) The author of the freeware multi-tier middleware MidWare http://www.overbyte.be
  2. Primož Gabrijelčič

    OmniThreadLibrary 3.07.7

    New OmniThreadLibrary is out! Get it while it’s hot! Version 3.07.7 is mostly a bugfix release. It fixes a stupid mistake introduced in version 3.07.6 plus some other minor bugs. You can get it now on git, download the ZIP archive, install it with Delphinus or with GetIt. For more information, visit OmniThreadLibrary home page or write your question on the forum. New features [HHasenack] On XE3 and above, TOmniValue.CastTo<T> supports casting to an interface. [HHasenack] Implemented Parallel.ForEach(IEnumerator<T>) and Parallel.ForEach(IEnumerable<T>). Bug fixes If additional wait objects registered with RegisterWaitObject were constantly signalled, timers were never called. OtlParallel threads were incorrectly scheduled to the main pool instead of GlobalParallelPool unless IOmniTaskConfig.ThreadPool was used. (introduced in 3.07.6) Using Parallel.Join, .For, and .ForEach with .OnStopInvoke failed with access violation if Join/For/ForEach was not executed with .NoWait. Thread pool creation code waits for thread pool management thread to be started and initialized. Without that, CountQueued and CountExecuting may not be initialized correctly when thread pool creation code exits. [tnx to Roland Skinner]
  3. I have started a new ICS release V8.60, not finished yet but available from SVN and the daily overnight zipped snapshot at : http://wiki.overbyte.eu/wiki/index.php/ICS_Download V8.60 is a major update added several new components and sample applications created by Magenta Systems Ltd and previously distributed separately to the ICS distribution. Bundling them with ICS makes installation and updating easier, and allows existing ICS samples to make use of some the new components, such as UTF-8 file logging. There are a lot of comments in the various SVN uploads which are included in the overnight zip file. New classes added include: TIcsBlacklist TIcsBuffLogStream TIcsFindList TIcsIpStrmLog TIcsMailQueue TIcsStringBuild TIcsTimeClient TIcsTimeServer TIcsWhoisCli and there are four new sample applications that illustrate their use: OverbyteIcsMailQuTst.dpr OverbyteIcsIpStmLogTst.dpr OverbyteIcsWhoisCliTst.dpr OverbyteIcsTimeTst.dpr Also there are major updates to OverbyteIcsSslMultiWebServ.dpr which now has almost all the functionality of my commercial web server. V8.60 will also include the Magenta File Transfer components, not finshed yet. Angus
  4. type TInfoType = (itProject, itContacts, itWorker, itWorkers); const cInfoTypeNodeNames: array[TInfoType] of string = ('project', 'contacts_info', 'WRK', 'WRKS'); begin Writeln(cInfoTypeNodeNames[1]); // will not compile Writeln(cInfoTypeNodeNames[itContacts]); // will compile end.
  5. I think that the syntax was always there and I use it a lot. I found it more useful especially it provides a compiler check about the indexing type. This code : NodeNames: array [TInfoType] of string = ('itProject', 'itContacts', 'itWorker', 'itWorkers'); Is exactly equivalent to this one : NodeNames2: array [Ord(Low(TInfoType)) .. Ord(High(TInfoType))] of string = ('itProject', 'itContacts', 'itWorker', 'itWorkers'); Note that you can also use range: NodeNames3: array [itContacts .. itWorkers] of string = ('itContacts', 'itWorker','itWorkers');
  6. The docs say about static arrays: So any ordinal type (which includes enumerations) are valid as array index. That has been this way since the invention of Pascal.
  7. jbg

    IDE Fix pack for Rio

    And another development snapshot is available. This time the functions in StyleUtils.inc (Vcl.Styles) got optimized what makes the UI rendering faster. IDEFixPackD103RegDev.7z fastdccD103vDev.7z
  8. Well, that is what giving number in the enum declaration is, too, The ADD example was just a little joke, because the numbers given nicely add up by coincidence.
  9. Remy Lebeau

    Request to Google Translate API

    In general, when creating a URL by hand, I suggest NOT using TIdURI.URLEncode() on the entire URL, but instead use TIdURI.PathEncode() and TIdURI.ParamsEncode() on individual components that actually need to be encoded. Also, the default encoding for TStringStream is the OS default charset, but JSON typically uses UTF-8 instead. If you know the actual charset the server uses for the response, you could hard-code it in the TStringStream constructor. But, it is generally better to just let TIdHTTP handle charset decoding of strings for you instead. Try something more like this: var http : TIdHTTP; sslIO : TIdSSLIOHandlerSocketOpenSSL; url, data : String; begin http := TIdHTTP.Create(nil); try http.HTTPOptions := http.HTTPOptions + [hoNoProtocolErrorException, hoWantProtocolErrorContent]; sslIO := TIdSSLIOHandlerSocketOpenSSL.Create(http); sslIO.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; sslIO.SSLOptions.Mode := sslmClient; sslIO.SSLOptions.VerifyMode := []; sslIO.SSLOptions.VerifyDepth := 0; http.IOHandler := sslIO; url := 'https://translate.googleapis.com/translate_a/single?client=gtx&sl=de&tl=ru&dt=t&q=' + TIdURI.ParamsEncode('Müller'); data := http.Get(url); finally http.Free; end; end;
  10. Remy Lebeau

    How To HTTP POST in Delphi?

    Your TIdHTTP code is all wrong for this kind of POST request. Try something more like this instead: uses ..., IdGlobalProtocols, IdHTTP, IdSSLOpenSSL; procedure TForm3.Button2Click(Sender: TObject); var SoapMsg: string; PostData, ResponseData: TStream; begin // buid up this string however you want (XML library, etc) ... SoapMsg := '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">' + ' <soapenv:Header/>' + ' <soapenv:Body>' + ' <tem:Consulta>' + ' <!--Optional:-->' + ' <tem:expresionImpresa><![CDATA[?re=LSO1306189R5&rr=GACJ940911ASA&tt=4999.99&id=e7df3047-f8de-425d-b469-37abe5b4dabb]]></tem:expresionImpresa>' + ' </tem:Consulta>' + ' </soapenv:Body>' + '</soapenv:Envelope>'; ResponseData := TMemoryStream.Create; try PostData := TStringStream.Create(SoapMsg, TEncoding.UTF8); try IdHTTP1.IOHandler := IdSSLIOHandlerSocketOpenSSL1; IdHTTP1.HTTPOptions := IdHTTP1.HTTPOptions + [hoNoProtocolErrorException, hoWantProtocolErrorContent]; IdHTTP1.Request.ContentType := 'text/xml'; IdHTTP1.Request.Charset := 'utf-8'; IdHTTP1.Request.Accept := 'text/xml'; IdHTTP1.Request.CacheControl := 'no-cache'; IdHTTP1.Request.CustomHeaders.Values['SOAPAction'] := 'http://tempuri.org/IConsultaCFDIService/Consulta'; IdHTTP1.Post('https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?wsdl', PostData, ResponseData); finally PostData.Free; end; Memo1.Lines.BeginUpdate; try Memo1.Lines.Add(Format('Response Code: %d', [IdHTTP1.ResponseCode])); Memo1.Lines.Add(Format('Response Text: %s', [IdHTTP1.ResponseText])); ResponseData.Position := 0; ReadStringsAsCharset(ResponseData, Memo1.Lines, IdHTTP1.Response.Charset); finally Memo1.Lines.EndUpdate; end; finally ResponseData.Free; end; end;
×