Template literals, where were you?

Ever since I started work at a new company 4 weeks ago, I’ve been challenged to learn the new paradigms of the Javascript programming language.

Think of me as an OG Javascript programmer who’s still stuck in pre-ES2015 era. I’ve been stuck with jQuery and vanilla JS pre ES6 as my front-end tools for the last 8 years and I’m learning of the awesome tricks that comes with ES6 and any versions beyond it. Part of the reasons I’ve not advanceD is my focus on developing backend solutions using Python and PHP.

One thing that has struck me today is template literals which can achieve the following:

  • Using variables as text placeholders e.g. `Hello ${name}. Are you ok?`
  • No need to concatenate using the plus operator (+)
  • No need to use the plus operator for multi-lined strings. You can write HTML code as is within the back ticks ()
  • Add Javascript expressions such as addition calculations etc

I’m definitely enjoying ES6/ ES2015 and looking forward to tackle ReactJS and VueJS soon.

Change Drupal 8 User Password

Changing the password of Drupal 8 user is easily done using drush. As of this post, the Drush version I’m using is version 9.5.2 and was installed in the project’s directory using composer (composer require drush/drush).

The syntax is:

drush upwd [user]  [password]


drush user:password [user]  [password]

For example, to change the admin user password:

drush upwd admin "another_password"

How to merge Excel Sheets Vertically?

This can be achieved in Pandas using the concat() function. The data frames generated from the read_excel() function are added as a list to the concat() function:

import pandas as pd

df = pd.read_excel('file-2.xlsx')
df1 = pd.read_excel('file-3.xlsx')
df2 = pd.read_excel('file-4.xlsx')
df3 = pd.read_excel('file-5.xlsx')

df_combined = pd.concat([df, df1, df2, df3])

Then finally use to_excel() function to generate the new combined Excel file.

Merge Dictionary in Python

There are two methods but I’ll focus on one that is a trick which merges two dictionaries and creates a new one using the ** character to pass multiple arguments using the dictionary:

x = {'a': 1, 'b': 2}
y = {'b': 3, 'c': 4}
z = {**x, **y}


{'a': 1, 'b': 3, 'c': 4}

Since both keys have the same b key, the last dictionary is considered and added to the resulting merge. In other words, if there are duplicates, the duplicate in the first dictionary is replaced by the duplicate in the second one.

Updating Nodejs

These are three simple steps to update Nodejs in Ubuntu using npm:

  • Clean the npm cache first: sudo npm cache clean -f
  • Install npm’s n module: sudo npm install -g n
  • Update node verison using the n: sudo n stable

Confirm the Nodejs version: node -v


npm itself can be updated in the following way – 

npm install npm@latest -g

Send Data from Disabled HTML Input Field

If you want to disable an input field and but still post it’s data to a database via a back end programming language like PHP, give it the readonly attribute i.e.

<input name="Percentage" readonly="readonly" type="textbox" value="100" />

If assigned the disabled attribute, then it will not be able to post data.

What if you are working with a <textarea> element?

<textarea id="description-text" class="form-control" name="description_change" rows="5" required readonly><?php echo set_value('description_change');?></textarea>

This feature is applicable when there are fields with auto-generated data and should not be tampered with while typing data.


Install Any pip Package Globally – Linux

Instead of the package installing in:


and install it globally and have it accessed from any Linux user, install it with sudo -H flag. For example:

sudo -H pip3 install seaborn

The above installs it in /usr/local/lib/python3.5/dist-packages and is accessible globally by any user or Python application.

This issue arose when I was trying to run a Jupyter notebook. There was a missing seaborn Python package but it was only installed in the .local folder of the logged in user (/home/user/.local).

Set Local Time on Ubuntu Server

To set an Ubuntu server instance to local time, simply type this command:
sudo dpkg-reconfigure tzdata

You’ll be greeted by a similar screen to this one (as of this post, I’m running Linux ubuntu-xenial 4.4.0-93-generic/ Ubuntu 16.04.2 LTS):

Linux Timezone Setting
Linux Timezone Setting

Select your geographic region and then your city/region corresponding to your timezone.