Thursday, December 31, 2020

Data Normalization in SQL

Why Normalization

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


It makes the queries simple and faster. 

It saves space.

It organizes the database.

It eliminated the duplicate / repeated data.


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


Now, what is an anomaly?

Ex; suppose there is some 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 example.

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


Similarly, if we have to set this dept. data for thousands of employees who are in the same condition, then this dept data will be repeated for all those thousands of employees. This is an ex of an insertion 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 the first normal form, we deal with the problem of atomicity. Atomicity means that the values of the cell are in their 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 multivalued attributes, it violates the first normal form. 

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


Since one employee can have more than one phone no, so phone no is a multivalued attributed. So we need to make separate 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 a partial dependency?

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

Now, what's a non-prime attribute?

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

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


EX: in the table, employee id and department id make 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- the table is said to be in 3rd normal form if it

* follows 2nf

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

let us 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 nonprime attributes on another non-prime attribute. The nonprime 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 a transitive functional dependency in the table and it violates the 3nf.


What to do?

 Divide the table, one table has student id, student name, subj id, and address and another table has subj id and subj. All the nonprime 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 the 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) that can uniquely identify a row in a table. A candidate 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 professor is assigned to the student. all normal forms are followed except. 


This is because the student id and subject form the primary key and the subject columns is a prime attribute. But there is one more dependency that the professors depend on subjects. while the subject is the prime attribute and the professor is the non-prime attributes, which is not the rule for BCNF,.


So we will divide it into 2 parts. one table will contain the student and the professor's 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 "professor id ", we have removed the non-prime attributes functional dependency. In the 2nd table professor id is the super key for that table and the remaining columns of it are functionally dependent on it. 


Wednesday, December 30, 2020

XSS Cross site scripting

 

XSS stands for cross-site scripting. It is a common web security vulnerability. In this type of vulnerability, the hacker targets the script embedded in a page on the client-side rather than on the server-side. 


Basically, a web page is manipulated by the hacker which in turn returns a malicious javascript to the user. When the malicious js code runs in the victim's browser, the attacker can get full access and special control over what the user is having. 


Types of cross-site scripting:

Reflected

Stored

DOM-based


Reflected CROSS SITE SCRIPTING

This type of cross-site scripting is very easy and most common to understand. Consider a case, the user made a GET request to the browser. In the respective response, some data will be sent to the user. Let us say that this comes out to be an HTTP response. 


EXAMPLE:


The app didn't process the data. That is why it is vulnerable to cyber-attacks. If the user visits/clicks this malicious URL, the script is loaded/executed in the browser. The script can carry out any action, it can collect the sensitive data, to which the user has access to.


NOTE: The HTTP responses should be processed and encoded to prevent this type of attack.


Stored cross-site scripting

This type of cross-site scripting occurs when the app receives data from an untrusted source and adds/ included that data to the HTTP response later on when a GET request is made. 

Ex: comments on a blog post, user nicknames in a chat room, contact details on a customer order., a marketing social media post, any mail, etc. 


DOM-based cross-site scripting.

This vulnerability occurs when an app contains client-side js that processes the data from an untrusted source. 


Reference: Portswigger.net


Saturday, December 26, 2020

EOS01 - ISROl's first launch of 2020

 EOS01- Earth observation satellite 01

ISRO had sent a communication satellite  GSAT30 in space in Jan. This was done using an Ariane Rocket launched from French Guiana. 


There are approx 12 countries that can launch their satellites on their own. Also among these 12, there are a few who regularly launch satellites. Some are there who launch satellites in 3 or 4 months. 

For ex- Iran new Zealand etc

A lot to know and a lot to discuss as always. So invest in the future and invest in yourself with a guiding point iconic course.


NOTE: Amazonia-I is going to be launched in February 2021 by ISRO. It is the first Earth Observation satellite of Brazil


What is the benefit of EOS?

EOS earth observation satellites are way better than google maps. We can see crystal clear images of the earth like farming fields, beaches, lakes. Earth observation satellites are mostly used in the cases of earth mapping.


