Jump to content

Primož Gabrijelčič

Members
  • Content Count

    154
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Primož Gabrijelčič

  1. Primož Gabrijelčič

    IDE Fix Pack 6.4.4 - failed to load layout

    Delphi 10.3.2, IDE Fix Pack 6.4.4 When I close a project with File, Close All, I get this error: This happens with all projects. Startup Layout.dst attached. @jbg Startup Layout.dst
  2. Primož Gabrijelčič

    Generic Command Line Parser for Delphi 10.3.x

    My approach: https://github.com/gabr42/GpDelphiUnits/blob/master/src/GpCommandLineParser.pas
  3. Primož Gabrijelčič

    IDE Fix Pack 6.4.3 breaks compilation

    IDE Fix Pack 6.4.3 breaks compilation in Rio 10.3.2 for our flagship application. After compile or rebuild, I get [dcc32 Fatal Error] FAB .gRPC . pas ( 265): F2084 Internal Error: AV0D0F16E4(0D080000)-R0000000C-0 Wihout IDE Fix Pack, compilation works fine. Any suggestions?
  4. Primož Gabrijelčič

    IDE Fix Pack 6.4.3 breaks compilation

    Works great! Thank you for a prompt fix! (And thank you for IDEFixPack!)
  5. Primož Gabrijelčič

    IDE Fix Pack 6.4.3 breaks compilation

    I was wrong - it is CodeGenMod.Win32.VirtFinalSealed. When I disable it, the project can be rebuilt again.
  6. Primož Gabrijelčič

    IDE Fix Pack 6.4.3 breaks compilation

    What was the patch that did not get applied in 6.4.2 because of the change in 10.3.2? I'm pretty sure that everything worked fine with 6.4.2.
  7. Hi all, Somehow I think that the following code should compile, but it does not. It looks like the compiler uses the wrong `TCallback` definition when resolving the property. Am I correct or did I miss something and I'm just stupid? program Project184; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; type TCallback = reference to procedure (value: int64); TRunner = class public type TCallback = reference to procedure; strict private FOnCallback: TCallback; public procedure Run; property OnCallback: TCallback read FOnCallback write FOnCallback; end; procedure TRunner.Run; begin OnCallback(); // <-- E2035 Not enough actual parameters end; begin end. Delphi 10.3.1, in case this is a regression bug.
  8. Primož Gabrijelčič

    redefined anonymous method - bug or my mistake?

    Reported, please vote: https://quality.embarcadero.com/browse/RSP-24827
  9. Primož Gabrijelčič

    redefined anonymous method - bug or my mistake?

    Indeed, a workaround is not a problem. The bug in itself is, though 😞
  10. Primož Gabrijelčič

    Updating UI using Invoke

    Indeed.This is documented.
  11. Primož Gabrijelčič

    Updating UI using Invoke

    Functionally it's about the same. I like the anonymous method approach more because all functionality is concentrated in one space.
  12. Primož Gabrijelčič

    Updating UI using Invoke

    Tricky, got me completely dazzled for a moment 🙂 You are now generating new capture proc for each `I`. That `Proc`, however, is just a pointer. Now your code `Task.Invoke(procedure begin Proc(); end);` captures this `Proc` by value and executes the last stored value three times. You should do it like this: function CaptureValue(Value: Integer): TOmniTaskInvokeFunction; begin Result := procedure begin Memo.Lines.add(Value.ToString); end; end; for I := 0 to 2 do begin Task.Invoke(CaptureValue(i)); end;
  13. Primož Gabrijelčič

    Updating UI using Invoke

    Reproducible test case, please ...
  14. Primož Gabrijelčič

    ANN: Parnassus Bookmarks and Navigator will be included in the next release of RAD Studio

    I think this is Delphi problem, not Parnassus. It also happens when I right-click a breakpoint or right-click in the editor.
  15. Primož Gabrijelčič

    Using Parameters with Async/Await.

    Indeed it is.
  16. Primož Gabrijelčič

    Using Parameters with Async/Await.

    The first approach is OK. The second code fragment would not compile as the anonymous method in Await wouldn't know anything about RemindersDue and RemindersCount.
  17. While writing Design Patterns with Delphi, I spent quite some time researching existing literature on design patterns implementation in Delphi, design patterns in other languages, other types of patterns, design principles and so on … In case you would like to dig deeper than the book takes you, here is my reading list. Design Patterns Essentials Software design pattern Computer Science Design Patterns The 23 patterns from the GoF Design Patterns with examples in different languages (including Delphi) Gang of Four Design Patterns Reference Sheet Programming principles Design principles and design patterns SOLID Don't Repeat Yourself (DRY) KISS YAGNI (You Ain't Gonna Need It) Software Design Patterns Are Not Goals, They Are Tools I'm Sick Of GoF Design Patterns Software Development AntiPatterns Big Ball of Mud Design Patterns for Humans Spring4D MMX Code Explorer Singleton https://en.wikipedia.org/wiki/Singleton_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Singleton http://www.yanniel.info/2010/10/singleton-pattern-delphi.html https://ibeblog.com/2010/08/18/delphi-singleton-patterns/ https://stackoverflow.com/a/1409672/4997 https://github.com/jimmckeeth/DelphiPatterns/tree/master/Creational.Singleton https://stackoverflow.com/questions/1409593/creating-a-singleton-in-delphi-using-the-new-features-of-d2009-and-d2010 https://sourcemaking.com/design_patterns/singleton https://schellingerhout.github.io/design%20patterns/design-patterns-creational-delphi/ https://github.com/kamranahmedse/design-patterns-for-humans#-singleton Dependency injection https://en.wikipedia.org/wiki/Dependency_injection http://www.nickhodges.com/post/Service-Locator-is-Indeed-an-Anti-pattern.aspx https://softwareengineering.stackexchange.com/questions/135914/why-was-dependency-injection-pattern-not-included-in-the-gang-of-four/135982 https://stackoverflow.com/questions/4176520/what-is-the-difference-between-strategy-pattern-and-dependency-injection Lazy Initialization https://en.wikipedia.org/wiki/Lazy_initialization Object pool https://en.wikipedia.org/wiki/Object_pool_pattern https://sourcemaking.com/design_patterns/object_pool Factory method https://en.wikipedia.org/wiki/Factory_method_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Factory_method https://github.com/jimmckeeth/DelphiPatterns/tree/master/Creational.FactoryMethod https://sourcemaking.com/design_patterns/factory_method https://schellingerhout.github.io/design%20patterns/design-patterns-creational-delphi/ https://github.com/kamranahmedse/design-patterns-for-humans#-factory-method Abstract factory https://en.wikipedia.org/wiki/Abstract_factory_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Abstract_Factory http://www.felix-colibri.com/papers/design_patterns/factory_and_bridge_patterns/factory_and_bridge_patterns.html#abstract_factory_pattern https://github.com/jimmckeeth/DelphiPatterns/tree/master/Creational.AbstractFactory http://www.nickhodges.com/post/Delphi-and-the-Factory-Pattern-Simple-Factory.aspx https://sourcemaking.com/design_patterns/abstract_factory https://schellingerhout.github.io/design%20patterns/design-patterns-creational-delphi/ https://github.com/kamranahmedse/design-patterns-for-humans#-abstract-factory Prototype https://sourcemaking.com/design_patterns/prototype https://schellingerhout.github.io/design%20patterns/design-patterns-creational-delphi/ https://en.wikipedia.org/wiki/Object_copying#Deep_copy https://github.com/kamranahmedse/design-patterns-for-humans#-prototype Builder https://en.wikipedia.org/wiki/Builder_pattern https://github.com/jimmckeeth/DelphiPatterns/tree/master/Creational.Builder https://sourcemaking.com/design_patterns/builder https://schellingerhout.github.io/design%20patterns/design-patterns-creational-delphi/ https://github.com/kamranahmedse/design-patterns-for-humans#-builder Composite https://en.wikipedia.org/wiki/Composite_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Composite https://github.com/jimmckeeth/DelphiPatterns/tree/master/Structural.Composite https://sourcemaking.com/design_patterns/composite https://github.com/kamranahmedse/design-patterns-for-humans#-composite Flyweight https://en.wikipedia.org/wiki/Flyweight_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Flyweight https://sourcemaking.com/design_patterns/flyweight https://github.com/kamranahmedse/design-patterns-for-humans#-flyweight https://en.wikipedia.org/wiki/String_interning Marker interface https://en.wikipedia.org/wiki/Marker_interface_pattern Bridge https://stackoverflow.com/questions/350404/how-do-the-proxy-decorator-adapter-and-bridge-patterns-differ https://en.wikipedia.org/wiki/Bridge_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Bridge https://github.com/jimmckeeth/DelphiPatterns/tree/master/Structural.Bridge https://sourcemaking.com/design_patterns/bridge http://www.felix-colibri.com/papers/design_patterns/factory_and_bridge_patterns/factory_and_bridge_patterns.html#the_bridge_design_pattern https://simpleprogrammer.com/design-patterns-simplified-the-bridge-pattern/ https://github.com/kamranahmedse/design-patterns-for-humans#-bridge https://stackoverflow.com/q/319728/4997 Adapter https://en.wikipedia.org/wiki/Adapter_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Adapter https://github.com/jimmckeeth/DelphiPatterns/tree/master/Structural.Adapter https://sourcemaking.com/design_patterns/adapter https://github.com/kamranahmedse/design-patterns-for-humans#-adapter Proxy https://en.wikipedia.org/wiki/Proxy_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Proxy https://github.com/jimmckeeth/DelphiPatterns/tree/master/Structural.Proxy https://sourcemaking.com/design_patterns/proxy https://github.com/kamranahmedse/design-patterns-for-humans#-proxy Decorator https://en.wikipedia.org/wiki/Decorator_pattern https://github.com/jimmckeeth/DelphiPatterns/tree/master/Structural.Decorator https://sourcemaking.com/design_patterns/decorator https://github.com/kamranahmedse/design-patterns-for-humans#-decorator Facade https://en.wikipedia.org/wiki/Facade_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Facade https://github.com/jimmckeeth/DelphiPatterns/tree/master/Structural.Facade https://sourcemaking.com/design_patterns/facade https://github.com/kamranahmedse/design-patterns-for-humans#-facade Null object https://en.wikipedia.org/wiki/Null_object_pattern https://sourcemaking.com/design_patterns/null_object Template method https://en.wikipedia.org/wiki/Template_method_pattern https://github.com/jimmckeeth/DelphiPatterns/tree/master/Behavioral.TemplateMethod https://www.codeproject.com/Articles/516094/TemplateplusMethodplusDesignplusPatternplusinplusD https://sourcemaking.com/design_patterns/template_method https://github.com/kamranahmedse/design-patterns-for-humans#-template-method Command https://en.wikipedia.org/wiki/Command_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Command https://github.com/jimmckeeth/DelphiPatterns/tree/master/Behavioral.Command https://sourcemaking.com/design_patterns/command https://github.com/kamranahmedse/design-patterns-for-humans#-command https://stackoverflow.com/q/6064116/4997 State https://en.wikipedia.org/wiki/State_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/State https://github.com/jimmckeeth/DelphiPatterns/tree/master/Behavioral.State https://sourcemaking.com/design_patterns/state https://sourcemaking.com/design_patterns/state/delphi https://github.com/kamranahmedse/design-patterns-for-humans#-state https://en.wikipedia.org/wiki/Finite-state_machine Iterator https://en.wikipedia.org/wiki/Iterator_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Iterator https://github.com/jimmckeeth/DelphiPatterns/tree/master/Behavioral.Iterator https://sourcemaking.com/design_patterns/iterator https://github.com/kamranahmedse/design-patterns-for-humans#-iterator http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Declarations_and_Statements_(Delphi)#For_Statements Visitor https://en.wikipedia.org/wiki/Visitor_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Visitor https://github.com/jimmckeeth/DelphiPatterns/tree/master/Behavioral.Visitor https://sourcemaking.com/design_patterns/visitor https://sourcemaking.com/design_patterns/visitor/delphi https://github.com/kamranahmedse/design-patterns-for-humans#-visitor Observer https://en.wikipedia.org/wiki/Observer_pattern https://en.wikipedia.org/wiki/Publish–subscribe_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Observer https://github.com/jimmckeeth/DelphiPatterns/tree/master/Behavioral.Observer https://github.com/spinettaro/delphi-event-bus https://sourcemaking.com/design_patterns/observer/delphi https://github.com/kamranahmedse/design-patterns-for-humans#-observer http://docwiki.embarcadero.com/Libraries/en/System.Messaging.TMessageManager http://docwiki.embarcadero.com/RADStudio/en/Using_the_RTL_Cross-Platform_Messaging_Solution http://docwiki.embarcadero.com/RADStudio/en/Sending_and_Receiving_Messages_Using_the_RTL http://docwiki.embarcadero.com/Libraries/en/System.Classes.TComponent.Observers Memento https://en.wikipedia.org/wiki/Memento_pattern https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Memento https://github.com/jimmckeeth/DelphiPatterns/tree/master/Behavioral.Memento https://sourcemaking.com/design_patterns/memento https://github.com/kamranahmedse/design-patterns-for-humans#-memento Lock https://en.wikipedia.org/wiki/Lock_(computer_science) https://en.wikipedia.org/wiki/Spinlock Lock striping https://netjs.blogspot.si/2016/05/lock-striping-in-java-concurrency.html Double-checked locking https://en.wikipedia.org/wiki/Double-checked_locking https://en.wikipedia.org/wiki/Test_and_test-and-set Optimistic locking https://www.javaworld.com/article/2075406/java-web-development/optimistic-locking-pattern-for-ejbs.html https://martinfowler.com/eaaCatalog/optimisticOfflineLock.html https://en.wikipedia.org/wiki/Optimistic_concurrency_control Readers-writer lock https://en.wikipedia.org/wiki/Readers–writer_lock https://docs.microsoft.com/en-us/windows/desktop/sync/slim-reader-writer--srw--locks Thread pool https://en.wikipedia.org/wiki/Thread_pool https://stackoverflow.com/questions/47504201/delphi-ttask-and-tthreadpool Messaging https://en.wikipedia.org/wiki/Message_passing https://en.wikipedia.org/wiki/Message_queue Future https://en.wikipedia.org/wiki/Futures_and_promises Pipeline https://en.wikipedia.org/wiki/Staged_event-driven_architecture Designing Delphi programs https://en.wikipedia.org/wiki/Event-driven_programming http://blong.com/Articles/Actions/Actions.htm https://github.com/andrea-magni/TFrameStand https://martinfowler.com/eaaCatalog/tableModule.html https://stackoverflow.com/questions/433819/table-module-vs-domain-model http://docwiki.embarcadero.com/RADStudio/en/LiveBindings_in_RAD_Studio https://www.embarcadero.com/images/dm/technical-papers/understanding_rad_studio_livebindings.pdf Other kinds of patterns https://en.wikipedia.org/wiki/Exception_handling http://wiki.c2.com/?ExceptionPatterns http://docwiki.embarcadero.com/Libraries/en/System.TObject.Destroy http://www.heaventools.com/eurekalog-exception-logger.htm http://www.madshi.net/madExceptDescription.htm https://github.com/project-jedi/jvcl https://en.wikipedia.org/wiki/Debugging_patterns https://git-scm.com/docs/git-bisect http://www.washi.cs.waseda.ac.jp/wp-content/uploads/2017/03/Woei-Kae-Chen.pdf https://github.com/colinj/Functional https://fsharpforfunandprofit.com/fppatterns/ https://en.wikipedia.org/wiki/Comparison_of_programming_paradigms Books & papers Architectural Patterns, Pethuru Raj, Anupama Raman, Harihara Subramanian Coding in Delphi, Nick Hodges Concurrency with Modern C++, Rainer Grimm Concurrent Patterns and Best Practices, Atul S. Khot Dependency Injection in Delphi, Nick Hodges Design Patterns for Humans, Kamran Ahmed Design Patterns Past and Future, Aleksandar Bulajic Design Patterns - Elements of Reusable Object-Oriented Software, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides Dive Into Design Patterns, Alexander Shvets Java Design Patterns, Devendra Singh More Coding in Delphi, Nick Hodges The Null Object Pattern, Bobby Woolf
  18. Primož Gabrijelčič

    Pipeline multi runnable

    If I understand correctly, this has nothing to do with a pipeline. a) You "create a protocol" (whatever that means) b) You submit that protocol to a background thread to execute it and c) you repeat step b. And you can do all that with different protocols. As one protocol is a normal serial process, it has nothing to do with threading. Just implement "protocol runner" as a state machine. Then create a Background Worker abstraction and submit it work items. One work item = one "protocol runnner".
  19. Primož Gabrijelčič

    Pipeline multi runnable

    Pipelines are not restartable by design. You create a pipeline, run it until you don't need it anymore, then tear it down. What problem are you trying to solve, anyway?
  20. Primož Gabrijelčič

    Delegation good practice

    Yes, OnMessageis designed for this. OTL takes care that OnMessage handler is executed in the thread which created the background task (in the owner).
  21. Primož Gabrijelčič

    Delegation good practice

    I don't really understand your questions, sorry. If you run some external code, you cannot be sure if it is thread-safe. You should protect access to it with some synchronization mechanism. A whole idea of a guardian object with a "not responding" callback is new to me. I don't believe it is a commonly used pattern. I can't comment on it as I never used it in practice.
  22. Primož Gabrijelčič

    DynArraySetLength exception

    Compilable, working example, please.
  23. Primož Gabrijelčič

    OnTerminated never triggers

    By debugging, of course. Although, I have to admit, it had me quite stumped for a while. A bit of logging proves that service start and stop both come from the same thread (the first number is the thread id): 8996|ServiceCreate 8996|Servizio attivato porta = 8889 17284|ServiceStart 8996|Got message 1024 8996|Keep Alive 8996|Got message 1024 8996|Keep Alive 17284|A try to stop task... 6456|Sending COmniTaskMsg_Terminated 17284|FRunner.ExitCode = 0 17284|ServiceStop 8996|Got Terminated 8996|OnTaskTerminated? 8996 is the main service thread, 17284 is the service control thread, 6456 is the thread running the background task. 
  24. Primož Gabrijelčič

    OnTerminated never triggers

    Your task is created in one thread (main service thread) and that thread processes messages sent from the task, including the termination message. The task is stopped from a different thread. ServiceCreate and ServiceStart/ServiceStop are NOT executed from the same thread. The OtlTaskControl code expects that the task will be terminated from the same thread that it was created in. The .Terminate method therefore tries to process all messages waiting in the message queue (for example, the termination message), but it cannot do that as the message queue is not associated with the "ServiceStop" thread but with the "ServiceCreate" thread. After the ServiceStop exits, the main service thread is destroyed and that destroys the IOmniTaskControl object. At that moment, messages from the inter-thread message queue are processed, but they cannot be dispatched anywhere as the main service thread is being terminated. (Because of a DSiWin32.pas bug, messages will still be dispatched and may cause the program to crash. This will be fixed today.) Solution? Just do your OnTerminated processing in ServiceStop.
  25. Primož Gabrijelčič

    OnTerminated never triggers

    I was able to repeat the problem and I'm looking into it.
×