Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Schokohase last won the day on August 20

Schokohase had the most liked content!

Community Reputation

76 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Schokohase

    Using Delphi in Virtual machine for a month

    With differential backups you only have to backup the changed files. Well one disk file will change at any time you start the vm, but with split option set there will be some files that have not changed and therefore need no backup
  2. Schokohase

    Using Delphi in Virtual machine for a month

    For backups it is better to use split files.
  3. Schokohase

    Using Delphi in Virtual machine for a month

    Maybe you should stop looking the directory content of some cache folders and watch the birds and bees outside flying in the sun and having a good time.
  4. Schokohase

    Using Delphi in Virtual machine for a month

    I simply exclude my project directories from AV.
  5. Schokohase

    Using Delphi in Virtual machine for a month

    Windows 10 has a built in AV and you will see it in the AV test rankings (as any other AV software) at any position (depends on the test and the time).
  6. When you use this class you will know the context it is used in. Do the synchronization (if needed) inside the callback method.
  7. Schokohase

    handling predicate conditions

    If it is public available? - Yes. If it is only private - No (or very rare).
  8. Schokohase

    handling predicate conditions

    We can only be theoretically/abstract because you asked a theoretically/abstract question:
  9. Schokohase

    handling predicate conditions

    Because of fail fast
  10. Schokohase

    How to abort tasks

    Check it at any place where it is safe to cancel. You can do that with ITask.CheckCanceled which will throw the EOperationCanceled exception if the task is requested to cancel. If it is safe to call it in each loop -> call it in each loop.
  11. Oh that is very complicated ... '(' + string.Join('|', fmtset.ShortDayNames) + ')' + // "ddd" '(' + string.Join('|', fmtset.ShortMonthNames) + ')' + // "mmm" ... not
  12. Just a sketch It should be possible to translate the format string into a Regular Expression to check the format and extract the values. The current format string dddd, dd mmmm yyyy could be translated to the following regular expression (using the en-US format settings) (Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday), (\d{2}) (January|February|March|April|May|June|July|August|September|October|November|December) (\d{4}) here a small PoC const dateToParseString = 'Sunday, 22 September 2019'; procedure Test(); var fmtset: TFormatSettings; pattern: string; match: TMatch; day: word; month: word; year: word; begin fmtset := TFormatSettings.Create('en-US'); pattern := // '(' + string.Join('|', fmtset.LongDayNames) + ')' + // "dddd" ', ' + // ", " '(\d{2})' + // "dd" ' ' + // " " '(' + string.Join('|', fmtset.LongMonthNames) + ')' + // "mmmm" ' ' + // " " '(\d{4})'; // "yyyy" match := TRegEx.match(dateToParseString, pattern); if not match.Success then raise Exception.Create('Invalid data'); day := word.Parse(match.Groups.Item[2].Value); month := 1; while (month <= 12) and (fmtset.LongMonthNames[month] <> match.Groups.Item[3].Value) do inc(month); year := word.Parse(match.Groups.Item[4].Value); Writeln(FormatDateTime('yyyy-mm-dd', EncodeDate(year, month, day), fmtset)); end; Well there is a lot to improve, but you should get the idea.
  13. Schokohase

    How to abort tasks

    Only the task itself - so it is you the programmer - can decide when it is safe to abort the operation and if there is some cleanup to do on cancellation. So, whenever you are at a point inside the task code where you can safely abort the execution of the task, check for cancellation.
  14. @zinpub Nope const dateToParse = 'Sunday, 22 September 2019'; const dateFormat = 'DDDD, DD MMMM YYYY'; const dateOutFormat = 'yyyy-MM-dd'; var date : TDateTime; begin try date := StrToDateFrmt(dateFormat,dateToParse); Writeln( FormatDateTime(dateOutFormat,date) ); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end. results in EConvertError: 'Sund' ist kein gültiger Integerwert
  15. Yes, .net can do the job using System; public class Program { const string dateToParse = "Sunday, 22 September 2019"; const string dateFormat = "dddd, dd MMMM yyyy"; const string dateOutFormat = "yyyy-MM-dd"; public static void Main() { var date = DateTime.ParseExact(dateToParse, dateFormat, System.Globalization.CultureInfo.InvariantCulture); Console.WriteLine(date.ToString(dateOutFormat, System.Globalization.CultureInfo.InvariantCulture)); } } see in action on .net fiddle The C# source code is open source and published on github so you may port it to Delphi.