Jump to content

Uwe Raabe

Members
  • Content Count

    2542
  • Joined

  • Last visited

  • Days Won

    147

Everything posted by Uwe Raabe

  1. Uwe Raabe

    Some REST help please.

    @Patrick PREMARTIN I have never seen some documentation about a REST API to forbit or even avoid POST requests. If you have a link to such docs I would be interested. In my (surely limited) experience with REST API implementations that are not simply read-only, I never encountered anything restricted to GET requests.
  2. Uwe Raabe

    Parsing Json to retrieve nested record

    You can use a TRESTResponseDataSetAdapter and connect its Response property to your TRESTResponse instance (alternatively use a TRESTResponseJSON instance to provide a TJSONObject). Iterating through the records list and adding each tubes items to your dataset may need some additional coding around, though.
  3. Uwe Raabe

    Parsing Json to retrieve nested record

    The above JSON has an array "records", where each item contains a "coin_mech" object, which itself contains the "tubes" array. Are you interested in the "tubes" from one specific "records" item or do you want to collect all "tubes" arrays from all "records" items.
  4. Uwe Raabe

    Parsing Json to retrieve nested record

    Which Delphi version are you using?
  5. Uwe Raabe

    Some REST help please.

    IMHO the best way ist to use a dedicated class handling the parameters and place that in body: type TMyParam = class private FUserName: string; FSecret: string; FShortcode: string; FMsisdn: string; FMessage: string; public property Message: string read FMessage write FMessage; property Msisdn: string read FMsisdn write FMsisdn; property Secret: string read FSecret write FSecret; property Shortcode: string read FShortcode write FShortcode; property UserName: string read FUserName write FUserName; end; ... var myParam := TMyParam.Create; try myParam.UserName := 'email@email.com'; myParam.Secret :='password'; myParam.Shortcode := 'pacific bulkms'; myParam.Msisdn := '6799998122'; myParam.Message := 'Hello World'; RestRequest1.AddBody(myParam); finally myParam.Free; end;
  6. Uwe Raabe

    Some REST help please.

    May be I missed it, but I cannot see where you set RESTRequest1..Method to rmPost (the default is rmGet). The default parameter kind is pkGetOrPost, which put the parameters in the URL for GET and into the body for POST. This would explain the "Empty Request..." error.
  7. So you are out for a warning/hint when abbreviations are used? (I won't consider error as long as CTRL-O-O actually follows such a setting) You might consider to rephrase the description as it isn't clear IMHO.
  8. It is not clear to me what this issue is about. Currently you can use the abbreviated version as well as the verbose one. I don't see where hint/warning/error settings come into play here, besides the directives affecting them.
  9. The problem in your code is that the anonymous method calling RunWork uses the counter variable directly. While it is correct that this variable is captured for the anonymous method, it is captured by its address and not by its value. Therefore the RunWork call uses the value of counter that is given in the moment of that call. Usually that is different from what you expect. You can solve this by injecting a method returning the anonymous method with the counter value at that time. function MakeRunWork(ACounter: Integer): TProc; begin Result := procedure begin RunWork(ACounter); end; end; procedure TForm780.Button1Click(Sender: TObject); const NumberOfParts = 1; var counter: integer; TaskArray: array of iTask; begin { --- run button --- } SetLength(TaskArray, NumberOfParts); for counter := 0 to NumberOfParts - 1 do begin try TaskArray[counter] := TTask.Run(MakeRunWork(counter)); except on E:EAggregateException do ShowMessage( E.ToString); end; // try end; // for counter end;
  10. I don't understand how this can even work at all. If PosY equals Y - 1 then PosY cannot be equal to Y - 2 nor Y - 3 and so on. There can either one condition be met or none, but not all.
  11. Uwe Raabe

    while TStream_TryRead() do

    @David Heffernan, that was my first idea, too. There is just some code missing that handles the BytesRead > 0 case before the loop exits. Some if-then after the read cannot be avoided in this case.
  12. Uwe Raabe

    Paradox in FireDAC Delphi 11 Ent 32bit VCL App

    I cannot see any compile error shown in the original post either. There is only one reference which doesn't make any sense:
  13. Uwe Raabe

    How do I know if the click is an actual user click ?

    One can also use the csUpdating flag in ComponentState, which is controlled by the Updating and Updated methods. It works for all TComponent descendants. But now we are in a much wider realm than the original OnClick problem describes.
  14. Uwe Raabe

    How do I know if the click is an actual user click ?

    Simply setting FState doesn't reflect the change in the control while its handle is allocated. That may work for some initialization during FormCreate before the handle allocated, but is no general solution.
  15. Uwe Raabe

    Project Options -> Version Info aka. dproj madness

    That is actually what my build server (resp. FinalBuilder) does here. That is only one reason, why I avoid creating any exe on my development system and send it to a customer. I would love to see a reliable solution in the IDE itself. For compatibility reasons I suggest to add a special entry to the configuration combo which handles the storage in the base configuration and clear all child configurations. One has to remember that the version info dialog for Win32/Win64 only projects differs from those targeting other platforms, too. The former can handle that in the base configuration, while the latter has to do it in the platform bases. The reason is that different platforms follow different rules.
  16. Uwe Raabe

    PDF to PNG and PNG to PDF

    Sadly, that exactly hits the point. Joe Hecht passed away some time ago.
  17. Uwe Raabe

    How do I know if the click is an actual user click ?

    It affects all TButtonControl descendants of which TCheckBox is just one. The easiest way to avoid that is to use actions. Another way would be to make use of the (protected) ClicksDisabled property, which skips the call to the event handler. That is basically the same as what the actions do.
  18. Uwe Raabe

    Project Options -> Version Info aka. dproj madness

    Project Magician follows a different scheme: It has an option to remove all child entries so that only the base values are effective. Unfortunately it doesn't force you to change base values only nor does it warn if you don't.
  19. Uwe Raabe

    JSON and UInt64 problem

    This can be easily solved by converting to string before calling the constructor: JSonObject.AddPair('Test', TJSONNumber.Create(High(UInt64).ToString)); // add System.SysUtils to uses clause If the UINT64 value is already correct in the JSON string it is properly converted to an UNIT64 later.
  20. Uwe Raabe

    Display Value at runtime

    I'm sorry, but I have no clue what you are talking about.
  21. Uwe Raabe

    JSON and UInt64 problem

    I have to revert my statement: Currently not even creation of a UINT64 is supported. Nevertheless, the values are always stored as string, so no restrictions apply here. It is the responsibility of the developer to do the conversion needed. For completeness I suggest to create a QP request. Internally it needs just some extension to the case statement in TJSONString.AsTValue.
  22. Uwe Raabe

    Project Options -> Version Info aka. dproj madness

    I guess you already did: https://quality.embarcadero.com/browse/RSP-33469
  23. Uwe Raabe

    JSON and UInt64 problem

    Probably not. Although it accepts UINT64 at creation, there is no support for retrieving it. I suggest to file a QP report.
  24. Uwe Raabe

    Rad studio install on several machines

    Licenses are bound to the machine name, so you probably have to use your serial to register online on the new system. This should work for a certain (low) number of times after which you need to ask for a registration bump. If you have an active subscription you can contact support for that, otherwise you need to ask sales for a bump.
  25. Uwe Raabe

    Project Options -> Version Info aka. dproj madness

    Unfortunately, changing any version information values at least once will break inheritance and the values in that build configuration have their own life. There is no built-in way to establish inheritance - unless the entries are removed from the dproj with some exterenal tool. That is the reason why Project Magician has this option
×