How Do You Install Apache Rya on Any Distribution of Linux?

Problem Scenario
You want to install Apache Rya on Linux. What do you do?

Solution

Prerequisites
i. You need a server with at least 5 GB of total memory. You can create swap space with this posting. (Remember that 1 GB of RAM and 2 GB of swap space will be insufficient for installing Rya.)
ii. You need a server with at least 30 GB of free space.
iii. Java and Maven must be installed. If you have a Debian or Ubuntu distribution of Linux and you need assistance installing Java, run this: sudo apt install default-jdk
For any other distribution of Linux you can see this posting for help on installing Java and this posting for installing Maven.
iv. Install git if it has not been installed. To do this on a RedHat derivative of Linux (e.g., CentOS/RHEL/Fedora), you could run this: sudo yum -y install git

Procedures
Run these commands:

git clone https://git-wip-us.apache.org/repos/asf/incubator-rya.git 

cd incubator-rya

mvn clean install -Drat.numUnapprovedLicenses=350
# The above command can take 90 minutes to run.

# The next commands are optional if you want to install the Rya command shell:

sudo find / -name rya.shell*tar.gz

Copy the file into /bin/ (e.g., sudo cp /path/to/file/found/above/rya.shell...tar.gz /bin/)
cd /bin/
sudo tar -xzvf rya.shell*tar.gz
cd rya.shell*
sudo bin/rya

From the rya prompt run this: version
This proves it was installed correctly.

(According to Forbes, triplestore databases are NoSQL.)

Using Python How Do You Write a Palindrome Tester with Special Requirements?

Problem scenario
You want to write a Python that will test if a string is a palindrome with two other requirements. One requirement is to not use a "::" (a colon pair) in the code. The second requirement is to search for a substring that is a palindrome if the full string is not a palindrome. This substring is not any substring however: it must include the leftmost character. For this requirement we will consider a one-character string to be a palindrome.

How do you create a palindrome testing function without using a double colon that tests for substrings to be palindromic if the entire string is not a palindrome?

Solution
Here is the code:

def palindrome_tester(string_to_test):
    if (len(string_to_test) == 1):
        return string_to_test
    tempa = list(string_to_test)  # Make the string a list for reversibility
    tempa.reverse()
    for x in range(0, len(tempa)):
        # Convert the tempa list to a string via the str func, map func
        # and the join method
        string_test = ''.join(map(str, tempa))
    if (string_test == string_to_test):
        return string_to_test
    else:
        # Remove the rightmost character and test resulting string
        string_to_test = string_to_test[:-1]
        # When using recursion, use the return keyword
        return palindrome_tester(string_to_test)

string_to_test = input("Enter a string: ")
result = palindrome_tester(string_to_test)
print("The longest palindrome that can be made of the characters is:")
print(result)

How Do You Use a PowerShell Command to Destroy an Azure VM?

Problem scenario
You have a server in Azure you no longer need. You want to save money by deleting it. What should you do to eliminate it?

Solution
Prerequisite
You need to know the server's name and resource group. You can do this by finding the server in the Azure Portal.

Procedures
Run this command:

Remove-AzureRmVM -ResourceGroupName $nameOfResourceGroup -Name $nameOfVM

# Replace $nameOfResourceGroup with the name of the Resource Group.  Replace $nameOfVM with the name of the the VM.

A List of Books on Site Reliability Engineering

Here is a list of SRE books:

How Do You Troubleshoot the Ansible Message “Syntax Error while loading YAML. expected , but found ””?

Problem scenario
You run an Ansible playbook with a variable. But you get this message: "ERROR! Syntax Error while loading YAML. expected , but found ''" (Ansible found blank single quotes or a double quote mark.)

How do you get the playbook to run?

Solution
Notice the "offending line" in the message. Remove the braces and possibly the quotes around the braces. Assign the variable by itself (without the braces syntax).

Do not use a variable like this:

tasks:
     - shell: "echo  > /tmp/date.txt"
       when: {{ ansible_hostname }} == "contintserver"

or like this:

