Jump to content

Mike Torrettinni

Members
  • Content Count

    1509
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Mike Torrettinni

  1. Mike Torrettinni

    Some sneak peek of some performance numbers with 11.3

    Do I understand correctly that 11.3 will include your improvements in RTL, or that you have available code patch we can apply to 11.3 when released?
  2. Here is suggested reading for certification: https://www.embarcaderoacademy.com/courses/delphi-developer-certification-exam/lectures/6312823 I think the last updated exams were in 2011, so these recommended readings are what was available back then. What you already read, some books could be considered advanced, so I think you should be good.
  3. It says it has 60 questions. I think 1 minute per question should be enough to answer if you know the answer. If you can download all the relevant material for the exam, it shouldn't be too hard to pass just by quickly reviewing the material to catch up with something you use rarely, If you decide to go for it, let us know of the experience. Having certificates can't hurt, only good for you, especially at the beginning of the career.
  4. Here it says it's valid for only 2 years : https://www.embarcaderoacademy.com/p/delphi-developer-certification-premium-package Even worse than AWS 3 years.
  5. Mike Torrettinni

    Windows App hosting options?

    You might get better answers on forums related to website design... but, I have a simple /downloads page where php script does the downloading on Download button, there is no direct links. I don't have it designed this way because of ads, but I want to make sure they always download the latest version. I would multiply download file size with the download times you think you will get in a month, then you find the hosting that suits the download bandwidth. From my experience, the hosting packages don't just cut you off when you reach the max bandwidth, but they send multiple warning before you reach it. And then you can decide to upgrade or switch to another hosting, if that is easy for you to do. Don't forget that is pretty common to download zip files, so this can give you a little help with bandwidth.
  6. Mike Torrettinni

    Why is ShowMesssage blocking all visible forms?

    I have an example where I create multiple instances of FormX from Main Form. When FormX are created, I can focus individual form or Main Form without problems, but as soon as one of the forms uses ShowMessage or (another Form.ShowModal) all forms are blocked, and waiting for focus to go back to the form. Screenshot of MainForm and 3x FormX, and I can focus any of them - forms are shown by Show method As soon as one of the forms uses ShowMessage('msg...'), the focus is on the message window and none of the other forms can be focused until this message window is closed: This is very simple example, I create forms like this: procedure TForm8.Button1Click(Sender: TObject); var vNewForm: TFormX; begin vNewForm := TFormX.Create(Application); fForms.Add(vNewForm); fForms.Last.Show; end; Is there anyway how to be able to work with other forms, even though one of them is waiting for another window (dialog box, or another Form) to close?
  7. Mike Torrettinni

    Any advice when to use FileExists?

    I definitely enjoy refactoring old code into small reusable methods, but refactoring methods dealing with Files always gives me a sense of 'point of failure' is very close 😉 Lets assume I'm setting up main method that access files, like this pseudo code: MainMethod: GetMainPath; for each File in MainPath do begin if FileExists(File) then begin If _IsFileValidForParsing(File) then begin If _FileIsA(File) then _ParseAsA(File); else _ParseAsB(File); end; end; end; So, here I have these simple (or complex) methods that all use File : _IsFileValidForParsing _FileIsA _FileIsB _ParseAsA _ParseAsB ... and, if they are to be reusable, I always put FileExists() also in each of these method, because I don't know who calls this method and if the caller already checked... just to be sure. So, now looking at the code if feels like my OS will eventually say: WTF, the File exists, stop checking for it!!! 🙂 Is this good approach? Any advice how to look at this, not to worry? Or I should change my approach? Thanks!
  8. Mike Torrettinni

    A gem from the past (Goto)

    Yes, I do today, that code is part of my 'learn to code just enough to sell' time, so the focus was not on learning to how to do things right.
  9. Mike Torrettinni

    A gem from the past (Goto)

    Another one from the way back: this was a long function (500+ loc) and to skip all the unnecessary code and exit on first possible condition, I used ToExit label function Process: boolean; var vList: TStringList; label ToExit; begin Result := false; vList := TStringList.Create; ... // for fast execution, exit asap when condition is right if condition_to_exit then begin Result := True; goto ToExit; end; ... ToExit: FreeAndNil(vList); end; So many mistakes here, but It's been working 15+ years. Ready for a makeover!
  10. Mike Torrettinni

    A gem from the past (Goto)

    Yes, I'm definitely guilty of this.
  11. Mike Torrettinni

    A gem from the past (Goto)

    That's pretty cool idea, avoiding exiting and running project again.
  12. Mike Torrettinni

    The Delphi 11.2 release thread

    This works really well!
  13. Mike Torrettinni

    The Delphi 11.2 release thread

    Let me know if it works for you. Sometimes I also switch between 32/64 platforms, because under 64bit it usually show more hints, if there are any hints.
  14. Mike Torrettinni

    The Delphi 11.2 release thread

    Did you try switching between Release/Debug config? It helps my projects and I don't need to do the close and re-open.
  15. Mike Torrettinni

    Change of coding style/structure..

    When I was using With a lot, I had the same view about With. But as it was already mentioned, a big disadvantage is using debugger with such a code. Very cumbersome, so I removed all With usage, except for a few basic forms, as in your example, for simple ShowModal - and these are in the process to be removed from using With, too! Do you use Virtual Treeview (TVirtualStringTree), have you ever looked into the code or try to figure it out? The usage of With is in every other method, including nested With! Such a great component, so incompatible with debugger!
  16. Mike Torrettinni

    Ctrl+Click declaration fails but CTRL+G works (Delphi 11.2)

    When Ctrl+click stops working for my projects, I found the best and easiest way to get it to work, I just switch between Release/Debug configuration (and back) and you can see the Codeinsight process does something and Ctrl+click starts working again. So, if I develop in Debug and Ctrl+Click stops working, I double click on Release, wait 1s to see Codeinsight progress shows up, then double click to go back to Debug config: Annoying, but works almost every time and it takes about 5 seconds. So, not too bad.
  17. Mike Torrettinni

    How to synchronize splitters?

    I have 2 splitters that I would like to synchronize moves, to move at the same time. Here I have example of top and bottom 2 panels, and 2 splitters: When Splitter1 resizes Panels 1&2, I would like for Splitter2 to resize Panels 3&4 at the same time, as if it's 1 splitter. Horizontal splitter of course splits Up & Down areas, so I can't have 1 vertical splitter. I found this code (http://www.delphigroups.info/2/66/312669.html) and works good for just 1 splitter. It works good when moving Splitter1 it also moves the same way Splitter2. TForm1 private fOriginalWindowProc: TWndMethod; procedure MoveOtherSplitter(var aMsg: TMessage); ... procedure TForm1.FormCreate(Sender: TObject); begin fOriginalWindowProc := Splitter1.WindowProc; Splitter1.WindowProc := MoveOtherSplitter; end; procedure TForm1.MoveOtherSplitter(var aMsg: TMessage); begin Case aMsg.Msg Of WM_MOUSEFIRST..WM_MOUSELAST: Splitter2.Perform(aMsg.Msg, aMsg.WParam, aMsg.LParam); end; fOriginalWindowProc(aMsg); end; But I don't know how to modify the code to apply the same behavior when moving Splitter2 to move Splitter1 at the same time. I tried to assign similar to Splitter2: var fOriginalWindowProc2: TWndMethod; procedure MoveOtherSplitter2(var aMsg: TMessage); ... fOriginalWindowProc2 := Splitter2.WindowProc; Splitter2.WindowProc := MoveOtherSplitter2; procedure TForm1.MoveOtherSplitter2(var aMsg: TMessage); begin Case aMsg.Msg Of WM_MOUSEFIRST..WM_MOUSELAST: Splitter1.Perform(aMsg.Msg, aMsg.WParam, aMsg.LParam); end; fOriginalWindowProc2(aMsg); end; I get stack overflow, because it locks in a message loop between both splitters moves. Any help appreciated in implementing how to synchronize splitters. full code with form: unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls; type TForm1 = class(TForm) Panel1: TPanel; Panel2: TPanel; Splitter3: TSplitter; Panel3: TPanel; Panel4: TPanel; Splitter1: TSplitter; Panel5: TPanel; Panel6: TPanel; Splitter2: TSplitter; procedure FormCreate(Sender: TObject); private fOriginalWindowProc: TWndMethod; procedure MoveOtherSplitter(var aMsg: TMessage); var fOriginalWindowProc2: TWndMethod; procedure MoveOtherSplitter2(var aMsg: TMessage); public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin fOriginalWindowProc := Splitter1.WindowProc; Splitter1.WindowProc := MoveOtherSplitter; fOriginalWindowProc2 := Splitter2.WindowProc; Splitter2.WindowProc := MoveOtherSplitter2; end; procedure TForm1.MoveOtherSplitter(var aMsg: TMessage); begin Case aMsg.Msg Of WM_MOUSEFIRST..WM_MOUSELAST: Splitter2.Perform(aMsg.Msg, aMsg.WParam, aMsg.LParam); end; fOriginalWindowProc(aMsg); end; procedure TForm1.MoveOtherSplitter2(var aMsg: TMessage); begin Case aMsg.Msg Of WM_MOUSEFIRST..WM_MOUSELAST: Splitter1.Perform(aMsg.Msg, aMsg.WParam, aMsg.LParam); end; fOriginalWindowProc2(aMsg); end; end. object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 360 ClientWidth = 477 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -12 Font.Name = 'Segoe UI' Font.Style = [] OnCreate = FormCreate TextHeight = 15 object Splitter3: TSplitter Left = 0 Top = 180 Width = 477 Height = 3 Cursor = crVSplit Align = alTop Color = clActiveCaption ParentColor = False ExplicitLeft = 1 ExplicitTop = 1 ExplicitWidth = 832 end object Panel1: TPanel AlignWithMargins = True Left = 3 Top = 3 Width = 471 Height = 174 Align = alTop BevelOuter = bvNone ParentBackground = False TabOrder = 0 object Splitter1: TSplitter Left = 235 Top = 0 Width = 5 Height = 174 Color = clActiveCaption ParentColor = False ExplicitLeft = 481 ExplicitTop = 17 ExplicitHeight = 431 end object Panel3: TPanel AlignWithMargins = True Left = 250 Top = 10 Width = 211 Height = 154 Margins.Left = 10 Margins.Top = 10 Margins.Right = 10 Margins.Bottom = 10 Align = alClient BevelOuter = bvNone Caption = 'Panel2' Color = clWhite ParentBackground = False TabOrder = 0 ExplicitLeft = 451 ExplicitTop = 5 ExplicitWidth = 452 ExplicitHeight = 425 end object Panel4: TPanel AlignWithMargins = True Left = 10 Top = 10 Width = 215 Height = 154 Margins.Left = 10 Margins.Top = 10 Margins.Right = 10 Margins.Bottom = 10 Align = alLeft BevelOuter = bvNone Caption = 'Panel1' Color = clWhite ParentBackground = False TabOrder = 1 ExplicitHeight = 210 end end object Panel2: TPanel AlignWithMargins = True Left = 3 Top = 186 Width = 471 Height = 171 Align = alClient BevelOuter = bvNone ParentBackground = False TabOrder = 1 ExplicitLeft = 168 ExplicitTop = 344 ExplicitWidth = 185 ExplicitHeight = 41 object Splitter2: TSplitter Left = 235 Top = 0 Width = 5 Height = 171 Color = clActiveCaption ParentColor = False ExplicitLeft = 448 ExplicitTop = 2 ExplicitHeight = 425 end object Panel5: TPanel AlignWithMargins = True Left = 10 Top = 10 Width = 215 Height = 151 Margins.Left = 10 Margins.Top = 10 Margins.Right = 10 Margins.Bottom = 10 Align = alLeft BevelOuter = bvNone Caption = 'Panel3' Color = clWhite ParentBackground = False TabOrder = 0 ExplicitHeight = 95 end object Panel6: TPanel AlignWithMargins = True Left = 250 Top = 10 Width = 211 Height = 151 Margins.Left = 10 Margins.Top = 10 Margins.Right = 10 Margins.Bottom = 10 Align = alClient BevelOuter = bvNone Caption = 'Panel4' Color = clWhite ParentBackground = False TabOrder = 1 ExplicitLeft = 451 ExplicitTop = 5 ExplicitWidth = 1027 ExplicitHeight = 425 end end end
  18. Mike Torrettinni

    How to synchronize splitters?

    I have TSplitter interposer in Commons.UI.SyncSplitters unit and method procedure SyncSplitters(aSplitter1, aSplitter2: TSplitter);. So all I do is use the unit and call SyncSplitters - which sets the Siblings, in one method. Perhaps I'm already doing what you are suggesting.
  19. Mike Torrettinni

    How to synchronize splitters?

    How would you use TSplitter.Constructor for splitters already on the form, to connect them? I already have UI set, don't want to create splitter controls when form is created, if that is what your suggestion requires.
  20. Mike Torrettinni

    Tip of day glitch

    Delphi 11.1 MMX 15.1.3 build 2530 See the text keeps overwriting the old text:
  21. Mike Torrettinni

    Tip of day glitch

    15.1.4 in 11.2, through RDP, works OK, no glitch. Thanks!
  22. Mike Torrettinni

    The Delphi 11.2 release thread

    11.2 seems to have less delay than 11.1, almost no delay. Tested on fresh installation and medium sized project. I moved from 10.2.3 to 11.1 a few months ago and there are noticeable improvements. 11.2 IDE seems quite less jittery than 11.1, smoother, less flicker.
  23. Mike Torrettinni

    The Delphi 11.2 release thread

    This improvement is pretty interesting: - Using CardPanels inside a frame but then, it's a first version that is supposed to work, so perhaps is better to wait another update, before using in production releases.
  24. Mike Torrettinni

    TTimer limit..

    Just wanted to say be careful with these numbers, if they are important... 8h = 480 minutes, right?
  25. Mike Torrettinni

    TTimer limit..

    Perhaps something like this: Timer.Interval := 1000000000;//1,000,000,000 fIntervalCount := 0; OnTimer Inc(fIntervalCount); if fIntervalCount >= 15 then ...
×