Ubuntu Linux 20.04: Bonding two network cards using netplan

I bonded two network cards on Ubuntu Linux 20.04. I’ve always liked Ubuntu. I’m not ashamed to admit it.
Don’t forget to issue “sudo netplan apply” after creating the yaml file else it will not take effect

Share Button

Using PowerShell, FFProbe, JSON, and Linux to store video properties in MongoDB.. Problem with periods in Keys

I have a simple script that walks the properties of a PSObject recursively if a property is itself a PSObject. On Windows 10, there are no issues but on Linux the stack is exhausted even though the hard stack size limit is set to unlimited in /etc/security/limits.conf.

After looking at the PSObject (really just an injested JSON object generated by ffprobe of a video file) I was able to determine that I only needed to scan the Tags properties for a period character.

Why do I need to do this? I’m storing the objects in a #MongoDB database and MongoDB doesn’t allow for period characters in the Key Names. Why? It was a design choice by the vendor – why this is I have no idea as it isn’t documented.

The following shows both the problem Key Name (“Key = HTTP://YOUTUBE.COM/STREAMING/OTF/DURATIONS/112015”) and the good simple code snippet to replace the period character with “” in the key.

Of course, if I needed to replace the character in other areas of the PSObject tree, I would either target each part individually (not ideal) or traverse the tree without recursion which is a bit of code.

Share Button

HowTo: view and copy your Kindle ebook highlights and notes

  1. Go to https://read.amazon.com/notebook and log in as yourself
  2. Choose the book you made notes or highlights in
  3. Highlight and copy what you want


Example:  I highlighted parts of Python Tricks: A Buffet of Awesome Python Features: (screenshot of the website followed by a normal cut&paste):

Your Kindle Notes For:

Python Tricks: A Buffet of Awesome Python Features

Dan Bader

Last accessed on Tuesday May 14, 2019

6 Highlight(s) | 0 Note(s)

Yellow highlight | Page: 20

Python’s assert statement is a debugging aid, not a mechanism for handling run-time errors. The goal of using assertions is to let developers find the likely root cause of a bug more quickly. An assertion error should never be raised unless there’s a bug in your program.

Yellow highlight | Page: 22

The biggest caveat with using asserts in Python is that assertions can be globally disabled3 with the -O and -OO command line switches, as well as the PYTHONOPTIMIZE environment variable in CPython.

Yellow highlight | Page: 23

it becomes extremely dangerous to use assert statements as a quick and easy way to validate input data.

Yellow highlight | Page: 25

you should always do a quick smoke test with your unit test cases. Make sure they can actually fail before you move on to writing the next one.

Yellow highlight | Page: 31

So what’s the with statement good for? It helps simplify some common resource management patterns by abstracting their functionality and allowing them to be factored out and reused.

Yellow highlight | Page: 31

Opening files using the with statement is generally recommended because it ensures that open file descriptors are closed automatically after program execution leaves the context of the with statement.


The folks at Marble Jar Channel have a wonderful video of using the highlights & notes with Google Sheets and Evernote.  The same method can be used with Microsoft’s OneNote or whatever you want really:

It wouldn’t take much to automate the process 🙂

Share Button

Youtube: We Believe: The Best Men Can Be | Gillette (Short Film)

By far the best commercial I’ve seen in a very long time. Well done.

Share Button

VIDEO: Dee Snider’s Emotional Stripped Down Version of “We’re Not Gonna Take It”

World Community Grid enables anyone with a computer, smartphone or tablet to donate their unused computing power to advance cutting-edge scientific research on topics related to health, poverty and sustainability. Through the contributions of over 650,000 individuals and 460 organizations, World Community Grid has supported 28 research projects to date, including searches for more effective treatments for cancer, HIV/AIDS and neglected tropical diseases. Other projects are looking for low-cost water filtration systems and new materials for capturing solar energy efficiently.

Help save lives today and join my team Apraxia Kids

Share Button

HOWTO: SAP Sybase IQ, SQLAnywhere, ADO.net and Powershell

Connecting to IQ can be a rather pain in the tuckus.

In the v16 IQ client for Microsoft Windows, the .net assembly changed to “Sap.Data.SQLAnywhere” from “iAnywhere.Data.SQLAnywhere”.

Another annoyance is the loading of the assembly where SAP recommends loading it via

Add-Type -AssemblyName ("Sap.Data.SQLAnywhere.v4.5, Version=, Culture=neutral, PublicKeyToken=f222fc4333e0d400")

This forces you to remember the exact version of the assembly as well as the public key token. If you’re worried about a nefarious individual gaining access to your machine and infecting your ado.net assemblies, continue to use the recommended method.

A simpler mechanism is using “LoadWithPartialName” where powershell will load the v4.5 ado.net driver for SQLAnywhere if it is in the Global Assembly Cache (GAC):


Working example of connecting to IQ from PowerShell with a v16.1 IQ client (v17 SQLAnywhere client under the covers):

$HostName = ""
$Port = 20001
$User = "DBA"
$Password = "password"


# Connection string
$connectionString = "Host=$HostName`:$Port;UserID=$User;Password=$Password"

# Create SAConnection object
$conn = New-Object Sap.Data.SQLAnywhere.SAConnection($connectionString)

# Connect to remote IQ server

# simple query
$Query = 'select 1 as col1 from dummy'

# Create a SACommand object and feed it the simple $Query
$command = New-Object Sap.Data.SQLAnywhere.SACommand($Query, $conn)

# Execute the query on the remote IQ server
$reader = $command.ExecuteReader()

# create a DataTable object 
$Datatable = New-Object System.Data.DataTable

# Load the results into the $DataTable object

# Send the results to the screen in a formatted table
$DataTable | Format-Table -Auto


Share Button

VIDEO: PostgreSQL at 10 TB and beyond

If you’re interested in large databases and PostgreSQL, Chris Travers at Edument has been kind enough to share his experiences with such a setup (YouTube)

Share Button

SAP IQ and SQL Anywhere UnixODBC UserDSN and SystemDSN issues: WORKAROUND

SAP’s IQ / SQLAnywhere ODBC driver on Linux/*nix doesn’t work with a system that has both UserDSNs (~/.odbc.ini) and SystemDSNs (/etc/odbc.ini).

Currently when the driver looks for a DSN (db instance), the resolution is:

  1. $ODBCINI – must contain the exact full path name of the .odbc.ini file.
  2. $HOME
  3. Current directory
  4. $PATH

Notice that /etc/odbc.ini is not processed. A workaround to use SystemDSNs is to set the ODBCINI variable to /etc/odbc.ini but it doesn’t help if you have a mix of SystemDSNs and UserDSNs.

I’ve requested SAP to fix this. They’ve opened KBA2571931 CR812127. Unfortunately, SAP requires a support contract to view the KBA 🙁

CR812127 order of resolution:

  1. $ODBCINI – must contain the exact full path name of the .odbc.ini file.
  2. $HOME
  3. Current directory
  4. $PATH
  5. /etc/odbc.ini
Share Button

HOWTO: IBM DB2, ODBC, and Linux (*nix) configuration

The DB2 ODBC driver works like anything else IBM. Nonstandard to the rest of the universe. How to set up ODBC:

Unix admin needs to do:
Retrieve the config file locations:

$ odbcinst -j
unixODBC 2.2.14
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /home/jason/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8

/etc/odbcinst.ini : list of the available drivers and default configuration for each driver
/etc/odbc.ini : list of the instances/databases for *all* users aka “System DSNs”
${HOME}/.odbc.ini : list of the instances/databases specific to *you* aka “User DSNs”

Add/update the following lines in the /etc/odbcinst.ini file (or wherever the file is as reported by odbcinst -j). Make sure there is no whitespace at the beginnings of the lines.

Description = DB2 Driver
Driver = /opt/ibm/db2/db2_v9.7/lib64/libdb2o.so

The driver line should point to the full path of libdb2o.so (any *nix but aix) or libdb2o.a (aix).

Add/update the following lines in the ${HOME}/.odbc.ini file:


You need to catalog the database (assuming you already cataloged the node [db2host in my case] – see https://www.ibm.com/support/knowledgecenter/en/SSEPGG_10.1.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001944.html):

 # catalog database database_name as database_alias at node node_name
catalog database MYDB2DB as MYDB2DB at node db2host

Test connectivity to the remote database:

db2 connect to MYDB2DB user testuser using test_password

Ensure we’re using the unixODBC isql:

$ /usr/bin/isql --version
unixODBC 2.2.14

Validate using unixodbc “isql”:

$ /usr/bin/isql -v MYDB2DB testuser test_password
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |

The DSN for the entry is simply “dbi:ODBC:MYDB2DB” if you’re using Perl. Later versions of the db2 client allow you to specify the connect options in the DSN like so:

my $odbc_connect_str = "dbi:ODBC:"
               . "DRIVER=/opt/ibm/db2_v10.5/lib64/libdb2o.so;
               . "Protocol=tcpip;"
               . "Hostname=mydbhost;"
               . "Port=67033;"
               . "DATABASE=MYDB2DB";
Share Button

HowTo: Set up iSCSI with Multipath (MPIO) in Windows 10 SOLVED – Spoke too soon

I searched high and low and wasn’t able to find a definitive answer on whether Microsoft Windows 10 supports multipath (MPIO) over iSCSI. I found many many blog posts, articles, and press releases for Windows servers but nothing for Windows 10.

The good news is that Windows 10 supports it out of the box. You don’t have to install anything extra. Of course, the see the benefits of multipath, you will need two or more network cards. You can either bond the network cards together or set up individual routes to the iSCSI network addresses. I’ll assume that you did that already. 🙂

This is only for new connections to your iSCSI targets.  You can not retrofit multipath on to existing connections.  You will need to offline the volumes, remove the targets from the favorites and then reboot.

As an administrator on your Windows 10 box:

  • Launch the iSCSI initiator (Windows key and type iscsi initiator)

  • Add both ip/ports to the iSCSI host in the Discovery -> Portal Groups tab

  • Refresh the iSCSI targets in the Targets tab.  If they aren’t shown, add them manually
  • Select the iSCSI target, click connect, and select “Add this connection to the list of favorites…” (so it will automatically connect the next time you start windows)  and “Enable MPIO”.  Click Okay

  • Select the iSCSI target, click properties.  In the Portal Groups tab you should see both ip/port paths

  • If you needed to offline the volumes, you will need to now online them.  They should retain any drive letter assignments
Share Button