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,

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

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

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

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 know 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]’ …

Can an Apple Magic Keyboard Work with a Windows Computer?

Question
Can an Apple Magic Keyboard work with a Windows computer?

Answer
Yes. An Apple Magic Keyboard will work with a Windows 10 desktop/laptop. It is plug and play too. We tried it with the USB cable initially. After that the wireless functionality was normal. (We tried this in December of 2020.) You can buy a Magic Keyboard here.

Why Do Some Job Descriptions Emphasize Object-oriented Programming?

Question
Why do some job descriptions emphasize object-oriented programming as opposed to procedural programming, scripting or other alternatives?

Background
Some people think that OOP is overused in certain contexts (page 379 of Python 3 Object-Oriented Programming and page 1303 of Programming Python by Mark Lutz). For example OOP may not be ideal for something like regexing (or matching string patterns per page 247 of Python 3 Object-Oriented Programming).

How Do You Troubleshoot the Hadoop Error “Connecting to ResourceManager”?

Problem scenario
You run a Hadoop command, but you get this error:

2020-12-20 18:19:33,706 INFO client.DefaultNoHARMFailoverProxyProvider: Connecting to ResourceManager at /0.0.0.0:8032
2020-12-20 18:19:36,068 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)

You tried restarted the start-dfs script with this command: bash /usr/local/hadoop/sbin/start-dfs.sh

It did not help. You ran “jps” to see if Resource Manager was running.

How Do You Get Permanent Variables Set in the MacOS Terminal?

Problem scenario
You are using a Mac and you want an environment variable to be configured. What should you do?

Solution

  1. From a terminal, run this: echo $SHELL
  2. If you see /bin/zsh modify the ~/.zshrc to have the export statement that you need. You can learn more here.
    If you do not see “/bin/zsh”, update the ~/.bash_profile file to have the export statement that you want.