Gravitational Waves

In Recent times, Gravitational Waves have been in the news, even the noble award this year was given for the contribution towards discovery of Gravitational Waves. India has also decided to go for LIGO (Laser Interferometer Gravitational Wave Observatory) Projects.

Gravitational waves were first proposed by Einstein as part of theory of relativity. These are like the repulse created in the fabric of space and time. Whenever we move mass, we always get Gravitational Wave. When these wave pass through earth, the earth also vibrates but this vibration is very minute and we need advanced equipment to figure out these vibrations.

Such equipment is LIGO, it consists of two long laser tubes perpendicular to each other, when earth vibrates these laser tube create interference at center which can be used to study the Gravitational Waves.

Gravitational waves can travel throughout the universe without any obstruction. Hence, they can give picture of the universe which we have not seen. This may lead to rise of entirely new branch of astrophysics.

LIGO India will add to ability of the scientists about being more accurate towards the study of Gravitational waves. It will give scientific training to Indian scientists on the international parameters.

LIGO India project will be mainly conducted by three institutions in India. Which are as follows:

  • Institute of Plasma Research, Gandhinagar, Gujrat.
  • Inter-University Centre for Astronomy and Astrophysics (IUCAA), Pune.
  • Raja Ramanna Centre for Advanced Technology, Indoor.


Limits To Freedom of Press

Limits To Freedom of Press

All citizens of India have the right to freedom of speech and expression as a fundamental right guaranteed under Article 19 of the Constitution of India. It also guarantees us the following rights:

  • Right to assemble peacefully and without arms.
  • Right to form associations or unions.
  • Right to move freely throughout the territory of India.
  • Right to reside and settle in any part of the territory of India.
  • Right to practice any profession, or to carry on any occupation, trade or business.

Fundamental right to freedom of speech and expression can be suspended on the following grounds:

  • Sovereignty
  • Integrity
  • Security
  • Friendly relations with foreign States
  • Public order
  • Decency or morality
  • In relation to contempt of court
  • Defamation or incitement to an offence

Freedom of Press is guaranteed as fundamental right under Article 19 as right to freedom of speech and expression.

As Press has all freedom to express the things going in the world and their existence is very much important to let people know what is going on apart from their lives. The social causes, solution discussion on available problem, general knowledge etc. these things are reachable to common men and women with the help of Press. There are few but major issues with which media is involved, are as follows:

  1. Media trial
  2. Sting operations

Media Trial

Nowadays media is being involved in taking interviews of accused; it is being involved in collecting evidences, recreating scenes of crime and even judging or presenting accused as convicted its own due to which accused must face defamation even if he/she has not been convicted of any crime by a court of law.

Sometimes due to this judges get biased in their judgement. For example, in the recent Ryan school incident entire management got arrested. Even due to media hype lawyers was not ready to protect school bus driver. We can see another example of Rajesh Talwar and Nupur Talwar, they were behind bars for over 7 years. The CBI court had given verdict in under the influence of media hype.

In the Sahara case, Supreme Court also said that media should not start its own trial.

They can report what is happened in the court. This kind of media trial is contempt of court. Once the judgement is given then media can do so.

Sting Operations

It can be said that a Sting operation is like a “double-edged sword”. In such cases, there are chances that both the parties will end up getting their hands burnt.

Let us consider a case, when somebody is requesting again and again to meet a public servant, and cameras have been fitted at the place where the public servant is called.

After many attempts to make them say the wrong things and/or accept bribes, the public servant is caught on camera. In this way one can be cheated and trapped in a planned manner.

Abetting as public servant to take a bribe is a punishable offence even if the sting operation is done for a noble cause. As per the law, no one has the right to test the integrity of anyone. Only government, CBI and Police can perform a sting operation as per the procedure prescribed by law.

According to the Supreme Court, when some incident occurs where the sting operation is carried out without any planning, and spontaneous actions are recorded then it is legal.

In case, when public servant does not take bribe then according to section 511 of Indian penal code (IPC) it is an attempt to bribe, and one can be sent behind the bars for this.

