-
Content Count
94 -
Joined
-
Last visited
-
Days Won
4
SwiftExpat last won the day on June 13
SwiftExpat had the most liked content!
Community Reputation
33 ExcellentTechnical Information
-
Delphi-Version
Delphi 11 Alexandria
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
FreeAndNil() - The Great Delphi Developer Debate
SwiftExpat replied to AlexBelo's topic in Tips / Blogs / Tutorials / Videos
I am signed up. Anything I can learn ( or hear out loud and realize that I actually understand the effect of the code I am writing ) is worth my time. This is a focused topic, I expect the content will be more focused than 'choosing the best ui framework for x' . -
OnSaveState did not fire when I tested 😞
-
split the string based on the delimiter for the last string in the list, ('0011') convert to integer (11) and increment (12) convert the int back to a string ('12') compare the lengths and then loop to add in the padding zeros ('0012') concate the list back to 1 string
-
Many of those lines are just there just to be able to place break points and verify what lines are actually executed (or not executed ) when the application terminates. Think of the situation where you need a child window, when that window is destroyed ( destroyed and closed are not the same ). In the parent window you would call free on the child window to have the destructor called.
-
I thought about this one quite hard today, a bit of fun learning, and here is my suggestion. FMX has the following mapped: procedure TPlatformCocoa.Terminate; begin FRunning := False; FTerminating := True; TMessageManager.DefaultManager.SendMessage(nil, TApplicationTerminatingMessage.Create); NSApp.terminate(nil); end; So in my app I implemented it as this , similar to what they recommend for android. unit dmDestroyMe; interface uses System.SysUtils, System.Classes, System.Messaging; type TDestroyVersion = class public VersionString: string; constructor Create; destructor Destroy; override; end; TDestroyMeDM = class(TDataModule) procedure DataModuleCreate(Sender: TObject); procedure DataModuleDestroy(Sender: TObject); private FVersion1, FVersion2: TDestroyVersion; v1, v2: string; msgSubId: integer; procedure ApplicationTerminatingHandler(const Sender: TObject; const Msg: TMessage); public { Public declarations } end; var DestroyMeDM: TDestroyMeDM; implementation {%CLASSGROUP 'FMX.Controls.TControl'} {$R *.dfm} { TDestroyVersion } uses FMX.Forms; constructor TDestroyVersion.Create; begin VersionString := '1.2.3.4'; end; destructor TDestroyVersion.Destroy; begin VersionString := '0.0.0.0'; inherited; end; procedure TDestroyMeDM.ApplicationTerminatingHandler(const Sender: TObject; const Msg: TMessage); begin v1 := '0.0.1.0'; Fversion1.Free; v2 := '0.1.0.0'; end; procedure TDestroyMeDM.DataModuleCreate(Sender: TObject); begin v1 := '2.0.1.0'; v2 := '3.1.0.0'; FVersion1 := TDestroyVersion.Create; FVersion2 := TDestroyVersion.Create; msgSubId := TMessageManager.DefaultManager.SubscribeToMessage(TApplicationTerminatingMessage, ApplicationTerminatingHandler); end; procedure TDestroyMeDM.DataModuleDestroy(Sender: TObject); begin FVersion2.Free; TMessageManager.DefaultManager.Unsubscribe(TApplicationTerminatingMessage, msgSubId, true); end; end. I will keep looking for the QP issue, but honestly this is one they expect you to implement. I just did not have the experience when I saw this the first time around. DestroyMe.zip
-
On MacOS the process is killed, so the app never gets to shutdown correctly. I opened a support ticket with Embarcadero and was not given a resolution to this. I ended up with a timer to save state every x seconds 😞 Maybe someone else has a better solution.
-
2 basics that might help take this thread further. What platform are you debugging on? Just to be sure, are you compiling in Debug not Release?
-
Code Insight can't find certain units (app compiles OK)
SwiftExpat replied to Incus J's topic in Delphi IDE and APIs
It is worth reporting in QP. As a work around you could create a link and then add that linked folder to the end of your search path. Creates a symbolic link. MKLINK [[/D] | [/H] | [/J]] Link Target /D Creates a directory symbolic link. Default is a file symbolic link. /H Creates a hard link instead of a symbolic link. /J Creates a Directory Junction. Link Specifies the new symbolic link name. Target Specifies the path (relative or absolute) that the new link refers to. -
Android: Opening files in external application
SwiftExpat replied to Bart Kindt's topic in Cross-platform
Mustafa, Great job putting together that readme for your github repo. I like the inline samples and android version cross references. -
https://docs.microsoft.com/en-us/windows/win32/api/_wua/ You should almost be able to follow this C# example https://stackoverflow.com/questions/64203306/c-sharp-get-pending-windows-updates-updates-that-cant-be-found Also you might prototype it in powershell just to make sure you are getting the results you want before you spend time writing Delphi code. here is almost a step by step https://mcpmag.com/articles/2016/06/23/finding-pending-updates.aspx
-
Odd timing when using multiple threads
SwiftExpat replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
You can also get the line size with sysinternals coreinfo, output looks like this: Logical Processor to Cache Map: **---------- Data Cache 0, Level 1, 32 KB, Assoc 8, LineSize 64 **---------- Instruction Cache 0, Level 1, 32 KB, Assoc 8, LineSize 64 **---------- Unified Cache 0, Level 2, 512 KB, Assoc 8, LineSize 64 ************ Unified Cache 1, Level 3, 32 MB, Assoc 16, LineSize 64 --**-------- Data Cache 1, Level 1, 32 KB, Assoc 8, LineSize 64 --**-------- Instruction Cache 1, Level 1, 32 KB, Assoc 8, LineSize 64 --**-------- Unified Cache 2, Level 2, 512 KB, Assoc 8, LineSize 64 -
If that happens consistently, then you might be able to trace the last unit compiled using sysinternals process monitor. Having that might help you work backwards into a "reproduce failure package". You would have to judge if that activity is worth the effort, and i honestly do not know if it will fix anything for you. I always disable Enable Unit Directory Cache under Computer\HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\22.0\Compiling
-
WinSock (Indy) select() doesn't return on network
SwiftExpat replied to aehimself's topic in Network, Cloud and Web
The client only knows / reacts to what it sends receives, so it could stay established. Sending keep alives is still a possible strategy. You can still have a timer on a router expire and the router will not send anything to the client(s). at that point it should be a re-transmit. It is still worth asking your network guys to understand if there is anything in the middle. Especially a load balancer in front of that HTTP server. -
New Delphi job opportunity
SwiftExpat replied to Berocoder's topic in Job Opportunities / Coder for Hire
They are not even planning on having full time trained staff. An MBA will tell you something like, "IT should be 1% of budget". The employer believes (plans) they have 2 options, outsource the project at a fixed price (which is never really fixed) or hire 3-4 low cost developers. The last developers I worked with in Brazil explained the situation, school is on the first floors of a tall building. Floors 7-8 were for our company, and our competition had floors 11&12. So when they go down for coffee at street level they are recruited, for a small pay increase, so naturally you they jump after 6 months. I don't blame them, it is better pay. School is also heavily sponsored by Microsoft and Oracle, so no surprise what they were trained in. The contract negotiators go in a room and promise to provide a complete solution and a fully trained staff at a fixed cost (except travel expenses and ...). And they substitute players whenever they feel like it (see the above, just a different angle). So no it does not compute. If you are the full time company employee, you will be looking for that career change. The circle just continues. -
WinSock (Indy) select() doesn't return on network
SwiftExpat replied to aehimself's topic in Network, Cloud and Web
My guesses are: TCP connection went into timewait on the client. Netstat is the only tool that I am aware will show you this, so you need to wrap it in loop and capture the output. Router killed it to conserve memory. The registry reference you are looking for is here (older version, but you can adjust): https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc757512(v=ws.10) It is a mix of timed wait and keep alive that you try to tune. I have only had mixed success trying to keep long db connections open, the keepalives are often killed at the firewall / router level. A lot of modern network equipment tracks those connections and kills them to save router memory. I help it helps you to get some insight.