Jump to content

Lars Fosdal

Administrators
  • Content Count

    3362
  • Joined

  • Last visited

  • Days Won

    112

Everything posted by Lars Fosdal

  1. Lars Fosdal

    UK Remote Delphi Developer

    I think you need more detail to attract candidates.
  2. Lars Fosdal

    Watch me coding in Delphi on YouTube

    This is me
  3. Xiaomi maintain their own Android fork. Can that be a factor?
  4. Lars Fosdal

    REST api: too much data

    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.
  5. Lars Fosdal

    MSGraph and OAuth

    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;
  6. Lars Fosdal

    TControlList — need help!

    Or VS Code.
  7. Lars Fosdal

    Delphi app using Access database very slow on network drive.

    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?
  8. Lars Fosdal

    What happened to OmniThreadLibrary.com

    Last release was 7 months ago. https://github.com/gabr42/OmniThreadLibrary
  9. Lars Fosdal

    Essential Delphi Addins survey

    Done.
  10. @corneliusdavid The fewest new ones, or the fewest old ones? 😉
  11. None of them. Old bugs fixed. New bugs are added. Old bugs resurface. Repeat.
  12. Lars Fosdal

    My YouTube Channel - The Silver Coder

    @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!
  13. Lars Fosdal

    Is there a way to check is the "user Idle" (no interaction)

    @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
  14. @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.
  15. 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
  16. I find some of the EMBT marketing practices to be idiotic and unnecessary. They keep spamming me these offers for "upgrades" and "new licenses" with varying levels of price slashing, all year around. Don't they consider that I have been a subscriber for more than a decade, and that the offers only are valid for new licenses? The new releases and offers tend to bundle some third party tool or package that is underfunctional and overpriced, and where the license terms are a tad unclear after the year has passed. After being bought by Idera, it is often some other Idera purchased product that I have little interest in. I find the bundling practices to be inconsistant, to put it mildly. Not only do they do this directly, but the local representative also spam the same offers, over and over. According to the local representative - it is EMBT that do the spam on their behalf. Where is the reward for staying a long time paying customer? It is not like the maintenance is cheap, and it is not like I spam EMBT with support issues. As for support, I don't think I've every raised a support question apart from the annoying license counter bump requests. Ok, I am paying for new versions, updates, hotfixes, etc. - but to be honest, for many major versions now, the first xx.0 releases have of sub-par quality. We've had to wait at least for update 1, and a hotfix or two - before it was fit for use. About license management... Remember the Delphi .NET craze? It led us to purchase RAD Studio licenses to get a the new and shiny .NET stuff. That shit didn't last long, mostly due to MS not fully opening the door on third party .NET tools - but - when they were discontinued, we were still on RAD Studio Enterprise, when we really only need Delphi Enterprise. We have never used the C++ part of RAD Studio., but there is no way to downgrade a license, and it is still cheaper to keep the RAD Studio Enterprise maintenance, than to repurchase Delphi Enterprise licenses. So we stay on maintenance and keep hoping for Old problems to be fixed New platforms to be supported HighDPI to be done right Code performance to be improved RTL performance to be improved IDE to become stable and performant Debuggers that actually work in all scenarios Less immature and unfinished new libs and components Less pointless marketing offers because, warts and all, the tool is what we have become dependant on. Still hoping that it will change for the better... http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html
  17. The maintenance part does get you the upgrades, updates, hotfixes, some GetIt stuff for a year, though. And, renewing the maintenance deal is less costly than repurchasing.
  18. Lars Fosdal

    How to debug a Not Responding program element

    @Willicious A common challenge when updating UI components that have events of their own, is that setting values in the component, will trigger said events, which again trigger your event handlers, which then exec code that changes other UI elements. Do you take steps to ensure that you don't get a flurry of events between different parts of the UI and biz logic when you change data in the components?
  19. Lars Fosdal

    Delphi on Surface Pro with Qualcomm CPU?

    I am sure I would prefer a clean installation.
  20. Lars Fosdal

    Delphi on Surface Pro with Qualcomm CPU?

    Considering that Delphi runs fine under Windows for ARM in Parallells on MacOS, it is likely that it will run well on Windows for ARM without a VM layer as well.
  21. ... or change the type in the method: Add(const n: NativeInt);
  22. Lars Fosdal

    Stack Overflow Developer Survey for 2024

    Or Androids...
  23. Lars Fosdal

    Stack Overflow Developer Survey for 2024

    It is a pretty lousy Captcha, I'd say.
  24. Lars Fosdal

    XML File - I need a schema for this file

    From https://www.freeformatter.com/xsd-generator.html - "Salami Slice" design Does this look ok? <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="title"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute type="xs:string" name="lang" use="optional"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="content"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute type="xs:string" name="lang" use="optional"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="items"> <xs:complexType> <xs:sequence> <xs:element ref="title"/> <xs:element ref="content"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="name" type="xs:string"/> <xs:element name="posts"> <xs:complexType> <xs:sequence> <xs:element ref="items" maxOccurs="unbounded" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="author"> <xs:complexType> <xs:sequence> <xs:element ref="name"/> <xs:element ref="posts"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="authors"> <xs:complexType> <xs:sequence> <xs:element ref="author"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
×