Leaderboard
Popular Content
Showing content with the highest reputation on 08/21/23 in all areas
-
LiveSearch
-
Can ICS thread cause memory violation? (EOutOfResources error)
Angus Robertson replied to PizzaProgram's topic in ICS - Internet Component Suite
There are two fundamental misuses of ICS in the code snippets supplied. 1 - the code is said to be running in a thread, but the MultiThreaded property of TSslHttpCli is never set, so messages for the thread will be processed using Application.ProcessMessages in a different thread. 2 - More seriously, the ICS components are being created and perhaps destroyed for each HTTPS request made, which is probably the cause of the memory leak, and is also highly inefficient. Specifically, OpenSSL is being loaded automatically by the components when the SslContext is automatically iniitialised by the request starting, and perhaps being unloaded when the request ends. The SslContext is designed as something to be shared by components, initialised once and then reused. Or OpenSSL can be loaded once when the program starts, to allow use with multiple SslContexts, in servers for instance that use multiple certificates. Many of the ICS samples show how to load OpenSSL early. ICS v9 has various improvements relating to freeing and destroying components, particularly when exceptions happen during that process, to ensure that inherited destroys are still called and not skipped which can cause memory leaks. Having said that, reports of memory leaks using ICS are very rare, and many ICS applications run for weeks or months without a problem. Angus Angus- 76 replies
-
- thread
- eoutofresources
-
(and 2 more)
Tagged with:
-
Google Play requires Android 13 after 31. august !!!
Hans♫ replied to Hans♫'s topic in Cross-platform
We already use a new installation of Delphi 11.3 Patch 1, but it targets API level 32. It installs this: file:///C:/Users/Public/Documents/Embarcadero/Studio/22.0/CatalogRepository/AndroidSDK-2525-22.0.47991.2819/platforms/android-32 What did you do to target API level 33? PS. It is installed on a VM that had Delphi 11.2, but upon installation of Delphi 11.3 it uninstalled 11.2 first. -
New Code Signing Certificate Recommendations
Vincent Parrett replied to James Steel's topic in General Help
It's certainly at odds with the notion that we should automate things so they work correctly every time. I for one am not going to sit there typing a pin and pushing a button for every file that I sign. If I cannot automate, then I will either not sign at all, or sign with a self signed certificate and provide the public key on my website for customers to install (to avoid the invalid certificate error). Of course microsoft, who has a big hand in this push to hardware storage of certificates, just happens to own a whole bunch of HSM's (azure key vault) and it working on a code signing service for azure - which they would like us all to use eventually - for a fee. -
With a very short notice, Google Play shows this warning:
-
Can ICS thread cause memory violation? (EOutOfResources error)
PizzaProgram replied to PizzaProgram's topic in ICS - Internet Component Suite
Sorry, but I don't fully understand that part yet. Does it mean, that now, that I've enabled MultiThreaded property, I need to call this process too? Also, if this is not the "right way" to automate thing: FMultiThreaded := TThread.CurrentThread.ThreadID <> MainThreadID; How about the opposite, at least stop the execution and warn us, programmers that we almost did a huge error: // before post or get: if (FMultiThreaded = False) and (TThread.CurrentThread.ThreadID <> MainThreadID) then begin raise Exception.Create('Warning! It is not safe to call this method from a background thread, if .MultiThreaded property is False! Exiting...'); Exit; end; ? (and save us 200+ wasted hours for searching the error...) Thank you for your concern! I'm really happy you have looked into the code too. You are right about "this COULD be a problem" at first site. I think too it's very risky to work with memory streams. Luckily this part has been well tested. There are 5+ other programmers using the same code without problems. (We have all shared our knowledge with each other to finish until deadline and worked 3 month long to find out how to communicate with the gov. server.) I was the only one using inside a Thread, and none of us knew about this "hidden" property. That's why the other guys had no problems.- 76 replies
-
- thread
- eoutofresources
-
(and 2 more)
Tagged with:
-
Can ICS thread cause memory violation? (EOutOfResources error)
Dalija Prasnikar replied to PizzaProgram's topic in ICS - Internet Component Suite
UTF8String is always one byte per char, regardless of a Delphi version.- 76 replies
-
- thread
- eoutofresources
-
(and 2 more)
Tagged with:
-
Well, Webdriver libs just give you a convenient interface to browser automation API which is no more than REST API. This WebDriver API is a standard and browser implementation could be any (Chrome, Opera, Firefox, Edge...). Phantom was just one of those. I have my scraper able to switch between Phantom, Chrome and Firefox and work with the same code. As for CEF4D, I had no experience but some guys here had and I believe they could help if you encounter any issue
-
Indeed! I'm currently on vacation and my brain is probably in low energy mode.
-
Can ICS thread cause memory violation? (EOutOfResources error)
Dalija Prasnikar replied to PizzaProgram's topic in ICS - Internet Component Suite
Yes, you are right. I am trying to solve one problem, while forgetting the broader picture. Although it might be easier to figure out what is wrong if the thread would just stall, comparing to having random issues somewhere else in the application.- 76 replies
-
- thread
- eoutofresources
-
(and 2 more)
Tagged with:
-
Can ICS thread cause memory violation? (EOutOfResources error)
Angus Robertson replied to PizzaProgram's topic in ICS - Internet Component Suite
ICS components could set the MultiThreaded property automatically, but the developer would still need to call IcsWndControl.ProcessMessages somewhere in the thread or the code would just stall, except in the simplest of applications. Angus- 76 replies
-
- thread
- eoutofresources
-
(and 2 more)
Tagged with:
-
LiveGrep
-
Can ICS thread cause memory violation? (EOutOfResources error)
Fr0sT.Brutal replied to PizzaProgram's topic in ICS - Internet Component Suite
I looked twice and still don't see anything wrong.- 76 replies
-
- thread
- eoutofresources
-
(and 2 more)
Tagged with:
-
TurboGrep GrepX XGrep FlashGrep
-
The Grepinator 🙂
-
Thanks god, I still have usual certificate for 2+ years, but looking into the dark future to come What I found it this article, maybe it helps, but I couldn't check it, because I have no SafeNet yet. https://medium.com/@joshualipson/ev-code-certificates-automated-builds-for-windows-6100fb8e8be6 Perhaps, somebody has experiences or comments with that solution? Personally, I find it particularly silly to enforce a world-class security system that is so super-secure that the developer has to hack it himself, probably using insecure and dubious third-party tools. Isn't that in stark contrast to the original goal?
-
Is it really "just", or are they going to try to talk the caller into upgrading/renewing first? Has anyone ever tried it and reported what their experience was? I would imagine the whole point of routing the call through sales would be to try to treat the call as a sales lead rather than a support request. If not, this change doesn't make sense.
-
I've not encountered this limited download period with software in recent times. If I buy a game from Steam, I can download it as many times as I want - even the new Baldur's Gate 3, which I hear is over 100GB! If I buy a game from Epic, I can download it again whenever I want - even if Epic no longer sells the game. The same applies to games I buy from GOG. If I buy an e-book from Amazon, I can re-download it whenever I want. Microsoft makes copies of Visual Studio and related tools available from 2013 onward. I can download a copy of the latest Windows ISO whenever I want, even from a non-Windows PC. I can re-download software from JetBrains whenever I want - in fact, they have a tool called Toolbox that handles (re)installation, and you can even download and install all the Jetbrains software you have purchased in one click! They also store your software settings in their cloud with five settings slots so you can even have the desired settings downloaded (say, one slot for PC, one for laptop, etc.). It's the old "like a book" rules too, so there's no installation counter. So I'd say across all different types of software, including development tools, as well as digital media it's not common to not be able to readily re-download something you've already purchased.
-
My list - with increasing nerd factor: Instant Grep Grepility Greppo
-
Wish I had seen this thread before wasting hours configuring 11 on my new dev PC only to discover it was 11.0 and I need 11.1. Delphi 11.0 IDE routinely freezes on F9 compiles on 11.0 and the situation is only a little better on 11.1. Full recompiles are still needed often, but at least I will get an F2084 Internal Error on 11.1 instead of a whole crash. See my thread I made a few months ago. Embarcadero is doing a great job of making 15+ year veteran developers hate them. How unethical and outrageous for them to rescind the link to a product I paid for, not mention anywhere this surreptitious recent practice designed to fatigue and deceive people into purchasing an update subscription, leave a misleading website error page in its place, and require me to waste my time contacting them for the link to "RADStudio_11_1_5_esd_10253.exe"
-
One needs to take into account that we're not dealing with lines but line segments. Lines have infinite length, while line segments have finite length. We don't want to detect a hit beyond the end of the line segment: I think the following one does the trick. I use it in a bitmap editor for scanline conversion of lines (the above image was made with it). (* Distance from point to line segment. Let A=(xa,ya), B=(xb,yb), X=(x,y) Now, the line between A and B is given parametrically by V(k) = (1-k)A + kB = A + k(B - A) and adding the constraint 0 <= k <= 1 makes V(k) the line segment from A to B. Now, the line through X perpendicular to V(k) intersects V(k) when k equals (B - A) . (X - A) k = ------------------- | B - A |^2 So if k <= 0, X is closest to A, if k >= 1, X is closest to B, and if 0 < k < kp, X is closest to V(k). *) function DistanceToLine(X,Y, XA,YA, XB,YB: integer; var RunLength: Single): Single; function VectorLength(X1,Y1, X2,Y2: Single): Single; inline; begin Result := Hypot(X1-X2, Y1-Y2); // = Sqrt(Sqr(X1-X2) + Sqr(Y1-Y2)) end; var k: Single; dx, dy: integer; begin dx := XB-XA; dy := YB-YA; if (dx <> 0) or (dy <> 0) then begin k := (dx*(X-XA) + dy*(Y-YA)) / (Sqr(dx)+Sqr(dy)); if (k <= 0) then // Point before or at start of line segment Result := VectorLength(XA,YA, X,Y) else if (k >= 1) then // Point after or at end of line segment Result := VectorLength(XB,YB, X,Y) else // Point within line segment Result := VectorLength(X,Y, XA+k*dx, YA+k*dy); // = VectorLength(X,Y, (1-kp)*XA+kp*XB, (1-kp)*YA+kp*YB); RunLength := k; end else // Degenerate line begin RunLength := 0; Result := VectorLength(XA,YA,X,Y); end; end; The result is the distance, the RunLength parameter can be used to determine where the projection of the point onto the line lies: before, on, or after the line segment. A small optimization can be done since we're doing hit-testing and don't really need the actual, precise distance value. The VectorLength function uses Hypot (i.e. Pythagoras) to calculate the distance. Hypot internally does a Sqrt, which is an expensive operation. The Sqrt can be eliminated so we return the squared distance instead and then we just need to compare that value against the squared hit limit instead. I.e. if your hit limit was 4 then compare the squared distance against 4*4 = 16 instead.
-
Path1.Data.FlattenToPolygon will return an array of points. Use DistanceFromPointToLine procedure LineEcuation(var a, b, c: Double; x1, y1, x2, y2: Double); begin if Abs(x1*y2 - x2*y1) < 1E-20 then begin if (Abs(x1) > 1E-20) or (Abs(x2) > 1E-20) then begin//Ecuation a*x + y = 0 if (Abs(x1) > 1E-20) then a := -y1 / x1 else a := -y2 / x2; b := 1; c := 0; end else begin//Ecuation x = 0 a := 1; b := 0; c := 0; end; end else begin//Ecuation a*x + b*y + 1 = 0 b := (x2 - x1) / (x1*y2 - x2*y1); a := (y1 - y2) / (x1*y2 - x2*y1); c := 1; end; end; //X0, Y0 point //Xd1, Yd1, Xd2, Yd2 - points of the line function DistanceFromPointToLine(X0, Y0, Xd1, Yd1, Xd2, Yd2: Double): Double; var a, b, c: Double; begin LineEcuation(a, b, c, Xd1, Yd1, Xd2, Yd2); Result := Abs(a * X0 + b * Y0 + c) / Hypot(a, b); end; I also think so.
-
New Code Signing Certificate Recommendations
Vincent Parrett replied to James Steel's topic in General Help
Sectigo and any Sectigo resellers supply YubiKey's Digicert supply Safenet tokens No reply from the other CA's I have contacted so far. FYI - Safenet good (can automate), YubiKey bad (password prompts cannot be avoided). -
Where is the link to register to the forum?
Uwe Raabe replied to FPiette's topic in Community Management
Perhaps when you ask which image shows valid Delphi code. -
ISO's are publicly available via http and ftp though the links are not published officially. However the very situation sucks.