How Do You Write a Python Program to Test if Integers Are in Order?

Problem scenario
You need to write a Python program to see if a list of unique integers is in order. You can copy the list and sort it to compare the ideal state to the list provided. The program must print out a relevant message if a swap of two numbers can place those two numbers in the correct order. The program must print out if a given number is already in order.

How Do You Configure Nginx to Listen to Messages Sent via HTTP?

Problem scenario
You have Nginx configured. The access logs never pick up any POST message content. You get 405 error messages. What do you do?

Solution
This will send a message payload — but not via POST. It may not work for your situation. To get a message to be sent to a website (a listening web service), craft a URL that does not necessarily exist,

How Do You Solve the Kubernetes Error “networkPlugin cni failed to set up pod network: open /run/flannel/subnet.env: no such file or directory”?

Problem scenario
You run kubectl describe pods. You see a message in the output that says

networkPlugin cni failed to set up pod network: open /run/flannel/subnet.env: no such file or directory.

How do you fix this?

Possible Solution #1
Log into every worker node. Make sure it has /run/flannel/subnet.env with the following four lines:

FLANNEL_NETWORK=10.244.0.0/16
FLANNEL_SUBNET=10.244.0.1/24
FLANNEL_MTU=1450
FLANNEL_IPMASQ=true

(This solution was adapted from https://www.programmersought.com/article/7824768991/)

Possible Solution #2
Run this: kubectl get pods.

How Do You Troubleshoot “/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require’: cannot load such file — winrm-elevated (LoadError)”?

Problem scenario
You run a Vagrant command. But you get this message: “/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require’: cannot load such file — winrm-elevated (LoadError)”

What should you do?

Solution
Run this command:

vagrant plugin install winrm-elevated …

What Is The Etymology of the Terms Level-Trigger and Edge-Trigger?

Problem scenario
You have read about level-trigger and edge-trigger notification mechanisms in Linux. Why are they called level-trigger and edge-trigger? Where do they get their names?

Answer
Electronics and processing electric signals. Edges represent changes to a state. A level state represents the lack of a change. Here is a diagram:

This answer was adapted from the following postings:
https://hackernoon.com/photos/QdWX77c6s5Skk99abuNLlG6AEZZ2-9w23y8s
http://venkateshabbarapu.blogspot.com/2013/03/edge-triggered-vs-level-triggered.html

FFR
Notification mechanisms are components of input and output in Linux.

How Do You Write a “Hello World” Command in Rust?

Problem scenario
You want to write a basic program in Rust to know you have it installed correctly. What do you do?

Solution

  1. Install Rust. If you need assistance, try this command:

sudo curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh

2. Create a file called contint.rs with the following four lines:

// We recommend calling this contint.rs
fn main() {
println!(“Hello World!”); …

What Does the “-> str” Syntax Signify in Python Functions?

Problem scenario
You see Python code with this “-str” syntax. What does it do?

Answer
It is purely for readability. To help your coworkers we recommend using the “-str” syntax if a function returns a string. Otherwise the way to find out is to read the code or temporarily change the code and use type(variable_returned) to show the data type of that which is/was returned.

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