Jump to content

Sherlock

Moderators
  • Content Count

    1245
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by Sherlock

  1. I wonder what Embarcadero would call a procedure with a return type... Has anyone created a ticket yet?
  2. It's a shame this thread slipped into a gender debate unnoticed. Sorry about that. BTT: https://meta.stackexchange.com/questions/390106/moderation-strike-update-data-dumps-choosing-representatives-gpt-data-and-wh
  3. Sherlock

    Trouble with testing dates

    As the title says, I'm having trouble with running a unit test to test dates. So here is my test: [TestFixture] TMyTestClass = class public [Test] // Test with TestCase Attribute to supply parameters. [Test] [TestCase('Test Thu-Sat', '2023-06-22 17:44:23.456, 2023-06-24 17:44:23.456, 0')] [TestCase('Test Thu-Sun', '2023-06-22 17:44:23.456, 2023-06-25 17:44:23.456, 1')] procedure Test(const AValue1: TDateTime; const AValue2: TDateTime; const AExp: Integer); end; procedure TMyTestClass.Test(const AValue1, AValue2: TDateTime; const AExp: Integer); begin Assert.IsTrue(Unit34.CheckForDates(AValue1, AValue2) = AExp); end; Now when I run this it alwas behaves as though the dates are not translated correctly. And sure enough the debugger says both AValues are 1899. When I run DUnitXs own Test - specifically the DUnitX.Tests.Example.pas the date there gets translated just fine. And the keen eye might notice the same time in my code as in DUnitXs...I copied and only changed the date. What am I doing wrong?
  4. Sherlock

    Trouble with testing dates

    Not to be "that guy" but, um... it would seem my initial dates where indeed ISO 8601 formatted. So my guess now is that the DUnitX used in D11.3 is more than two years old?
  5. Sherlock

    Trouble with testing dates

    OK, so it's a locale settings issue. Apparently the DUnitX tests do something to the date format, that catch this. As soon as I use my native german date format, it works. Hrmpf [TestCase('Test Do-Sa', '22.06.2023 17:44:23.456, 24.06.2023 17:44:23.456, 0')] And @Der schöne Günther I will do just that then. Thank you!
  6. Sherlock

    Is there a Sunday between 2 dates ?

    @mvanrijnen Ooh, that is cool. And easy enough to convert to Delphi: IfThen being in System.Math and DaysBetween in System.DateUtils. Edith has fixed extra sundays counted.
  7. Sherlock

    Is there a Sunday between 2 dates ?

    So I just noticed...well, then my code is a bit too simple. 😄
  8. Sherlock

    Is there a Sunday between 2 dates ?

    uses System.DateUtils; function CheckForSunday(StartDate, EndDate: TDateTime): Boolean; var StartDay: Integer; EndDay: Integer; begin Result := Daysbetween(StartDate, EndDate) >= 7; if not Result then begin StartDay := DayofWeek(StartDate); EndDay := DayofWeek(EndDate); if (StartDay <= EndDay) then begin Result := (1 >= StartDay) and (1 <= EndDay) end else Result := True; end; end; OK, how does this look? I do have the assumption though, that StartDate lies before EndDate, saving one or two comparison steps.
  9. Sherlock

    Is there a Sunday between 2 dates ?

    Well SysUtils has a nifty function called DayOfWeek. It returns Integers between 1 and 7 where 1 is Sunday and Saturday is 7. The rest is simple. You might try @Lajos Juhász AI quote, or may get even shorter code by checking if 1 is in the range between StartDate and EndDate.
  10. Sherlock

    macOS Ventura 13.4.1, any comments ?

    Definitely not XCode 15 😞
  11. Sherlock

    macOS Ventura 13.4.1, any comments ?

    I'm stuck on Monterey, because my MacBook is from late 2015. But I'm still quite happy with it.
  12. Sherlock

    [FMX beginner] Key Handling

    Voted. I guess noone uses shortcuts anymore. Especially FMX applications tend to be distributed for Android or iOS. No shortcuts there...only gestures and taps. So this might really be an oversight due to lack of use.
  13. Sherlock

    SDI <-> MDI forms

    Oh, but hold your horses, because MDI will get a lot of attention in the upcoming release: https://blogs.embarcadero.com/whats-coming-in-delphi-and-cbuilder-libraries/
  14. I'm pretty sure any Army employing women as fighter pilots has put them through the same tests and training as men, it would be recklessly stupid otherwise. That said, I am still convinced that the strongest man is stronger than the strongest woman. As can be seen in sports - athletics specifically. But our line of work is not really physically challenging, is it? Lets just concentrate on that.
  15. There goes another enshittification. And we all get to watch it live and in color.
  16. BTT: Just consider that "imaginary" Blog as a To-Do list of improvements
  17. Sherlock

    File Search

    I have a feeling the specifications have not been clear enough to the folks that answered, because https://stackoverflow.com/questions/76472056/exclude-specific-folder-from-file-search-in-delphi
  18. I read this with mixed feelings. Firstly it's cool, that reinforced learning can come up with "faster sorting" but then... It is kind of irritating, that a code review was not able to find those improvements in "ALPHA DEV swap move".
  19. They are the ones that came up with all this...go figure. Back to the 100k/yr example: Everything that has been deducted so far is just taxes. What about social security (healthcare, pension, unemployment)?
  20. Sherlock

    0/0 => EInvalidOp or NAN ?

    Windows ARM <> Windows x86 Windows ARM in this case is much closer to Android.
  21. I keep asking and keep getting responses, and when my questions where unclear or something else was lacking, this was communicated to me in a neutral tone (people who can hear a tone in any written statement are peculiar) and I fixed that. Almost all of my questions have been answered, and I myself have been able to provide an answer too...once or twice. So for me SO is a valuable resource that should not go to waste by allowing fake answers. Just how exactly does that work? Did they hack Stack Exchange to gain mod privileges? And Stack Exchange can't be bothered to check?
  22. Sherlock

    Form Creation

    "Does not seem to work" how do you deduce this? Do you see error messages, get unexpected behavior? If so, what are the errors, what behavior do you expect, and what is happening instead of that?
  23. Sherlock

    File Search

    I am not blind, I know what he asked. But to just come up with code without perhaps improving the overall style or at least pointing out what is wrong with it just seems careless. But do as you please, if it makes you happy.
×