How Do You Install Erlang on a Linux SUSE Server?

Problem scenario
You want to install Erlang on a Linux SUSE machine. What should you do?

Solution
Run this script with sudo (e.g., sudo bash /tmp/erlang.sh):

# Written by www.continualintegration.com
#/bin/bash

widgetversion=3.0.4

echo “This script can take 20 minutes to complete”

zypper -n install ncurses gcc-c++ autoconf make git python3 bzip2 gtk2 gtk3 gtk2-devel ncurses-utils ncurses-devel
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

cd /bin/
git clone https://github.com/erlang/otp.git
cd otp
./otp_build autoconf
./configure
echo “This next portion may take 15 minutes”
date /tmp/datetime.txt
make
make install
ln -s /usr/local/lib/erlang/bin/erl /usr/bin/erl
ln -s /usr/local/bin/erlc /usr/bin/erlc
ln -s /etc/alternatives/python3 /usr/bin/python
echo “Script run completed.”
echo ” ”
echo “Many errors above (if there are any) may be ignorable”
echo “try the ‘erl’ command with no quotes to see if Erlang was installed”
echo ‘If you get to a carrot prompt,  » Read more..

How Do You Get Python to Parse Web Pages to Find a String?

Problem scenario
You know a string is buried in a series of web pages. How do you get Python to read the web pages and find the string?

Solution
Change the URLs as you desire. Change the “searchterm” variable assignment to the word of your choice. Then run this Python 3 program:

import re
import requests
listofurls = [‘http://www.continualintegration.com/’, ‘http://www.continualintegration.com/miscellaneous-articles/page/1/’,  » Read more..

How Do You Know the Entrenchments in the U.S. Constitution Exist?

Problem scenario
You read that there were two entrenchments in the U.S. Constitution. How do you know that they exist?

Answer
An entrenchment is the placement of something in a trench (according to Merriam-Webster’s Dictionary). This connotes a defensible and protected cavity (e.g., for warfare). Article V of the Constitution explains the entrenchments. Article V describes amending the Constitution,

 » Read more..

How Can a Linux Have a Load above 5 with a High Percentage of CPU Being Idle?

Problem scenario
You are using Linux, and you run top, and you see this:

top – 21:38:04 up 14 days, 12:12, 1 user, load average: 5.30, 5.10, 4.90
Tasks: 54 total, 15 running, 39 sleeping, 0 stopped, 0 zombie
%Cpu(s): 11.7 us, 13.7 sy, 0.0 ni, 74.6 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

How can the load average be so high with so much CPU being idle?

 » Read more..

How Do You Back Up Many Emails from a Web-based Email Quickly?

Problem scenario
You want to back up many different emails from a web-based email. You cannot select several and print them all at once. What should you do?

Solution
Prerequisite

This assumes your web-based email can be configured to work with a desktop email client (such as Outlook).

Procedures
Install and configure Thunderbird,

 » Read more..

How Do You Troubleshoot the Error ‘”/usr/share/collectd/types.db” no such file or directory’?

Problem scenario
You are running an aws ssm command. You receive a message about an error when parsing amazon-cloudwatch-agent.toml that also says ‘”/usr/share/collectd/types.db” no such file or directory’. What do you do?

Solution
Install collectd. If you are using a RedHat derivative of Linux (e.g., Fedora or CentOS), run this: sudo yum -y install collectd

 » Read more..

How Do You Use Ansible to Have Retrievable Double Quotes ‘”‘ in a Variable?

Problem scenario
You are using Ansible, and you want a playbook to have a variable with double quotes. The double quotes are disappearing from your echo var1.stdout[:] invocations. How do you get shell/bash commands to have double quotes?

Solution
Rather than “echo” a string with double quotes, use a variable assignment. Do not use this: echo “a \”long string\” for a \”test\” “

Use something like this: coolstring=”a \”long string\” for a \”test\” ” &&

 » Read more..

How Do You Install the traceroute Utility on Ubuntu/Debian Linux?

Problem scenario
You want to see how far outbound TCP/IP packets get when sent from your Ubuntu or Debian Linux machine. What should you do?

Solution
Run these commands:
sudo apt -y update
sudo apt-get install inetutils-traceroute

 » Read more..

How Do You Fix the Stack Storm Error “Failed to authenticate”?

Problem scenario
You run an st2 command, but it fails with an error like this:

Failed to authenticate with credentials provided in the config.
ERROR: 401 Client Error: Unauthorized
MESSAGE: Invalid or missing credentials for url: http://127.0.0.1:9100/tokens

What should you do?

Solution
Run a command like this (but replace “jdoe” and “passwordhere” with your credentials respectively):

st2 login jdoe –password ‘passwordhere’

Now run the st2 command(s).

 » Read more..

How Do You Pass an Array to a Method in Java?

Problem scenario
You want to pass an argument to another piece of code (e.g., a function in Java). How do you pass an array as a parameter to another portion of code?

Solution
Java only has methods — not functions (according to this posting).

This code (which should be called contInt.java) will pass a two-dimensional array called twoD to the method “coolp”.

 » Read more..