-
Content Count
2848 -
Joined
-
Last visited
-
Days Won
155
Posts posted by Anders Melander
-
-
GetRTLVersion would be my guess.
The actual values appears to be undocumented though - but here's an unofficial list to get you started: https://delphidabbler.com/notes/version-numbers
-
4 minutes ago, Renate Schaaf said:help says that this version of Format isn't threadsafe
"Not thread-safe" in this case doesn't mean crash and burn. It just means that if one thread modifies the global FormatSettings then it will affect all other threads also using it.
Hardly a problem - even if you did output floating point values in the exception message.
-
1
-
1
-
-
7 minutes ago, Kas Ob. said:Well i am bad writer, i said strange as this is exactly how it is used https://github.com/rmesch/Bitmaps2Video-for-Media-Foundation/blob/main/Utilities/uDirectoryTree.pas#L313-L314
And how it didn't raise AV on Renate debugger, that is strange thing.
Likely because Renate is using a newer version of Delphi. As far as I can tell the faulty code was contributed by someone else.
-
Just now, Kas Ob. said:Does the following work ?!
Procedure Test; var Strings: TArray<string>; begin strings[5] := 'Hi'; end;
Because it is used there similar to this.
🙂
No, of course that doesn't work
A dynamic array is initialized to an empty array so there needs to be a SetLength first.
-
FWIW & FYI:
54 minutes ago, Kas Ob. said:IntToHex Must have second parameter
Newer versions of Delphi have IntToHex overloads for NativeInt to match the size of a pointer. I think it got introduced in Delphi 10.
52 minutes ago, Kas Ob. said:removed TArray<string> , this one is very strange, causing access violation as the array is not initialized, the AV appear in the caller as it cause corrupt stack, or may be i am living under a rock and modern Delphi compiler do initialize it.
TArray<T>, being a dynamic array, is a manages type and string too, so TArray<string> should be initialized automatically. Probably a compiler bug.
-
1 hour ago, Renate Schaaf said:I hate the format-strings, because I can never remember the code for the place-holders.
If only there was some magic key you could press in the editor to display help about various relevant topics... 🙂
I only ever use %s %d, %n and %x - and I use those a lot so that helps but I sometime need to consult that magic key when it comes to the precision or index specifiers.
-
1
-
-
1 hour ago, Kas Ob. said:1) Ditch "goto Done;" and use try..finally it is safer and here there is no need for goto and loop is not complex, it is just exit.
There's not even a need for try..finally since there no resources to protect; Get rid of hr, assign the results to Result directly and just exit.
Also, instead of:
raise Exception.Create('Fail in call nr. ' + IntToStr(Count) + ' of ' + ProcName + ' with result $' + IntToHex(hr));
I would use:
raise Exception.CreateFmt('Fail in call no. %d of %s with result %x', [Count, ProcName, hr]);
for readability.
-
I'm pretty sure Skia's BMP handling isn't bug-free but it's way more likely that this problem is caused by the Delphi side of things; The alpha handling in VCL's TBitmap is such a horrible mess that it should be deprecated and reimplemented from scratch.
See also:
-
-
I'm working on a project like that; New units are named consistently after strict rules so we can easily locate the relevant unit. Old units are named after whatever the developer had time to type (and apparently he was always in a rush).
So I introduced a "magic" key that when pressed at run-time displays the name of the active form/frame. It's basically just a TApplicationEvents.OnShortCut on the main form:
procedure TFormAnynymizedToProtectTheGuilty.ApplicationEventsShortCut(var Message: TWMKey; var Handled: Boolean); begin {$ifdef DEBUG} if (Menus.ShortCutFromMessage(Message) = ShortCut(VK_F1, [ssAlt])) then begin if (Screen.ActiveCustomForm <> nil) then begin var Msg := ''; // Find frames in the form var Control := Screen.ActiveControl; while (Control <> nil) and (Control <> Screen.ActiveCustomForm) do begin if (Control is TFrame) then Msg := Msg + Format('Embedded frame: %s in %s.pas', [Control.ClassName, Control.UnitName]) + #13 else if (Control is TForm) then Msg := Msg + Format('Embedded form: %s in %s.pas', [Control.ClassName, Control.UnitName]) + #13; Control := Control.Parent; end; Msg := Msg + Format('Active form: %s in %s.pas', [Screen.ActiveCustomForm.ClassName, Screen.ActiveCustomForm.UnitName]); TaskMessageDlg('YOU ARE IN A MAZE OF TWISTY LITTLE PASSAGES, ALL ALIKE.', Msg, mtInformation, [mbOK], 0); end; Handled := True; end; {$endif DEBUG} end;
-
2
-
1
-
-
25 minutes ago, RDP1974 said:I added a thread safe fifo queue for highest performance producer-consumer between threads
AFAIR a lock-free FIFO queue can be implemented with just TInterlocked.CompareExchange (i.e. InterlockedCompareExchange).
-
3 hours ago, david berneda said:StretchDraw? That's a horrible solution - to a 4 year old problem.
-
I would argue that the type of Epsilon depends on the use case; For one an absolute explicit Epsilon is suitable (SameValue(Value, Epsilon)), for another an absolute implicit Epsilon will make sense (SameValue(Value) but with some better defaults), and for yet another a relative magnitude Epsilon would be desirable (let's call it KasObSameValue(Value, Epsilon) since we don't have it in the RTL).
FWIW, the same discussion could be had about IsZero. I mostly use it to avoid division by zero and overflow errors caused by division by a very small number. I'm not really comfortable doing it but the alternative is the gazillion sporadic exceptions we had in the old application I'm working on, before we began using it.
-
Google "manifest cache"
-
1 minute ago, Kas Ob. said:its documentation should declare it use low(reduced) precision for comparison by default.
No argument there.
-
33 minutes ago, Kas Ob. said:The right way ...
I think you are missing my point.
I'm saying that SameValue, with Epsilon specified, is documented to work in the way it does now. If it didn't then that would be a bug.
You can argue that it would be better if it worked in another way (e.g. Epsilon relative to the magnitude of value) but that is not how it is documented to work, it is also subjective, and it depends on how one intends to use it.
It's like arguing that the right way to index strings is zero based.
-
5 minutes ago, Kas Ob. said:the formula for the comparison should be
Should? As far as I can tell the current implementation matches the documented behavior. Yours doesn't.
You might prefer another behavior, which is perfectly reasonable, but it doesn't make the current one wrong.
I agree that SameValue without the Epsilon parameter is at best problematic but, with regard to the choice of default Epsilon, we don't know what the criteria was for the values they chose (because it isn't documented) so I can't see how we can say that they are wrong. Again; We might prefer other values but that doesn't make the current values wrong.
-
40 minutes ago, Kas Ob. said:SameValue will murder some of them as its error tolerance is fixed
Only if you don't specify a tolerance.
I can't see anything wrong with it if you specify a tolerance.
-
Multiply by a 10^"number of decimals", Trunc to convert to integer, Assert on the integer value
-
1
-
-
As far as I can tell they've been forced to replace their proprietary APIs with standard APIs (in order to avoid vendor lock-in) and to allow competing third party applications access to their map data. Did I understand that right?
It seems Google has few friends in the map business; They aren't allowed to link to Google Maps from their Google search results - or even from the search page (which is pretty stupid and doesn't do the users any good), while the same restrictions doesn't apply to Bing. Could it be that Bing map data is provided by Tom-Tom?
-
2
-
-
5 hours ago, bk31415 said:I am writing an (MQTT) broker (serves) that serves about 100 clients.
9 minutes ago, bk31415 said:Both machines (A and B) single-user, they will access one another over the local network --not from Internet or similar.
Alright then.
So you are going to violate the license and don't want that aspect discussed. That's between you, Microsoft, and whatever unfortunate user/client, if any, this involves but maybe you shouldn't ask us to help you do it.
-
1 minute ago, bk31415 said:Second part applies.
You mean you are "installing the software on a device for use only by remote users"?
-
2 minutes ago, bk31415 said:This must be the strictest possible interpretation out there.
No it's not; You are not allowed to use a desktop Windows as a server. What other people that violate the license say about that isn't really relevant.
QuoteInstallation and Use Rights.
Restrictions.
For the avoidance of doubt, this license does not give you any right to, and you may
not (and you may not permit any other person or entity to):...
use the software as server software or to operate the device as a server, except as permitted under Section 2(d)(iii) below; use the software to offer commercial hosting services; make the software available for simultaneous use by more than one user over a network, except as permitted under Section 2(d)(vi) below;
install the software on a server for remote access or use over a network; or install the software on a device for use only by remote users; -
Just now, Attila Kovacs said:if you're turning the machine into a server that violates terms intended for client/desktop use
Exactly.
Read the EULA. Search for "server". It's stated pretty clearly what you can and cannot do.
programmatically determine the edition of RAD Studio 12.3
in Delphi IDE and APIs
Posted
Oh - You meant what version of RAD Studio is installed on the local system.
I think the InstalledUpdates registry key is the closest you can get. There's no guarantee that it's valid though since it's only informational.