29 Jun 2020

Mapas para tu GPS / Maps for your GPS

  

Procedimiento para instalar mapas .gmapi (MacOS)

He conseguido instalar mapapi siguiendo este procedimiento:

  1. Obtener el archivo de mapa .gmapi
  2. Entrar en el contenido con el menú contextual "Show Content"
  3. Copiar el archivo .gmap (sin la "i")
  4. Instalar el archivo .gmap (Por ejemplo con la aplicación Garmin "Map Manager v3.1.3")

Procedure for .gmapi maps (MacOS)

I was able to install *.gmapi maps following this procedure:

  1. Get the map archive file *.gmapi
  2. Enter in the content with "Show Content" contextual menu
  3. Copy the .gmap (without  the "i") archive
  4. Install the map archive *.gmap (For example with Garmin "Map Manager v3.1.3" application)

24 Jun 2020

21 Jun 2020

Ecuación diferencial del Oscilador Armónico con "Grapher"

En este documento se resume las matemáticas que hay detras de estos fenómenos oscilatorios. Y mediante la utilidad "Grapher" instalada en equipos MacOS vamos a representar la solución de la ecuación diferencial que no es otra que una oscilación (frecuencia, longitud de onda, Amplitud).

Ejemplos de Osciladores armónicosdon son: Las Ondas de radiofrecuencia y un Muelle perfecto sin rozamiento.

SWR, Coef. de reflexión, parámetros S



ZL es la impedancia de la carga y Z0 la de la línea de transmisión. Las impudencias son magnitudes complejas (resistencia y reactancia) por lo tanto el coeficiente de reflexión también.

17 Jun 2020

sark-100-antenna-analyzer Application

Summary: Software based on Python for the MINI60s (clone of sark100) antenna analyzer device, compatible with MacOS. Resumen: Software basado en language Python para el dispositivo MINI60s (clon del sark100), compatible con el sistema operativo MacOS.
       
  

Instalación... Con workaround incluido

Es posible instalar la aplicación en un portátil con MacOS Mojave siguiendo los pasos siguientes. Hay que hacerlo con cuidado, ya que es necesario realizar una pequeña modificación en el código fuente cpp de la aplicación !: 
git clone https://github.com/jedi98/sark-100-antenna-analyzer
cd sark-100-antenna-analyzer
brew install Qt
echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> $HOME/.bash_profile
qmake -spec macx-g++ -o Makefile analyzer.pro

# A mi me ha salido un error al ejecutar el comando "make". He podido solucionarlo editando el código fuente de la aplicación. Es una pequeña modificación, que consistió en editar el archivo "seriallink.cpp" y sustituir "std::setlocale" por "setlocale"
make
open analyzer.app

# Una vez comprobado que la aplicación funciona puedes moverla a la ruta que quieras. Por ejemplo a $HOME/bbin/sark-100-antenna-analyzer. mv sark-100-antenna-analyzer $HOME/bin/

# De esa manera, para lanzarla solamente tendrás que ejecurar lo siguiente open $HOME/bin/sark-100-antenna-analyzer/analyzer.app

Conectar el MINI60S via USB o Bluetooth

  1. Enciende el MINI60s mediante su interruptor
  2. Conectalo al portátil via cable USB
  3. En el dispositibo presiona los botones: SET > "PC Link" > DOWN > "Waiting Link" (Para bluetooth utilizar "1234" como clave)
  4. Abre la aplicación
  5. En la aplicación vete al Menu > Link > Device > Select your device (tty.usbserial-00000000)
  6. Ahora ya podrás utilizar el dispositivo a través de la aplicación. Por ejemplo para escanear el valor de SWR en un rango de frecuencias o una banda concreta.

Manual del Mini60 Antenna Analyzer (sark100)

Puede que necesites echar un ojo al manual del dispositivo analizador de antenas. Por ejemplo para ver como usar la funcionaidad "PC Link" y poder conectarlo por USB.
 

Software Install including a little workaround

I was able to install the software in MacOS Mojave following this steps. Take care as they involve a small modification in the cpp source code !: 

git clone https://github.com/jedi98/sark-100-antenna-analyzer
cd sark-100-antenna-analyzer
brew install Qt
echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> $HOME/.bash_profile
qmake -spec macx-g++ -o Makefile analyzer.pro

# I got an error when trying the "make" command. I was able to overcome it by editing the source code. The little modification required in my environment was to open source code file "seriallink.cpp" and substitute "std::setlocale" by "setlocale"
make
open analyzer.app

