Jump to content

Lajos Juhász

Members
  • Content Count

    1078
  • Joined

  • Last visited

  • Days Won

    15

Posts posted by Lajos Juhász


  1. 10 minutes ago, Sherlock said:

    Given the complexity and the tendency of developers to always suggest some totally different approach :classic_biggrin:, here is my completely different suggestion. You seem to have the need to validate an e-mail address before storing it. How about sending a test mail before doing that. That way you get to birds with one stone: Verify the address, and get the permission to use it... a must have in Europe.

    This is an excellent suggestion. I doubt it is a must in Europe, I still receive sensitive information for other people in my e-mail account. 


  2. 4 minutes ago, Anders Melander said:

    Even if you don't have a need to write assembler, knowledge of it makes you a better developer because it gives you a deeper understanding of what's going on and why. The same goes for hardware.

    I wrote that in context that Asm has more than twice the rating of Delphi.  I simply cannot believe that's true. 


  3. 16 hours ago, David Heffernan said:

    Stefan is talking about a different algorithm, modified binary search algorithms know as lower or upper bound binary search. Kind of the entire point of this topic.

    My point was with that Wikipedia link that modified algorithms have their names. Like in the link the variation to find the elemest with lowest index is called binary_search_leftmost and not binary_search.

     

    16 hours ago, Anders Melander said:

    Wikipedia (even though it references the almighty Knuth) isn't the definition". It's a definition.

    That's true, but most developers expect that if an implementation reference to an algorithm it will implement that algorithm and not something else. That was the whole point to name algorithms in matemathics and computer science. That no matter from where you learned an algorithm you know how it works.

    • Like 1

  4. 3 hours ago, Stefan Glienke said:

    Not true - in a lower bound binary search you keep on binary searching until your range got down to 1 element - with a loop you turn O(log n) into O(n)

    This is the definition of the binary search: https://en.wikipedia.org/wiki/Binary_search_algorithm

     

    "The procedure may return any index whose element is equal to the target value, even if there are duplicate elements in the array. For example, if the array to be searched was {\displaystyle [1,2,3,4,4,5,6,7]}{\displaystyle [1,2,3,4,4,5,6,7]} and the target was {\displaystyle 4}4, then it would be correct for the algorithm to either return the 4th (index 3) or 5th (index 4) element. The regular procedure would return the 4th element (index 3) in this case. It does not always return the first duplicate (consider {\displaystyle [1,2,4,4,4,5,6,7]}{\displaystyle [1,2,4,4,4,5,6,7]} which still returns the 4th element). "

     


  5. 30 minutes ago, David Heffernan said:

    Interestingly, if the process has UTF-8 as the active code page (ccchttps://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page) then you can use AnsiString fine and be fully Unicode compliant. I discovered this by accident lately when my MATLAB mex file, which uses ANSI because MATLAB doesn't do UTF16, unexpectedly started handling Unicode with a recent MATLAB update! The update set this code page in its manifest. 

    Yeah, and breaks FireDAC as it converts from UTF-16 using the language for non-unicode programs instead of using conversion from client locale to server locale.


  6. 8 minutes ago, David Heffernan said:

    Thanks for the correction. The main point stands, namely that Chr(11200) is perfectly valid.

    This is true for strings. However in the example it's used to assign the value to ansistring:

     

    var
      MyAnsiString: AnsiString;

     

    AnsiString is not a unicode string thus there is no chr(11200) most probably the code page of the ansistring will have no conversation for that unicode code point thus will be converted to ?


  7. At least I won this bet. You should always post the parent class as don't everyone will have the complete source. By openning the System.Classes.pas it's clear what to do:

     

    procedure TCustomMemoryStream.SetPointer(Ptr: Pointer; const Size: NativeInt);

     

    change the method signature to match.


  8. You should at least provide a compiler error message. From here we don't know which class it's inherited from.

     

    I don't like to gamble but will make an exception my guess is that you should change the parameters of the method to match the signature from the parent class?


  9. Yes you can, before you compile the package uninstall all the packages that depends on that one. That should improve the situation.

     

    Unfortunately this is a "known" issue and impossible to report (as it's hard to make the required test case).

     

    PS. For a project group I even have a situation that some days Access Violation is almost every time triggered when I compile an application without runtime packages.


  10.  

    uses
      Xml.XMLIntf, Xml.XMLDoc;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      MyXMLDocument : IXMLDocument;
      FounderNode : IXMLNode;
    
    begin
      MyXMLDocument := TXMLDocument.Create(nil);
      MyXMLDocument.Active := true;
      MyXMLDocument.Version:='1.0';
      MyXMLDocument.DocumentElement := MyXMLDocument.CreateNode('ab', ntElement,'');
      MyXMLDocument.DocumentElement.DeclareNamespace('xsi', 'https://www.guru99.com/XMLSchema-instance');
      MyXMLDocument.DocumentElement.DeclareNamespace('xsd', 'https://www.guru99.com/XMLSchema');
      MyXMLDocument.DocumentElement.SetAttributeNS('xmlns', '','MyString');
    
      FounderNode := MyXMLDocument.DocumentElement.AddChild('founder');
      FounderNode.NodeValue:='Krishna';
    
      MyXMLDocument.SaveToFile('TestOne01.XML');
      MyXMLDocument.Active := false;
    end;

    You have to set the version and MyString should be the 3rd parameter not the second one.

    • Like 1
×