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.
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
Creating the database
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.
Creating and populating the
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
... remaining output omitted ...
More cases to come…
Syntax for string replace operations in BASH:
Find and Replace:
Work with All files in git Repo
add all changed files use the
-A argument on the command line.
git add -A
commit all changed and staged files and changes:
git commit -a
or, if you want to enter a command line message:
git commit -am "your commit message here"
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 email@example.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.
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:
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 firstname.lastname@example.org, the message will be sent to my user.
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