-
Content Count
3018 -
Joined
-
Last visited
-
Days Won
108
Everything posted by dummzeuch
-
Another thing I just found out is that the Grep expert uses a regular expression for the exclude dirs option. It first escapes meta characters (e.g. '.', '*', '\' etc.), replaces ';' with '|' and then uses the result as a case insensitive regular expression to match the full directory name and the full file name. Every directory or file that matches the regex is excluded from the search. The help says this: Exclude Dirs: A semicolon separated list of directories to exclude from the search (the exclusion is done via a substring match on the full directory and file name) I always assumed that this filter is only applied to the name of subdirectories and that it does a full match, e.g. 'src' matches the 'src' subdirectory only, not just any directory name that contains the string 'src', e.g. 'deleted-src'. And I never expected it to match a file name like 'somesrc.pas'. Searching the directory 'd:\src\SomeProject' with an exclude dirs filter of 'src' will actually find nothing at all because all names will start with 'd:\src' which always matches the filter! Did you know that? Is this a bug or a feature?
-
done
-
OK, since nobody bothered to reply, I assume that it won't matter if I change that feature to do what most people will assume it does: Only search sub-directories that do not match those given in the exclude dirs list.
-
I think that might be GExperts, in particular when using the GExperts code formatter. I have tried to find and fix this issue without any luck for many years.
-
I updated to 1909 from Windows 8.1 in December 2019. There were two issues that I remember, but these do not concern any recent Delphi versions: Updating to Windows 10 broke Delphi 6 and 2007 again Installing dotNet 2.0 on Windows 10 (The second was not an update issue but installing Delphi 2007 on a fresh Windows 10 installation.) This is why I blog about those issues. I keep forgetting them if I don't.
-
Basically C++ Builder in later versions is RAD Studio with a reduced feature set, so in theory it should work. Some experts are restricted to Delphi code (which as far as I know can also be compiled with C++ Builder). Since I don't program in C++ with RAD Studio, I don't know whether there are any problems. I haven't gotten any feedback from C++ programmers on that either. But it is easy to remove GExperts from RAD Studio if it causes any problems: Delete the GExperts entry from Computer\HKEY_CURRENT_USER\Software\Embarcadero\BDS\20.0\Experts and it is gone. So, it is fairly safe to just try it.
-
When I see code like this I always wonder why the functions aren't called isBusy and isIdle rather than Busy and Idle. Prefixing them with "is" makes it clear that they will return a Boolean value.
-
More features for the IFDEF expert in GExperts
dummzeuch posted a topic in Tips / Blogs / Tutorials / Videos
The IFDEF editor expert was added to GExperts in 2016 and improved again in the same year, to support symbols defined in include files. Unfortunately sometimes an include file itself sometimes includes other files (e.g. jclNN.inc in the JEDI Code Library includes jedi.inc) which will usually add additional symbols which are then available for conditional compilation. But the IFDEF expert only listed symbols from the original include file. This has irked me for a long time, ... (read on in the blog post) -
Google Chrome is blocking the download of my application — HELP!!!
dummzeuch replied to Steve Maughan's topic in General Help
If it's only about blocking Google, why not simply post the password on the site itself? -
How do you deal with deprecated symbols in backwards compatible code?
dummzeuch posted a topic in RTL and Delphi Object Pascal
TJSONObject.Size was deprecated and replaced by .Count in Delphi XE6, so up to Delphi XE5 you have to use .Size (because .Count doesn't exist) and from Delphi XE6 on you either live with the deprecated warnings (.Size is still available in Delphi 10.3) or replace the calls with .Count. But even if you accept those warnings, sooner or later you will have to address them because Embarcadero decided to finally remove the deprecated code. So, what if you want your code to compile on all versions that support JSON without warnings? E.g. in my u_dzGoogleTranslate unit there is the following code: if o.Size <> 3 then raise Exception.CreateFmt(_('Parsing error on JSON answer: Root object size is %d not 3.'), [o.Size]); where o is a TJSONObject. This compiles fine in all Delphi versions that have JSON support but starts throwing deprecated warnings from Delphi XE6 on. So, what are my options? I could IFDEF all those calls: {$IFDEF JSONOBJ_HAS_COUNT} if o.Count <> 3 then raise Exception.CreateFmt(_('Parsing error on JSON answer: Root object size is %d not 3.'), [o.Count]); {$ELSE} if o.Size <> 3 then raise Exception.CreateFmt(_('Parsing error on JSON answer: Root object size is %d not 3.'), [o.Size]); {$ENDIF} Which would be fine for one single line, but there are dozens of similar lines which renders the code unreadable. I could IFDEF complete functions instead but that would mean to fix any bug in all these functions. I could add a class helper for TJSONObject that adds the missing Count function for earlier versions (I think they all support class helpers, so that would be doable.) I could derive TdzJSONObject from TJSONObject and add the missing Count function but that would not work for RTL code that returns a TJSONObject. I could write an inlined wrapper function JSONObject_size that encapsulates that IFDEF. That would improve readability but but would still be ugly. I could drop support for Delphi XE5 or earlier, but I'd rather not. You never know when you're going to need that. Can you think of any other options? -
How do you deal with deprecated symbols in backwards compatible code?
dummzeuch replied to dummzeuch's topic in RTL and Delphi Object Pascal
OK, I should have provided some background: This library is a hobby project of mine, there are only a very limited number of people that use it: I myself at work my two coworkers (but only in Delphi 2007, XE2 and lately 10.2) I myself (again) in many of my open source projects that support various versions of Delphi (for GExperts that means Delphi 6 and later), but not all units from that library are important for this Even though this library has been open source (MPL) for at least 15 years, I have never heard of anybody else using it (Which I think is a shame, but hey, they just don't know what they are missing out. 😉 ) So, I don't want to drop compatibility if it can be kept without too much hassle, I'm asking for alternatives. Believe it or not: Maintaining backwards compatibility can be fun if it involves creative (mis-)uses of language features. I am programming in Delphi for fun, not just for the paycheck, otherwise I would have dropped Delphi for Visual Studio more than 10 years ago. -
Applied. Thanks again.
-
Do you name your Threads for debugging?
dummzeuch replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
I wrote my own TThread class descendant which sets the name to the class name. It also automatically sets the name "Main" for the main thread. (Don't the latest Delphi versions already do that?) -
Is a standard comment before each procedure implementation useful?
dummzeuch posted a topic in GExperts
While fixing some bugs in the code formatter I came across a functionality that I didn't know about: procedure bla; begin end; The formatter can insert a fixed comment above each procedure like this: { procedure } procdure bla; begin end; It does this only if the configuration option CommentFunction is set to True. It's False by default and there is no GUI way to set it, so I never noticed. I think the way it currently works is pretty pointless, especially since the comment is hard coded as '{ procedure }' and is inserted above each procedure, function constructor and destructor. Even if there is already a different comment: { This is a comment } procdure bla; begin end; becomes { This is a comment } { procedure } procdure bla; begin end; Nobody needs that. Would any other automatically created comment be more useful? I can't think of any, but maybe somebody else has an idea? Currently I'd rather remove that functionality. I don't think a code formatter should add comments, it should simply format the source code that is there. -
I have no idea what might cause this, but since support is unable to resolve this, I would expect them to issue a new license just in case there is something wrong with the old one on Embarcadero's side. Since there are two different computers involved on your side it is likely to be a problem on their side. Hm, thinking about it: Has anything changed regarding your internet access? Is it possible that Embarcadero's servers can no longer be contacted? Could you maybe try to move your laptop to a friend and try his internet access to make sure? An option for support to help you could also be to convert your license to a Network Named User license. That would require you to run your own license server, but could prevent anything like this happening again.
-
Is a standard comment before each procedure implementation useful?
dummzeuch replied to dummzeuch's topic in GExperts
That's actually one change I made over Easter: The Formatter does no longer insert a blank line between a comment and the procedure it describes. Are there any other experts in GExperts that do this? -
Create a diff of all changed files (TortoiseSVN can do that, see TortoiesSVN -> Create Patch) and send it to me via private message or upload it as an attachment to a feature request on sourceforge.
-
Might be a nice addition. Care to submit a patch?
-
The base Exception class introduces various constructors. If you use ressources strings, there are two options: raise Exception.CreateFmt(MY_RES_STRING, [parameters, go, here]); raise Exception.CreateResFmt(@MY_RES_STRING, [parameters, go, here]); The second form is the one used everywhere in the RTL/VCL. It actually accepts a PResStringRec parameter. Up to now I also used that form in some of my internal libraries. But when I enabled the "Typed @ operator" compiler option today to get the compiler to find some errors in my code, it turned out that this form doesn't compile any more (in Delphi 2007, haven't tried anything else). Given that the first form works fine, why would I want to use the second form anyway?
-
I have never seen that problem, but I rarely use 10.3 and I don't use DevExpress at all. The call stack suggests that it happens in the drawing code somewhere, but apart from that I have no idea where to look.
-
Which doesn't help, since he is using Lazarus, not Delphi: On the other hand, the source code for the LCL is also available, but it's much more convoluted than the VCL, because it's supposed to be cross platform.
-
Automatically make your PC wake up at a given time
dummzeuch posted a topic in Tips / Blogs / Tutorials / Videos
Due the the COVID19 pandemic I am currently working from home, using Putty + ssh + Remote Desktop to log into and work on my office PC. For this to work, the office PC must be turned on and booted. So far I have let it running 24h which is really a waste of energy but since sometimes nobody is in the office at all, that was the most fool proof way. Today I have had some time at my hands waiting for an Ubuntu server to finish installing, so I thought about alternatives. ... read on in my blog post. -
Automatically make your PC wake up at a given time
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Apparently not. At least I have not seen any spontaneous awakenings 😉 of our office computers. There are three check boxes on the "Power Management" tab of the network controller properties (on my computer): * Allow the computer to turn off this device to save power * Allow this device to wake the computer * Only allow a magic packet to wake the computer On my computer, all of them are set. On a colleagues' computer the last one was not set. My colleague said that he didn't touch this (but on the other hand I don't remember doing that either on my computer), so I don't know what the default is. I can only assume that it depends on some circumstances during the installation. Maybe different hardware, or maybe whether the computer belongs to a domain or not (mine doesn't, the colleague's does). -
Automatically make your PC wake up at a given time
dummzeuch replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Aparently many modern computers are already configured to wake on any LAN activity, not just the WOL magic package. So e.g. trying to RemoteDesktop into a computer might be sufficient to wake it up. I tested this with two of our computers, both of which had a special setting to restrict WOL to the "magic package", which seems to be off by default. But I am not sure from which state this will work. WOL didn't work at the one time I actually shut down the computer rather than hibernating it. Another one didn't wake up from sleep. The only state for which this has always worked for me was hibernate. -
Is Record method solution or a bad hack for pointer fields?
dummzeuch replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
No, that's perfectly valid. But why don't you decleare RecPointer as ^TIniRec and save yourself the typecasting? Or are there pointers to different types? If the latter, why do you use records instead of classes? Actually I don't think this should compile: TComparedData = record PointerRecType: TRecType; // this identifies RecPointer as TINIRec RecPointer: Pointer; // Pointer to TINIRec ... function IsSectionHeaderLine: boolean; end; function TComparedData.IsSectionHeaderLine: boolean; begin Result := false; if RecPointer <> nil then Result := TINIRec(RecPointer^).IsSectionHeader; // <-- this should not compile as RecPointer is an untyped pointer and therefore RecPointer^ is undefined. end;