How Do You Use Google’s Cloud Pub/Sub with Python?

Problem scenario
You want to use a Data Analytics or a Big Data tool that publishes messages and subscribes to listening to messages being published. You know GCP has a Pub/Sub tool. You know it supports synchronous and asynchronous messaging. How do you use it with Python?

Solution

  1. Log into GCP via the web UI.
  2. Go here: https://console.cloud.google.com/cloudpubsub/
  3. Click “Create Topic”.

How Do You Install RabbitMQ Server on Any Distribution of Linux?

Problem scenario
You want to install RabbitMQ on any distribution of Linux using the same script. How do you write such a script?

Solution

1.a. If you are using SUSE or a Red Hat deriviative of Linux (e.g., CentOS/RHEL/Fedora), go to step #2.

1.b. If you are using Debian or Ubuntu Linux, read the following. There may be manual steps (often three steps with Ubuntu 18.04 in AWS).

How Is Input Passed into the Python Program in HackerRank.com?

Problem scenario
You wrote a Python program on a Linux machine, and it works by interactively prompting a user for input. You want it to work for HackerRank, but you are not sure how standard input works in their platform. You use this line of code in your program: ‘input(“Enter your input here: “)’ to ask the user for input. This does not work in HackerRank.

You tried rewriting your program to accept parameters when you run it like this:

python foobar.py blue

In foobar.py you have “sys.argv[1]” to accept the “blue” argument.

How Do You Get wget to Work when curl Commands Are Successful?

Problem scenario
You have a URL that works with a curl command (with the -X POST option). You need to get wget to do a POST like curl. You are having trouble getting wget to work. wget returns 403 forbidden errors, but the destination address is the same. It seems as though the source server is different and potentially causing the problem (e.g, by virtue of its IP address).

How Do You Find What Context Your Kubernetes Configuration Is Using?

Problem scenario
You are trying to fix a Kubernetes problem. You read that you need to check the context to solve your problem. How do you determine what context you are using?

Solution
Run this command:
kubectl config current-context

Or try this command:
kubectl config get-contexts

Another command that may be interesting is this one:
kubectl config view | grep -i context

How Do You Troubleshoot the kubectl Error “Unable to connect to the server: dial tcp: lookup ,,, no such host”?

Problem scenario

You run this command:
kubectl get cluster-info

You receive this error message:
“Unable to connect to the server: dial tcp: lookup ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789.yl4.FQDN.com on 172.55.44.33: no such host”

Solution

Possible solution #1
Ask yourself these three questions:

  1. Have you recently destroyed a Kubernetes cluster?
  2. Is the intended Kubernetes cluster running?

How Do You Troubleshoot a Kubernetes Dashboard Message about a 403 Forbidden Error?

Problem scenario
You created an EKS cluster. But when you open a web browser and go to the API endpoint, you get a 403 forbidden error.

The web browser shows something like this:

kind “Status”
apiVersion “v1”
metadata {}
status “Failure”
message “forbidden: User \”system:anonymous\” cannot get path \”/\””
reason “Forbidden”
details {}
code 403

How do you access the web UI in Kubernetes for the first time?

What Does the Phrase Cloud Native Mean?

Question
What does the phrase “Cloud Native” mean?

Answer
It is a descriptive term that that means having the qualities of cutting-edge cloud technologies. In our experience it connotes using microservices and containers primarily with open source technologies. In some ways it is cloud 2.0. Originally cloud computing referred to SaaS and possibly IaaS or PaaS, but now cloud computing is referring to CaaS and KaaS too.

How Do You Troubleshoot a Bitbucket Webhook Invocation to Start a Jenkins Build?

Problem scenario
You have created a webhook in Bitbucket to call a Jenkins URL. You create the triggering event in the repository (e.g., by pushing code or creating a pull request). The build associated with the Jenkins URL does not start.

You manually tested the Jenkins URL, bypassing Bitbucket, with curl -X POST. The invocation successfully starts the build.

In the Bitbucket logs you see “Connection refused” or “403 Forbidden” errors when the triggering event happens to the given repository (configured with the webhook).

What Are The Disadvantages of Using WordPress for a Programming Blog?

Question
What are the drawbacks of using WordPress when you want syntax highlighting for code in your blog?

Answer

1. When you paste PHP code, it will disappear. In Weebly for example, you can paste PHP code and there will be no automatic elimination of it. In Weebly, the PHP code remains as text. You have to get used to this.