Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/10/22 in all areas

  1. We are glad to announce that New Modern Multi-platform FM Style "Mirage Dark" just released: https://www.delphistyles.com/fmx/MirageDark.html Style elements have specific of each platform UI!
  2. TurboMagic

    Code coverage wizard plus

    Hello, do good and talk about... I'm currently shortly before releasing a new tool. It''s named "Delphi Code Coverage Plus" and is a completely rewritten and improved version of "Delphi Code Coverage Wizard". You can already get it on GitHub and it already works, the things before a 1.0 release I want to do are mostly cosmetic ones. Here is the link: https://github.com/MHumm/delphi-code-coverage-wizard-plus Now what can it do for me? It is a GUI tool which can generate everything needed to run the commandline Delphi Code Coverage tool that Delphi Code Coverage tool would run your unit tests and find out which lines of code your unit tests are actually run by the unit tests and which ones are never reached Why did I rewrite it and what's new/improved? The former Wizard (remember: I only reworte the wizard, not the command line tool itsself!) would generate the batch file to run the command line tool and create other necessary files, but if you changed something in your Delphi project, you would have to update these files/batch file yourself manually The new wizard got rid of JVCL components so it uses only what comes with Delphi itsself, which hopefully makes it easier for others to contribute The new wizard introduces a project format so you can load and modify an existing project, e.g. if you added more units to your project or need a different output format The new wizard can add itsself to Delphi's Tools menu if you like. The new wizard stores his position and window sze so it opens the same positionand with the same size new time it is started The new wizard should be HiDPI capable The new wizard can directly show the HTML output if you selected that one as output format What else is there to know? it was developed with 11.2, but most likely will compile and work fine with 10.4 For isntallation download the ZIP from GitHub or clone it, then open and run the project file There are plans to release it via GetIt package manager as well If you like this tool you can "star" it on GitHub 😉
  3. TurboMagic

    Code coverage wizard plus

    Gah! I'm sorry to report that a bug crept in. There's still some dependency on JCL or so in there at some place. I'll try to fix this tonight. So if you don't have JCL/JVCL installed it will not run at the moment.
  4. TurboMagic

    Code coverage wizard plus

    Just to let you know that I just submitted the form to get it published in GetIt. Now that's EMBT's turn 😉
  5. Not bad the idea, it just might require adding more syntax to { ToDo: "my list item" } comments. I'm also sure you know where you can file such requests officially. If you do that and post the number here others might vote for that.
  6. Stefan Glienke

    A gem from the past (Goto)

    If you are using XE2 as in your profile you could be affected by this: https://quality.embarcadero.com/browse/RSP-27375 And as David mentions depending on what is inside the try the compiler easily throws any register usage overboard and operates via stack.
  7. AcquireSRWLockShared was introduced in Windows Vista. So, I would guess not. Delphi no longer supports Windows XP as a development target and according to comments from them, they are actively removing code that exists merely to service targeting XP. If you really need to support such an old OS, you will probably want to stick with development tools meant for it.
  8. Anders Melander

    Use of inline variables..

    ...or without the temporary buffer: function ComputerName: string; begin var Size: Cardinal := 0; if (not GetComputerName(PChar(Result), Size)) and (GetLastError <> ERROR_BUFFER_OVERFLOW) then RaiseLastOSError; SetLength(Result, Size-1); if (not GetComputerName(PChar(Result), Size)) then RaiseLastOSError; end;
  9. Ian Branch

    Use of inline variables..

    🙂 I'm a simple man that does simple, old school, programming. 🙂 Just trying to pick up some new tricks..
  10. dummzeuch

    A gem from the past (Goto)

    I actually used a goto for debugging today. The reason was that at the end of a function I check the result and for a particular result I want to repeat the code in the function in order to step through it: function whatever: SomeType; label RepeatMe; begin RepeatMe: // some code that generates the result if Result = ResultIWantToDebug then goto RepeatMe; // <== put a breakpoint here // some more code end;
  11. Remy Lebeau

    Any advice when to use FileExists?

    The FileExists() call becomes redundant if you make _IsFileValidForParsing() return False for a non-existing file. But really, I would suggest completely re-writing this loop to actually open the File, decide whether to call _ParseAsA() or _ParseAsB() based on the content of the opened file rather than just its filename, and wrap the loop code in a try/except to handle IO errors. For instance: procedure MainMethod; var File: string; begin for File in GetMainPath do begin if _IsFileValidForParsing(File) then // <-- OK to leave in only if it checks just the filename and not the content ... begin try FS := TFileStream.Create(File, fmOpenRead or fmShareDenyWrite); try if _FileIsA(FS) then _ParseAsA(FS) else if _FileIsB(FS) then _ParseAsB(FS); finally FS.Free; end; except // handle error as needed ... end; end; end; end;
  12. Sherlock

    Any advice when to use FileExists?

    Well...if you know your other methods do the file check, then don't do it outside of them. But only then.
  13. Uwe Raabe

    ImageName vs. ImageIndex

    Who hasn't seen this before: A bunch of controls and actions are linked to an ImageList with an ImageIndex, but as soon as you sort this ImageList to give it a sensible order all controls immediately start to show the wrong images. Wouldn't it be cool if instead a cryptic number as ImageIndex you could specify a descriptive name at the control? Thus the order of images inside the ImageList wouldn't matter at all. Of course, the ImageList has to support names in the first place. TPngImageList from PngComponents does that right from the beginning. So what about implementing that feature based on TPngImageList? Can't be that hard, can it? Well, it turned out to be a bit more complex than I anticipated, but that's probably because I had set my goals pretty high. So I expected to have a selection from image names for the ImageIndex properties of the control and thus a display of the image name instead of just a number. Also this scheme should be extendable to other controls and especially to other ImageLists supporting names. From this the ImageIndexMapper was born. A non-visual component to be placed on a form or datamodule, that when activated takes care of the image names. You just have to call one method to resolve those names to the actual corresponding number values. The attached ZIP file contains all the sources and files for the component and design time support as well as a sample project (currently for Delphi 10.2 Tokyo only). As a prerequisite you have to use PngComponents from the above source. I suggest to use the recent version V1.5.0 with direct ImageIndexMapper support. Older versions require the contained PNG Support Package to be installed and add the corresponding unit to your uses clause somewhere in your project. Version 1.5.0 makes this obsolete, Presumably there is much room for improvement. Whoever finds some time to test this component - please forward any encountered bug to me. Here is a short GIF showing the switch from TPngImageList to TImageList (without name support) in the Object Inspector: https://www.screencast.com/t/4MbJkygjFR ImageIndexMapper.zip Cross Post: https://www.delphipraxis.net/198212-imagename-statt-imageindex.html#post1415709
×