FYI: The former name of EOS01 is RISAT- 2BR2. It is an X-band synthetic aperture radar-based all weather earth imaging satellite. The EOS was launched with PSLV C49. The cost of eos01 is 125 crore (18million). Along with eos01, 9 foreign satellites were also launched. 


Lithuania -1

Luxembourg- 4

USA -4


Q-What is x band synthetic aperture?


Friday, December 25, 2020

CMS01

 CMS O1 

Covid 19 became a blockage for many ISRO Plans. They have to delay a lot of their projects and plans for this year.  CMS01 satellitite is the second mission achieved by ISRO this year. CMS01 is a communication satellite. In november PSLV C49 was sent in november. The cms01 is launched with the help of PSLV C50 /CMS01.


a lot to know and a lot to discuss as always. 

CMS01 is an extended c band communcation satellite.

It is sent to a geostationary orbit. 


Lets first talk about PSLV C50 

CMS01 is the 77th launch vehicle launched from sriharikota.PSLV stands for polar satellite launch vehicle. PSLV is 44 m high and has 4 stages with 6 strap on booster motors onto the first stage which gives it a higher thrust. 


Now lets have a glance on cms01!

You must have studied about electromagnetic waves. There are 7 types of waves in electromagnetic waves. Radio, micro, infrared, visible, ultravoilet xray, and gamma. The wavelength decreases in the given order above. But the frequency increases. Stuffs can be penetrated fastly. 


4G is less than 1 MHZ

5G works between 2 -3 Ghz frequency.

 C band starts after 4ghz.


cms01 is going to provide extended c band sevices. It will improve the coverage in other parts of the country. The weight of cms01 is 1410 kg. There are many types of satellite like Earth observation(mapping to find resources), communication, etc. Communication sateelites are placed in geostationary orbits. It is going to replace the GSAT12 satellite. GSAT satellite was launched on 15 july 11. gsat12 serverd for 9 years. Now it is going to be replaced by cms01. The expected life of cms02 is 7 years or more. 


EOS- earth observation satellite 

CMS- communication satelllite


The next launch is going to be soon. 3 sattellites will be launched in the next mission. A startup named Pixxel india made a satellite called anand. The 2nd satellite is made by Space kidz india and the 3rd one is made by a university consortium called (unitysat).


what is extended c band?

what is strap on booster motors?

What is thrust?

Whats a payload?

Wednesday, December 23, 2020

Struggle of a #Youtube Content Creator , credits: Crazy deep

 This post is inspired by 2 content creators: Carryminati and Crazy deep. Everyone knows to carry bhai but there  are a few who know about deep bhai. 

So I watched a video and got some inspiration from there and here I am curating the post with some great takeaways. Hope you like it.

Everyone says this or that person got success. But no one is interested to know the journey behind it. The journey full of failures , journey full of rejections, humiliations, .No one cares regarding this. 

So now I am going to tell you a story. A story about breakups , a story about rejection. It is not that relationship breakup. Leaving of girl is not only thing which is called breakup. 

Breakup of dreams, leaving of parents, splitting of hopes and aspirations, all these are breakups. 


So, it all starts with a day when a creator decided to do something good. He decides to create a content. He says- "I can also do this". Suggestions started coming that all this youtube content creation needs setups, camera and a lot of investments. 

No pc, no laptop, no system. Still he tried to edit and make content with mobile. All what he said"I will edit with mobile".


NOTE: Long journeys are never straight. we will face a lot of ups and downs there. 


While recording his videos, one or other came making a noise. A lot of distractions came and went. But being firm by mind, he didn't stop. 


NOTE: Being optimistic is the first chapter of winning. But this chapter comes frequently in the book of life.

His dad scolded him on using youtube. I  think every content creator can understand this. I connected this and hope you will also connect with this.

He took out time and find space. His hard work started showing good results. Someout with his hard work and by gods grace, he completed 100K subscribers. Now it was the time to celebrate all that hard work and sweat.

