How Do You Troubleshoot “postgresql.Driver Connection error: org.postgresql.util.PSQLException Fatal: Ident authentication failed for user”?

Problem scenario
You are trying to connect to a PostgreSQL database.  Your database username and password are not working, but you think they should.  You get the message:  “postgresql.Driver Connection error: org.postgresql.util.PSQLException Fatal: Ident authentication failed for user”

What should you do?

Possible solution #1
Make sure the pg_hba.conf file is configured correctly.

Here is an example if you are trying to connect from your local machine and you do not need your Postgres instance extremely hardened:

# TYPE 

How Do You Troubleshoot “Failed to start sonar.service: Unit not found” Error?

Problem scenario
You run “sudo systemctl start sonar”, but you get this message: “Failed to start sonar.service: Unit not found”

What should you do?

Solution
Run this: sudo systemctl enable sonar

Now you should be able to run your command to start the “sonar” service.

How Do You Troubleshoot the GitLab Integration Webhook Error “No valid crumb was included in the request”?

Problem scenario
You are trying to configure GitLab to work with Jenkins (so the two are integrated to enable CI, continual integration, in your environment).  When you test a connection of an integration webhook from GitLab to reach out to Jenkins you receive this error:

“Hook executed successfully but returned HTTP 403… No valid crumb was included in the request.”

What should you do?

Solution
Possible solution #1
Warning: This is not a recommended practice. 

How Do You Troubleshoot “command not found” in a Bash Script?

Problem scenario
You have a function defined in your Bash script.   You call the function you created.  But you get “command not found”.  What should you do?

Solution
The Bash script is parsed from the top of the file to the bottom of the file.  You cannot invoke the function before it has been defined.  Place the function above the line where it is called. 

How Do You Troubleshoot the Oracle and Java Message “java.sql.sqlexception ora-01003 no statement parsed”?

Problem scenario
You run a Java program that runs a SQL statement in an Oracle database.  You get this error: “java.sql.sqlexception ora-01003 no statement parsed”.  What do you do to fix this?

Solution
Run the Java program a second time.  Does the problem remain?  It could be that there was a successful DDL command, and this error could be ignorable.  

You may want to try these links for further info:
https://stackoverflow.com/questions/23866710/ora-01003-no-statement-parsed
https://community.oracle.com/thread/736289 (this link used to work)

How Do You Use Encapsulation in Python?

Problem scenario
You know about encapsulation.  You know about private methods that are only accessible from inside a class — not outside.  You want to encapsulate a method in a class in Python.  How do you write such a program?

Solution
“Programmers are most effective if shielded from, not exposed to, the innards of modules not their own.” (This was taken from page 272 of The Mythical Man-Month.)

Here is an example;

How Do You Troubleshoot JIRA Not Working due to Not Finding a Suitable Driver?

Problem scenario
Atlassian JIRA is not working.  The web UI does not have a login page.  On the back-end in the logs, you see an error about not finding a suitable driver.  (You may get an error about a port number instead.  This problem may require a similar solution to the one proposed below for an error about a suitable driver.)  You know you have the ojdbc.jar file (or variation thereof) in the correct place. 

With awk, What Do You Do to Get a Colon To Be Recognized as a Separator of Fields?

Problem scenario
You have Awk 4.1.3 installed.  The default field separator in awk is a space.  You want to assign it to a different character — specifically a colon “:”.  You have a string with a colon assigned to the variable “y”.  You have tried these things:

echo $y | awk -F “:” ‘/1/ {print $NF}’  # this prints nothing
echo $y | awk ‘{FS=”:”; print $1}’  # this prints y
echo $y | awk ‘BEGIN { FS=”:” } /1/ { print $2}’ # this prints nothing

The above commands do not recognize the “:” as the field separator. 

How Do You Write a Java Program to Accept a Number for 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 number, and print it back to the screen (using the integer data type)?

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

How Do You Use an USB-Connected Local Camera with Your Desktop Computer?

Problem Scenario
You purchased a camera that connects to your computer (e.g., a laptop) with a USB cable.  An example may be an SQ9* camera. You now want to use it.  The device connects to your laptop via a USB mini to USB A connector.  How do you view images on your desktop that are captured with the camera lense?

Solution
(This problem assumes that the camera is not plug-and-play.