-
Content Count
3504 -
Joined
-
Last visited
-
Days Won
115
Everything posted by Lars Fosdal
-
Difference between Pred and -1
Lars Fosdal replied to John Kouraklis's topic in RTL and Delphi Object Pascal
Wow! That fact had eluded me! -
The book gives a reasonably good understanding of threading issues. That understanding would suggest alternate solutions that avoids the pitfalls of messaging.
-
A good place to start for writing solid thread code: https://leanpub.com/omnithreadlibrary
-
Ref installation: You can safely install without elevating to localadmin.
-
If you had TMS libs from before, like the TMS Component Pack, those are purely VCL for Windows. There are currently two alternatives for cross platform: 1. FireMonkey + TMS FMX Components https://www.tmssoftware.com/site/products.asp?t=fm (All Firemonkey supported platforms) 2. CrossVCL https://www.crossvcl.com/ - not compatible with TMS for VCL, afaik. (MacOS and Linux) Disclaimer: I've not used any of these, only the TMS Component Pack for VCL.
-
Using the std TJson class in REST.Json. Probably not considered gold std.
-
Do you name your Threads for debugging?
Lars Fosdal replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
Yes. I use the thread class name and an instance id. -
Android FMX Game App not working reliably
Lars Fosdal replied to Len Yates's topic in Cross-platform
Also, monitor your memory consumption in the Windows App. If it is not stable but keeps growing - there is a chance that you have a leak.- 5 replies
-
- delphi 10.3.3
- multi-platform
-
(and 1 more)
Tagged with:
-
That is never wrong. Please ignore me 🖖
-
Not sure why one would want to do this in a Delphi app, when the tools are right there in PowerShell. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-hotfix?view=powershell-7
-
Firefox? I assume Firemonkey. You are more likely to get help if you are specific with regards to what you want to do.
-
Difference between Pred and -1
Lars Fosdal replied to John Kouraklis's topic in RTL and Delphi Object Pascal
I know... My indendation style is unconventional. It works for me, though. -
Difference between Pred and -1
Lars Fosdal replied to John Kouraklis's topic in RTL and Delphi Object Pascal
Scoured our complete source code and found only one occurence each of pred and succ. One was legit. for e := Low(TElementType) to Pred(High(TElementType)) do // i.e. do not include the last enum value in the loop. The other one was a bullshit one - and I was probably the author of both. function AfterFirst(const Match:char; const st:string):String; var index : Word; begin index := pos(Match,st); if index <> 0 then Result := Copy(st, index + 1, succ(Length(st) - index)) else Result := st; end; It's not even consequent. -
How about using MadExcept or EurekaLog ?
-
That said, there is BigInteger from https://github.com/rvelthuis/DelphiBigNumbers
-
An IPv6 address is 128 bits. The answer is no. You'd need two UInt64s to hold that.
-
Setting a "nullable" property on a .NET object
Lars Fosdal replied to Dave Nottage's topic in Windows API
But isn't it still a value type? https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-value-types#how-to-identify-a-nullable-value-type -
Setting a "nullable" property on a .NET object
Lars Fosdal replied to Dave Nottage's topic in Windows API
100% guesswork without any foundation, except name likeness, follows: There is a GetUnderlyingType property in System.RTTI type TRttiEnumerationType - but it is used absolutely nowhere in the RTL. Also, WinAPI.Ole2 contains a VariantChangeType, and WinAPI.ActiveX contains a VariantChangeTypeEx that may be relevant. System.VarUtils contain both. function TRttiEnumerationType.GetUnderlyingType: TRttiType; begin Result := Pool.TypeOrNil(TypeData^.BaseType); end; function TRttiPool.TypeOrNil(Value: PPTypeInfo): TRttiType; begin if Value = nil then Exit(nil); Result := GetType(Value^); end; function TRttiPool.GetType(ATypeInfo: Pointer): TRttiType; begin if ATypeInfo = nil then Exit(nil); Result := TRttiType(ReadObjectPointer(TRttiType, nil, ATypeInfo)); end; -
I see. Personally, I rely on the MRU, Quick Access and Libraries functions that are built into the File Explorer. They are sufficient for me.
-
I am not sure if these are supported in Lazarus, but you could try an ActionMainMenuBar + ActionManager where you only use the top-level menu items. It would handle the hotkeys for you. ActionBarDemo.zip
-
@limelect What is the nature of the interaction between your app and the file explorer? Would it be better to launch your own explorer with CreateProcessEx? That way, your app would be the owner, and you would know when it closes, and if you need to launch another. In Windows 10, you can control if folder explorer windows should have separate processes by default or not. The default appears to be not, meaning each explorer opened (from f.x. using Win+E) actually is running in the same process. What is your setting? Does changing this setting affect your observable problem?
-
Beginner-Question: Server Prog, BackgroundWorker, unknown thread
Lars Fosdal replied to t2000's topic in OmniThreadLibrary
@Primož Gabrijelčič From the wishful thinking department: I'd love to see OTL evolve to support Linux/MacOS, iOS and Android. Hence, I'd love to see solutions that do NOT use Windows messaging - or at least hide it inside the notification implementation. -
VSoft.Awaitable - async/await for Delphi
Lars Fosdal replied to Vincent Parrett's topic in I made this
Is there a way to use it with "plugin" handlers instead on anonymous procedures? There are so many pitfalls with captures. -
Is Class with 2 'nested' constructors bad design?
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
An alternative is to create completely independent classes, and use an interface to define the methods that you want to be general across the classes. -
Is Class with 2 'nested' constructors bad design?
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
It requires some practice to wrap your head around encapsulation (pun intended) and thinking about how to make your code general or generic, if you like. A common base class mostly makes sense if you want to be able to ignore how it is used later, i.e. rely on polymorphism, and when you have a certain degree of reuse of code. Specific: Instance := TClassType.Create, then provide params -- Ideally, this would be the one place where you do something specific for the type when using it. General. Instance.LoadFiles; General: Instance.Compare; General: Output := Instance.CreateOutput; General: Render Output As you expand your hierarchy, you add properties and features only on the level where you need them. type TCompare = class procedure LoadFiles; virtual; procedure Compare; virtual; property File1: string; property File2: string; end; TCompare2Way = class(TCompare) procedure Compare; override; property Merge: Boolean; end; TCompare3Way = class(TCompare2Way) procedure LoadFiles; override; procedure CompareLeft; procedure CompareRight; procedure Compare; override; property File3: string; end;