Der schöne Günther
Members-
Content Count
691 -
Joined
-
Last visited
-
Days Won
12
Everything posted by Der schöne Günther
-
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
-
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.
-
Cast an array of numbers to array of bytes without re-allocating
Der schöne Günther posted a topic in Algorithms, Data Structures and Class Design
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(..). -
Cast an array of numbers to array of bytes without re-allocating
Der schöne Günther replied to Der schöne Günther's topic in Algorithms, Data Structures and Class Design
Of course. That's what unit tests are for 😎 True. Or, even better and less c-like, IEnumerable<Byte> -
Cast an array of numbers to array of bytes without re-allocating
Der schöne Günther replied to Der schöne Günther's topic in Algorithms, Data Structures and Class Design
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. -
Cast an array of numbers to array of bytes without re-allocating
Der schöne Günther replied to Der schöne Günther's topic in Algorithms, Data Structures and Class Design
No, using the absolute variable does not increase the array's reference count. See this snippet: Project1.dpr · GitHub -
Cast an array of numbers to array of bytes without re-allocating
Der schöne Günther replied to Der schöne Günther's topic in Algorithms, Data Structures and Class Design
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) -
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.
-
Does anyone know how to get the filesystem for usb mass storage?
Der schöne Günther replied to wilsonning's topic in FMX
Since he/he said "FMX" and an posted an Android screenshot, I think a "Windows only" solution will not help. -
Strange Benchmark Results; Am I Missing Something?
Der schöne Günther replied to Joseph MItzen's topic in I made this
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. -
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?
-
Where did you get a 12 year old .NET 4.0 from?
-
What is good replacement for FastReports?
Der schöne Günther replied to GreatDayDan's topic in General Help
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? -
I am still logged in, and it works for me.
-
Get memory used by a Memtable record??
Der schöne Günther replied to Ian Branch's topic in General Help
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. -
Get memory used by a Memtable record??
Der schöne Günther replied to Ian Branch's topic in General Help
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. -
DPROJ changes: SourceTree vs Beyond Compare
Der schöne Günther replied to Mike Torrettinni's topic in General Help
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. -
Requests to local api very slow with TRESTClient
Der schöne Günther replied to Karbot's topic in Network, Cloud and Web
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. -
Analyze strings for common parts
Der schöne Günther replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
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. -
DocWiki.Embarcadero.com does Russian Roulette.
Der schöne Günther replied to A.M. Hoornweg's topic in General Help
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? -
The WebView2 runtime is already included in Windows 11. Can you reproduce your issue in a clean VM?
-
Good question. The title page states but that's listed under FMX. Does it apply to VCL as well?
-
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.
-
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?
-
simple SFTP-like server for Windows?
Der schöne Günther replied to David Schwartz's topic in General Help
Only the Typescript version, not the Delphi one, unfortunately.