Jump to content

mvanrijnen

Members
  • Content Count

    24
  • Joined

  • Last visited

Community Reputation

2 Neutral

Recent Profile Visitors

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

  1. mvanrijnen

    Having fun with Delphi

    Good idea with the pointer, you do have to encode somevalues in the stringbuilder (escape special chars etc) maybe with an TInterfaced (no need to free) THSURI2 = class(TInterfacedObject) private FScheme: THSURIScheme; FFragment: string; FQuery: string; FPort: Integer; FPassword: string; FHost: string; FUserName: string; FPath : string; function GetAsString: string; constructor Scheme(const AScheme : THSURIScheme); public constructor HTTP; constructor HTTPS; .... TMP2 := THSURI2.HTTPS .UserName('yourname') .Password('andpassword') .Host('www.website.com') .Port(1234) .Path('chapter') .Path('subchapter') .Path('subsubchaper') .Parameter('showall') .Parameter('yearstart', '1990') .Fragment('startreadinghere'); test := TMP2.AsString;
  2. mvanrijnen

    Having fun with Delphi

    Ok, did not know that. So have to be carefull where and how to use this. Would not be wise to use it in highperf code sections, but There where you set up connection strings, sql statements, urls etc, why not use it ?
  3. mvanrijnen

    Having fun with Delphi

    Something like: tmp := THSUri.HTTPS .UserName('yourname') .Password('andpassword') .Host('www.website.com') .Port(1234) .Path('chapter') .Path('subchapter') .Path('subsubchaper') .Parameter('showall') .Parameter('yearstart', '1990') .Fragment('startreadinghere'); tmp.AsString Reults in: 'https://yourname:andpassword@www.website.com:1234/chapter/subchapter/subsubchaper?showall&yearstart=1990#startreadinghere' I'm using the scheme (HTTP, HTTPS) as the record constructor/initializer. .... public class function Scheme(const AScheme : THSURIScheme) : THSUri; static; class function HTTP : THSURI; static; class function HTTPS : THSURI; static; ..... implementation class function THSURI.Scheme(const AScheme: THSURIScheme): THSUri; begin // some needed and needless inits. Result.FScheme := AScheme; Result.FPort := 0; Result.FHost := string.Empty; Result.FUserName := string.Empty; Result.FPassword := string.Empty; Result.FPath := string.Empty; Result.FQuery := string.Empty; Result.FFragment := string.Empty; end; class function THSURI.HTTP: THSURI; begin Result := THSURI.Scheme(usHTTP); end; class function THSURI.HTTPS: THSURI; begin Result := THSURI.Scheme(usHTTPS); end;
  4. mvanrijnen

    FireDAC and pooling random error

    "a specific part of the program" is a thread (amongst other parts) in your case, misunderstood your sentence there 🙂
  5. mvanrijnen

    FireDAC and pooling random error

    That is tricky, you should not do that, maybe the underlaying physicaldb class takes care of you for this, but with most db types, you must not practise this. (i can not forbid you todo 🙂 ). See this: http://docwiki.embarcadero.com/RADStudio/Rio/en/Multithreading_(FireDAC) I have some troubles with a new project too, with MT and FD, probably some (yet) unidentified loading from a thread in a datamodule which is purely running mainthread.
  6. mvanrijnen

    [Source code for sale] Automated Whatsapp server

    I don't think it's allowed to use whatsapp in this way, maybe check with their license(s).
  7. mvanrijnen

    More performance Stringgrid sorting algorithm help

    1st You constantly assign the strings of the stringlist, do you do this within a beginupdate/endupdate ? 2nd Not want to be too harsh, but looks not good to be a final solution that code.
  8. mvanrijnen

    TEndpointRequest, can not get body (json)

    Problem solved itself after restarting Delphi and clear all dcu's from the build. strange but true.
  9. Hello, maybe someone can help me out with the following problem, serverside resource See following code, i post a request for updating something, serverside can not find body? this is what the post request, posts to the server (captured with fiddler): POST http://pc-pcname:8080/appointments/21140 HTTP/1.1 Connection: Keep-Alive Content-Type: application/json Accept: application/json, text/plain; q=0.9, text/html;q=0.8, Accept-Charset: utf-8, *;q=0.8 User-Agent: Embarcadero RESTClient/1.0 Content-Length: 435 Host: pc-ict1:8080 application/json{"ID":21140,"Description":"blah blah blah" "UpdateState":0} Server Side: procedure TAppoinmentResource.PostAppointment(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse); var jsonobj : TJSONObject; begin if ARequest.Body.TryGetObject(jsonobj) then begin // do something with the jsonobject end; end; Client Side procedure TPlannerRestClient.UpdateAppointment(const AAppointment: TPlannerAPIAppointment); var request : TRESTRequest; jsonstring : string; jsonobject : TJSONObject; begin request := NewRequest(resAppointment, TRESTRequestMethod.rmPOST); try request.ResourceSuffix := AAppointment.ID.ToString; // todo fix serialization TgoBsonSerializer.Serialize(AAppointment, jsonstring); jsonobject := TJSONObject.ParseJSONValue(jsonstring) as TJSONObject; request.ClearBody; request.AddBody(jsonobject); request.Execute; finally jsonobject.Free request.Free; end; end; Somebody a hint what i'm doing wrong?
  10. maybe this is usable: https://blog.grijjy.com/2018/02/28/javascripting-with-duktape-for-delphi/ (those guys write pretty good code)
  11. Look out with the TZipFile class, there is a bug which causes empty zips when it gets too large (or you insert very big files) i posted a bug a few years ago. (i go search if it's fixed) can not find it, but problem is that it did execute normally without raising an exception, but you end(ed) up with an empty zip file.
  12. So, where does this leave us? EMB did not test D10.4 on Vmware/HyperV guests? Or they did and just decided to bother us with this ?
  13. mvanrijnen

    Are we just "Cash Cows"?

    for a fact my first official programming classes where in COBOL 🙂 very long time ago.
  14. mvanrijnen

    Are we just "Cash Cows"?

    Not read the whole thread, but this is my opinion. Delphi comes to me as a product for which you pay full price (a lot more then VisualStudio), with less capabilities/tooling, but the most painfull, it seems/looks like it is being developed as a opensource project with some projectmanagers and a varying dev team. They really should sit on their customers seat for a while and get a new perspective on how to go forward with Delphi. It's a wonderful language with enough possibilities, would be a shame if we would have to go look around for another dev platform if quality does not improve. At the moment it;s not future proof.
  15. Hey guys, Installed D10.4 in a HyperV guest (Win10Pro, 16GBmem, 4 procs). We notice very slow Options dialogs now, takes more then 10seconds to open the Delphi->Tools->Options dialog, also the project options dialogs are very slow? More people with these complaints? Someone with a hint to better performance?
×