Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 12/20/19 in all areas

  1. We are all given a finite time here. Why would we spend it optimising something that wasn't a bottleneck. Imagine measuring, identifying the bottleneck, optimising, and the observing real discernible performance benefits? How great does that feel? Conversely, imagine expending time on work that yields no benefit. And worse, you likely end up with code that is harder to read and maintain. Usually this just results in bugs. Think of it, you spend valuable time making your program worse. You may as well just go to the pub and leave the code alone. You have a good time, and your program is better. Win win.
  2. Leave the pub once you reach the Ballmer Peak and then work on your program to make it even better
  3. PeterPanettone

    Open Url From Current Line

    Put the caret on a source code line containing the URL of a web page: Then press Alt+T -> U to run this IDE tool Open URL From Current Line: Here is the source code: program OpenUrlFromCurrentLine; {$APPTYPE CONSOLE} {$R *.res} uses Winapi.Windows, Winapi.ShellAPI, System.Classes, System.RegularExpressions, System.SysUtils; var ThisLine: Integer; ThisLineStr, ThisURL: string; ThisSource: TStringList; begin // This is explained at: https://en.delphipraxis.net/ try if ParamCount > 0 then begin if ParamCount = 2 then begin if FileExists(ParamStr(1)) then begin if System.SysUtils.TryStrToInt(ParamStr(2), ThisLine) then begin ThisSource := TStringList.Create; try ThisSource.LoadFromFile(ParamStr(1)); if ThisSource.Count >= (ThisLine) then begin ThisLineStr := ThisSource[ThisLine - 1]; ThisURL := TRegEx.Match(ThisLineStr, '\b(?:(?:https?|ftp|file)://|www\.|ftp\.)[-A-Z0-9+&@#/%=~_|$?!:,.]*[A-Z0-9+&@#/%=~_|$]', [roIgnoreCase]).Value; if ThisURL <> '' then Winapi.ShellAPI.ShellExecute(0, 'open', PChar(ThisURL), nil, nil, SW_SHOW); end; finally ThisSource.Free; end; end; end; end; end; //Readln; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. Build it. Then create a new IDE tool and configure it like this: Now you are ready to have fun. Merry Christmas!
  4. Uwe Raabe

    Hotkeys for Move Entity

    I always have the feeling of wasted with that.
  5. aehimself

    Open Url From Current Line

    There you go, I found it: https://dictionary.cambridge.org/us/dictionary/english/sarcasm I'll try to act like an adult and stop this discussion right here. If you would like to learn more about coding styles, Google is - as always - your friend. In the mean time, please learn how not to get offended when people say their favorite color is not the same as yours.
  6. aehimself

    Open Url From Current Line

    I'm no expert, but I'd say it's... nesting, which is... unnecessary? 😐
  7. David Heffernan

    Open Url From Current Line

    I doub you'll find a single book written in the past 25 years that would advocate nesting over early return. All the most respected experts agree on this and have done for years. Which books are you reading?
  8. tobiasgiesen

    SFTP client

    Hello, I would like to let you know that the uploading permissions bug has been fixed in the latest TGPuttyLib version.
  9. PeterPanettone

    Open Url From Current Line

    I too, if they are LOGICAL. But the above are not.
  10. aehimself

    Open Url From Current Line

    I'm a fan of early returns, I use them all the times. For me it does improve readability but my colleagues complain that it makes it harder for them. This is a matter of preference IMO, nothing else.
  11. Of course but I am assuming that Steve is doing more with this list than just removing many items at once. My personal experience with collections and a lot of material I read and watched is telling me that the chances are kinda slim that a linked list will perform better in the overall usecase. Anyhow in the context of this question any discussion of this is moot and my first sentence in my first comment still stands. Anything else is a waste of time.
  12. Huh? You have heard of premature optimization haven't you?
  13. Lars Fosdal

    BLE cannot get service

    Did you call BluetoothLE1.DiscoverServices before calling GetService? http://docwiki.embarcadero.com/Libraries/Rio/en/System.Bluetooth.TBluetoothLEDevice.GetService http://docwiki.embarcadero.com/Libraries/Rio/en/System.Bluetooth.TBluetoothLEDevice.DiscoverServices
×