# After check that application runs you can now copy the folder with the application to your desired path. For example $HOME/bbin/sark-100-antenna-analyzer. mv sark-100-antenna-analyzer $HOME/bin/

# So you will launch the app in this case as open $HOME/bin/sark-100-antenna-analyzer/analyzer.app

Connecting the MINI60S via USB o Bluetooth

  1. Switch on the MINI60s
  2. Connect it via USB cable
  3. On the Device press these buttons: SET > "PC Link" > DOWN > "Waiting Link" (For bluetooth use "1234" as key)
  4. Open the application
  5. On the Application go to Menu > Link > Device > Select your device (tty.usbserial-00000000)
  6. Now yo can scan a range of frequencies or a specific band for example.

Mini60 Antenna Analyzer Manual (sark100)

You may need to take a look to the manual in case for example to use the "PC Link" feature.
 

15 Jun 2020

WSJT application on MacOS (sysctl.conf workaround)

Software download and install (MacOSX details)



WSJT-X makes use of a block of memory which is shared between different parts of the code.  The normal allocation of shared memory on a Mac is insufficient and this has to be increased.   So you will need to modify your sysctl.conf file.
When you downloaded wsjtx it includes a ReadMe.txt file and sysctl.conf file. Please, read the instructions in the "readme". Basically these are the steps at the moment I wrote this article:

  1. Copy sysctl.conf  to your desktop.
  2. Open sysctl.conf with a text editor.
  3. shmmax determines the amount of shared memory that must be allocated for WSJT-X to operate.  This is 14680064 (14MB) and should not be changed.
  4. It is possible to run more than one instance of WSJT-X simultaneously.  The parameter that controls this is shmall=17920 . The max. number of instances is (shmall x 4096/14680064)=5.
  5. If 5 is not good for you, then you must edit the file according to this calculation.
  6. Once sysctl.conf  is ready:
    1.   sudo cp "$HOME/Desktop/sysctl.conf" /etc/
    2.   sudo chmod 664 /etc/sysctl.conf
    3.   sudo chown  root:wheel  /etc/sysctl.conf
  7. Reboot your Mac
  8. Check changes has been made correctly:
    1. sysctl -a | grep sysv.shm
  9. Drag the WSJT-X app to your preferred location, such as Applications.
  10. Configure sound card:
    1. Visit Applications > Utilities > Audio MIDI Setup and select your sound card and then set Format to be "48000Hz 2ch-16bit" for input and output.
    2. double-click on the WSJT-X app
    3. IMPORTANT: If you are using macOS 10.14 (Mojave) it is important to note that the default setting for audio input is "block".  In order to receive audio from WSJT-X you must visit System Preferences > Security & Privacy > Privacy and, with WSJT-X launched, select "Microphone"under Location Services and wsjtx should appear in the panel.   Check the "Allow" box.  You will have to quit WSJT-X for this change to take effect.
    4. Visit the Audio panel and select the Audio Codec you use to communicate between WSJT-X and your rig
WSJT Home page: https://physics.princeton.edu/pulsar/K1JT/wsjtx.html



11 Jun 2020

Keyboard Map for special ALT characters / Mapa de caracteres especiales ALT del teclado

Summary: A way to access specials ALT characters on a MacOS keyboard. Resumen: Un truco para acceder a los caracteres especiales ALT desde un teclado Mac.
Mac keyboard special characters


En la imagen anterior tenemos un mapa con la posición de los caracteres especiales de un teclado. Para acceder a ellos, mantendremos pulsadas la tecla "ALT" o bien "ALT+SHIFT"

In the previous image we have a map with the position of the special characters of a keyboard. To access them, we will hold down the "ALT" or "ALT+SHIFT" keys.

10 Jun 2020

Qucs Universal Circuit simulator (Windows, Linux, MacOS)

  

QUCS schematic circuit

Introduction