Currently the government is formulating a law on sting operations.


Freedom of press is guaranteed as a fundamental right within right to freedom of speech and expression as per Article 19. this is subject to restrictions when Public order, morality and public interest at large is considered. So, the media should work to broadcast correct information to the people, without being judgmental itself.


Shell Companies

A Shell company is described as a non-trading organisation that does not engage in any activity but exists only as medium for another organisation’s business activity.

In India, there is no clear definition of shell companies. However, typically shell companies include multiple layers of companies that have been created for purpose of diverting money or for money laundering.

Most shell companies do not manufacture any product or deal in any product or render nay service. They are mostly used to make financial transactions. Generally, these companies hold assets only ono paper and not in reality. These companies conduct almost no economic activity.

What are the Concerns

Given the umpteen instance of individuals and corporates abusing shell companies, either to avoid taxes or use them as conduit for money laundering, these are generally viewed as dubious and questionable enterprises.

According to the data provided by Finance Ministry, there are about 1.5 million registered companies in India, while only 600,000 companies file their annual return. This means large number of these companies may be indulging in financial irregularities.

Recent Efforts Of The Government

This September, a Memorandum of understanding(MOU) was signed between the ministry of corporate affairs (MCA) and central board of direct taxes(CBDT) regarding sharing of data and information with each other on an automatic regular basis.

In August, SEBI (The Securities and Exchange Board of India) direct stock exchanges to initiate action against 331 suspected shell companies and bar them from trading.

Similarly, MCA cancelled the registration of around 2 lakh defaulting companies.

Finance ministry directed banks to restrict operations of the bank accounts of suspected companies by directors of such companies or their authorized representatives.

Following this, MCA has identified more than 1 lakh directors for disqualifications under Section 164(2)(a) of the Companies Act, 2013.

Importance of such efforts

These moves are targeted to curb the menace of shell companies, money laundering and black money in the country and prevent misuse of corporate structure by shell companies various illegal purpose.




Difference between Delete and Truncate command in SQL

Today, I am going to discuss about the facts behind the delete query and difference between delete query and truncate query.

Now you will come to know about why truncate query is faster than the delete query and what happens when you fire a delete query on a table.


Let me first brief you about delete query, Delete command is used to delete rows from the table you can also filter rows to delete from the table using where clause.

Syntax is shared below:

Delete from users where name = ‘vishal’

Where users is table name and  name is column of the table and using where clause I am filtering rows from users to delete from the table with name vishal.

And if query is fired without any where clause all the rows from the table will be deleted after delete command you need to fire rollback or commit to make the changes permanent or undo it.

Note: this command will cause all the delete triggers to fire on the table.


In case of truncate command all the rows from the table are removed and we cannot rollback the changes on the table because no DML triggers are fired on to the table.

Truncate is a DDL command whereas Delete is DML command and truncate is much faster than delete command.


When you fire delete command all the data gets copied to Rollback tablespace first then delete operation gets performed that is why when you fire rollback you get data back (the system get it from the rollback table space) . All this process takes time but when you fire truncate command it removes data directly from the table and you cannot retrieve data back from the rollback table space. That is why truncate is faster than delete command.




Concurrency in Java

Concurrent collections are introduced in java 5 to increase scalable multithreaded java applications.

Prior to java 5, if you have to deal with collections in multithreaded application you either used synchronized collections or regular collections.


  • HashTable
  • Vector


  • Regular
  • HashMap

Both of these can be synchronized where HashTable and vector are already synchronized and arrayList and HashMap can be synchronized using utility class under java.collections package.

Before java 5, if one thread is reading a collection resource and the same time when second thread tries to update it then you get “ConcurrentModificationException” which is not desirable.

To overcome this problem, the concept of concurrency come into picture. It provides the following methods:

  • Concurrent HashMap.
  • CopyOnWriteArrayList
  • CopyOnWriteArraySet

ConcurrentHashMap uses concept of lock stripping so while one thread is iterating the collection and another  thread is updating the collection, they will sync up at some point.

