How Do You Write a Python Program to Simulate a Dial-by-Name directory?

Updated on 9/19/19 to use Python 3

Problem scenario
You have a list of first and last names in a file.  You want a program to extract the last names based on the first two or three letters.  You want to allow the user to dial by last name (to enter phone keys that correspond to letters of last names).  You want the user to enter a sequence of numbers that will correspond to the first two or three letters of the person’s last name. 

How Do You Create a VM in Google Cloud Platform Using a Command Line or an API?

Problem scenario
You want to create a server in Google Cloud Platform using an API or command line.  How do you do this?

Solution
1.  Log into Google Cloud Platform.  
2.  Click the hamburger icon in the upper left hand corner (the icon with three horizontal bars stacked onto each other).
3.  Go to Compute Engine -VM Instances
4. 

When There Is A “connection refused” Message for Graylog, What Might Be the Problem?

Problem scenario
Using PowerShell you test TCP/IP connectivity over port 9000 to your Graylog instance.  You use these commands:

$tcp = New-Object System.Net.Sockets.TcpClient
$tcp.connect(‘x.x.x.x’, ‘9000’)

You get “Exception calling “Connect” with “2” argument(s): “N connection could be made because the target maching actively refused it.”   

You know there is no firewall blocking port 9000.  Using nmap you test TCP/IP connectivity over port 9000 to your Graylog instance.

How Do You Troubleshoot an Empty Multi-node Hadoop Cluster?

Problem scenario
One or more of the following is happening:
   1) There are 0 DataNodes in your Hadoop cluster according to an error message
   2) There is 0 B configured as capacity (as shown from a “hdfs dfsadmin -report” command).
   3)  There is one fewer DataNode in your Hadoop cluster than you expect.
   4)  You run “hdfs dfsadmin -report | grep Hostname” and do not see a node that has its DataNode service (as seen with the 

How Do You Troubleshoot This Problem “Access denied for user ‘zabbix’@’localhost’ (using password: YES)”?

Problem scenario
The web UI for Zabbix shows the Zabbix server is not running.  In “Status of Zabbix” there is a parameter “Zabbix server is running” and it has a value of “No.”  To investigate on the back-end of the Zabbix server you run this command: tail -f /var/log/zabbix/zabbix_server.log

You see this error: “Access denied for user ‘zabbix’@’localhost’ (using password: YES)”

What should you do?

Solution
Examine the zabbix_server.conf file. 

How Do You Install the Latest Version of python-setuptools (aka easy_install) when Your Package Repositories Do Not Have It Available?

Problem scenario
Your apt or yum repositories do not have the newest version of python-setuptools (aka easy_install) available.  You need to install a recent version.  What should you do?

Solution
Prerequisites
a.  You need to have unzip installed.  Debian/Ubuntu servers usually have this by default, but if you still need assistance, see the Debian/Ubuntu link below.  Click on your distribution of Linux for assistance with installing unzip:
CentOS/RHEL/Fedora
Debian/Ubuntu
SUSE
b. 

How Do You Get around the Error ‘no program or library has “hello” as canonical name’?

Problem scenario
You are running “autoreconf –install” but you get this type of error:

“Makefile.am:2: warning: variable ‘hello_SOURCES’ is defined but no program or
Makefile.am:2: library has ‘hello’ as canonical name (possible typo)
autoreconf: automake failed with exit status: 1″

How do you modify Makefile.am to not have this error when running “autoreconf –install“?

Solution
In the Makefile.am file,

How Do You Use Python Eve as a RESTful Endpoint on an Ubuntu Server?

Problem scenario
You want to use Python Eve to test it out.  You also want to create a RESTful endpoint on an Ubuntu Linux server.  How do you do this?

Solution
1.  Install Eve on the Ubuntu server.  Here is one way:

sudo apt-get -y update
sudo apt-get -y install python python-pip
sudo pip install eve

An alternative way to install it is given