How Do You Use Partitions on a Disk and Have Complete Disk Encryption with Ubuntu?

Problem scenario
You want your entire hard disk to have encryption. You want to install Ubuntu Linux with partitions. What do you do?

Solution
Follow these directions, but make sure the second partition (with GRUB) uses 80 MB. To do this, mentally find this command "sgdisk --new=2:0:+2M $DEV" here:
https://help.ubuntu.com/community/Full_Disk_Encryption_Howto_2019

When you get to that command, use this command instead: sgdisk --new=2:0:+80M $DEV
We think the directions above would not work on many systems unless you allocated more space to the GRUB disk. The rest of the directions may be fine.

The LUKS unlock step (in the help.ubuntu link above) seems unnecessary or it may seem tedious if you have a long passphrase. However we recommend you try that step as it applies to the encrypted partitions you created.

How Do You Change Your WordPress Website’s Icon at The top of a Web Browser’s Tab?

Problem scenario
You are using WordPress and you want to change the icon that your website has (e.g., in a tab of a web browser). How do you change the website's icon when you use WordPress?

Solution
1. Log into WordPress
2. Appearance -> Themes
3. Find which theme is active and click "Customize".
4. Click "Site Identity"
5. Click "Select site icon"
6. Click "Upload files"
7. Upload the file you want
8. Then select it after it has been uploaded

What is the Difference between a Bottom-Up Approach and a Top-Down Approach in Computer Programming?

Problem scenario
You have heard of bottom-up programming and top-down programming. How are the two types different?

Solution
A bottom-up programming approach involves composing small sub-solutions into a bigger whole solution. There is an integration of components to make a whole with bottom-up programming. This method can be difficult to create the final, coherent product.

A top-down programming approach involves decomposing a big problem into smaller fragments. These fragments can be modules or chunks. The top-down programming approach involves working with something close to a final product from the beginning (not the modules themselves). This method is more of a "let's try to tackle everything" approach."

For more information, see the following:

https://www.geeksforgeeks.org/difference-between-bottom-up-model-and-top-down-model/

https://www.codingninjas.com/codestudio/library/top-down-vs-bottom-up-programming-whats-the-difference

https://dept-info.labri.fr/~strandh/Teaching/MTP/Common/Strandh-Tutorial/bottom-up-programming.html

https://dept-info.labri.fr/~strandh/Teaching/MTP/Common/Strandh-Tutorial/top-down-programming.html

https://en.wikipedia.org/wiki/Top-down_and_bottom-up_design#Programming

Do “if x in dic” Statements Look at Keys or Values in Python Dictionaries?

Problem scenario
In Python if you test if a value is in a dictionary, does it look at the keys, the values, or both?

For example, you have code like this:

good_kv = {}
good_kv["a"] = 1
good_kv["b"] = 2
good_kv["c"] = 3

if "b" in good_kv:
    print("The value is in the dictionary!")
else:
    print("The value is not in the dictionary!")

print ("testing keys of dictionary above and values of dictionaries below")

if 3 in good_kv:
    print("The value is in the dictionary!")
else:
    print("The value is not in the dictionary!")

Do dictionaries keys, values or both play a role in the equivalence factor?

Solution
In the above examples, only keys are analyzed. Use .items() or .values() to incorporate the values in such for statements and subsequent coding logic. By default only the .keys() of the dictionary will play a role in "if … in" tests.

(As an aside, remember to not put quotes around integers or else they will be treated like strings.)

How Do You Troubleshoot the Kubernetes Pods Error “CrashLoopBackOff”?

Problem scenario
You have a problem with Pods not starting up. They have a status of "CrashLoopBackOff". What should you do?

Possible Solution #1
Can the Pods start in a lower environment with minimal utilization? Being able to reproduce the problem can help. Trying the YAML in an optimal environment can help you pinpoint the error (e.g., traffic may be high in a production environment). Verifying the deployment dependencies are all met can lead to a better understanding of what precisely is needed.

Possible Solution #2
Look at your monitoring of the Pods and relevant nodes. Are the CPU, RAM and disk utilizations looking healthy? Did it used to work? What changed to make it now not work? If it never worked, you should revise your YAML file or look at the image you are using.

Possible Solution #3
Run this command on a Pod with the status "CrashLoopBackOff": kubectl describe foobar #where "foobar" is the name of the Pod
kubectl logs foobar --all-containers # replace "foobar" with the name of your Pod
Run this command: kubectl get events

