Monday, November 30, 2020

Upgrade or downgrade node and npm version with NVM

Hello folks! Hope you all are doing well. In the previous post, we learnt about the basic ubuntu commands. If you havent read that, then give it a try. Today, we learn how to upgrade or downgrade the node and npm version. 

In some cases, the user requires a specific version of node. Suppose you have node of version 14.15.0 and for some task you need node version 12.0.0. In that case, you might think that you should uninstall the version you have and install  the version that is required. 

Rather than doing it manually, you can manage the node and the npm versions using nvm windows. NVM stands for node version manager. Just install the nvm for the windows os and then run the nvm commands on the terminal to manange the node verisons.

NOTE: As you switch to a new node version, its compatible npm version will be installed along with. So just get the required node version and the npm version will be managed respectivly.

Without any further due, lets get to the main point. So for this, go to any search engine and search nvm windows release.


1. Go to the first search result which is the official github repo of the nvm.


2. Then download the zip file of nvm under the assets section. 


3. Unzip the file and install the nvm.exe file 


4. After some basic installation steps, nvm will be installed on your device.


5. Open the git bash/ terminal, and check if nvm is properly installed with this command. 

nvm -v

This command will give the installed version of nvm on your system.


NOTE: With the above command, some basic nvm commands will also be printed and by reading them, you will get a fair idea about the other useful commands to manage node version.


6. Then uninstall the node version you have with the command below. For this, you must know the exact version of your node app. 


nvm uninstall 15.12.0


7. Then install the node version according to your environment using the command below.

nvm install 12.0.0


8. After this, use this command below to use the newly installed version on your system. 

nvm use 12.0.0

This is it. NVM gets really helpful when you have to suddenly upgrade or downgrade the node and npm version. So finally you have achieved what you want to. If you like the post and if it helped you, make sure to share it with our friends. 

Labels:

Sunday, November 29, 2020

Must Know Ubuntu commands for beginners

Hello people! Hope you all are doing good. 

In the previous tutorial, you learned how to create a live bootable USB for ubuntu on windows. Make sure to read that if you want to switch to Linux from windows. If you are a ubuntu beginner and want to learn more about its commands, then this is the perfect post for you.


Ubuntu uses bash as its command-line interface like the command prompt in windows. So let's start with any further due:


1. sudo

sudo means superuser do. This command gives administrative privileges to the user. It is like the "Run as Administrator" command in windows. So if a user would not have access to a specific file and he wants to edit that file, this command should be used.


2. apt-get

This command comes in handy when the user is required to install, update, upgrade, and remove any package. This will save you time as you do not need to do the actions manually. It has some subcommands and let's have a look at them.


a) sudo apt-get update

After the user has installed ubuntu, this is the first command the user needs to run. This will update the database and give info on whether there are new versions of tools available or not.


b) sudo apt-get upgrade

After command a), the user needs to upgrade the installed tools in the database. This command will upgrade all the tools which have newer versions.


NOTE: If the user wants to upgrade any specific tool/ package, then this command should be used. 

sudo apt-get upgrade [PACKAGE NAME]

sudo apt-get upgrade pip


c) sudo apt-get install

Install any package with this command. So before hitting this command, you need to know the package name

sudo apt-get install pip

NOTE: If you don't know the package name properly, just type few letters of the package name and then hit the tab button, it will suggest the names of packages with the letter you have typed. This is like the auto-completion feature.


d) sudo apt-get remove

This command will remove the package but make sure you entered the correct package name. If you don't know the package name properly. 


NOTE: To list down all the packages on your system, use this command:

dpkg --list


Then copy the package name and run the command: sudo apt-get remove the pip

NOTE: The package pip will be removed but its configuration files will still be there. So remove it entirely, use the next command below.


e) sudo apt-get purge

To remove a package completely along with its configuration or data files.

dpkd --list  

Copy the package name and then run the command: sudo apt-get purge pip


f) sudo apt-get autoremove

When a user installs an app/tool, the other dependencies will be installed parallelly. So when you uninstall the app, the dependency will still be there. To remove the unwanted software dependency, use this command. 


