Jump to content

Cristian Peța

Members
  • Content Count

    217
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Cristian Peța

  1. Cristian Peța

    Trying to share a text file

    This "image/text/plain" is strange for me. You can try this. This will enable share for image and text. If you need only text delete the "image/* " This setType() will filter the applications that supports that type.
  2. Cristian Peța

    Several F2084 Internal Error on Delphi 10.4.2

    Then not the memory limit is the problem. I think I had something similar but long time ago I starter to avoid compile and use build almost every time. It is better to wait 10-15 seconds (in my case) than to fight with these issues. If I remember well this started for me about ten years ago when iOS was first introduced as a new platform.
  3. Cristian Peța

    Trying to share a text file

    And what if you omit this line? Intent.setPackage(StringToJString('com.whatsapp'))
  4. Cristian Peța

    Several F2084 Internal Error on Delphi 10.4.2

    If "Use MSBuild externally to compile" helps then probably you have reached the memory limit. You can see in Task Manager if Delphi is approaching 4 GB limit. I have for example 534 MB after a build of 330k LOC.
  5. To send text you could use this function. If the previous change fixed the issue I suppose this will also fix it without to change anything else. You could also store binary data in AnsiString but I would not do this. It's better to use TBytes for this. procedure TThermalPrinter.SendString(AValue: AnsiString); var SND: TBytes; begin SetLength(SND, Length(AValue)); CopyMemory(@SND[0], @AValue[1], Length(AValue)); LSockect.SendData(SND); // send data to the printer end; And better this in TThermalPrinter.DoPrintBitmap() vTempStr : AnsiString;
  6. 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.
  7. 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)]);
  8. Why to sleep 5 second? And ShellExecute() doesn't create a child processes.
  9. It's not the best method but I run a batch file with net stop ServiceName net start ServiceName
  10. 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.
  11. Cristian Peța

    XML Parsing and Processing

    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
  12. Cristian Peța

    XML Parsing and Processing

    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.
  13. 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.
  14. Cristian Peța

    Delphi 10.4.2 first impressions

    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.
  15. Cristian Peța

    Delphi and the new Apple M1 CPU

    Something about performance: https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-8700K+%40+3.70GHz&id=3098
  16. Cristian Peța

    Possible D10.4.2 issue..

    deleted
  17. Cristian Peța

    Possible D10.4.2 issue..

    How do you know that it crashes exactly at that line of code? Do you have a stack-trace? A message?
  18. 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;
  19. Cristian Peța

    exit terminates delphi app

    @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.
  20. Cristian Peța

    Inch representation format in TEdit like controls

    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"
  21. Cristian Peța

    Inch representation format in TEdit like controls

    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.
  22. 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?
  23. 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;
  24. Cristian Peța

    Hiding a public property in a descendant class

    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.
  25. Cristian Peța

    Print PDF file in Android\iOS application

    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.
×