Leaderboard
Popular Content
Showing content with the highest reputation on 08/17/23 in all areas
-
Where is the link to register to the forum?
Roger Cigol replied to FPiette's topic in Community Management
This problem is always going to be with us. But we do need to keep the forum open. New members = new blood = new ideas. Without new members the forum has signed it's own death warrant (even if it is a slow death). -
here
-
Are local TGUIDS preinitialized?
Stefan Glienke replied to Attila Kovacs's topic in RTL and Delphi Object Pascal
The explanation was given by the pm and not some compiler dev fwiw and it is nonsense tbh. The compiler already knows if a record is managed or not because if its managed then it inserts code to call to System._InitializeRecord. Now the case can happen that you access some field on a record that is a managed record but that field is of a non managed type - these fields are not touched inside that routine. The compiler can still issue a W1036 when accessing a field on a record that is not managed - would there still be cases where a warning would be missing? Yes, but it would be better than it is currently. -
HTML Office Library can extract information from each page as HTML or plain text. Also HTML from each page can be saved back to separate PDF.
-
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). -
Way for external app to jump to a unit and position inside the IDE?
dummzeuch replied to domus's topic in Delphi IDE and APIs
AFAIK this can only be done using the OTAPI which is only available for IDE plugins. -
Way for external app to jump to a unit and position inside the IDE?
uligerhardt replied to domus's topic in Delphi IDE and APIs
You can use ShellExecute(0, 'open', PChar(FileName), nil, nil, SW_SHOWNORMAL); to show the unit in your registered Pascal editor - which probably is Delphi. I don't know about the line number. -
Where is the link to register to the forum?
Anders Melander replied to FPiette's topic in Community Management
To be "Musked" I believe it's called -
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.
-
Oh, didn't realized that you also added an exe. You're right: running your exe I can reproduce this behavior when styles are active.
-
I have been using PDFtk (https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) in our Delphi apps to merge documents. I haven't tried splitting but PDFtk has also the splitting function. you may want to give it a try. As for our case, we utilized the command prompt and we just issue a call Shellexecute in our app. Works just fine.
-
Delphi support for Google Protocol Buffers?
Sherlock replied to Lars Fosdal's topic in Algorithms, Data Structures and Class Design
Yet another structured data serializing standard. I'll keep using slow but (human) readable YAML. 😁 -
Are local TGUIDS preinitialized?
Dalija Prasnikar replied to Attila Kovacs's topic in RTL and Delphi Object Pascal
It means that it can be hard to tell whether record is initialized or not. For instance you could have TGuid.Clear method that would initialize record, but there is not way to tell what that method does comparing to TGuid.IsEmpty or any other that would expect initialized record. It is not as much that warnings cannot be emitted, but that there would be a lot of bogus warnings in such case, which defeats the purpose of a warning. -
Due to the large number of new components and changes, ICS V8.71 has been renamed to ICS V9.0 for final release. All the source units have updated versions and copyrights, some unused units have gone. All the active samples (per readme9.txt) have also been updated with new versions and copyrights and there is a new ActiveDemos.groupproj group that allows them all to be built together. ICS v9 is available from a new SVN repository https://svn.overbyte.be/svn/icsv9/ and also from the Zipped Daily Snapshot section of https://wiki.overbyte.eu/wiki/index.php/ICS_Download The snapshot download URL is: https://wiki.overbyte.eu/arch/icsv9w.zip The final release notes and updated wiki pages are still being written and will be available next week. Meanwhile, I'd appreciate it if some active ICS users could download V9 now and test for installation and backward compatibility with existing applications, particularly with Delphi 7 and XE compilers. I updated literally hundreds of package files manually, for the last time, and it would be good to know they actually install before the final V9 version is released. There is also a new ICS V10 SVN repository for the next major version with Linux support, but this is many months away from being complete, so please ignore it for now. ICS V9 is planned to be a long term support release with no new components or major features added, just bug fixes as needed, major changes will be for V10. V9.0 has been tested with Delphi 7, but I had to make changes to several new components due to missing language features and TWebBrowser does not exist, so V9.0 will be the last tested with D7. Delphi 2007 is easier to support for those building ANSI projects and will become the oldest version supported. Angus