How Do You Analyze Java Thread Dumps?

Problem scenario
You run Java programs on your Linux server. You want to view content of Java thread dumps. What should you do?

Solution
Prerequisites
Install Java if it has not already been installed. See this posting if you need assistance.

You may or may not want to learn more about what a Java thread is;

 » Read more..

In Python, How Do You Call a Bound Function as a New Thread with the threading Module?

Problem scenario
You want to write a program to call a bound function in a new thread. How do you do this?

Solution
Run this program (e.g., python foobar.py):

from threading import Thread

class mighty:
def good():
print(“Good”)

def contint():
print(“Hello!”)

if __name__ == “__main__”:
thread = Thread(mighty.good())
thread.start()
thread.join()
print(“thread finished…exiting”)  » Read more..

How Do You Eliminate Unwanted Indentation at the Top of Text in WordPress Postings?

Problem scenario
You are using WordPress for your website. In some text, paragraph blocks you use with the “<Code” syntax on some lines of computer programming code. The first word is indented from the left. You do not want this indenting. What should you do so your code looks like code but does not have this indentation problem?

Solution
Do not use the “Paragraph” formatting.

 » Read more..

How Do You Assign a Variable in JavaScript from User Input?

Problem scenario
You want to read input and assign it as a variable in JavaScript. What should you do?

Solution
Create a .html file, saved directly on your desktop or in a /var/www/html/ directory on a web server, with the follow content to illustrate how to do this (then open it in a web browser):

<!DOCTYPE html<html<body<h2Use JavaScript to Change Text</h2<pThis example writes “Hello in JavaScript from Continualintegration.com!” into an HTML element with id=”demo”:</p<p id=”demo”</p<scriptvar foo = prompt(“Please enter input and press enter”);  » Read more..

How Do You Print the Email Addresses That Bounced after They Were Sent from Your Postfix Server?

Problem scenario
You have installed Postfix (e.g., version 3.2.0) on your Linux server. You know several emails that were sent (or attempted to be delivered) bounced. You want to have a list of those unique email addresses by themselves. What do you do?

Solution
Run this command:

sudo cat /var/log/mail | grep bounce | awk ‘ $0 ~ /@/ {print $5}’ | awk ‘{FS=”to=”;  » Read more..

How Do You Troubleshoot a Bash Script with the Error “No such file or directory”?

Problem scenario
An “if” statement in Bash is throwing an error message “No such file or directory.” What do you do?

Possible solution #1
Replace the parentheses around the arithmetical comparison with double parentheses. Instead of this:

if ( $numlines < 5); then

Use this:

if (( $numlines < 5)); then

Possible solution #2
Replace the “[]” with “(())”.

 » Read more..

How Do You Get Your Linux Email Server to Deliver Email Consistently?

Problem scenario
You quickly set up an email server on a virtual machine in a public cloud. Some emails from the server are being received but some are not being received. What could be wrong?

Solution
1. If you are using Postfix, check the files in these locations:

/var/spool/postfix/private/bounce
/var/spool/postfix/bounce
/usr/lib/postfix/bounce

2. Look at the file /var/log/mail for clues about what could be wrong.

 » Read more..

How Do You Create a Hidden Directory Like the .ssh Directory?

Problem scenario
In users’ directories you run ls -lh and see no .ssh. You can cd into the .ssh subdirectory. How do you create such a directory?

Solution
mkdir .foobar

# Replace “foobar” with the name of your choice.

 » Read more..

How Do You Install GitLab on a CentOS/RHEL/Fedora Server?

Problem scenario
You want to install GitLab on a Red Hat derivative of Linux. What should you do?

Solution
1. Get a CentOS/RHEL/Fedora Linux server with either 3.5 GB of RAM or at least 1.5 GB of RAM and 2 GB of virtual memory. If you need to add more memory (e.g., to an AWS EC-2 instance or a physical on-premise server), this posting can help you.

 » Read more..

How Do You Set up a Send-Only Email (Postfix) Server on a Linux SUSE AWS Instance?

Problem scenario
You have a monitoring tool on a Linux server that needs to send out emails upon certain events happening. You want to install and configure an email server. You need to send outbound emails, but you do not need to receive inbound emails. How do you configure Linux SUSE to be able to send out regular emails over the internet?

Solution
1.

 » Read more..