- shell: "echo  > /tmp/date.txt"
  when: "{{ ansible_hostname }}" == "contintserver"

Here would be a correct snippet:

- shell: "echo  > /tmp/date.txt"
  when: ansible_hostname == "contintserver"

How Do You Troubleshoot the Message “Error: Config file not found: /usr/lib/jvm/java-9-openjdk-amd64/conf/management/management.properties”?

Problem scenario
You are trying to run Apache Zookeeper or some other application. You enounter the problem Error: Config file not found: /usr/lib/jvm/java-9-openjdk-amd64/conf/management/management.properties. What should you do?

Possible solution
This is a workaround. Run these commands:
sudo mkdir -p /usr/lib/jvm/java-9-openjdk-amd64/conf/management/
sudo touch /usr/lib/jvm/java-9-openjdk-amd64/conf/management/management.properties

Why Does Your Python Function Return None?

Problem scenario
Your Python function prints out the value of the variable immediately before it returns the variable.  When it is assigned via the "return" statement, the value is "None".  You were expecting an integer or some other value.  What is wrong?

Solution
Does your function use recursion?  If it is using recursion rather than merely calling the function and it returns "None", use the return statement.  For example, this would cause the problem:

def coolfunction(x):
    ....
    coolfunction(x)

This rewrite of the above would solve the problem of the unwanted "None" returning from your function:

def coolfunction(x):
    ....
    return coolfunction(x) 

How Do You Configure HeidiSQL to Work with Postgres?

Problem scenario
You have a Windows desktop computer with HeidiSQL installed on it. You have a Linux server with Postgres installed on it.  How do you get your SQL front end (e.g., Hiedi SQL), to work with the Postgres database?

Solution
Part 1 / From the back end:
1.
  Modify this file /etc/postgresql/9.5/main/postgresql.conf so this stanza is not commented out:
listen_addresses = 'localhost' 

# Make sure in the quotes there is a space and then the external IP address of the Postgres server.  To find the external IP address, you may use this link.

# The "9.5" in the path should be changed to the version of Postgresql that you installed.

2.  Obtain database credentials.  One way would be to go to the Linux server and create a user.  Once you have access to the command prompt of the Linux server with postgres, see this article for running commands.  If you know how to get to the Postgres command prompt from the Linux terminal, run these commands to create a user:

CREATE USER charles WITH PASSWORD 'veryNeatpw';

3.  Ensure that port 5432 is not blocked on the Linux server.  Confirm there is no process with ufw, firewalld, or iptables.  If there is a process, ensure that port 5432 is not blocked.

4.  Ensure that the Postgres service is running.  See this link for more information.

Part 2 / From the front-end
5.  
Open HeidiSQL. When configuring a connection for the first time, the "Network Type" should be PostgreSQL (Experimental).

6.  The specific database that you want to connect to should be specified when you set up the connection in the connection manager.  You can save these settings for each database if you have many different databases.

Here is what the connection manager will look like:

How Do You Troubleshoot this Error “java.lang.ClassNotFoundException: com.mysql.jdbc.Driver”?

Problem scenario
In Linux you are trying to run a Java program that connects to a MySQL database. The program compiles, but it does not run. You get this error: "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" What should you do?

Solution

1. Set the CLASSPATH variable in two steps. First set it to where the .class file is for the Java file you are running. If the .class file of the program you are running is in /home/jdoe/javaprograms run this command:

export CLASSPATH=/home/jdoe/javaprograms

2. Find where the .jar file is that you need; it will be referred to as "/path/found/file.jar" below. (This command "sudo find / -name ext | grep lib" may help you find where the .jar file should be.)

3. Now set CLASSPATH by running this command: export CLASSPATH=$CLASSPATH:/path/found/file.jar

4. Now try to run the Java program again.

What is a Jenkins Project?

Question
With the CI/CD pipeline, you hear about projects in the context of Jenkins. What is a Jenkins project?

Answer
A Jenkins project is a job. However, the term "job" is no longer used. Jenkins' website defines a project as this: "A user-configured description of work which Jenkins should perform, such as building a piece of software, etc." Taken from Jenkins' website.