Leaderboard
Popular Content
Showing content with the highest reputation on 04/08/24 in all areas
-
The Zeos Team is proud to announce the availability of Zeos 8.0.0 as a stable release. This is the newest stable version of Zeos. It deprecates Zeos 7.2, and any previous version of Zeos. We urge all people still using older versions of Zeos to upgrade. If you have any problems with Zeos 8.0, please get in contact with us on the forums or on the bugtracker. The most outstanding changes in Zeos 8.0 are Support for Delphi NextGen compilers to support Android, iOS and Mac OS X Two new bridge drivers for OleDB and ODBC A new driver that uses the Firebird interface based API for accessing Firebird versions 2.5 and above A special proxy server and an according driver that can be used to access any Zeos supported database using SOAP over HTTP(S) from (mobile) clients. Propper support for numeic and decimal fields by using TBCDField and TFMTBCDField Nested transactions using savepoints Two new components: TZTransaction and TZMemTable better overall performance and smaller memory footprint Besides these improvements Zeos has seen a ton of other additions and improvements. For an overview of the changes in Zeos 8.0 see the release notes. To download, the new version of Zeos please use this link.
-
My recommendation would be, to avoid 3rd Libraries as much as possible. Since FMX on Mobile is very volatile and Android/iOS change significantly every 6 months, it is very important not to rely on additional, possibly unstable, external components. My recommendation would be, to make as much as possible on your own. I can recommend DelphiWorlds-Kastri as a common life-saver, TMS FNC and other TMS components - since they are quite active, but I would still reduce any external reference as much as possible. Moreover, I would not directly try to port a desktop app to mobile. Better to start clean with a mobile-first app and then put your "desktop" functionality back step-by-step.
-
Compile time issue with RTTI, generic interface and type casting...
pmcgee replied to Ali Dehban's topic in RTL and Delphi Object Pascal
@Ali Dehban I like the idea of the area you were investigating here. Stretching my brain to a function that can return any type is something I have thought about in the last year or so. It took a while before I started to wrap my head around enough it to have questions, 'tho. The first was that IMyInterface<T> = interface function DoSomething: T; end; looks a lot like the definition of an anonymous function ... and then I replaced it with records. But I'll skip that for now. My second eventual question is why have function UseInterface<T> ( obj: IMyInterface<T> ) : T; begin Result := obj.DoSomething; end; vs just ? obj.DoSomething; So, as a first step I ended up with the following : (I realise you would have been simplifying the code above from your real use case) {$APPTYPE CONSOLE} program Project3; uses System.SysUtils, System.Variants, System.Classes, System.Rtti; type IWithAny<T> = interface function DoSomething: T; end; TWithAny<T> = class(TInterfacedObject, IWithAny<T>) function DoSomething : T; end; { TWithAny<T> } function TWithAny<T>.DoSomething: T; begin var val: TValue := TValue.Empty; var typ: T := default(T); case GetTypeKind(T) of tkString, tkUString : val := 'Hello'; tkInteger : val := 20; tkClass : if TValue.From<T>(typ).IsType<TStringList> then begin val := TStringList.Create; val.AsType<TStringList>.Add('Hello from StringList'); end; end; Result := Val.AsType<T>; end; var obj1 : IWithAny< Integer >; obj2 : IWithAny< String >; obj3 : IWithAny< TStringList >; begin obj1 := TWithAny< Integer > .Create; obj2 := TWithAny< String > .Create; obj3 := TWithAny< TStringList >.Create; writeln( obj1.DoSomething ); writeln( obj2.DoSomething ); var lvstr := obj3.DoSomething; writeln(lvstr.Text); lvstr.Free; readln; ReportMemoryLeaksOnShutdown := True; end. What I'd kinda like to see is the interface return a (managed record?) holding the <T>, made to clean up it's own memory. -
I have now merged in your changes. For consistency, I re-arranged the order of the new directories that you had added.
-
This may be worth a look: neslib/Chet: C Header Translator for Delphi (github.com). From @Erik@Grijjy
-
For those who prefer designing an application visually rather than coding it, this could be useful.
-
Thanks lars as well, I'm sure I tried that originally.....maybe not enough coffee !
-
https://blogs.embarcadero.com/the-new-quality-portal-is-live-here-are-the-details/
-
Again? What was old is new again - except my jokes.
-
Click on Requests, select All, enter your search in the search box, upper left.
-
Current GExperts builds without issue in D12.1.
-
Delphi 12 messing up with test project's DPR when using TestInsight and DUnitX
Vincent Parrett replied to John R.'s topic in Delphi IDE and APIs
There is no generic "works for everyone" main dpr setup for dunitx - the code depends on what logging and settings you want. You typically do not want the console logger or the xml logggers when using TestInsight - and when running on a CI server you probably don't want the console logger. I guess we could move some of the generated code to another generated unit so the IDE doesn't mess with the ifdefs - I don't have time to work on it at the moment but happy to accept a PR that improves this situation. -
Delphi 12 messing up with test project's DPR when using TestInsight and DUnitX
Stefan Glienke replied to John R.'s topic in Delphi IDE and APIs
My general advice to this is usually to move any conditional unit usage to its own unit and then only reference that unit in the dpr. Unfortunately, that is not some practice the DUnitX Expert is using. It would possibly also reduce the duplicated code generated for the dpr main every time. -
Delphi should let me use a const array reference as a constant
Stefan Glienke replied to PiedSoftware's topic in RTL and Delphi Object Pascal
Imagine you could write this code in Delphi: var i: Integer = 42; begin const j = i; Writeln(j); end. Oh, wait, you can. Too bad that the syntax is not really clean as it mimics the const declaration using the equal sign while it really is what other languages call immutable variable and thus should have used the assign operator but people with even less expertise in programming language design than me disagreed. -
Is this an April 1 joke?
-
Yes, I fear it will. While I haven't used it yet and there's presently nothing there, I'm really afraid this just wiped out yet another small community. Tick tock, tick tock.
-
aaaaaaaand it sucks. But at least, from reading the announcement, it appears they know it sucks.
-
Delphi 12 messing up with test project's DPR when using TestInsight and DUnitX
Uwe Raabe replied to John R.'s topic in Delphi IDE and APIs
I guess that is caused by the {$ELSE} part of the TESTINSIGHT conditional. You can safely remove that: System.SysUtils, {$IFDEF TESTINSIGHT} TestInsight.DUnitX, {$ENDIF } DUnitX.Loggers.Console, DUnitX.Loggers.XML.NUnit, DUnitX.TestFramework, -
Rounded polygon
vfbb replied to A.M. Hoornweg's topic in Algorithms, Data Structures and Class Design
Here's an example: uses Skia; function MakeCubicSplineInterpolation(const APoints: TArray<TPointF>): ISkPath; var LPathBuilder: ISkPathBuilder; LSegments: Integer; I: Integer; mx: Single; my: Single; LScratches: array of record a, b, c, r, p: TPointF; end; begin LPathBuilder := TSkPathBuilder.Create; if Length(APoints) < 2 then Exit(LPathBuilder.Detach); if Length(APoints) = 2 then begin LPathBuilder.MoveTo(APoints[0]); LPathBuilder.LineTo(APoints[1]); Exit(LPathBuilder.Detach); end; LSegments := Length(APoints) - 1; SetLength(LScratches, LSegments); LScratches[0].a := PointF(0, 0); LScratches[0].b := PointF(2, 2); LScratches[0].c := PointF(1, 1); LScratches[0].r := PointF(APoints[0].X + 2 * APoints[1].X, APoints[0].Y + 2 * APoints[1].Y); for I := 1 to LSegments - 2 do begin LScratches[I].a := PointF(1, 1); LScratches[I].b := PointF(4, 4); LScratches[I].c := PointF(1, 1); LScratches[I].r := PointF(4 * APoints[i].X + 2 * APoints[I + 1].X, 4 * APoints[I].Y + 2 * APoints[I + 1].Y); end; LScratches[LSegments - 1].a := PointF(2, 2); LScratches[LSegments - 1].b := PointF(7, 7); LScratches[LSegments - 1].c := PointF(0, 0); LScratches[LSegments - 1].r := PointF(8 * APoints[LSegments - 1].X + APoints[LSegments].X, 8 * APoints[LSegments - 1].Y + APoints[LSegments].Y); for I := 1 to LSegments - 1 do begin mx := LScratches[I].a.X / LScratches[I - 1].b.X; my := LScratches[I].a.Y / LScratches[I - 1].b.Y; LScratches[I].b := LScratches[I].b - PointF(mx * LScratches[I - 1].c.X, my * LScratches[I - 1].c.Y); LScratches[I].r := LScratches[I].r - PointF(mx * LScratches[I - 1].r.X, my * LScratches[I - 1].r.Y); end; LScratches[LSegments - 1].p := PointF(LScratches[LSegments - 1].r.X / LScratches[LSegments - 1].b.X, LScratches[LSegments - 1].r.Y / LScratches[LSegments - 1].b.Y); for I := Length(APoints) - 3 downto 0 do begin LScratches[I].p := PointF((LScratches[I].r.X - LScratches[I].c.X * LScratches[I + 1].p.X) / LScratches[I].b.X, (LScratches[I].r.Y - LScratches[I].c.Y * LScratches[I + 1].p.Y) / LScratches[I].b.Y); end; LPathBuilder.MoveTo(APoints[0]); for I := 0 to LSegments - 2 do begin LPathBuilder.CubicTo(LScratches[I].p, PointF(2 * APoints[I + 1].X - LScratches[I + 1].p.X, 2 * APoints[I + 1].Y - LScratches[I + 1].p.Y), APoints[I + 1]); end; LPathBuilder.CubicTo(LScratches[LSegments - 1].p, PointF(0.5 * (APoints[LSegments].X + LScratches[LSegments - 1].p.X), 0.5 * (APoints[LSegments].Y + LScratches[LSegments - 1].p.Y)), APoints[LSegments]); Result := LPathBuilder.Detach; end; procedure TForm1.SkPaintBox1Draw(ASender: TObject; const ACanvas: ISkCanvas; const ADest: TRectF; const AOpacity: Single); var LPaint: ISkPaint; LMyPoints: TArray<TPointF>; begin LMyPoints := [PointF(62, 511), PointF(162, 605), PointF(262, 610), PointF(362, 402), PointF(462, 959), PointF(562, 58), PointF(662, 272), PointF(762, 99), PointF(862, 759), PointF(962, 945)]; LPaint := TSkPaint.Create(TSkPaintStyle.Stroke); LPaint.Color := TAlphaColors.Red; LPaint.AntiAlias := True; LPaint.StrokeWidth := 3; LPaint.StrokeCap := TSkStrokeCap.Round; ACanvas.DrawPath(MakeCubicSplineInterpolation(LMyPoints), LPaint); LPaint.StrokeWidth := 10; LPaint.Color := TAlphaColors.Black; ACanvas.DrawPoints(TSkDrawPointsMode.Points, LMyPoints, LPaint); end; Result: Note: You don't need to use Skia, it was just a facilitator for the example.