-
Content Count
437 -
Joined
-
Last visited
-
Days Won
5
Everything posted by Cristian Peța
-
TBitmap to TBytes for ESC/POS Thermal Printer
Cristian Peța replied to at3s's topic in RTL and Delphi Object Pascal
If this was the fix then this was a lottery. I was thinking you need to get rid of that SendString() everywhere. At least when you send binary data. And Lo(ABitmap.Width) is binary data. If you want to send text and to be readable in source you can use AnsiString and convert to TBytes. Using String to store bytes is as @David Heffernan would say: perverse. -
TBitmap to TBytes for ESC/POS Thermal Printer
Cristian Peța replied to at3s's topic in RTL and Delphi Object Pascal
Here you are sending String converted with TEncoding.ASCII.GetBytes() to TBytes. Why not directly? LSockect.SendData([$1B, 42, 33, Lo(ABitmap.Width), Hi(ABitmap.Width)]); -
Delphi service in a domain controlled environment
Cristian Peța replied to thomh's topic in Network, Cloud and Web
Why to sleep 5 second? And ShellExecute() doesn't create a child processes. -
Delphi service in a domain controlled environment
Cristian Peța replied to thomh's topic in Network, Cloud and Web
It's not the best method but I run a batch file with net stop ServiceName net start ServiceName -
TBitmap to TBytes for ESC/POS Thermal Printer
Cristian Peța replied to at3s's topic in RTL and Delphi Object Pascal
If you don't have the documentation then at least follow what that article says clearly: " This is because low-level programmers, such as those who designed the ESC/POS language, tend to blur the lines between data types: it’s all bytes at the end of the day." You need to write binary data. Simply don't put binary data in String and convert using TEncoding.ASCII.GetBytes(). This won't help you. But if you want to know I used TBytes. -
XML Parsing and Processing
Cristian Peța replied to pyscripter's topic in RTL and Delphi Object Pascal
IMAGE_FILE_LARGE_ADDRESS_AWARE. I use this also but not enough in some cases. And 64 bit is not yet an option because I don't want both 32 and 64 and there are about 10% with 32bit OS in case of my users. https://github.com/neslib/Neslib.Xml -
XML Parsing and Processing
Cristian Peța replied to pyscripter's topic in RTL and Delphi Object Pascal
Fine, if you are not on 32bit and memory is at limit when you save the XML. It will save nicely but truncated. Fast, if you don't have to many attributes in a node. If you have 100 attributes it's starting to slow down perceptible. I had a case with tens of thousands. These are corner cases but showstoppers for me. Better try Neslib.Xml. I have an implementation that is not faster than Neslib.Xml (slightly slower and more memory) but faster in my case if there are many attributes in a node because I use a dictionary for storing the attributes. -
TBitmap to TBytes for ESC/POS Thermal Printer
Cristian Peța replied to at3s's topic in RTL and Delphi Object Pascal
You are using examples from others that doesn't work or doesn't work in your case. Maybe it's time to read the documentation of that printer, understand it and do it right. From what I understood reading a little Nicholas Piasecki's article is that you need to send binary data. Not ASCII. And from your code it's clear that you need (like in Nicholas Piasecki's article) a monochrome, one bit per pixel image. In top-bottom and right-left order. This is binary data. A sort of simplified PCX graphic format (long time ago I wrote a little procedure to save TBitmap to PCX format). Your don't need SendString(AValue: String) function. Use directly LSockect.SendData() instead. And don't use String but TBytes like LSockect.SendData() is expecting. -
With 10.4.1 there was issues with CodeinSight and some %IFDEF's but with 10.4.2 I have not seen yet any issues till now.
-
Something about performance: https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-8700K+%40+3.70GHz&id=3098
-
deleted
-
How do you know that it crashes exactly at that line of code? Do you have a stack-trace? A message?
-
I have a project using TidHTTPServer on Delphi 10.3.3 using Indy from Delphi installation. SSL libraries 1.0.2u. All is working. I moved this project to Delphi 10.4.2 and while on http is still working, on https doesn't work anymore. In Fiddler I have his error: [Fiddler] The connection to 'localhost' failed. System.Security.SecurityException Failed to negotiate HTTPS connection with server.fiddler.network.https> HTTPS handshake to localhost (for #377) failed. System.IO.IOException Authentication failed because the remote party has closed the transport stream. And in the browser: ERR_TIMED_OUT Here is the code: var ServerSSLIOHandler: TIdServerIOHandlerSSLOpenSSL; begin ..... RootDir := ExtractFilePath(ParamStr(0)); ServerSSLIOHandler := TIdServerIOHandlerSSLOpenSSL.Create(nil); ServerSSLIOhandler.SSLOptions.RootCertFile := RootDir + 'root.pem'; ServerSSLIOhandler.SSLOptions.CertFile := RootDir + 'cert.pem'; ServerSSLIOhandler.SSLOptions.KeyFile := RootDir + 'key.pem'; ServerSSLIOhandler.SSLOptions.Method := sslvSSLv23; ServerSSLIOhandler.SSLOptions.Mode := sslmServer; ServerSSLIOhandler.OnGetPassword := nil; ServerSSLIOhandler.OnVerifyPeer := OnVerifyPeer; FIdHTTPServer := TIdHTTPServer.Create(nil); FIdHTTPServer.IOHandler := ServerSSLIOHandler; FIdHTTPServer.DefaultPort := 8000; FIdHTTPServer.OnCommandGet := FIdHTTPServerCommandGet; FIdHTTPServer.OnCreatePostStream := FIdHTTPServerCreatePostStream;
-
@zMotoR if you are giving to the user the ability to modify scripts and you are afraid that someone will write an exit(), this looks like a nice method that can be easily applied automatically in the background without the user knowledge.
-
Inch representation format in TEdit like controls
Cristian Peța replied to Cristian Peța's topic in General Help
Now I see there is an TMaskEdit.EditText property. But it looks odd if you have a mask like this "0000 00\/00;0;_" and want to write only "1 1/2" -
Inch representation format in TEdit like controls
Cristian Peța replied to Cristian Peța's topic in General Help
But if you read the Text property you have "12316". How to transform this into a value? And what if the user want to type "12 15/16" or "123 1/4"? And I have my control that do the job but was wondering if there are some other edit controls for this. Maybe it's not so common. -
Hiding a public property in a descendant class
Cristian Peța posted a topic in RTL and Delphi Object Pascal
TMyEdit = class(TCustomEdit) private property Text; end; I try to hide the Text property of TCustomEdit in a descendant class but it doesn't work. Code insight (LSP) in other unit does not see it but the compiler does not complain if I use it. Can I do something to hide the Text property? -
Delphi service in a domain controlled environment
Cristian Peța replied to thomh's topic in Network, Cloud and Web
I think a standard Delphi service would be using TService. http://docwiki.embarcadero.com/RADStudio/Sydney/en/Service_Applications Just create a service project and put this in OnExecute event: procedure TService1.Service1Execute(Sender: TService); begin while not Terminated do ServiceThread.ProcessRequests(True); end; -
Hiding a public property in a descendant class
Cristian Peța replied to Cristian Peța's topic in RTL and Delphi Object Pascal
Interestingly, but not a problem in this case. I replaced an old component with a new one and I wanted to be sure there is not code that will set the Text property directly. I don't force it in such a way so no problem. -
I have not tried but I think that a share should work. Then the user will choose to sent by email, print or something else.
-
Hiding a public property in a descendant class
Cristian Peța replied to Cristian Peța's topic in RTL and Delphi Object Pascal
TMyEdit = class(TCustomEdit) private function GetText: String; public property Text: String read GetText; end; implementation function TMyEdit.GetText: String; begin Result := TCustomEdit(Self).Text; end; It works !!!! Text property is now read-only. Do someone knows some side effects of this? There was somewhere a discussion about hiding properties when you re-declare it but I don't remember. -
Hiding a public property in a descendant class
Cristian Peța replied to Cristian Peța's topic in RTL and Delphi Object Pascal
More I read on this subject I understand this is right. -
Casting pointer to TBytes
Cristian Peța replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
You can not because a dynamic array is not just the data. There is also the length and reference count. But you can pass a pointer and length of that memory, -
iOS 14 is supported only with Delphi 10.4 iOS 13 starting with Delphi 10.3.3 Also "iOS Simulator version 11 or later is currently not supported. You can open Xcode > Preferences > Components , to download and install an earlier version of the iOS Simulator. " http://docwiki.embarcadero.com/PlatformStatus/en/Main_Page
-
"This release is not compliant with the Google Play 64-bit requirement"
Cristian Peța replied to Magno's topic in Cross-platform
Does this app compiled for 64-bit works? Have you tried to upload only with 64-bit binaries?