Monday, 30 March 2020

Ch 2: Bits & Bytes

Bits & Bytes - Explained:

Any data in computer is stored in memory, which is a physical device. The memory is capable of storing small or large information and stores it temporarily or permanently. For eg., Random Access Memory (RAM), is a volatile memory that stores information for short duration, on an integrated circuit used by the Operating System.

Memory can be either volatile or non-volatile. Volatile memory is a type of memory that loses its contents when the computer or hardware device is switched off. RAM is a type of volatile memory. RAM loses its contents when the computer is switched off or rebooted. Non-volatile memory is a memory that keep its contents saved even when the computer is switched off. EPROM (Erasable Programmable ROM) is an example of non-volatile memory.

All the data and information stored in volatile or non-volatile memory in the computer is measured in terms of bits and bytes. A bit is the smallest unit to measure data stored in memory i.e. a bit is the smallest unit of storage. A byte is made up of 8 bits.

A bit can store either 0 or 1. This implies that the computer understands only 0 or 1 digits. Computers use bit (binary digit) to represent information in digital form. For eg. refer the below table for better understanding:
In above eg., in 1 bit either 0 or 1 can be stored. In 2 bits 00, 01, 10 or 11 are the possible values that can be stored and so on.

A Byte is a combination of 8 bits and hence there are 28-1 (255) possible patterns or values that can be stored in a byte.
Each of this bit can store either 0 or 1. If 0th bit has 1 then 20 = 1, if 0th has 0 & 1st bit has 1 then 21 = 2. Similarly if any 1 bit has value 1 then the value of that byte is 2 raise to bit position. For eg., if 5th bit has 1 then value stored in that byte is 25 = 32. 
So, each bit value can be represented as 
20 = 1, 21 = 2, 22 = 4, 23 = 8, 24 = 16, 25 = 32, 26 = 64 and 27 = 128

A byte can store maximum value of 255 and this can be achieved by adding value of each bit i.e. 1+2+4+8+16+32+64+128 = 255.

So a decimal number is stored in binary number by converting decimal number in the combination of 0's and 1's i.e. binary number.

Now its very important to understand that each character (alphabet, number or any symbol) occupies minimum 1 byte of storage. And every character is represented by a unique ASCII code. For instance, A-Z has ASCII code 65-90 respectively, a-z has ASCII code 97-122 respectively and 0-9 has ASCII code 48-57 respectively. 

This implies to store character 'A' in memory, its ASCII code 65 is converted to its equivalent binary number and then binary number is stored in memory.

Different units of memory are Byte, KiloByte (KB), MegaByte (MB), GigaByte (GB), TeraByte (TB), PetaByte (PB), ExaByte (EB), ZettaByte (ZB), YottaByte (YB).













Friday, 27 March 2020

Vegetable Pulao

Recipe for Vegetable Pulao

Preparation Time: 30 mins
Cooking Time: 10 - 15 mins
Servings: 3 to 4 persons

Ingredients:

Rice - 1 to 1.5 medium size bowl. Boil rice in cooker and keep it dry.

Vegetables

  • Onions (medium size chopped) - 1 medium size
  • Tomato (medium size chopped) - 1 medium size
  • Cabbage(medium size chopped) 
  • Carrot (medium size chopped) - 1/2 carrot
  • Capsicum (medium size chopped) - 1 small
  • Corn - 1/2 bowl
  • Peas - 1/2 bowl
  • Cauliflower (small size chopped) - 1/2 bowl
  • Lemon juice - 1/2 lemon
Additional
  • Paneer small pieces -around 15
  • Cashew small pieces
Spices
  • Salt to taste
  • Red Chilli powder
  • Garam Masala
  • Coriander powder
  • Turmeric powder
  • Black pepper powder
  • Masala-e-Magic (1 to 2 teaspoons)
  • Everest/Badshah Pao Bhaji Masala (1 teaspoon)
  • Ginger paste
  • Garlic paste
  • Soya sauce (1 to 2 teaspoons)
  • Oil (3 to 4 teaspoons)
Garnish
  • Fresh Coriander leaves (finely chopped)
  • Spring Onions (1 to 2) (finely chopped)

