

TurboMagic
-
Content Count
255 -
Joined
-
Last visited
-
Days Won
9
Posts posted by TurboMagic
-
-
On 10/2/2020 at 9:01 AM, Rollo62 said:Yes I have that, but the strings are so much more elegant.
I would whish to have better TBytes and dyn. array support like that in Delphi.You know that arrays can be concatenated with + since XE7? And delete etc. is available for them as well!
-
1
-
-
One thing which has helped at least some persons is to have a look at where units are put in uses. It often helped to put them into interface section rather than implementation section.
And somewhere else I read reports which compared 10.3.3 and 10.4.x both without fix pack and 10.4.x was measurably faster. It might not be as fast yet as everybody wishes, but at least noticeably faster.
Oh and somebody lately suspected it might have to do with unit scope like sometimes using SysUtils and sometimes System.SysUtils.
But that's a guess only.
-
Hello,
ICS is now moving to those SSL named classes, which is fine.
The question now is: in order to have a FTP client not using SSL is it enough to set the SSLType of the client component to "none"?
Best regards
TurboMagic
-
Small status update: it looks I have fixed all non object related issues. At least the unit tests for those do run and the same unit tests as implemented for unmanaged types have ben implemented for strings as well and they do run.
What's left now is the OwnsObjects semantics and tests for interfaces and regular classes. That's the state of the development branch.
-
I fixed the Add(Items:TRingbufferArray) now, it might need further test coverage for managed types, but that at least fixed some of the failed string test cases now.
Peek no longer crashes and while working on that I had see that Peek had already a value in Result at the beginning of the method. Trying to set that to Default(T)
there crashed immediately. So fixing add was the right thing.
One thing which still puzzles me and maybe is not even possible:
I can have such a generic ringbuffer class which works for non managed types and for reference counted types at the same time.
But I don't seem to be able to make it work with objects and OwnsObject semantics, as I cannot call free. I can only call free if I introduce a class constraint.
Is this assumption correct and my initial attempt with a class for objects inheriting from the first one is the right one?
I already tried to find out how TObjectList<T> from Generics.Collections does it, but I failed to find the free of the items in it...
-
Yes, I resolved it by upgrading the student to 10.3.3 and then using the permission request solution provided there.
It works now and if you check the github repo you'll see it's in there as well 😉
So if you need to create a video on Android you can use that solution right away 😉
The only thing missing there is an iOS implementation as I don't have any iPhone and Mac.
-
1
-
-
Access violation, but I don't know why.
Ok, I started to write some further unit tests now as a start to fix the issues this implementation has in order to learn some things.
I copied the integer unit tests which run fine and reworked those into string ones. so <T> is string now.
One of the tests calls this method:
function TRingbuffer<T>.Peek(Index: UInt32): T; var reminder : UInt32; begin if (Index < Count) then begin // Puffer läuft derzeit nicht über seine obere Grenze hinaus if ((FStart+Index) < Size) then result := FItems[FStart+Index] else begin // um wieviel geht es über die obere Grenze hinaus? reminder := (FStart+Index)-Size; result := FItems[reminder]; end; end else raise EArgumentOutOfRangeException.Create('Invalid Index: '+Index.ToString+ ' Max. Index: '+Count.ToString); end;
FItems at that point contains 5 items, FStart is 1 and Index is 1 as well.
It crashes with EInvalidPointer at this line:
result := FItems[FStart+Index]
When debugging the asm I see some call to freemem.
I would have expected that Peek would simply return a string with the contents of FItems[FStart+Index] and that it would increase the
reference counter of the string stored in FItems[FStart+Index].This Peek method is called in a loop over the complete ringbuffer to check if its contents is the expected one.
For Index = 0 it doesn't crash.
What is wrong on my assumption?
And the other question would be: should peek increase reference counter of reference counted types (string, interface...) or return
a copy which is not reference counted and thus completely detached from the buffer inside the ring buffer class?And if "detached" should be preferred, how to do the copying properly?
-
By the way: the whole thing is now available here:
https://github.com/rmesch/Bitmaps2Video
Android 64 bit support for the sample provided should be available soon, I need to commit it and create a pull request.
Which I'll do in a minute.-
1
-
-
On 6/8/2020 at 11:40 AM, David Heffernan said:Couldn't take the traffic of tens of devs trying to vote for range checking enabled by default
I guess it's rather a missing overflow check in the server software for the vote counter 😉
But I guess this Jira software is not written in Delphi (oh, if it were overflow checking would be available and this issue would have been caught during testing...)Of course I voted for this as well.
-
If your Delphi version is new enough to support generics:
Create a TDictionary where the key is the number (ID) of the question and the data is the number of points of the answer selected.
Store the ID of the question in the tag of the tab the question is on (assuming one tab holds one question, if not put each question
in some container which has a tag, it doesn't matter if that container is visible or not). Store the number of points associated with an
anwer to the question in the tag of the checkbox or radio button for the answer.If somebody selects an answer look in the list if there is already some entry with hat question ID. If yes, remove it and add it again with
the new data or overwrite the data.When the questionaire is finished iterate through the dictionary and count the points.
uses Generics.Collections; type // first one is the key = question ID, last one the data asociated with the key in your case the points. TAnswerDict = Dictionary<integer, integer>; var Answers:TAnswerDict; Pair: TPair; Points: Integer; begin Answers := TAnswerDict.Create; try Answers.Add(1,3); Answers.Add(2,1); Points := 0; for Pair in Answers do inc(Points, Pair.Value); finally Answers.Free; end; end.
The code has not been tested but it should be a starting point for you, if still relevant.
-
Ok, besides accepting Uwe's pull request I did some changes to the Peek method in order to make it more compatible with managed types. Feel free to look at it and critisise where necessary, I admit that I didn't test it yet (need to create unit tests) but it's getting late enough already. I can only learn from it.
And if somebody wants to contribute: feel free. As far as I understood Stefan, one could get rid of the 2nd class implemented for managed types altogether by using IsManaged and calling the appropriate code to release the items where necessary.
-
1 minute ago, Anders Melander said:Move isn't the problem in this particular case. The problem is that once you logically remove an entry from the array then you need to finalize that entry in the array to clear the reference. You can do that by assigning Default(T) to the entry.
Ok, thanks for this hint.
-
19 minutes ago, Anders Melander said:Because otherwise the buffer will still hold a reference to the T instance. For any managed type this will be a problem.
For example what happens if T is an interface?
Maybe some unit testing is in order...
Yes, unit tests for managed types would still have to be created. And yes one would have to do some for strings and interfaces as well as tey're of course managed as well.
I contributed this to the public because it will not help the community if one always consumes only without giving. That also means, if there's interest in this library others should contribute fixes etc. as well. My main open source commitment currently is DEC (Delphi Encryption Compendium) and that's enough work.
-
4 minutes ago, Anders Melander said:Because otherwise the buffer will still hold a reference to the T instance. For any managed type this will be a problem.
For example what happens if T is an interface?
Maybe some unit testing is in order...
Thanks! That could be fixed at the place where items get taken out of the list. I guess one would have to make a distinction of cases via
IsManagedType(T) so one can keep using Move for non manages types and assignment operator for managed ones. Would that be correct?
-
9 hours ago, Stefan Glienke said:No, yes
For managed types you can System.Move them in the internal array - however it also does it when peeking x items into the result array.
For types containing weak reference System.Move does not work even for the internal array.
Ok, I think I see what you're after. In case of the peek one would have to use the assignment operator then (if the type is a managed one) in order to increase the reference counter. Am I right? But how to find out whether the type is managed?
-
9 hours ago, Anders Melander said:I can't see why using Move would be a problem as long as it just moves entries within the buffer array (which it does as far as I can tell).
However there does seem to be a problem with not clearing empty slots in the array. E.g. by assigning Default(T) to them.
Why would those have to be cleared? One shoukdn't be able to read those out and I don't remember but if the buffer has to free any instances contained in it when the buffer is freed it will only free the instances still in the buffer.
-
On 8/23/2020 at 4:31 PM, TurboMagic said:Uwe Raabe is already working on this 😉
But others than MVPs and the usual folks could contribiute as well...
Often such easy things or even parts of those would help the community!
Since I didn't hear from him with a ull request or any other "delivery" yet I guess he got stuck translating the comments...
-
24 minutes ago, Angus Robertson said:The ICS FAQ pages already have a lot of SSL/TLS documentation for major subjects, and some of the server components have almost up to data documentation for properties and methods. But proper documentation takes weeks and no-one will pay for it, so I spend more time writing new components.
http://wiki.overbyte.eu/wiki/index.php/Main_Page
I have created a complete help file of all ICS components, properties, methods and events, but it would take weeks to make it useful with actual text on what they do. Some developers give up at that point and just leave a skeleton help file.
Angus
Ok, I see the FAQ pages but in the wiki documentation for the various components the SSL ones are usually read = nonexisting links.
My earlier question was what we can do to help generate the Wiki sceleton as automatically as possible.
About the help you started to create: is this CHM based and is the "source" available for contribution somewhere?
-
Uwe Raabe is already working on this 😉
But others than MVPs and the usual folks could contribiute as well...
Often such easy things or even parts of those would help the community!
-
Oh, another remark:
If somebody would "donnate"! English translations for CircularBuffer I would submit the updated version to GetIt!
-
1
-
-
I can understand the request to do so. I have already written in the project description that this would be a task one could/should do.
As I'm busy enough with my other open source project (DEC - Delphi Encryption Compendium)
I will accept such translations and update the code with them but won't invest the time in those at this time.
As user Dummzeuch (a German by the way! ;-) ) stated: maybe somebody could contribute them.
I guess there are enough Delphi developers out there who didn't contribute code etc. yet but only consumed so far what
others contributed. That could be a start to give something back.
As we're talking about contributing and my next topic is related to F. Piette:
is there an easy way to write a Delphi source code parser (maybe using Delphi AST which I only know by name)
to parse the source of ICS and generate output in the Wikipedia syntax so that for the still undocumented SSL ICS code
the Wiki sceleton could be generated at least as a starting point to finally get documentation started?
While I value the library and its many demos, a written documentation about the individual properties and methods
is also worth quite something!
-
2
-
-
Meanwhile the necessary TChart files have been "published" via some download link in the QP report RSP-28780.
-
1
-
-
Hello,
just a small note that I released a generic circular buffer library under open source license (Apache 2.0) here:
https://github.com/MHumm/CircularBuffer
Feel free to use it or to contribute to it.
Cheers
TubroMagic
-
3
-
1
-
-
Did you already see the new comments to this one?
https://quality.embarcadero.com/browse/RSP-28780
They indicate that TChart works in release configuration!
-
1
-
DEC (Delphi Encryption Compendium) has a new home
in Delphi Third-Party
Posted
Hello,
this is the notice that DEC (Delphi Encryption Compendium) has a new home.
The GitHub repository has been transferred to me by the previous maintainer as
he no longer found the time to work on it and I was the main developer since a
few years already anyway.
The new URL is:
https://github.com/MHumm/DelphiEncryptionCompendium
This transfer also makes it a bit more likely that the V6.0 which is still in the works
will be released in the near future.
Best regards
TurboMagic