NOTE: The user doesn't need to use any package name, as this is a smart command that will automatically remove the unwanted software dependencies that were installed with apps and that are not used by any other app on the system


3. ls 

This command will give the list of all the folders and files of the user's current working directory. 

The user needs to specify the path to the other directories for which they won't see the content.


4. cd

This command comes in handy when the user wants to switch from the current working directory to any other directory. 

cd [FOLDER NAME]

cd Documents


Examples

cd/  - It will take the user to the root directory

cd ..  - It will take up one directory level

cd - -    -It will take to the previous directory

cd documents  - It will switch the current working directory to documents

cd documents\ Blog   -It will open the blog named folder in the documents directory


5. pwd

This will be used to print the full path of the current working directory.


6. cp

Specify the file to be copied and the path to be pasted and you can do the copy-paste job with the command. 

Example: 

cp blog /documents  - This command would copy the blog file and paste it into the documents directory.


7. mv

Move any file to a new location by specifying both the file name and the path.  

mv blog /documents.


8. rm

It will remove the specified file.

Example

rmdir     - It will remove an empty directory

rm -r     - It will remove an empty directory with its content.


9. mkdir

It will create a new directory in your current working dir. To create a dir to a different location, the user needs to specify the directory. 


10. history

This will show the history of the user's previous command up to the history limit.  

Labels:

Saturday, November 28, 2020

How to make a bootable usb for ubuntu

 Hola people!

Hope you all doing well. Today's post a how-to tutorial on How to make a bootable USB for ubuntu. FYI, ubuntu is a Linux distribution that is often recommended for the beginner. 

From my personal experience, if you want to have a good experience with Linux as a beginner, then you should start with ubuntu. 


Without any further due, let's get started. 

1. For this go to the official site of the ubuntu and then download the ISO image of the ubuntu. 

 

2. Then download another tool named "Rufus". This is a free tool that will convert a simple USB to a bootable USB.


3. Use a USB with at least 8GB of storage. Connect it with your system. 


NOTE: The content of this USB will be erased once it gets converted to a bootable USB. So make sure that you have backed-up all the crucial files or I will suggest using an entirely empty USB for this purpose.  


4. So as soon as the Rufus window pops up,  in the device section, ensure that you select your connected USB.


5. Now click on the File System option and choose FAT32 to enable the "Create a bootable disk using" option.


6. Then check the "Create a bootable disk using" option and select your downloaded Ubuntu ISO file. 


7. Then hit the start button and soon the main process will start. 


8. Click "Yes" to automatically download the newer Syslinux files.


9. Now choose the "Write in ISO image Mode(Recommended)" option and click ok.


10. You will be warned that all the files of the USB will be erased from the USB. So you have an option to back up your files at this stage.


Congrats, your bootable USB is ready now. You can use ubuntu whenever you want. Hope this helped all those who want to get started with Linux. In my upcoming posts, I will be sharing some more info on Linux terminal commands, so stay tuned. 

Labels:

Friday, November 27, 2020

Good News: Covid Vaccine Latest Updates

 Hello people!

There is some good news for all of you in this time of hardship. Covid19 cases are increasing daily all around the globe. People are eagerly waiting for their vaccine. Most of the people are afraid of going back to the office without any vaccine. 


Amidst all of this, we have good news for everyone. The Serum Institute of India in collaboration with the AstraZeneca company of Britain is preparing effective covid19 vaccines. The vaccine is named as covishield. 


These vaccines were tested in Brazil and Britain with the proper procedures. The success of these trials raises new hope for both the Serum Institute and the AstraZeneca company. They are claiming that this Covishield vaccine is 90% effective against covid19 without any side effects. 


According to the above organizations, the vaccine given to the volunteers was found 90% effective against Covid19 which is really good news for everyone out there struggling with covid19. Another dose was given after one month, and on average, the covid19 vaccine was 70% effective. 


No side-effects were recorded in the volunteers who were given the dose of these vaccines. Against this world pandemic, it has been accepted as an effective step. This will surely improve the health emergency conditions caused by the covid19. 


