Jump to content

dummzeuch

Members
  • Content Count

    2973
  • Joined

  • Last visited

  • Days Won

    106

Everything posted by dummzeuch

  1. dummzeuch

    New Grep Expert in GExperts - need a name

    Thanks for the suggestions. So far I like InstantGrep and LiveGrep best. InstantGrep might be better because LiveGrep in my opinion suggests that it also updates when the source code is changed or even when switching to a different tab, which at least currently is not the case and I am not sure I want to go that way. Some other suggestions at least made me smile. Thanks for these too.
  2. When running stand alone, GExperts Grep Results can not be opened in the IDE. Instead an external text editor is used. This editor and the required parameters to open the file and set the cursor at the desired line and column must be configured in the File → Options menu. I have now added buttons with the pre-sets for some popular ... read on in the blog post.
  3. I don't think this will work as the editor control (TEditControl) does not descend from TEdit or TMemo but from TWinControl (via TCustomControl -> TCustomEditControl): But I might be wrong, maybe one of those controls processes this message. Edit: TMemo descends from TCustomEdit (which itself descends from TWinControl), not from TCustomEditControl.
  4. dummzeuch

    GREP menu and shortcut misery

    Hm, that's odd. I just tried it again with Delphi 11 just to be sure (before I used 11.2). Again, Shift+Alt+S and Ctrl+Alt+R worked fine for me. But then I assigned Shift+Alt+S as shortcut to the "Grep" entry rather than to the "Grep Search" entry and got the same popup menu as you. So it's likely that it's the same in your configuration:
  5. dummzeuch

    GREP menu and shortcut misery

    You can still assign individual shortcuts to "Grep Search" and "Grep Results", and there is no need to assign a shortcut to "Grep" (the submenu). In fact that's the default. And for me it works the same way as it always has.
  6. AFAIK this can only be done using the OTAPI which is only available for IDE plugins.
  7. dummzeuch

    What am I missing here??

    Just going by the error message JTAfterEdit might need a parameter of type TDataset rather than TObject.. No idea whether that's correct, I haven't done any database programming for years. But also: Shouldn't JTAfterEdit be a method rather than a procedure?
  8. It has always irked me that in C you can write: while (0<(BytesRead=Read(...))) { // .. } But in Delphi you have to use the much less readable BytesRead := Stream.Read(Buffer, BufSize); while BytesRead > 0 do begin // .. BytesRead := Stream.Read(Buffer, BufSize); end; Today I had enough and wrote these simple helper functions: function TStream_TryRead(_st: TStream; var _Buffer: TBytes; _Count: Int32; out _BytesRead: Int32): Boolean; overload; inline; begin _BytesRead := _st.Read(_Buffer, _Count); Result := (_BytesRead > 0); end; function TStream_TryRead(_st: TStream; var _Buffer; _Count: Int32; out _BytesRead: Int32): Boolean; overload; inline; begin _BytesRead := _st.Read(_Buffer, _Count); Result := (_BytesRead > 0); end; function TStream_TryRead(_st: TStream; _Buffer: TBytes; _Offset, _Count: Int32; out _BytesRead: Int32): Boolean; overload; inline; begin _BytesRead := _st.Read(_Buffer, _Offset, _Count); Result := (_BytesRead > 0); end; function TStream_TryRead(_st: TStream; _Buffer: TBytes; _Offset, _Count: Int64; out _BytesRead: Int64): Boolean; overload; inline; begin _BytesRead := _st.Read64(_Buffer, _Offset, _Count); Result := (_BytesRead > 0); end; With these you can write: while TStream_TryRead(Buffer, BufSize, BytesRead) do begin // .. end; Yes, that's far from being rocket science. It's probably possible to convert these into a class helper, but I can't be bothered. (Original Blog post.)
  9. dummzeuch

    while TStream_TryRead() do

    Shouldn't that be until BytesRead <= 0 ? Hm, And where does the code to process those bytes go in this case? I admit I should have included a call for that in my original example. Something like this: while TStream_TryRead(Buffer, BufSize, BytesRead) do begin Process(Buffer, BytesRead) end; Because what's the point in reading from the stream when you just throw away the data read from it? Unless of course you want to simply empty the stream. Of course, the Process procedure itself could check whether the BytesRead parameter is <= 0. In that case a repeat loop would work: repeat BytesRead := Stream.Read(Buffer, BufSize); Process(Buffer, BytesRead; until BytesRead <= 0; But that just means that the if statement goes into the Process procedure instead of the loop: repeat BytesRead := Stream.Read(Buffer, BufSize); if BytesRead > 0 then Process(Buffer, BytesRead; until BytesRead <= 0;
  10. dummzeuch

    while TStream_TryRead() do

    That depends on what you want to do with these bytes. It might be crucial to process them as fast as they can be read. E.g. if they come from a device (e.g. via serial port) and you need a time stamp to know when exactly they were received (Yes, I know from experience that this would be far from reliable. We are talking Windows, not some real time OS here.)
  11. We currently are using TIdTCPClient and TIdTCPServer from Indy10 for communication between applications written in Delphi 2007, so all strings are AnsiStrings. Now I have got the first program that is written in Delphi 10.2, so all strings are now Unicode strings. Is there anything special I need to do so it can communicate with the existing server which is still written in Delphi 2007? Edit: Strings here are only used for text (commands and parameters) not abused as buffer for binary data.
  12. dummzeuch

    while TStream_TryRead() do

    Hm, an endless loop with an obscured break is not quite what I would call elegant and easily readable. But yes, that's one way a repeat loop "would do the trick".
  13. dummzeuch

    while TStream_TryRead() do

    Care to provide an example?
  14. dummzeuch

    Project Options -> Version Info aka. dproj madness

    https://blog.dummzeuch.de/2015/09/26/using-my-buildtools/ Actually, it's even older: http://www.dummzeuch.de/delphi/dzprepbuild/englisch.html
  15. dummzeuch

    Project Options -> Version Info aka. dproj madness

    I haven't got a build server, but use the post build event in the IDE (and in command line builds) instead.
  16. dummzeuch

    Project Options -> Version Info aka. dproj madness

    Since the version info stuff never really worked very well since at least Delphi 2005, I don't use the IDE to manage the version info but create a version info resource externally and link it to the executable. As as side effect, I have no more annoying changes in the dproj file that show up in SCM with every build.
  17. dummzeuch

    Rad studio install on several machines

    If you need to do that more than once: If you have got an active subscription, I suggest to have your license converted into a Network Named User license (As far as I know that's possible any time and does not cost anything. Ask Embarcadero.). This will allow you as many installations as you like as long as the user name is the same on all installations. You'd need to run the Embarcadero License Center on the network though, but that can also be a virtual machine. I blogged about that a while ago. If it's only this one time: The License used to be bound to the computer name (I think that's still the case) and you could copy the contents of the directory C:\ProgramData\Embarcadero to the new machine (But again: You have to use the same computer name for this to work, which is only possible if only one computer with that name is on the Network at any time.) If that doesn't work, try a new online activation. If that doesn't work because you have already reached the maximum number of possible installations (2!) the you need to contact Embarcadero sales to bump the number of activations for you.
  18. I'm sure everybody else noticed that a bot has started to spam this forum using several accounts. The motive behind this is trying to promote fake airline phone numbers for scamming people. And apparently nobody who can do something about it, has so far noticed.
  19. Delphi has for a while contained two classes that simplify stream compression: TZCompressionStream TZDecompressionStream I had not used them before and when I tried to use them now to compress and decompress some binary data that is stored as part of a large file, I got some inexplicable results. So I wrote this little test program to find the problem. Read on in the blog post.
  20. What kind of application are we talking here? VCL? FMX? Console? That you get a runtime error rather than an exception hints at something going wrong before an exception handler is active.
  21. Since as the last step he does an actual comparison between the input string and the string "found" by the hash function(*1), it should work with any input string. The important part is that the strings he is searching for are known beforehand, so he can fine tune the hash function. (*1: At least he was still doing that when I stopped watching at about 3/4 of the video.)
  22. I am trying to convert an import lib file for a dll meant for Visual Studio (therefore in COFF format) to OMF format to be used in C++ Builder: c:\Program Files\somecompany\cpp\lib32\Debug>coff2omf -lib:ms libraryname.lib c:\sources\libs\libraryname.lib coff2omf takes a few seconds does not output any error messages but does not create any output file. If I add the -v option, it will output lots of symbol names, but still create no output file. The input file is readonly but the output directory is writable. What am I missing this time? I'm beginning to suspect I should have used Visual Studio rather than C++ Builder, but we don't have a license for that. Does anybody have any experience with Embarcadero Dev C++ ?
  23. Some of these computers have access to the same servers, but many don't, so a network share is out. Hm, yes, version control would probably work. Never thought of that.
  24. The repository is one of the many ancient but mostly unknown features of the IDE. Thanks for reminding me. It can also store frequently used preconfigured components (e.g. an Ok button) and even component groups (e.g. an Ok plus a Cancel button), that can then be easily accessed through the component palette. Unfortunately I have so many different installations on various computers, that every time I remember using that feature, the template is on a different computer. But I guess that's rare.
×