Jump to content

Dave Novo

Members
  • Content Count

    131
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Dave Novo


  1. Hello all,

     

    If you go to the Delphi help

     

    Docking (Delphi) - RAD Studio Code Examples (embarcadero.com)

     

    You see if refers to a "docking demo". The general help for the built is docking is woefully inadequate.

     

    If you go to 

    RAD Studio Code Examples (embarcadero.com)

     

    You find that the code examples are supposed to be at 

    Embarcadero Technologies · GitHub

    or

    GitHub - Embarcadero/RADStudio11Demos: Delphi and C++Builder Demos for Embarcadero RAD Studio version 11

     

    I cannot find a docking demo in either location. Has this been removed from the demos? Or am I just going crazy and its really there. Searching the github for the work "dock" and also cloning the repo and searching for "dock" does not turn up any files


  2. Hello, 

     

    Is there an example of how TPropertyChangedEventArgs and associated infrastructure is supposed to be used?

     

    I am hoping there is some magic somehow where I can get a notification that a property changed on a class, without having to modify the source of that class to throw an event. Not sure how this would be done, magic code hooks, VMT hijacking or some other craziness. But when I see some of the magic in Spring4D, I can believe that almost anything is possible 🙂


  3. I never meant to imply that it was unnecessary. In fact, I already applied your excellent code to my own code that was writing out CSV files from large 2D matrices of integers. I was just wondering if there was a wider variety of circumstances that I could also leverage this technique that I was not thinking of. 

     

    In fact, I also have to write out large matrices of floating point values, so will try to modify the Delphi float conversion routines to work on array of char similar to what you proposed below. 

     

    TBH though, I have not done much timing. I wonder if the overhead of writing the file to disk dwarfs the time it takes for the conversions. 


  4. I am trying to understand when this stack based allocation can practically help, because it seems to me that for the most part, you usually are going to have to do something with this array of char, and inevitably transform it to a string which will do some heap allocation and copy the stack data.

     

    The one thing that pops to my head is if saving a large number of integers to a file (as strings of course), when you can write to the file directly from the char buffer allocated on the stack. Then you avoid any heap allocation for a large number of conversions.

     

    Are there many other circumstances where you can avoid the eventual conversion to a heap allocated string and reap the benefits of the stack based memory allocation? It seems limited to areas where you are doing large numbers of IntToStr and only need to keep the string value within the local method within the loop.

    • Thanks 1

  5. 15 hours ago, Stefan Glienke said:

    A serious question because many sort benchmarks are so obsessed with sorting large arrays/vectors of just integers and floats:

    Do people in reality really have these kinds of data that need to be sorted?

    We write software that does scientific data analysis. We regularly have to sort arrays of millions of elements of data. But I recognize we are in the minority of developers.

    • Like 1

  6. I figured it out. You have to close the TestRunner Gui properly. Since my test was failing (i.e. crashing) the GuiRunner never closed properly because I stopped running the program after the crash. I had expected that the Guirunner would save the selected tests prior to the test run started. 


  7. Hello,

    Does anyone have any idea why my TestInsight could have dissapeared. I do not see it in the View menu, nor can I right click on a project and make it a "test insight" application (ie it just adds the TESTINSIGHT compiler directive".

    I have uninstalled/reinstalled testinsight 3x already. I am using version 1.2.0.0 that I just installed.

     

     


  8. I am a newbie to DunitX so this may be a dumb question. 

     

    If I select some tests to run in the VCL GUI logger, they run fine.

    When I recompile my app, all the tests are selected again, even though previously I only selected one.

    Is there a way to have the VCL GUI logger remember my previous selections so I dont have to keep selecting the same things?


  9. I agree with Darian. We have hired many good Devs in the past with and without Delphi experience. Of course the good Devs with no Delphi experience are already good Devs by any definition i.e. smart, know OOP well, diligent workers. But lets face it, the RTL/VCL is 10s or maybe 100s of thousands of lines of code. You cannot expect a Delphi noob to not take a while to learn even what classes are available and what the methods are. Never mind all the Delphi-isms how to most effectively use them. Never mind how to work around all the bugs in the IDE and all the tricks of the Delphi debugger. Never mind the subtleties of Delphi reference counting that can be different from other libraries. etc. etc. IME it takes at least a few years before a good developer becomes a true good Delphi Developer. 

    • Like 4

  10. 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>

     


  11. 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.


  12. 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>

     

    • Thanks 1

  13. Hello,

     

    I am trying to use some unicode math symbols as variables to make code more readable. But I cannot seem to find out how to insert unicode characters into my source code. I am using the consolas (the default) font in the editor. 

    I saw on the internet some blogs that in other apps you enter the code value and then Alt+X, but that brings up model maker code explorer menu.

    Any tips are appreciated.


  14. 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

    image.png.97b1dd8739a4c64917641840d54e39c1.png

     

    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.


  15. 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.

     

     

×