Qucs is free software (GPL licensed). It consists of several standalone programs interacting with each other through the GUI: the GUI, the simulator backend, a text editor, a filter synthesis application, a transmision line calculator, a component library, an attenuator synthesis application, a command line conversion program. Additionally for digital simulations (via VHDL) the program FreeHDL (see http://www.freehdl.seul.org) is used. And for circuit optimizations ASCO (see http://asco.sourceforge.net) is configured and run.

Install

It can be downloaded from http://qucs.sourceforge.net. You will find the complete source code and installable versions for several operating systems. It is available for a variety of operating systems including:

  • GNU/Linux
  • Windows
  • FreeBSD
  • MacOS
  • NetBSD
  • Solaris

Documentacion and tutorials

You can find documentacion, samples and tutorials in the Website.

Example schematics

Check schematics examples.

The folder with schematics samples in MacOS is /usr/local/share/qucs

Introducción

Qucs es software libre (licencia GPL). Consiste en varios programas independientes que interactúan entre sí a través de la GUI: la propia GUI, el backend simulador, un editor de texto, una aplicación de síntesis de filtros, calculadora de líneas de transmisión, una biblioteca de componentes, una aplicación de síntesis de atenuadores, un programa de conversión de línea de comando. Además, para simulaciones digitales (a través de VHDL) se utiliza el programa FreeHDL (http://www.freehdl.seul.org). Y para optimizaciones de circuitos, ASCO (ver http://asco.sourceforge.net).

Instalación

Se puede descargar desde http://qucs.sourceforge.net. Encontrarás además el código fuente completo. Hay versiones disponibles para distintos sistemas operativos, inluyendo:

  • GNU/Linux
  • Windows
  • FreeBSD
  • MacOS
  • NetBSD
  • Solaris

Documentación y tutoriales

Puedes encontrar documentación, ejemplos y tutoriales en su Website.

Esquemas de ejemplo

Dispones de esquemas de ejemplo.

La carpeta local donde se instalan los ejemplos en MacOS por ejemplo es /usr/local/share/qucs

9 Jun 2020

Matrix and Math ... with Latex

With MathJax we can use Latex language to introduce math expressions, equations in our webpages.
Sample:
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
Type LaTeX markup Renders as
Plain \begin{matrix}
1 & 2 & 3\\
a & b &c
\end{matrix}
\begin{matrix}1 & 2 & 3\\a & b & c\end{matrix}
Parentheses
round brackets
\begin{pmatrix}
1 & 2 & 3\\
a & b & c
\end{pmatrix}
\begin{pmatrix}
1 & 2 & 3\\
a & b & c
\end{pmatrix}
Brackets
square brackets
\begin{bmatrix}
1 & 2 & 3\\
a & b & c
\end{bmatrix}
\begin{bmatrix}1 & 2 & 3\\a & b & c\end{bmatrix}
Braces
curly brackets
\begin{Bmatrix}
1 & 2 & 3\\
a & b & c
\end{Bmatrix}
\begin{Bmatrix}1 & 2 & 3\\a & b & c\end{Bmatrix}
Pipes \begin{vmatrix}
1 & 2 & 3\\
a & b & c
\end{vmatrix}
\begin{vmatrix}1 & 2 & 3\\a & b & c\end{vmatrix}
Double pipes \begin{Vmatrix}
1 & 2 & 3\\
a & b & c
\end{Vmatrix}
\begin{Vmatrix}1 & 2 & 3\\a & b & c\end{Vmatrix}

8 Jun 2020

Shell Scripting Mini-Course !

Documentation and References

There is a lot of documentation there about shell scripting language. For example one of the most common is Bash. You can find the manual in several formats (html, pdf, asci...) here:
From the console and offline yo can also get documentation:
man bash
info bash
Info has some hyperlinks. You don’t use the mouse ut the keys for navigate throng them.

Considerations on your script file

  • Start your file with first line as:
#!/usr/bin/env bash
or typically
#!/bin/bash
  • Make your script executable if you need to: sh chmod u+x filename.sh . You then can execute your file as ./filename.sh If you don’t make it executable you still can execute it as bash filename.sh
  • Normally we use extension *.sh when naming a bash script

Variables, the two areas

We have two areas to keep variables:
  • Enviroment (exported variables) export variable=“variable value”
  • Process variables that live in the current process

Typeset

Functions share variables, they don’t get a copy, so if you modify a variable in a function {} it is modified globally. If you need to create a variable in a function that will not ve abailable outside you can declare it with do it with typeset. Also is good to know that arithmetic is much faster for variables defined as integers.
typeset x —> We use this inside a function to make a variable private to the function 
typeset -i x —> Integer

Declare

Check your Bash version as if you have Bash v3 some declare command may not be supported
declare -l lstring=“aBCDfe” # —> string, uppercase will be converted to lowercase
declare -u ustring=“aBCDfe” # —> uppercase string
declare -r readonly=“Readonly value” # —> Readonly
declare -a MyArray # —> Indexed array 
declare -A MyAssocArray # —> Associative Array (dictionary)
In case you need to upgrade your Bash :

Atirthmetics

typeset -i x x=1; let x++; let x=2*x; let y=x**3

Parentesis ()

When you use parenthesis a new process is created for those command inside. This process go away you closes “()” Example:
a=100
(
a=90; echo $a
)
Echo $a

Curly Braces {}

We use braces to group things. We can use braces like this:
abc=Hello
echo {$abc}DEF # {Hello}DEF
echo ${abc}DEF # HelloDEF
Indirection:
x=abc
abd=def
echo ${!x} # it will print "def"
Unset or Null Variables:
${variable  value}
Example:
x=${var:-Default}
:- # If var unset/null , return value; otherwise, return var value
:= # If var unset/null , var is assigned value & returned
:? # Display an error and exit script if var unset/null
:+ if var unset/null return nothing; otherwise, return value
String Operations:
${var:offset} # value of var starting at offset
${var:offset:len} # value of var starting at offset up to length len
${#var} # length of var
Prefix/Postfix are usefull for processing filenames, paths:
${var#pre} # remove matching prefix
${var%post} # remove sufix

Bash Builtins

You can check what it is enabled in your Bash just typing enable For example one very useful built-in for real time is: time

Startup settings and files

.bash_profile Is a file read when Bash is invoked as a login shell We put here typically environment variables in it:
PATH=$PATH:/usr/local/bin
export PATH
You can check your profile this way:
cat $HOME/.bash_profile
.bashrc Is executed when a new shell is started We normally put here aliases (as they are not exported).

Aliases samples

Aliases is how we rename things of make command shortcuts. You can get a list of all aliases by just “alias”. A typicall use could be:
alias ls=“ls —color”
alias ll=“ls -l”
alias lr=“ls -ltr”
alias copy=cp
alias myserver='ssh -p 22 username@192.168.1.204' # My cloud server
You also can unalias, for example: sh unalias ls 

Sourcing scripts

source environment.sh This way we get the Shell executed the script in the shell’s own process instead of in a new process (as it would be when just runnig ./enviroment.sh)

Echo Command

-n —> don’t print a trailing newline
-e —> enable backslash escaped chars like \n and \t
-E —> disable backslash escaped chars in case they where enabled by default
echo 'Warning Message!' >&2 # (output to stderr)

Read command

read a b —> Read first word into a and rest into b
read a b c —> Read first word into a, second into b and the rest into c

While Loops

while
    read a b
do
     echo a is $a and b is $b  
done <data_file
ls -l | while
read a b c d e f g h i
do echo owner of file $i is $c
done

For Loops

The structure is:
for  in 
do
commands
done
For example:
for i in {1..10}
do
echo $i
done

for i in {a..z}
do
echo $i
done

for f in $(find . -name *.c)

for f in $(find . -iname *4.1*)

Bash Functions

function myfunction {
    echo "Hello !"
    return
}
You can asign the result of a function to a variable:
myvar=$(myfunction)
Also you can export a function to be available for other shells
export -f myfunction

Exit

exit sets the exit status of the whole shell program (not just a function) is is represented by $? so after script execution you can read the exit with:
sh status with echo $? 

Redirection and Pipes

Normally processes have three files open:
0 --> stdin, 1 --> stdout, 2--> stderr
We use them like this:
command > stdout_file 2> stderr_file < stdin_file

command &> stdout_and_stderr_file (file is created or overwritten with stdout and stderr)
command &>> (appends stdout and stderr)

command1 | command2 (command2 stdin comes from command1 stdout)

command1 2>&1 | command2 (gets stdout and stderr from command1)

Here Documents: <<

sort <<END
car
airplane
skate
bike
END

Open and Close File Descriptors

We use lsof -p PID to see what file descriptors for a process are open,
# $$ is shell's PID
lsof -p $$ 

# Opens file descriptor 5 for reading from file "myfile"
exec 5< myfile

# Opens file descriptor 5 for writing to file "myfile"
exec 5> myfile

Case statement

case expression in
pattern 1 )
    commands;;
pattern 2 )
    commands;;
esac
Sample:
case $answer in
yes|YES|y|Y )
    echo "Yes";;
n*|N* )
    echo "No";;
