-
Content Count
3416 -
Joined
-
Last visited
-
Days Won
113
Everything posted by Lars Fosdal
-
How to get the Currency Symbol in multiple platforms
Lars Fosdal replied to John Kouraklis's topic in Cross-platform
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. -
Passing back a string from an external program
Lars Fosdal replied to dummzeuch's topic in Windows API
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. -
Blocking the Windows Screen Saver in Delphi
Lars Fosdal replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
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. -
Blocking the Windows Screen Saver in Delphi
Lars Fosdal replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
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 -
Passing back a string from an external program
Lars Fosdal replied to dummzeuch's topic in Windows API
I'd call that a concurrency issue, rather than a race condition? SharedFileName := '%temp%\MyFileName.ext.' + GetCurrentProcessId.ToString; -
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 ?
-
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.
-
Passing back a string from an external program
Lars Fosdal replied to dummzeuch's topic in Windows API
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/) -
Also, https://github.com/tananaev/rootless-logcat Same caveat.
-
https://bitbucket.org/mlopatkin/android-log-viewer/src/default/ Caveat: I have not tried it myself
-
Good design for "file was just saved" message
Lars Fosdal replied to Mike Torrettinni's topic in General Help
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. -
Good design for "file was just saved" message
Lars Fosdal replied to Mike Torrettinni's topic in General Help
Yes, that could work well, IMO. -
Good design for "file was just saved" message
Lars Fosdal replied to Mike Torrettinni's topic in General Help
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. -
SDTimes Industry Watch: The developer transformation
Lars Fosdal posted a topic in Project Planning and -Management
https://sdtimes.com/softwaredev/industry-watch-the-developer-transformation/ -
Very slow access to class parameters by properties
Lars Fosdal replied to ŁukaszDe's topic in Algorithms, Data Structures and Class Design
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; -
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?
-
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
-
I use a cream colored background in the editor. I find that much calmer than looking at a black display.
-
https://jsonlint.com is very handy.
-
Increasing registration count not possible without active maintenance support
Lars Fosdal replied to Leif Uneus's topic in Delphi IDE and APIs
I like the MS VS way better than the EMBT BDS way. -
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.
-
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
-
Thanks, Uwe. We did consider that our best option as well. Now we just need Tetrapak to set up their OPC server correctly 😛
-
Initialize local variables at declaration
Lars Fosdal replied to PeterPanettone's topic in Delphi IDE and APIs
They would be uninitialized per iteration. Ref. AllocMsg - what can I say other than old habits die hard 😛 TPQ and ArtSum are regular objects retrieved from global shared pools and life cycle management happens elsewhere. -
C# offtopic: Class of TSomeClass - Alternatives?
Lars Fosdal posted a topic in RTL and Delphi Object Pascal
I am quite fond of class variables of the Class of TSomeClass type. I use these for polymorph creation of class instance variables, typically handlers of some sort, but C# does AFAIK not have a similar construct, i.e. type as a variable. What are the best practice alternatives to using class variables? Am I limited to case / if then else factories or is there something more elegant around?