Serum Institute of India is one of the largest vaccine producers in the world. Serum Institute in collaboration with AstraZeneca is going to produce one billion of covid19 vaccines soon.


3 Billion Vaccines to be produced

The alliance is trying to produce 3 Billion vaccines by the end of the next year. These coronavirus vaccines will be distributed all over the world. 


23000 volunteers participated

A report has been prepared on the basis of the trial done with the 23000 volunteers. This safety database will be presented for independent review. The alliance is planning to submit this for publication as soon as possible so that the data can be reviewed.


Oxford University thanked all the partners and researchers who helped them to develop the vaccine. 


Labels:

Sunday, November 22, 2020

Normalisation in RDBMS

 Why Normalisation

Normalisation of a data is done to reduce the redundant/duplicate data and making the database free from anomalies like insertion,deletion and updation anomalies. 


It make the queries simple and faster. 

It saves space.

It organises the data base.

It eliminated the duplicate / repeated data.


NOTE: The data that we have must make some sense.


Now what is anomaly?

Ex; suppose there is same data at multiple places, we updated the data at one place but forget to update the data at other cells. Now it will cause trouble for us as we cant conclude which data is correct. As the data is something at one place and something else at another place. 


There are 3 anomalies: Insertion, deletion, and updation. 

Let make it by an example.

Suppose for a new postion in a company, Mr Chintu is selected but his department is not alloted to him in that case if we want to update his info into the database, we have to set the department value as null. This is the case with only one employee.


Similarly if we ahve to set this dept. data for thousands of employees who are in same condition, then this dept data will be repeated for all those thousands of employeers. This is an ex of inssertion anomaly.


2. What if mr chintu leaves the company and no longer he is the head of marketing. In that case, all the employee record has to be updated and if we forget to update any record, this will lead to the data inconsistency. This is updation anomaly.


3. Deletion anomaly- In our employee table, there are 2 columns: Employee and department. At the end of the financial year, if employee records are deleted, the department info is also lost. 


Types of normal form.

1NF - In first normal form, we deal with the problem of atomicity. Atomicity means that the values of the cell are in its most reduced form. Just like the atoms, they cannot be further divided. 

In layman, a single cell must contain a single value to follow the atomicity rule.


NOTE: If a table contains composite or mutlivalued attributes, it voilates the first normal form. 

Suppose in a table, we have employee id, name, phoneno, salary as columns.


Since one employee can have more than one phoneno, so phoneno is amultivalued attributed. So we need to make separed rows to solve this problem. This way we can say that the table has achieved its atomicity. 


2NF- the table is said to be in 2nd normal form if it follows:

*1nf

*The table should not contain partial dependency.


Now what is partial dependency?

The proper subset of a candidate key determines a  non prime attribute.

Now whats a non prime attribute?

Attributes that form a candidate key in a table are prime attributes and rest are nonprime. 

For the table, that we have columns like employee id and department id and the nonprime attribute are the office location.


EX: in the table, employee id and department id makes the primary key. the office location column depends on the department id. So we have to split the table accordingly.

the first table has employment id and department id and the 2nd one has dep id and office location.


The column office location is fully dependent on the primary key  of that table which is nothing but the dep id.


3.)3NF- table is said to be in 3rd normal form if it

* follows 2nf

* no non prime attribute is transitively dependent on any non prime attrubute which depends on any non prime attribute. 

lets make it simple, if c depends on b and b depends on a then ,transitively c depends on a . So there should be no transitive dependency of non prime attributes on other non prime attribute. The non prime attribute should be dependent on the prime attribute.


Ex: in a table, student id determines subject id and subj id determines subjects. so student id determines subj via subj id.  This shows that there is transitive functional dependency in the table and it voilates the 3nf.


What to do?

 Divide the table, one table has student id, student name, subj id and address and other table has subj id and subj. All the non prime attributes are fully functionally dependent on the primary key. 


In the first table columns like student name, subj id and address are completely dependent on student id. Similarly in 2nd table subj only depends on subj id.


4. BCNF- boyce codd normal form. also called 3.5 nf. It is the higher version of 3nf.  Before bcnf , you must know what is a super key?

