-
Content Count
329 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Cristian Peța
-
If the speed is the problem then I think better to use a profiler and save your time guessing. Using SetLength frequently on a large array is clearly a big one. VTune is nice using https://bitbucket.org/anders_melander/map2pdb/src/master/
-
Should a TDataSet allow changing the .SQL property while being open?
Cristian Peța replied to aehimself's topic in Databases
I prefer that changing the SQL to simply close the dataset. Then possibly I want to set some parameters. I will open it again when all is ready. But sincerely I always call Close before changing SQL. If this is a documented behavior then it's OK but otherwise this can change anytime. I voted for the last. It's closer to what I prefer. -
If you don't want to compromise quality there is https://www.jpegmini.com/ There are some ways for developers to automate this but you can also buy a standalone app for 59$ and do it manually (first extract images to a folder then back to database). I think that with a free trial you can see how much it helps in your case.
-
Set an event handler: if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(AppEventService)) then AppeventService.SetApplicationEventHandler(My_ApplicationEventHandler); And in that event you will receive the warning: function TFormMain.My_ApplicationEventHandler(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of TApplicationEvent.LowMemory: ; end; end;
-
take a look to this REST API Server
Cristian Peța replied to RDP1974's topic in Network, Cloud and Web
I don't see the point. Delphi app is used only to serve Angular pages? What are the advantages over Angular own embedded HTTP server? -
If Count is 0 then Str[1] will trow a range check.
-
I start a new VM for every major app version and I want old versions to be stable. In this case I prefer to keep the sources in VMs. I don't write 3rd party components and I need only one Delphi version per my app version. It is easier so. When I start a new version I do a copy of the VM and all is there.
-
Has anyone tried running Delphi on Windows ARM?
Cristian Peța replied to Chris Pim's topic in Delphi IDE and APIs
From what I understand from the article it's "the Arm version of Windows". No emulator. But this Windows can run x86 code, like Delphi IDE, most probably using an emulator. -
Yes, whole dataset, but how match it takes? What do you want to optimize? Do you keep in memory more than some thousands records?
-
DataSet.Filtered := False; DataSet.Filtered := True; Is working for me when using OnFilterRecord event.
-
Customers asked me a long time ago for a feature to be able to introduce the length in inch in "12 3/16" format in a TEdit like control. I've made a component for this but with the new TNumberBox in Delphi 10.4.2 I wonder if this is usual and if there are some components for this in Delphi world?
-
Intraweb/MS SQL/FireDAC app Azure deployment problem...
Cristian Peța replied to zsleo's topic in Databases
I use UniDAC and in such a case I would use DBMonitor to see what queries are send to the server. I don't know if FireDAC has something like this but from what I know, if I'm not mistaken, you can see failed queries also in Azure. -
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.
-
Several F2084 Internal Error on Delphi 10.4.2
Cristian Peța replied to Davide Angeli's topic in Delphi IDE and APIs
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. -
And what if you omit this line? Intent.setPackage(StringToJString('com.whatsapp'))
-
Several F2084 Internal Error on Delphi 10.4.2
Cristian Peța replied to Davide Angeli's topic in Delphi IDE and APIs
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. -
TBitmap to TBytes for ESC/POS Thermal Printer
Cristian Peța replied to at3s's topic in RTL and Delphi Object Pascal
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; -
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.