override and final are two new qualifiers introduced in C++11. The use of these qualifiers is optional. They are meant to be used with virtual methods to show the intention of the method. The compiler uses these qualifiers to check if your intention matches the actual ground truth in your code and throws a compile error if it does not. Thus, it helps to catch bugs earlier at compile time.
When you specify override for a method, you are indicating to the compiler that this is a virtual method and it is overriding a virtual method with the same signature in one of the base classes that the current class inherits from. If the method is not inheriting from any virtual method with the same signature, the compiler throws an error. Thus if you made a mistake in the function signature while defining this method, you would not have caught it unless you used this qualifier.
When you specify final for a method, you are indicating that this is a virtual method and that no class that inherits from the current class can override this method. If any method tries to override this method in an inherited class, the compiler throws an error.
If override or final are used with non-virtual methods, the compiler throws an error.
These qualifiers are specified after the function input arguments and should be specified after const if the virtual method is a const method. If you put these qualifiers before a const, you will get a weird error with GCC that gives no hint that this is because of the order of qualifiers is wrong!
These qualifiers are to be specified only with the method declaration. If you try to use them with the method definition, the compiler will throw an error.
You can specify override final for a method, but it is the same as using final.
override is not allowed to be used with the base virtual method. This is for the obvious reason that the base virtual method is the first virtual method and it is not overriding any other method.
final can be used with the base virtual method. This can be used to specify that the first base virtual method cannot be overridden in any inherited class.
This code example shows how to use these qualifiers:
KAlgebra is a simple graphing calculator for Linux. It is a good replacement to using an actual graphing calculator. I find it useful to plot functions instead of using SageMath, which can be an overkill for just plotting.
It can be installed easily from Ubuntu repositories:
$ sudo apt install kalgebra
I usually just switch to the 2D plot mode and add my function. KAlgebra checks if the expression is correct as you type and indicates error. If expression is correct, then it shows the graph preview right below. If you press Enter after the expression, it is plotted in the main 2D plot window. More functions can be added by clicking the Add tab in the bottom-right corner.
As you move the mouse inside the 2D plot window, KAlgebra shows the X and Y coordinate values in the bottom-left corner. It also shows the tangent to the curve as you move your mouse along the curve.
Sensible is a super simple plugin for Vim by Tim Pope. It is nothing but a set of sensible settings for your vimrc. It is a great way to start off on a new system where you do not have access to your fully featured vimrc. I only wish he explained some of the choices he made for the options in this file.
If I have a local account on the remote or new computer, I find it far easier to just replicate my vimrc, and other dot files, using GNU Stow.
I updated Ubuntu packages, which included Firefox and I updated Selenium using pip3 cause that also depends on the Firefox version. But running my existing Python scripts that use Selenium popped this error:
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'
Firefox now provides the geckodriver as a separate binary. You can download the version matching your OS and CPU here. Unzip the file and place the binary anywhere that is in your PATH. Your Python scripts should work now.
To use just type EmojiOne Picker at the Dash. Note that it takes a few seconds to load and finally settles down in the system tray area with a smiley face. Right-click on it to get the fully detailed list of emoji. Click on any one and it will be copied to your clipboard for easy pasting into any app or website.
In Settings, I like to choose the Low end computer mode which reduces the number of emoji and thus makes loading and usage of this app faster.
It is useful to be able to autocomplete a path to a directory or filename while typing code or script files. This helps in ensuring that there are no mistakes and the path is correct. Thankfully, Vim has an autocompletion feature for typing path in insert mode! It calls this feature as file name completion.
Ctrl-x Ctrl-f: This is the shortcut to autocomplete path in insert mode. Start typing a path (absolute or relative) and use this keyboard shortcut. You will see a dropdown menu filled with the next entries from the filesystem that can be used to fill the path.
Ctrl-n or Ctrl-p: Shortcuts to move up and down the entries in the autocomplete dropdown menu. If you move off the top or bottom of the dropdown menu, you get the empty entry.
Absolute path: Any path that you begin typing with a slash is autocompleted as an absolute path.
Relative path: This is any path that does not begin with a slash. They are autocompleted too. Note that they will use the directory that Vim was launched from (PWD) as the root.
Hidden files or directories: I found that this was autocompleted only if I typed the first period and then used Ctrl-x Ctrl-f.
RSync has some different and confusing behavior depending on whether you put a trailing slash on the source directory or not.
No trailing slash on source directory: this copies the source directory itself as a subdirectory into the destination directory.
$ rsync -a /some/path/foobar .
Trailing slash on source directory: this copies the contents inside source directory into the destination directory.
$ rsync -a /some/path/foobar/ .
You do not see such confusing behavior with cp or mv. I guess rsync has this because it is usually used for synchronizing the contents of two directories but it is also sometimes used to copy over directories.