Super key is a set of one or more attributes(columns) which can uniquely identify a row in a table. Canditate key is the subset of a superkey.


a table is said to be in bcnf if it follows

* 3nf 

*every functional dependency A-> B , then  A has to be  the super key of that particular table.


Ex: in a table , one student can enroll for multiple subjects, there can be multiple teachers for one subject and for each subject a profressor is assigned to the student. all normal forms are followed except. 


This is becuase the student id and subject forms the primary key and the subject  columsnis prime attribute. But there is one more dependency that the professors depends on subjects. while the subject is the prime attribute and the professor is the non prime atttri, which is not the rule for bcnf,.


So we will divide it in 2 parts. one table will contain the sstudent and the professer id. Here we created a new column named professor id. And the other table includes professor id , subj and professor. 


NOTE: by creating a new column "professsor id ", we have removed the non prime attributes functional dependency. In the 2nd table professor id is the super key for that table and remaining columns of it are functionally dependent on it. 




Saturday, November 21, 2020

Car driving tutorial: more about gears

Stuff to do before driving the car:

*Adjust the seat according to visibility and comfort.

*Lock the car doors.

*Ensure you have a learner license and someone who has a permanent driving license. 

*Set front, side mirrors. Clean them.

*Check for the break and fuel.



More about gears:

There are 6 gears in a normal car/four-wheeler. 1,3,5 on top and 2,4 and Reverse gear on the

bottom. 

*Before changing the gears, you have to press the clutch and then change the gear. 

*Then release the gear slowly. 

*If you want to accelerate, press the accelerate button and that too slowly.

*For newbies, it is recommended to drive at gear 1 and 2. 

*On breakers, you have to reduce the car speed. So for this, first press the clutch and then press the brake slowly. 

*Biting point of a car- the point at which the car starts moving forward or backward.


ALERT: Set your mirrors and ensure that there is no one behind you. 

 *Reverse gear- First practice, moving backward linearly. 

NOTE: For this, move back and then press break, move a little back and then press brake and then again move back and then press break.

*This way, practice with reverse gear with different positions of the car and don't forget to wear a seat belt.


Friday, November 20, 2020

Lets swim

 Swimming tips:

1. If you have hydrophobia, take a proper coach for swimming.

2. When you go to the swimming pool, for the first time, feel the water.

3. Our body experiences more resistance in water than in air. So it's really important to feel that resistance as well.

4. The first most important thing to learn when you are inside the pool is  "Breathing"

5. Breathe in when you are in the air and breathe out when you are submerged in water. The main idea behind this is that we will collect the oxygen from the air and then use it when we are inside water. 

6. Do this breathing exercise daily when you enter the pool.

7. After that learn how to float in water. This can be done by learning the movement of your legs in the water. 

8. Then learn arm movements. Learn how to dive(the correct posture). 

9. Practice laps with your friends there in the pool. 

PRO TIP: While making a lapse, your shoulder/arms must make minimum noise. This is the real identity of good swimmers. They don't make noise. 


FOR MOTIVATION: Watch youtube videos: Olympic races of Michael Phelps


10. After this, train yourself for competitions. Start from small like district level or city level.



Lets drive a car!

 Let's drive a car 

Remember: Driving is a privilege but it is not a right


First, let's talk about the car interface.

1. Steering wheel- to control the car and wheel direction

2. Gearbox - to adjust the gear

3. Handbrake- for parking you have to use it

4. Indicator- to turn left/right. Lift Up for left and lift down the indicator for right.

5. Viper indicator- for rainy seasons

6. Mirrors- left, right and rearview mirror

7. Clutch - clutch then break slowly, clutch then gear slowly

8. Break- after clutch, press brake slowly

9. Accelerator- after clutch, press acc


Important points you have to remember

1. Wear a seatbelt.

2. Must have learner/ driver license, insurance.

3. Lock the doors of the car before you start driving.


Thursday, November 19, 2020

create your custom server using nodejs

 In nodejs we donot need any 3rd party software to create a server.

1. HTTP module is required to create a server. So first we will include this.

