-
Content Count
1210 -
Joined
-
Last visited
-
Days Won
16
Everything posted by FPiette
-
Are you sure all communications are done when you stop your service? Remember ICS component are asynchronous and work in the background.
-
At first glance it is not correct. The component is asynchronous. Calling one method will merely start the process in the background. You shouldn't detach the component from the thread before it has finished the operation you requested. You should remind that ICS components are asynchronous and doesn't require multi-threading to execute a lot of operations in parallel. Multi-threading is only useful if you have a large number (hundreds) of active communications simultaneously. Other operations that your application does may require multi-threading, for example lengthy SQL requests if they don't use an asynchronous programming model.
-
Why not create your own ShowMessage function? After all it is simply a modal form that you can easily build yourself to fit your needs.
-
TSuperObjectIter ObjectFindFirst problem
FPiette replied to PizzaProgram's topic in ICS - Internet Component Suite
Please also fix your message. You can edit it. -
TSuperObjectIter ObjectFindFirst problem
FPiette replied to PizzaProgram's topic in ICS - Internet Component Suite
What is js_keres function? -
TSuperObjectIter ObjectFindFirst problem
FPiette replied to PizzaProgram's topic in ICS - Internet Component Suite
Use one of the functions: function ObjectIsType(const obj: ISuperObject; typ: TSuperType): boolean; function ObjectGetType(const obj: ISuperObject): TSuperType; -
TSuperObjectIter ObjectFindFirst problem
FPiette replied to PizzaProgram's topic in ICS - Internet Component Suite
Ask the developer! Before asking, read the SuperObject documentation. -
I have no idea about XSD but for sure you can do the check in Delphi using System.RegularExpressions to do the check.
-
You have to try the component in a sample application, creating the component at runtime. When it works, you can consider installing it in the IDE. That's not specific to that component but it is how any component has to be developed. When the component is in the sample application, you can use the debugger to understand where and why it blocks.
-
You probably forgot to change Winsock to OverbyteIcsWinSock. The use clause should be this: uses Windows, Classes, SysUtils, ExtCtrls, OverbyteIcsWSocket, OverbyteIcsWSocketS, OverbyteIcsWinSock;
-
How to build JSON with ISuperObject as an Array ?
FPiette replied to PizzaProgram's topic in ICS - Internet Component Suite
Is your problem solved? If not, on which line EXACTLY does your code cause an AV? Run your program under the debugger using the debug release. -
What is the problem with "Src : TSockAddrIn;" ? What error message give the compiler. You really have to help us to help you!
-
Override the form's DoShow procedure and from there post a custom message to the form. In the corresponding message handler restore the form position and size. If you want an example, look at https://github.com/fpiette/OvbImgOrganizer/blob/main/Source/OvbImgOrganizer.Main.pas
-
How to build JSON with ISuperObject as an Array ?
FPiette replied to PizzaProgram's topic in ICS - Internet Component Suite
On which line EXACTLY does your code cause an AV? -
Please describe the problem you get. And tell us which Delphi version you use.
-
In which space are your points? The formula and code I gave is for computing the distance between two points of given by their geographic coordinates (On a sphere which is the earth in my code). The distance is computed on a great-circle. The formula for two points located on a plane is different and simpler.
-
What is the relation with your initial question and my answer ?
-
If you are talking about geographic coordinates, look at the haversine formula. function HaversineDist( Lat1 : Extended; // Latitude of point 1 in degrees Lng1 : Extended; // Longitude of point 1 in degrees Lat2 : Extended; // Latitude of point 2 in degrees Lng2 : Extended) // Longitude of point 2 in degrees : Extended; // Distance in meters var Dx, Dy, Dz : Extended; const Diameter = 2 * 6372.8 * 1000; // Meters begin Lng1 := DegToRad(Lng1 - Lng2); Lat1 := DegToRad(Lat1); Lat2 := DegToRad(Lat2); Dz := Sin(Lat1) - Sin(Lat2); Dx := Cos(Lng1) * Cos(Lat1) - Cos(Lat2); Dy := Sin(Lng1) * Cos(Lat1); Result := ArcSin(Sqrt(sqr(Dx) + Sqr(Dy) + Sqr(Dz)) / 2) * Diameter; end;
-
Works now.
-
Still down for me.
-
Count requests in different intervals
FPiette replied to chkaufmann's topic in Algorithms, Data Structures and Class Design
It is enough to store the request count per 5 sec interval. The other intervals can be computed form the 5 sec interval. To count for the 5 sec interval, you can increment a counter (in memory or in SQL table), rounding the timestamp to the nearest 5 sec and using that rounded value plus the user ID to locate the record to update (or insert if not already existent). At regular interval, you can delete all counters older than the desired retention time. For performance reason, you may buffer the counter in memory for one or more 5 sec intervals and then flush the memory to the database to secure the data. With that scheme; you have at most 12 * 60 * 24 = 17280 counter per day per active user. 2 bytes (short int) is enough if no use has more than 65535 requests per day. If they can do more, then you need more bytes per counter. -
Look at this report : https://quality.embarcadero.com/browse/RSP-33766 This is probably a similar issue. You should create a new report with the issue you see.
-
Yes, it should. I always code like that and when taking code from elsewhere, I rewrite it like that.
-
I like to use FreeAndNil for the same reason David explained for the rest : One day you make your procedure more complex, adding some code lines after the FreeAndNil and yet use the freed variable. Calling FreeAndNil instead of Free will make you quickly discover (AV° the error you made. The price is very low for this security.
-
You are partially right. This recommendation is for destructing a form in the context of an event handler of that form. In that case you need to call Release which defers the actual destruction after the event is terminated. This doesn't apply in this case.