Jump to content

Lars Fosdal

Administrators
  • Content Count

    3298
  • Joined

  • Last visited

  • Days Won

    110

Everything posted by Lars Fosdal

  1. Lars Fosdal

    Parameter passing

    Which language Which version Which class is SslHttpRest, and from which unit? If you use System.Net.HttpClient (which I use, because getting the REST classes to work with various flavours of OAuth2 turned out to be a challenge), you can do it something like this (code is not complete 😞 var HTTPRequest: IHttpRequest; // from System.Net.HttpClient HttpResponse: IHttpResponse; // System.Net.HttpClient ReqHeaders: TNetHeaders; // System.Net.URLClient URL: String; begin try try try HTTPRequest := HTTP.GetRequest('GET', URL); ReqHeaders := [ TNetHeader.Create('Content-Type', 'application/json'), TNetHeader.Create('Content-Length, ''), TNetHeader.Create('Store-Token', '22345673301244567896663456789012'), TNetHeader.Create('User-Agent', 'PostmanRuntime/7.37.3'), TNetHeader.Create('Accept', '*/*'), TNetHeader.Create('Postman-Token', '40f28212-2f71-487a-a22f-d6ecdfa61b8b'), TNetHeader.Create('Host', 'localhost:8080'), TNetHeader.Create('Accept-Encoding', 'gzip, deflate, br'), TNetHeader.Create('Connection', 'keep-alive') ]; HttpResponse := HTTP.Execute(HTTPRequest,nil, ReqHeaders); // HTTP is THTTPClient from System.Net.HttpClient ...
  2. If the date doesn't follow spec, do you really want to attempt to import it?
  3. Lars Fosdal

    RAD Studio 12.1 Athens Patch 1 Available

    RSS-425 doesn't open for me either. It could be that the reporter chose to NOT share the report with the Embarcadero Customer group.
  4. Lars Fosdal

    Delphi Low-code No-code?

    If you are a corporate developer, the money for tools are peanuts compare to other costs.
  5. Lars Fosdal

    Delphi and "Use only memory safe languages"

    Can we stay on the topic, please? Are there any practical languages that are applicable to writing the same variety of solutions as Delphi, that are actually memory safe? Even if you manage your memory in Delphi, it is not hard to get corrupted data due to a dangling or misdirected pointer, even in Delphi.
  6. Lars Fosdal

    TListview and TImage Pixalated Image

    Sometimes, when entering new areas of knowledge, you might not even know what to expect. Hence, a guiding hand can go a long way. Most people appreciate those that offer help without conditions.
  7. Did you use the offline installer or the web installer? If you used the offline installer, please see: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Release_Notes.
  8. Lars Fosdal

    TListview and TImage Pixalated Image

    IMO, that was not very helpful. If you are a new user, you may need to be guided on how to do it right, not just be told that you are doing it wrong.
  9. Vote here Native ARM64 compiler for Windows for ARM https://quality.embarcadero.com/browse/RSP-38298 Context: https://www.theverge.com/2022/5/24/23139475/microsoft-visual-studio-2022-native-arm-vs-code
  10. Lars Fosdal

    Alexandria 11.3 and Android 13 (part 2)

    Irrelevant content removed.
  11. There also is https://docwiki.embarcadero.com/Libraries/Sydney/en/System.TypInfo.GetEnumProp which returns a PPropInfo, which again contains a PropType: PPTypeInfo, which you then can use with GetEnumValue?
  12. What if you treat every value as a generic type? That way you are free to use TypeInfo? procedure TParam<T>.SetAsString(const aValue: string); var TV: TValue; begin TV := TValue.From<T>(Default(T)); try case TV.Kind of tkEnumeration: TV := TValue.FromOrdinal(TypeInfo(T), GetEnumValue(TypeInfo(T), aValue)); tkInteger: TV := TValue.From<Integer>(StrToInt(aValue)); tkInt64: TV := TValue.From<Int64>(StrToInt(aValue)); tkFloat: TV := TValue.From<Extended>(StrToFloat(aValue)); else TV := TValue.From<String>(aValue); end; FValue := TV.AsType<T>; except on E:Exception do begin CmdDebugOut(Parent.Debug + ': "' + aValue + '" -> ' + E.Message); FValue := Default(T); end; end; end; function TParam<T>.GetAsString: string; var TV: TValue; begin TV := TValue.From<T>(FValue); Result := TV.AsString; end;
  13. @msohn - I don't usually spend much time in the text format .dfm.
  14. I should simply stop posting without actually checking shit... object Label1: TLabel Left = 303 Top = 233 Width = 99 Height = 15 Caption = 'Text'#32'Textï»żï»żï»ż' end does however, work correctly. Edit But if you actually edited the dfm text and put in that #32, then view as form, and back to view as text - it has been converted to 'Text Text'. As @Lajos JuhĂĄszpoints out - Unicode text that is entered in the form attribute editor, will translate to #1234 values.
  15. You can't really declare strings in .dfms as 'Text'#32'Text', can you? If you set a caption or label in a dfm from such a string in code, yes you'd be affected.
  16. The problem even shows up in the IDE. and the cure is the same as for compiled code
  17. Lars Fosdal

    New desktop FMX app - third party controls?

    What kind of license is it published under?
  18. Lars Fosdal

    Delphi and "Use only memory safe languages"

    Ref := ItemProvider.Grab(ItemId); // or Ref := ItemProvider.GrabForChange(ItemId); try // do stuff finally ItemProvider.Drop(Ref); end; ItemProvider can do the allocation and loading, as well as the disposal. If there is parallell use, it can secure against readers/other writers, have a keep-alive in cache period, etc. In theory, with the "smart pointer" trick, you could even do away with the try/finally.
  19. Lars Fosdal

    Delphi and "Use only memory safe languages"

    That is not what I intended to say. I was wondering if someone had tried to apply LLM for finding even better patterns for optimization than those that are currently implemented. Naturally, such improved patterns would be made into new deterministic rules in the compiler after being properly vetted. I agree that todays AI output has to be treated as indicative at best, and as bullshit at worst.
  20. Lars Fosdal

    Delphi and "Use only memory safe languages"

    Request/Release Which is to be expected, I guess, since the training was not done with optimization in mind.
  21. Lars Fosdal

    Delphi and "Use only memory safe languages"

    None of the techniques described in that paper appear to be related to the LLM generation of AIs.
  22. Lars Fosdal

    Delphi and "Use only memory safe languages"

    Hasn't this already been demonstrated with "smart pointers"?
  23. Lars Fosdal

    Delphi and "Use only memory safe languages"

    I wonder if anyone has tried to train an LLM on Assembly code generation to see if it could improve the current optimization patterns?
  24. You are probably right, only some operators might be new/different (ARM f.x.). Book: https://www.amazon.com/Hackers-Delight-2nd-Henry-Warren/dp/0321842685
  25. I am afraid so, even if it probably is somewhat outdated by now, in the light of new CPUs.
×