How Do You Troubleshoot the nmap Results “Host seems down” when the Other Server is Not Down?

Problem scenario
Two servers have a specific incoming port open between them. But when you try nmap to test the port, you get a message like this:

Starting Nmap 7.60 ( https://nmap.org ) at 2019-10-08 19:57 UTC
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 3.04 seconds

What should you do?

How Do You Get the /var/log/mail File to Start Over?

Problem scenario
You want to search for activity associated with a given email address. You do not want to examine historical records because you made a configuration change. How do you eliminate the old records of the file and start over?

Solution
1. Make a back up of the file. (The commands below will eliminate the original copy.)
2. Run these four commands:

sudo su –
cd /var/log
mail
exit …

How Do You Find out What Packages You Can Install That Are Related to a Certain Category when Using CentOS/RedHat/Fedora Linux?

Problem scenario
You want to find what Java packages are available on the configured repositories of the RedHat distribution of Linux server you are using. What do you do?

Solution
Run a command like this: sudo yum list available | grep -i java

# Replace “java” above with the package you want to learn more about from the available options.

How Do You List the Repositories in GitHub for a Specific Organization without Using the Web UI?

Problem scenario
How do you use the GitHub API to list repositories for an organization?

Solution
Draft a command like this:

curl -u jdoe https://api.github.com/orgs/foobar/repos | grep git_commits_url

  • Change “jdoe” to the username of your GitHub account
  • Change “foobar” to the name of your organization

Why Does a PHP Program Call to a Python Program Work from the Back-End but Not from the Front-End?

Problem scenario
In your PHP program, the Python binary is executing regardless of how the PHP program is run (e.g., from a command line with the php command or when downloaded from a web browser). The PHP program will launch Python programs if the PHP program is invoked from the back-end with PHP. But Python programs are not being interpreted by Python when a web browser loads the PHP file.

How Do You Troubleshoot a Web UI Problem with GitLab?

Problem scenario
When you are using GitLab, you receive various 500 errors. The web UI is not working correctly. What should you do?

Possible solution #1
1. Go to the back-end of the GitLab server. Run this: sudo gitlab-ctl tail
2. Reproduce the web UI problems that you are having. Examine the output.

Possible solution #2
You may want to install Fiddler on your desktop to get more details about the front-end.

How Do You Troubleshoot the Python Problem “NameError: global name ‘var2’ is not defined”?

Problem scenario
You have a Python program that works, but you get an error when you run it. You get a message like this: “NameError: global name ‘var2’ is not defined”

Here is your source code:

def fun1(var1):
print(“this is how it works”)
var1 = var2
return var2
b = fun1(“check it out”)
print(b)

What should you do about this error?

Solution
A variable inside a function must be defined.

How Do You Create a Master Branch (or First Branch) with the GitHub API?

Problem scenario
You do not want to copy a branch to create a new one. How do you create a branch of a repository that has no branches?

Solution
You must know the relevant organization name of the Git repository and the name of the repository itself. Do these changes:

  • Change “acme” to the organization name
  • Change “goodrepo” to the repository name of your choice.

How Do You Troubleshoot a pom.xml File?

Problem scenario
You are trying to run your Java program from a .jar file. You get an error like this:

Error: Could not find or load main class target.contint-0.1.0.jar
Caused by: java.lang.ClassNotFoundException: target.contint-0.1.0.jar

What should you do?

Solution
Examine the mainClass stanza. The word to the left of the period should be the name of the package. You should have a .java program that will have a line such as package foobar.

How Do You Use Multi-Line String Variables in JavaScript?

Problem scenario
You want to present multiple lines in an “alert” message in JavaScript. How do you have new lines with text in JavaScript?

Possible Solution #1 (less preferred)
Use syntax like this:

var y = `
line1
line2
line3
`;

Possible Solution #2 (preferred)

var z = [
line1,
line2,
line3
].join(“\n”);

You could use this stand-alone file multiline.html:

<!DOCTYPE html<html<body<h2This demonstrates a multi-line variable in JavaScript</h2<p id=”demo”</p<scriptline1 = “aaa”
line2 = “bbb”
line3 = “ccc”

var z = [
line1, …