Jump to content

Jacek Laskowski

Members
  • Content Count

    267
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Jacek Laskowski


  1. Code:

    var
      lXML: IXMLDocument;
    begin
      lXML := TXMLDocument.Create(nil);
      lXML.ParseOptions := [poResolveExternals, poValidateOnParse];
      lXML.LoadFromFile('test_.xml');

    and test file for load:

    <?xml version="1.0" encoding="UTF-8"?>
    <tns:JPK xmlns:tns="http://jpk.mf.gov.pl/wzor/2017/11/13/1113/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:etd="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2016/01/25/eD/DefinicjeTypy/" xsi:schemaLocation="http://jpk.mf.gov.pl/wzor/2017/11/13/1113/ http://www.mf.gov.pl/documents/764034/6145258/Schemat_JPK_VAT%283%29_v1-1.xsd">
      <tns:Naglowek>
        <tns:KodFormularza kodSystemowy="JPK_VAT (3)" wersjaSchemy="1-1">JPK_VAT</tns:KodFormularza>
        <tns:WariantFormularza>3</tns:WariantFormularza>
        <tns:CelZlozenia>0</tns:CelZlozenia>
        <tns:DataWytworzeniaJPK>2020-07-23T12:49:30.000Z</tns:DataWytworzeniaJPK>
        <tns:DataOd>2020-06-01</tns:DataOd>
        <tns:DataDo>2020-06-30</tns:DataDo>
        <tns:NazwaSystemu>test</tns:NazwaSystemu>
      </tns:Naglowek>
    </tns:JPK>
    
    

     


  2. I need to validate an XML file that has references to XSD files, I use TXMLDocument for that. But during this validation, which is done in a thread, the MSXML bni library displays me a window asking for permission, it looks like this:

     

    image.thumb.png.4f95aa4fd0ead23eedb97044e2cf843a.png

     

    The message in english is: "This page is accessing information that is not under its control. This poses a security risk. Do you want to continue?"

     

    Is it possible to confirm this question from the code level or disable the message?

    And I know it is hidden in the internet options of the system, but I do not have access to clients' computers and I have to bypass it in the code.


  3. 52 minutes ago, Uwe Raabe said:

    I think that would be too much of a hassle, especially when you are working with relative paths and/or want to configure that on a per project/-group level. One could even throw wildcards in there to complicate things further.

    I also use relative paths in the project, but in the end each path is absolute. And probably others, like me, have some common folder with external libraries (in my case d:\work\libraries) which as a whole could be excluded and the problem would disappear.

    52 minutes ago, Uwe Raabe said:

    You can either switch off that feature or make the offending files read-only.

     

    BTW, I also get these LF problems with Spring4D all over the place, but I usually don't debug it. Interestingly, up to now it seems to be the only library with this hickup. 

    Fortunately, git can be configured so that "on the fly" it changes the end of line characters to the ones we prefer and does not treat this as changed sources, so everything works fine. Thanks to this Spring4D has a CRLF at the ends of the line.


  4. Great @Uwe Raabe!
    In that case I will add one more thing I came across. Before I was touched by the problem "Unable rename ..." I was struggling with strange behavior of the environment while debugging the code. When I pressed the F7 key while standing cursor on the line with a Spring method call, IDE went to Spring4D sources and then the weird thing happened. The cursor was standing on the first line of the unit (not in the method) and the Spring file was marked by the IDE as modified (asterisk next to the name).

    I was looking for a long time for the reason before I came across that Project Magician has end of line correction option set and at the same time my git configuration under Linux didn't force the end as CRLF but Spring files had LF at the end of line!

    In such a situation Magician was changing line ends and debugger was stupid. And I was with him :classic_wink:

     

    Maybe it is worth to add an exclusion path for this Magician function?


  5. @Uwe Raabe

     

    Perhaps it would be worth adding a function to the Project Magician that will scan the project files and their paths and check if the actual paths on the disk are the same case sensitive?
    I know it's not very useful for most programmers, but the workload is small, and such a feature can sometimes save a lot of time. Besides, for programmers who like to keep their projects in order (and that's what Magician is for) even if everything works, it may be important to have the correct paths.

     


  6. After a few hours of fighting I discovered the cause of the problems... Maybe somebody will meet with it one day and I'll give you a solution.
    As I wrote I migrated from Windows to Ubuntu and converted the disk from NTFS to Ext4. As you know Linux systems are case sensitive and so is Ext4.
    Although the files had the correct name, it turned out that in the dpr and dproj files the paths to some files sometimes had the name "\Services\" and sometimes "\services\" and that was the reason.

    After correcting the contents of dpr and dproj to the correct directory names, all errors disappeared.

     


  7. I have been using VMware Workstation for years, the host system is Windows 10, the virtual machine works under Windows 7, where I have Delphi 10.3 installed. It always worked well. External project and library files are on a disk shared by VMware mechanism called "Shared folders", in the virtual machine they are available as a network disk, which I map to the letter D:\

     

    A month ago I built a new computer on Ryzen, and installed Ubuntu as the host system. Under Ubuntu I installed VMware Workstation and moved a virtual machine containing Delphi from the old computer. I've converted the disk file system with projects and libraries from NTFS to Ext4 and it's also shared by "Shared folders". Everything was ok until it turned out that I couldn't make a change in Spring.inc file from Delphi level. But for example, by notepad the change was successful. I couldn't find an explanation, so I worked until now.

     

    Since yesterday I have the same problem with one of the files in my project. Trying to save (ctrl+s) changes in *.pas file ends with an error message:

    "Unable to rename ...\path\filename.pas to ...\path]\__history\filename.pas.~20~"
     and the file does not save, only a copy of it with the extension *.$$$ next to the source file is created, all this can be seen in the screenshot:

     

    image.thumb.png.1a8cb09924b24d94fa54b789001b7c4c.png

     

    It seems that the internal (Delphi) file versioning mechanism has some problem with this file. But I've been editing other files from the same project for a month now and I haven't had such problems (except for Spring.inc - outside the project).
    This is not a problem of permissions in the Ext4 file system, because I checked and the permissions are identical with all the project files. I also checked the file edition with notepad and rename with move with shell command "mv" - also without any problem.

     

    What can be the cause and what else can I check?

     

     


  8.  

    I create an array of arrays, then assign the data in whole rows (array).

     

    Example code:

     

    program Project1;
    
    {$APPTYPE CONSOLE}
    
    {$R *.res}
    
    uses
      System.SysUtils;
    
    var
      lValues: array of TArray<Variant>;
    
    procedure TestAddRowData();
    var
      lRow : TArray<Variant>;
    begin
      SetLength(lRow, 3);
      SetLength(lValues, 3);
    
      lRow[0] := 'one';
      lRow[1] := 1;
      lRow[2] := '1one';
      lValues[0] := lRow;
    
      lRow[0] := 'two';
      lRow[1] := 2;
      lRow[2] := '2two';
      lValues[1] := lRow;
    
      lRow[0] := 'three';
      lRow[1] := 3;
      lRow[2] := '3three';
      lValues[2] := lRow;
    end;
    
    
    begin
        TestAddRowData();
        Writeln(lValues[0, 0]);
        Writeln(lValues[0, 1]);
        Writeln(lValues[0, 2]);
        Writeln(lValues[1, 0]);
        Writeln(lValues[1, 1]);
        Writeln(lValues[1, 2]);
        Writeln(lValues[2, 0]);
        Writeln(lValues[2, 1]);
        Writeln(lValues[2, 2]);
        Readln;
    end.
    

    Results:

    three
    3
    3three
    three
    3
    3three
    three
    3
    3three

     

    I expected to get all the data according to their addition...

     

    Isn't there a Copy on Write rule for arrays?


  9. Extension's cool and needed. Thanks for that!


    After a minute of use, I see one flaw... if I have a lot of code cards open, the window with ListBox does not scroll and pressing the Tab key hides the cursor outside the window after a while.


  10. MMX from several versions already works really well, does not slow down, does not suspend the IDE, works quite smoothly. Thanks!


    I have only one more problem with it. Unfortunately I can't find the rule, although I've been looking for a month.
    Sometimes, very rarely, after editing a method in a class by ctrl+E and after approving the editing window by enter, MMX flips the header of the edited method from the public section just below the name of the class, as shown in the picture below. This problem is from about 3 versions back.

     

    vps_2020_07.01_01.thumb.png.a745c91a0ff948fcd287070ed141f5f1.png


  11. I'm updating the MMX, setting the cursor on the method, press ctrl+E and...

     

    vps_2020_06.30_03.thumb.png.57633a34cf52edf71876c206c025121c.png

     

    The same thing happens when I try to enter the MMX options (menu MMX -> Properties...)

     

     

    I've traced that MMX looks for FontName and FontSize in the registry, in the IDE settings in the Theme subnode, if there are no FontName and FontSize, this is an exception. I don't have these settings.

    I've written it down and it works, but... something is wrong.

     

    Delphi 10.3

×