Jump to content

Sherlock

Moderators
  • Content Count

    1245
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by Sherlock

  1. Sherlock

    Delphi 11.3 is available now!

    In the release notes: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Release_Notes#Launching_iOS_fails_with_PAServer_22
  2. Sherlock

    Delphi 11.3 is available now!

    Switching between VMs is not that arduous... What gets to me right now is that my GetIt batch file wont work. I get either or What gives? Now I have to install everything by hand again, along with the really tedious IDE restarting....
  3. Sherlock

    Delphi 11.3 is available now!

    It is sad to see, that PAServer on macOS still requires Python 2.7. Firstly because the guys over on the Python side always claimed breaking changes between the 2 and 3 branches where no biggie and secondly because even though they are they are fixable...
  4. So I've been digging into some component codes just for the heck of it, and stumbled across a whole lot of code like the following snippet: procedure Foo; var Bar: PArrayOfByte; begin // Do some more or less elaborate thing with Bar // and in the end FreeAndNil(Bar); end; Now, first off, that is not how I had understood FreeAndNil. I always thought it to be usable for object instances. Of course one could argue, that whatever is behind a pointer could be an object itself, but I mean some thingy that was created via a TObject.Create. And sure enough, Delphi 10.4 will no longer compile stunts like these. It will give an E2010 and bluntly state that TObject and PArrayOfByte are not compatible. And rightly so. So...What to do? How to fix? Given that (in the above crude example) Bar must have been allocated memory via System.GetMem or System.New, System.FreeMem or Sysem.Dispose will do the trick, right? Why was this not done in the first place, though? Why mix paradigms at the risk of creating some unholy entity mucking up the entire system? Perhaps looking into FreeAndNil will enlighten us? This is 10.3.1s take on that method: procedure FreeAndNil(var Obj); {$IF not Defined(AUTOREFCOUNT)} var Temp: TObject; begin Temp := TObject(Obj); Pointer(Obj) := nil; Temp.Free; end; {$ELSE} begin TObject(Obj) := nil; end; {$ENDIF} And here is what 10.4 considers to be correct: procedure FreeAndNil(const [ref] Obj: TObject); {$IF not Defined(AUTOREFCOUNT)} var Temp: TObject; begin Temp := Obj; TObject(Pointer(@Obj)^) := nil; Temp.Free; end; {$ELSE} begin Obj := nil; end; {$ENDIF} Subtle, innit? Now FreeAndNil requires the thing it's supposed to free and nil to be of TObject, which is cool. But it also considers it to be const...why is that? I learned const renders the parameter unmodifiable, see here: http://docwiki.embarcadero.com/RADStudio/Rio/en/Parameters_(Delphi)#Constant_Parameters. I also took a wrong turn somewhere and ended up in this C++ explantion of const http://docwiki.embarcadero.com/RADStudio/Rio/en/Const in detail this sentence: "A const pointer cannot be modified, though the object to which it points can be changed." OK, so we can change the object, we are freeing it after all. But then we also change where the pointer points to, by niling it. Now that should violate the const boundary, but it does not. Is it because of the "fancy shmancy" use of @s and ^s here? TObject(Pointer(@Obj)^) := nil; Why? Why go to the lenghts of casting, adressing and dereferencing? What are your thoughts and comments on this? I think this almost cured my urge to look into the sources of other people 🤣
  5. Sherlock

    Error when iOS application building in Delphi 11.2

    Just to mention another service: https://www.macincloud.com/
  6. @programmerdelphi2k I don't have a problem, what problem are you talking about? You had better either respond using quotes or address the person you would like to respond to directly. But posts like yours might very well lead to further misunderstandings.
  7. Sherlock

    Must have multiple var sections

    The var goes before the begin. procedure TfDesignMaster.PopulatePdlNotesWithValuePack(Sender: TObject); var stocknummm,value,value1,value2,keyfields, fieldname: string; F: TField; i: integer; lresult: boolean; fn: TStringList; sl: TStringList; begin fn:=tstringlist.create; sl:=tstringlist.create; Surprisingly the DocWiki does not clarify this: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Variables_(Delphi) at least on that page.
  8. The issue I have with the (not so new) browser approach is as follows: It promotes a browser monoculture. A little bit over 10 years ago IE was a must have in the corporate world, because all the renowned applications would run on it, and only it. No other browsers could be used, and therefore as soon as somebody wanted to browse the internet, in some companies they where forced to use IE, resulting in catastrophic security issues, because MS got lazy and complacent in their browser development. Everybody that counted needed it, and anybody that didn't like it didn't count. But this got so far that the fine people who developed browser based applications got just as lazy and complacent ("learning from MS means winning" and so forth), resulting in even worse applications, that only ran on specific IE versions. It was then that responsible IT departments had to allow the installation of other browsers, if only to allow for safe browsing. IE was the biggest target for malware by far.... I have taken a lunch break and noticed I drifted off. So let me get back to the point. The only good reason for browser based applications is the zero install "feature". I admit, that is a tough one, for the usual Java, .net crowd what with their frameworks and version jungle and so forth. But for us Delphians? Come on! As I always say: monolithic applications rule! No need to install pesky frameworks, DLLs or other version dependent nuisance, just run it from a network share. As for the current browser high. Do they really check if their applications work with all browsers in all OSes? Short answer is "No" which leads us to monoculture with all the bad things that entails.
  9. Sherlock

    Delphi 11.2 unofficial LSP patch

    Well, being the best it has ever been does not really mean it will be great. It simply means it wont be as bad as it is now.
  10. Sherlock

    Update an application automatically

    Ugh, don't you just hate it when that happens?
  11. Sherlock

    Update an application automatically

    Is that still a valid deterrent?
  12. Sherlock

    Puzzled by StrToDate

    I could readily accept such a statement for VCL, but still FMX tends to change a lot. Less than in the XE versions of Delphi but still.
  13. Sherlock

    Need a "Delphi programming guideline"

    I hope your customers only use one version, i.e. no custom tailored versions. Furthermore I hope your boss or whoever is responsible knows every single feature, no matter how small. Because customers can get really "special" when something no longer works as expected, just because of a new version, especially one they have to pay for - assuming the rewrite will not be for free.
  14. Hmm almost sounds like a job for TWriter.WriteString which writes to a TStream. If you don't want it to be a file, it could be a TStringStream.
  15. Too much has happened with links that lead to previously unknown sites. Bear with us, we'll learn to trust each other soon enough.
  16. @pouyafarThanks for that! And the tables would contain function names with some explanations, correct?
  17. Those links seem quite harmless. It's just two sites translated from persian to english. Second link is pouyafars blog and the first is a forum. I don't see the immediate need to act. And translate.goog belongs to google.
  18. The common link is clear but the evolution of use and meaning is just baffling to me.
  19. ROFL....sorry, but in german "gammel" means "rotten". This is just too funny how related and then again not our languages are.
  20. Sherlock

    IsValidDate fails after the Year 9999

    To elaborate on this correct and concise answer: One should only fix things that a really broken or occur during the life cycle of the software. You simply cannot think of all eventualities - one of them being: will there still be a Delphi compiler in the year 9999? If not, how can I make sure that my code can still be compiled? Are we all gonna die? OMG! Panic! Enter into catatonic state now. To use popular acronyms: This is both YAGNI and KISS.
  21. So I finally tried it myself, inspired by a fairly new SO question. Me: Using the Delphi language, explain how to turn a large image into many smaller ones and tile them My follow up question then crashed the thing: How can I make sure only the tiles visible on the screen will be painted? ☠️ Then I tried the same question again, hoping a different follow up would not crash... It came up with a different answer: Well that looked easy enough but: Me: The source should be assumed to be 40000 by 40000 pixels Thanks for that piece of well known information...why do you think I wanted to split the thing in the first place? So... Me: Well the splitting part you have done, but assume the source is a 40000 by 40000 PNG Eagle eyed I spot the issue at once (never minding the snippet is unfinished): Me: that is to large for a TBitmap OK, that looks nice, with one slight snag in the middle part: Me: Width and Height are ReadOnly for a TPNGImage. That got it to thinking quite bit, and it started to write something in the likes of "Yes, you are right, and here is how to get around that". Started to put together some code and crashed again... Oh, well. I guess it is not ready for my stupid questions. 🕵️‍♂️
  22. Sherlock

    How convert an android app into an i-phone app?

    Please also note that any "custom" Java snippets or Android specific code will not migrate without making a fuss.
  23. Sherlock

    IEC 62304 Medical software standard

    Only if and when Sennheiser chooses to call them hearing aids themselves, but then they might get questions from other folks too. So I'm sure they will avoid using the term wherever they can....at least until they have all the necessary documentation. I mean 849 bucks is a steep price for ear buds, but quite competitive for mid-level hearing aids.
  24. Well then have fun with this: https://www.123cloud.st/p/chatgpt-tackles-xkcds-what-if
  25. It would probably use "old norse".
×