Where, CopyOnWriteArrayList  and CopyOnWriteArrayList keeping cloning the collection every time when a write is made to the collection and then at some point they will sync up.

So using concurrent collections, we can use collections across multiple threads.

Note: use concurrent collections when you are using less writes and more read through the collection object.

Disadvantages :

When you are using a lot of writes in application you will clone every time the collection object which will degrade the performance of the program.

Why we need MVC in ASP.NET

Before reading what ASP.NET MVC is, it’s better to understand why Microsoft has introduced MVC. Let’s try to understand this by comparing MVC and Webforms.

ASP.NET MVC vs WebForms

Success of Microsoft programming languages is due to RAD (Rapid application development) and visual programming approach. Visual programming was so much addressed and successful in Microsoft that literally they named their IDE’s as “Visual Studio”.

By using visual studio, developers where able to drag drop UI elements on a designer area and visual studio generates C# or VB.NET code for those elements. These codes where termed as “Behind Code” or “Code Behind”. In this code behind Developers can go and write logic to manipulate the UI elements.

So the Visual RAD architecture of Microsoft has Two Things.

  • UI
  • Code Behind

What are the problems with Asp.Net Web Forms?

So when ASP.NET Webform was so successful, why Microsoft thought of creating ASP.NET MVC. The main problem with ASP.NET Webform is performance, performance and performance.

In web application there are two aspects which define performance.

  • Response time: – How fast the server responds to request?
  • Bandwidth consumption: – How much data is sent?

Response time issues:-

Why response time is slower, when it comes to ASP.NET Webforms. Consider the below UI code and Code behind for that UI.

<asp:TextBox ID="TextBox1"  runat="server"></asp:TextBox >

In the code behind you have written some logic which manipulates the text box values and the back ground color.

protected void Page_Load(object sender, EventArgs e)

 TextBox1.Text = "Make it simple"; TextBox1.BackColor = Color.Aqua;

See the HTML output by doing view source it looks something as shown below.

<input name="TextBox1" type="text" value="Make it simple" id="TextBox1" style="background-color:Aqua;" />

Now the points of discussion are:

  • Is this a efficient way of generating HTML? Do we really need to make those long server trips to get that simple HTML on the browser?
  • Can’t the developer write HTML straight forward, is it so tough?

For every request there is a conversion logic which runs and converts the server controls to HTML output. This conversion gets worse and heavy when we have grids, tree view controls etc., where the HTML outputs are complicated HTML tables.

Due to this unnecessary conversion the response time get affected.

Solution for this problem: – “GET RID of CODE BEHIND”, means work with pure HTML.

Bandwidth Consumption Issue.

Viewstate has been a very dear and near friend of ASP.NET developers, because it automatically saves states between post backs and reduces our development time. But this reduction in development time comes at a huge cost as it increases the page size considerably.

The size increases, because of extra bytes generated from viewstate. Lot of people can argue that viewstate can be disabled but then we all know how developers are; if there is option given they would definitely try that out.

Solution for this problem: – “GET RID of SERVER CONTROLS”.

HTML Customization:-

In ASP.NET web server controls, we have “NO IDEA” what kind of HTML can come out and how efficient they are. For example see the below ASPX code, can you guess what kind of HTML it will generate.

<asp:Label ID="Label1" runat="server" Text="I am label"> <asp:Literal ID="Literal1" runat="server" Text="I am a literal"> <asp:Panel ID="Panel1" runat="server">I am a panel

Will Label generate DIV tag or SPAN tag? If you run the above code below are the respective generated HTML.

Label generates a SPAN,

Literal generates simple text,

Panel generates DIV tag and so on.

<span id="Label1">I am label</span> I am a literal

I am a panel

So rather than generating HTML using server controls, how about writing HTML directly and taking complete control of HTML.

Solution for this problem is “DO NOT USE SERVER CONTROLS” and work with direct HTML.

The other great benefit of working directly with HTML is that your web designers can work very closely with the developer team. They can take the HTML code put in their favorite designer tool like dream weaver, front page etc. and design independently.

