Jump to content

Der schöne Günther

Members
  • Content Count

    691
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by Der schöne Günther

  1. Der schöne Günther

    DUnitX and StackTraces

    Don't want to be a party pooper, but I never saw the reason for having detailed stack traces. Tests should fail for exactly one reason. If you have a bunch of entirely different checks in your test case and struggle to find out what exactly failed, there's something wrong. Better split them up in seperate tests. I am still on DUnit and have never really used DUnitX, but can't you debug a test? That should easily tell you what, and where something is going wrong. The fabulous "Test Insight" plugin from Stefan allows you to directly debug the test at your cursor position with [Alt]+[F9] sglienke / TestInsight / wiki / Home — Bitbucket
  2. Der schöne Günther

    Overloads in implementation

    The reason is that function GetDay(dt: TDateTime) doesn't yet know about the other overload. You either have to replace their order or, better, add a definition like you did when you added their definition in the interface section of the unit.
  3. I have some API that allocates and returns a TArray<Word>. I would then like to process this array with a library that operates exclusively on TArray<Byte>. How can I cast my_word_array to my_byte_array without re-allocating space for a new array and then copying the entire content over? My only idea so far was a clunky workaround using the absolute directive and manually overwriting the array's length indicator in memory: procedure changeLengthIndicator(const firstElement; const newLength: NativeInt); var ptr: PNativeInt; begin // Source regarding memory layout: // https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Internal_Data_Formats_(Delphi)#Dynamic_Array_Types ptr := Addr(firstElement); Dec(ptr); //set pointer to length indicator ptr^ := newLength; end; procedure p(); var words: TArray<Word>; bytes: TArray<Byte> absolute words; byteCount: NativeInt; begin words := [$0FF0, $FEFE, $0000, $0001, $ABAB]; byteCount := Length(words) * SizeOf(Word); changeLengthIndicator(bytes[0], byteCount); processBytes(bytes); end; Is there a better option? Unfortunately, there is no making sure no one will use the words array after the call to changeLengthIndicator(..).
  4. Of course. That's what unit tests are for 😎 True. Or, even better and less c-like, IEnumerable<Byte>
  5. That's actually an interesting idea. It will store if it's in "byte" or "word" mode, and if you're trying to get the "wrong" data, it will instead throw a runtime exception. That's certainly better than what I have right now.
  6. No, using the absolute variable does not increase the array's reference count. See this snippet: Project1.dpr · GitHub
  7. It will overwrite the second half of the existing data with zeroes because it considers it "newly allocated" System.SetLength - RAD Studio API Documentation (embarcadero.com)
  8. Der schöne Günther

    Is TEdit bugged with mobile? Since when?

    That does not sound typical at all. I don't know about Android, but on iOS you can either scroll by swiping on the space key, or by tap and holding within the text area. It is not a problem at all.
  9. Der schöne Günther

    Does anyone know how to get the filesystem for usb mass storage?

    Since he/he said "FMX" and an posted an Android screenshot, I think a "Windows only" solution will not help.
  10. Der schöne Günther

    Strange Benchmark Results; Am I Missing Something?

    Just for your information, the following snippet in Rust was around 1250 ms on my system. Compilation about 1 second. fn main() { let mut total: u64 = 0; for number in 1..=1000000000 { if ((number % 3) == 0) || ((number % 5) == 0) { total += number; }; } println!("total is {}", total); } The Delphi implementation was around 7.5 seconds on this machine.
  11. Der schöne Günther

    INI problem

    Doesn't TIniFile fall back to some extremely ancient Windows methods? I would have expected an encoding problem with your text file. Can you provide the original .ini file?
  12. Der schöne Günther

    .NET kill the Delphi IDE

    Where did you get a 12 year old .NET 4.0 from?
  13. Der schöne Günther

    What is good replacement for FastReports?

    We are using FastReport and have no plans to change it, but FortesReport seems interesting, I have never heard of it before. Github links to their homepage www.fortesreport.com.br which simply doesn't exist. Does anybody have more information?
  14. Der schöne Günther

    quality.embarcadero.com not working?

    I am still logged in, and it works for me.
  15. Der schöne Günther

    Get memory used by a Memtable record??

    I don't think comparing "memory usage before" and "memory usage after" in a release build is going to yield anything useful. There might be a lot of other things going on in separate threads.
  16. Der schöne Günther

    Get memory used by a Memtable record??

    I had the same question a few years back. The TClientDataSet had a somewhat plausible DataSize property, but the FireDAC memory table had no such thing. A rather desperate approach would be saving the entire memory table into a stream and then determining the stream size which is rather silly and does not necessarily reflect how much the data actually takes up in your memory.
  17. Der schöne Günther

    DPROJ changes: SourceTree vs Beyond Compare

    It's just a text file. My guess is that either the file encoding or line breaks have changed. If you can provide a file "before" and "after", I'm sure we can find what's up. I don't know about SourceTree, but diff editors often have an option whether line breaks or whitespace changes should be taken into account.
  18. Der schöne Günther

    Requests to local api very slow with TRESTClient

    I remember also having this! localhost first ran into a 2000 ms timeout, but 127.0.0.1 was normal. After we made our local server listen for ipv6 connections as well, that timeout was gone.
  19. Der schöne Günther

    Analyze strings for common parts

    You are looking for regular expressions. I would like to point you to Delphis documentation, but it has been offline for weeks now. Everything you need is in the unit System.RegularExpressions.
  20. Der schöne Günther

    DocWiki.Embarcadero.com does Russian Roulette.

    If this was some kind of individual and super complex system that is has integrations with a dozen other systems, I'd probably understand. But this is just a wiki! How difficult could it possibly be?
  21. Der schöne Günther

    TEdgeBrowser Stopped Working

    The WebView2 runtime is already included in Windows 11. Can you reproduce your issue in a clean VM?
  22. Der schöne Günther

    ANN: Skia4Delphi v3.0.2

    Good question. The title page states but that's listed under FMX. Does it apply to VCL as well?
  23. Der schöne Günther

    Skia4Delphi v3.0.0

    Your documentation is outstanding. Very interesting to read, pictures, and shows how to get started, step by step. Clearly some effort was put into this. Many libraries often make it very hard to get started.
  24. Der schöne Günther

    PC-specific memory corruption...?

    How do you actually detect that something has now gone wrong? Some component (like a DBGrid) displays a TDataSet that contains gobbledegook? Or is there more to detect it? How do you know it's memory corruption (like writing out of bounds), and not generally using a stale pointer? Have you tried compiling the application with a memory manager like full FastMM and enabled runtime checks?
  25. Der schöne Günther

    simple SFTP-like server for Windows?

    Only the Typescript version, not the Delphi one, unfortunately.
×