Visual Studio Code is a free open source code editor with numerous extensions supporting most code languages, including for proprietary languages like Matlab. Fortran is well-supported by Visual Studio Code using the Modern Fortran extension, wrapping Gfortran as a linting tool.
Currently, Grammarly does not have an official API. Rahul Kadyan reverse-engineered a Grammarly API and made a Visual Studio Code Grammarly Plugin.
For those with a Grammarly subscription this plugin may be useful for:
- documenting code
- Markdown Readmes
- Markdown-based blogs
Simulations with spatial grids in 3D can be visualized via scatter plots. The grid may have irregular spacing such that each of the x, y, z dimensions is itself a 3-dimensional array. This can be visualized in Matlab or Python by reshaping the 3D arrays to a vector in the plotting command.
Scatter plots are one way to visualize 3D data in Matlab.
scatter3(x(:), y(:), z(:))
from matplotlib.pyplot import figure ax = figure().gca() ax.scatter(x.ravel(), y.ravel(), z.ravel())
We use the free Poppler tools instead of using Acrobat, despite a work/school license. Extracting one or more pages from a PDF file can be done with paid Adobe Acrobat. The free Adobe Reader or FoxIt Reader cannot extract pages. Adobe Acrobat is a large and cumbersome program that installs startup daemons that are not trivially disabled.
To extract pages 2 to 3 from
in.pdf using Poppler:
pdfseparate -f 2 -l 3 in.pdf out.pdf
Note: you must leave a space after
-l as shown.
If you can’t get Poppler, GhostScript can also extract pages from PDF, but it’s a more complicated command:
gs -sDEVICE=pdfwrite -dFirstPage=2 -dLastPage=3 -dNOPAUSE -dSAFER -dBATCH -sOutputFile=out.pdf in.pdf
apt install poppler-utils
brew install poppler
- Windows: use
Windows Subsystem for Linux
Battery time remaining estimates for computing devices can vary widely in accuracy. The estimates are based on assumptions about future behavior based on prior usage trends, from a mix of current and prior charge usage. Windows updates can disable battery time remaining, and some devices (including Microsoft Surface) may come from the factory with battery time estimates disabled. Even though the battery time remaining estimates on Windows have limited accuracy, I prefer to have the estimate shown.
The usual precautions on modifying the Windows Registry apply–do a Windows System Recovery milestone first. These keys are under:
These settings “worked for me” across multiple models of Microsoft Surface devices and other laptops. Reboot after making these changes.
Set to 0 if present
If these registry keys exist, set their value to 0. If they don’t exist, that’s fine too.
Create / set to 1
Create this DWORD32 value (if not existing) and set to
GitHub CodeQL semantically analyzes Python code for security issues. Also, CVE Lists are checked vs. your GitHub repo’s dependency graph. CodeQL can install the Python package for more fidelity.
This approach finally fixes the concerns we had with the previous implementation that simply did CVE scans versus dependency graphs. The prior method of extracting dependencies did not work for modern Python packages. The new CodeQL method is much more robust and useful.
While HDF5 offers support for symbolic links (hard, soft and external), NetCDF4 does NOT support symbolic links.
Fortran and C
call h%softlink(target, link)
The Python h5py interface is a popular and robust means to access HDF5 files from Python. h5py.SoftLink allows creating soft links.
The Solaar program manages connections with Logitech Unifying receiver on Linux, including pairing/unpairing. This means wireless keyboards and mice, including wireless trackballs work well on Linux. Logitech wireless firmware updates are provided seamlessly in Linux. The Unifying receiver “just works” on Linux upon plugging in, with trackballs being recognized as an HID device.
Solaar is strictly a GUI program, so you will need a display or VNC graphical desktop to perform operations like
- configuring buttons
- monitoring battery level
- checking firmware version of Unifying receiver and connected devices
Logitech Unifying receivers can be paired with multiple devices. This allows one to carry a laptop from home to office without dragging the wireless keyboard or mouse along.
The 0-based indexing of Python and Numpy versus the 1-based indexing of Matlab is perhaps the most obvious difference when working between the languages. Other, more subtle defaults come into play and may not be immediately caught within functions except by manual checks.
In atmospheric science among other fields, cumulative integration implemented as cumulative trapezoidal numerical integration is a common function named “cumtrapz”.
Distinctive behavior between Matlab
might not be immediately caught inside a function, although it’s obvious when manually checking.
Specifically, SciPy cumtrapz needs the
initial=0 argument to match Matlab.
Let’s show this by example:
In both languages, suppose
x = [-2.5, 5, 10]
Matlab (or GNU Octave) outputs:
y = cumtrapz(x) [0, 1.25, 8.75]
Here comes the wrinkle–SciPy cumtrapz output one element less than the input by default:
scipy.integrate.cumtrapz(x) [1.25, 8.75]
To match Matlab output from SciPy, add the
scipy.integrate.cumtrapz(x, initial=0) [0, 1.25, 8.75]
We strongly recommend using CMake to build HDF5 rather than autotools.
For those building HDF5 on Windows, CMake is required.
There is a slight quirk with current (HDF5 1.10.7, 1.12.0) HDF5 CMake scripts in that the “new”
cmake -B build flags don’t work properly–the CMake build will fail partway through with weird platform-dependent errors.
HDF Group is working to improve CMake and has merged pull requests from us with CMake improvements for HDF5.
These CMake options build HDF5 for Fortran as fast as possible by omitting optional items. If these seems too complicated, try our one-step Python build HDF5 script.
mkdir build cd build cmake -S /path/to/hdf5_source -DCMAKE_INSTALL_PREFIX=~/.local/hdf5 -DHDF5_GENERATE_HEADERS:BOOL=false -DHDF5_DISABLE_COMPILER_WARNINGS:BOOL=true -DBUILD_SHARED_LIBS:BOOL=false -DCMAKE_BUILD_TYPE=Release -DHDF5_BUILD_FORTRAN:BOOL=true -DHDF5_BUILD_CPP_LIB:BOOL=false -DHDF5_BUILD_TOOLS:BOOL=false -DBUILD_TESTING:BOOL=false -DHDF5_BUILD_EXAMPLES:BOOL=false
This creates static and dynamic HDF5 libraries under the user install prefix–we don’t show the library suffixes for simplicity. Note: the *stub files may not be present.
hdf5/lib/libhdf5 hdf5/lib/libhdf5_fortran hdf5/lib/libhdf5_hl hdf5/lib/libhdf5_hl_fortran hdf5/lib/libhdf5hl_fortran hdf5/lib/libhdf5_hl_f90cstub hdf5/lib/libhdf5_f90cstub
The Fortran .mod files that need to be included are under
Tell CMake to use this HDF5 from your project by:
cmake -B build -DHDF5_ROOT=~/.local/hdf5 cmake --build build