Important Point to understand:-

If you watch any professional ASP.NET Webform project you will notice that code behind class is where you have huge amount of code and the code is really complicated. Now this code behind page class inherits from “System.Web.UI.Page” class. This class is not a normal class which can be reused and instantiated anywhere. In other words you can never do something as shown below for a Webform class:-

WebForm1 obj = new WebForm1(); obj.Button1_Click();

Because, the “WebForm” class cannot instantiate without “request” and “response” object. If you have ever seen the “ButtonClick” events of “WebForm” they are as shown in the code below.

protected void Button1_Click(object sender, EventArgs e)


// The logic which you want to reuse and invoke


Solution is we need to move the code behind to a separate simple class library and get rid of ASP.NET Server controls and write simple HTML.

How Microsoft Asp.Net MVC tackles problems in Web Forms?

This is the current WebForm architecture which developers are using in its mostly 3 layer architecture. This three layer architecture comprises of UI which has ASPX and the CS code behind.

This UI talk’s with .NET classes which you can term as middle layer, business logic etc. and the middle layer talks with data access layer (DAL).

So Asp.Net MVC comprises of three sections Model, View and Controller(MVC).

  • The code behind logic goes in to the controller.
  • View is your ASPX i.e. pure HTML.
  • Model is your middle layer.

So if you see there are two major changes VIEW becoming simple HTML and code behind moving to simple .NET classes termed as controller.

Asp.Net MVC request flow in general.

Step 1:- The first hit comes to the controller.

Step 2:- Depending on the action, controller creates the object of the Model. Model in turn calls the data access layer which fetches data for the Model.

Step 3:- Fetched data filled in Model is then passed to the view for display purpose.

GDP (Gross Domestic Product)

Values of all the goods and services produced within the country and also termed as, Measure of market value of all the final goods and service produced in a period. GDP value comes on the quarterly basis and on yearly basis GDP is described for whole year.

Statistician say, when a country’s GDP is high it means that the country is increasing the amount of production that is taking place in the economy and the citizens have a higher income and hence are spending more.


GDP is abbreviated in three parts as,

1. Gross 2. Domestic 3. Product


In the production of goods there are several factors such as-:

1. Labour 2. Machinery 3. Land 4. Building

All the above factors excluded in the pricing of goods then the final cost that remains out of this is called as Gross.


Value of all the goods and services produced within the country. Income from abroad is excluded.


Product is the goods and services itself.

Why we need GDP

GDP estimates are commonly used to determine the economic performance of a whole country or region and to make international comparisons. Therefore using a GDP per capita basis is arguably more useful when comparing differences in living standards between various nations.

How to calculate GDP of a country

GDP can be determined in three ways -:

Production approach

  • Estimate the gross value of domestic output out of the many various economic activities.
  • Determines the intermediate consumption i.e. the cost of material, supplies and services used to produce final goods or services.

Income approach

  • The sum of primary incomes distributed by resident producer units.
  • Hire – wages for Labour, interest for capital, rent for land and profits for entrepreneurship.

Expenditure accounts

  • Wages, salaries and supplementary Labour income.
  • Corporate profits.
  • Interest and miscellaneous investment income
  • Farmer’s incomes
  • Income from non-farm unincorporated business

GDP is sum of Consumption(c), Investment (I), Government spending (G) and Net Exports (X M).

Y = C + I + G + [X – M]

C – Consumption

  • Examples include food, rent, jewelry, gasoline and medical expenses.

I – Investment

  • Includes, for instance, business investment in equipment

G – Government spending

  • Is the sum of government expenditures on final goods and services.
  • It includes salaries of public servants, purchases of weapons for the military and any investment expenditure by a government.

X – Exports

  • Represents gross exports.

M – Imports

  • Represents gross imports

Imports are subtracted since imported goods will be included in terms of G, I or C and must be deducted to avoid counting foreign supply as domestic.


OSI Reference Model

OSI (Open Systems Interconnection) is a reference model to define application communication flow over a network and is also defined as conceptual framework for understanding relationships.

