Dave Novo
Members-
Content Count
139 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Dave Novo
-
How to enter unicode symbols into the Delphi IDE
Dave Novo replied to Dave Novo's topic in Delphi IDE and APIs
ugh. sorry, I was in the middle of creating a whole bunch of templates for different greek letters and was copying and pasting. Just change the \alpha to \sigma. Or replace the sigma symbol inside the CDATA and Description with an alpha. The other thing I found is that the template above will not insert the symbol into a comment. if you change the context to "comments" then it does, although seems to sometimes put it in the wrong spot when inside the comments. It seems to work fine in the method body. Also, inside the comment it is intermittent if it works automatically or you have to press CTRL+J or Ctrl+Space after entering the template name. Below is the alpha template <?xml version="1.0" encoding="utf-8" ?> <codetemplate xmlns="http://schemas.borland.com/Delphi/2005/codetemplates" version="1.0.0"> <template name="\alpha" invoke="auto"> <description> inserts the α symbol based on the latex syntax </description> <author> David Novo-Lake </author> <code language="Delphi" context="comment"><![CDATA[α]]> </code> </template> </codetemplate> -
Hello, I know I can do the following to restrict the valid range of integer variables. TNBType= 1..2; Can I do something similar with floating point. For example, I want to restrict the values of a double precision variable to be between 0.0 to 1.0. I have tried the following TProbabilityValue=0.0..1.0; TProbabilityValue:double=0.0..1.0; TProbabilityValue:double=0..1; none of the above seem to work. I guess this is not possible, but I figured I would ask.
-
restricting floating point range
Dave Novo replied to Dave Novo's topic in RTL and Delphi Object Pascal
Thanks for the suggestions. I was looking for compiler support instead of rolling my own, but all the suggestions above are great. -
How to enter unicode symbols into the Delphi IDE
Dave Novo replied to Dave Novo's topic in Delphi IDE and APIs
As an update to this, I found a lot of success using Live Templates. It is a pain the butt to create all of them, but once they are working, then its is pretty easy. Please see here how to create the live template. An example of one that inserts the alpha symbol is below. Simply type /alpha<space> and you are good to go. <?xml version="1.0" encoding="utf-8" ?> <codetemplate xmlns="http://schemas.borland.com/Delphi/2005/codetemplates" version="1.0.0"> <template name="\alpha" invoke="auto"> <description> inserts the σ symbol based on the latex syntax </description> <author> David Novo-Lake </author> <code language="Delphi" context="methodbody"><![CDATA[σ]]> </code> </template> </codetemplate> -
How to enter unicode symbols into the Delphi IDE
Dave Novo replied to Dave Novo's topic in Delphi IDE and APIs
Thank you everyone for all your great ideas! -
Hello All. If I create the following simple console application program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.Classes, System.SysUtils, System.IOUtils; var combinedPath:string; curPath:string; begin try combinedPath := TPath.Combine(ParamStr(0),'..\..\..\'); curPath:=TPath.GetFullPath(combinedPath); var f:=TFileStream.Create(curPath+'file.txt',fmCreate); f.free; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. everything works fine. I hover the mouse over the string variables and it pulls up the values, and I can view them in the watch list. However, if I make this slight change to use the new Delphi language features program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.Classes, System.SysUtils, System.IOUtils; begin try var combinedPath := TPath.Combine(ParamStr(0),'..\..\..\'); var curPath:=TPath.GetFullPath(combinedPath); var f:=TFileStream.Create(curPath+'file.txt',fmCreate); f.free; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. then when I hover the mouse over combinedPath, or curPath, nothing happens. If I enter them into the watch list I get Is there any way around this behavior. I like this new language feature, but if I cannot debug my variables then it is not very helpful.
-
Delphi 11.2 Linker eliminating symbols
Dave Novo replied to Dave Novo's topic in RTL and Delphi Object Pascal
For reference, I added this bug report https://quality.embarcadero.com/browse/RSP-40502 -
Delphi 11.2 Linker eliminating symbols
Dave Novo replied to Dave Novo's topic in RTL and Delphi Object Pascal
Now I finally have an excuse to live a long and healthy life 🙂 -
Delphi 11.2 Linker eliminating symbols
Dave Novo replied to Dave Novo's topic in RTL and Delphi Object Pascal
I see, so this is just a problem because I am in the global begin..end block of a console application? -
The best way to handle undo and redo.
Dave Novo replied to skyzoframe[hun]'s topic in Algorithms, Data Structures and Class Design
There is a nice Delphi specific design patterns book as well. https://www.amazon.com/dp/1789343240 For databases, I know interbase is supposed to be designed that it stores transactions as part of its structure, which makes it easier to roll back. -
TMethodImplementation and its uses
Dave Novo replied to pyscripter's topic in RTL and Delphi Object Pascal
Of course I read your post. But I am unclear what could not be handled using anonymous methods? i.e. while the code in procedure ImplCallback(UserData: Pointer; const Args: TArray<TValue>; out Result: TValue); has a very general method signature, in actuality every implementation has to know exactly how many args are going to come in the args array, and exactly what they are going to mean. So why can you not wrap the python code in an anonymous method and then pass the anon method to delphi. I am unclear of what the example of why you would need a method stub. -
TMethodImplementation and its uses
Dave Novo replied to pyscripter's topic in RTL and Delphi Object Pascal
Hello, While technically this seems cool, why is this particularly useful? I see that I can create an event handler without an explicit object that will implement the event handler method. Why would I need to do this? If I needed this, would I not simply design my class to accept anonymous methods? Or is this for a trick to allow classes not designed to handle anonymous methods to actually handle them? -
Hello, This is a very old school way of saving data. Probably from Pascal in 1980. You should not do it this way any longer. I would do something as follows (note, I am writing this without testing syntax) TCustomer= record CompanyName:String[255]; SpotsAllocated:Integer; LicensePlates:String[255]; Parked:string[255]; procedure SaveToStream(aStream:TStream); procedure LoadFromStream(aStream:TStream) end; TCustomerArr=array of TCustomer; TCustomerArrHelper=record helper for TCustomerArr procedure SaveToStream(aStream:TStream) procedure LoadFromSTream(aSTream:TStream) procedure SaveToFile(const aFileName:string); end; procedure TCustomer.SaveToSTream(aStream:TStream); var ver:integer; begin ver:=1; // always save a version number in case you change the record format in the future aStream.WriteBuffer(ver,sizeof(ver)); // call aStream.Write for other fields end; procedure TCustomer.LoadFromSTream(aStream:TStream); var ver:integer; begin aStream.ReadBuffer(ver,sizeof(ver)); if ver<>1 then raise Exception.Craete('Version mismatch'); aSTream.ReadBuffer();// one readbuffer to match the writes above end; procedure TCustomerArrHelper.SaveToStream(aStream:TSTream); var ver:integer; cust:TCustomer; begin ver:=1; aStream.WriteBuffer(ver,sizeof(ver)); myLen:=Length(self); sTream.WriteBuffer(myLen,sizeof(mylen)); // save the length, you will use the length when reading in to allocate the array size for cust in self do cust.SaveToSTream(aStream); end procedure TCustomerArrHelper.LoadFromStream(aStream:TSTream); var ver:integer; myLen:integer; cust:TCustomer; begin aStream.ReadBuffer(ver,sizeof(ver)); if ver<>1 then raise Exception.Craete('Version mismatch'); aSTream.ReadBuffer(myLen,sizeof(mylen)); SetLength(self,myLen) for cust in self do cust.LoadFromSTream(aStream); end procedure TCustomerArrHelper.SaveToFile(const aFileName:string); var f:TFileStream; begin f:=TFileStream.Create(aFileName,fmCreate); try someCustArr.SaveToSTream(f); finally f.free end end
-
The TRichview forums are excellent. You should post your questions there. Firstly, I am sure that question is answered there if you search, and if not, Sergey (the main developer) will give you a detailed answer. i.e. https://www.trichview.com/forums/viewtopic.php?p=35009&hilit=insert+picture#p35009
-
Sad news I feel https://community.devexpress.com/blogs/ctodx/archive/2020/12/02/fmx-grid-future-plans.aspx For those of us hoping to port our VCL applications with minimal fuss one day. There are a few other FMX grids available, but at least on the VCL side, none of them are as good as Dev Express grids.
-
Hello, I wonder if anyone has encountered this before. Delphi 11.1 (initial release) was running fine on the computer (Win10). We tried to install Patch 1 according to the instructions at https://blogs.embarcadero.com/rad-studio-11-1-alexandria-patch-1-available/ using the "manual mode". Basically we opened the patch ZIP file and manually copied the files within the zip over the previous Delphi 11.1 files that were there. We did it folder by folder just to be paranoid and ensure we were copying the correct thing. We then restarted Delphi, and the IDE seems to start up, but when we get past the little startup wizard we get Does anyone have any idea why Patch 1 would trigger this problem. There is nothing trying to be loaded from a network location. All files were replaced in the standard delphi installation folders.
-
problem upgrading to Delphi 11.1 Patch 1
Dave Novo replied to Dave Novo's topic in Delphi IDE and APIs
We have a license server internally. -
problem upgrading to Delphi 11.1 Patch 1
Dave Novo replied to Dave Novo's topic in Delphi IDE and APIs
We are trying to create a template machine that all developers can use. We dont want to have to have a script that all developers have to do manually, i.e. run GetIT, do X, do Y. The base machine should be setup that we just create virtual machines, join them to the domain, and developers login and are up and running. In fact, we are setting up the entire machine via Ansible, so its completely automated, documented and under version control. This ridiculous patch issue is our last issue. I dont see why when they release a patch then EMB cannot rebuild an installer with the patch incorporated. -
There is no way for Python to know about the objects/functions in your delphi program. You have to create some classes and register them with the Delphi4Python to expose them to the python side. These can be your real classes in your application (not advised IMHO), or "bridge" classes that just expose functions to python. Then, in your implementation of the bridge methods, you call methods/functions on the delphi side.
-
Pascal source code of Vidi Language, just published
Dave Novo replied to david berneda's topic in I made this
That has always been my dream, to have the spare time to create the "perfect" programming language! Good on you. -
Problems with installing RAD Studio 11 in Wine
Dave Novo replied to AntiClasxson1958's topic in Delphi IDE and APIs
We deploy our compiled app for mac in Wine, via codeweavers, and it works great. It is a very sophisticated UI with many 3rd party components. However, I admit we have not tried to run the Delphi IDE in WINE. -
Problems with installing RAD Studio 11 in Wine
Dave Novo replied to AntiClasxson1958's topic in Delphi IDE and APIs
The latest version of WINE is 7.0. You are using a very, very old version and trying to use the latest software with that. I would guess you are really shooting yourself in the foot trying to get it to work in a few year old version of WINE. -
When installing Delphi 10.4.2 or Delphi 11 it prompts me to install the Windows Software Development Kit. With lots of options (see below). What do I need that for? Are any of the things in the Development Kit necessary for Delphi to run properly? Or are these ancillary tools and/or libraries that are completely optional?
-
Thanks for all the help. Out of curiosity, aside from the SDK docs, which are easily available on the internet and we use all the time, are there any particular tools from the Windows SDK that you recommend? We use Innosetup for creating installers and it seems to have what we need. Although maybe it uses the MSIX from the SDK installed with Delphi behind the scenes, I have never checked that deeply.
-
This comes up as part of the install of both Delphi 10.4.2 and Delphi 11.