Jump to content

Bill Meyer

Members
  • Content Count

    655
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by Bill Meyer


  1. 45 minutes ago, rvk said:

    Look in your project source (the .dpr file)... do you have multiple {$R *.res} lines?

     

    I don't recall this happening before, but I add a module to the project, and a {$R *.res} is added to the tail of a unit in the DPR. And it has happened now a few times. Hopefully, restarting the IDE will clear that mode.


  2. I have seen the basic message before, but this one leaves me scratching my head:

    [DCC Error] E2161 Warning: Duplicate resource:  Type 14 (ICON GROUP), ID MAINICON; File D:\MyProj\MyProg.RES resource kept; file D:\MyProj\MyProg.RES resource discarded.

     

    The file kept and the file discarded are the same file?


  3. 1 hour ago, Uwe Raabe said:

    If this call happens inside a method or class method in that unit, you can use UnitName for that. Every class returns the unit of its declaration with this function. See: http://docwiki.embarcadero.com/Libraries/Rio/en/System.TObject.UnitName

    I thought I remembered UnitName in some hazy way. But the issue here is that I need to add logging into an initialization section, and not all of those are calling into classes. I am simply trying to find the least change needed to get the log to demonstrate the initialization order. Then I will apply that sequence in a module in which I manage the initialization sequence, and in each module, the initialization and finalization will be replaced by procedures InitializeUnit and FinalizeUnit, which contain the original code.

    The issue is that the initialization sequence contains some traps, in that there are sequence dependencies, and on the way to a complete solution, making the order explicit in my code shields me from the shifting sands when changes are made to uses clauses. This in turn is a concern because of massive unit dependencies I am trying to reduce. As I learned painfully some months ago, removing unneeded unit references can cause the execution order of those initializations to change.

    And yes, in the long run, refactoring and redesign is needed, but meanwhile, I have a couple thousand units in a large legacy app which must first be made stable.


  4. Is there any way to refer to the unit name in the unit's code? The question arises in connection with logging, and the convenience it would bring not to have to manually enter the unit name in those calls. Something like:

      LogThis(ThisUnit, SomeValue);

    If this were only an occasional need, it would not matter, but I have hundreds units into which to add the calls.


  5. 18 hours ago, ertank said:

    I have a friend using ReportBuilder and for export purposes he uses Gnostice PDF Toolkit because ReportBuilder is not capable of building quality and glitch free PDF, PNG, etc files.

    Gnostice has support for ReportBuilder.

    I have a love/hate relationship with ReportBuilder. My experience has been that it builds PDFs reliably, and with no quality concerns. That said, when you encounter idiosyncratic behaviors, finding solutions for them can be a nightmare.

    It is on my agenda to try FastReports, which looks promising.


  6. 16 hours ago, Larry Hengen said:

    I also had issue in the past using different ppDevices to render PDF.  The PDF text and images were sometimes blurry.  Any advice hot to address that?

    The only time I have seen issues with image quality was when the provided image was significantly smaller than needed, and it was being stretched the the desired size. That said, I believe that the support for such operations in most graphics components is less than excellent. If you need to enlarge images, you may do well to use graphics32 or similar, to enlarge them before inserting to the report.


  7. 16 hours ago, Larry Hengen said:

    I am currently not using a reporting tool but I have used ReportBuilder in the past.  It is one of my more favorite report writing tools, but I was not aware that it would provide the functionality I desire for this use case.  Do you use it to print an image of the chart?  If that is the case then would you not still have to determine the image resolution to use, and where to segment it so it would fit on a page with the legend?

    The charts I have needed to insert were relatively small, such that three -- the maximum I needed -- would fit on one page. Since there is embedded support in ReportBuilder for TeeChart, I wonder whether that may handle the concerns you raised.


  8. 32 minutes ago, Larry Hengen said:

    Anyone ever printed charts that are segmented to fit each page with a legend?  Client wants PDF output with multiple graphs vertically on the page with a user defined horizontal extent (ie: 50 metres) of each graph appearing on each page with a legend beside it.  Not quite the same problem as just printing an oversize image.  Any recommendations on approach or tools for Delphi?

    I do this in ReportBuilder. Are you using a reporting tool of any sort?


  9. 33 minutes ago, Uwe Raabe said:

    As I said, it heavily depends on the coding style. I would never do this. The last time I wrote this kind of stuff was about Turbo Pascal 4 or so.

     

    I would declare explicit types for these records. Even if they are only used locally.

    But the formatter is of little use, if it can be confused by coding style. There are many things I don't do that others have done, and in some cases, I will use a formatter to clean things up, but most of the time, I am dealing with old code in source control, and my colleagues would be very unhappy to see files reformatted. 😉

    • Sad 1

  10. A dictionary is nice, but in older versions -- I work a lot in D2007 -- then I make use of enums and const arrays. Defining them can be tedious, but maintenance is simple, and associated code is clean and easy.

     

    One thing to note on defining const arrays in the private section of a class: In D2007, I have found that defining consts in the class breaks the Ctrl-Shift-Up/Dn navigation between interface and implementation on members below the const declaration. I therefore put const declarations in the implementation section of the unit.


  11. 3 hours ago, Dany Marmur said:

    I am looking for a blob-post, and if i remember correctly it should be .5 to 1.5 years ago. It was a post or posts by a Delphi developer on how to or perhaps why one should consider application-wide "standards" in ones own application. I googled but i suspect the author did not use the word "framework" in the title/post. Googling "Delphi Application framework" is useless of course and i cannot remember more. Argh! Please help!

     

    AND my e-mail client has deleted the mails that i deleted from the POP3 server - it should NOT have done that. Argh! But that is OT.

    What sort of standards? That word is almost as useless on Google. 😉 But I can imagine all sorts of things I would seek to make standard within an application....


  12. Quite a few years ago, someone wrote a series of articles on how to design forms that were testable in code. I thought it was also a great demo of why you should avoid doing so, as the added complexity was impressive. At any event, I thought I knoew who the author was, and in what magazine they were published, but I seem to have been wrong. A great deal of time on google didn't help.

     

    If anyone here recalls the articles, the magazine, or the author. please let me know.

     

    Bill


  13. These were recommended to me:

    http://www.freeclipboardviewer.com/

    https://nirsoft.net/utils/inside_clipboard.html

     

    MS Word, copying to the clipboard, inserts all manner of stuff. The export from GExperts was 3K; from MS Word, 44K. And I have no idea which particular chunk of content may make the difference. 😞

    For now, I can export as RTF, paste into an editor and save, then import that to Affinity Publisher.I just discovered that ClipMate, which I have used for years, offers an Application Profile report which suggests in its section on Publisher that the current possibilities are only TEXT and RTF. However, the RTF fragment from GExperts pastes as plain text. If I save it in Notepad, and then Edit, Place (Import) in Publisher, it comes in with formatting, as it should.

    I am collecting datapoints, but I can't claim to have gained any useful insight.


  14. I routinely use Source Export to capture snippets I then insert into MS Word as formatted text. Right now, I am attempting to do the same with Affinity Publisher as the target, but the text after paste is plain, not formatted.

    If I paste to MS Word, then copy the same block from MS Word and paste to Affinity Publisher, I get the desired result. But obviously, at the expense of more steps in the workflow.

    Is there some tool I can use to look at the raw content from the clipboard item, so I can get some idea how the Source Export differs from what I copy from MS Word?


  15. 3 hours ago, Angus Robertson said:

    But I really would prefer a TMemo that reverses the TStringList loaded into it, top latest.

    That aspect you should be able to resolve easily enough with a TStringList as a buffer, and just iterate through the source stringlist from bottom to top, copying lines to the destination.


  16. For reasons I have never understood, the TDataset and its descendants stream data, but not properties. In my own work, I have had to deal with this in connection with the field properties we wish to pass to reporting code. It is all very nice to have Alignment, DisplayFormat, and DisplayLabel, but rather annoying that there is no option to include them in streaming.


  17. A point not yet mentioned is the use of nested methods in the course of refactoring. In legacy code, it is not uncommon to find huge routines which have been thoughtlessly coded, and often with useless naming. I have found it helpful to remove to nested methods the chunks of code which might better be placed in a private class, as Arnaud suggests. Making them methods of the class in which you are working often makes no sense because these routines may have no practical value out of the context in which they were found. In new design, their use is harder to justify, I think.

     

    • Thanks 1

  18. 28 minutes ago, Stefan Glienke said:

    Fun fact: I just recently consciously used goto because it yielded a noticable performance gain and rewriting the code without it would have been a massive undertaking resulting in more complicated code than just putting a goto there. And no, no raptor attacked me (yet...)

    This subject came up yesterday at the office. I could not recall what topic it was in Knuth's magnum opus where he explains that although goto can always be avoided, there are rare cases in which its use brings performance benefits. Seems like a sorting discussion. Quicksort?


  19. 3 minutes ago, Arnaud Bouchez said:

    @Bill Meyer
    Is   with UnitA, UnitB do   even suppose to compile?

    Oh, yes. you can pass 1..n units. Of course, what you may get, with name collisions -- which will not be reported -- is up for grabs. (Note that FixInsight now checks for with clauses which use more than one unit.)

    • Like 1

  20. 31 minutes ago, Dalija Prasnikar said:

    'with' is relic of another time and another coding practices. And, yes you could shoot yourself in the foot even back then, but now it is extremely easy to do so. Not using 'with' is the best advice one could offer. It is almost like using goto and absolute. You may have some very limited use case where using it is justified, but you will not find such constructs being used at large.

    The inherent dangers of 'with' are at their worst with such usage as: with UnitA, UnitB do.

×