In other words, to divide the interrelated aspects of Network operation into less complex operations and to defines standard interfaces to achieve compatibility and multi vendor integration.

Layer 7 Application
Layer 6 Presentation
Layer 5 Session
Layer 4 Transport
Layer 3 Network
Layer 2 Data Link
Layer 1 Physical


Application Layer:

  • Provides interface between OSI RM and end user application.
  • Provides network services to user client/server-based application.
  • Establishes and defines program-to-program communication.
  • Identifies availability of intended communication partner.
  • Examples include ftp, tftp, http, www browsers, DNS, SMTP, telnet.

Presentation Layer

  • Defines data format for transmission.
  • Ensures arriving data from the network can be transmitted by the application and information sent by the application can be transmitted on the network.
  • Performs encryption and decryption.
  • Example representation includes ASCII, JPEG, HTML etc.

Session layer

  • Defines how to strat, control and end session.
  • RPCs (Remote Procedure Call) operate at this layer.
  • Logon validation happens at this layer.
  • Named Pipes defined at this layer – Named Pipes use TCP to guarantee communication.
  • Session layer organizes communication through simple, half-duplex or full-duplex.
  • Example protocols include SQL, RPC, Named Pipes etc.

Transport Layer

  • Segmented data to be passed down to Network layer and reassembles data for session and upper layers.
  •  Provide the choice of connection-oriented and guaranteed (TCP) or connectionless and non-guaranteed(UDP) delivery of data .
  • Provides end to end transport services.
  • Provides flow control to overcome congestion in network.
  • Provides 3 flow control mechanism:
  1. Buffering: Each computer has enough buffer space to hold data before it os processed.
  2. Congestion Avoidance: Receiving computer notices its buffers are filling quickly and sends a stop message to the sending host to temporarily stop transmitting while it processes data already received. Then signals that it is ready for more data. Eg. Protocols – Synchronous Data Link Control (SDLC), Link Access Procedure, Balanced (LAPB), ICMP Source Quench (slows down rate instead of stopping it).
  3. Windowing: Defines maximum number of bytes it is willing to send at one time before an acknowledgement is expected.

Network Layer

  • Defines the network address.
  • Routers operate at this layer.
  • Segments from the transport layer are placed into and passed down to Data Link Layer.
  • Network layer routes data from one node to another.
  • Determines the best path/ route to destination device to use for routing data on the inter network- this is done using hop count or tick where 1 tick = 1/18th of a second.
  • Network layer maintains routing table.

Data Link Layer

  • Provides error- free link between 2 devices- CRC used for error checking.
  • Packets from the Network layer are placed into frames.
  • Data Link layer handles physical transmission of data from one node to another.
  • Handles error notification.
  • IEEE subdivided this layer into 2 sub layers
  1. Logical Link Control (LLC): Uses destination Service Access Point (DSAP) and Source Service Access Points (SSAP) to help lower protocols access Network layer protocols.
  2. Media Access Control (MAC) : build frames from bits performs CRC Handles MAC address- first digits of 12 hex defines vendor Id, next 6 defines serial no of that vendor Id.

Physical Layer

  • Defines connections – RJ-45, RJ-11, BNC etc.
  • Places Frames, represented as bits, onto media as electric signals or pulses of light.
  • Hubs are repeaters operate at this layer.

Synchronization in Multithreading

When two or more threads need access to a shared resource, they need some way to ensure that the resource will be used by only one thread at a time. The process by which this is achieved is called synchronization.

In other words,

Thread Synchronization is defined as a mechanism which ensures that two or more concurrent processes or threads do not simultaneously execute some particular program segment known as critical section.

Key to synchronization is the concept of the monitor. A monitor is an object that is used as a mutually exclusive lock. Only one thread can own a monitor at a given time. When a thread acquires a lock, it is said to have entered the monitor. All other threads attempting to enter the locked monitor will be suspended until the first thread exits the monitor. These other threads are said to be waiting for the monitor. A thread that owns a monitor can reenter the same monitor if it so desires.

