Install LAMP on Ubuntu 16.04

Download XAMPP/LAMPP (Linux + Apache + MariaDB + PHP + Perl) from Apache Friends: https://www.apachefriends.org.

Change the permissions to the installer
chmod 755 xampp-linux-[your version type and number goes here]-installer.run

Run the installer
sudo ./xampp-linux-*-installer.run

To start LAMP
sudo /opt/lampp/lampp start

To stop LAMP
sudo /opt/lampp/lampp stop

Graphical tool to manage your servers
cd /opt/lampp
sudo ./manager-linux.run (or manager-linux-x64.run)

Check installation
Type http://localhost in your web browser.

Change ownership of htdocs
sudo chown -R username:username /opt/lampp/htdocs [Replace username with your own username]

Update httpd.conf file
sudo gedit /opt/lampp/etc/httpd.conf

In the file, find the following lines:
User nobody
Group nogroup

Replace nobody with your username and save the file.

Now you can create, delete, and manage files / folder in htdocs folder. To test it, open the opt/lampp/htdocs folder and create some files.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Share and Enjoy
  • Facebook
  • Twitter
  • LinkedIn
  • del.icio.us
  • StumbleUpon
  • RSS
  • email
  • PDF

Open File in Application From the Terminal

Sometimes I want to open a file in a specific application from the terminal. Using Linux, there are two easy options.

application-name filename
The first option is to type the application name followed by the filename. For example, to open a JavaScript file in Sublime Text or an HTML file in Google Chrome I type the following:
subl script.js
google-chrome index.html

However, sometimes you don’t know the exact name of the application. In these situations, xdg-open is useful.

xdg-open filename
A second options is to type xdg-open followed by the filename which opens a file in the preferred application for files of that type. For example, if I want to open a JavaScript file or an HTML file in my preferred application, I type the following:
xdg-open script.js
xdg-open index.html

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Share and Enjoy
  • Facebook
  • Twitter
  • LinkedIn
  • del.icio.us
  • StumbleUpon
  • RSS
  • email
  • PDF

Create a global .gitignore file

You can also create a global .gitignore file, which is a list of rules for ignoring files in every Git repository on your computer. For example, you might create the file at ~/.gitignore_global and add some rules to it.

# Declare the global .gitignore
git config --global core.excludesfile ~/.gitignore_global

# Create the .gitignore_global file
touch .gitignore_global

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Share and Enjoy
  • Facebook
  • Twitter
  • LinkedIn
  • del.icio.us
  • StumbleUpon
  • RSS
  • email
  • PDF

Copy and paste data into R

How can I copy and paste data into R? For example, you see a small data set on the web, perhaps in a blog or here on StackOverflow, and you want that data set in your R session. This is a common task for many of us, and there are several ways to go about. Below I present a solution based on this blog post that I have found useful.

First, copy (e.g. “⌘ + C”) the data set.

Then, paste (e.g. “⌘ + V”) to create an R character vector:
x <- " A B C D
1: 2 2 5 3
2: 2 1 2 3
3: 3 4 4 3"

Next, use the read.table() function:
y <- read.table(text = x, header = TRUE)

Done! The data is now in a data frame:
class(y)
[1] "data.frame"

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Share and Enjoy
  • Facebook
  • Twitter
  • LinkedIn
  • del.icio.us
  • StumbleUpon
  • RSS
  • email
  • PDF