Jump to content

Mike Torrettinni

Members
  • Content Count

    1509
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Mike Torrettinni

  1. Mike Torrettinni

    docwiki.embarcadero.com is not working

    At the end it could be just a simple explanation, like with Bookmarks plugin: one of the managers is personally responsible and they would rather have current situation then to explain why someone else could be better suited to sort out the issue and manage in the future. Probably someone just needs to press reset button on the server.
  2. Mike Torrettinni

    Debugger Exception Notification

    This worked for me:
  3. Mike Torrettinni

    Analyze strings for common parts

    Aha, I just corrected the post above, about TDiff. Thanks!
  4. Mike Torrettinni

    Analyze strings for common parts

    I see, this could be interesting. I assume you are referring to this, TDiff/TextDiff at https://github.com/rickard67/TextDiff
  5. Mike Torrettinni

    Analyze strings for common parts

    Why do you suggest regular expression? I don't know what the scripts will be in the log, so I can't use TRegEx.Matches, if that's what you are hinting at. Or am I wrong?
  6. Mike Torrettinni

    Project Release Icon not Showing

    There's probably many reasons why it suddenly doesn't work, in previous versions of Delphi when this happened to me it helped just to re-set the icons. So, clear icons to produce default Delphi icons, re-start IDE and set new icons. This usually worked for me, perhaps will for you. too.
  7. Mike Torrettinni

    Routine to check if set of dates match

    Perhaps a check if total strings lengths are equal, before constructing actual strings. Calculating lengths is usually faster then concatenating strings. Could save some time.
  8. Mike Torrettinni

    docwiki.embarcadero.com is not working

    Not sure if this makes any difference, but if I access site from US I get partial results, some show up some have error. Using VPN from other countries works 99%, rarely, but every now and then the error shows up.
  9. Mike Torrettinni

    A book about Object Pascal Style Guide

    Well, it is true that I'm still looking at 10.2 sources, so perhaps 11 or future versions will improve, but I seriously doubt they will put resources into restyling current code over bug fixes. I hope not.
  10. Mike Torrettinni

    A book about Object Pascal Style Guide

    There's quite a lot of inconsistency in Delphi sources, in some cases very obvious when a different developer implemented a change and introduced new variables. Completely different style, or usage of L prefix.
  11. Mike Torrettinni

    A book about Object Pascal Style Guide

    Well, just don't buy it in the first place. There's always a preview of some sort so you know what you are buying. If I were you, I wouldn't worry too much about it, I doubt he will finalize it to sell it. If our ghost buster got under his skin, he probably can't stomach the English proofreading, anyway.
  12. Mike Torrettinni

    A book about Object Pascal Style Guide

    Very impressive that a full book can be written on this topic! It was quite easy to read, although could use some more incorrect vs correct examples, some points could be easier demonstrated like this and not trying to explain with text. All in all not boring book, considering the boring topic. But the examples just reconfirmed how awful F, L and A prefixes look. I use f, v (local vars) and x (unit vars) and a. I agree with this 100%. It was a bit confusing to read that L prefix for local variables is encouraged, and not a guide: "The ā€œLā€ prefix is encouraged for local variables in case identical names would conflict or shadow identifiers of parameters, variables, fields, or property names." When a style guide is encouraged to be used, it's not a guide but a free-for-all. Too bad he left and deleted the account. I would buy the book, if it was sold.
  13. Mike Torrettinni

    Move a Function or Procedure to a Unit??

    Then you can make them as fields of this new structure. If these variables are local to unit (defined in implementation) than leave them, if you really need to, but with such a small number of vars this is good opportunity to practice removing/converting global vars.
  14. Mike Torrettinni

    Move a Function or Procedure to a Unit??

    I assume these are global variables accessed from MainForm, right? If only used in MainForm, then don't use them as globals but define them as MainForm fields and pass them as parameters to the method: MainForm: TMainForm ... private fAPJobtickets fSendAPMsg fdsSendAPMSG // then on some action (button click, form create...) create them like this: CreateApDataComponents(fAPJobtickets, fSendAPMsg, fdsSendAPMSG); there are multiple ways to implement this, but this is simple example that will then allow you to expand, change.... try to avoid global vars. Also, make sure the new unit doesn't use MainForm unit - avoid circular reference, if possible.
  15. Mike Torrettinni

    Move a Function or Procedure to a Unit??

    Can you show very simple example what you did here, for 1 control what was before and how it is now? I don't understand why you are recreating controls... the originals were part of MainForm, right? I just want to make sure my suggestion didn't lead you down the wrong path.
  16. Thanks, I can't believe I tolerated these annoying useless .dfm changes for so long!
  17. Mike Torrettinni

    Move a Function or Procedure to a Unit??

    I refactored 100s of methods like this, from within forms, in past few years, and the first thing I do is to make it independent of form and controls. So, remove form reference to become: procedure SendAPEmails(parameters...); also move the declaration out of the form, but keep in the same unit. Now make it work without reference to the form or controls. You will probably need to set parameters to pass values to assign to controls. Once it works as a standalone method, move it to new unit. You will see what uses clause you need to define to work. Perhaps you will need to move a few more methods that are used just by this method. Do the same for other print routines. Once you move a few or all of them, then it will be easier to see what patterns of code are repeated so you can refactor to smaller methods. I found this was best for my case, trying to refactor in the form unit with lots of other code was quickly becoming unmanageable mess. But if you have these methods in smaller unit(s) the refactoring is much easier and more obvious.
  18. Mike Torrettinni

    Library to get user, computer info

    In my projects, I don't gather user identifiable info, even for licensing. Worked good so far, but now I have the need for different licensing style. I have methods to get user name, computer name, some hardware info, local IP... for Windows. But I'm looking also for Linux version. Also identifying if VM is used or not. So, looking for a library (linux would be a plus) that handles also cases like VM, RDP, Citrix, roaming user profile management... and other network particulars that can give odd results with basic methods. Any suggestions?
  19. Mike Torrettinni

    Library to get user, computer info

    Thanks, it looks like it does cover a lot. And having available all the demos is quite refreshing. No Linux support is not a deal breaker, but it would be nice to have all in one. Thanks, at this moment I'm looking for ready-made library (commercial) up to date and a Linux support is a plus. There's plenty example available online for all sorts of system info, but I'm trying to avoid my own trial and error.
  20. Mike Torrettinni

    Delphi compatibility with Windows 11?

    No improvement in W11? I thought that was such a cool idea, shared office files, but I switched it off very quickly, on W10. Unreliable, kept complaining it's offline and can't connect. Shame.
  21. Mike Torrettinni

    Unit testing for beginners

    I guess it's time I start to learn this topic. There's plenty resources I can find on google, but seems more scattered than focused material that would teach from first test case to more substantial examples. I'm looking for something with more meaningful examples because this is completely useless for me: https://blogs.embarcadero.com/learn-how-to-do-unit-testing-in-delphi-with-the-powerful-dunitx-framework/ I just started new project, created a couple of file parsers and now I would like to implement unit testing. So, Calc examples... I just don't get it. Any suggestion on resources for beginners?
  22. Mike Torrettinni

    Unit testing for beginners

    OK, first test done successful! šŸ™‚ Things are much clearer now! This video is for real beginners, very easy to follow: Thanks for the help everybody!
  23. Can we expect future Delphi compiler be so smart to detect repeated calls and just do the once, like: if (CustomerNet(C) = 0) and CustomerIsNotActive(C) or (CustomerNet(C) > 0) then To avoid 2 calls, I can add variable and store CustomerNet(c) and use it in the condition, but wouldn't it be cool for compiler to detect such cases on its own and optimize so that just 1 call gets executed? Are other compilers smarter than Delphi and can handle such cases better?
  24. Mike Torrettinni

    Compiler detecting repeated lines?

    I guess it can change, yes, but it my example it doesn't. But you are right, it's not guaranteed. Still, maybe it can detect if the called method can return different result... if not, then it's the same call.
  25. Mike Torrettinni

    Unit testing for beginners

    From all the blogs I read, I didn't come across anything like such a simple explanation.
Ɨ