You can synchronize your code in either of two ways. Both involve the use of the synchronized keyword, and both are examined here.

Real Life example of thread safe

If you are having a bank account and you have two debit cards. Consider one card is being used by you and another is used by your wife. Your bank account balance is 5000. One day you need money and you go to ATM and at the same time your wife is also going to use their ATM. Now, if you both make transaction at same time for 2000 out of whole money. Now, what should happen? Should it show the remaining balance 3000?

Turns out, No!

Because, if you are allowed to do so at the same time without taken care your account will not be then synchronized with number of transactions you made.

To do so we should have taken care of synchronization.

Now let’s see a case when synchronization is not there:

// This program is not synchronized.

class Callme {

    void call(String msg) {

        System.out.print("[" + msg);

        try {


        } catch(InterruptedException e) {





//creating a thread class implementing Runnable interface

class Caller implements Runnable {

    String msg;

    Callme target;

    Thread t;

    public Caller(Callme targ, String s) {

        target = targ;

        msg = s;

        t = new Thread(this);

       //starting thread



    // implementing runnable method.

    public void run() {;


//creating main class

class SynchController {

    //main method

    public static void main(String args[]) {

        Callme target = new Callme();

        Caller ob1 = new Caller(target, "Hello");

        Caller ob2 = new Caller(target, "Synchronized");

        Caller ob3 = new Caller(target, "World");

        // wait for threads to end

        try {




        } catch(InterruptedException e) {





Here is the output produced by this program:

#Output : [Hello[Synchronized[World]



Note:   join( ) method wait for a thread to finish .This method waits until the thread on which it is called terminates. Its name comes from the concept of the calling thread waiting until the specified thread joins it. By calling join method our currently running thread waits for the joined thread to complete.

As you can see, by calling sleep( ), the call( ) method allows execution to switch to another thread. This results in the mixed-up output of the three message strings. In this program, nothing exists to stop all three threads from calling the same method, on the same object, at the same time. This is known as a race condition, because the three threads are racing each other to complete the method which can cause a program to run right one time and wrong the next.

To fix the preceding program, you must serialize access to call( ). That is, you must restrict its access to only one thread at a time. To do this, you simply need to precede call( )’s definition with the keyword synchronized, as shown here:

class Callme {

synchronized void call(String msg) {


This prevents other threads from entering call( ) while another thread is using it. After

synchronized has been added to call( ), the output of the program is as follows:

#output : [Hello]




Table Variables

Table variables are table type variables which are used to create table like structure. They are partially stored in both memory and in tempdb database of a database server. Once the execution is finished, table variables are dropped automatically.

Why we need Table variables

When you are executing code in T-SQL, tables are necessary to store data temporarily to smooth your development, raise code maintainability and re usability.


As other variables, table variables are declared inside the code block of batch or stored procedures. Table variable store a set of records, so naturally the declaration syntax looks very similar to create table statement, as you can see in following example:



Id int,

Name varchar(200)


Insert, update, delete in table variable is same as we do with normal Table.

  • INSERT INTO @usersTblVar(id, name) values(1,’raam’)
  • UPDATE @usersTblVar SET name =’shyam’ where id =’1’
  • DELETE FROM @usersTblVar where id =’1’

You might think table variable work just like temporary tables, there are differences.

Note: you cannot use table variable like input and output parameter but you can return a table variable from a user defined function. The restricted scope of a table variable gives are database server some liberty to perform optimization.


Because of scope definition concept, a table variable use fewer resources than a temporary table. Table variables only last only duration of update on table variable which reduces locking and logging overhead. It also reduces the problem of recompilation of stored procedures which occurs with temporary tables.


You can also insert into a table variable in bulk as well for example:

INSERT INTO @usersTblVar

SELECT * FROM usersBackup

It will insert data into table variable in bulk from usersBackup table.

Note: use table variable without @ in case of MySql.

Disadvantages of using table variables

  • You cannot create a non-cluster index on a table variable.
  • database server does not maintain statics on table variable.
  • Table definition of table variable cannot be changed after declaration.