-
Content Count
3362 -
Joined
-
Last visited
-
Days Won
112
Lars Fosdal last won the day on July 18
Lars Fosdal had the most liked content!
Community Reputation
1764 ExcellentTechnical Information
-
Delphi-Version
Delphi 12 Athens
Recent Profile Visitors
-
UK Remote Delphi Developer
Lars Fosdal replied to NESHE's topic in Job Opportunities / Coder for Hire
I think you need more detail to attract candidates. -
Watch me coding in Delphi on YouTube
Lars Fosdal replied to silvercoder79's topic in Tips / Blogs / Tutorials / Videos
This is me -
RAD Studio does not recognize an Android device like Xiaomi Mi Max 3.
Lars Fosdal replied to dmitrybv's topic in Cross-platform
Xiaomi maintain their own Android fork. Can that be a factor? -
Do you get a monolithic collection of json elements for the entire day, or do they arrive one by one? If monolithic, you could split it up and add each element to a queue. Is there a sequence of processing requirement? If not, you could have multiple parallell consumers of that queue.
-
Found a description of "Invalid audience"-here https://stackoverflow.com/questions/75228773/access-token-validation-failure-invalid-audience-office-365-graph-api Spelunked and found this, but haven't tried it myself https://github.com/jfbilodeau/AzureRESTExample There also is this thread, but I am uncertain if it came to conclusion? OAuth2 isn't really a standard, but a guideline, and there can be fickle differences between implementations. I successfully do OAuth2 authentication to our ERP systems, using System.Net.HTTPClient THTTPClient, and simulating a form post. I couldn't get the REST OAuth component to work. In the source below, TRes is a TObject containing the properties of the expected response body from the authentication - which should contain your tokens. function TIONAPI.BuildStringStream(const NameValues: TNetHeaders): TStringStream; var Encoded, Sep : string; begin Sep := ''; Encoded := ''; for var item in NameValues do begin Encoded := Encoded + Sep + Item.Name + '=' + Encoder.EncodeForm(Item.Value); Sep := '&'; end; Result := TStringStream.Create(UTF8String(Encoded)); end; function TIONAPI.PostForm<TRes>(const aURL: string; const aFormFields: TNetHeaders; aExpectsResult: Boolean): TRes; var HTTPRequest: IHttpRequest; HttpResponse: IHttpResponse; ReqBody: TStringStream; ResStatus: Integer; ResContent: string; ReqHeaders: TNetHeaders; T: TStopWatch; begin Result := nil; ResStatus := 0; ReqBody := nil; FLastStatus := 0; FLastErrorMsg := ''; try try DebugOut(Format('HTTP %s %s', ['POST', aURL])); // DO NOT TRANSLATE try HTTPRequest := HTTP.GetRequest('POST', aURL); HTTPRequest.RemoveHeader('User-Agent'); HTTPRequest.SetCredential(IONCredentials.ResourceOwnerClientId, IONCredentials.ResourceOwnerClientSecret); ReqBody := BuildStringStream(aFormFields); HttpRequest.SourceStream := ReqBody; ReqHeaders := [ TNetHeader.Create('content-type', mime.ApplicationXwwwForm), // DO NOT TRANSLATE TNetHeader.Create('Expect', '100-continue') // DO NOT TRANSLATE // TNetHeader.Create('User-Agent', UserAgent); // DO NOT TRANSLATE ]; HTTP.PreemptiveAuthentication := True; T := TStopWatch.StartNew; HttpResponse := HTTP.Execute(HTTPRequest, nil, ReqHeaders); T.Stop; DebugOut('Status: ' + ResStatus.ToString + ' in ' + T.ElapsedMilliseconds.ToString+ ' ms'); if Assigned(HttpResponse) then begin ResStatus := HttpResponse.StatusCode; ResContent := HttpResponse.ContentAsString(TEncoding.UTF8); if (ResStatus = 200) then begin try T := TStopWatch.StartNew; Result := TJson.JsonToObject<TRes>(ResContent); except on E: Exception do begin DebugOutException(E, Format('TIONAPI.PostForm.%s<%s, %s> returned StatusCode: %d - but failed during conversion of "%s"', // DO NOT TRANSLATE [aURL, '', Result.ClassName, ResStatus, ResContent])); ResStatus := HTTPStatus.ExpectationFailed417; Result := nil; FLastErrorMsg := E.Message; end; end; end else begin Result := nil; end; end else begin ResStatus := HTTPStatus.NoResponse; ResContent := ''; Result := nil; end; except // Json Exception on E:Exception do begin DebugOutException(E); ResStatus := HTTPStatus.ExpectationFailed417; end; end; finally // DebugOut('Status: ' + ResStatus.ToString); ReqBody.Free; end; except // HTTP Exception on E: Exception do begin FLastStatus := ResStatus; FLastErrorMsg := E.Message; DebugOutException(E, Self.ClassName + '.PostForm'); // DO NOT TRANSLATE end; end; end;
-
Delphi app using Access database very slow on network drive.
Lars Fosdal replied to Jean-Michel Gaudette's topic in Databases
Single user or multi user? Named share? Long path/file names? Antivirus changes? DNS changes? Security changes? Do you which calls that are slow? Have you tried System Monitor to look for errors? -
Last release was 7 months ago. https://github.com/gabr42/OmniThreadLibrary
-
Done.
-
What version of Delphi has the least amount of bugs throughout history?
Lars Fosdal replied to Al T's topic in Delphi IDE and APIs
@corneliusdavid The fewest new ones, or the fewest old ones? 😉 -
What version of Delphi has the least amount of bugs throughout history?
Lars Fosdal replied to Al T's topic in Delphi IDE and APIs
None of them. Old bugs fixed. New bugs are added. Old bugs resurface. Repeat. -
My YouTube Channel - The Silver Coder
Lars Fosdal replied to silvercoder79's topic in Tips / Blogs / Tutorials / Videos
@silvercoder79 Hi Tim! I think it is great that you share your experiences with our favorite language! There seems to be a small influx of new faces at the moment, so the better an education they can have, the better it is for the community! -
Is there a way to check is the "user Idle" (no interaction)
Lars Fosdal replied to Tommi Prami's topic in Windows API
@Tommi Prami - So, do you want to have your app do something, when the PC signals that there has been no keyboard or mouse events for a while? Do you want to track that yourself, or are you looking for a system event? https://stackoverflow.com/questions/2212823/how-to-detect-inactive-user https://stackoverflow.com/questions/2177513/receive-screensaver-notification -
RESTClient.OnNeedClientCertificate event does not execute
Lars Fosdal replied to Leszek's topic in Network, Cloud and Web
@Leszek Ref. your report - unless the context/conditions are identical, it is always wise to start a new topic instead of adding your question to an existing topic. I split off this question for you, as it seems to be a different problem. -
Convert inconsistent line ending when pasting clipboard from Google colab
Lars Fosdal replied to Wivona's topic in VCL
So, you copy text from outside the Delphi app, and when you paste it into your TMemo, it is LF and not CRLF? What is your TMemo.Lines.LineBreak set to? An alternative would be to intercept the paste and use https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.SysUtils.AdjustLineBreaks