Preparation:

  1. Take a non-stick pan.
  2. Put oil and heat on medium flame
  3. Add ginger and garlic paste. Heat for 30 to 40 secs
  4. Add all the vegetables except tomatoes. Saute all vegetables for 2-3 mins
  5. Add tomatoes now. Saute all vegetables.
  6. Add turmeric, red chilli, coriander powder, garam masala, 1/2 teaspoon salt.
  7. Mix spices with vegetables very well and saute for another 3-4 mins.
  8. Add Masala-e-magic masala, pao bhaji masala. 
  9. Add Soya sauce and lemon juice. 
  10. Add paneer & cashew pieces. Mix well all the vegetables and cook for 1 min.
  11. Add rice to the vegetables. Mix well so that the texture of rice becomes consistent.
  12. Finally add black pepper powder & salt to taste and mix & cook for 1-2 mins.

Serving:

  1. Serve vegetable pulao and garnish with coriander leaves and spring onions. 
  2. Serve complimentary butter milk (chaas), green salad and Lijjat masala papad.



Chapter 1: Computer Programming

What do you understand by the term 'Programming'?


I've been teaching part-time or full-time since 2002. I've come across numerous students who doesn't even know what is the purpose of programming.

Well when the question is asked, many students would answer "Programming is something which is written in Computers to see the output. For eg. addition of two numbers, etc.".

Programming means the process of writing/executing definite set of instructions which results into desired or expected output from the user.

Let's quickly move on to Computer Programming.


Computer Programming:


Computer programming means to write set of instructions in a logical sequential way to perform any task which results into the expected output.

Any computer program has mainly 3 types of instructions:

  1. Input
  2. Processing
  3. Output

From the above figure, its very obvious that the sequence of instructions is fixed. This implies that without any input, nothing can be processed and you can't expect an output from the task.

There are different programming languages like C, C++, Java, Python, etc. Many would wonder why I've not included HTML into this list. The reason is straight forward. Because, HTML is NOT a Programming language. Well some seasoned programmers consider HTML as programming language, others don't.

Quote the Answer:
Any instruction that tells the computer to do something is a Programming language.

Versus:
No, HTML is not a programming language. The "M" stands for "Markup". A programming language allows you to describe some instructions of process for performing a task, whereas HTML is a way of adding context and structure to text.


Top Programming Languages (2020):

1.   
PYTHON

Python is fast, easy-to-use, and easy-to-deploy programming language that is being widely used to develop scalable web applications. YouTube, Instagram, Pinterest, SurveyMonkey are all built-in Python. 
2.   
JAVA

Java is widely used for building enterprise-scale web applications. Java is known to be extremely stable. Java is also widely used in Android App Development.
3.   
C/C++

Almost all low-level systems such as operating systems, file systems, etc are written in C/C++. If you wish to be a system-level programmer, C/C++ is the language you should learn. C++ also provides something called STL - Standard Template Library.
4.   
JAVASCRIPT

JavaScript is the “frontend” programming language. JavaScript is widely used to design interactive frontend applications. For instance, when you click on a button which opens up a popup, the logic is implemented via JavaScript.
5.   
GO (GOLANG)

Go, also known as Golang, is a programming language built by Google. Go provides excellent support for multithreading and so, it is being used by a lot of companies that rely heavily on distributed systems. Go is widely used in startups in Silicon Valley. However, it is yet to be adopted by Indian companies/startups.
6.   
R

R programming language is one of the most commonly used programming languages for Data Analysis and Machine Learning. R provides an excellent framework and built-in libraries to develop powerful Machine Learning algorithms. R is also used for general statistical computing as well as graphics.
7.   
SWIFT

Swift is the programming language that is used to develop iOS applications. iOS-based devices are becoming increasingly popular.
8.   
PHP

PHP is among the most popular backend programming language. Though PHP is facing tough competition from Python and JavaScript, the market still needs a large number of PHP developers.
9.   
C#

C# is a general-purpose programming language developed by Microsoft. C# is widely used for backend programming, building games (using Unity), building Window mobile phone apps and lots of other use cases.
10.   
MATLAB

MATLAB is a statistical analysis tool that is used in various industries for Data Analysis. MATLAB is used widely in the Computer Vision and Image processing industry as well.


Next Post: Bits & Bytes

Quote:
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler