Jump to content

Bill Meyer

Members
  • Content Count

    655
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by Bill Meyer


  1. Also, as far as I know, many (most?) component packages ignore the possibility of "Install for All Users." Some claim (falsely) to support it. 

     

    Not usually an issue, but some months ago, I was setting up a new VM to be used by members of our team, and it would have been convenient to install the 8 devs as users, then install everything to be for all users. Each could then make the VM personal by removing the other users.


  2. This can happen when the named component is present in the PAS file, but not on the form, or vice-versa. In my experience, it comes up when you move a form from a particular version of Delphi in which the component was installed to one in which the component type is not installed. Most often, it is in the DFM file, which will not display the component because it can't be found. Right-click on the form and edit as text, then search on the name.

    Alternately, it could be absent from the form, but the declaration in the PAS file may still be present. If that is the case, remove the declaration and then place your new component.

     

    As to the behavior described with CodeSite, I have no idea, as I have never experienced that. You could try a message to Ray Konopka, who is very helpful.


  3. 24 minutes ago, Attila Kovacs said:

    Ahm, i was afraid that using the word "set" would be misleading, and I was right, sorry, but lists are a bit different from multisets again, so I don't know,

    I need to compare two or more "set of anything" and I'm tired writing it always manually.

     

    Ah, I did indeed misunderstand. So really, you want set operations on collections of whatever type. 


  4. Not aware of any library, but I have written small routines like

      function AnyOf(ATarget, AActual: TOptionSet): Boolean;  and

      function Contains(ATarget, AActual: TOptionSet): Boolean;  

     

    Makes the code more readable, I think, which is all I really needed. My notion was that although the set operations are pretty terse, not a lot of devs spend much time reading them, so comprehension may be a struggle. AnyOf() handles any members of the target being present in the actual:

        Result := ATarget * AActual <> [];

    while Contains() tests:

        Result := ATarget * AActual = ATarget;

     

    Unless your need is for a lot of densely coded operations, this kind of thing may be sufficient. If you do need dense code, then you may better simply use the existing operators.


  5. Just now, Attila Kovacs said:

    I'm not an IB expert but IB BLOB has a default subtype = text.

    Maybe it was the whole time stored with that subtype but it was fine with ansistrings?

    We were just discussing that. I am not an IB or FB expert either, but we now suspect that the subtype may be the root cause. It should be 0 for binary, but is now set to 1. If that is the issue, we're looking at a lot of scripts to update DBs.


  6. 21 minutes ago, Attila Kovacs said:

    does the blob editor showing it in raw hex?

    do you read the blob as blobfield and stream or as string?

    Yes, blob editor shows us raw hex.

    Tried TBlobField, and same problem. The conversion appears to occur before the call to CreateBlobStream. Using the answer given here: https://stackoverflow.com/questions/44365344/how-to-read-data-from-a-tblobfield-using-ado-in-delphi

    In debug with this:

    function ReadBlobField(DataSet: TDataSet; Field: TField): TBytes;
    var
      Stream: TStream;
    begin
      Stream := DataSet.CreateBlobStream(Field, bmRead);
      try
        SetLength(Result, Stream.Size);
        if Stream.Size>0 then
          Stream.ReadBuffer(Result[0], Stream.Size);
      finally
        Stream.Free;
      end;
    end;
    Right after Stream.ReadBuffer, Result shows characters with alternating zeroes.

  7. A colleague in the office is having an odd problem. We have long stored data in blob fields and now in moving from D2007 to Tokyo, we find that reading out of the blob has converted Ansi strings in the blob to Unicode. That's annoying for the string contend, but the string is simply a version identifier and the rest of the content is compressed data. What would seem obvious is to treat the content as an array of bytes, but somewhere in the chain, and before he pulls it, the conversion has occurred.

     

    Opening the table in Database Workbench, the blob editor shows it is correct in the blob. Unicode should not come into play here. The Transliterate property does not appear to alter the behavior. What are we missing?


  8. 4 minutes ago, Mike Torrettinni said:

    I understand this as: as long as it's a measured bottleneck, it is worth looking into. 

    You began with the question of how to identify a bottleneck. The first criterion should be whether it is observable by your users. If you have a button click event which executes in 200mS, and you can cut that in half, you may get satisfaction from doing it, but the user will not see the difference.

    Ordinarily, unless a) an action takes at least dozens of seconds to complete, b) is frequently used and c) can be significantly speeded up (by which I mean 2X or more), the time invested is unlikely to be repaid in user satisfaction.

    If you are analyzing or converting some kind of data, and the amount to process is large, then you are likely looking in the wrong place. Some years ago, I had a spreadsheet which the app took a few minutes to produce. In the end, it was not code rework, but replacement of some memory datasets which made a difference. Profiling showed that I might improve code execution by 10% or so, but changing to a more suitable component brought a speedup of over 20 times.

    • Like 2
    • Thanks 1

  9. 12 hours ago, Mike Torrettinni said:

    I've been reading a lot about optimization and it's interesting to see that phrase 'premature optimization' is usually just a BS, except for extremely basic cases. I agree with this and by attempting some minor optimizations I learned how to optimize other bigger parts of the code.

    Sorry, can't agree. There are many good reasons to rework code, and performance is just one of them. When I was learning to code, many years ago, a colleague advised "first make it work, then make it fast."

     

    Performance optimization should be done because of performance issues, not simply to see whether you can buy another 10% improvement in a routine which doesn't affect user perception at all.

     

    Good reasons to rework code include clarity, reduced coupling, better organization of modules, improving naming, adding documentation of the need for the actions in routines. 

     

    Seeking to optimize every routine in a program is a waste of energy, and a needless cost. Justifiable for a hobby, or in open-source, perhaps, but not in commercial work.

    • Like 4

  10. 34 minutes ago, limelect said:

    1. If you want anyone to use, use English. At the list, your site should be translated.

    It cannot.

    At the least...

    I agree that the site should present in English. That said, Google translate does a good job on the descriptions, at least sufficient to let you decide whether you have an interest in the components.

×