How Do You Create a GCP VM to Be a Web Server?

Problem scenario
You have a GCP server. You can run curl commands to its URL via localhost. But with a URL constructed with the server’s external IP address the curl command times out. You cannot reach the URL from your workstation. How do you get the GCP server to present the web service to other machines?

Solution
Modify the firewall rule by following these steps below.

 » Read more..

How Do You Install Firefox on a Windows Server with PowerShell?

Problem scenario
You want to install Firefox on a Windows server without using the traditional GUI method. What should you do?

Solution
1. Open PowerShell ISE as Administrator (right click it, go to More -Run as Administrator).
2. Run this script (e.g., firefox.ps1):

# This script was mostly taken from https://forum.pulseway.com/topic/1940-install-firefox-with-powershell/

# www.continualintegration.com changed the version number of Firefox and added some comments
# Silent Install Firefox

# Download URL: https://www.mozilla.org/en-US/firefox/all/

# Path for the workdir
$workdir = “c:\installer\”

# Check if work directory exists if not create it

If (Test-Path -Path $workdir -PathType Container)
{ Write-Host “$workdir already exists” -ForegroundColor Red}
ELSE
{ New-Item -Path $workdir -ItemType directory }

# Download the installer

$source = “https://download.mozilla.org/?product=firefox-58.0.1-SSL&os=win64&lang=en-US”
$destination = “$workdir\firefox.exe”

# Check if Invoke-Webrequest exists otherwise execute WebClient

if (Get-Command ‘Invoke-Webrequest’)
{
Invoke-WebRequest $source -OutFile $destination
}
else
{
$WebClient = New-Object System.Net.WebClient
$webclient.DownloadFile($source,  » Read more..

How Do You Set the S3 Policy to Archive after 60 Days?

Problem scenario
You want items in an S3 bucket to be archived automatically after they are 60 days old. What do you do?

Solution
1. Log into the AWS console.
2. Click on your S3 bucket.
3. Click on the “Management” tab on the right.
4. Click on “Add lifecycle rule”
5. Give the rule a name. Click “Next.”
6.

 » Read more..

How Do You Delete an Aurora Database when You Get an Error about It Not Being Started?

Problem scenario
You are trying to delete an Aurora database but you get this error: “This database is not started.” What do you do?

Possible Solution #1 (with the web console)
1. Log into the web console.
2. Go to “Amazon RDS”.
3. Go to “Databases”
4. Click on the Aurora cluster of the database you want to delete or its parent.

 » Read more..

How Do You Find the Default Directory for Tomcat when It Acts as a Web Server?

Problem scenario
Your Tomcat server is has been configured to serve as a web server. You have access to the back-end Linux server. But you do not know what directory corresponds with the URL of the host. How do you find what the default directory is for files that are presented on the web?

Solution
From the back-end, run this: sudo find / -name index.html | grep tomcat

Look for a WEB-INF or webapps directory.

 » Read more..

How Do You Troubleshoot an Error Such as “UnboundLocalError: local variable ‘foobar’ referenced before assignment”?

Problem scenario
You run a Python program. You receive this message: “UnboundLocalError: local variable ‘foobar’ referenced before assignment”

What should you do?

Solution
Initialize the variable (e.g., foobar = 0). If you do so inside a function wherein foobar, that may work. If you want it to be available globally throughout your program, you will initialize it outside of a function.

 » Read more..

How Do You Troubleshoot Golang Using Hexademical Values?

Problem scenario
Your Golang program has variables with values that look like this:

{0xc4200457e8 [97 49]}

You think the that underlying variables should have regular alphabetic string values. What should you do?

Solution
Use the .string() function.

When you use strings.Builder for a variable, the value will be a hexadecimal value. To retrieve the string value that you intend,

 » Read more..

What Are Some Free SQL Front-end Applications to Install on a Windows Desktop?

Problem scenario
You want a free trial or a completely open source (always free) graphical user interface application to install on your Windows desktop or laptop. What options do you have for a free front-end?

Answer
These GUIs are free or free to start out with an initial trial:

https://www.aquafold.com/aquadatastudio/trialregform
https://www.heidisql.com/
https://dbeaver.io/
https://www.devart.com/dbforge/postgresql/studio/
https://www.pgadmin.org/
https://omnidb.org/en/
https://teamsql.io/
https://download.cnet.com/DbVisualizer/3000-10254_4-10202406.html
https://fishcodelib.com/database.htm

 » Read more..

How Do You Know if Hadoop is Installed (and the version if it is installed) on Linux SUSE?

Problem scenario
You are administering Linux SUSE machines. You want to see if Hadoop is installed on them. The command hadoop version does not work.

Solution
Run this command:

sudo find / -name hadoop -type f

From the results above, you can probably find the file and path of the executable. It will likely not be in /var/ or /tmp/.

 » Read more..

How Do You Troubleshoot the GitLab Installation Error “dpkg: error processing package gitlab-ee…post-installation script returned error exit status 1”?

Problem scenario
You are trying to install GitLab, but you get this error:

“dpkg: error processing package gitlab-ee (–configure):
subprocess installed post-installation script returned error exit status 1″

What do you do?

Possible solution #1
Is Jenkins running on the server? Is a service running on port 8080? Can you stop any process running on port 8080 and try again?

 » Read more..