Jump to content

A.M. Hoornweg

Members
  • Content Count

    447
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by A.M. Hoornweg


  1. I have no idea, it could be a lot of things. Maybe there's less inlining? Or are they finally using a more compact format for RTTI info? Or maybe LLVM is involved now?
    Whatever it is, I find the reduction in executable size impressive (I'm a sucker for efficiency).

     

    I would be interested to know if x86 code has become tighter also?

     

     


  2. A broken drive is much more costly than the price of the hardware alone.

     

    Hard drives *will* fail sooner or later.  I have had at least 8 hdd's fail on me in my career.  Drop a HDD hard and it's probably ruined (at least I wouldn't ever trust it anymore).  If you order a HDD,  you have no way of knowing if it was dropped or half frozen during shipping. SSD's OTOH are very insensitive to shocks and temperature differences. No moving parts!

     

     

     

     

     

     

     

     

     

     


  3. On 8/21/2021 at 7:15 PM, David Heffernan said:

    What's wrong with asking the system to copy a file? 100% you should not be using this buffered file stream code. 

    I avoid it for the following reasons. 

    First of all, the CopyFileEx API documentation does not specify if the source file is opened for shared access or not. So I don't know how it behaves when multiple users are accessing the file and if that behavior may change in future.   

     

    Secondly, when I copy a file somewhere, I emphatically want it to inherit the access properties of the target directory. Otherwise the access rights become unpredictable.   Unfortunately, the CopyFileEx API documentation says "The security resource properties (ATTRIBUTE_SECURITY_INFORMATION) for the existing file are copied to the new file".  I really don't want that to happen.

     

    • Thanks 1

  4. 1 hour ago, David Heffernan said:

    Explicit ordinal values tends to be used for interop with external libs. It's rarely useful for pure delphi code. 

    I very often have the case that I need to parse records in files and data streams where some integer field identifies the type of content that follows. Some of them were generated by software of my own, some by others.  So for that, it is eminently useful:  Instead of declaring tons of constants with prefixes to clarify the context they apply to, one just declares an enum which locks the constants into a common namespace.

     

    For example, look at what Borland did a long time ago in units System.pas and Variants.pas.   It's full of prefixed constants like VarEmpty, VarNull, VarInteger .... where a single enum

     

    type tVariantType=
     (Empty=0,
      Null=1,
      ...)
    
    
    

    would have been much prettier.  This example comes to mind because I need to decode and encode variants quite often.  

    • Like 1

  5. 3 minutes ago, Uwe Raabe said:

    Thank you!

     

    So if I understand correctly, it's just an enum with explicitly defined integer values instead of the default 0...X sequence that the compiler would otherwise generate. 

     

    Too bad, my first impression was that the constants had an implicit associated data type (integer) and that I could use it for stuff like

    Type tnumerals=(
    one='uno',
    two='due')

     

    but that clearly isn't the case.  Too bad.

     

    But still, I think the syntax is very handy for some of my purposes.

     


  6. Hello all,

     

    I recently stumbled upon some code whose syntax was new to me. That doesn't happen too often so I'm slightly overwhelmed.  How do you call this elegant way of declaring constants, and is it documented somewhere? I especially like the implicit association between a type and values.

      

    Type tSomeType=(
      begindoc=$01,
      Newpage=$02,
      enddoc=$03
    );

     

     


  7. Another advantage of VMs is that you're able to do remote debugging and test your software on a different version of Windows than the one you're developing under.

     

    I can easily compile a Delphi application on my Windows 10 development VM, deploy it to a network share on my Windows 7 VM and debug it on that operating system. Piece of cake.  The same goes for Linux.  It's even possible to run MacOS under VMWare, though Apple doesn't allow it unless the underlying host is an Apple machine. 

     

     

    The latest VMWare version can co-exist with Hyper-V on the same host machine by the way.

     

    • Like 2

  8. 16 hours ago, Joseph MItzen said:

    I've never encountered anyone except Delphi users who develop inside VMs. Seriously, no one else. I'm not sure why you'd want to do it either. You're going to end up with less RAM, slower CPU, slower disk access, and the need to maintain two OSes now. I can understand testing in a VM where isolation and reproducibility are important, but I don't understand the advantages of using a VM for development. Honestly, it might have something to do with how hard it's been historically to get a Delphi development environment set up (or upgraded).

    Some advantages of using virtualization:

     

    Backing up a vm is as easy as copying a file. If you break something in a vm, it doesn't affect the host machine. If you decide to replace your host machine with a new one, you're up and running again within an hour. 

     

    I've configured my VM to use separate virtual disk files for C: and D: and I keep my projects on D:.

     

    Whenever I update Delphi, I archive the virtual C: drive first. This makes it dead easy to fire up an older Delphi version whenever I need it.

     

     

     

     

     

    • Like 1

  9. I'm using VMWare Workstation Professional since many years and totally love it.

     

    I have 2 external screens attached to my notebook (plus the internal one, which makes three) and I can very flexibly set VMWare to use any combination of screens and resolutions. This makes it very easy to test DPI-Aware applications. Another big advantage for my specific line of work is that VMWare lets me configure virtual COM Ports (which communicate with each other through named pipes) so I can test serial communication protocols even though my notebook has no "real" RS232 ports.  VMWare also supports virtual networks so I can define "private" networks between virtual machines that are isolated from others.  There are tons of ready-made VM's to download from the internet with appliances like routers etc.  

     

    When configured right, a VM in VMware is not noticeably slower than the host machine.


  10. 12 hours ago, ioan said:

    I also have several multi threaded windows services and I'm using JCL Library to track exceptions. I'm very happy with it and never had problems. You'll find my code in this post:

     

    Make sure to follow the instructions from the code comments.

     

    This is very interesting, I'll certainly look into this. 

     

    I'm also currently evaluating Eurekalog.


  11. Hello all,

     

    I'm trying to debug a multithreaded application that contains, among other things, the Intraweb framework.    I have the Parnassus Parallel debugger installed in my Delphi 10.4.2. Sydney IDE.

     

    My problem:

    whenever I try to set a breakpoint in a multithreaded piece of code of my own, the Delphi debugger immediately complains that it can't find the location of some Intraweb source file.  Of course it doesn't, because Intraweb doesn't come with source, so why is it asking?  The big problem is that this message is impossible to get rid of.  It just keeps coming again and again and I never even get the change to assign the correct thread affinity to my breakpoint. 

     

    So... How the heck do I tell the Delphi debugger to not keep asking where the Intraweb sources are located?

    debuggingproblem.png


  12.  

    33 minutes ago, Lars Fosdal said:

    Eurekalog is invaluable for services. 

    Eliminates the guesswork.

    Worth every €/$/£.

    My service is heavily multi-threaded (see attachment) , has hundreds of threads running which pull data from a multitude of oil rigs.
    The communication threads use Remobjects Remoting which is also multithreaded. The service itself has a builtin http management console that is based on Intraweb, which is also a multithreaded framework.

     

     

    There is sooo much multithreading going on, can a tool like Eurekalog produce a stack frame if one of these threads produces an AV?

     

     

     

    wellsync.png


  13. Hello all,

     

    one of my (heavily multithreaded) Windows services crashed today with an access violation and Windows was decent enough to write the "fault offset" in the event log.  
    I have a detailed linker MAP file of the application.  Does anyone know a tool that will parse the MAP file to help me find the approximate error location in the source?


  14. 11 hours ago, Attila Kovacs said:

    Btw. your example does not reflects this.

    I think it does. The two searches are not disjoint, so calling StringReplace (shortest word first) would replace "Hut" by "House" and the name "Hutt" would not exist anymore in the second search pass due to this insertion.  An approach that starts by scanning the original string for all search terms would reveal two "hits" at the first letter H and then things get interesting, because it would have to decide which replacement is "better".  So it needs some rules to make that decision. One rule could be to replace the longest search term.
     


  15. 50 minutes ago, Attila Kovacs said:

    I don't understand the question. The input has a natural order. There is nothing to decide.

    What I mean is, if you call Embarcadero's stringReplace routine multiple times, then each subsequent replace sees the insertions made by the previous call.

    But if you write a MultiStringReplace routine that first analyzes the string and determines everything that is to be replaced, that is not the case. It sees only the original string and not the intermediate insertions. The end result may be different.

    • Like 2

  16. On 3/20/2021 at 12:40 PM, Mike Torrettinni said:

    So, the purpose of this ReplaceMultiStrings is avoid calling StringRepace multiple times, when we need to replace multiple sub strings, like:

    I am a bit puzzled here. How do you want to guarantee a consistent outcome? The first "search & replace" will change the string. It will remove characters and insert new ones. Which may get captured by the next search.

     

    Suppose you have a string like "Jabba the Hutt lived in a Hut" and you want to replace "Hutt" by "Alien" and "Hut" by "House".  How do you decide which replacement to do first?  

     

     

     

     

     

     

     

    • Like 1
×