Absence of Religiosity and Negative Outcomes

Coursera Data Analysis and Visualization Week 1

According the Gallop Organization religious devotion and practice is in decline in America. It is my assumption that adults who are not religious will not transmit religiosity to their children. If this is the case, it could have an effect on the positive and negative factors associated with religion.

Using the National Longitudinal Study of Adolescent Health (Add Health) survey results – a representative sample of adolescents in grades 7-12 in the United States –  I seek to answer the question of whether or not religiosity is associated with negative outcomes (defined later). If religion is negatively associated with negative outcomes, we can then expect this trend in religiosity to be beneficial for individuals.

However, if the opposite is true (i.e. religion is positively associated with negative outcomes – i.e. protective against negative outcomes), this research could start a discussion concerning this trend in the American population regarding religiousness.

Continue reading

SQLite3 Database Quick Create with Bash

In this post, I will document a couple of cases where one can quickly create an SQLite3 database by issuing commands in a Bash shell (the default terminal shell in Linux and Mac OS X).

Case 1: Create a database with a table for images containing rows/tuples with the image url and a caption for the image. The images are in a directory located in resources/img/gallery, and the database will be stored in a directory at resources/sql.

Creating the database

touch resources/sql/img.db.sql

The touch command is used to change (update) the given file’s timestamp, but if the file (in this case resources/sql/img.db.sql) does not exist it will be created. Now, to make things easier to fit and read on a single command line, I’ll create a Bash variable the stores the command to access the SQLite3 database.

db='sqlite3 resources/sql/img.db.sql'

Creating and populating the img table

echo "CREATE TABLE img (url TEXT, caption TEXT);" | $db

for x in `ls resources/img/gallery`; do
echo "INSERT INTO img (url,caption) VALUES ('resources/img/gallery/$x','Insert Caption...');" | $db

Now the table should be created and populated with the desired content (captions to be inserted at a later time).

echo "SELECT * FROM img;" | $db
resources/img/gallery/0001.jpg|Insert Caption...
resources/img/gallery/0002.jpg|Insert Caption...
resources/img/gallery/0004.jpg|Insert Caption...
resources/img/gallery/0006.jpg|Insert Caption...
... remaining output omitted ...

More cases to come…

Setup a Postfix Alias Email Account

Recently, my business had the need to create an email account for general inquiries. Since I’m currently the only employee, the email will be sent to me, but I’d like to publish a contact email address in some instances rather than my personal email address.

The email address I decided to publish rather than my own was contact@lakonacomputers.com. In order to avoid setting up an user account on the mail server for a user named contact (and creating a mail store for the user), I decided to create an alias for contact and set myself as the contact user. This way, when email is received by Postfix for contact, the email will be sent to my mail store in my user directory.

The Configuration

First check the main.cf file (located at /etc/postfix on my Ubuntu server) to find the alias file configured for Postfix. Look for the following lines.

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

This tell us where the aliases file is located, so we open the file and you will see something like this:

# /etc/aliases
mailer-daemon: postmaster
postmaster: jason
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: jason
www: root
ftp: root
abuse: root
noc: root
security: root

I simply added contact: jason to the file and then run the newaliases command to inform postfix of the update of aliases file. Voila, now when messages are sent to contact@lakonacomputers.com, the message will be sent to my user.

Basic iptables Firewall

The iptables software is a user space application for configuring packet filtering in the Linux kernel. iptables is used to set rules for packets that travel through a host’s network stack and at certain points, called hooks, the iptables rules are evaluated and actions, such as dropping a packet, can be executed. In this post I will draft a script to setup the iptables’ rules for a firewall and then set that script to be executed at boot time. Continue reading