How Do You Write a Java Program to Accept Text from the Command Terminal and Print It Back Out?

Problem scenario
You want to write a basic Java program to test it out.  How do you write a program to accept user input, specifically a alphanumeric input, and print it back to the screen?

Solution
1.  Install the Java Development Kit if you have not installed it yet.  If you are not sure you have it, run “javac -version“.  If it says that the command is not found,

How Do You Troubleshoot the Ansible Error “Syntax Error while loading YAML expected <block end>, but found ‘-‘”?

Problem scenario
You are trying to run an Ansible playbook with the “become: yes” stanza.  You get this error after your ansible-playbook command:

“ERROR! Syntax Error while loading YAML.
  expected <block end>, but found ‘-‘

The error appears to have been in ‘/home/cooluser/good.yaml’: line 4, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

 

In Python, How Do You Call an Unbound Function as a New Thread with the thread Module?

Problem scenario
You want to write a program to call a unbound function in a new thread with the threading module. How do you do this?

Solution
Run this program (e.g., python foobar.py):

import _thread as thread
def contint():
print(“Hello!”)

#if name == “main”:
foobar = thread.start_new_thread(contint, () )
print(“thread finished exiting”) …

How Do You Troubleshoot the Bash Script Error “line 5: $’\r’: command not found”?

Problem scenario
You drafted a Bash script on a Windows computer.  You then uploaded it to Google Cloud Platform via a web browser feature.  When you run the bash script on a Linux server (e.g., in GCP), you get this error “line 5: $’\r’: command not found”.  You do not want to install dos2unix or any new packages.  What should you do?

Solution
The file needs to be modified or “cleaned up.” 

How Do You Install Jira When You Get an Error about Not Having a Graphical UI or an Error about Using the -c Flag to Use the “console” to Install Jira?

Problem scenario
You are trying to install Jira on a RHEL server (e.g., in AWS).  You run this:

sudo ./atlassian-jira-software-7.8.1-x64.bin

But it gives you an error.  You see a message about not being able to connect to an X server and the -c option will invoke a console method.  You try using the -c flag when invoking the .bin script to install Jira.  The problem keeps happening. 

How Do You Troubleshoot “ERROR! ‘service’ is not a valid attribute for a Play”?

Problem scenario
You are trying to use the “service” Ansible playbook reserved word.  You want a service to be started.  But when you run the Ansible playbook, you get “ERROR! ‘service’ is not a valid attribute for a Play”.  How do you fix this?

Solution
Change the formatting of the playbook.  Eliminate spaces and make sure indentation aligns with other sections of the playbook.

What Are Some Tips on a Bash Programmer Becoming a PHP Programmer?

Problem scenario
You are a Bash programmer, but you want to learn how to code in PHP.  How do you learn to develop PHP scripts when you have a Linux bash background?

Solution
If you are new to PHP programming and familiar with Bash programming, remember these tips:

1.  Variable assignments involve the variable with the syntax of a cash sign “$” before the variable name. 

How Do You Troubleshoot the Jira Cluster Message “Node is not using the correct shared home…”?

Problem scenario
In the Jira “Instance health checks” section you see a problem has been detected under the “Cluster” section.  It says “Node jiranode1 is not using the correct shared home…”  How do you get this error to go away?

Possible solution #1
Log into the node on the back-end.  Stop the Jira service and then start the Jira service.

Possible solution #2
Log into a working node on the back-end. 

How Do You Troubleshoot the SonarQube Scanner Error “java.lang.IllegalStateException: Unable to load component class or.sonar.scanner.scan.ProjectLock”?

Problem scenario
You are trying to run SonarScanner, but you get an error about “java.lang.IllegalStateException: Unable to load component class or.sonar.scanner.scan.ProjectLock”.  What should you do?

Possible solution
Is there a sonar-project.properties file in the directory where you are running the above command?  Does your user have access to read the file?  Check these things first.