-
Content Count
2963 -
Joined
-
Last visited
-
Days Won
106
Everything posted by dummzeuch
-
Turns out the culprit was not CnWizards but actually the Favorites Files Expert in GExperts. It took forever to read 4096 entries from the registry. And these 4096 entries doubled the next time I called the configuration dialog and doubled again the next time. If any of the CnWizards developers reads this: Sorry for suspecting your code, it was my own.
-
I recently had a problem with access violations when calling methods of interfaces. The reason turned out to be duplicate GUIDs in the interface declarations. This caused AVs because the wrong methods were called and the parameters passed to them were not of the right type and numbers. Duplicate GUIDs are usually caused by copying existing interfaces and changing them, without also generating a GUID for the copy. (Btw: The Hotkey for generating a new GUID in the Delphi IDE is Ctrl+Shift+G.) So I looked for a way to find all interfaces and their GUIDs in my program. https://blog.dummzeuch.de/2019/02/16/finding-guids-with-gexperts-grep/
-
Finding GUIDs with GExperts Grep
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
No, you don't have a duty. But neither have I. Sorry if that sounded harsh (always remember: English is not my native tongue, some fine points always get lost in translation). It's just that some people (not you!) seem to think they have the right to demand features and waste my time which I want to spend on things that is fun to do. You were the 5th one today who wrote a suggestion (I'm not saying that these are bad suggestions either!) and I got really tired pointing out that there is such a thing as the feature request form on Sourceforge for exactly that. GExperts is an open source project. Everybody has the code and can contribute. But only very few do. I can't even find people who regularly test new features or bug fixes with the Delphi versions I myself don't use. -
Finding GUIDs with GExperts Grep
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
I said it before (to somebody else on a different topic: Please file a feature request on SourceForge. That way all these are in one place and whenever I find time I can look if something there looks interesting. Anything mentioned only here will most likely be forgotten in no time. (And no: I am not going to write these feature request entries for people who can't be bothered. I prefer spending my time on more interesting things. You get to use GExperts free of charge and profit from my work, so do your duty. - Sorry if this sounds harsh, but my time is limited.) -
Talking about more things that (still) don't work: The GExperts Editor-Popup-Menu still does not work if Images are assigned. So I have left the workaround (not assign Images) in place.
-
How can I get the list of registered interfaces and their GUIDs in a Delphi 2007 application?
dummzeuch replied to dummzeuch's topic in RTL and Delphi Object Pascal
Too many of my questions on SO have been closed for me to rely solely on SO any more.- 8 replies
-
- delphi-2007
- rtti
-
(and 2 more)
Tagged with:
-
Blogged : Delphi Package Manager RFC
dummzeuch replied to Vincent Parrett's topic in Tips / Blogs / Tutorials / Videos
I just tried to download and compile the sources: MultiInstaller_Icon.ico is missng. -
Blogged : Delphi Package Manager RFC
dummzeuch replied to Vincent Parrett's topic in Tips / Blogs / Tutorials / Videos
I'm not sure that such a tool should support freepascal and Lazarus too. This would: Add a lot more complexity Get the maintainer / developer into unnecessary open vs. closed source discussions Would be a direct "competitor" to an already existing tool which would again cause endless discussions. I'm not a fan of tying it into Github, btw. -
Fast way to find points near a given point?
dummzeuch posted a topic in Algorithms, Data Structures and Class Design
I have a list of several thousand points with given X and Y coordinates (cartesian corrdinates in metres, stored as double) and of course additional properties. The list originally is sorted by one of the additional properties. I need to go through this list and for each point find others that are near this point, e.g. have a distance of less than 1 metre. This sounds like it should be a common problem and there should be an existing solution, but my Google skills have failed me. My approach would be: 1. Create two sorted lists, ListX sorted by X, ListY sorted by Y. 2. For each point find the points in ListX and ListY that are near the point's coordinates (example: Less than 1 metre in that direction.) 3. Take those points that are in both results and check their actual distance to my given point. -
Rather than hooking an event, which might already be hooked, you can create a custom TComponent descendant and set the main window as its parent. The main window will then destroy that component before it gets freed and you can intercept that to do whatever you need. Regarding chaining events, see here for my suggestion to play fair with other plugins.
-
Code block should be Delphi by default not HTML
dummzeuch replied to mael's topic in Community Management
Yes, it's an annoyance. Wasn't that already reported? I seem to remember a similar post. -
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.
-
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/
-
Complete Boolean Evaluation
dummzeuch posted a topic in Algorithms, Data Structures and Class Design
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): -
How to pass an unknown record to a function as argument
dummzeuch replied to John Kouraklis's topic in RTL and Delphi Object Pascal
I missed the part about RTTI in the question. -
How to pass an unknown record to a function as argument
dummzeuch replied to John Kouraklis's topic in RTL and Delphi Object Pascal
function pass(var aRec): boolean; or function pass(const aRec): boolean; -
Guessing the decimal separator
dummzeuch posted a topic in Algorithms, Data Structures and Class Design
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? -
How to switch condition position?
dummzeuch replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
No. You might want to look at Perl for that. 😉 -
fixed now (in the current sources).
-
appending to a dynamic array
dummzeuch posted a topic in Algorithms, Data Structures and Class Design
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.) -
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
-
Conditional compilation for various Delphi versions
dummzeuch posted a topic in Tips / Blogs / Tutorials / Videos
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/ -
Conditional compilation for various Delphi versions
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
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. < -
Guessing the decimal separator
dummzeuch replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
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. -
Guessing the decimal separator
dummzeuch replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
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?