Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 02/17/25 in all areas

  1. Oh, OK. Setting Active=False does stop listening for new connections, but it ALSO immediately closes any existing client connections, too. Then it waits for everything to finish cleaning up before it exits back to your code. If you want existing clients to continue their work uninterrupted, then yes. Try something like this: ShuttingDown := True; IdHTTPServer1.StopListening; Timer1.Enabed := True; ... procedure TMyForm.Timer1Timer(Sender: TObject); begin with IdHTTPServer1.Contexts.LockList do try if Count > 0 then Exit; finally IdHTTPServer1.Contexts.UnlockList; end; Timer1.Enabled := False; IdHTTPServer1.Active := False; Application.Terminate; end; ... procedure TMyForm.IdHTTPServer1CommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); begin if ShuttingDown then begin AResponseInfo.ResponseNo := 503; AResponse.CustomHeaders.Values['Retry-After'] := '5'; AResponseInfo.CloseConnection := True; Exit; end; // process normally ... if ShuttingDown then AResponseInfo.CloseConnection := True; end;
  2. One nice feature of the Delphi IDE that I keep forgetting are Component Templates. That means you drop and customize one or multiple components on a form and then give them a new name so you can easily create them again on a different form in a different program. https://blog.dummzeuch.de/2018/11/03/creating-component-templates-in-delphi/
  3. Rollo62

    Recommended devices android testing

    I usually look into market surveys, which phones or brands were selling best https://www.heise.de/news/Smartphone-Markt-hat-sich-2024-erholt-chinesische-Marken-legen-zu-10241291.html#nav_marktanteile__1 Then you have a chance that you are testing on whats your clients are using most. Google Pixel is perhaps the best, most modern and best supported Android phone, which helps to be state-of-the-art, but its market share is quite low still.
  4. Vandrovnik

    Recommended devices android testing

    Samsung offers a remote testing lab: https://developer.samsung.com/remote-test-lab
  5. JIMSMITH

    Reading a section of JSON

    Remy, I am using Delphi 10.1 Update 2. I was able to figure it out from the code that you provided plus prior work. So I am good at this point and thanks for your help.
  6. Anders Melander

    Modern StandBy

    You are looking at the symptoms at the end of a long chain of circumstances. You need to look at the other end, which supposedly (assuming WM_TIMER is the problem) is closer to the source of the problem. If standby killed WM_TIMER then millions of applications would break so I think it's very unlikely. The bug in PuTTY wasn't that the timer didn't fire but that they assumed that it would fire with a certain time interval and WM_TIMER is never guaranteed to do that. AFAIK WM_TIMER is a low priority message which is only synthesized when the message queue is polled and no higher priority messages are in the queue (or synthesized). I don't know your application but it could be that the queue is simply flooded with other stuff after resume from standby. So instead of assuming that WM_TIMER doesn't work I recommend that you simply verify with a simple application that does nothing but write a time stamp to a TMemo every time a 1 second TTimer fires. If that doesn't work then there's a problem with TTimer and we can start examining what that is.
  7. JohnLM

    The Advent of Code 2024.

    Oh, how clumsy of me. I was aiming for {ch:=s[c]; and then {if ch='#' then}, . . . but realized I could use {if s[c]='#' then} and didn't remove the other code. And still, your idea (technique) is better. function astCounterGrid1(m1: tmemo): integer; var r,c : integer; aC: integer; s : string; begin aC:=0; result:=0; for r:= 0 to m1.Lines.Count-1 do begin s := m1.Lines.Strings[r]; for c:=0 to length(s) do if s[c]='#' then inc(aC); end; result := aC; end; // me; my updated version Below, is CorneliusDavid suggestion, plus I added the capture for #13#10 end-of-line codes (when used in tmemo as a grid). function astCounterGrid2(m1: tmemo): integer; var aC: integer; s : string; begin aC:=0; result:=0; s := m1.Text; s := StringReplace(s, #13#10, '', [rfReplaceAll]); s := StringReplace(s, '.' , '', [rfReplaceAll]); Inc(ac, s.Length); result := aC; end; // carnelious suggestion and my updates Both routines produce the same results. They capture the total asteroid counts for all the examples: Best is 3,4 because it can detect 8 asteroids : had 10 Best is 5,8 with 33 other asteroids detected: had 40 Best is 1,2 with 35 other asteroids detected: had 40 Best is 6,3 with 41 other asteroids detected: had 50 Best is 11,13 with 210 other asteroids detected: had 300 I often use the tmemo component as a "grid" to help me with visualization, though it does add to the extra work to compensate for it, like when accounting for the #13#10 char codes that are added. Had I used an multi-dimentional array[1..5, 1..5] of char, then the #13#10 would not be there and we could eliminate the line with: s := StringReplace(s, #13#10, '', [rfReplaceAll]);
  8. This year, on February 14th, Delphi celebrates its 30th birthday. Over the past three decades, Delphi has proven to be a robust and versatile development environment, empowering developers to build high-performance applications with ease across multiple platforms: Windows, Linux, Android, iOS, and macOS. As we commemorate this milestone, I am also introducing a new book to help guide you into Delphi's fourth decade: Delphi Quality-Driven Development - A practical guide to testing and writing testable code. Useful to lone developers and vast teams alike, this book aims to demonstrate a variety of essential practices and techniques for making high-quality, testable code. There is a 25% sale going on until the end of February for the Delphi Quality-Driven Development ebook, and there you can also get an additional discount on other books if you add them to your order. https://dalija.prasnikar.info/delphiqdd/index.html To all my fellow Delphi developers: May your code compile quickly, your memory be manageable, and your code testable.
  9. braindead0@yahoo.com

    Delphi 12.2 and MacOS Sequoia (15.0) : No provisioning profile

    Thanks for the detail about the profile folder being moved. I spent hours trying to get IOS development working (my first trip down this road with Delphi).. Solution I used was to create a symlink to the new folder from terminal: cd ~/Library/ mkdir MobileDevice cd MobileDevice ln -s "../Developer/Xcode/UserData/Provisioning Profiles" "Provisioning Profiles" Hopefully this helps the next person.. got an app running on iOS...
  10. dummzeuch

    [Open Source] Delphi Youtube Downloader

    So it is a GUI wrapper for yt-dlp.exe?
  11. Fred Ahrens

    What new features would you like to see in Delphi 13?

    I don't need any new features. I just need that the existing features work as intended. And there are many areas where existing features need to be made usable again (e.g. refactoring, code formatting, HighDPI). OK, one new feature would be nice: compiling for Raspberry Pi. But fixing the existing features needs to be done first.
×