Jump to content

Clément

Members
  • Content Count

    56
  • Joined

  • Last visited

  • Days Won

    2

Clément last won the day on August 26

Clément had the most liked content!

Community Reputation

31 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I'm using Delphi Rio. I have this thread that respond to Windows Messages using PostThreadMessage called from the main thread or any other thread. It is fast and working fine. procedure TdhsLoggerThread.Execute; var lMsg : TMsg; lCOunt : Integer; begin inherited; fLogs := TObjectDictionary<String,TdhsLoggerItemData>.Create([doOwnsValues]); try gLoggerThreadID := ThreadID; PeekMessage( lMsg, 0 , WM_USER , WM_USER , PM_NOREMOVE ); //FTimerID := SetTimer(0,0,1000,nil); #1 lCount := 0; while GetMessage( lMsg, 0, 0 , 0 ) do begin inc(lCount); DoProcessMessages( lMsg ); // if (lCOunt mod 1000) = 0 then #2 // DoFlushLogs; #2 end; // KillTimer(0,FTimerID); #1 DoFlushLogs; finally fLogs.Free; end; end; If I run the code as posted ( commenting #1 & #2), during my stress test with 200000 calls, lCount shows the correct number of processed messages (200005). I need to FlushLogs every second, so I added the code I marked with #1, I'm receiving WM_TIMER messages, but some of my messages are lost and lCount shows 195453 calls ( The count varies but I usually losing between 5000 to 10000 messages) . Every message has information I can't loose, so missing messages is a big no no! If I comment #1 and uncomment #2 I get all the calls as expected. No problems with DoFlushLogs then, so I'm messing up SetTimer call or it is not supposed to be called the I'm calling it. Am I using correctly SetTimer? I'm trying to avoid creating another thread just to control the timer, is there another way create a timer in the same thread without loosing my messages? ( I don't want to use Sleep() ). All I need is to timely flushlogs. If there's no other way, I will create a ThreadedTimer. TIA, Clément
  2. This really should be fixed! Debugging this code structure will be more common as soon as 10.4 will fix inline declaration or when LSP will be released. procedure TTest.Test; begin if SomeCondition then begin var Qry := 'select * from sometable'; Check(Qry); // Breakpoint: S shows 'A' - Output in check = 'A' end; {..} if SomeOtherCondition then begin var Qry := 'select * from sometable where condition'; Check(Qry); // Breakpoint: S shows 'A' - should have been 'C' - Output in check = 'C' end; {..} while SomeCondition do begin var Qry := SomeFunction( SomeParameter ); Check(Qry); end; end; I'm not saying this construction is good or not, but if the new feature allows it, should work as advertised! Don't have much hair left to pull out.
  3. Clément

    Application blocking (suspended)

    the icon is called "econo mode" and when you hover over the leaf icon in Task Manager’s Status column, you will now see a tooltip describing what it means (this app is suspending processes to help improve system performance). My machine shows 2 applications with that leaf (Settings and Cortana). Both applications are responding. Here's another link with a better article: https://technidad.com/what-is-this-new-green-leaf-icon-in-task-manager-of-windows-10/ How the Green Leaf feature works and what it actually does As you know, the task manager is a window in which you can view all the processes. You can view all your running apps and also the different background processes. The processes that have a Green Leaf icon beside them are a bit different from the other processes. These are the processes which are actually ‘suspended’. This can save your computers RAM, without significantly affecting the performance of the processes. You could say that Windows puts these applications in the ‘Ready state’ or ‘blocks’ them from being executed by the processor. Windows could do it when the app requires a human input/output. Also, you won’t feel any lag because of the Green Leaf feature while switching between processes. A blessing for computers with lower specs It is expected that the introduction of this new feature in several versions of Windows 10 will be a blessing for computers with lower specs. The feature is so smart that it can turn your RAM more efficient than before and you can enjoy faster speeds of computing and reduced lags. By suspending the apps until you launch them the Green Leaf feature does a really good job.Also, after the app is launch you will notice in the task manager that the Green Leaf icon disappears. hth,
  4. Clément

    Application blocking (suspended)

    This might shed some light: https://superuser.com/questions/1406692/what-does-the-leaf-symbol-in-the-status-column-of-the-task-manager-mean "Do note, the faster your computer is, the less likely it is that windows needs to suspend processes. So some users with fast pc's may not see any suspended process, while people with a slower pc may see a lot of them." HTH
  5. Clément

    news about the beta of 10.3.4

    Amateurs! Delphi 10 Rock in Rio III If you insist in using X.... Delphi X-Rio III ( I should be in marketing )
  6. Clément

    Good practices with nested methods

    Hi, The code you posted is full of traps! While it's ok to play with scope you could end it with unexpected behavior when debugging should someone alter the disposition of the declarations ( There's always this guy that wants to optimize stuff). Another thing I always keep in mind. Nested methods are good candidate to private methods. Be sure to write safe code when future comes and avoid breaking working code because you WILL cut and paste that code and WILL suffer the cut and paste syndrome !
  7. Clément

    news about the beta of 10.3.4

    I guess you heard of 10.3.4 before everybody else. From the latest roadmap 10.3.3 should be released late 2019 and 10.4 was postponed to early 2020. You can check it out here: https://community.idera.com/developer-tools/b/blog/posts/august-2019-delphi-android-beta-plans-august-roadmap-update
  8. Wow! I will take a look. Thanks a lot.
  9. Hi, I will start a new project with Delphi Rio and ICS 8.62. I will send and receive JSON objects and I don't need to return HTML pages, at least not for the first release. Is ThttpAppSrv Ok to use for REST only , or should I use THttpSrv instead ( I might need to use SSL ). I want to build a windows service to handle my REST requests. Is there a sample I can take a look? TIA, Clément
  10. Clément

    Payment - Monetization - Good international PSP

    Thanks! I will have a look. I wrote my store in Delphi, it's easy to incorporate new providers. The problem is the other way around. Would the provider want to work with me? (Ingenico never reply my emails) I guess my transaction volume scared them! 😋
  11. Clément

    Payment - Monetization - Good international PSP

    Nothing is basic in my country (Take Amazon Rain Forest as the latest example) There's a lot of thing this administration must do, or else.... Anyway, selling worldwide shows how confident I am with solving our basic administration problems in a foreseeable future
  12. Clément

    Payment - Monetization - Good international PSP

    Major card is a must for me too. I released my application (VCL) with an embedded shopping cart that is powered by Stripe and Paypal. Both offers major cards and local payment methods. All purchases will end up in my business Stripe or Paypal account. Still have to see how I will handle receipts. Brazil is known as the country with most entangled taxes, so one can only hope that working with other countries will be easier.
  13. Clément

    The Embarcadero GetIt server could not be reached...

    Hi, Have you tried the new patches? http://blog.marcocantu.com/blog/2019-august-more-patches-update-getit.html HTH, Clément
  14. Clément

    August 2019 Roadmap released

    If those are included, 10.4 would be groundbreaking change! But to be honest lambda expressions and ternary operators will never happen. (Now someone from EMB. should reply to never say never 😋)
  15. {$IFDEF} doesn't have code folding per se. I need to do some extra writing: {$IFDEF USE_FEATURE} {$REGION "USE_FEATURE"} // changes in methods to use feature(s) {$ENDREGION} {$ELSE} {$REGION "NO_FEATURE"} // Original code {$ENDREGION} {$ENDIF} Even so, this will not beat a fancy parser.
×