Jump to content

Jacek Laskowski

Members
  • Content Count

    277
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Jacek Laskowski

  1. Jacek Laskowski

    [Firedac] Truncation error on Firebird select query

    128 = 32 * 4 where 32 is column size in chars and 4 comes from hardcoded method: function TIBLib.GetBytesPerChar(ACSID: Integer): Integer; var iID: Integer; begin iID := ACSID mod 256; if iID = csIDUnicodeFSS then Result := 3 else if iID = IDUTF8 then Result := 4 <<<------------------ for UTF8 columns else if (FBrand = ibInterbase) and ((iID = csIDUnicodeBE) or (iID = csIDUnicodeLE)) then Result := 2 else Result := 1; end;
  2. Jacek Laskowski

    [Firedac] Truncation error on Firebird select query

    See: http://docwiki.embarcadero.com/Libraries/Rio/en/FireDAC.Stan.Option.TFDFormatOptions.StrsTrim2Len citation from doc:
  3. Jacek Laskowski

    [Firedac] Truncation error on Firebird select query

    I debug FD and I found suspected place: and DataSize method code: function TIBVariable.GetDataSize: LongWord; begin if FDataSize = 0 then Result := sqllen else Result := FDataSize; end; But why result (sqllen) is 128??
  4. Jacek Laskowski

    [Firedac] Truncation error on Firebird select query

    Maybe this is corrected in Rio? Can anyone check it out in Rio?
  5. Jacek Laskowski

    [Firedac] Truncation error on Firebird select query

    Correction, Insert does not work either 😕 Before query execution (param value is longer than column size): After F9: Delphi Tokyo, FB 2.5.8. Does the StrsTrim2Len option work at all?
  6. Jacek Laskowski

    [Firedac] Truncation error on Firebird select query

    Yes Yes
  7. Jacek Laskowski

    Code expert for fixing very simple and obvious syntax errors?

    Look for ESLint, add-on for VSCode
  8. Jacek Laskowski

    DSK file

    Delphi saves the desktop settings in the DSK file. The currently open/active modules are saved there. This file, according to my observations, is saved ONLY when closing Delphi or closing the project. How do you force Delphi to save this file without closing the project? It irritates me very much when after Delphi hangs (often!) I lose these settings.
  9. Jacek Laskowski

    DSK file

    Save All does not save these settings. I'm also not sure that this is saved in the registry, because it is a per-project setting. ps. autosave options are of course marked
  10. Jacek Laskowski

    Named pipe failure, multithreading and asynchronous I/O

    I'm sorry, actually a browser-side problem, my antivirus (kaspersky) has blocked the call. It's kind of weird because I've had this antivirus for two years and I have never heard such a message.
  11. Jacek Laskowski

    Named pipe failure, multithreading and asynchronous I/O

    I try download from your site, but I get error: Access denied The requested URL cannot be provided http://www.overbyte.eu/cgi-bin/redirect1<...> Blocked by Web Anti-Virus Reason: threat of data loss Detection method: cloud protection
  12. Jacek Laskowski

    Named pipe failure, multithreading and asynchronous I/O

    Will this project be publicly available in a repository?
  13. Is it possible to register a generic class implementing the delphi IEqualityComparer<T> in the Spring container? This interface does not have a GUID and RegisterType generates an error. How to do it?
  14. Jacek Laskowski

    Spring4D and IEqualityComparer<T>

    Ok, I paste more code with real example: program s4dgic; uses System.Generics.Defaults, Spring.Collections, Spring.Container, System.SysUtils; {$APPTYPE CONSOLE} {$R *.res} type TBaseClass<T, V> = class(TInterfacedObject) private fDict: IDictionary<T, V>; public constructor Create(const aComparer: IEqualityComparer<T>); virtual; end; constructor TBaseClass<T, V>.Create(const aComparer: IEqualityComparer<T>); begin inherited Create; fDict := TCollections.CreateDictionary<T, V>(aComparer); end; type RKey = record FieldA: Integer; FieldB: String; end; TMyEqualityComparer = class(TEqualityComparer<RKey>) public function Equals(const Left, Right: RKey): Boolean; override; end; function TMyEqualityComparer.Equals(const Left, Right: RKey): Boolean; begin Result := (Left.FieldA = Right.FieldA) and (Left.FieldB = Right.FieldB); end; type IMyIntf = interface ['{874B15D9-675E-428B-906A-D526FCC3AE0D}'] end; TMainClass = class(TBaseClass<RKey, TObject>, IMyIntf) public constructor Create(const aComparer: IEqualityComparer<RKey>); override; end; constructor TMainClass.Create(const aComparer: IEqualityComparer<RKey>); begin inherited Create(aComparer); end; var C: TContainer; I : IMyIntf; begin try C := TContainer.Create; >>>>> how to register required types? <<<< C.RegisterType<TMainClass>.Implements<IMyIntf>; C.Build; I := C.Resolve<IMyIntf>; C.Free; Readln; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end.
  15. Jacek Laskowski

    Spring4D and IEqualityComparer<T>

    Yes, I have class with IEqualityComparer<T> in constructor, so I need the container to be able to resolve this interface... but this is impossible? TMyClass<T> = class(TInterfacedObject, IMyInterface) constructor Create(const aKeyComparer : IEqualityComparer<T>); end;
  16. Jacek Laskowski

    Unused local variables

    I knew that you're sticking to it ... 🙂 I try to eliminate warnings from my own code, but I have warnings from external libraries, eg Synapse, DCPCrypt and others.
  17. Jacek Laskowski

    Check for override

    the temptation to optimize is sometimes so great... 😉
  18. Maybe green and gray circle would be enough? Without plus or minus sign? Green for interface, gray for implementation (gray as in shadow, hidden).
  19. Jacek Laskowski

    Check for override

    The class design is rather good, the override detection I need in order to optimize performance (class implements cache in the REST server). The ancestor (in base class) method returns always False, the descendant method can change this behavior, but if it does not change, I prefer to check the boolean flag rather than call the method (just because it's faster).
  20. Jacek Laskowski

    Check for override

    Thanks for both solutions, I use Spring4D, but "seek" way is worth attention too (and probably faster).
  21. Jacek Laskowski

    Extremely useful feature

    CNPack has similar or in some cases better solution, see:
  22. Jacek Laskowski

    Communication between processes (IPC)

    from Microsft site: " [Network DDE is no longer supported. Nddeapi.dll is present on Windows Vista, but all function calls return NDDE_NOT_IMPLEMENTED.] "
  23. Jacek Laskowski

    Please faster json library

    https://github.com/ahausladen/JsonDataObjects by Andreas Hausladen
  24. Jacek Laskowski

    Discussion: JSON and templates

    Maybe instead of thinking up a language, use TypeScript? In JS (and TS), JSON automatically becomes an object (Java Script Object Notation).
  25. Jacek Laskowski

    Caching with class variables

    what about thread safety?
×