How Do You Eliminate the “Namespace”, Quotes and Brackets from the Variable You Are Printing with Python?

Problem scenario
You are trying to print a variable, but it prints out like this:

Namespace(string=[‘foobar’])

How do you print out just “foobar” with no quotes?

Solution

Overview
The key word here is “string”.  The “string” text in this is the attribute you will want.

Background
Your program may have something like this:

args = parser.parse.args() # Assuming this is the variable assignment of “foobar”
print (args)

 Procedures
1. 

How Do You Troubleshoot the Artifactory REST API Error of a Hanging Command?

Problem scenario
You issue a call to an Artifactory URL.  You see something like this: “TCP_NODELAY set”.  There is a delay, and nothing happens.  What should you do?

Solution
Does the URL have a port number in it?  The socket may be incorrect depending on what port number you use.  If you can go to the back-end of the Artifactory and install nmap,

How Do You Install a Yum Package from a Reachable yet Unconfigured Repository on an Ad Hoc Basis?

Problem scenario
You want to install a package with a yum command.  But you receive an error about the package not being available.  You know that a reachable, yet unconfigured, repository has the package.  You know the repository’s name too.

You cannot use “subscription-manager register” to configure a new repository because you do not have the proper credentials or there is a firewall blocking the Red Hat derivative Linux server. 

How Do You Get Your Smart Phone’s Flashlight to Work?

Problem scenario
You need illumination to see in a dark room (e.g., a data center or behind a server in a server room).  How do you get your smart phone to illuminate its flashlight?

Solution
It depends what type of phone you have.  See the bullet below that corresponds with the type of phone you have.

  • For an iPhone, see this 

How Do You Troubleshoot Sonarqube Not Starting with Log Messages about “failed to load plugin”?

Problem scenario
You are using SonarQube Community Edition.  SonarQube will not start.  You recently moved a .jar file into a plugins directory.  You want to use this plugin to analyze code.  

The SonarQube logs may register something like “Background initialization failed. Stopping SonarQube java.lang.IllegalStateException: Fail to load plugin C / C++ / Objective-C [cpp]”

The logs may also say something like this: “Unable to register extension com.A.A.A.B.F from plugin ‘cpp’ or “NoClassFoundError…PropertiesDao”.

How Can You Get SUPERAntispyware Updates to Download Reliably?

Problem scenario
Your Super AntiSpyware updates are not downloading properly.  You tried reinstalling the application.  The problem happens on Windows 7 and Windows 10.  What should you do?

Possible solution #1
Do not use a VPN connection for your internet browsing.  This can cause a problem with getting the updates.

Possible solution #2
See if your have a firewall blocking special ports. 

How Do You Get Variables That Are Assigned a Value in an Ansible Playbook (i.e., a .yaml file) to Be Assigned from a Different File?

Problem scenario
You have a complex Ansible playbook (a .yaml file) that you want to be more modular with discrete component files.  You want to assign variables in a different file.  This will make your Ansible playbook have fewer lines.  Your playbook must  read in the variables from a separate file and inject them into the playbook when it is run.  You appreciate Unix philosophy of having things be modular.

What Command Would Test If sudo Was Working without Making Any Changes?

Problem scenario
To see if Ansible can run commands with sudo without being prompted, you want to run a test.

You want to see if sudo works for certain on your Linux server.  But you do not want to destroy anything or change any files.  What should you do for a test that would tell you if sudo is working or not?

Solution
Run a command such as this:  sudo ls /root

The above would not ordinarily work for a regular Linux user.

How Do You Troubleshoot the Error “java.lang.classnotfoundexception oracle.jdbc.driver.oracledriver”?

Problem scenario
You run a Java program and receive “java.lang.classnotfoundexception oracle.jdbc.driver.oracledriver”.  You need to get a program working despite reading that this driver has been deprecated.  What should you do?

Solution
1.  Find the JRE/lib/ext directory.  
2.  Place an ojdbc14.jar file (e.g., downloaded from Oracle.com or some trustworthy website) in that directory.
3.  Without recompiling your program, run the Java program again.

How Do You Use the .gitignore File?

Problem scenario
You want certain files to be ignored when you do a git add –all.  Later you want to run a “git commit” and a “git origin push master” but you do not want certain files included.  While developing a solution and modifying files, you place binary files or change source code to include sensitive passwords in the same directory as your locally saved Git repo that you pulled down.  These files to be excluded are files you do not want stored in a Git repository on the centrally available server (e.g.,