Jump to content

Remy Lebeau

Members
  • Content Count

    3060
  • Joined

  • Last visited

  • Days Won

    139

Everything posted by Remy Lebeau

  1. Remy Lebeau

    IdThread and THttpCli

    I was thinking the same thing. Yes, TIdThread is part of Indy. So, why wouldn't you want to use Indy's TIdHTTP component if you are using Indy for other things?
  2. Remy Lebeau

    Software architecture [indy?]

    The point was, if you use the plain vanilla TCP client/server components, then you have to design your own protocol on top of them, and implement both sides of that protocol. If you use a standard protocol, like FTP or HTTP, then you don't need to implement both sides (unless you really need to customize both sides), you can use pre-existing implementations. And HTTP has benefits over FTP. "check buffer is empty" is not a good way to approach this task in the first place.
  3. Remy Lebeau

    Indy & OpenSSL 1.1.1 & TLS 1.3

    And I do appreciate that work, and I will review it when I have time to do so (I wasn't able to get to it this past weekend, like I had hoped to).
  4. Remy Lebeau

    Thread programming without sleep or WaitFor events

    Actually, Embarcadero has slowly been cutting its dependencies on Indy over the past several releases. Eventually, I'd like to see Indy moved to GetIt as an optional install, like most other 3rd party components. But because Indy doesn't have a traditional install process (mainly for C++ support), that has been difficult to prepare.
  5. Remy Lebeau

    Thread programming without sleep or WaitFor events

    Sort of, but mostly no. At this time, there are no plans to move away from the current model of 1-thread-per-connection w/ blocking I/O, since Indy is multi-platform and that model is very portable. However, on Windows, Indy's IdWinsock2 unit does currently have declarations for the RIO functions, although it does not actually import the functions at runtime. But you can do that manually by calling WSAIoctl() directly (which Indy does expose access to). Also, I did check in some updates to Indy a few months ago to allow users to create asynchronous sockets using Indy's API, although Indy itself does not make use of asynchronous sockets. We tried once before (the SuperCore package) to add support for fibers and IOCP to Indy on Windows, but that was an epic failure, it just didn't work right and didn't fit well with the rest of Indy's architecture. Maybe in the future, we might consider making some new Windows-specific components that are just native IOCP/RIO without trying to shoe-horn IOCP/RIO into the rest of Indy. Who knows. If we ever did, that would likely be WAY down the line. Maybe Indy 12, 13, etc. We haven't even released Indy 11 yet, and that will just be a maintenance version, no real new features, just mostly code cleanup. No ETA on that.
  6. Remy Lebeau

    Thread programming without sleep or WaitFor events

    No, I do not. But I'm sure you can find some online. For example, here is a basic intro to get you started: Windows 8 Registered I/O Networking Extensions
  7. Remy Lebeau

    Thread programming without sleep or WaitFor events

    And the FreePascal/Lazarus forum: https://forum.lazarus.freepascal.org/index.php/topic,49585.0/topicseen.html
  8. Remy Lebeau

    Thread programming without sleep or WaitFor events

    Or Registered I/O.
  9. Local variables that are un-managed types are not auto-initialized. Object pointers are managed types only on ARC platforms (iOS and Android). Strings are always managed types, integers are never managed types. Only global variables and class members that are un-managed types get auto-initialized to zeros.
  10. Remy Lebeau

    Making method with default encoding

    Being a class type, you really can't specify a specific TEncoding value as a default parameter value. So you have to either: Use an overload (that is what Delphi's RTL does): procedure Save(const AData: TStringList); overload; procedure Save(const AData: TStringList; const AEncoding: TEncoding); overload; ... procedure Save(const AData: TStringList); begin Save(AData, TEncoding.UTF8); end; procedure Save(const AData: TStringList; const AEncoding: TEncoding); begin AData.SaveToFile(FileName, AEncoding); end; Or else use nil for the default value: procedure Save(const AData: TStringList; AEncoding: TEncoding = nil); ... procedure Save(const AData: TStringList; AEncoding: TEncoding); begin if AEncoding = nil then AEncoding := TEncoding.UTF8; AData.SaveToFile(FileName, AEncoding); end;
  11. Remy Lebeau

    TListBox, TListView how to use Sort(Compare) ?

    What does that code have to do with TListBox/TListView? Their Sort() methods are quite different than TObjectList's Sort() method.
  12. Remy Lebeau

    TListBox, TListView how to use Sort(Compare) ?

    Can you be more specific? What exactly is not working for you? Please show the code you are having trouble with.
  13. Note the ETag was also different between the two responses, which means different versions of the resource were being accessed, which would explain why they had different timestamps.
  14. Remy Lebeau

    TIdSSLIOHandlerSocketOpenSSL and TLS 1.3 ?

    There is already work being done to add 1.1.x support. Not by me, codewise, but I'll review and merge it when its ready.
  15. Remy Lebeau

    Variant to generic T, how?

    And this is why I HATE Generics! They cause more headaches than they solve.
  16. Remy Lebeau

    Variant to generic T, how?

    @Jacek Laskowski I can't test this myself (no working IDE), but what about if the 'record' constraint is added to the Generic so the compiler knows that T is a value type? ToField<T: record> = class private fData : T; protected procedure SetFromVariant(const aValue : Variant); end; procedure ToField<T>.SetFromVariant(const aValue : Variant); begin fData := aValue; end;
  17. I already told you how. Clicking on a hyperlink inside the HTML is supposed to fire the OnShouldStartLoadWithRequest and OnDidStartLoad events. If it is not, then you should file a bug report. I don't understand what you are describing, but that doesn't seem to match with your screenshot. Are you running your code in the IDE's debugger? If so, the messages will go to the debugger's output window, not to DebugView.
  18. Clicking on a hyperlink starts a load request. You should be getting events for that. Lets starts with the obvious - did you actually ASSIGN a handler to that event? I'm confused. What are you trying to say exactly? Can you provide a ste-by-step example?
  19. Remy Lebeau

    Threading question

    If you are going to do that, it would be simpler to use SetString() instead: SetString(AMsg, PChar(stat), Length(stat)); Or Copy(): AMsg := Copy(stat, 1, MaxInt); Especially since both of these approaches handle empty strings, whereas accessing index 1 of an empty string is technically undefined behavior, even though Move() won't do actually anything when the Length is 0.
  20. Remy Lebeau

    Threading question

    The correct way to use UniqueString() in this example would be like this: procedure StatusOut(const stat: string); var AMsg: string; begin AMsg := stat; UniqueString(AMsg); // use AMsg as needed... end;
  21. Remy Lebeau

    Indy question readbytes VS readstring

    There are no real "advantages" per-se, they are just different methods meant for reading different kinds of data. Use whatever method is appropriate for whatever kind of data you are trying to read. If you are reading textual data, then ReadLn(), ReadString(s)(), Capture(), etc are all suitable, depending on the formatting of the text. If you are reading binary data, then ReadBytes() or ReadStream() are suitable.
  22. VCL's TWebBrowser has an OnBeforeNavigate2 event. FMX's TWebBrowser has OnShouldStartLoadWithRequest and OnDidStartLoad events.
  23. Remy Lebeau

    Variant to generic T, how?

    Can't you just assign the Variant to the field directly and let the Variant handle the conversion? Why do you need to go through TValue at all? procedure ToField<T>.SetFromVariant(const aValue : Variant); begin fData := aValue; end; Internally, when TValue is holding a Variant, TValue.AsType<T>() will look at the Variant's VType, copy the appropriate TVarData field to a temp TValue, and then assign that temp to the Result variable via TValue.Get<T>(). So just take out the middle man (TValue), Variant already knows how to do that same conversion directly.
  24. Remy Lebeau

    issues with non-Win platforms

    The Platform/Feature Manager does not exist when using the Offline (ISO-based) installer, only when using the Online (GetIt-based) installer. This is stated as much in the Installation documentation:
  25. Remy Lebeau

    Threading question

    Yes, because it CAN'T switch to PostMessage(). That would grant the caller permission to free the string data before it has actually been used to update the Memo. The Add() must be synchronous, regardless of its implementation, blocking the caller until the update is complete to ensure the integrity of the string data.
×