How Do You Write a Tic-Tac-Toe Program in Ruby?

Problem scenario
You want to write a Tic-Tac-Toe program in Ruby. What should you do?

Solution

# Tic-tac-toe game in Ruby. Written by continualintegration.com.
# We know Ruby is object-oriented. Ideally we will re-write this to encapsulate all logic in objects.
puts “This is a two player game of tictactoe. One person can pretend to be the other player.”
puts “Both players should share a keyboard and monitor.”
puts “The legend for squares in the grid is as follows: ”
puts ” ”
puts “***************************************************************”
puts “ltc is left-top-corner, …

What is a Service in Kubernetes?

Question
A Kubernetes cluster will have a pod running on a node. The ReplicationController will create a copy (or copies) of a pod to ensure it is available. What is a service in the context of a Kubernetes cluster?

Answer
“A Service in Kubernetes is an abstraction which defines a logical set of Pods and a policy by which to access them.” This quote was taken from https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/

A service is a networking service with a static IP address that connects requests to pods in the Kubernetes cluster (page 48 of Kubernetes in Action by Luksa).

How Do You Find the Port Number That GitLab’s Web UI Uses from the Back-end of a Linux Server?

Problem scenario
You have an existing GitLab set up on a Linux server. You have access to the back-end. You want to find the port number to connect to. How do you do this?

Solution
First find the external IP address (e.g., curl icanhazip)

Second, install nmap (e.g., sudo yum -y install nmap or sudo apt-get -y install nmap).

How Do You Prepare for a Job Interview as a Software Engineer?

Question
How do you prepare for a job interview as a software engineer?

Answer
You may want to go to these pages:

Buy books on technical aspects of coding or one that is geared toward technical questions that may be asked. Here are some options:

How Do You Find the Largest and Smallest Numbers in a Python List in O(N^2) Time?

Problem scenario
You want to write a Python program that will accept a list of integers interactively. You want the program to find and print out the largest number and the smallest number of the list entered. You do not want to use the max() or min() functions (which work in Python 3 without importing any library).

What do you do?

Solution

def extremefinder(mainlist):
a = len(mainlist) – 1
b = len(mainlist)
maxnum = 0
minnum = 0
for x in mainlist:
low = 0
high = 0
for y in mainlist:
if (x y):
low = low + 1
if (low == a): # This never evaluates if x == y. …

Many Ways to Optimize an OLTP Database Running PostgreSQL

Updated on 2/1/22
Tuning relational databases and related processes can be somewhat simple or very complex. OLTP databases have many processes governing the usage of resources. Optimizing these and keeping locks granular and efficient in accord with business requirements is key to having high performance and reliability.

Studying the business requirements carefully can allow you to redesign the database and the SQL queries to make things happen more efficiently.

How Do You Install pip on a RHEL Server in AWS?

Problem scenario
You want to install pip on a RedHat Enterprise Linux server in AWS.  What do you do?

Solution
Prerequisites
This assumes that Python has been installed. If it has not, run this command:
sudo yum -y install python3


Procedures

You may want to try these two commands first:

sudo find / -name pip
sudo find / -name pip3

If the above did not help you,

What is the Difference between a Readiness Probe and a Liveness Probe in Kubernetes?

Question
What is a difference between a readinessprobe and a livenessprobe besides how the corresponding fields are used in defining a Pod using YAML?

Answer
At most a failed liveness probe will result in the restarting of a container. At most a failed readiness probe will result in the removing a pod from the endpoint of a service (page 150 of Kubernetes in Action).

How Do You Open a Port to Connect to a GCP server?

Problem scenario
You are used to AWS Security Groups. You created a firewall rule in GCP. You cannot seem to reach the GCP server. What is wrong?

Possible Solution
Does the GCP firewall rule use the same shorthand notation like this?
x.x.x.x/32

Inbound rules in AWS Security Groups use the /32 to allow an IP address to connect to an EC-2 instance or service.