-
Content Count
3416 -
Joined
-
Last visited
-
Days Won
113
Everything posted by Lars Fosdal
-
Anybody changing FileVersion directly in dproj file?
Lars Fosdal replied to Mike Torrettinni's topic in General Help
I prefer to use a build server that deals with discovering code changes and performs the versioning. We use Continua CI (which is free for personal use) to automatically start builds after a commit to GitHub, and FinalBuilder which deals with the finer details of configuring projects. Continua can assign the same version number to any number of projects in the build configuration. -
Generics compiler Error "Incompatible Types"
Lars Fosdal replied to luebbe's topic in Algorithms, Data Structures and Class Design
Added advice for generic lists: If you ever need a polymorph generic element type TMyType<T> as well, base it on a skeleton TMyType which contain the verbs and common props you need. TMyType = class public constructor Create; virtual; abstract; procedure SomeOperation; virtual; abstract; end; TMyType<T> = class(TMyType); public constructor Create; override; procedure SomeOperation; override; end; TMyTypeList<T:TMyType, constructor> = class FItems: TList<T>; procedure AddItem(AItem: T); function GetItem: T; end; -
Generics compiler Error "Incompatible Types"
Lars Fosdal replied to luebbe's topic in Algorithms, Data Structures and Class Design
program Project4Fixed; {$APPTYPE CONSOLE} {$R *.res} uses System.Generics.Collections, System.SysUtils; type IMyIntf = interface ['{FCAFF2E8-5F8E-4473-8795-89BD41C89D57}'] end; TMyList<T:IMyIntf> = class FItems: TList<T>; procedure AddItem(AItem: T); function GetItem: T; end; TMyType = class end; TMyTypeList<T:TMyType> = class FItems: TList<T>; procedure AddItem(AItem: T); function GetItem: T; end; { TMyList<IMyIntf> } procedure TMyList<T>.AddItem(AItem: T); var Value: T; begin FItems.Add(AItem); // E2008 Incompatible Types No more - Compiler happy FItems.Add(Value); // Compiler is happy end; function TMyList<T>.GetItem: T; begin Result := FItems[0]; // E2008 Incompatible Types No more - Compiler happy end; { TMyTypeList<T> } procedure TMyTypeList<T>.AddItem(AItem: T); var Value: T; begin FItems.Add(AItem); // E2008 Incompatible Types No more - Compiler happy FItems.Add(Value); // Compiler is happy end; function TMyTypeList<T>.GetItem: T; begin Result := FItems[0]; // E2008 Incompatible Types No more - Compiler happy end; begin try { TODO -oUser -cConsole Main : Code hier einfügen } except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. -
Anon function with undefined result yields no warning
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Well, I voted now, because I got bit by it. -
Seems pretty much dead and buried online. You are probably looking at a painful refactoring.
-
How to use unit BufferedFileStream & FastCopy?
Lars Fosdal replied to Quarks's topic in General Help
To be fair, one of the three disk drives in my laptop is rotating. I'm oldschool (and very large SSDs are still too expensive). -
imagelist Looking for Icon Fonts support in Delphi for High-DPI and Themed app?
Lars Fosdal replied to Carlo Barazzetta's topic in VCL
Have you checked if your app receives any notification after the installation of the font? A sleep seems so random... what if the system is REALLY busy so that the sleep is too short? -
How to use unit BufferedFileStream & FastCopy?
Lars Fosdal replied to Quarks's topic in General Help
Physical heads are increasingly rare these days. My speculation is that the low level DMA mechanisms in the OS might outperform the higher level file routines - but it is pure speculation. -
/off-topic: My mind boggles at the thought of a table without a primary key...
-
How to use unit BufferedFileStream & FastCopy?
Lars Fosdal replied to Quarks's topic in General Help
A random thought I had - what if you copied from one memory mapped file onto another, with multiple threads? I am not even sure that is possible, and it might be a problem with so large files, due to disk storage fragmentation. Edit: Not sure if it is possible to do memory mapping for a removable USB drive. Perhaps you simply need a faster USB unit 😉 https://www.tripplite.com/products/usb-connectivity-types-standards As for copying across network drive, this is where CopyFileEx really does a lot of low level problem solving for you. -
How to use unit BufferedFileStream & FastCopy?
Lars Fosdal replied to Quarks's topic in General Help
Are you doing local copying or copying across the network? From empirical evidence, it seems to open files with read only, deny none. I've never experienced a sharing violation, and I have multiple concurrent clients that pull down changed .exe files from a central share. -
Why are you extracting the blob with AsString and not AsBlob?
-
AFAIK, the Text field in SQLite has no length limit. Why use a BLOb?
-
Even professionals can't really do much without actual source code. Can you reproduce the problem in a self contained compilable example?
-
What it's like to be a Delphi Developer
Lars Fosdal replied to Joe C. Hecht's topic in Tips / Blogs / Tutorials / Videos
In some aspects VS is terrible. It is just a different terrible than the terrible RAD Studio. -
10.4.1+ Custom Managed Records usable?
Lars Fosdal replied to Darian Miller's topic in RTL and Delphi Object Pascal
The If and Case statements expressions are indeed pretty nice. -
upcoming language enhancements?
Lars Fosdal replied to David Schwartz's topic in RTL and Delphi Object Pascal
It works for global vars, though. unit MiscTestMore; interface uses System.SysUtils; type TOutput = reference to procedure(const aText: string); TRec = record a: string; b: integer; end; const c_TRec: TRec = (a:'A'; b:1); // Works c_TRec2: TRec = (a:'A2'); var v_TRec: TRec = (a:'A3'; b:2); // Works v_TRec2: TRec = (a:'A4'); procedure RecordConstTest(const Output:TOutput); implementation function Fmt(const aTitle: string; const aRec: TRec):String; begin Result := Format('%s a:"%s" b:%d', [aTitle, aRec.a, aRec.b]); end; procedure RecordConstTest(const Output:TOutput); begin Output(Fmt('c_TRec ', c_TRec)); Output(Fmt('c_TRec2', c_TRec2)); Output(Fmt('v_TRec ', v_TRec)); Output(Fmt('v_TRec2', v_TRec2)); // var l_TRec1: TRec := (a:'A5'; b:3); // Fails // var l_TRec2: TRec := (a:'A6'); var l_TRec: TRec := v_TRec; // Works Output(Fmt('l_TRec ', l_TRec)); end; end. Output: c_TRec a:"A" b:1 c_TRec2 a:"A2" b:0 v_TRec a:"A3" b:2 v_TRec2 a:"A4" b:0 l_TRec a:"A3" b:2 -
10.4.1+ Custom Managed Records usable?
Lars Fosdal replied to Darian Miller's topic in RTL and Delphi Object Pascal
I like clarity. Brevity is not always clarity. -
There is documentation, but it is meagre on examples of use. http://docwiki.embarcadero.com/Libraries/Sydney/en/EMS.Services.TEMSLoggingService
-
What it's like to be a Delphi Developer
Lars Fosdal replied to Joe C. Hecht's topic in Tips / Blogs / Tutorials / Videos
Lots of good advice and my kind of humor, Joe! Great interview! -
Can you verify that you are not calling Click from other methods / event handlers? Is it triggered from OnClick, or from OnMouseUp/OnMouseDown?
-
Image32 - 2D graphics library (open source freeware)
Lars Fosdal replied to angusj's topic in I made this
My first PC as well. Well, technically - the Memotech MTX512 belonged to my dad, but guess who used it the most?- 42 replies
-
- graphics
- cross-platform
-
(and 2 more)
Tagged with:
-
10.4.1+ Custom Managed Records usable?
Lars Fosdal replied to Darian Miller's topic in RTL and Delphi Object Pascal
Yup. -
Why compiler allows this difference in declaration?
Lars Fosdal replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
Interesting. I wonder why it was limited to the OLE/COM scope? -
Why compiler allows this difference in declaration?
Lars Fosdal replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
@Pat Foley - That is something entirely different. I was talking about naming parameters to a method.