How Do You Fix the Problem of Being Prompted for the Root Password When You Want to sudo as a Given User?

Problem scenario
You try to run a command with sudo and you are prompted for the root user password (not the password for the username who issued the sudo command). You want to be prompted for the user (e.g., jdoe) not root.  What should you do?

Solution
Root cause
sudo is not configured properly.

Procedures
1.  Use the visudo command (with no arguments): 

 » Read more..

How Do You Write a Hello World Program in Node.js?

Problem scenario
You want to write a “Hello World” program using Node.js.  What do you do?

Solution
Prerequisite
Identify the external IP address of the server (e.g., run “curl icanhazip.com” if you have access to the internet).

Procedures
1.  Install node and npm on a Linux server.  If you need assistance with this,

 » Read more..

How Do You Create a Node.js Application to Be Presentable and Usable via a Docker Container?

Problem scenario
You want to create a basic “Hello World” web page with Node.js running in a Docker container.  How do you do this?

Solution
Prerequisite

Install Docker.  If you need assistance, see this posting.

Procedures
1.  Create three files in the same directory on a Linux server.  A possible location would be the home directory of the user that will run the “docker” commands.

 » Read more..

How Do You, in Python, Make a Tuple from a List?

Problem scenario
You are writing code in Python.  You have a list that you want to have a copy of in the form of a tuple.  What do you do to convert the content to a different data type?

Solution
Assuming you have a list called “contintlist”, this line would create a tuple with the content of “contintlist”:

cooltuple = tuple(contintlist)

Here is a Python program that generates a list,

 » Read more..

How Do You Create an Organization in GitHub?

Problem scenario
You want to create an organization in GitHub.

Solution
1. Log into GitHub.
2. Go here: https://github.com/organizations/new

 » Read more..

How Do You Generate 10,000 Random Numbers in a List in Python?

Problem scenario
You want to generate 10,000 random numbers in a tuple.  That is, you want a tuple with 10,000 numbers.  The numbers can be chosen at random.  How do you do this?

Solution
Run this program:
import random
coollist = []
for i in range(1000000):
   coollist.append(random.randint(1,100000))

 » Read more..

How Do You Install kubeadm on Any Type of Linux?

Problem scenario
You want a quick, generic way to install kubeadm on any type of Linux.  What should you do?

Solution
Run these commands:

cd /tmp

curl -Lo kubeadm https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubeadm && chmod +x kubeadm

sudo mv kubeadm /usr/bin/

Test it by running this command: kubeadm version

 » Read more..

How Do You Find the Resource Group Names in your Azure Account?

Problem scenario
You want to use an existing Resource Group name.  How do you find which ones you have created?

Solution
1.  Log into the web UI for the Azure Portal.
2.  On the left there often will be an item “Resource Groups” (under favorites).  Click on it.  If it is not there, search for “Resource Groups”

 » Read more..

How Do You Write Tic-Tac-Toe in JavaScript?

Problem scenario
You want to write a program using JavaScript. You want to play Tic-Tac-Toe. What do you do?

Solution

1. Save the file below as contint.html to your computer.
2. Open a web browser, preferably Firefox.
3. View the HTML file on your computer via the web browser. (e.g., c:\path\to\contint.html)

<!DOCTYPE html<html<body<h2Play Tic-Tac-Toe with Anyone You Can Share a Keyboard With</h2<p</p<p***************************************************************</p<pTo make your mark,  » Read more..

How Do You Use an Unbound Method in Python?

Problem scenario
You want to write a Python program with a unbound method.  What should you do?

Solution
The definition of an unbound method is a method or function that is not part of a class.  Run this program and you will invoke an unbound method:

#!/usr/bin/env python

def unboundexample():
  print(“This function is not bound to a class. 

 » Read more..