This possible solution was influenced by https://sysdig.com/blog/debug-kubernetes-crashloopbackoff/

Possible Solution #4
Increase the memory given to the Pods (e.g., in the relevant YAML file).

Possible Solution #5
Is the Pod trying to use a PersistentVolume?

Can you view the logs of the Pod? Are there other details about what could be wrong? Can you view the Deployment logs? If the Pod is coming up, can you enter it and try to figure out what is wrong with the CrashLoopBackOff and/or Persistent Volume?

See also
How Do You Troubleshoot a PVC That Appears to Still Be in Use?

How Do You Troubleshoot a PVC That Appears to Still Be in Use?

Problem scenario
You are working with Kubernetes. A PVC cannot be mounted. It seems like the Persistent Volume is still in use. What should you do?

Possible Solution #1
Find out about the volume attachments with these commands:

kubectl get volumeattachment
kubectl get pv

Find the Pods that use it. Is unmounting working? Perhaps the unmounting process has a problem.

Run kubectl describe pod foobar (where "foobar" is the name of the Pod trying to use the PVC).

Investigate if the volume is getting detached before it is attempted to to be reused by a Pod. If your use case allows you to delete the Pod that was using it previously, you may want to do that.

Possible Solution #2
Change the grace period seconds in the YAML that govern access to it.

"By default, Kubernetes will wait 30 seconds to allow processes to handle the TERM signal. " (Quote taken from https://linkerd.io/2.13/tasks/graceful-shutdown/.)

Experiment with a longer or shorter grace period. A shorter one will mean the TERM signal will be sent sooner. Your subsequent utilization of the PV (with a PersistentVolumeClaim) may then work. Alternatively, a longer grace period may make the series of processes complete without the TERM signal.

Possible Solution #3
Examine your monitoring and logs. Are there problems with networking or the hardware involved? See this external posting.

In Python when Source Code is Used to Create Byte Code, what is the Intermediate Content?

Problem scenario
Python can compile source code. There is a process that happens. What form does the code take in the interim (before byte code is created)?

Solution
Abstract Syntax Tree (according to page 175 of Expert Python Programming by Jaworski and Ziade). There is an ast module that allows you to interact with the Abstract Syntax Tree via its grammar. To read more, see https://docs.python.org/3/library/ast.html.

How Do You Troubleshoot Running a File and Getting “syntax error near unexpected token”?

Problem scenario
You have a file that is in an executable directory. This file allows a user to execute it.

You run a command, but you get something like this as the output:

/usr/bin/foobar: line 1: syntax error near unexpected token `<'
/usr/bin/foobar: line 1: `<html><body>You are being <a href="https://objects.githubusercontent.com/github-production-release-asset-abcd/123456789/1234568d-5290-4412-bb2b-abcd?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=AKIAIWABCD1234%2F20220113%2Fus-east-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20200113T184113Z&amp;X-Amz-Expires=300&amp;X-Amz-Signature=79cfe429ab0794f4ef1234fd567891cc2ae0a0d2513abcdefgaa97b37e681a856&amp;X-Amz-SignedHeaders=host&amp;actor_id=0&amp;key_id=0&amp;repo_id=59522149&amp;response-content-disposition=attachment%3B%20filename%3Dfoobar_linux_arm64&amp;response-content-type=application%2Foctet-stream">redirected</a>.</body></html>'

What should you do?

Solution
Check the contents of the binary file you are running. Is it just text or is it a binary file? You maybe expected a binary file, but accidentally got some incorrect content. It may be worthwhile investigating the download step or the file or program that created the file that is producing the error above.

Where Does the Dollar Sign “$” Come from?

Problem scenario
You are curious why an "S" with a line through it is the sign of the dollar. Where did the cash sign "$" (or dollar symbol) originate?

Answer
It is not clear, but it appears to have something to do with Spanish coinage with "pesos" meaning "pieces" and an abbreviation would be "ps". In smaller coins or on containers, this abbreviation may have been jumbled or pushed the individual letters together closely. The vertical line may have been prominent on a regular basis over the "S." This "ps" abbreviation may have morphed into a "$" sign and eventually recognized as the symbol of money/cash. But there are other theories.

Atlas Shrugged by Ayn Rand suggests it came from the abbreviation of the United States (with the prominent vertical lines of the "U" being overlayed upon the "S"). This origin seems dubious.

See the below links for further information: