New episodes every weekday Monday through Friday. This page was generated by The HPR Robot at
Welcome to HPR, the Community Podcast
We started producing shows as Today with a Techie on 2005-09-19, 19 years, 1 months, 3 days ago. Our shows are produced by listeners like you and can be on any topics that "are of interest to hackers". If you listen to HPR then please consider contributing one show a year. If you record your show now it could be released in 6 days.
Call for shows
We are running very low on shows at the moment. Have a look at the hosts page and if you don't see "2024-??-??" next to your name, or if your name is not listed, you might consider sending us in something.
Shows me attaching the leg of a resistor to the new backup battery. This
is to extend the battery terminal length so that it can be soldered
between the two connecting battery posts of the radio Printed Circuit
Board.
Picture 2
Shows the newly fitted PLL backup battery with it’s extended terminal
fitted directly below the EPROM labelled JAF7.
Picture 3
Shows the speaker sitting within a metal box. This box sits on top of
the screened metal box housing the PLL backup battery. When I was
refitting the speaker box I discovered there were extra badly soldered
grey wires attached to the speaker terminals. The other end of the wires
was covered with black electrical insulating tape. I removed these extra
grey wires from the speaker to prevent them from coming adrift and or
causing a short circuit within the radio.
I mention the trick of using blue-tak to hold a difficult screw when
inserting it into a tight recess. Wikipedia article about
Blu Tack
Create your image with your preferred disk image creation tool. I
used USB Image Tool to create an image from my "golden master" Windows
11 installation thumb drive A. USB Image Tool: https://www.alexpage.de/usb-image-tool
Prepare
your Tmux session on your Linux or BSD-based system.
'tmux new -s $sessionName' to create a new Tmux session
window with a session name of your choice.
'Ctrl-B-"' to create a horizontal split, putting one
pane over the other.
'Ctrl-B-%' to create a vertical split, putting one pane
next to the other.
'Ctrl-B-UpArrow' or 'Ctrl-B-DownArrow' to
move to the pane you want to split if you split the window with a
horizontal line.
'Ctrl-B-LeftArrow' or 'Ctrl-B-RightArrow'
to move to the pane you want to split if you split the window with a
vertical line.
Duplicate
4 USB thumb drives from a disk image within your new, split-paned Tmux
session:
CHECK DMESG FOR THE CORRECT DEVICE NAME AND WRITE IT
DOWN!!!
FreeBSD will show dmesg output on TTYv0, or you can use the dmesg
command on Linux or BSD. You don't want to end up wiping your system
drive!
Within your Tmux session:
Pane 1:
'dd if=$diskImageName of=/dev/da0 bs=1M status=progress' to
begin imaging USB thumb drive #1.
Pane 2:
'dd if=$diskImageName of=/dev/da1 bs=1M status=progress' to
begin imaging USB thumb drive #2.
Pane 3:
'dd if=$diskImageName of=/dev/da2 bs=1M status=progress' to
begin imaging USB thumb drive #3.
Pane 4:
'dd if=$diskImageName of=/dev/da3 bs=1M status=progress' to
begin imaging USB thumb drive #4.
'Ctrl-B-:' to call the Tmux command prompt, followed by
'setw synchronize-panes' to sync the 4 panes to your
commands. The primary pane will be highlighted in red, and the secondary
panes will copy whatever command it typed into that primary pane.
Hit Enter to begin the process on all 4 panes.
When the image finishes, you can remove the USB thumbs drives, pop
in 4 more, hit the Up arrow on the primary pane to pull up the previous
commands on their respective panes, and hit Enter. When in doubt, refer
to Step 0!!
Repeat as needed.
If you need to de-synchronize your Tmux panes, just type
'Ctrl-:' to call the Tmux command prompt, followed by
'setw synchronize-panes' to toggle pane synchronization on
and off (or you can use the up arrow at the Tmux command prompt to bring
up that previously-typed command).
The faster your USB ports and USB thumb drives, the better!
Lee talks to Matthew about the link between neurodiversity and using
systems in ways they were not designed for.
A short biography:
Matthew Bellringer is a neurodiversity and innovation specialist who
specialises in supporting work that addresses problems from a unique
perspective, co-production, and regenerative working practices. More
details on Matthew's
website.
Matthew is also Chair and Co-founder of NeurodiverseIT, a group for
neurodivergent IT professionals within BCS, the Chartered Institute of IT and
the organiser and founder of Curious
Being, a community for unconventional people who want to make the
world a better place. Matthew is a late-discovery autistic ADHDer.
In this episode we will continue looking at basic filters. Then we
will start looking at the feature that makes jq very
powerful, the ability to transform JSON from one form to another. In
essence we can read and parse JSON and then construct an alternative
form.
More basic filters
Array/String Slice:
.[<number>:<number>]
This filter allows parts of JSON arrays or strings to be
extracted.
The first number is the index of the elements of the array or string,
starting from zero. The second number is an ending index, but it means
"up to but not including". If the first index is omitted it refers to
the start of the string or array. If the second index is blank it refers
to the end of the string or array.
This example shows using an array and extracting part of it:
Here we use the seq command to generate the numbers 1-10
separated by commas in a JSON array. Feeding this to jq on
its standard input with the slice request '.[3:6]' results
in a sub-array from element 3 (containing value 4), up to but not
including element 6 (containing 7). Note that using the
'-c' option generates compact output, as we discussed in
the last episode.
For a string, the idea is similar, as in:
$ echo '"Hacker Public Radio"' | jq '.[7:10]'
"Pub"
Notice that we provide the JSON string quotes inside single quotes
following echo. The filter '.[7:10]' starts
from element 7 (letter "P") up to but not including element 10
(letter "l").
Both of the numbers may be negative, meaning that they are offsets
from the end of the array or string.
So, using '.[-7:-4]' in the array example gives the same
result as '.[3:6]', as do '.[3:-4]' and
'.[-7:6]'. This example uses the x variable
created earlier:
$ for f in '.[-7:-4]' '.[3:6]' '.[3:-4]' '.[-7:6]'; do
> echo "$x" | jq -c "$f"
> done
[4,5,6]
[4,5,6]
[4,5,6]
[4,5,6]
Similarly, using '.[-12:-9]' gives the same result as
'.[7:10]' when used with the string.
$ echo '"Hacker Public Radio"' | jq '.[-12:-9]'
"Pub"
As a point of interest, I wrote a little Bash loop to show the
positive and negative offsets of the characters in the test string -
just to help me visualise them. See the footnote1 for details.
Finally, here is how to get the last character of the example string
using positive and negative offsets:
$ echo '"Hacker Public Radio"' | jq '.[18:]'
"o"
$ echo '"Hacker Public Radio"' | jq '.[-1:]'
"o"
Array/Object Value Iterator:
.[]
This filter generates values from iterating through an array or an
object. It is similar to the .[index] syntax we have
already seen, but it returns all of the array elements:
There are two operators that can be placed between filters to combine
their effects: the comma (',') and the
pipe ('|').
Comma operator
The comma (',') operator allows you to chain together
multiple filters. As we already know, the jq program feeds
the input it receives on standard input or from a file into whatever
filter it is given. So far we have only seen a single filter being
used.
With the comma operator the input to jq is fed to all of
the filters separated by commas in left to right order. The result is a
concatenation of the output of all of these filters.
For example, if we take the output from the HPR stats page which was
mentioned in part 1
of this series of shows, and store it in a file called
stats.json we can view two separate parts of the JSON like
this:
This applies the filter .shows (an object
identifier-index filter, see part 2)
which returns the contents of the object with that name, then it applies
filter .queue which returns the relevant JSON object.
Pipe operator
The pipe ('|') operator combines filters by feeding the
output of the first (left-most) filter of a pair into the second
(right-most) filter of a pair. This is analogous to the way the same
symbol works in the Unix shell.
For example, if we extract the 'shows' object from
stats.json, we can then extract the value of the
total' key' as follows:
$ jq '.shows | .total' stats.json
4756
Interestingly, chaining two object identifier-index filters
gives the same output:
$ jq '.shows.total' stats.json
4756
(Note: to answer the question in the audio, the two filters shown can
also be written as '.shows .total'with intervening
spaces.)
We will see the pipe operator being used in many instances in
upcoming episodes.
Parentheses
It is possible to use parentheses in filter expressions in a similar
way to using them in arithmetic, where they group parts together and can
change the normal order of operations. They can be used in other
contexts too. The example is a simple arithmetic one:
Here we are using a file called countries.json obtained
from the GitHub
project listed below. This file is around 39,000 lines long so it is
not being distributed with the show. However, it's quite interesting and
you are encouraged to grab a copy and experiment with it.
I will show ways in which the structure can be examined and reported
with jq in a later show, but for now I will show an example
of extracting data:
The file contains an array of country objects; the one with index 42
is Switzerland.
The name of the country is in an object called "name",
with the common name in a keyed field called "common", thus
the filter .name.common.
In this country object is an object called "capital"
holding an array containing the name (or names) of the capital city (or
cities). The filter .capital.[] obtains and displays the
contents of the array.
Note that we used a comma operator between the
filters.
Finding country data #2
Another search of the countries.json file, this time
looking at the languages spoken. There is an object called
"languages" which contains abbreviated language names as
keys and full names as the values:
PREP TIME
5 minutes
TOTAL TIME
5 minutes
Ingredients
½ cup mayonnaise
½ cup sour cream
3 Tablespoons pickled jalapeno juice (from a jar of pickled jalapenos)
3 Tablespoons pickled jalapenos (diced)
2 teaspoon paprika
2 teaspoons ground cumin
1 teaspoon garlic granules
1 teaspoon onion powder
½ teaspoon salt (or to taste)
½ teaspoon chili powder
Known in the Hacker world as the Ham Radio Guy at FOSDEM,
Kristoff Bonne ON1ARF, and
Ken Fallon
PA7KEN/G5KEN sit down to
discuss
"vergrijzing,
changing attitudes, and increasing participation in the Amateur Radio
Community."
The Artifice Girl is a 2022 science fiction psychological thriller
written and directed by Franklin Ritch, produced by Aaron B. Koontz and
released direct to VOD. It stars Tatum Matthews, Sinda Nichols, David
Girard, Lance Henriksen, and Franklin Ritch. NGO agents discover a
revolutionary Artificial intelligence (AI) computer program that uses a
digital child to catch online predators, it advances far more rapid than
they could have imagined, posing unforeseen challenges for the
relationship between humans and AI.