esac

If-Then-Else Statement

if 
    comands # last result is used
then
   commands
else
    commands
fi
Samples:
if 
    grep -q error myfile
then
   echo myfile has Errors
else
    echo myfile has not Errors
fi

if [[ -f myfile ]]; then echo "file exists"; fi

if test -f myfile; then echo "file exists"; fi

if [[ $x -gt 5 ]]; then echo "It is greater"; fi
Test Operators
[[ expr1 -eq expr2 ]]
[[ expr1 -ne expr2 ]]

[[ expr1 -lt expr2 ]]
[[ expr1 -gt expr2 ]]

[[ expr1 -le expr2 ]]
[[ expr1 -ge expr2 ]]

((expr1 == expr2))
((expr1 != expr2))

((expr1 < expr2))
((expr1 > expr2))

((expr1 <= expr2))
((expr1 >= expr2))

((expr1 && expr2))
((expr1 || expr2))

# Success if X is a directory
test -d X

# Success if X is a regular file
test -f X

# Success if X exists and not empty
test -s X

# Success you hace x permision on X
test -x X

# Success you hace w permision on X
test -w X

# Success you hace r permision on X
test -r X

Aritmetic operations

Use in (( )) or with let
id++ id-- ++id --id
! ** * / % % + -
<< >> <= >= < >
== != & ^ | && ||
expr?expr:expr
= *= /= %= += -= <<= >>= &= ^= |=
expr1 , expr2
Samples:
((n=2**3 + 5))
((y=n^4))  # (xor)

