Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/09/20 in all areas

  1. Exactly. This is one of the reasons why enabling extended RTTI did increase the exe size by a big margin, and why I usually disable it unless I know I will actually need it.
  2. Cristian was the first to spot the blog article: https://blogs.embarcadero.com/delphi-compiler-and-lsp-patch-for-rad-studio-10-4-1/
  3. Arnaud Bouchez

    Compile code on the fly...?

    They just rewrite a regexp-like engine, which are usually using byte codes. Note that when a regexp uses JIT, it is faster, but not in all cases. For pascal source code of a very fast regexp engine, check https://github.com/BeRo1985/flre - you will see it is complex to make such things fast! But to be fair, my guess is that Everything as a tool is fast not because its pattern search is fast, but because all the file names are already cached in memory. So it doesn't have to call the Windows API to get all the file names. The real bottleneck is not the search itself, but the OS API calls. Byte-code search in the list may result in the search being a bit faster, but for only a few percent. So this performance statement is more like a marketing statement - not false, but not the real performance trick. As another reference code, perhaps easier to read than FLRE, check our Open Source TMatch object in https://github.com/synopse/mORMot2/blob/master/src/core/mormot.core.search.pas It is very fast e.g. to find e.g. '*.pas' or 'toto*.pas' or '*inside*'. When I mean fast, it is fast (using algorithms like Holub and Durian (2005) SBNDM2 algorithm). And if you want to see some code about an expression search engine, using an AST and some kind of byte codes, check the TExprParserMatch class in the same unit.
  4. Yaron

    My open-source portfolio

    I released quite a bit of interesting code to github over the years: YouTube DATA API v3 parsing: https://github.com/bLightZP/Delphi-YouTube-Channel-parsing-plugin-for-Zoom-Player Basic RSS feed parsing code: https://github.com/bLightZP/Delphi-RSS-feed-parsing-plugin-for-Zoom-Player TheAudioDB MetaData/Image scraping code: https://github.com/bLightZP/Delphi-theaudiodb.com-Zoom-Player-media-scraping-plug-in TheMovieDB MetaData/Image scraping code: https://github.com/bLightZP/Delphi-themoviedb.org-Zoom-Player-media-scraping-plug-in OpenSubtitles.org subtitle search & scrape code: https://github.com/bLightZP/Delphi-OpenSubtitles.org-API-support-for-Zoom-Player A basic cross-platform calculator https://github.com/bLightZP/ElegantCalculator https://play.google.com/store/apps/details?id=com.inmatrix.ElegantCalculator Adapted old code to work as cross-platform pure-pascal image scaling with filters (bicubic, bilinear, etc): https://github.com/bLightZP/ImageInterpolation Adapted old code to work as a cross-platform drawing of an anti-aliased circle (can be modified to draw rount-rect as well): https://github.com/bLightZP/AntiAliasedCircle I forked a QRCode generating source code and greatly optimized it (~ x50 faster): https://github.com/bLightZP/DelphiZXingQRCode The original Delphi scanline color-conversion implementation was very slow, so I optimized it: https://github.com/bLightZP/OptimizedDelphiFMXScanline
  5. Remy Lebeau

    Batch Reading Emails from Windows Explorer

    Which version of Indy are you looking at? TIdCoderTNEF was introduced in Indy 10, are you looking at Indy 9, perhaps? TIdCoderTNEF is not documented in the help files. No, TIdCoderTNEF still exists in Indy 10. TIdCoderTNEF has been in Indy 10 for over a decade. It is in the IndyProtocols package. There is no documentation available for TIdCoderTNEF, other than comments in the unit itself. I think it was created after the last time the documentation was updated, which was sadly a very long time ago. In a nutshell, you would simply extract a TNEF attachment from a normal email, and pass that attachment to TIdCoderTNEF.Parse(), which will then populate a TIdMessage with the relevant message data (headers, body, attachments, etc) from the TNEF.
  6. A method is a routine (procedure/function) that is associated with an object. A class method would be a routine (procedure/function) that is associated with a class.
  7. Cristian Peța

    Outdated Delphi Roadmap

    Patch is just released. https://blogs.embarcadero.com/delphi-compiler-and-lsp-patch-for-rad-studio-10-4-1/
  8. Presumably it's because of your RTTI settings, which by default allow public methods to be called from RTTI, but not private.
  9. Anders Melander

    TFDMemTable in use by different threads

    Yes. Moving the cursor in a clone does not affect the other clones. As I read that post read access to a cloned dataset is thread safe.
  10. FPiette

    remove part of string and compare

    Why can't you use my example and do the reverse. It is trivial! Maybe a little bit more programming learning is required and also some effort to correctly specify a problem. We could have avoided all this if the question was asked clearly from the beginning function ExtractDomain(const URL : String) : String; var I, J : Integer; begin I := Pos('://', URL); if I <= 0 then I := 1 else Inc(I, 3); J := Pos('/', URL, I); if J <= 0 then begin Result := Copy(URL, I, MAXINT); Exit; end; Result := Copy(URL, I, J - I); end; procedure TForm1.Button1Click(Sender: TObject); var Index : Integer; Dict : TDictionary<String, Integer>; URL : String; Domain : String; Value : Integer; UrlFile : TStreamReader; begin Dict := TDictionary<String, Integer>.Create(10000); try ListBox1.Items.BeginUpdate; try // Load the dictionary with url.txt file UrlFile := TStreamReader.Create('url.txt'); try while not UrlFile.EndOfStream do begin URL := Trim(UrlFile.ReadLine); if URL = '' then continue; Domain := ExtractDomain(UpperCase(URL)); if Dict.TryGetValue(Domain, Value) then // Domain already found, ignore it continue; // Domain not seen before, add to dictionary Dict.Add(Domain, 0); end; finally FreeAndNil(UrlFile); end; // Now filter the ListBox to remove duplicate and items wich // are already in the dictionary (because they come from url.txt) for Index := ListBox1.Items.Count - 1 downto 0 do begin URL := Trim(ListBox1.Items[Index]); if URL = '' then begin ListBox1.Items.Delete(Index); continue; end; Domain := ExtractDomain(UpperCase(URL)); if Dict.TryGetValue(Domain, Value) then begin // Domain already found, delete from ListBox ListBox1.Items.Delete(Index); continue; end; // Domain not seen before, add to dictionary and don't remove Dict.Add(Domain, 0); end; finally ListBox1.Items.EndUpdate; end; finally FreeAndNil(Dict); end; end;
  11. Timsort is stable, and performs well on partially ordered data. It's the default sort for Python and Java.
  12. @David Heffernan and me implemented one for Spring4D - you can already check it out in the develop branch
×