Your Digital Companion

Friday, March 24

Why to choose yarn over npm!

Since the domination of Javascript over web began, we developers have been creating and using modules or packages in our projects which make our lives easier.

Packages save us from "reinventing the wheel" and allow reusability in code.

These packages come with their own set of dependencies (other files or libraries that the package requires to function) which may be either flat i.e. just one package or nested dependency - package requiring another package as dependency and so on.

To easily handle packages and their dependencies we have package managers. These allow packages to be installed along with their dependencies and free up our To-Do list of effort required to manage them.

In Javascript we have "package.json" a file we keep track of all packages required for project.

Until now, npm has been the de-facto package manager to be used in Node projects till Facebook introduced us to yarn. Yarn has been gaining a lot of traction mainly in projects using ReactJS.
So let's see the comparison between the two.


npm stands for node pacakge manager and it claims itself to be the world's largest software repository. It is by default installed in a Node project and can manage both local dependencies in a project as well as JS tools required globally. It uses pacakge.json file in project to keep track of dependencies and their versions. The dependencies are downloaded and installed in node_modules folder inside project tree.

npm commands follow the following structure:
npm <command> [args]
To initialise a project by creating package.json file -
npm init
To install all dependencies from package.json -
npm install
To install a specific package -
npm install <package-name>
Example: npm install express

A specific version can be installed by -
npm install [package-name]@version
To uninstall a package -
npm uninstall [package-name]


Now moving on to yarn, new kid on the block introduced to the world by Facebook on Oct'16. Facebook has been using yarn as their dependency manager on production and have now open sourced it. It's the same modules, registries of npm but a different installer - Yarn.

Apart from doing what npm does, yarn outsmarts npm by caching packages that are downloaded once on a system, so you don't have to re-download whole package tree every time you setup. Yarn also parallelises operations to maximize resource utilisation so install times are faster.

Yarn installation -
brew install yarn
To initialise a project by creating package.json file -
yarn init
To install all dependencies from package.json -
yarn install
To install a specific package -
yarn add [package-name]
To uninstall a package -
yarn remove [package-name]

Advantages of Yarn over npm 

1. Yarn has Security-centric design and verifies integrity with checksums for every package installed before execution.
2. We can install packages from either bower or npm without any hassle.
3. Yarn uses lockfile for locking all dependencies following  deterministic approach in package management, i.e. for same package.json all machines will all have same source tree of dependencies installed in their node_modules folder.
4. npm is non-deterministic package manager, which doesn't guaranteed lockfile, and deterministic algorithm for installs.
5. By using yarn we may stay assured that an working install on one system will work exactly the same way on any other system.
6. We can  selectively upgrade specific packages using "yarn upgrade-interactive"
7. Yarn is network resilient, so install won't fail because of a single failed request. Failed ones are retried later on.

Sunday, October 4


This advertising slogan, created by Anuja Chauhan, gained mass popularity, and became a battle slogan and rallying cry. First used by Capt. Vikram Batra during the 1999 Kargil War, it was widely reported in the media. Identify.
Born Tough
Yeh Dil Maange More!
Taste The Thunder
Jiyo Sar Utha Ke

This advertising slogan was coined in 1888 by the founder of which company?

"Good things come to those who wait" was a slogan used by which company in the 1980s? The concept was that even people in a hurry would wait for the product to trickle out of its glass bottle. The same slogan was used by Guinness in the 1990s.

Middle East Airlines, which has a frequent flyer programme called ‘Cedar Miles’, is the national carrier of which country?

Which Asian airline offers these cards for their frequent flyer programme?
Thai Air
Singapore Airlines
Air Asia
Air India

Which Middle Eastern airline has a frequent flyer program called ‘Sindbad’?
Qatar Airways
Gulf Air
Oman Air

Atorvastatin is supposed to be the world's bestselling drug of all time, with more than $125 billion in sales over approximately 14.5 years. Under what trade name is it sold?

Acetaminophen is the name generally used in the US and Japan for what commonly used medicine?

Sildenafil is a drug that was initially studied for use in hypertension and angina pectoris (a heart disease), though it is now used for a different purpose. Under what brand name is it sold?

Friday, June 26

Updating MySQL and phpmyadmin passwords in WAMP Server

WampServer is a popular software stack used for Web development for the Microsoft Windows operating system. Created by Romain Bourdon, it consists of the Apache web server, OpenSSL for SSL support, MySQL database and PHP programming language.

By default on installing WAMP server on a Windows machine,  user  - "root" is created with no passwords.
So  access can be made without any password in this manner:

  • Open the MySQL console in following way -

  • Press ENTER -
  • Which takes to the following view -

To solve this, first of all, password of MySQL root user needs to be updated.
  • Open the MySQL console
  • Run the following command
SET PASSWORD FOR root@localhost = PASSWORD(' <yourpassword> ');

After this, the root user for WAMP MySQL service will be updated with a password and access will require a password.
Similarly, phpnyadmin can be configured for access with a password as:
  • Navigate to WAMP installation directory, generally it is

  • Open 

  • Update values
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

$cfg['Servers'][$i]['password'] = ' <yourpassword> ';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
After this, the access to phpmyadmin panel will be password restricted.

Friday, May 29

Getting started with the Shell

Shell in Linux (or Command prompt for Windows) refers to CLI (Command Line Interface) for providing commands or instructions to Computer.

The definition of Shell goes like this:
shell is a program that provides the traditional, text-only user interface for Linux and other Unix-like operating systems. Its primary function is to read commands that are typed into a console (i.e., an all-text display mode) or terminal window (an all-text window) in a GUI (graphical user interface) and then execute (i.e., run) them.
CLI has been the conventional way of executing instructions on a computer before the folks at Xerox invented the GUI (Graphical User Interface) which later tickled Steve Jobs and Bill Gates to gift the world with Macintosh and Windows based on GUI.
GUI revolutionized Computing because anyone by simple Point-and-Click can get their job done.

If you are a geek and want to boast  your technical prowess CLI is by far the easiest way to do it, just punch in some words and Voila! job is done!!!
Need I tell you that no matter how intuitive or easy GUI is, CLI is way way faster.
Apart from that Shell is very powerfull tool too, you can

  • Install/Uninstall a Software
  • Manage your files/folder
  • Fire up an application
and do a lot of other things.

So lets jump right into the Terminal.
In this tutorial we are going to learn how to gain access or start the terminal, subsequent actions will be covered in later posts.

Starting the terminal in Linux
Just search  for "Terminal" in the Application drawer of your Linux distro and run it, you are good to go!

Starting Command prompt in Windows

  • Search for "Command" in Start menu

  • Press "Windows Key + R" to get the Run dialog box, there in type "cmd" and hit enter


So, now we have started the terminal, we will learn about the various commands in upcoming posts.

Monday, October 27

[git] Add git PATH to Windows

Please ensure msysgit is installed on your local machine.
For setting up PATH, the path to git install is required which is generally "C:\Program Files (x86)\Git"
It can be slightly different depending on type of Machine (x86/x64). Check yours before continuing.

Now open Windows Environment Variables/Path Window

  • Right-Click on My Computer
  • Click Advanced System Settings link from the left side column
  • Click Environment Variables in the bottom of the window
  • Then under System Variables look for the path variable and click edit
  • Add the pwd to git's bin and cmd at the end of the string like this:
;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd
Test it out in PowerShell; type git and see if it recognizes the command.