-
Content Count
1167 -
Joined
-
Last visited
-
Days Won
16
Everything posted by FPiette
-
Class TSslHttpCli not found - DELPHI5
FPiette replied to 2nd-Snoopy's topic in ICS - Internet Component Suite
Bad idea IMO. That was a bad idea. Never do that for any component. Always use inheritance for that (Create you own component inheriting from the existing). If you can't do what you need in the inherited class, for example because a method is not virtual or private or similar, then contact author to request a small change. You should really get rid of the old Delphi 5, and anything else but the latest from Embarcadero. You have not answered my question about why you can't upgrade. -
In a set of projects, you have to handle differently the source for each of the individual projects and the source for libraries, components and other common files. I have a common base for everything, then a subdirectory for libraries, components and common files, then a sub-directory for all projects. The library sub-directory has one sub-directory for each group of sources (A library or component can be made of several sources). The project sub-directory has one sub-directory for each project. In the sub-directory for each project, I have different directories: for sources, for docs, for dcus, for binaries, for images,... I never use search path in projects: I always add each required unit in the project. This way I see what the project really need. When creating a project which is similar to an existing one, I first work on the existing one to split as much as possible the sources: some which are specific to that project and other sources which will be common. Then I move the new common files to the library directory in an appropriate sub-directory. Then I using the IDE save the project file to the directory where the new project will live and then, using the IDE, I save all specific files to the same directory. This must be done in that order so that the original project stay untouched. I tend to have many source files of small size. Each file contain only things that are needed for the file main purpose.
-
Class TSslHttpCli not found - DELPHI5
FPiette replied to 2nd-Snoopy's topic in ICS - Internet Component Suite
Not sure about the cause because you did not told us which exact error message you have. Maybe you forgot to install ICS component package. Or you did but you opened the project BEFORE having installed ICS and when the IDE complain about missing component you answered "ignore". You shoulg have answered "cancel" because "ignore" will remove the missing component and open the form. It will still run if you install the old OpenSSL version of that time. But it is likely that webserver you'll try to connect to will refuse the connection because it sees an outdated SSL version. -
Yes, there is so that the use of TWSocket is the same for both TCP and TCP. Look at the source code if you are interested.
-
Large address space awareness. How to test properly?
FPiette replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
Definitely not ! Use UIntPtr (Alias to NativeUInt) which is a type especially created for that purpose. -
Don't do that. Use OnSessionConnected event and write a handler which checks if connection is successful and if it is, can SendLine to send something.
-
Class TSslHttpCli not found - DELPHI5
FPiette replied to 2nd-Snoopy's topic in ICS - Internet Component Suite
As far as I remember, the very old ICS which still support Delphi 5 lacks SSL although I'm not sure. Why can't you upgrade to latest Delphi version? If it is for hobby or small business, you can use the Community Edition which is free. Unless you use old components for which you don't have the source, it is not that difficult to port Delphi 5 to latest Delphi version. -
On Delphi 10.4.1 the MMX Code Explorer is mostly dead/inactive when running Delphi debugger
FPiette replied to panie's topic in MMX Code Explorer
I don't. -
TWSocketClient.OnDataAvailable not firing off after a day or two
FPiette replied to aehimself's topic in Network, Cloud and Web
Good to know. Thanks for reporting. -
On Delphi 10.4.1 the MMX Code Explorer is mostly dead/inactive when running Delphi debugger
FPiette replied to panie's topic in MMX Code Explorer
I'm sure everyone will love to have a styled VirtualTree! -
On Delphi 10.4.1 the MMX Code Explorer is mostly dead/inactive when running Delphi debugger
FPiette replied to panie's topic in MMX Code Explorer
Wouldn't be interesting to update VirtualTrees source code at https://github.com/JAM-Software/Virtual-TreeView ? -
Best type for data buffer: TBytes, RawByteString, String, AnsiString, ...
FPiette replied to Rollo62's topic in Algorithms, Data Structures and Class Design
This article is about random insertion and random deletion, I guess they take into account the time required to locate the record in the list. If random means generating a random index number, then it is the worst case possible for linked list and best case for array (direct access). If that is a main access pattern, then a linked list is NOT the correct data structure. Insertion/deletion in a linked list is only quick provided the insertion/deletion point is already available. Measuring the performance for a search separately from performance for insert/delete itself is what has to be done to truly compare linked-list and arrays or any other data structure such as a dictionary or hash table. A linked list is excellent for a FIFO QUEUE or LIFO QUEUE (STACK). And that is the problem in the case of this message thread: communication which require a FIFO queue between receiving process and computing process. That is why I proposed a linked-list. -
On Delphi 10.4.1 the MMX Code Explorer is mostly dead/inactive when running Delphi debugger
FPiette replied to panie's topic in MMX Code Explorer
Installed. Up to now source indexer works as expected. Thanks. btw: I almost use only the source indexer. -
On Delphi 10.4.1 the MMX Code Explorer is mostly dead/inactive when running Delphi debugger
FPiette replied to panie's topic in MMX Code Explorer
Source indexer doesn't work here (not shown when asked). Never noticed it is when debug layout is active. I have a basic setup with MMX being the only add-on. -
Best type for data buffer: TBytes, RawByteString, String, AnsiString, ...
FPiette replied to Rollo62's topic in Algorithms, Data Structures and Class Design
Linked lists compared to arrays allow to insert/delete/move items without moving the whole array. When doing a FIFO, it is very important to be able to quickly insert at one end. With linked list it is easy to implement multiple queues, for example a free list and a busy list without moving data. Obviously, if you have a small numbers of items, it makes no differences. For a really small number of items, a linked list may even be slower that an array. As everywhere, use case are different and there is no best solution for everything. That's true for anything! Non optimized is... non optimized 🙂 -
Is it's safe to destroy TSslHttpCli while http request in progress ?
FPiette replied to Max Terentiev's topic in ICS - Internet Component Suite
Yes. The remote site will experience and abort error if a transfer is occurring. -
Is it's safe to destroy TSslHttpCli while http request in progress ?
FPiette replied to Max Terentiev's topic in ICS - Internet Component Suite
You should not destroy the component from an event handler of that component (general rule, not specific of ICS) or you'll experience access violation or other strange behavior. From an event handler, you can defer the destroy using a PostMessage of a custom message. That is what TForm.Release does by the way. -
Do you have gtClasse3.pas or gtClasse3.dcu somewhere in Delphi search path or project search path, or directly added in your project? Any typo error?
-
Best type for data buffer: TBytes, RawByteString, String, AnsiString, ...
FPiette replied to Rollo62's topic in Algorithms, Data Structures and Class Design
Yes, I have no idea who you are! -
Best type for data buffer: TBytes, RawByteString, String, AnsiString, ...
FPiette replied to Rollo62's topic in Algorithms, Data Structures and Class Design
No, only TCP. UDP is a datagram oriented protocol. But you are able to discover which protocol is used in your processor stuff. What I say is that you have to move the part of the code out of the processor code and move it to an intermediate layer between the low level receiver and high level the processor. Layers is the key success in protocol handling. RawByteString is low performance. It is all about memory alloc/free, data copy and memory fragmentation. Low performance but easier to design and develop. Linked list (Or queue if you want to encapsulate the linked list in another name) is the way to go for performance as I explained. And yes, I agree that this is more complex to design and develop but this is the price to pay for performance. I bet you will never do that change. You'll buy a higher performance computer. -
Best type for data buffer: TBytes, RawByteString, String, AnsiString, ...
FPiette replied to Rollo62's topic in Algorithms, Data Structures and Class Design
Not tricky but less trivial. As someone else said in this conversation, performance often means more complex solution. You put your priority where you want! Maybe you don't know, but I'm the author of ICS (Internet Component Suite) and what you describe is exactly what happens with a TCP stream which is what a TCP socket gives. So I have large experience in that kind of data receiving handling. There are 3 ways to delimit data: 1) There are delimiters such STX/END around a data block or a CRLF (or any other end-of-block marker) at the end of data block. 2) Each block begins with a data length. 3) Communication is closed or broken You should move the determination of the data block complete/incomplete in the receiving process or thread, not in the processing thread. This means that the same buffer (Pointer and length or pointer to star, offset and length) is given to the low level receiver until a complete data block is received. Only then this data block is put at the end of the incoming data linked list (or Queue if you prefer this term) for processing. -
Best type for data buffer: TBytes, RawByteString, String, AnsiString, ...
FPiette replied to Rollo62's topic in Algorithms, Data Structures and Class Design
So this is perfect for a linked list! The linked list will grow as the source data thread add more buffer at the end. Buffer extracted from released buffers after processing or new buffer if no free available. Processors, will take a buffer from the start of the linked list for processing and move the buffer to the released linked list. Then you have to have a linked list per source data. When a processor retrieve the first buffer from the linked list and determine it is not complete, then it is flagged and it stays in the linked list. When the next data chunk arrive, and the first buffer in the list is flagged as incomplete, then it is flagged as fragment so that the processors knows that if must also retrieve the next item in the list (or a few ones) to get complete data. btw: Linked list are frequently used to implement queues (FIFO, LIFO). I never seriously looked at how Delphi RTL implement TQueue<T> but I think it is an array which is less efficient. -
Best type for data buffer: TBytes, RawByteString, String, AnsiString, ...
FPiette replied to Rollo62's topic in Algorithms, Data Structures and Class Design
You'll get performance if you avoid copying data. If your receiver component accept a buffer (You said TBytes which is a TArray<Byte>), you can keep it into that buffer, add that buffer in a linked list of pointers to those TBytes buffer and pass another buffer for the next receive. Each "processor" will then receive the data it know how to handle right and produce some result maybe in the same buffer or in a new one. One a buffer is not needed, it is freed or better put on a second linked list with available buffers and reuse that buffer later. You'll avoid memory allocation/deallocation which produce memory fragmentation which is also very bad if the application has to run continuously. Resizing and array (Remember TBytes is an array) is an inefficient operation. It involve copying data because the array can't always be expanded in place and obviously it involves memory alloc/free because you use a dynamic array (TBytes). I don't know what your receiver looks like nor if the data size is known up front. But if possible, it is better to preallocate a buffer large enough for - let's say - 90% of the occurrences and reuse that buffer again and again (Because as I said above you have a linked list of free buffers). -
Best type for data buffer: TBytes, RawByteString, String, AnsiString, ...
FPiette replied to Rollo62's topic in Algorithms, Data Structures and Class Design
Linked list is among the fastest. Much faster than arrays or strings. But since you didn't told us how data is coming and which processing you need to do, all answers (Mine and from others) are just guess and probably not really helpful. You'll get performance if you minimize the number of data copy and memory allocation. Be aware of hidden data copy and allocation when you resize a dynamic array or a string and all variation. -
Best type for data buffer: TBytes, RawByteString, String, AnsiString, ...
FPiette replied to Rollo62's topic in Algorithms, Data Structures and Class Design
You forgot a data structure specifically designed to handle the processing of your data. For example linked list of some basic data type. Since we don't say anything about the details of your processing, I can't be more specific.