Dave Novo
Members-
Content Count
139 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Dave Novo
-
How to get pointer to record at the top of TStack<T>
Dave Novo posted a topic in RTL and Delphi Object Pascal
I have a section of code where I need to modify the top record on a stack. This code is supposed to be highly performant, so I would like to optimize it as much as possible. I would like to get the top record of the stack without popping and pushing it. The record is somewhat complex, so copying the data back and forth to a temporary record is silly. A sample program is below type TMyRec=record s:string; end; PMyRec=^TMyrec; var stk:TStack<TMyRec>; rec:TMyRec; prec:pMyRec; begin stk:=TStack<TMyRec>.Create; rec.s:='Hello'; stk.push(rec); prec:=@stk.Peek; // get error “variable required” prec.s:=’Goodbye’; stk.Free; end; Seems like @stk.Peek is returning the address to the Peek method, not the pointer of the element being returned by the peek method. I have tried casting in various ways but it never compiles properly. Any ideas? -
How to get pointer to record at the top of TStack<T>
Dave Novo replied to Dave Novo's topic in RTL and Delphi Object Pascal
In Delphi Seattle, there is no List array property. The internal array is called FItems and it is Private. -
How to get pointer to record at the top of TStack<T>
Dave Novo replied to Dave Novo's topic in RTL and Delphi Object Pascal
I wanted to modify the top record of the stack, without removing the record from the stack. Seems like with the way records work (copies all the time) that may not be possible with the current TStack implementation, given the intermediate records that are along the way. With our own structures, in situations that require it, we do take the effort to ensure there are no intermediate records and we get direct access to the address of the record we want to modify. I had not considered that the result of Peek would actually be a copy of the record at the top of the stack. -
How to get pointer to record at the top of TStack<T>
Dave Novo replied to Dave Novo's topic in RTL and Delphi Object Pascal
@Mahdi Safsafi - thank you. Very clever! -
Disadvantage of using defined type of TArray?
Dave Novo replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
@David Heffernan Which refactoring tool do you use that reliably will change some scenario where you have lots of places across lots of units where you had something like procedure SomeProc var myList:TList<TFoo> begin myList:=TList<TFoo>.Create then you want to change all places from TList<TFoo> to TObjectList<TFoo>. So the refactor would presumably change the variable declarations and the .Create calls across all the units. It really does not work reliably for us and we have lots of search..replace with invetiable 10 minutes of compiling churn to get it all right. We tend to do TFooList=TList<TFoo> and just use TFooList everywhere for this reason. If the refactoring tools worked well, it would make that less necessary. -
I am not sure what @salvadodrf wants the automation for, but for me it is for testing. The debate over the utility of GUI unit testing has been beaten to death all over the internet. The advantages/disadvantages over mocking your entire system can be found all over. Without getting into a religious debate over whether or not GUI testing is good, I am just wondering if there already exists FMX tools to allow you to drive the GUI for an FMX app like the SendInput app does for Windows. Of course, SendInput alone cannot do everything, you have to combine with VCL methods to find coordinates of controls etc, but SendInput is really the key and I have not found an analog under FMX.
-
related to this, one key to the testing harness that we wrote for VCL is the SendInput windows API Does anyone know if there is an analog for FMX that works across platforms? We really only care about OSX for mac. But knowing android and iOS would be helpful for others.
-
pre-generic dictionary class
Dave Novo replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
I would suggest having a look at https://www.amazon.com/Tomes-Delphi-Algorithms-Data-Structures-ebook/dp/B007FKB0EI It has all those basic data structures for pre generic delphi. IIRC the code is all open source. If you can find an old version with the CD you might not even have to type anything in. I will see if I have a copy of the code in the office and will attach it here if I find it. -
Using Delphi in Virtual machine for a month
Dave Novo replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
We have been using Delphi in a VMWare Workstation for over a decade. We have a team of about 12 people. Some remote workers use Delphi in a Citrix instance run on our XenDesktop environment. A decade ago, there were lots of problems. Windows activation issues. Delphi activation issues. etc. But we stuck with it because it ensured all team members have an identical instance set up appropriately. Also, if one computer crapped out, we were up and running within 20 minutes. These days, its a no brainer. We dont even have Delphi installed directly on the host machines any longer, so I cannot compare to a host installation on the same machine, but running in the VM is more than acceptable. All benchmarks we have run (i.e. running same executable inside vm and on real machine) are within 95% speed of each other. For profiling, we dont even both copying to the host machine any longer, unless we are profiling heavy multi-threaded work. What does make a big difference is to put the VM on an SSD. Compile times are much faster. Our App is about 2 million LOC, but we ensure that our individual units are not too large. Usually a few K LOC, up to a max of 20K LOC or so. CTRL+END is pretty instant for me, even in the largest units. Maybe we would get 1/2 sec better on some mouse actions if we installed it on the desktop, who knows, but I personally do not notice any speed impediment due the to the VM. My typing speed is usually the bottleneck, not the IDE (and I type pretty fast). -
How to Export a PowerPoint PPTX File?
Dave Novo replied to Steve Maughan's topic in Delphi Third-Party
I have never tried it, but I know this exists https://www.winsoft.sk/doffice.htm -
Is there a component that allows me to include proper digital signatures
Dave Novo posted a topic in Delphi Third-Party
Hello, When signing a PDF, you can use a proper digital signature. Note in the attached screenshot, you can use a certificate from the System or from a file. You can even create new certificates etc. Are there any third party components that handle the details of this, i.e. reading/validating the certificates. I want my users to be able to sign the documents that my application makes. We have a basic digital signature system already, but not one that supports certificates etc. -
Is there a component that allows me to include proper digital signatures
Dave Novo replied to Dave Novo's topic in Delphi Third-Party
HI Emil, I do not want to sign a PDF however. I want to be able to implement signing on my own custom documents. But still using a "industry standard" signing mechanism. -
Is there a component that allows me to include proper digital signatures
Dave Novo replied to Dave Novo's topic in Delphi Third-Party
I want to implement the same standard (ideally) that Adobe PDF implements. It seems there are a few standards https://en.wikipedia.org/wiki/PAdES https://www.cloudsignatureconsortium.org/ Seems like there are already "trusted" companies that can generate the signing certificates in the proper way, and also you can create your own certificates somehow. I dont know all the technical details of how this works though, I was hoping that someone already implemented it. -
Is there a component that allows me to include proper digital signatures
Dave Novo replied to Dave Novo's topic in Delphi Third-Party
In as much as if you saw my signature on any piece of paper, like credit card receipt, then stole my checkbook, then scanned both together and issued forged checks, you could try to do so I guess. This somehow embeds a real certificate of some sort into your document. Here is a bit of an overview of what they are doing, but it is light on technical details https://helpx.adobe.com/acrobat/11/using/digital-ids.html I think there is an open standard that governs these kinds of digital signatures.