Problem scenario
You try to start an older version of Presto. It keeps failing with a variety of errors. You are using Python 3. Where can you find a launcher.py file that uses Python 3 for Apache Presto?
Solution
Go to this GitHub link.
A Technical I.T./DevOps Blog
Problem scenario
You try to start an older version of Presto. It keeps failing with a variety of errors. You are using Python 3. Where can you find a launcher.py file that uses Python 3 for Apache Presto?
Solution
Go to this GitHub link.
Problem scenario
You want to log or monitor AWS activity (e.g., AWS Management Console, AWS CLI, and/or AWS SDK actions). You do not want encryption because you are just testing it out. How do you use CloudTrail to do this?
Solution
(We recommend using encryption for production uses. The above is just for a proof-of-concept.)
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
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).
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".
import java.util.*;
class contInt
{
static String[][] boardprinter(String [][] arr1) {
return arr1;
}
public static void main(String[] args) {
String twoD[][] = new String[3][3];
twoD[0][0] = "i";
twoD[0][1] = "h";
twoD[0][2] = "g";
twoD[1][0] = "f";
twoD[1][1] = "e";
twoD[1][2] = "d";
twoD[2][0] = "c";
twoD[2][1] = "b";
twoD[2][2] = "a";
String [][] var1 = boardprinter(twoD);
System.out.println("The print function is below from the variable passed to another method.");
coolp(twoD);
}
static void coolp(String[][] twoD) {
String [][] var1 = boardprinter(twoD);
String composite1 = "|" + var1[0][0] + "|" + var1[0][1] + "|" + var1[0][2] + "|";
System.out.println(composite1);
}
}
Problem scenario
You want to use peering connections between two VPCs (in the same region) so that EC-2 instances in each VPC can communicate with each other. How do you do this?
Solution
Prerequisite
This assumes you have two VPCs already created in the same region. This assumes you have EC-2 instances also created.
i. Create one VPC. Go to VPC and give it a name. Create an IPv4 CIDR block (e.g., 55.55.0.0/24 or 66.66.0.0/16). We find it is easier if the VPC has "Edit DNS Hostnames" enabled; you can do this by going to the VPCs, clicking the radio button for the VPC, then going to Actions -> Edit DNS hostnames, and choose "enable", and clicking "Save."
ii. Create a second VPC as you did in step i.
iii. Create EC-2 instances in the VPCs above. When you create each one, make sure it is created in the VPC you want. Step 3 is "Configure Instance Details" (if you are using the web console). The "Network" drop down option should show the VPC you want. If you have to create a subnet, use one of the options in VPC CIDRs. We find it to be easier to choose the "Enable" drop down option for "Auto-assign Public IP".
iv. Ensure the NACLs that govern the subnets of your VPCs allow connectivity from your workstation. The inbound rules must have the IP address of your workstation even if there is a rule for 0.0.0.0 (allow all IP addresses). If you go to VPC -> Security -> Network ACLs, you can find one that governs a subnet. The website ipchicken.com can help you out with your public IP address (of your workstation). The format of the IP address in field will be like this: 123.123.123.123/32
v. Make sure the EC-2 instances have Security Groups with Inbound rules that permit connectivity from your workstation.
vi. Finally if you need to connect to these two EC-2 instances, you may want to create an Internet Gateway for each VPC. Then you will want to modify the Route table of the VPC to have traffic destined for 0.0.0.0/0 route to the internet gateway.
Procedures
In our experience modifications to Route Tables happen instantly; there is no delay.
Problem scenario
You run a Bash command or an Ansible playbook, but you get stymied by this problem: "unexpected EOF while looking for match `\"'"
What should you do when you see this message?
Solution
Verify your escape characters have a space after the symbol that they are escaping.
For example, if you have \""
change it to \" "
The escape character may be working on two sequential symbols (without a space).
Problem scenario
You are trying to install Python 3 but you get a message about zlib. This is the full message:
rm /usr/local/lib/python3.9/lib-dynload/_sysconfigdata__linux_x86_64-linux-gnu.py
rm -r /usr/local/lib/python3.9/lib-dynload/__pycache__
/bin/install -c -m 644 ./Misc/python.man \
/usr/local/share/man/man1/python3.9.1
if test "xupgrade" != "xno" ; then \
case upgrade in \
upgrade) ensurepip="--altinstall --upgrade" ;; \
install|*) ensurepip="--altinstall" ;; \
esac; \
./python -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Traceback (most recent call last):
File "<frozen zipimport>", line 520, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen zipimport>", line 568, in _get_data
File "<frozen zipimport>", line 523, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/Python-3.9.0a1/Lib/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/bin/Python-3.9.0a1/Lib/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/bin/Python-3.9.0a1/Lib/ensurepip/__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "/usr/bin/Python-3.9.0a1/Lib/ensurepip/__init__.py", line 203, in _main
return _bootstrap(
File "/usr/bin/Python-3.9.0a1/Lib/ensurepip/__init__.py", line 122, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/usr/bin/Python-3.9.0a1/Lib/ensurepip/__init__.py", line 30, in _run_pip
import pip._internal
File "<frozen zipimport>", line 241, in load_module
File "<frozen zipimport>", line 709, in _get_module_code
File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [Makefile:1200: altinstall] Error 1
Solution
Run this:sudo yum -y install zlib-devel
(If you get a "yum command not found" error, go to this site.)
Problem scenario
You want your PDF to retain the same content. But you want the file size to be reduced. You have access to a command prompt of an Ubuntu Linux server with no GUI environment. What should you do?
Possible Solution #1
If the fidelity of the reduced size PDF is important, try this solution (as we believe it is relatively lossless).
1. Install Ghostscript:
sudo apt -y install ghostscript
2. Run the following two commands where "foobar.pdf" is the name of your large PDF file:
pdf2ps foobar.pdf foobar.ps
ps2pdf foobar.ps smallfoobar.pdf
Possible Solution #2
If a minor reduction in quality is acceptable and it is very important to reduce the size by a large amount, try this solution.
sudo apt -y install graphicsmagick-imagemagick-compatconvert foobar.pdf -compress Zip small.pdfProblem scenario
You do not have make installed, but you are trying to install it. You get the following message:
build.sh: line 21: ./build.cfg: No such file or directory
sed: can't read lib/Makefile: No such file or directory
sed: can't read lib/Makefile: No such file or directory
sed: can't read Makefile: No such file or directory
sed: can't read lib/Makefile: No such file or directory
./lib/libgnu.a: No such file or directory
What should you do?
Solution
Run these commands:
cd /path/to/directory/with/make/files
sudo ./configure --prefix=/usr/local #do not be alarmed if there are errors
sudo bash build.sh
# Some errors can be ignored. You may be able to proceed even if you saw errors.
If you want to install make from scratch on any type of Linux, see this posting.