2. Create a  object for server by using the HTTP  createServer method. 

3. Pass req, res as the parameters of this obj.  

NOTE: Use the ES6 arrow function to reduce the function length

4. Send a response('hello from the server side.') from the server-side.

5. Make the sever listen at a port say 3000.

6. On the sever, show that the server is listening. 

NOTE: use nodemon to check if the server has been created

Labels: ,

Explore the Microsoft sample sql db

 1First of all download, the ms adventure works DB from this site.

2. You have to download the OLTP .bak file. 

NOTE: Download the latest db

3. Now you have to restore the downloaded sample db. You can do this either by command RESTORE or by using the mssql server management studio gui.

4. we will do this by using the gui first. So first move that sample db to the backup folder of sql server.

NOTE: path look like this: C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\Backup


5. Open ssms, connect it to the server.

6. On the left side, right click on the database folder and choose the Restore Database option.

7. Now choose from the DEVICE, click on 3...  (...) 

8. choose the .bak downloaded sample db and press ok..

Finally, you will get a pop up indicating that your sample db is restored.


Till now we downloaded and installed the sample db. Its the time to explore it.

As you click on the database, you will be to see the sample db there. 

1. Click on the sample DB. 

2. Click on the table folder.

3. Then you will get a number of tables. 

4. For example[ HumanResources.Employee]::[schema.Table]

5. Right-click on this table in 4 and click on SELECT TOP 1000 ROWS. 

6. This is gonna print the top 1000 rows from that table. 

7. Practice all the SQL queries you have learned before. 

NOTE: The more you play with the queries and the table, the more you get familiar with how DB management works


Labels:

Resolve MSSQL error : cannot connect to the USERNAME/SQLEXPRESS

 Follow these steps to resolve this error of mssql.

1. When you encounter this error, close the mssql serve management.


2. Press (window +R) , type services.msc and hit enter.


3. A list will appear. Search SQL Server(SQLEXPRESS).


4. As you click on it, click the start button on the top left corner.

5. Now your problem is solved open the mssql server management and you are good to carry your task.

Monday, November 16, 2020

Interview series 1: UI UX

 Typography rules in UI UX:



⚡If you don’t have enough experience or knowledge — don’t use fancy fonts at all. Keep it simple. 

⚡ FONT: Don't mix more than 2 fonts. I will recommend using only one type of font.

NOTE: the key to great design is Contrast

Default fonts are recommended to use for beginners.

 Stick with one font unless you understand that font in its best way.

⚡Maintain proper readability.

⚡ ALIGNMENT- always use justify left alignment. This is more reader-friendly and never indent the first line of a para,

⚡DOUBLE POINT SIZE- a good rule of thumb is to double or half the point size you are using.

If you are using 30 pt type for heading, then use 15pt type for the body.

Labels: ,

Thursday, November 12, 2020

COVID19 - How you should deal

 Symptoms of Corona!





Headache

Fever

Breathing/Oxygen Problem

Loss of smell/taste

Pain in body Joints 

Diarrhea

Focus Problem


If you face 3-4 symptoms from the mentioned above, it's not necessary that you are COVID+ve, but it is an indication that you need to take good care of your body. It's high time to take care of your health and body. 


What's next?

1. Wear a mask, even if you are at home.

2. Wash your hands frequently with warm water.

3. Keep tracking your symptoms and note down them/ or your family can do that. 

4. Keep yourself hydrated.

5. Drink Kadha- (Here is the recipe for Kadha)


What to do if you got a covid +ve?

1. Live in a separate room if possible.

2. Keep your belongings away from other family members like clothes, food, shampoo, towel, etc.

3. Use disposable plates for your food

4. Talk with your parents, friends, relatives or anyone you like.

5. Prefer fresh and hot food like soup 

6. Avoid stale and cold food.


After recovery;

1. Exercise daily for 30 minutes

2. Donate your plasma after proper plasma check.

3. Drink boiled water.

4. Follow the social distancing norm as per govt guidelines.

5. Wear masks. wash hands regularly, take care of your family members.

6. Wear proper full sleeves winter clothes to get rid of winter and mosquitoes.