Jump to content

Lars Fosdal

Administrators
  • Content Count

    389
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by Lars Fosdal

  1. Lars Fosdal

    Best delphi so far?

    The last 8-9 years I've had the luxury of pretty much staying current with the Delphi versions. We usually skip the first releases like 10.2 or 10,3 and migrate when the 10.2.1 or 10.3.1 arrive. This has become a little harder as the so-called minor upgrades now also have a lot of changes and even new stuff., but we tend to wait for the first "fix pack". That allows the new versions mature for a while so that TMS, EurekaLog, FastReports, and others can work out any new quirks, and the bleeding edge crowd can draw first blood, but as I said, we do aspire to move on to the latest version as soon as it seems tried and tested. Back in the day, skipping several versions often raised headaches when finally deciding to migrate as you had to deal with multiple incompatibilities or breaking changes, so I much prefer the current approach. To be honest, in some cases I actually wish that EMBT would be bolder and more often introduce breaking changes to tidy up old sins. On the topic of unit dependency cycles, I tend to view them as a design weakness. It is a quick workaround for properly designing with DI and other tools that eliminate unit inter-dependencies. Yet, working with code that has evolved over a long time, they can be hard to eliminate as they are so deeply ingrained. We have one particular unit that causes a compiler internal error whenever we change something in its interface section and do a compile in the IDE. At that point only a Build All resolves the problem.
  2. Lars Fosdal

    FireDAC Connections

    We ended up setting up the connections in code, rather than using connection definitions. procedure TPSDDatabase_FD.CreateFireDACConnections; const OSAuthent = 'No'; begin if not Assigned(FConnection) then begin OnConnectionCreate; FConnection := TFDConnection.Create(nil); FConnection.DriverName := FireDriverLink.BaseDriverId; FConnection.Params.Values[MSSQLParam.Server] := Trim(FHost); FConnection.Params.Values[MSSQLParam.Database] := Trim(FDatabaseName); FConnection.Params.Values[MSSQLParam.OSAuthent] := OSAuthent; FConnection.Params.Values[MSSQLParam.User_Name] := Trim(FUserName); FConnection.Params.Values[MSSQLParam.Password] := Trim(FPassword); FConnection.Params.MonitorBy := Self.MonitorBy; if DisableMARS then FConnection.Params.Values[MSSQLParam.MARS] := 'No'; FConnection.Params.Values[MSSQLParam.ApplicationName] := AppInfo.Summary+';tid=' + IntToStr(GetCurrentThreadId); FConnection.LoginPrompt := False; FConnection.FormatOptions.OwnMapRules := True; with FConnection.FormatOptions.MapRules.Add do begin SourceDataType := dtDateTimeStamp; TargetDataType := dtDateTime; end; with FConnection.FormatOptions.MapRules.Add do begin SourceDataType := dtDate; TargetDataType := dtDateTime; end; FConnection.OnLogin := FDConnectionLoginEvent; FConnection.OnError := FDConnectionErrorEvent; FConnection.OnLost := FDConnectionLostEvent; FConnection.OnRestored := FDConnectionRestoredEvent; FConnection.OnRecover := FDConnectionRecoverEvent; end; end;
  3. Lars Fosdal

    Laufleistung

    Mileage or Distance traveled. And, IMO, although the origin of mileage is miles traveled, today it is fine to use a mileage measured in km - if that is the local distance unit. In Norwegian, the word "kilometerstand" is used, meaning the current standing of the kilometer counter in the odometer.
  4. Lars Fosdal

    How to get the Currency Symbol in multiple platforms

    https://restcountries.eu offers various free REST APIs for retrieving lists of country-specific info. Pretty nice. AFAIK, there are no cross-platform libs to get country-specific info. Ugly workaround for your apps: Let your user specify the locale. Alternatively, implement for each platform. Windows https://docs.microsoft.com/en-us/windows/desktop/api/winnls/nf-winnls-getlocaleinfoa Android https://developer.android.com/reference/java/util/Locale iOS https://developer.apple.com/documentation/foundation/nslocale/1643060-countrycode Linux No std way as far as I know.
  5. Lars Fosdal

    Passing back a string from an external program

    Depends on the dictionary, I guess. Race conditions rarely flag as errors, but cause inconsistent or erratic data, possibly leading to wrongful processing later on. In this case, at least one of the four parties would be denied access (due to exclusive write lock and - depending on the programmmer - exclusive read) to the file and hence should have/raise awareness of a problem. But, whatever.
  6. It turns NumLock off/on/off (or on/off/on) within less than 30 ms every 60 seconds, so I don't think it will bother you much.
  7. Our laptops are under company governance, so we can't prevent the session from locking as it is dictated by the policies. In addition, the idle time is really short. So - we wrote LockBlock which basically simulates toggling the numlock every 60 seconds. That prevented the auto locking, but it also prevented the screensaver from kicking in when the dektkop was locked, so I added handling of lock/unlock to disable the fake keystrokes when it was locked. Super simple UI: 60 second interval, starting at 8 in the morning, lasting for 8 hours - with an add an extra hour button for off work hours lock blocking. Project source attached. LockBlock.zip
  8. Lars Fosdal

    Passing back a string from an external program

    I'd call that a concurrency issue, rather than a race condition? SharedFileName := '%temp%\MyFileName.ext.' + GetCurrentProcessId.ToString;
  9. Lars Fosdal

    JSON string value

    If you don't document it - how do you expect to maintain backward compatibility? My code relies on REST.Json - ObjectInstance := TJson.JsonToObject<T>(aJsonString) ; - aJsonString := TJson.ObjectToJsonString(ObjectInstance, [joIgnoreEmptyStrings, joIgnoreEmptyArrays, joDateIsUTC, joDateFormatISO8601]); - TJSONInterceptor / JsonReflectAttribute for instructing the converter to drop TDateTime properties that have 0 as value. What are the equivalents in System.Json ?
  10. Lars Fosdal

    JSON string value

    I wish the various Json classes were better documented. http://docwiki.embarcadero.com/Libraries/Rio/en/REST.JsonReflect is particularly poorly documented with regards to marshalling, interceptors and converters. I have long been wondering if the TJson.JsonToObject<T>(aJsonString) can be made to handle mixed type arrays {"list": [5, "text", {"prop": "value"}]} by injecting converters, but it seems impossible - but then again - the above mentioned tools are undocumented.
  11. Lars Fosdal

    Passing back a string from an external program

    What about a memory mapped file? An idealist kind of solution could perhaps be a message queue system like f.x. RabbitMQ (https://www.rabbitmq.com/)
  12. Lars Fosdal

    Android Log Capture

    Also, https://github.com/tananaev/rootless-logcat Same caveat.
  13. Lars Fosdal

    Android Log Capture

    https://bitbucket.org/mlopatkin/android-log-viewer/src/default/ Caveat: I have not tried it myself
  14. Lars Fosdal

    Good design for "file was just saved" message

    Another option would be to specify that file should be opened after creation already at the point where you decide to make the file in the first place.
  15. Lars Fosdal

    Good design for "file was just saved" message

    Yes, that could work well, IMO.
  16. Lars Fosdal

    Good design for "file was just saved" message

    I'd make a generic "application log" where I would log the different actions, and for each action type - offer the possible options when viewing the log. Whenever something is logged, I'd have a "New Item" counter (Think "number of unread") somewhere in the UI - f.x. on a button that opens the log. I also strongly dislike modal dialogs, but when I need that file, I do need a mechanism to find it.
  17. https://sdtimes.com/softwaredev/industry-watch-the-developer-transformation/
  18. As David says - if the setter and getter don't do anything but assignments, you can eliminate them. property X: Integer read pX write pX; property Y: Integer read pY write pY;
  19. The joys of inherited problems. I am looking for a pattern or advice on how to best allocate a set of records to a specific requestor when there are multiple parallel requests, and there are multiple parallel request viewers. In practice: Allocate a set of deliveries to a user, when there can be multiple users requesting deliveries in parallel, and multiple users viewing the deliveries in parallel. The current SQL can give deadlocks both on allocations and on viewing, so something is definitively not right, and I need to improve on it. There is SO, where it all is an exercise in asking the question right... Are there other good discussion sites?
  20. Lars Fosdal

    Best site/source for SQL Server questions?

    Work in progress. Looking at more retry resilience, rather than always once off. https://www.microsoftpressstore.com/store/exam-ref-70-762-developing-sql-databases-9781509304912
  21. Lars Fosdal

    10.3.1 has been released

    I use a cream colored background in the editor. I find that much calmer than looking at a black display.
  22. Lars Fosdal

    New to Json

    https://jsonlint.com is very handy.
  23. I like the MS VS way better than the EMBT BDS way.
  24. Lars Fosdal

    P.I. Engineering XKeys keyboards

    I have a couple of XK16, an XK-60, and the XK-3 pedal that I rarely use these days. I used them a lot back when I was a PC gamer. Amazing hardware. Quirky software.
  25. Does any of you have experience with OPC over DCOM, using Delphi? We are looking for a library that is tried and known to work well, as there are a number to choose from at https://www.opcconnect.com/delphi.php
×