What Is Rotating a List in Computer Programming?

Problem scenario
You have read about lists or arrays being rotated. What does this mean in computer programming?

Solution
Lists and arrays can be interchangeable in many contexts. Java supports arrays and Python supports lists. Both are zero-based. That is, the first item in each is indexed as 0. Lists in Python are circular: the last item in the list can be referred to as -1 and the penultimate item can be referred to as index -2.

 » Read more..

How Do You Import a .mbox into Thunderbird to View the Emails?

Problem scenario
You want to view the emails in a .mbox file. You are using Thunderbird. What do you do?

Solution
Overview: Install the ImportExportTools NG add-on. Have another email account (an empty one or something else) that can accept the emails in Thunderbird configured.

Procedures

  1. Open Thunderbird
  2. Click the hamburger symbol (of three horizonal bars in the upper right hand corner)
  3. Go to “Add-ons”
  4. Search for “ImportExportTools”
  5. Click the hamburger symbol (of three horizonal bars in the upper right hand corner)
  6. A mailbox,

 » Read more..

What Happens Technically when Someone Opens a Web Browser and Goes to a Website?

Question
Surfing the World Wide Web happens as a part of everyday life. In a job interview, you are asked to describe what happens behind the scenes when you open a web browser and enter a URL. The hiring manager wants to hear your knowledge of assembling packets of PHP, JavaScript, HTML, networking, or other technologies involved and how the sequence proceeds. What are the details of what happens behind-the-scenes?

 » Read more..

How Do You Get Chef to Be Automatically Installed and Configured (e.g., in a Docker Container)?

Problem scenario
You have a Docker container that supports Chef or some automatic way of installing Chef. The automation is failing at the end because you are being prompted to accept a license. What should you do to be able to invoke Chef commands automatically?

Solution
With the first Chef command, e.g., “chef env”, use the “–chef-license accept” option/flag. Here is an example:

chef env –chef-license accept

For more information,

 » Read more..

How Do You Troubleshoot the pip Message ‘sys.stderr.write(f”ERROR: {exc}”)’?

Problem scenario
You run a pip command (e.g., pip –version), but ou get an error like this:

Traceback (most recent call last):
File “/home/mike/.local/bin/pip”, line 7, in
from pip._internal.cli.main import main
File “/home/mike/.local/lib/python3.*/site-packages/pip/_internal/cli/main.py” , line 60
sys.stderr.write(f”ERROR: {exc}”)

You no longer want to use Python 2 in on the server. What should you do?

Solution

1.a.

 » Read more..

How Do You Troubleshoot an Apple Application That Seems to Work but Is Not Opening?

Problem scenario
Using a Mac computer your mouse becomes lost or you have an application that is open (based on the black dot underneath its icon), but you cannot find the application. Your computer thinks the application is open, but it is not. What should you do?

Solution
Is your laptop connected to another monitor? If an HDMI cable is connected to the laptop and that monitor is off or hidden,

 » Read more..

How Do You Use a Class in Python to Test The __init__ Constructor’s Default Settings?

Problem scenario
You want to instantiate a class with default values if the class was called to create an object without all the settings. You want to verify you know how to code this basic object-oriented programming feature. You want to print out specific member variables of an object. How do you do this?

Solution
Use this program:

#!/bin/python3

class Computer(object):
def __init__(self,  » Read more..

How Do You Attach a Lambda Function to a VPC?

Problem scenario
When trying to attach a Lambda function to a VPC, you get an error like this: “The provided execution role does not have permissions to call CreateNetworkInterface on EC2”

What should you do?

Solution
1. Go to IAM and create a policy. Use the JSON editor. Use these settings (taken from StackOverflow):

{
“Version”: “2012-10-17”,  » Read more..

How Do You Troubleshoot the Python Error “built-in method strip of str object at 0x7fc87bf4a0f0”?

Problem scenario
You are running a Python program with the “strip” string manipulation method. You get this problem:

<built-in method strip of str object at 0x7fc87bf4a0f0>

What should you do?

Solution
Did you remember to use the parentheses “()” with your strip call?

print(x.strip) can return “<built-in method strip of str object at 0x7fc87bf4a0f0>”

print(x.strip()) will return the intended value.  » Read more..

How Do You Use the AWS CLI to Return IAM Information with the AssumePolicyDocument Nested JSON?

Problem scenario
You want to craft an AWS CLI command to return the principal services of your IAM roles. You want the name and the ARN values of the roles to be printed along with the principal services. You the principal services data is in the AssumePolicyDocument. Your previous attempts have returned “None” for this value. What do you do?

Solution
Run a command like this:

aws iam list-roles –output text –query ‘Roles[*].[RoleName,Arn,AssumeRolePolicyDocument.Statement[*].Principal]’  » Read more..