How Do You Troubleshoot a C Program That Prints a Warning Message like “expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=]”?

Problem scenario
You compile a C program (with gcc foobar.cc) but you get an error message like this:

basicprog.c:5:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=]
printf (“y is a %d\n”,y);

What do you do to not get this error?

Solution
While the code compiles, the executable may not run.  A compilation error can be benign. 

A List of PowerShell Books

1593279183PowerShell for Sysadmins: Workflow Automation Made Easy by No Starch Press

1617294160Learn Windows PowerShell in a Month of Lunches by Manning Publications

1449320686Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft’s Command Shell by O’Reilly Media

1789536669Mastering Windows PowerShell Scripting: Automate and manage your environment using PowerShell Core 6.0, 3rd Edition by Packt Publishing

B085RQNL9XWindows PowerShell and Scripting for Beginners: Complete Beginners Guide to learn Windows PowerShell and its Scripting by Independently published

1617295094Learn PowerShell Scripting in a Month of Lunches by Manning Publications

0735675112Windows PowerShell Step by Step by Microsoft Press

1789808537Windows Server 2019 Automation with PowerShell Cookbook: Powerful ways to automate and manage Windows administrative tasks,

How Do You Install Erlang on a Debian/Ubuntu Server?

Problem scenario
You want to install Erlang on a Debian or Ubuntu Server (e.g., Linux Mint or Kali Linux). What should you do?

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

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

echo “This script can take 20 minutes to run”
apt -y update
apt -y install autoconf
apt -y install libncurses5-dev
apt -y install libncursesw5-dev
apt -y install gcc
apt -y install python3
apt -y install make
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, …

How Do You Troubleshoot the Python3 Error “No such file or directory: ‘/usr/local/lib/python3.6/site-packages/” on RHEL 8.x?

One or more of the following problems are happening to you:

Problem scenario #1
You run python3 setup.py install on RHEL 8.x, but you get an error message like this:

running install
error: can’t create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 2] No such file or directory: ‘/usr/local/lib/python3.6/site-packages/test-easy-install-52191.write-test’

The installation directory you specified (via –install-dir, …

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, …

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 = [‘https://www.continualintegration.com/’, ‘https://www.continualintegration.com/miscellaneous-articles/page/1/’, …

How Do You Get Presto to Start when Errors about Presto requiring an Oracle or OpenJDK JVM?

Problem scenario
Presto will not run because of an error about the JVM.

You get a message like this:
“Java version has an unknown format: 15” (from “C” below)
“Presto requires an Oracle or OpenJDK JVM (found Ubuntu)” (associated with the Java version shown in B or D below)
“Presto requires an Oracle or OpenJDK JVM (found Private Build)” (associated with the Java version in E below)
“Presto requires an Oracle or OpenJDK JVM (found IcedTea)” (associated with the Java version shown in F below)

Solution
For detailed background information,

How Do You Troubleshoot the Python Error “NameError: name ” is not defined”?

Problem scenario
You are trying to run a Python program with a class. You get this message:

File “foobar.py”, line 11, in
class Building(param1, param2):
NameError: name ‘param1’ is not defined

What should you do?

Solution
Use the word “object” instead of one or more parameters that you are passing in the parentheses () of the class.

How Do You Troubleshoot the Message “/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require’: cannot load such file — foobar (LoadError)”?

Problem scenario
You are running Vagrant, Ruby or a Ruby application, but you get this error: “/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require’: cannot load such file — foobar (LoadError)”

What should you do?

Possible Solution #1
Try to run the original command with “sudo”. If that doesn’t work, use “gem list” to verify “foobar” is installed.

For Windows users, try to run the command or application as Administrator.