Default Apache virtual host file in Ubuntu

I was asked the other day ‘How does the default Apache virtual host file looks like?’ I was having my Peruvian coffee and decided to place below the default Apache virtual host file in this post for any future reference.

<VirtualHost *:80>
    ServerName www.example.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Super simple. Enjoy and remember to keep coding with coffee!

Linux File Systems ext2, ext3 and ext4

While having coffee at home I decided to put this table together regarding Linux File Systems and their differences. Let me know if I’m missing something.

Ext2Ext3Ext4
Stands for Second Extended file system.Stands for Third Extended file system.Stands for Fourth Extended file system.
Introduced in 1993.Introduced in 2001.Introduced in 2008.
This was developed to overcome the
limitation of the original ext file
system.
Starting from Kernel 2.4.15 ext3 was available.Starting from Kernel 2.6.19 ext4 was available.
Does NOT have journaling feature.Allows journaling.Supports huge individual file size and overall file system size.
Maximum individual file size can be from 16GB to 2TB.Maximum individual file size can be from 16GB to 2TB.Maximum individual file size can be from 16 GB to 16 TB.
Overall ext2 file system size can be
from 2TB to 32TB.
Overall ext2 file system size can be
from 2TB to 32TB.
Overall maximum ext4 file system size is 1 EB (exabyte).

API requests types brief explanation

API is an Application Programming Interface which is a way that allows communication between two applications using a set of rules. While having a great coffee from Bolivia I found the following API requests types.

The main Web Service APIs are:

  • SOAP (Simple Object Access Protocol) uses XML to transfer sets of information in the form of objects. Created by Microsoft in 1998.
  • XML-RPC was developed in 1997. It uses identifying tags similar to HTML and provides a rigid way to structuring data.
  • JSON-RPC was developed in 2001 and is derived from the JavaScript language. Similar to HTML its easily human readable, but can be condensed to reduce file size. JSON is now one of the most popular type of request APIs used.
  • REST (Representational State Transfer) Mainly a set of HTTP verbs. GET, POST DELETE, PUT handle the management of the server’s resources.

I hope this information about API requests types is helpful. You can also contact me if you have questions.

Difference between Inner Join and Outer Join in SQL

An inner join it is the most common kind of join, so common that SQL doesn’t actually make us say “inner join” to do one.

An outer join returns a set of records or rows that include what an inner join would return, but also includes other rows for which no corresponding match is found in the other table. There are 3 types of outer join:

  • Left join
  • Right join
  • Full join

Copying files rsync Linux use of “/” at the end of path

Hello, sometimes we need to copy files and we are not sure when to use “/ ” at the end of the path. Copying files rsync while brewing coffee at home this is what I found. Check this useful summary:

Continue reading “Copying files rsync Linux use of “/” at the end of path”

Activate File Sharing via Terminal macOS

The other day I only had access to my secondary Mac (mac mini) via the Terminal. For some reason Screen Share did not work. I needed to enabled File Sharing on my mac mini in order to transfer some backup files from my MacBook Pro to the mac mini. Coffee was brewing!

This is how I activated File Sharing via the terminal on the mac mini. I ran these two commands:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist

and then this one:

sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist EnabledServices -array disk

I was then able to see the shares on my MacBook Pro. This approach is good for home use because in this case we are sharing all folders in the mac mini.

If you like to disable file sharing via terminal again run this command:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.smbd.plists

How to Change Root Password in Ubuntu Linux

The root user is disabled by default in Ubuntu. This does not mean the account was removed. After researching while having amazing coffee from Latin America I found the following…

If for some reason, you need to enable the root account, all you need to do is to set a password for the root user. In Ubuntu, you can set or change the password of a user account with the passwd command.

To change the root password you need to run the following command as a sudo user:

sudo passwd root

You will be prompted to enter and confirm the new root password.

Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

That’s all! Now you can login to the Ubuntu system as a root. This is not the recommended way. You should always use a sudo user account instead.

What is a session in Google Analytics?

A session is defined as a group of interactions one user takes within a given time frame on your website.

For example a single session can contain multiple page views, events, social interactions, and E-Commerce transactions. A single user can open multiple sessions. Those sessions can occur on the same day, or over several days, weeks, or months. As soon as one session ends, there is then an opportunity to start a new session. There are two methods by which a session ends:

  • Time-based expiration:
    • After 30 minutes of inactivity
    • At midnight
  • Campaign change:
    • If a user arrives via one campaign, leaves, and then comes back via a different campaign.

By default, a session lasts until there’s 30 minutes of inactivity, but you can adjust this limit so a session lasts from a few seconds to several hours. See suggestions by Google in this link.

Fixing Outdated WooCommerce Templates

Most theme authors fix themes in a timely manner, but others won’t 🙁 . There are times you will need to update WooCommerce templates yourself. Its easier than what you think, but it may take you some time.

You need to determine what templates to update, make a backup of old templates and then restore any customizations.

Go to WooCommerce > Status> System Status. Scroll to the end of the page where there is a list of templates overridden by your theme/child theme and a warning message that they need to be updated. For example <aTheme>/woocommerce/cart/cart-totals.php version 2.2.0 is out of date. The core version is 2.3.0 and so on...

Before you do anything .Save a backup of the outdated templates!

Copy the default template from wp-content/plugins/woocommerce/templates/[path-to-the-template] and paste it in your theme folder found at: wp-content/themes/[path-to-theme]

It may take you a while to complete the entire process, but sometimes we have no choice.

If this issue keeps going with future WooCommerce updates and your theme keeps breaking consider changing your theme for a better supported one.

Contact me if you need help making these changes.

Install mkpasswd Ubuntu

Hola,

I ran into the below issue while trying to install mkpasswd

sudo apt install mkpasswd

Reading package lists… Done Building dependency tree Reading state information… Done E: Unable to locate package mkpasswd

Turns out that mkpasswd is a utility part of the whois package. So, in order to get mkpasswd you have to:

sudo apt install whois

To confirm mkpasswd is installed you can run:

which mkpasswd

You should get the following:

/usr/bin/mkpasswd