Jump to content

Lars Fosdal

Administrators
  • Content Count

    3303
  • Joined

  • Last visited

  • Days Won

    110

Everything posted by Lars Fosdal

  1. Edit: Doh - as always I misread the original post... You wanted a callback for progress, I offered a progress bar 😛 Off to top up the coffee mug... I use the native Windows one. It deals well with UNC paths, access rights, network glitches, etc. In addition, I touch up the target file date to ensure it matches the original file date. Code was yanked from a utility unit, so there may be missing or superfluous units or functions. uses System.SysUtils, WinAPI.Windows, WinAPI.mmSystem, Winapi.ShlObj, Winapi.ShellApi, Winapi.ShFolder; function ShellFileOperation(const hHandle: THandle; const aSourceFiles: string; aTargetDirectory: string; aFunc:UInt; aFlags: FileOp_Flags; ProgressText:String):Integer; var shellinfo: TSHFileOpStruct; rc: Integer; begin FillChar(ShellInfo, SizeOf(ShellInfo), 0); shellinfo.wnd := hHandle; shellinfo.wFunc := aFunc; shellinfo.fFlags := aFlags; shellinfo.pFrom := PChar(aSourceFiles+#0); shellinfo.pTo := PChar(aTargetDirectory+#0); if ProgressText <> '' then shellinfo.lpszProgressTitle := pChar(ProgressText) else Shellinfo.lpszProgressTitle := pChar('Copying'); rc := SHFileOperation(shellinfo); if (rc = 0) and shellinfo.fAnyOperationsAborted then rc := -1; Result := rc; end; function FileCopyProgress(const SourceFile, TargetFile: String; const ProgressText: String; const AppWinHandle: THandle; const Silent:Boolean): Boolean; var rc : Integer; Flags: UInt; aDate: TDateTime; awh: hWnd; begin FileAge(SourceFile,aDate); Flags := FOF_NOCONFIRMATION OR FOF_FILESONLY OR FOF_ALLOWUNDO; if Silent then begin Flags := Flags OR FOF_SILENT OR FOF_NOERRORUI OR FOF_NOCONFIRMMKDIR; awh := 0; end else awh := hWnd(AppWinHandle); rc := ShellFileOperation(awh, SourceFile, TargetFile, FO_COPY, Flags, ProgressText); DebugOut('ShellFileCopy ' + SourceFile + ' -> ' + TargetFile + ' returns rc='+IntToStr(rc)); Result := (rc = 0); if Result then begin Sleep(250); FileSetDate(TargetFile, DateTimeToFileDate(aDate)); end; end;
  2. Interesting read. About avoiding RTTI as much as possible - how is this achieved? Edit: Or rather - what tradeoffs were necessary to eliminate the RTTI dependencies?
  3. Isn't that basically the same message as the one that Herb Sutter presented years ago (2007)? “Machine Architecture: Things Your Programming Language Never Told You” Slides: https://nwcpp.org/talks/2007/Machine_Architecture_-_NWCPP.pdf
  4. Lars Fosdal

    Apple XCode Cloud

    https://developer.apple.com/xcode-cloud/ You'll still need a Mac, but you don't need to own every Apple device.
  5. The VMware thing popped up in my feed. My gut reaction was to bring it forward. I agree - PS Remoting has risks. But - if an intruder is already inside the domain - you are already in trouble. We only allow it for some specific domain users and it is explicitly enabled for specific machines. The initiating host must be inside the domain.
  6. VMware users, patch now! https://www.bleepingcomputer.com/news/security/attackers-are-scanning-for-vulnerable-vmware-servers-patch-now/
  7. Lars Fosdal

    READ_SMS permission not requested

    https://google-developer-training.github.io/android-developer-phone-sms-course/Lesson 2/2_p_sending_sms_messages.html Has SMS access been enabled for the app in the Android settings? Also, best practices: https://stackoverflow.com/questions/32814922/why-does-android-ignore-read-sms-permission
  8. Lars Fosdal

    'as' operator??

    Ref.1: The as operator is a checked typecast. Let's say that you have a method that takes a TObject as parameter aInstance. The difference between a simple typecast and a checked typecase is that var Unchecked := TMyClass(aInstance); will never complain, while var Unchecked := aInstance as TMyClass; will raise an exception if aInstance is not a TMyClass Also see the is operator which can be used to validate the type before the cast. if aInstance is TMyClass then (aInstance as TMyClass).SomeTMyClassMethod;
  9. Most of the experts there seem to be self-appointed.
  10. Sounds like bullshit to me. No random crashes that we didn't cause ourselves that I can remember, and I've used every Delphi version there is, on most of the Windows versions there has been.
  11. There is one unmentioned drawback to VMs. The more you have, the more you need to keep updated and patched. That is the price you pay for flexibility.
  12. The only thing that is slow in my VMs is 3D gfx, but since I don't rely on those - it is not a problem.
  13. MS submitted changes to the Linux kernel in June 2020 that would allow running Hyper-V hosting on Linux. Not sure if this is present in any current Linux release yet.
  14. 3D GPU performance is a mixed bag, imo - but why would you test that in a VM? You'd remote debug that from the VM on a physical machine. The CPU is virtualized, so I guess the only time you'd get into trouble is if you try to run something like a VM with 8 cores on a 4 core machine or use more memory than is physically present. I would expect Hyper-V to simply cut down to the max avail if exceeded.
  15. Lars Fosdal

    TJsonTextWriter out of memory

    Well, Delphi 32-bit stops at 2Gb. If you need more memory, I suggest a 64-bit app.
  16. Lars Fosdal

    TArray<T> helper

    @Tommi Prami It would have been awesome if we could do helpers for generics. We can't.
  17. I used paid VMWare workstation for years. About a year ago, I switched to Hyper-V and never regretted doing so.
  18. Then there is this: https://www.microsoft.com/en-us/microsoft-365/blog/2021/04/28/beyond-calibri-finding-microsofts-next-default-font/
  19. Lars Fosdal

    Outlook Server Execution Failed

    It may be that the Outlook 2003 OLE server lacks some of the interfaces that your OLE client implementation requires. 2003 is pretty ancient...
  20. Lars Fosdal

    Loading data to multiple tables in a transaction

    It seems that the @Inserted_Values temp table does not use TIMESTAMP. declare @Inserted_Values table ( WX_5Min_Key int NOT NULL, [DateTime] DateTime NOT NULL );
  21. Lars Fosdal

    Loading data to multiple tables in a transaction

    Have you looked into which joins that fail? Is it possible to see any differences in the stored data / parameters that can cause joins that fail? Is the type strictly identical - ie both parameters and tables columns are of the TIMESTAMP type?
  22. Have you applied the most recent patches?
  23. It is useful to post the actual errors for others to be able to think about the cause.
  24. Lars Fosdal

    "Divided by zero" exception

    What target? Windows, iOS, Android, Linux? 32 or 64 bit? In the IDE or outside?
×