Jump to content

dummzeuch

Members
  • Content Count

    2994
  • Joined

  • Last visited

  • Days Won

    107

Everything posted by dummzeuch

  1. dummzeuch

    Update an application automatically

    It's DxGettext. If I disable translations, renaming the file works with SysUtils.RenameFile, with the Explorer and also with the Rename command. Man wird alt wie 'ne Kuh und lernt immer noch dazu.
  2. dummzeuch

    Update an application automatically

    That's really odd. I just tried it because I couldn't believe it: VCL-Application with a form and a button b_Rename and the following code: procedure TRenameExeTest.b_RenameClick(Sender: TObject); begin RenameFile(Application.ExeName, Application.ExeName + '.old'); end; Works as expected or rather as not expected by me. Now I wonder why the Explorer and the Rename command cannot do this. Interestingly, after the program has renamed its own executable, it's possible to rename it back using the Explorer. And even more strange: This program can be renamed with the Explorer while its running. The one I tried first (last post with the screenshot) could not. I wonder what causes this. Maybe it's DxGettext that keeps the file open because it accesses the linked in translations? Or JclDebug accessing the jdbg information in the file?
  3. dummzeuch

    Update an application automatically

    Hm, neither Explorer nor the rename command on the commandline can rename an executable that is currently running, so I have so far assumed that's not possible.
  4. dummzeuch

    Error in module rtl200.bpl

    That's actually a good thing: It's easily reproducible. Are you using any plugins? If yes, disable them and try again. Does it still happen every time? If yes, it's the IDE and you probably can't do anything about it (apart from reporting this bug to Embarcadero, of course). If not, enable these plugins one by one and every time try it again. This should tell you which plugin is causing the trouble. In that case report the bug to the plugin maintainer.
  5. dummzeuch

    Update an application automatically

    Are you sure that is what it does? As far as I know only DLLs can be renamed while in use, but not EXEs (*1). (*1: Unless the EXE is located on a Samba-Sever share but then it can only renamed directly on the Unix/Linux box and if you do that it will come back to bite you.)
  6. I just spent some time testing ChatGPTs ability to "understand" and explain Delphi source code. The results were actually quite good. I asked ChatGPT "what’s wrong with the following Delphi code?" function IsoStringToDateTime(const ISODateTime: string): TDateTime; const ISOShortLen = 19; ISOFullLen = 23; var y, m, d, h, n, s, z: Word; begin // ISODateTime should be in one of these formats: // YYYY-MM-DDTHH:NN:SS, YYYY-MM-DD HH:NN:SS // YYYY-MM-DDTHH:NN:SS.ZZZ, YYYY-MM-DD HH:NN:SS.ZZZ if (Length(ISODateTime) <> ISOShortLen) and (Length(ISODateTime) <> ISOFullLen) then raise EConvertError.Create('Invalid ISO date time string: ' + ISODateTime); y := SysUtils.StrToInt(Copy(ISODateTime, 1, 4)); m := SysUtils.StrToInt(Copy(ISODateTime, 6, 2)); d := SysUtils.StrToInt(Copy(ISODateTime, 9, 2)); h := SysUtils.StrToInt(Copy(ISODateTime, 12, 2)); n := SysUtils.StrToInt(Copy(ISODateTime, 15, 2)); s := SysUtils.StrToInt(Copy(ISODateTime, 18, 2)); z := StrToIntDef(Copy(ISODateTime, 21, 3), 0); // Optional Result := EncodeDate(y, m, d) + EncodeTime(h, n, s, z); end; and also "What does the following Delphi function do?" function FileSizeToHumanReadableString(_FileSize: Int64): string; begin if _FileSize > 5 * OneExbiByte then Result := Format(_('%.2f EiB'), [_FileSize / OneExbiByte]) else if _FileSize > 5 * OnePebiByte then Result := Format(_('%.2f PiB'), [_FileSize / OnePebiByte]) else if _FileSize > 5 * OneTebiByte then Result := Format(_('%.2f TiB'), [_FileSize / OneTebiByte]) else if _FileSize > 5 * OneGibiByte then Result := Format(_('%.2f GiB'), [_FileSize / OneGibiByte]) else if _FileSize > 5 * OneMebiByte then Result := Format(_('%.2f MiB'), [_FileSize / OneMebiByte]) else if _FileSize > 5 * OneKibiByte then Result := Format(_('%.2f KiB'), [_FileSize / OneKibiByte]) else Result := Format(_('%d Bytes'), [_FileSize]); end; The answers will surprise you. And these were the shocking answers. The answers were actually quite interesting.
  7. Which only goes to show that the definition of "intelligence" is still very difficult, or at least is used very narrowly in the context of "artificial intelligence".
  8. You could aks ChagGPT to look for bugs in these. 😉
  9. I wasn't aware that I did that. Did I?
  10. I didn't expect it to perform that well, in particular the descriptions it gave for what those functions do. I found that interesting. These were simple tests where I knew the correct answers. It might be helpful in cases where I don't know the answers. Our possibly not. The code I'm usually dealing with is much more complex than a simple function. But you never know. Regardless of whether it will ever be helpful, I had some fun.
  11. It has been in the source code for quite a while and some few people and I have tested it, but I didn’t tell anybody else about it: There is a new expert in GExperts for editing the current project’s unit search path. It looks like this: (read on in the blog post)
  12. dummzeuch

    Need help testing a GExperts bugfix

    I have just applied patches that are supposed to fix some Unicode issues with Russian characters. These apply to the following experts: Macro Template Locate/ Move to matching delimiter Previous / Next Identifier reference My tests so far have shown no changes on how these work on my source code, but I usually don’t use any special Unicode characters and in particular no Russian characters. So if you want to help out, whether or not you are using Unicode characters anywhere (for identifiers or within strings or comments) and especially Russian characters, please compile a new DLL from the current source code an test whether anything has been broken (or fixed). (Original blog post with links)
  13. It not merely compiles but works as expected.
  14. Hm, you declared K and V as class. An oversight? Changing this to TObjectDictionaryWithDuplicateObjects<K; V:class> (semicolon instead of comma) made it work (or rather compile) for me.
  15. I'll try that dictionary + object list approach tomorrow. It's actually much neater than the sorted object list I was thinking about, and should also perform better, but that's not a real concern as I expect only a few dozen entries for the current need. But on the other hand, I'll probably start using this in a lot of other cases in the future.
  16. Hm, shouldn't freeing the dictionary automatically free the object lists stored in it, which would then in turn free the objects stored in those? So there should be no need for the MyFreeObjectsFromList procedure, or am I overlooking something?
  17. You're still miffed, apparently.
  18. dummzeuch

    What are the correct settings for "Code inlining control"?

    You might want to turn inlining on for debug builds if what you are trying to debug might be releated to inlining. But in most cases I would also turn it off because it is really annoying if you can't step into a function because it was inlined.
  19. dummzeuch

    Select multiples lines at once

    I just tried it in Delphi 10.2: I can only rename identifiers, it doesn't work for any other text or even special characters. But even with this limitation it is useful. And I know now, why I haven't used it: It's available since Delphi 2010 and until a while ago I was using Delphi 2007 for most projects.
  20. dummzeuch

    Select multiples lines at once

    I didn't even know it has a keyboard shortcut. I have never used it.
  21. dummzeuch

    Select multiples lines at once

    I'm sure I saw a similar functionality demonstrated in the Delphi IDE. Was it called SyncEdit? https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Sync_Edit_Mode_(Delphi,_C++) An older version of the documentation links to a video: But that's only for identifiers, not for generic text.
  22. dummzeuch

    Select multiples lines at once

    GExperts does not have this functionality.
  23. dummzeuch

    Does ChatAI make StackOverflow obsolete ?

    Sorry, I couldn't resist letting ChatGPT write a reply to this: (I'll try to resist in the future though because I don't want this to escalate into a thread that consists of ChatGPT generated stuff only.)
  24. dummzeuch

    Delphi 11.2 unofficial LSP patch

    And those command line compilers do not use the dccxxxx.dll files?
  25. dummzeuch

    Delphi 11.2 unofficial LSP patch

    What they mean is "Don't use a patched IDE to produce anything (DLL, Exe, DCUs, BPLs whatever) that's going to be used in production".
×