Jump to content

Attila Kovacs

Members
  • Content Count

    2067
  • Joined

  • Last visited

  • Days Won

    27

Everything posted by Attila Kovacs

  1. Attila Kovacs

    form data store component ?

    Just download the 3 units above and add it to a newly created package and save it and install it
  2. Attila Kovacs

    DL a file from the web

    https://chat.openai.com/chat "To download a file from HTTP in Delphi, you can use the TIdHTTP component from the Indy library. This component provides methods for sending HTTP requests and receiving HTTP responses, including the ability to download files from a URL. Here is an example of how you could use TIdHTTP to download a file in Delphi:" uses IdHTTP; var http: TIdHTTP; url: string; filename: string; stream: TMemoryStream; begin // Create the HTTP client object http := TIdHTTP.Create; // Specify the URL of the file you want to download url := 'http://www.example.com/myfile.txt'; // Specify the name of the file where you want to save the downloaded data filename := 'C:\myfile.txt'; // Create a memory stream to hold the downloaded data stream := TMemoryStream.Create; try // Use the HTTP client to download the file from the specified URL http.Get(url, stream); // Save the downloaded data to the specified file stream.SaveToFile(filename); finally // Clean up stream.Free; http.Free; end; end. "In this example, the TIdHTTP.Get method is used to download the file from the specified URL and save the data to the TMemoryStream object. Once the download is complete, the data is saved to the specified file using the TMemoryStream.SaveToFile method." 2nd run: uses IdHTTP; procedure DownloadFile(const URL, FileName: string); var HTTP: TIdHTTP; Stream: TFileStream; begin HTTP := TIdHTTP.Create(nil); try Stream := TFileStream.Create(FileName, fmCreate); try HTTP.Get(URL, Stream); finally Stream.Free; end; finally HTTP.Free; end; end; "download a file from http in delphi in the background": uses IdHTTP, Classes; type TDownloadThread = class(TThread) private FURL: string; FFileName: string; FHTTP: TIdHTTP; FStream: TFileStream; protected procedure Execute; override; public constructor Create(const URL, FileName: string); destructor Destroy; override; end; constructor TDownloadThread.Create(const URL, FileName: string); begin inherited Create(False); FURL := URL; FFileName := FileName; FHTTP := TIdHTTP.Create(nil); FStream := TFileStream.Create(FileName, fmCreate); end; destructor TDownloadThread.Destroy; begin FStream.Free; FHTTP.Free; inherited Destroy; end; procedure TDownloadThread.Execute; begin FHTTP.Get(FURL, FStream); end; procedure DownloadFile(const URL, FileName: string); var Thread: TDownloadThread; begin Thread := TDownloadThread.Create(URL, FileName); Thread.Start; end;
  3. Attila Kovacs

    form data store component ?

    I made this component back in the days, drop it on a form/datamodule, you can add files by doubleclicking the component on the form or manually enter text by adding items. Use it like: "Storage['Title']" I have commented out some encryption stuff but you can implement it yourself if you need it. It can zip its content. (Install it by creating a new package and add the units to it) Public domain, no restrictions, have fun. forsix.StringListHelper.pas forsix.VCL.Storage.pas forsix.VCL.Storage.Design.pas
  4. Attila Kovacs

    TTreeview to JSON VCL?

    I know, but in this particular case I can't think of any situation where I would test any function for supporting a tree when there is no tree. Or building a console application and having stuff for a tree, which I do not need. In my view, in this case, you are mixing the GUI and the business logic.
  5. Attila Kovacs

    TTreeview to JSON VCL?

    As the component itself stores only a reference in both cases, I can't see any benefit.
  6. Attila Kovacs

    TTreeview to JSON VCL?

    You both never worked with treeviews, do you?
  7. Attila Kovacs

    How to connect to wss:// server ?

    "Host not found" to "ws.xn--twelvedata-lb99c.com" You will not have the drink, Kimi.
  8. okay everybody, we make the photoshooting today.. remember, don't smile, and close your eyes! by the way, if the background isn't just white and you don't have to automatize https://www.photoroom.com/white-background/
  9. Attila Kovacs

    IsZero or SameValue

    Ok I thought he cited it from a working lib... @Anders Melander how dare you!??
  10. Attila Kovacs

    IsZero or SameValue

    match, matcher, matchest? The tolerance determines the result, isn't it?
  11. Attila Kovacs

    floating point error, [solved].

    or SameValue()
  12. Attila Kovacs

    SQL problem

    I wrote the battle of marathon back in 490 BC, yes.
  13. Attila Kovacs

    SQL problem

    guess work, because we can't see your code: remove the fields from the query component, leave it empty, set fetchall to false, do not use "select *", fetch the blobs separately, add a key field to the table, set the keyfield in the query component
  14. Attila Kovacs

    SQL problem

    why do you need the 2 different compare functions? why not just WHERE (A LIKE '%' + B + '%') OR (B LIKE '%' + A + '%') ? if you read it out loud, everybody beside to you will understand what you want
  15. Attila Kovacs

    SQL problem

    that's not how things work, I'm not sure your database is worth search anything...
  16. Attila Kovacs

    SQL problem

    Why would a search for "G:\Delphi Projects\image32_3.2.2\Examples\Layers101" find "G:\Delphi Projects\image32_3.2.2\" ?
  17. Attila Kovacs

    Huge memory problem

    You'll not have the drink Kimi
  18. Attila Kovacs

    Any advice when to use FileExists?

    in the very next second it could have the rights and vice versa
  19. Attila Kovacs

    Change 'DPI awareness' on runtime

    this looks strange, even a logical control hierarchy is missing, otherwise they would be cropped on the bottom you should try using alignments instead of fixed positions
  20. Attila Kovacs

    Change 'DPI awareness' on runtime

    or you have a common form with some extra methods 🙂
  21. Attila Kovacs

    Zip Compression library

    I'd still go with compressionmode 1 and 25sec instead of 18% better compression and almost twice the time. HDD is cheap, time isn't.
  22. Attila Kovacs

    Zip Compression library

    the one I just downloaded.... must be the latest
  23. Attila Kovacs

    Zip Compression library

    downloaded and installed zipforge, pretty same as W10
  24. Attila Kovacs

    Zip Compression library

    I did not believe those numbers so I did it myself. source enwik9.zip http://mattmahoney.net/dc/textdata.html compression routine zf := TZipFile.Create; zf.Open('MyFile.zip', zmWrite); zf.Add('enwik9', '', zcDeflate); zf.Close; But, I don't know what TZipFile is using, own code or winapi.
  25. Attila Kovacs

    Getters & Settters??

    We are not discussing here how to free a form, I'm always using caFree which is not part of the question.
Ă—