How Do You Choose a User ID or a Group ID in Linux?

Problem scenario
You are configuring UID and GID values in Linux. You want to have some idea of what values to use. What ranges should you target?

Solution
Use an integer between 3000 and 4999 (inclusive) if you have no other requirements. This range is recommended. To learn more about why this range is recommended, see this external posting.

In Object-Oriented Programming What Is an Object’s Operation’s Signature?

Question
You are learning about OOP. You know object's have operations. You read about operations having signatures. What are signatures?

Answer
An object's operation's signature is the composite of these three things:

  1. the operation's name
  2. the parameter objects the operation accepts
  3. the return value of the operation

(This was paraphrased from page 13 of Design Patterns). To learn more about what a signature is, see these links:

How Do You Troubleshoot Two WordPress Websites when You Expect There to Be Only One?

Problem scenario
You seem to have two versions of a website being hosted. When you log into WordPress and make changes, they aren't taking effect. You notice that the website you have is duplicated with one older version and one newer version. Both are hosted. You use a VPN or proxy tunnel website and find differences in your website. You want to consolidate these. How do you find out what is going on?

Solution
Root cause: there are two servers hosting your website.

Use traceroute in Linux, tracert from a Windows command prompt, or use https://www.uptrends.com/tools/find-ip-address-of-my-website

These tools can help you track down a second web server that is hosting your website.

Did you ever update the /etc/hosts file on a Linux computer or update the C:\Windows\System32\drivers\etc\hosts file on a Windows computer? If one of these files make your website domain resolve to a different IP address, you could theoretically see two different versions of your website.

How Do You Troubleshoot “Warning FailedScheduling … default-scheduler no nodes available to schedule pods”?

Problem scenario
You are running EKS in AWS. You get this message "Warning FailedScheduling … default-scheduler no nodes available to schedule pods". How do you troubleshoot it?

Solution
Verify your nodes are healthy with this command: kubectl get nodes

If you are using EKS, you may need to create nodes. Here is a command to do that (but replace "foo" with the name of the EKS cluster that you have, and "bar" with the name of the node-group you want to create, and subnet-123456 with the subnet you have and "arn:aws:iam::123456789:role/nameofrole" with the ARN of the IAM role that can create nodes):

aws eks create-nodegroup --cluster-name foo --nodegroup-name "bar" --subnets subnet-123456 --node-role arn:aws:iam::123456789:role/nameofrole

# If you want to see what subnets you can choose from, run this command:
# aws eks describe-cluster --name foo --query 'cluster.resourcesVpcConfig.subnetIds'
# If you can remember a pattern in the name of the relevant role (i.e., "foobar"), try a command like this to find the exact IAM role:
# aws iam list-roles | grep -i foobar

The command kubectl describe pods may have you some clues. You may want to see this posting if the worker nodes have an issue with subnet.env. Another related posting is How Do You Get Kubernetes Nodes to Be Ready?.

How Is a Process Different from a Daemon in Linux?

Question
How is a process different from a daemon in Linux?

Answer
A process subsumes a daemon. A daemon is a process that runs for a long period of time (e.g., the duration the server is on). It may require no interaction with a user. A logging process or a web service like Nginx are examples of daemons.

This answer was paraphrased from page 34 of The Linux Programming Interface.

See also:

What Is a Decorator in I.T. or DevOps?

Problem scenario
You have read about decorators in object-oriented programming and in Python. Is there a disambiguation of what a decorator is?

Solution
In object-oriented programming, inheritance allows for an object to change from its class at compile time (according to page 201 of Programming Interviews Exposed). In OOP, the decorator pattern is a structural design pattern (according to the inside of the front cover of Design Patterns) and is a way to modify an object in OOP at run-time (according to page 201 of Programming Interviews Exposed). The intent of a decorator is to dynamically extend an object's functionality (according to page 175 of Design Patterns). The decorator can also be known as a wrapper (according to page 175 of Design Patterns).

In Python you can do object-oriented programming. However a decorator in Python should be thought of something completely different. There are class decorators and function decorators in Python.

"A [function] decorator in Python is a function that takes another function as its argument, and returns yet another function." (This quote was taken from https://towardsdatascience.com/how-to-use-decorators-in-python-by-example-b398328163b.)

"There's been a number of complaints about the choice of the name 'decorator' for this feature. The major one is that the name is not consistent with its use in the GoF book … The name 'decorator' probably owes more to its use in the compiler area -- a syntax tree is walked and annotated. It's quite possible that a better name may turn up." (This quote without the hyperlink was taken from https://www.python.org/dev/peps/pep-0318/.)

How Do You Save All the Emails in Your Gmail Account Locally?

Problem scenario
You want all the emails in your gmail account to be saved. You want the text of the messages searchable, and you want to save the attachments. How do you do this?

Solution

  1. Export your messages to an .mbox format. Refer to the "email" option here: https://support.google.com/accounts/answer/3024190?hl=en
  2. Install Thunderbird.
  3. Install the ImportExportTool NG add-on in Thunderbird. If you need assistance, see this posting.
  4. Import the .mbox file.
  5. Create a folder for the files.
  6. Highlight all the emails once you see them. Right click on a highlighted portion, and go to "Save Selected Messages" -> "HTML Formats with attachments". Then choose the folder created in step #5.
  7. You are done.

How Do You Troubleshoot Vagrant when You Receive “The box you’re attempting to add doesn’t support the provider you requested”?

Problem scenario
You run "vagrant up", but you get one of the following error messages:

The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.

If you're adding a box from HashiCorp's Vagrant Cloud, make sure the box is
released.

Name: foobar/Windows2016
Address: https://vagrantcloud.com/foobar/Windows2016
Requested provider: [:libvirt]
"

"The following settings shouldn't exist: provider"

What should you do?

Solution
Go to your Vagrantfile. Find the "provider" stanza. You need to have a stanza like this (but substitute "virtualbox" for "vmware_fusion" if necessary):

config.vm.provider "virtualbox"