-
Content Count
277 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Jacek Laskowski
-
[Firedac] Truncation error on Firebird select query
Jacek Laskowski replied to Jacek Laskowski's topic in Databases
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; -
[Firedac] Truncation error on Firebird select query
Jacek Laskowski replied to Jacek Laskowski's topic in Databases
See: http://docwiki.embarcadero.com/Libraries/Rio/en/FireDAC.Stan.Option.TFDFormatOptions.StrsTrim2Len citation from doc: -
[Firedac] Truncation error on Firebird select query
Jacek Laskowski replied to Jacek Laskowski's topic in Databases
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?? -
[Firedac] Truncation error on Firebird select query
Jacek Laskowski replied to Jacek Laskowski's topic in Databases
Maybe this is corrected in Rio? Can anyone check it out in Rio? -
[Firedac] Truncation error on Firebird select query
Jacek Laskowski replied to Jacek Laskowski's topic in Databases
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? -
[Firedac] Truncation error on Firebird select query
Jacek Laskowski replied to Jacek Laskowski's topic in Databases
Yes Yes -
Code expert for fixing very simple and obvious syntax errors?
Jacek Laskowski replied to PeterPanettone's topic in Delphi IDE and APIs
Look for ESLint, add-on for VSCode -
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.
-
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
-
Named pipe failure, multithreading and asynchronous I/O
Jacek Laskowski replied to FPiette's topic in Windows API
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. -
Named pipe failure, multithreading and asynchronous I/O
Jacek Laskowski replied to FPiette's topic in Windows API
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 -
Named pipe failure, multithreading and asynchronous I/O
Jacek Laskowski replied to FPiette's topic in Windows API
Will this project be publicly available in a repository? -
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?
-
Spring4D and IEqualityComparer<T>
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
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. -
Spring4D and IEqualityComparer<T>
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
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; -
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.
-
Check for override
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
the temptation to optimize is sometimes so great... 😉 -
New feature suggestion for MMX: implementation marking in Find Identifier window
Jacek Laskowski replied to PeterPanettone's topic in MMX Code Explorer
Maybe green and gray circle would be enough? Without plus or minus sign? Green for interface, gray for implementation (gray as in shadow, hidden). -
Check for override
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
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). -
Check for override
Jacek Laskowski replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
Thanks for both solutions, I use Spring4D, but "seek" way is worth attention too (and probably faster). -
CNPack has similar or in some cases better solution, see:
-
from Microsft site: " [Network DDE is no longer supported. Nddeapi.dll is present on Windows Vista, but all function calls return NDDE_NOT_IMPLEMENTED.] "
-
https://github.com/ahausladen/JsonDataObjects by Andreas Hausladen
-
Discussion: JSON and templates
Jacek Laskowski replied to Mahdi Safsafi's topic in Algorithms, Data Structures and Class Design
Maybe instead of thinking up a language, use TypeScript? In JS (and TS), JSON automatically becomes an object (Java Script Object Notation). -
Caching with class variables
Jacek Laskowski replied to Primož Gabrijelčič's topic in Tips / Blogs / Tutorials / Videos
what about thread safety?