He bought a new editing pc. From here he went to a relationship with his girlfriend. Then comes the end of the relationship. This broke him very deeply from inside. He started consuming alcohol and started smoking. This depressed and demotivated him a lot.


NOTE: A person can fight with others but cannot fight with himself. Breakup of dreams, leaving of our loved ones, shatters our heart. It all brings us to a hault/ pause. But a creator doesn't stop. 


Then comes the fake positivity. Then comes the time when he has to give a fake smile in his videos. Because no one would like to watch a weeping sad artist. 

NOTE: A creator fights with his family, leaves his friends for his work but at the end he gets satisfaction when he sees his work. 

Being a creator is a really great thing.Years of struggles and sacrifices is required if you are from a middle class family. This story is dedicated for all the hard working creators out there, who work all day and night to make great content. 

#weloveyou

When we feel low or demotivated, we watch videos and listen songs or play games. All these things are created by the content creator. We use their content in times of hardships to get some hope or motivation. In the same way, the creators feel happy and motivated when they see the comments, love and support of their audience or viewers. 

So that is it. I will be back with such amazing stories soon.


This is Vikas Singh.Signing off .

Thursday, December 10, 2020

Programming contests that every programmer should know about

Google CodeJam

It is Google's longest-running global coding contest. It has rounded. It's first or qualifying round is of 27 hours. You just have to score 30 marks out of 100 marks to qualify for the next round. The registration will start from February 2021. So you must register before the registration ends. Programmers of all levels compete to improve their skills.  

2021 Schedule

Registration opens on Feb 17 2021, 00:30 (GMT+5:30) and will remain open until Mar 28 2021, 07:30 (GMT+5:30)


Next round

Qualification Round 2021

Mar 26 2021, 23:00 (UTC)

27 hrs


Google Kickstart

It consists of 8 rounds. From Roud A to round H. Each round is for 3 hours. The top contestants get calls for interviews from google itself. Apart from this, the winners are awarded cash prizes. It is an individual contest. You can take part in one or all online rounds held throughout the year.


2021 Schedule

Registration opens on Feb 9 2021, 21:30  and will remain open until Nov 14 2021, 11:30 


Google HashCode

It is also organized by Google. But it has only 2 rounds. The first one is the online qualification round and the second is the virtual world finals 

It is a team competition organized for students and professionals. 


2021 Schedule

Registration opens on Jan 7 2021, 22:30 (GMT+5:30) and will remain open until Feb 22 2021, 16:30 (GMT+5:30)



Facebook Hackercup

It is organized by Facebook annually. It has 5 rounds including the qualification round. It is completely open to all participants around the world. If you like to solve algorithmic problems and you also love mathematics, then you must give it a shot. 


Everyone who solves at least one problem in round 2 will receive a Facebook Hacker Cup t-shirt. The top 200 competitors from Round 2 will have a "Top 200" badge on their T-shirts.

The qualification round starts in July most of the time. 


ACM ICPC

ACM ICPC is called the Olympics of programming. It has mainly 3 rounds. The online qualification round, the regional round, and the world final rounds. It is a team-based contest. You need to have 3 members at maximum and 1 as a reserve. So all the 3 members should be individually good at solving mathematical and algorithmic problems. 


So these are some of the prominent programming contests, every programmer should know and give it a try at least once. So in the comments tell me, for which contest you are preparing for!



 

Friday, December 4, 2020

Best thing to do after installing Ubuntu

Hey people! Hope you are fit, healthy, fine, and doing good in your life. In my previous post, we learned about some cool tools best suited for ubuntu beginners. This time I am sharing some tips for the ubuntu that will increase their productivity. 


So, First things first, whatever you do, there should be some purpose behind it. Now that if you have installed Ubuntu or any Linux distro, you must be thinking about your next step. If you are a gamer, then you must be downloading games and configuring the system graphic card, if you are a developer, then you must be downloading vs studio and other IDE for the development purpose.


