How Do You Quickly Install Several Python Packages Such as Pycrypto and Paramiko on RedHat Linux?

Problem scenario
How do you install pycrypto, paramiko and the several related packages without copying several individual packages on a RedHat Linux server?

Background
It can be tedious getting the different dependencies of python packages installed.  By downloading various .tar.gz files, you have to unpack them, then run a series of “python setup.py …” commands. While it is not advisable to install more packages than are strictly necessary,

How Do You Install Java on an AWS Instance of RHEL?

Problem scenario
You are using RedHat Enterprise Linux 7.x in AWS.  How do you install Java?

Possible Solution #1
Use this posting as it is preferred. Below is an alternative.

Possible Solution #2
This will install Java 1.8.x.

1. Create a file named java.sh with this as the content:

yum -y install java-1.8.0-openjdk*
JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk
echo ‘export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk’ ~/.bashrc
source ~/.bashrc
sudo -s
sudo -s source /etc/environment

2.  

How Do You Troubleshoot This Error “javac: command not found”?

Problem scenario
You have Java installed. The “java -version” command returns data showing that Java was been installed correctly.  You try to use the javac command to compile a .java file.  You get this error:

-bash: javac: command not found

How do you compile your Java code when javac is not recognized?

Solution
As root,

How Do You Check If a Variable in Ruby Is a Boolean?

Problem scenario
You want to determine if a variable is being assigned a non-string “true” or “false” data type.  That is, you want to distinguish from a string value of true/false and the Boolean, built-in, supported data type of true/false.  Some programming languages support Boolean or bit values.  Ruby has a number of data types.  There is a feature that Ruby supports to test for most of its datatypes.  

How Do You Test If a Variable Is a String or a Numeric Data Type in Ruby?

Problem scenario
You want to test if a given variable is a Numeric or String.  These are built-in data types that Ruby has.

What should you do?

Solution
Append “.is_a? Numeric” or “.is_a? String” to variable.  For an example, here is code that explicitly prints out if the data type is a Numeric or String.

var1 = 123
an = var1.is_a?

How Do You Find the PID when You only Know It by the Task Name in the Task Manager?

Problem scenario
You have an application (in Windows) running, and you want to terminate it with PowerShell.  You want to find running program’s PID.  But you only know its name in Task Manager.  

How do you obtain the Process ID (identification number) of a program (or application) in Windows when you only know the Task Manager name of the program (or application)?

Solution
1.

How Do You Use C++ to Retrieve Data from a PostgreSQL Database on Ubuntu Linux?

Problem scenario:  You have C++ and Postgres installed on an Ubuntu Linux server.  How do you write C++ programs to retrieve data from Posgres databases?

Solution
Install the official C++ API for Postgresql.  These directions should work on any Debian distribution of Linux.

As root, do the following from the Linux command prompt:

apt-get -y install libpq-dev g++
cd /usr/bin/
curl http://pqxx.org/download/software/libpqxx/libpqxx-4.0.tar.gz >

How Do You Troubleshoot This PowerShell Error “Unable to initialize device PRN.”?

Problem scenario
When running a PowerShell script, you receive the error “Unable to initialize device PRN.”  

Solution
Use the “echo” reserved word instead of “print”.

PRN is what the Windows system name for printer (according to this external posting).

Optional:  If you want to buy a book on PowerShell, click here; you may also want to click here and search for “PowerShell”.

Using PowerShell, How Do You Reverse the Individual Strings in a .txt File While Preserving the Top to Bottom Order of the Lines Themselves?

Problem scenario
You have a list of strings in a .txt file.  You want each string to be in the reverse order from left to right.  You want the strings to remain in their current order from top to bottom.  In other words, you want the content of each line to be reversed. Otherwise you want to preserve the lines in the file (row by row).  For example,