Leaderboard
Popular Content
Showing content with the highest reputation on 04/14/25 in all areas
-
Hi It seems like a natural thing to want: is there a way to get all the datasouces that have dataset = ADataset? Other than looping through the components property of the owner of course. I was looking at the code of TDataset. It even has a private member variable FDatasources: TList<TDatasource>, but it is not exposed. So close! TIA Mark
-
How can you list all the datasources linked to a dataset?
Remy Lebeau replied to PiedSoftware's topic in VCL
Class helpers don't have access to private members anymore since Delphi 10.1 Berlin. https://blogs.embarcadero.com/closing-the-class-helpers-private-access-loophole/ -
Overflow Checking from 10.4 onwards
pmcgee replied to pmcgee's topic in RTL and Delphi Object Pascal
PS : I have submitted an update to the TurboPack repo on Github, with the appropriate attribution back to this thread. https://github.com/TurboPack/RudysBigNumbers/pull/10 -
Overflow Checking from 10.4 onwards
pmcgee replied to pmcgee's topic in RTL and Delphi Object Pascal
Yes. Right. Got it. I did go to the link, but my brain saw the (az+b)(cz+d) and totally failed to see that this was exactly the z = 1.e32 (in binary) that I was using. And thank you for the information about the Elliptic Curve stuff (El-Gamal) to read up on. I'll be very interested to read it. -
Overflow Checking from 10.4 onwards
Kas Ob. replied to pmcgee's topic in RTL and Delphi Object Pascal
I don't have any of the mentioned above IDEs, but i see a problem or two .. well more than that a lot, but will talk about your exact problem first 1) The directives are wrong and mixed, and here how they should look like function TRandom.Next(Bits: Integer): UInt32; begin {$IFOPT R+} {$DEFINE HasRangeChecks} {$ENDIF} {$IFOPT Q+} {$DEFINE HasOverflowChecks} {$ENDIF} {$RANGECHECKS OFF} {$OVERFLOWCHECKS OFF} FSeed := (FSeed * CMultiplier + CIncrement); Result := UInt32(FSeed shr (64 - Bits)); // Use the highest bits; Lower bits have lower period. {$IFDEF HasRangeChecks} {$RANGECHECKS ON} {$ENDIF} {$IFDEF HasOverflowChecks} {$OVERFLOWCHECKS ON} {$ENDIF} end; Because we have two overflow check can be triggered here, not one !, Integer overflow range overflow come from multiplication and form truncation while mixing signed and unsigned, both need to be disabled, also the R+ for the range while wrongly was Q. 2) I tried this small test procedure RunTest; var Rand: IRandom; A, B, C: BigInteger; begin Rand := TRandom.Create($FF00FE01FD02FC03); // sooner ! Trigger overflow check at TRandomBase.NextBytes //Rand := TRandom.Create($FF00FF01FF02FF03); // Trigger overflow check at TRandom.Next A.Create(1024, Rand); B.Create(1024, Rand); C := A * C; Writeln('A = ' + A.ToHexString); Writeln('B = ' + B.ToHexString); Writeln('C = ' + C.ToHexString); end; And we have another place that has an overflow, but the fix is easy (again sign bit!!) procedure TRandomBase.NextBytes(var Bytes: array of Byte); var Head, Tail: Integer; N, {Rnd,} I: Integer; Rnd : UInt32; // <--- fix overflow begin Didn't go through more tests or any deeper in digging into the source. Now to the other problems 3) This pseudorandom number generator is not cryptographically secure , it has very small duration and depend on single modular operation which is 2^(64-Bits)= 2^k, this can't be considered secure it is as predictable as it can be by design, but choosing 2^k make brute force algorithm for it way much faster ! 4) I don't understand from where the assumption of only 48 bits are only used, this is strange and out of the context or this family of PRNG, may be i missed something with Bits, but will not dig deeper in it. 5) the core problem is depending on Int64, this is signed and by using signed we lose a bit and confuse the compiler and math, while gains nothing in return, this family of PRNG which call LCG https://en.wikipedia.org/wiki/Linear_congruential_generator doesn't handle signed numbers, and doesn't need as it is by definition, so using Int64 should be replaced with UInt64 for the constants, and the algorithm too. 6) tried to figure out this code You are going with Karatsuba https://en.wikipedia.org/wiki/Karatsuba_algorithm , nice it is the right way when you are in the corner, also much cleaner for limbs, yet the last masking is again wrong assuming (you are following the original code) it can or should be signed operation, this should be changed to unsigned, and return the sign bit to the fold, as it is by design is using the highest 32 bit, by losing the sign, where entropy is lost, we left with 31 bit randomness. About learning and implementing RSA, yes do it and you will learn much, and i wish you good luck, also a suggestion : why not read more about CSPRNG and implement one ,a cryptographically secure (CS) one, there is one i liked very much due it speed and portability, it is based on CHAHCA with reduced rounds called ChaCha8, it use the same permutation as ChaCha20 but with 8 rounds, it is secure and small as it can be, and used in Go Lang applications extensively, anyway it is not so important and most important thing is understanding is that security is like a chain and the chain is weak as its weakest link, randomness is always the most crucial link that when break (insecure) it will render everything built on it insecure, and last suggestion if you are going to use you own implementation of RSA in production for clients then test it then test it and test it again and think a lot before using your own implementation, it is not recommended by anyone ( as i think you read again and again, things like don't implement your own...), but you should learn it inside out, so go with it. -
Component with sub-property event
Anders Melander replied to Anders Melander's topic in Delphi IDE and APIs
Decoupling. In this case the events belongs in the sub-property objects. They do not concern the main component. I understand what you are saying but IMO that view is driven by the fact that we are talking about "components" which is a RAD thing, thus design-time stuff, monolithic design and so on. I'm designing this like I would if there was no design-time to influence things. If I hadn't gotten this to work then the events simply wouldn't have been accessible at design-time. In fact, at the moment the sub-properties are objects that are statically created by the component. The next stage is to make the class type of the objects dynamic and configurable at design-time. And then there's no way I could expose those event on the component because they wouldn't be known at compile-time. So instead of a single class that handles many different button styles (like I have now - see screenshot): property ButtonOptions: TButtonOptions read FButtonOptions write SetButtonOptions; I will get one class for each button style: property ButtonOptions: TCustomButtonOptions read FButtonOptions write SetButtonOptions; property ButtonOptionsClass: TButtonOptionsClass read FButtonOptionsClass write SetButtonOptionsClass; and each class will expose the properties that are relevant to that style. -
ANN: JetPascal Sneak Preview and Early Bird Program
baoquan.zuo posted a topic in Delphi Third-Party
JetPascal is a new code assistant for Delphi developers. Our goal is to be a fast, reliable, and intelligent code assistant for Delphi developers, supporting both RAD Studio and Visual Studio Code. The product is still in early stages. The current Insiders version includes these navigation and search features (inspired by Visual Studio Code) for Delphi XE7-12.3. Go to File Go to Project Go to Line Go to Symbol in Editor Delphi Source File VCL/FMX Form Go to Symbol in Workspace Go to Definition Go to Type Definition Go to Base Symbols Go to Derived Symbols Go to Implementation Go to Containing Declaration Peek Definition A few demos: - Go to Symbol in Source Editor - Go to Symbol in Form Editor (Go to component, property, and event in form designer.) - Go to Implementation To see the more demos, the status, and the roadmap of the product, please visit JetPascal page. You can also try it by download the Insiders version. Early Bird Program We are offering special Early Bird Price—significantly below the upcoming standard rate—while we finalize key features. This offer applies to both Commercial and Personal subscriptions and is open to new users now. Note: Legacy CodeInsightPlus customers can request our standard renewal price throughout 2025. -
Nice thought experiment
-
I've written some code, which is part of my AI demonstration project at https://github.com/geoffsmith82/Symposium2023/ . I currently have a Weather MCP demo. See https://github.com/geoffsmith82/Symposium2023/tree/main/MCP for the demo project code and https://github.com/geoffsmith82/Symposium2023/tree/main/Libs/MCP for the reusable section. I have had it running in Claude desktop. To get the weather you will need to sign up to https://www.weatherapi.com/signup.aspx and get an API Key. Compile and run the TestAPI project and add the API Key via the Settings->API Keys menu item and find "WEATHER_API_KEY" in the list and add in the key there. In the claude_desktop_config.json, it will need to look something like below. Make sure you update the path to were the exe file is actually located. { "mcpServers": { "WeatherMCPService": { "command": "Z:\\Programming\\Symposium2023\\MCP\\WeatherMCPService", "protocol": "stdio", "args": [] } } } Here is what it looks like in claude desktop. Currently working on some other ideas for an MCP, but the code should be enough to get you started.