1. So some people say that after installing any Linux distro, you should first update and upgrade the tools and the other applications. But according to me, before that, you should enable the additional repositories. 


For this, just search for "software and update". Then the canonical Partners option will be enabled and soon all the additional repositories will be enabled.


2. Update and upgrade 

After this, update and upgrade the system. There is no doubt that an updated system is the best one to work. This can be easily done with some of the simple command lines. 


Command: 

sudo apt update

sudo apt upgrade

sudo apt dist-upgrade


Then you must be asked to press y or n to complete a specific update or upgrade. So press "y"

in that case. 



 3. Install the latest graphic driver

 If you are a voracious designer and a gamer, then this is kind of a compulsory task to perform. For this, you must check the availability of the respective drivers for your hardware. 

So do this way "Applications Overview>> Software & Updates>>Additional Drivers>>Install /Apply changes"


4. Customize the Gnome Shell

If you love to customize stuff and all, then you must install the "Gnome Tweak Tool". This will help you to change and customize the fonts, the window style, animations, GTK themes, icons, and a lot of amazing things. 


Command:

sudo apt-get install gnome-tweak-tool


5. Install the Gnome Shell Extension

This will help you to make your Linux development environment much more awesome, fantastic, and visually appealing. For this extension to be installed, you must activate the Gnome Tweak Tool.

Command:

sudo apt-get install gnome-tweak-tool


These gnome-shell-extensions are similar to the add-ons and extensions of chrome, firefox, and opera mini. So you need a browser for the successful installation of these extensions. These extensions are so thrilling and appealing that you haven't imagined about. 


6. Install and Use the GTK and icon themes

There are a lot of fabulous gtk and icon themes. You may feel dull while working with the default themes and icons of your Linux distro. So to get rid of this, use the gnome tweak tool to install the gtk and icon themes. 


Command:

sudo apt-get install gnome-tweak-tool


NOTE: after the installation of the gtk themes via the tweak tool, you can follow the instructions on how to install themes in Linux or your respective distro.


7. Enable night mode

I don't know about the other Linux distros but Ubuntu provides a blue filtered night mode feature like your android and iOS. It is really simple to enable this. So do this way:

"Setting> Devices> Displays and toggle the Night Light on."


8. Frequent System cleanup is a must

Be it a system or your own body, clean it every day. So there are many different terminal commands to do this. 

commands:

sudo apt-get autoclean          [to clean the partial packages]

sudo apt-get clean      [to auto clean apt-cache]

sudo apt-get autoremove         [to clean the unused dependencies]


Must have Linux tools for developers

 Hola amigos!

Hope you all are fit, healthy, and fine. In my previous post, I shared my personal experience of switching to Linux from windows. It was a really fantastic experience. In today's post, I will be sharing. 


1. Unity Tweak tool

This tool is recommended to the ubuntu-users so that they can configure the system in the way they want. Some of the features of the unity tweak tool are the configuration options like desktop hot corners, theme and icon customization, icon size, workspace number, colors, and a lot of amazing features.


command: sudo install unity-tweak-tool


2. Google Chrome

Even if you switched from Windows to Linux, you must have used google chrome on windows earlier. Google chrome is the best browser and that too without any doubt. 


3. VLC Media Player

VLC is the best cross-platform video player. It has a really clean and nice user interface. 


Command: sudo apt install snapd

sudo snap install vlc


4. GIMP 

Here you need to know that you cannot use Adobe tools like Adobe Photoshop, Adobe Illustrator on Linux. So the best alternative to this is the Linux GIMP. 


Command: sudo apt-get install gimp


5. Visual Studio Code or VS Code

This is the favorite tool for all the developers out there. It has an out of the box integration with git. It is flexible like the sublime text. It has a great UI like the atom.  I will share the commands to download both the vs code and the sublime text


the command for vs code: sudo apt install snapd

sudo snap install code --classic



the command for sublime text: sudo snap install sublime text --classic 


6. Peek 

