Certain projects with legacy build systems like Make or Autotools or in general may specify to build with flags like “-fPIC” for position independent code (PIC) on Linux systems.
Consider not forcing these flags in CMake projects if there isn’t a specific known need, to let users and consuming projects decide whether they need PIC or not.
When PIC is needed, do like:
Since CMake 3.13 was released in 2018, a more elegant two-step CMake build process is available with the simple syntax
cmake -B ./build
cmake --build ./build
The CMake configure command
with the “-B” option generates the build system files in the specified build directory.
It’s best to build out-of-source in general, so we specify a separate “./build” directory here.
The
cmake –build
build command executes the build tool configured for the project, e.g. Make, Ninja, MSBuild, etc.
The “./” can be omitted, we only include it here for clarity.
We keep seeing even the largest OEMs using the
old-fashioned
three-step process.
Check your projects’ example and docs to update them to the less-confusing and compact two-step CMake build process.
Open data file formats such as HDF5 and NetCDF4 are excellent way to share and store archival data across computing platforms and software languages.
Numerical software such as Matlab, GNU Octave, Python, and many more support these data file formats.
The syntax in the code examples below is the same for Matlab and GNU Octave.
Omit the pkg load and pkg install statements in Matlab.
NetCDF4 files in GNU Octave are accessed via
Octave NetCDF4 package.
Install the package from Octave prompt:
pkg install netcdf
Write an array to a NetCDF4 file “example.nc” dataset “m”:
pkg load netcdffn = 'example.nc';nccreate (fn, 'm', "Dimensions", {"x", 3, "y", 3});% must include dimensions or a scalar dataset will be createdncwrite (fn, 'm', magic (3));
Read the NetCDF4 file “example.nc” to an array:
x = ncread (fn, 'm')
Reference:
oct-hdf5 package: Octave low-level access to HDF5 files.
In CMake projects (or other build systems) it’s more robust to detect compiler features rather than make brittle, difficult to maintain nested if / elseif logic trees based on compiler vendor and version.
There are edge cases where if() statements to work around known compiler bugs are necessary, but where we can, we use compiler feature checks instead.
Each compiler vendor such as
AppleClang,
GNU
GCC,
LLVM Clang,
typically publishes
tables
of compiler features vs. language standard support in their documentation.
These tables might not cover every aspect of feature support, or the project invocation of that support may trigger bugs in specific compiler versions.
Then, either hard-coded build system logic or preferably configure-time feature detection is needed.
An
example
using
check_source_compiles
in a CMake project requires C11 variable length arrays.
The CMakeLists.txt would look like:
include(CheckSourceCompiles)set(CMAKE_C_STANDARD11)set(CMAKE_C_STANDARD_REQUIREDON)# so that check_source_compiles sets the correct language standard
set(CMAKE_TRY_COMPILE_TARGET_TYPESTATIC_LIBRARY)# save link time, only compile is needed
check_source_compiles(C"int main(void){
for (int i = 1; i < 5; i++){
int a[i];
}
return 0;
}"c11vla)if(NOTc11vla)# fatal error or disable feature using C11 VLA
endif()add_executable(c11demodemo.c)
project('c11vla_demo','c',default_options:['c_std=c11'])c11_vla=meson.get_compiler('c').compiles(required:true,name:'c11_vla','int main(void){ for (int i = 1; i < 5; i++){ int a[i]; } return 0; }')
12.5 kHz channel spacing is
permitted
in certain cases by the FCC in VHF marine radio.
Despite
experiments
demonstrating the practicality of using 12.5 kHz channel spacing on VHF marine radio, currently available radios and practice appear to remain at +/- 5 kHz deviation and 25 kHz channel spacing.
Unlike the vocal
controversy around 1969 over marine VHF narrowbanding
from +/- 15 kHz deviation to +/- 5 kHz deviation, there appears to be little controversy over going to 12.5 kHz marine VHF channel spacing.
Assuming there isn’t adjacent channel interference, the communications range penalty from narrowbanding 5 kHz FM deviation systems to 2.5 kHz FM deviation can be represented to first order as 20*log10(2.5/5) + 20*log10(16/11) ~ -3.3 dB, which is measurable but not necessarily devastating for a system that already has adequate coverage.
This comes from the disadvantage of reduced FM modulation index (2.5 / 5) and the advantage of narrower IF receiver filter (11 kHz vs. 16 kHz typical).
The true significance must be measured and modeled for the particular communications systems.
Keep in mind the reduced ability to withstand co-channel interference due to the reduced FM capture effect, which can be expressed in dB as the cube 10*log10((5/2.5)**3) (9 dB C/N reduction in resilience to co-channel interfering FM signals).
Unlike in commercial PMR / LMR / SMR systems where digital modulation gains of 3-4 dB can be achieved by say APCO25, DMR, NXDN or similar, VHF marine radio like airband VHF needs to keep compatible analog modulation schemes indefinitely due to the large number of casual spectrum users that still need life-critical communications access.
Fortran
array temporaries
can be implicitly created when
non-contiguous
array slices are passed to procedures.
This copy of data can impact performance.
Older compilers like GCC 8.x (including Gfortran 8.5), which may be the only installed choice on some HPC systems, have occasional bugs related to array temporaries that can lead to incorrect results or crashes.
Compilers older than GCC 9 are not supported by
Fortran-stdlib
among other prominent Fortran libraries.
It is possible that disabling optimization can change the bug behavior, but this can make the program run vastly slower and it’s just for debugging.
Use
git bisect
or similar techniques to find the commit that introduced the bug.
If the bug is introduced by a new / changed function call using an actual array argument that indexes into a non-contiguous array, that is a hint that the problem may be related to array temporaries.
Enable compiler flags to help identify array temporaries in GFortran:
Here, A(:, 4:16:3) creates a non-contiguous array slice, leading to the creation of an array temporary when passed to myfun.
Manually allocate an contiguous auxiliary array variable and copy the data into it before passing it to the function:
real,allocatable::temp(:,:)allocate(temp(size(A,1),5))! Adjust size as needed
temp=A(:,4:16:3)! Copy data into contiguous array
x=myfun(temp)! Pass the contiguous array
deallocate(temp)!Cleanup
Obviously this process is tedious, so we only employ it when needed to workaround a compiler bug.
Many programming languages (including LaTeX) have directives or pragma–formatted comments that tells the compiler to do something specific.
LaTeX pragma: de factodirectives
are
compatible
with popular LaTeX editors including TeXstudio.
Specify LaTeX compiler and bibliography toolat the top of the main/root LaTeX document like:
% !TeX program = xelatex
% !BIB program = biber
LaTeX projects often use Biber for bibliography management.
The above directives tell TeXstudio to use XeLaTeX compiler and Biber bibliography tool when compiling the document.
Find the MAC address of a Bluetooth device in Windows from Windows Device Manager under Bluetooth, (select device in list), Properties, Details, Bluetooth Device Address.
List all Bluetooth devices and their MAC addresses from PowerShell:
The standard
git bisect
command helps quickly identify a specific commit that introduced a bug in a Git repository.
In projects where branches with lots of commits were previously merged, there may be known-bad commits with build failure unrelated to the current bisect search.
It’s possible to
skip
such commits during the bisect process, or
avoid
specific commits altogether.
For projects using Git submodules it’s useful to set option
submodules.recursetrue
git config --global submodule.recurse true
that works for most Git commands and avoids the need during “git bisect” to also have to “git submodule update –init –recursive” at each step of the bisect process.
git bisect start
# if you already know this current commit is good or bad, tell Git about itgit bisect <good|bad> <commit>
# test the current commit by running your test code / program / scriptgit bisect run <test command>
# ... repeat the above two steps until Git finds the first bad commit# finish the bisect process and return to the original branchgit bisect reset
Certain Cobra CB radios starting in the late 1990s including the Cobra 75 WX ST have a
compandor
circuit known as “SoundTracker” to reduce noise.
The IC used for the SoundTracker included the TA31101AF, which is a generic audio compandor IC used in various radio communication devices.
Compandoring compresses the dynamic range of an audio signal before transmission and expands it back to its original range upon reception, typically with a frequency vs. amplitude response curve tuned for the communication mode of the radio (say FM cordless phone vs. AM CB radio).
Compandoring helps improve apparent audio SNR, but it can introduce artifacts, especially when only one side uses companding.
Field experience indicates that SoundTracker can improve intelligibility for weak to moderate signals, including with non-SoundTracker radios, while adding a “huffy” character to recovered audio in some cases.
Reported improvement can be up to about 20 dB when both sides enable SoundTracker, and up to about 10 dB when only one side enables it; artifacts are usually more noticeable in one-sided use.
The digital noise reduction (DNR) circuit in the modern Cobra 75 All Road is generally superior to SoundTracker and avoids those specific compandor artifacts.
For the 2000s-era
Cobra 75 WX ST,
transmit modulation is high-level (yielding better sound quality and punchiness vs. low-level modulation of less expensive radios) and the radio includes an automatic noise limiter (ANL).
Internal adjustments in the Cobra 75 WX ST allow optimizing transmit carrier power, modulation limiting, and other parameters.
After two decades, the cord covering may crack and fall off, revealing the wires and antenna coax inside.
In contrast to the modern Cobra 75 All Road, the 75 WX ST has all the RF hardware in the microphone, with the small gray box being an interface to the antenna, power, and speaker jack.
The 75 WX ST is a good spare radio, but if purchasing a radio, consider instead a modern radio with DNR instead of SoundTracker, as the DNR is superior to the compandor.