How Do You Install wxWidgets on Linux?

Problem scenario
You want to install wxWidgets on Linux. What should you do?

Solution
Run the following:

sudo zypper -n install bzip2 gcc-c++
sudo yum -y install bzip2
sudo apt -y install bzip2

widgetversion=3.0.4
cd /tmp/
curl -Ls https://github.com/wxWidgets/wxWidgets/releases/download/v$widgetversion/wxWidgets-$widgetversion.tar.bz2 > /tmp/wxWidgets-$widgetversion.tar.bz2
cp /tmp/wxWidgets-$widgetversion.tar.bz2 /bin/
cd /bin/
bzip2 -d wxWidgets-$widgetversion.tar.bz2
tar -xf wxWidgets-$widgetversion.tar
cd wxWidgets-$widgetversion

How Do You Access a Linux Server’s GUI Desktop?

Problem scenario
Normally you use Putty to a Debian distribution of a Linux server. You are having trouble using some of the Linux server's utilities. You try to run the "jsql" command, but you see this:

Apr 29, 2019 1:46:15 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
13:46:17,296 ERROR root:67 - HeadlessException, command line execution in jSQL not supported yet:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
        at java.awt.Window.<init>(Window.java:536)
        at java.awt.Frame.<init>(Frame.java:420)
        at javax.swing.JFrame.<init>(JFrame.java:233)
        at com.jsql.view.swing.JFrameView.<init>(JFrameView.java:80)
        at com.jsql.MainApplication.main(MainApplication.java:62)

How do you access a Debian distribution of Linux's GUI?

Solution
Assuming you are using Linux Mint, Kali Linux, Ubuntu or a Debian derivative of Linux, run these commands:

sudo apt -y update
sudo apt -y install xrdp
sudo service xrdp start

Now you should be able to RDP into the server (e.g., use Remote Desktop from a Windows computer). If something is blocking port 3389, you may want to consult with this posting.

How Do You Find the AWS Namespaces?

Problem scenario
For a boto3 program, you want to find the AWS namespaces. What do you do to list the namespaces that are part of your AWS accounts?

Solution
Prerequisites

You must have the AWS CLI installed. If you need assistance with this, see this posting.

This also assumes that the Linux user has the policy for servicediscovery:ListNamespaces. If you aren't sure, try the solution first. Otherwise your user must be made to allow "servicediscover:ListNamespaces".

Procedures
Run this command: aws servicediscovery list-namespaces

How Do You Resolve the “env: ‘python’: No such file or directory” Error without Installing Python 2?

Problem scenario
The security team for your enterprise will not permit Python 2 to be installed. (You do not want to install a new minimal Python package either.) How do you fix the problem of env: ‘python’: No such file or directory when you run a make command?

Solution
The command "python" (not python3), will work after you run this script. Run this script as sudo (e.g., sudo bash /tmp/scriptbelow.sh):

if [ -f "/usr/bin/python" ]
then
  echo "Python has been installed."
else
  pysource=$(which python)
  ln -s $pysource /usr/bin/python
fi

How Do You Troubleshoot Craft CMS Not Presenting Its Website After the Installation?

Problem scenario
You installed CraftCMS. But there is no port activity on port 80. You want to go to the front-end now. You cannot get to it via a web browser. What do you do?

Solution
Is there a firewall or public cloud security group (e.g., an Azure Network Security Group) blocking traffic to the public IP address over port 80? GCP's firewall could block HTTP traffic such that nmap commands would not show activity over port 80. An nmap -Pn x.x.x.x command could return neither a port filtered/closed response if GCP's firewall was configured to govern the server to block HTTP traffic.

How Do You Install Rundeck?

Problem scenario
You want to set up Rundeck to see what it is like. How do you do this on a Debian distribution of Linux (e.g., Ubuntu, Kali Linux, or Linux Mint)?

Solution
Prerequisite
Java must be installed. Use this posting if you need help with that. We recommend a 4 CPU server with at least 8 GB of RAM. If you need assistance with adding memory, see this posting.

Procedures

  1. Run these commands:
curl -Ls https://dl.bintray.com/rundeck/rundeck-deb/rundeck_3.0.22.20190512-1.201905130100_all.deb > /tmp/rundeck_3.0.22.20190512-1.201905130100_all.deb
sudo dpkg /tmp/rundeck_3.0.22.20190512-1.201905130100_all.deb
  1. Update /etc/rundeck/rundeck-config.properties so the "grails.serverURL" stanza is like this where x.x.x.x is the external IP address of the web server (or the FQDN of the web server):

grails.serverURL=http://x.x.x.x:4440

  1. Run these commands:
    sudo systemctl start rundeckd
    sudo systemctl enable rundeckd
  1. Open a web browser. Go to x.x.x.x:4440 (where x.x.x.x is the external IP address of the server).
  2. Log into the Rundeck web UI. The default credentials are admin / admin.

How Do You Troubleshoot a Puppet Manifest when The Errors and Logging Do Not Help You? (abridged version)

ABRIDGED VERSION (To see the unabridged version, see this posting.)

Problem scenario
A Puppet manifest is not working, but there are no obvious error messages. When running the puppet agent command, you use the -d flag for debugging. In your manifest, you use logoutput => true stanza. But still, you cannot figure out why your manifest is not working.

You tried this command: puppet parser validate nameOfManifest.pp

The above command had no output. On the Puppet Master server, you looked in /var/log/ to find clues. When the Puppet Agent runs and communicates with the Puppet Master server, on the back end of the Puppet Master, the activity should be somewhat logged to /var/log/puppet/puppetserver/puppetserver.log. You see no error messages anywhere that correspond to a puppet agent service running. You want to fix the manifest that is not producing the desired changes and/or effects that you want. Debugging can be difficult when Puppet appears to work perfectly. It seems hard to solve a manifest problem with no runtime errors and no errors in the logs.

How do you debug or otherwise troubleshoot a silently failing manifest that will not apply correctly?

Five Possible Solutions

#1. Are you using the ENC (External Node Classifier)? If you forget or fail to classify the Puppet agent and Puppet manifest correctly, you can observe a Puppet manifest not work with no error messages. For more details on how to remedy this issue, see "Possible solutions" #5 and #7 of this posting

#2. Are the modules directories or files subdirectories associated with the manifest not in their correct location? Or have such directories been given permissions that do not allow for files to be read from their locations? Puppet Master migrations or other systems administration operations on the Puppet Master server could cause dependent files to not be retrieved properly causing manifests to fail without warning or notice.

#3. Look at the Puppet manifest closely. Is the logic correct? Imperfect logic can be a big cause of errorless Puppet manifests not doing what is intended. For example, a node stanza could signify an incorrect server from what you expected. A class declaration could have prematurely terminating braces that could exclude an exec statement. This scenario (with the exec statement never running on a Puppet agent server) could be free from errors, even if you use the "puppet parser validate" feature. Be sure you did not forget to uncomment out a line in the manifest.

#4. Temporarily re-write a copy of the manifest purely for the sake of debugging. To diagnose what happens with the errorless run of a manifest, you may want to note the time at different stages as well as the user security context throughout the progression/failure of the manifest.

To determine the exact problem you could run exec commands that are specific to the OS receiving the configuration. For example, in Linux you could use date, whoami, or env. In Windows you could use date or whoami. These statements could be redirected (with the ">" symbol" to a file for viewing afterward.

Another way to learn more about a complex yet quietly failing manifest is to use Puppet's two DSL reserved words notify or notice. These can help you obtain more detailed messages without using regular Bash or PowerShell commands. To learn more about adding debugging details, see this external link. While the requires and require keywords can be confused, they can be helpful for ensuring the explicit execution order of a manifest that is failing in an elusive way.

#5. Make sure at least one Puppet manifest will work properly on a given Puppet agent server. Incorrectly configured Puppet master servers can cause an errorless run of a Puppet agent to actually not work. Restart the Puppet Master service. If that does not work, try rebooting the servers involved. If rebooting the servers involved does not work and you have time to do a great deal more, try to redeploy Puppet Master and Puppet Agent. When you try to apply the manifest again, it may work or there may be an error message.

Should Environmental Data Be Placed Into Version Control?

Problem scenario
You are not sure if environmental specific values should be placed into version control. What should do you?

Solution
Some people think that everything should go into version control. But others disagree. Here are examples of each philosophy:

"You need to get everything in version control. Everything. Not just the code, but everything required to build the environment." (This was taken from page 297 of The Phoenix Project.) This is very clear in how it disagrees with the twelve-factor app principles.

"The twelve-factor app stores config in environment variables (often shortened to env vars or env). Env vars are easy to change between deploys without changing any code; unlike config files, there is little chance of them being checked into the code repo accidentally;" (This quote was taken from https://12factor.net/config.)

What Is The Difference between Unit Testing and Functional Testing?

Question
What is the difference between unit testing and functional testing in the context of professionals using one over the other?

Answer
A user wants to verify that the software behavior is correct from a black-box perspective; this more closely describes functional testing. A programmer is more concerned about the theoretical aspects of the code and its inner workings; this more closely describes unit testing. QA professionals blend user testing with programmer testing. See also What is an SDET?.