Peek is used to recording your screen and convert them into gifs in no time. It is beautifully designed, has a lightweight, and very easy to use. You will really love this utility. 


command: sudo add-apt-repository ppa:peek-developers

sudo apt update

sudo apt install peek


7. MOC (Music On Console)

Run your favorite music from the ease of console location. MOC is a lightweight tool that allows you to play songs natively by simple console commands. 

command: sudo apt-get install moc moc-FFmpeg-plugin

Labels:

Thursday, December 3, 2020

My experience from windows to Ubuntu


Hello folks! Hope you all are doing well. In my previous post, I shared some more advanced ubuntu terminal commands. In this post, I will be sharing my personal experience from windows 10 to ubuntu.


NOTE: ubuntu is the most recommended Linux distro for beginners. So if you are new to Linux and the open-source world, then I recommend you to use ubuntu as your first Linux distribution. 


First of all, I want to say that when you do something new or challenging, you fee some troubles and issues in the beginning. The same goes for me! I was first a bit intimidated by seeing the ubuntu UI and UX. But after some days, I have a much better experience. 


Now I can customize anything on my desktop. Installing Linux might be scary in the beginning but it is worth it. The best point here is that you get everything for free. It's open-source. No virus can harm your system.


Linux is much better than windows or mac. It boosts the speed of your system which in turn will improve your productivity. There is no issue with security. If you are a developer, then I would highly recommend you give Linux a try. By hitting just a single line command, you can connect to any remote server. 


NOTE: If you find yourself stuck at a point, then use askubuntu.com for any kind of assistance. 


After installing the distro, I first learned the sudo commands. With the help of the Linux command, I updated, installed, and upgraded all the required tools. It was really easy with the sudo apt command. 


Share your experience with windows, Linux, and max in the comments. 

Labels:

Tuesday, December 1, 2020

Ubuntu commands that no one will tell you

 Hello folks! Hope you all are doing well.

In my previous post, we learn some basic ubuntu commands that a beginner should know. So first we will revise those commands first. The Ubuntu terminal commands are below:


sudo apt-get update
sudo apt-get install
sudo apt-get upgrade
sudo apt-get install pip
sudo apt-get update pip
sudo apt-get upgrade pip
dpkg --list
sudo apt-get remove pip
sudo apt-get purge pip
sudo apt-get autoremove 
ls
cd
cd/  [go to the root directory]
cd..   [go to one directory up]
cd --   [go to the previous directory]
mkdir
pwd
cp blog /documents
mv blog/documents
rmdir Vikas
rm -r Vikas
history


So these were the commands for ubuntu beginners. Today we will learn more about such helpful commands. So without any further due, let's get started.

1. df

df is basically a display filesystem. It helps the user to get info about disk space usage of all mounted filesystems.


2. du

du is directory usage. It will display the size of a directory and the size of its all the sub dir.


3. free

This is the best ubuntu or Linux command the user can use to get the info about the free space available on their system.


4. uname -a

It provides a wide range of basic and advanced information about users' systems.


5. top

In order to display the processes that are using the most resources of the system at any given time, use this top command. After that, you can press q to quit.


6. man

The man command is used to show the manual page.  Now you must be wondering what good is that! So manual pages are the detailed pages and they are recommended to be read for any unknown command. 

Examples:

man man: it gives info about the manual.

man intro: it gives a brief intro about the Linux commands.


7. info

It is similar to the man command. But prefer this "info" command if you want specific and more detailed information.


8. [command name] -h

If you know the name of a command but do not know about its use. Then use this command. It will provide a quick overview of that command and will also list down its uses


Example:

sudo -h


9. passwd

This command should be used when the user wants to change the password of a specific user. 

NOTE: The user must know the username of the user for which he wants to change the password.


Example:

passwd [vikas]


10. whatis

This Linux command should be used to know the brief description of a specific built-in Linux command. 

Example:

whatis sudo

whatis cd

whatis man



So these are some more Linux ubuntu commands. 

Labels: