Jump to content

Uwe Raabe

Members
  • Content Count

    2838
  • Joined

  • Last visited

  • Days Won

    168

Everything posted by Uwe Raabe

  1. Uwe Raabe

    Request

    Can you explain a bit more, please?
  2. Uwe Raabe

    Changing the WordWrap property of a TMemo runtime

    Seems legit. If you have a horizontal scroll bar there is no need for wrapping anything.
  3. Uwe Raabe

    TControl.SetParent

    You are not alone: Parented controls with free notifications aren't scaled Frame with Assigned PopupMenu is wrong Displayed on high DPI A scaled form gets resized to design time ClientWidth/ClientHeight when embeded in a parent form
  4. That's an important point. There are situations where your program is not the only one accessing the data. This doesn't mean that it could not be done different, but sometimes these other systems are out of your reach.
  5. Not sure if it fits your needs, but nevertheless this might be an interesting read for you (unless you have already done so): Dataset Enumerator Reloaded And here ist the corresponding rep: DataSetEnumerator
  6. Yes, there are. One can use this fact to distinguish between UTF8 and ANSI encoding. An ANSI encoded text file can throw an exception when read as UTF8 if it contains certain characters. UTF8 character sequences start with a specific byte range followed by one to three bytes from a different range. Simply exchanging the first two bytes of a UTF8 sequence invalidates the file.
  7. Uwe Raabe

    Project Magician gotcha

    @timfrost It doesn't matter if what you do with Project Magician is intended usage or not - it should not crash - period. In case this depends on the project file: Can you send me a copy, please?
  8. Uwe Raabe

    Project Magician gotcha

    Can you send me that dproj file? The version info is handled directly when you save the project options from the dialog - or you change the Project Magician options.
  9. Uwe Raabe

    string helpers question

    Actually, I like this and make heavy use of it. begin if Value.StartsWith(Prefix, IgnoreCase) then Result := Value.Substring(Prefix.Length) else Result := Value; end; is just easier to read than var isPrefixed: Boolean; begin if IgnoreCase then isPrefixed := StartsText(Prefix, Value) else isPrefixed := StartsStr(Prefix, Value); if isPrefixed then Result := Copy(Value, Length(Prefix) + 1, Length(Value)) else Result := Value; end;
  10. Uwe Raabe

    Project Magician gotcha

    Which platforms are in your project? There is indeed a different behavior for Windows-only projects and others. If there are other platforms than Win32 and Win64, the base configuration stays as is (usually it then is empty anyway). But perhaps something is just going wrong there.
  11. Uwe Raabe

    string helpers question

    I agree about Contains missing a case-insensitive option. On the other hand, the requested LowerCase functionality is already there under the name ToLower. Alas, there are more functions missing from the string helper where you need to fall back to the global ones.
  12. Uwe Raabe

    Delphi 10.4.1 and the IDE FIx Pack

    But that applies to the Community Edition as well. The only way to get around it is to buy a commercial license then (which is what I do btw.)
  13. Uwe Raabe

    Project Magician gotcha

    Yes, read-only files are out of bounds. The latest version also recovers from any write errors caused by insufficient access rights.
  14. Uwe Raabe

    Delphi 10.4.1 and the IDE FIx Pack

    AFAIK, Embarcadero offered a free one-year license (similar to what MVPs and Tech Partners get) to Andreas - probably more than once. Seems there is not much interest.
  15. Uwe Raabe

    Project Magician gotcha

    Actually I am thinking about some mechanisms for a DO NOT TOUCH! feature in Project Magician. While this is supposed to handle more cases than some Delphi library files only, I am still unsure how to implement it in a flexible as well as easy to handle way. I guess, this qualifies for a QP report anyway. Some sort of Clean Linefeeds action before commit/check-in should be mandatory - even for Embarcadero. Not to mention a Format Sources.
  16. Uwe Raabe

    Best way to prevent multiple instances? Mutex not working

    If a mutex is not working you are probably doing something wrong.
  17. Uwe Raabe

    proper way to check server up or down in rest application

    TRestRequest has also a method ExecuteAsync with handlers for successful completion and error handling (in addition to the event handlers OnAfterExecute and OnHTTPProtocolError). Depending on your specific needs it may boil down to just a simple call like this: RequestLogin.ExecuteAsync( procedure begin ShowMessage('server up'); end, True, True, procedure begin ShowMessage('server down'); end);
  18. As all fields in that record are either 32 or 64 bit (depending on the target platform) it doesn't matter if the record were declared as packed or not.
  19. Perhaps a simple "Open as text" in the context menu of a DFM in the project manager may be sufficient.
  20. Uwe Raabe

    Key Combination to enter Edit or Insert mode??

    Which control is supposed to handle that key stroke? TDBGrid reacts on <F2> and <Insert>.
  21. Uwe Raabe

    Set focus to IDE editor

    I have to find out...
  22. If I got that right, Stefan is referring to the case where the array is relocated, which invalidates the record pointers. This is not the case for a class list, where only pointers to the class instances are stored inside the array. Relocating such an array will keep the instance pointers intact.
  23. Isn't that just the same with classes? Of course one has to know what can be done and what should be avoided. That is no difference to the standard generic record list, where you need to know that you are changing content of copies of records and not that of the records itself. My approach (which may be more a proof of concept than a solution for production) allows to work with a generic record list just like with the standard one, with the feature to change the record contents in the list, just like it was a simple array of records. I am pretty sure that it will work for the majority of use cases. Whenever the language gets a new feature that makes this obsolete - so then. It is near to impossible (and probably not even desirable) to make everything fool proof. IMHO fools shouldn't be allowed to write programs in the first place.
  24. I think that would be too much of a hassle, especially when you are working with relative paths and/or want to configure that on a per project/-group level. One could even throw wildcards in there to complicate things further. You can either switch off that feature or make the offending files read-only. BTW, I also get these LF problems with Spring4D all over the place, but I usually don't debug it. Interestingly, up to now it seems to be the only library with this hickup.
  25. It is not very difficult to make a generic list for records that allows manipulating the record content directly: type TChangeableRecordList<T: record> = class(TList<T>) type PT = ^T; private function GetItem(Index: Integer): PT; procedure SetItem(Index: Integer; const Value: PT); public property Items[Index: Integer]: PT read GetItem write SetItem; default; end; implementation function TChangeableRecordList<T>.GetItem(Index: Integer): PT; begin Result := Addr(PList^[Index]); end; procedure TChangeableRecordList<T>.SetItem(Index: Integer; const Value: PT); begin inherited Items[Index] := Value^; end; A suitable test case could look like this: type TMyRec = record IntValue: Integer; end; var list: TChangeableRecordList<TMyRec>; myRec: TMyRec; begin list := TChangeableRecordList<TMyRec>.Create; try myRec.IntValue := 1; list.Add(myRec); Assert(list[0].IntValue = 1); list[0].IntValue := 3; Assert(list[0].IntValue = 3); finally list.Free; end; end;
×