Filters

In Linux a program is a "filter" that reads from stdin and writes on stdout.
We use filters to combine input and output sequence of commands typically to get a report.
head file.txt # Prints the first lines of file or stdin
tail file.txt # Prints the last lines of file or stdin

cat myfile | head -10 # First 10 lines of myfile
cat myfile | tail -10 # Last 10 lines of myfile

cat myfile | head -10 | tail -5 # Lines 6-10 of myfile
cat myfile | head -5 | tail -3 # Lines 3-5 of myfile

wc # Word counts
wc -l # number of lines

sed Command

sed is a non-interactive stream editor. Works great as a filterand it is ideal for batch editing task applied to all lines in a file. Some examples using it to substitute strings:
date | sed 's/Jun/Junio/; s/Thu/Jueves/'
sed 's/w/White/; s/b/Blue/'
sed -e 's/[xX]/Y/' -e 's/b.*n/blue/'
sed 's/[xX]/Y/; s/Y/Yellow/'
sed '1,5p'
You can put sed instructions in a file and use it as a sed script:
sed -f sedscript myfile.txt # sedscript file contains the substitution

sed '/alpha/s/beta/gamma/' # If the line has alpha then substitute beta for gamma

sed '/apple/,/orange/d' # find a line with apple on it then find a line with orange on it and then delete the sequence on lines from apple to orange

sed '/Error/!s/old/new/' # substitute only if line does not contain Error

cat myfile | sed -n "4,10p" # Take lines 4 to 10 from myfile

The awk language

  • A pattern matching language
  • Works as a filter
  • Good for reporting
  • Processes one line at a time as sed
  • Brakes a line into fields, $1, $2, etc...
  • Fields delimited by values in variable FS, normally white space
  • $0 is the entire line
Samples:
ps -el | \
awk '/pts/||$8~/35/{printf("%5d %5d %s\n", $4, $5, $14)}' --> If line contains pts or field 8 contains 35 then we print some values
Here a awk script samples using END. END is a special key. Indicates that when ending procesing the lines then execute the commands:
sample.awk:
#!/usr/bin/awk -f
{szsum+=$9
rssum+=$8}
END{printf("RSS\tSZ\n%d\t%d\n",rssum,szsum)}
$ ps -l | ./sample.awk
words.awk:
#!/usr/bin/awk -f
{for (i=1;i<NF;i++)
    words[$i]++}
END{printf("is=%d, ls=%d, the=%d\n", words["is"], words["ls"], words["the"])}
$ man ls | col -b | awk -f words.awk

Command line arguments

  • Parameters (positional): $1, $2, $3, ...
  • To reference multidigit we use {}, e.g., ${10}
  • $0 is the path to the program itself echo Usage: $0 arg1 ...
  • Shift moves the positional arguments, $2 into $1, $3 into $2, etc... We use this to loop and process arguments (allways $1) until there are no more arguments
Sample:
#!/usr/bin/env bash
while [[ $# -gt 0 ]]
do
 echo $1
 shift
done

Coprocesses

With this technology we create a script that works as a filter and use it as a background running process we can use with no need to launch it every time.
coproc ./mycoproc.sh # This way we create a coprocess for our script
We can write to ([1]) or read ([0]) from:
echo VALUE >&"${COPROC[1]}
cat <&"${COPROC[0]}
We can also give our process a name:
coproc mycoproc { ./mycoproc.sh; }
echo VALUE >&"${mycoproc[1]}
cat <&"${mycoproc[0]}

More info

Remember to check info and man to get more information and usefull documentation.

Enjoy !