Jump to content

dummzeuch

Members
  • Content Count

    2855
  • Joined

  • Last visited

  • Days Won

    101

Everything posted by dummzeuch

  1. Yes, it's an annoyance. Wasn't that already reported? I seem to remember a similar post.
  2. dummzeuch

    Delphi wrapper for libpng

    A google search found this: http://delphi.pjh2.de/articles/graphic/png.php#libpng and also, this http://www.libpng.org/pub/png/pngaptk.html which lists a few Delphi libraries with libpng support, but the links I tried were dead. and there is this: https://www.opengl24.de/header/libpng I haven't tried any of them.
  3. dummzeuch

    Two GExperts bugs fixed, 14 to go

    I just fixed two (newly reported) bugs in GExperts: The Set Tab Order dialog no longer worked in Delphi 6, 7 and 2005. This was due to me adding AlignWithMargins (and the associated Margins property) to the dfm file. This property apparently was introduced in Delphi 2006. Again, this underlines what I mentioned several times: I do not use Delphi < 2007 for anything but testing and fixing bugs GExperts. That’s why glitches like this tend to slip by unnoticed. That’s why I would like people to volunteer for testing the various versions. But apparently nobody can be bothered. Fine by me, but you will have to live with the consequences. I don’t have a QA department. The extensions to the Uses Clause Manager caused several thousand (small) files to be created in the GExperts configuration directory. This directory is located under AppData\roaming\GExperts which means it will be copied when roaming profiles are enabledin a Windows domain. I didn’t know that anybody still uses roaming profiles since they are usually not worth the trouble, but apparently they are still being used. So I now moved that cache to AppData\local and also added a config option to disable caching altogether. https://blog.dummzeuch.de/2019/02/09/two-gexperts-bugs-fixed-14-to-go/
  4. Has anybody ever enabled Complete Boolean Evaluation, and if yes, why? (see associated poll) Here is a use case (but I still would not do it this way but simply switch the conditions):
  5. I missed the part about RTTI in the question.
  6. function pass(var aRec): boolean; or function pass(const aRec): boolean;
  7. Sometimes I get files with text representations of numbers where it is not known what is used for the decimal separator. (I'm sure I am not the only one.) For this type of data, I have written the following function: function GuessDecimalSeparator(const _s: string): Char; var i: Integer; CommaCnt: Integer; begin CommaCnt := 0; Result := '.'; for i := 1 to Length(_s) do begin case _s[i] of '.': begin Result := '.'; end; ',': begin Inc(CommaCnt); Result := ','; end; end; end; if (Result = ',') and (CommaCnt = 1) then Exit; Result := '.'; end; It takes a string which is supposed to be a number in decimal representation, which can optionally contain thousands separators and a decimal separator. It then tries to guess, which one of '.' or ',' is the decimal separator. The algorithm is: Start at the beginning and count the occurrences of '.' and ','. The one that only occurs once is the decimal separator. If there is none, return '.' (because it does not matter). I can see the following problems with this approach: There are other possible decimal / thousands separators than '.' and ',' (personally I don't know any, but my experience is limited to European and American number formats). For strings in the form '1.000' (or '1,000') it assumes that the separator is the decimal separator. This could be wrong (That's why it's called GuessDecimalSeparator and not DetectDecimalSeparator.) For malformed strings (e.g. '1.00.00' or '1,00,00') the result is most likely wrong, but that's simply garbage in -> garbage out. I guess this could be improved. One possible improvement would be to not just process one number but many and check whether the results match. Any additional thoughts on this?
  8. No. You might want to look at Perl for that. 😉
  9. dummzeuch

    New features in GExperts

    fixed now (in the current sources).
  10. Given an array MyArr = array of TSomeRec Appending to that array means: Increase the length Set the values for the new record I have seen code like this: SetLength(MyArr, Length(MyArr) + 1); MyArr[High(MyArr)].SomeField := SomeValue; // and repeated for each field in TSomeRec This always triggers my bad smell sense because I would have coded it like this: var Len: integer; // [...] Len := Length(MyArr); SetLength(MyArr, Len + 1); MyArr[Len].SomeField := SomeValue; // and repeated for each field in TSomeRec Am I just too pedantic? (Please ignore for now that this might lead to memory fragmentation in both cases.)
  11. dummzeuch

    New features in GExperts

    Hi Ian, first: Please start a new topic for requests like this. Or even better, file a feature request on SourceForge. I have no idea. I have not really understood what this does and how it works. When you file a feature request, make sure to add a short description of the functionality. twm
  12. If you are maintaining a library, component or plugin for various Delphi versions you will sooner or later hit a point where it becomes necessary to have different code for some of them. Some examples are: The constants faTemporary and faSymlink are only declared in Delphi 2009 and later, so you have to declare them yourself for older versions. Some Open Tools API function have bugs in some versions so you have to implement a workaround. Some classes or functions have been added to later versions of the RTL so you need to implement them yourself for older versions, but you don’t want to use these implementations for newer versions The traditional way of masking code for some Delphi versions is using the VERxxx symbols which the compiler defines, where xxx is the compiler version multiplied by 10. Note that the compiler versions started with Turbo Pascal, not with ... https://blog.dummzeuch.de/2018/12/02/conditional-compilation-for-various-delphi-versions/
  13. Your definition of "traditional" obviously is different from mine. Maybe I'm just older. In my blog post I actually continue: > An alternative is the {$IF } compiler directive which can test for arbitrary Boolean expressions [...] It was added to the Delphi compiler in Delphi 6, so it covers quite a few Delphi versions. <
  14. Me neither! Just pay me enough(*1) and I will do that for you - for one hour per week. *1: Enough means that that one hour per week must be enough to live on.
  15. Did you know that 86.64% of all statistics are made up? The remaining 53.42% have been tampered with. Seriously, is there any sense behind this number?
  16. dummzeuch

    Using dxgettext on Windows 10

    I just added a test for using gnugettext in a multithreaded environment: https://svn.code.sf.net/p/dxgettext/code/trunk/tests/MultithreadedResourceStringTest Could you please checkout this test and try to run it on your computer? If it's something that happens only there, maybe this simple test case might get some more information. There are two projects, one for Delphi 2007 and the other for Delphi 10.2. I haven't got Delphi 10.3 here to test, but loading and compiling the Delphi 10.2 project in Delphi 10.3 should work fine. Note that the project is meant to be run in the integrated debugger because in case of failure, the threads just raise an excpeption. These exceptions are only visible in the debugger.
  17. Define "fail". For German language settings it returns a comma, which is probably correct in most cases. Fail means that it might improperly return '.' on English language settings. If I knew the correct language settings for the input, I wouldn't have to guess the decimal separator. Yes, I am aware of that (as I said in the original post). In that case it would not matter. I could simply use '.' or ',' to convert it to a number and would get the correct result for either.
  18. dummzeuch

    New features in GExperts

    Please file a bug report on SourceForge. And be more specific in it.
  19. Because I don't know that it is an integer. I get a string that is supposed to be a number. I assume that the decimal separator is either a comma or a dot. I try to guess which one it is. One criterion: The decimal separator is only allowed once. There is none, as I already wrote in my original post:
  20. Will also fail on '1.000.000'. (Yes, I have read the comment, but that case is not as rare that I would accept the function to fail on it.)
  21. But you usually don't post credit card receipts on a sign post at a busy place. You just posted a picture of your signature on the internet ...
  22. I started out with that approach, but: In '1.000.000' the decimal separator would definitely not be '.'. (or '1,000,000' it wouldn't be ',').
  23. dummzeuch

    Using dxgettext on Windows 10

    Ah, OK, I understand what you are getting at. Hm, I don't remember seeing any assembler code in gnugtetext.pas. And since it is a stand alone unit that uses only Delphi system units, I doubt that this could be the case. Even if it were the case, I would not know were to look. Also, IIRC you said, that you ran your test program in the debugger. This kind of bug should have triggered the debugger to stop. You didn't mention any such error, so I guess there isn't.
  24. dummzeuch

    Using dxgettext on Windows 10

    Possible. Since I have no idea what caused it, I can't really say. But as far as I know about how IDEFixPack works, it should not affect the compiled executables. Uninstall the IDEFixPack, compile your test program and test it again. Then you'll know.
  25. SourceForge had a time with technical problems (not only with svn), and it took them quite a while to sort them, but they are now back to being reliable and fast. During that time I moved many of my open source projects to OSDN (which started off as a SourceForge clone). They are also quite good. Also, github offers svn access to git repositories. It works for simple cases. My most treasured feature of svn - externals - is not supported though. But of course these are mostly for open source projects. I would not use a cloud service for proprietary sources at all.
×