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 website.
  • For an Android smart phone:

           1.  Drag the top bar down until you see different options such as "Bluetooth", "Wi-Fi", and "Airplane mode".
           2.  Toggle the option for "Flashlight".
           3.  If that does not work, see this external link.  If you want a new Android phone, click here.

  • For a BlackBerry:

           1.  Press the BlackBerry icon button.  It will look like this:

(Courtesy of simpleicon.com.)

2.  Click the option for "Flashlight".

            If you want a new BlackBerry, click here.

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".

What should you do to get SonarQube to start?

Solution
Stop SonarQube services.  Remove the recently added plugin (e.g., move the .jar file from a plugin directory).  Restart SonarQube services.

You cannot use the C / C++ plugin without a paid version of SonarQube such as the Developer Edition.

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.  Strict TCP security measures can prevent the application from getting the proper updates.

Possible solution #3
Apply the updates manually.  Download this for the most recent updates.  You do not need to uninstall and reinstall the application.

Possible solution #4
You could consider posting the details of your problem on the old website http://forums.superantispyware.com. But apparently it is gone.

Possible solution #5
Buy the supported version and open a ticket.

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.

You tried creating a vars file and placed it in a group_vars directory.  But when you run the playbook you get "The task includes an option with an undefined variable."

How do you have a separate file for variables for your playbook?

Solution
1.  In the directory with the playbook, create a subdirectory called "group_vars". 
2.  In group_vars create a subdirectory called "all". 
3.  Create the file named "vars" in this subdirectory named "all". 
4.  The variables can be assigned in this "vars" file.  The formatting is the same as the Ansible playbook.

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.  

If you have Ansible installed and configured with an inventory (e.g., /etc/ansible/hosts) file that is ready, you can run a command like this to see if you are prompted for a password when elevating to sudo:

ansible -m shell -a 'sudo ls /root' all

If you want to test a specific managed node, you could modify the command above by replacing "all" with the hostname of the managed node you want to test.

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.

For future reference:
If you want to reinstall Java or install the JDK on any type of Linux see this posting.  For more information about database connectivity from a Java program, see this website.

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., BitBucket or GitHub).  How does the .gitignore file help you keep files private that should not be stored in a repository while also being in a convenient location that allows you to develop solutions rapidly?

Solution
There are multiple settings and variations of how to use a .gitignore file.  A basic way to use it is to create a .gitignore file (via vi) in a base directory of the Git repo.  Then have a list of the file names that you do not want to include in the Git repository.  List the files case sensitively and one file per line.  If your repository has subdirectories, files that have the same name as those in the .gitignore file will all be excluded (regardless if they are in the base, or root, directory of the Git repo or in a subdirectory).

To never add .jar files (something that you would not want in a Git repo) use this as the .gitignore file in the Git repo:

*.jar

How Do You Troubleshoot the Ansible Error “Only one –vault-id can be used for encryption.”?

Problem scenario
You try to run ansible-vault, but you get this error:
"ERROR! Only one --vault-id can be used for encryption.  This includes passwords from configuration and cli."  You want a fast solution, and you have complete control of the Ansible server. You do not need to use encryption or decryption for your Ansible operation(s).  What should you do?

Solution
Modify the ansible.cfg file. Comment out a stanza like this:

# vault_password_file = ~/.vault_pass.txt

If there is no leading pound "#" mark, add one to comment it out

How Do You Install pip or pip3?

Problem scenario
You think you installed pip (e.g., using this posting for Debian/Ubuntu, using this posting with Linux SUSE, using this posting for a CentOS/RHEL/Fedora server, or this posting as an alternative), but when you run pip, you get "command not found."  How do you install pip and get it working?

Solution
pip or pip3 may actually be installed despite the fact that things may seem otherwise. The path to it (pip or pip3) may not be in your environment (e.g., env) variables.  Run these commands:

sudo find / -name pip
sudo find / -name pip3

Use the full directory path and the pip file when calling the pip command.  For example, use one of the following as a command:

/usr/bin/subdirectory/version/pip
/usr/bin/subdirectory/version/pip3

How Do You Use Azure Functions?

Problem scenario
You want a REST API program to write to logs in a serverless way.  You want to have a program (or some very basic lines of code to) execute upon certain events happening (e.g., to write intelligent pre-processed logs and potentially gather data from multiple sources).  You want to use an Azure PaaS for this.  How do you use Azure functions?

Solution
1.  Log into Azure.
2.  Click "Create a resource" in the upper-right hand corner.
3.  Click "Serverless Function App"
4.  For the "App name" enter something unique (e.g., adkeui37672hd73hx)
5.  For "Runtime Stack" select "JavaScript".
6.  Adjust other settings as needed.  Click "Create" near the bottom.
7.  Processing will occur.  There will be a laser-like horizontal bar that will scroll near the top of the Azure Portal GUI.  When this bar disappears, the "Function" has been created. 
8.  Click "Function Apps" (either on the left or in the middle of the screen).  (Or go here: https://portal.azure.com/#blade/WebsitesExtension/FunctionsIFrameBladeMain )
9.  On the left you should see the unique name you gave it.  Find the name you entered and click on it [to expand it].
10.  Underneath that should be an icon and the word "Functions". 
11.  Expand Functions and click on plus sign.
12.  Click the "In-portal" option in the middle of the screen.
13.  Click "Continue"
14.  Click "Webhook + API" and then click "Create"
15.  Click "</> Get function URL "
16.  The pop-up window should have a section called "URL".  Copy that URL text (e.g., by clicking the hyperlinked, blue "Copy text" on the right of the pop-up window).
17.a.  Draft a URL by pasting the copied text into a text editor.
17.b.  Append "&name=MikeSmith" to the text. 
17.c.  Replace "Mike Smith" with your name. 
17.d.  This text is the draft or "composed URL".

It will look something like this:
https://mkwjeu1857234.azurewebsites.net/api/HttpTrigger1?code=v3dkeE651Kh29xmnwbRE/N4c6ej393MBN==&name=Hello Mike Smith

18.  Open a new web browser and go to this composed URL.  You should see something like "Hello Mike Smith"

19.  You are done.  To learn about the details (e.g., pricing) see this link.