o815
Members-
Content Count
14 -
Joined
-
Last visited
Community Reputation
0 NeutralRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Hey there, I have following problem: I have a Grid with 14 Columns and dynamically 1...20 Rows. Now I want to be sure that the text in every cell (also header cells) will fit into the grid, but with following rule: The fontsize should be adjusted, meaning if any cell-text won't fit, the font-size would be decreased until it fits. I the other hand, if there is enough space in cell, the fontsize will increase. I tried such functions like Autosize := true AutoFitColumns() But they won't affect the fonzsize, so it seems I have to iterate through every fontsize and see if it fits. Someone had already a similar problem?
-
Hey man, thanks this did the trick, cool! Hm there is no option to make this a little more generic, meaning: I create a DLL which is using python4delphi, an has following function: DLL idea: TDemoInput = record varName : string; // the name of variable in python code varValue : variant; // value end; TDemoOutput = record varName : string; // the name of variable in python code varValue : variant; // value end; function demo(APythonCode : TStrings; AInput : TArray<TDemoInput>; var AOutput : TArray<TDemoOutput> ): integer; var j : integer; begin result := 0; // return code (for erros) for j := 0 to length(AInput)-1 do begin MainModule.<AInput[idx].varName> := AInput[idx].varValue; // pseudo code -> is this possible with RTTI?! end; PythonEngine.ExecStrings(APythonCode); for j := 0 to length(AOutput)-1 do begin AOutput[idx].varValue := MainModule.<AOutput[idx].varName> := ; // pseudo code -> is this possible with RTTI?! end; end; Now I could call one function in dll and execute the same code as in my first post: var cmd : TStringlist; frequeny : Variant; // array of double gain : Variant; // array of double ... cmd := TStringList.Create; cmd.Add('from scipy.signal import kaiserord, lfilter, firwin, freqz, firwin2'); cmd.Add('taps = firwin2(511, frequency, gain)'); //DLL call demo(cmd, frequency, gain);
-
Hey there, I was using the Python4Delphi library 2 years ago. So lately I decided to update to the latest version of P4D. I tried the example "35" from github: https://github.com/pyscripter/python4delphi/tree/master/Demos/Demo35 In my python code, I create an array "taps" which I want to read back to delphi. I dont't get understand how I can access to this varialbe: np_arr := ExtractPythonObjectFrom(taps); // np_arr = nil So my modified code looks like: const N = 100000; type PIntArray = ^TIntArray; TIntArray = array[0..N - 1] of Integer; var Sum: Int64; np: Variant; taps: Variant; np_arr: PPyObject; PyBuffer: Py_buffer; V: Variant; I: Integer; cmd : TStringList; begin try CreatePyEngine; try cmd := TStringList.Create; cmd.Add('from scipy.signal import kaiserord, lfilter, firwin, freqz, firwin2'); cmd.Add('taps = firwin2(511, [0.0, 0.032, 0.05, 0.07, 1.0], [0.0, 0.0, 15.0, 0.0, 0.0])'); { ^ |____________ I want to access this variable "taps" in delphi } PythonEngine.ExecStrings(cmd); // is executed without errors np_arr := ExtractPythonObjectFrom(taps); // np_arr = nil // PythonEngine.PyObject_GetBuffer(np_arr, @PyBuffer, PyBUF_CONTIG); // PythonEngine.CheckError; // try // Sum := 0; // for I := 0 to N - 1 do // Sum := Sum + PIntArray(PyBuffer.buf)^[I]; finally PythonEngine.PyBuffer_Release(@PyBuffer); end; finally DestroyEngine; end; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; ReadLn; end. Perhaps someone got the trick, whats wrong in my code?
-
[SOLVED] Delphi 12, FireDac, SQLite : capability not supported
o815 replied to weabow's topic in Databases
If someone want this in code, not in UI Designer: I just created an object "FDPhysSQLiteDriverLink " at initialization and set the property. Works for me. uses FireDAC.Phys.SQLiteWrapper.FDEStat, FireDAC.Phys.SQLiteWrapper, ... var FDPhysSQLiteDriverLink : TFDPhysSQLiteDriverLink; initialization FDPhysSQLiteDriverLink := TFDPhysSQLiteDriverLink.Create(nil); FDPhysSQLiteDriverLink.EngineLinkage := slFDEStatic; // compatibility Delphi >=12 finalization FDPhysSQLiteDriverLink.Free; end. -
Delphi 11.3, issue after encrypting exe file -> bad symbols @ GUI
o815 replied to o815's topic in Delphi IDE and APIs
Yeah you are right. I just had a little hope that someone else is having similar issues... Turns out the problem appears only when using an additional Delphi-DLL, so I'll contact wibukey. Sorry to bother you. -
Delphi 11.3, issue after encrypting exe file -> bad symbols @ GUI
o815 replied to o815's topic in Delphi IDE and APIs
Yep, the not encrypted exe is working. I am using an external "wibukey" encryption, so the complete encryption is done by an external exe provided by WibuKey. -
Delphi 11.3, issue after encrypting exe file -> bad symbols @ GUI
o815 posted a topic in Delphi IDE and APIs
Hi there, I've noticed some issue since we upgraded from Delphi 10.3 to 11.3. Currently after compiling our software as a "release", we encrypt the exe file with "WibuKey" (a USB Dongle for copy protection). Now (since Delphi 11.3) I have a strange issue with encrypted Delphi exe files, meaning that my GUI suddenly shows chinese / unreadable symbols f.e. on a simple TPanel.Caption. The thing is, TPanel.Caption isn't any resourcestring or something, also there is no localization file used. To double check it isn't an issue with the "release", we compiled it as "debug" an encrypted the exe file - same issue. In my understanding, there must be a difference between Delphi 10.3 - to 11.3 in the compiled exe file, especially with strings. So the encrypted exe file seems to read from the wrong "string-address" of the TPanel.Caption. Perhaps someone else has similar issues with encrypted delphi 11.3 exe files? -
serialize/deserialize data with RTTI
o815 replied to o815's topic in Algorithms, Data Structures and Class Design
Thanks, I have seen this library, too. Problem is that BSON (or only this BSON library) is not supporting dynamic arrays: I am using now the Grijjy implementation of Google Protocol Buffers which was suggested by "timfrost". The only uncool thing is that protocol buffers is not supporting 2D arrays (TArray<TArray<...>>) and TDatetime. TDatetime seems to be supported by the latest update of protocol buffer specification, but is not updated by Grijjy until now. BTW: I found another library which supports "messagepack". There's also a community version for free (but didn't test it): http://www.components4developers.com/products_kbmMW.html -
serialize/deserialize data with RTTI
o815 replied to o815's topic in Algorithms, Data Structures and Class Design
Yeah man, that looks nice, thanks! I'll give it a try. I also found another interesting git project which supports a lot of serialization standards (but still a work in progress): https://github.com/SeanSolberg/DynamicDataObjects JSON, BSON, MsgPack (similar to "protocol buffer") .... -
serialize/deserialize data with RTTI
o815 posted a topic in Algorithms, Data Structures and Class Design
Hi there, I was just wondering if anyone of you is using a cool de/serialization library (not JSON, something more "binary"). I am looking for something compact and want to avoid as much extra code as possible. Currently we are using (in my optionion (until now)) the coolest library: https://github.com/KrystianBigaj/kblib Note: Only cool if you don't use the de/serialized data out of delphi universe. What I like on this library, I can use just ONE LINE to de/serialize my structs (including Arrays etc): type //example definition of my data I want to de/serialize TStruct2 = record blabla : string; bla : boolean; end; TMyStruct = record foo : integer; foo2 : string; foo3 : TArray<Integer>; foo4 : TArray<TStruct2>; end; ... var s : TMemorystream; foo : TMyStruct; ... TKBDynamic.ReadFrom(s, foo , TypeInfo(TMyStruct)); // serialize data to memorystream TKBDynamic.WriteTo(s, foo , TypeInfo(TMyStruct)); // deserialize data from memorystream Does anybody out there know any similar and compact library (f.e. BSON) which can be easily used with a single line? When I look around, there is only something like this, which is too much overflow (in my opinion): https://docwiki.embarcadero.com/RADStudio/Alexandria/en/BSON Any suggestions? -
UInt64 -> TArray<Byte> -> shift bits
o815 replied to o815's topic in Algorithms, Data Structures and Class Design
Thanks I'll give it a try! -
UInt64 -> TArray<Byte> -> shift bits
o815 posted a topic in Algorithms, Data Structures and Class Design
Hey there, following problem: I used a UINT64 to represent bitewise data. So with UINT64 I have 64 bits. The problem is now, I need more than 64bits to represent my data. So I converted my UINT64 to an TArray<Byte>. Because it's a dynamic array I can represent 64Bits with array lenght = 8. So far so good, everything is working as expected, I can also use logical operators "AND", "OR" etc... bytewise. There is only one problem which I am not 100% sure how to solve it: With UINT64 and (JclLogic - JEDI Library) I was also able to shift my UINT64 "shl" / "shr". Someone has an idea how to shift bitwise in an TArray<Byte> ? My current idea is to first shift my array bytewise (if bitshift > 8Bits f.e.) and in second iteration I shift my bytes bitwise. Someone has another / better idea how to solve this? // Note: Self => Array to shift -> TArray<Byte> function shiftLEFT(ACount : Integer): TArray<Byte>; var idx : integer; buffer : Word; bytes : integer; bits : integer; cnt : integer; begin Setlength(result, Length(Self)); bytes := trunc(ACount/8); bits := Acount mod 8; SetLength(result, length(Self) + bytes); FillChar(result[0], length(result),0); // shift bytes CopyMemory(@result[bytes], @Self[0], length(Self)); cnt := length(result); // shift bits for idx := cnt-1 downto 0 do begin buffer := result[idx] shl bits; if(buffer > $FF) then begin // MSB BYTE if(idx = length(result)-1) then begin SetLength(result, cnt+1); result[cnt] := (buffer shr 8) and $FF; result[idx] := (buffer ) and $FF; end else begin result[idx + 1] := ((buffer shr 8) and $FF) or result[idx + 1]; result[idx ] := (buffer ) and $FF; end; end else begin result[idx] := (buffer) and $FF; end; end; end; -
Delphi Update 10.3.2 -> 11.3 -> no more TLS1.2 handshake
o815 replied to o815's topic in Delphi IDE and APIs
Hey man, thanks a lot! passthrough := false did the trick! Seems this variable was set default false at 10.3.2 and now is default true in 11.3, but you are right: not setting this variable explicit is my bad. -
Hey there, I recently updated out Delphi from 10.3.2 to 11.3. We are communicating as a TLS-Client to our hardware (TLS-Server) via TLS 1.2. On Delphi 10.3.2 everything was working fine, but since the updated Version, I get a "bad hello message" at the handshake of my server. We are using the OpenSSL librariers and Indy libeay32.dll ssleay32.dll procedure myFoo; var FIdTCPClient : TIdTCPClient; FIdSSLIOHandler : TIdSSLIOHandlerSocketOpenSSL; begin FIdTCPClient := TIdTCPClient.Create; FIdTCPClient.Host := '10.10.10.10'; FIdTCPClient.Port := 10007; FIdSSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create; FIdSSLIOHandler.SSLOptions.Mode := sslmClient; FIdSSLIOHandler.SSLOptions.VerifyMode := []; FIdSSLIOHandler.SSLOptions.VerifyDepth := 0; FIdSSLIOHandler.SSLOptions.SSLVersions := [sslvTLSv1_2]; FIdSSLIOHandler.SSLOptions.Method := sslvTLSv1_2; FIdTCPClient.IOHandler := FIdSSLIOHandler; FIdTCPClient.Connect; FIdTCPclient.Send([0,1,2,3]); // send testdata -> server says "bad hello message" --> testdata is working @ Delphi 10.3.2; Delphi 11.3 not end; So I tried the "ICS" component and did in my opinion the same thing, just advanced the demo "...\icsv870\Samples\Delphi\SslInternet\OverbyteIcsSimpleSslCli.dproj". With this component, the communication is working! So it seems like an issue with indy. procedure TForm1.Button1Click(Sender: TObject); begin Sock.Addr := '10.10.10.10'; Sock.Port := '10007'; RecStream.Size := 0; Sock.SslEnable := TRUE; Sock.Connect; //--> sock.TimeoutIdle := 60000; sock.TimeoutConnect := 60000; Sock.StartSslHandshake; // connected with server end; procedure TForm1.Button2Click(Sender: TObject); begin Sock.SendTB([0,1,2,3,4,5,6,7,8,9]); // this data was received by server end; Embarcadero support could't help me, because indy isn't a component developed by them. So anybody else having issues wiht TLS1.2 after updating? Did I miss something to set another parameter in indy? Thanks in advance. By the way, I am using the libeay32.dll, ssleay32.dll with the timestamp of (2019-12-21). I am not able to use the current DLLs which are recommended by embarcadero: https://docwiki.embarcadero.com/RADStudio/Sydney/de/OpenSSL If I use them, I get an error (" Could not open SSL library "), which I found already there: On worst case, I have to switch to "ICS", I try to avoid 3rd party tools and significant changed on TLS communication....