Tuesday, April 27, 2021

What do the version numbers mean in NPM modules ^ ~

 

A package with the sequence 4.17.4 is interpreted as Major release, Minor Release and patch.

^4.17.4 - keep major version update minor version

~4.17.4 - keep minor version update patch

4.17.4 - exact version

* - latest version

How to find root directory of NPM modules?

 npm root -g

Monday, April 26, 2021

What is XHR?

 XHR stands for XmlHttpRequest object.

This is the traditional way of accessing data asynchronously.

HTML file has a button that we will use to trigger the event.

!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!--<meta http-equiv="X-UA-Compatible" content-->
<meta name="keyword" content="AJAX">
<meta name="description=" content="AJAX example">
<!-- <script type="javascript" async="" src="js/ajax.js"></script> -->
<title>AJAX Example</title>
</head>
<body>
<div class="container">
<button id="button">Get Data</button>
<br><br>
<div id="output"></div>
</div>
<script src="js/ajax.js"></script>
</body>
</html>



<script src="js/ajax.js"></script>

Saturday, April 24, 2021

Where are the macOS commands located? What are /usr/bin /usr/local/bin directories used for?

We have all heard of /usr/bin /usr/local/bin and so on. Do we know how and why they are organized?Let's get started

/bin - user utilities - cd ls cat bash cp pwd - all these are here. Did you know? 

/sbin - s for system program and administration

ping mount reboot shutdown ifconfig - ring a bell?

/usr/bin - non-system programs - 

awk base64 curl emacs find grep ssh php vim perl php python rake rails sed

/usr/sbin - system daemons(background processes) & system utilities only

chown chmod cron httpd sendmail sshd apachectl - sytem utilities that are user specific

/usr/local/bin - The programs installed over the base operating systems due to a dmg file installation or using a package manager might land up here.

Example: Lets say you install mysql it would be installed in /usr/local/mysql/bin. Similarly php would be installed in /usr/local/php

Summary:
/bin and /sbin - commands provided by OS - /bin - consumers /sbin - system administrators
/usr/bin - utilities used by developers
/usr/sbin - utilities used by OS administrators
/usr/local/bin - compilers/executables softwares installed - php and mysql
/usr/local/sbin - administrative commands for softwares installed - Apache restart, mysql server start re-start

We all use cd, ls and many such commands in the macOS Terminal day in and day out. I am better than yesterday after I learnt this today. I know where to search my executables.

Credits & Thanks to :https://medium.com/@jalendport/what-exactly-is-your-shell-path-2f076f02deb4

Are you feeling low? Top 5 ways to live with coronvavirus COVID-19 pademic

COVID-19 made it's may into 2020 and now 2021.

How do I feel about it? It's mixed emotions.

I miss the strangers, the acquaintances, friends, colleagues and buddies I use to spend time with.We are all aging as the day passes by, our friends and family are not limited to only family.

The pandemic has taken a toil on our mental health. We as people are born to be on the move.

I miss the coffee talks, the cafeteria chats, eleventh hour plans and it all comes down to freedom and independence.

We have now seen a series of lockdowns and unlockdowns but our minds have taken a hit.

I am no spiritual healer not a motivational speaker, but here's how I deal with the ups and downs and high's and low's.

1. Read a book:
I wasn't a voracious reader ever, I've managed to be better than I was. Pick up a book, read 5 pages a day.

2. Health:
I wouldn't suggest this to people. I was overweight and still I am, I had a routine to walk ~10,000 steps a day a year before pandemic and I lost 1.5 kgs a month. I continued this for 14 months and I lost ~20 kgs. This story is for another day.

I walk 3 to 4 times a day - 10 to 15 min walk in my room, jog around. This will clear up your mind.

3. Ask yourself, What am I doing? and What should I be doing?
I picked this from a book. We are become mindful with each day, but with each day we add thoughts to the millions we already have. Our whole life is about thoughts.

If you have work to do and you want to focus, question yourself. What am I doing? You'll notice your brain stops for a second, keeps all thoughts aside and becomes blank. Continuously do this the whole day, you will observe a sense of awareness.

4. Pick a hobby:

 Learn something and start writing. Try to enjoy activities with family. If you like to be alone, pick an area of interest, read and write a blog about it like I am doing now.

5. Time your activities:
Time your activities in the day, use a mobile to time them, you should be able to make a 24 hour plan for yourself in a couple of months. This is how I did it. Time a task let's say read a book for 5 mins or 10 mins. Snooze it if you want to continue it for another 5 mins. Eventually you will find that time that suits your concentration levels.

Remember to take breaks and don't let the breaks break you either.

Cheers,

Ajith