Friday, 21 November 2014

GNU General Public License


                     GNU General Public License is the widely used license for free software which ensures the users the right to study, copy, alter and share the softwares. Softwares that acquires these rights are called Free software. This License is first released by Richard Stallman of the Free Software Foundation(FSF) for GNU Project in 1989. This license is based on the copyleft principle. i.e, the chain of users involved should distribute their work or modifications that he/she has done to the software under the same license. It is the first copyleft license for general use.
                   The GPL accounted for nearly 65% of the 43,442 free softwares projects listed on Freecode as of August 2007 and about 68% of the projects listed on SourceForge.net by January 2006. Most widely used free software that are licensed under GPL includes Linux Kernel and GNU Compiler Collection(GCC). There are also some dual licensed free softwares like MySQL in which one being the GPL.
                  On 29 June 2007, the third new version of the license(GNU GPLv3) was released to solve the issues that GNU GPLv2 had. To keep the GPL updated, developers has the option to choose “any later version” clause. This is to choose between the original terms or terms imposed by the new version imposed by FSF. For example Linux Kernel is under GPLv2 without “any later version” clause.
Now let's see the different versions of the GPL
Version 1
                 The first version of GPL was released on 25th February 1989. It was mainly published to prevent the restrictions that violated the definition of the Free software. The first problem that GPL solved is that, the distributors were asked to produce the human readable form of the source code along with the binaries under the same licensing conditions.
The second problem was that vendors imposed additional restrictions to the license and combined softwares with other which had other restriction on its distribution. To avoid this GPLv1 said that altered or modified software as a whole has to be distributed under same conditions.
Version 2
               According to Stallman, the prominent change in GPLv2 was “Liberty or Death”. It states that, restrictions that prevent him or her from distributing GPL licensed software in a way that respects other users' freedom, he or she cannot distribute it at all.
Version 3
           GPLv3 was released on 29th June 2009 by Richard Stallman with legal counsel from Eben Moglen and the Software Freedom Law Center.
The major changes in GPLv3 are in relation to free software, software patents, “source code” definition and hardware restrictions on software modification. GPLv3 improves compatibility with several open source software licenses such as Apache License, version 2.0.
It was a long journey when they finally published the third version GPLv3 on 29th June 2009.

Thursday, 25 September 2014

Critical Section

In concurrent programming, Critical section is a set of statements that should be run exclusively . When multiple processes that shares same data are run simultaneously there are chances for the data to be inconsistent. So an operating system is designed in such a way that only one of the processes among them is allowed to access the shared data at a time. A critical section terminates in a fixed time, so a process or task must wait for that fixed time to enter its critical section.
Critical section is used when multi threaded programming need to manipulate a shared data without creating further threads conflicting the data. It also ensures that a shared device is accessed only by a single process at a time.
In single processor systems critical section can be implemented by disabling interrupts while entering the critical section, prevent system calls causing context switches while inside the critical section and restoring the interrupts while exit. With this implementation, any thread entering critical section any where in the system will prevent other thread trying to execute its critical section. Thus CPU can’t be accessed by any other process until the running process exits the CPU.
So far there are many algorithms that came up with solving the issues regarding the execution of critical section. The solutions for critical section is a wide area to discuss...

Tuesday, 12 August 2014

top and htop commands in Linux

        Linux provides utilities called top and htop to monitor the real time processes. They displays the dynamic real-time view of the running system. But, both the command are quite different in action.
Top command displays the Linux processes. It can display system summary information and processes or threads currently managed by the kernel.  When we type top in terminal we get the currently running process as shown in Fig 1.


                                              Fig 1:top  displaying running processes

Even though htop is quite similar to top there are some extra features that makes htop better command utility than top. The htop utility is not already built in Linux, it should be downloaded and installed. Once it is installed  it can be run through command line by just typing 'htop' (We can install it by just typing sudo apt-get install htop)

The Fig 2 shows the htop window look like,

                                                          Fig 2 :htop window


Now let's see what htop displays,

The top left corner:
The numbers 1,2,3 and 4 represents the number of cores in the system. The bars next to these numbers shows the loads on the cores. The colour difference in the bars represent different information. Below that lies memory and swap information.

The top right corner:
Here information related to  loads, threads, load average and up time are displayed. Load average is the amount of work that system does. Here in my system load average is 0.34 which means very less load on CPU. If it goes up to 2 it means that system is making use of CPU 100%.

Process related information:
The information about each process is divided into columns. The explanation of each column is as follows:


     PID: Process ID of a process
    USER: User owning the process
    PR: Priority of the process.
    NI: The nice value for a process.
    VIRT: Virtual memory consumption.
    RES: Physical RAM consumption in kilobytes.
    SHR: Shared memory consumption.
    S: Process status (sleeping, running etc).
    CPU%: CPU consumption
    MEM%: Physical RAM consumption.
    TIME+: Processor time used by the process.
    COMMAND: Command that started the process.

Htop provides many features to customize it according to user's taste. At the bottom of the htop window we can see F-keys and its function written next to them.

Saturday, 2 August 2014

Installing MariaDB

You can know what is MariaDB from my previous blog http://amruthasangeeth.blogspot.in/2014/06/mariadb_17.html


Now let’s see the installation of MariaDB
Step 1
First make sure that required packages are installed and  add apt-get key for Mariadb repository using following command
$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db

Add apt-get repository as per your Ubuntu version
For Ubuntu 13.10
$ sudo add-apt-repository 'deb http://ftp.kaist.ac.kr/mariadb/repo/5.5/ubuntu saucy main'
For Ubuntu 13.04
$ sudo add-apt-repository 'deb http://ftp.kaist.ac.kr/mariadb/repo/5.5/ubuntu raring main'
For Ubuntu 12.10
$ sudo add-apt-repository 'deb http://ftp.kaist.ac.kr/mariadb/repo/5.5/ubuntu quantal main'
For Ubuntu 12.04 LTS
$ sudo add-apt-repository 'deb http://ftp.kaist.ac.kr/mariadb/repo/5.5/ubuntu precise main'



Step 2
Install MariaDB using the following commands
$ sudo apt-get update
$ sudo apt-get install mariadb-server

Provide the root account password as given below


Step 3

Login to MariaDB using the following command after installation
mysql -u root -p




Creating a database in MariaDB
Entering the account administrator password set up during installation you will be given a MariaDB prompt.

We will create a database to learn on called students using the following command
CREATE DATABASE  students;
We will switch to the new database
USE  students;
Now the database is created and we can create a table.
CREATE TABLE details(student_id int(5) NOT NULL AUTO_INCREMENT,
                        name varchar(20) DEFAULT NULL,
                        age int(3) DEFAULT NULL,
                        marks int(5) DEFAULT NULL,
                        PRIMARY KEY(student_i)d
                        );
To accomplish what we have done, use the following command,
show columns in details;


Each column in table creation command is separated by comma and follows this fashion,
Column_Name Data_Type[(size_of_data)] [NULL or NOT NULL] [DEFAULT default_value]
[AUTO_INCREMENT]

The values of each column definition are,
* Column Name: Describes the attribute being assigned.
* Data Type: Specifies the type of data in the column.
* Null: Defines whether null is a valid value for that field. Can be "null" or "not null".
* Default Value: Sets the initial value of all newly created records that do not specify a value.
* auto_increment: MySQL will handle the sequential numbering internally of any column marked with this   option, in order to provide a unique value for each record.

Ultimately before closing the table definition we need to use primary key by typing PRIMARY KEY(column name).It guarantees that , this column will serve as a unique field.

Inserting data into MariaDB table
INSERT INTO details(name,age,marks) values ("anu",15,450);


INSERT INTO details(name,age,marks) VALUES("Bob",15,400);



We need not add values in student_id.It is automatically incremented.All other values are given in quotes.

Deleting a table
To delete a table, type the following command
DROP TABLE table_name;
Once the table is deleted, the data inside it cannot be recovered.

Now we can view the current table using “show tables” command. This command gives all the tables inside the database.
SHOW tables;
Then, after deleting the table.
DROP TABLE details;
Query OK, 0 rows affected (0.02 sec)

SHOW tables;

Tuesday, 29 July 2014

Database Languages


A database system provide Data Definition Language(DDL) to specify Database schema and Data Manipulation Language(DML) to express Database queries and updates. They are a part of a single Database language, such as the widely used SQL language.



Data Manipulation Language (DML)

DML allows users to acces and manipulate data as organized by the appropriate

data models.The types of access are,

* Retrieval of data

* Insertion of data

* Deletion of data

* Modification of data



Basically there are two types of DMLs,

1) Procedural DML

Here user need to specify what data and how to access that data

2) Declarative DML (Non procedural DML)

Here user need to specify what the data is and the DML will find an effective way to access those data



Therefore users mostly prefer Declarative DMLs since it is easier to learn and it can efficiently carry out data access.



Data Definition Language (DDL)

We specify database schema by a set of definitions and additional properties of data using DDL. We specify the storage structure and access methods used by Database system by a set of statements in a special type of DDL called data storage and definition language.

The DDL provides facilities to specify certain consistency constraints. Database system implement integrity constraints that can be tested with minimal overhead.



* Domain Constraints

Declaring an attribute like int, char as a specific domain acts as constraints on the values it can take. They are checked whenever new data items are entered.



* Referential integrity

There occurs some cases where we want a value appearingin one relation must appear in another relation. In some cases database modification cause violation in Referential integrity. When that happens, the action that causes the violation is rejected.



* Assertion

Assertion is any condition that a database must always satisfy. Domain constraints and Refrential integrity are other forms of assertions. When an assertion is created, system tests for its validity. If it is valid, database allows further modification if it does not cause any violation.



* Authorization

Users are differentiated according to type of access that they have to the database. This differentiation among the users are expressed in terms of Authorization.

The different types of authorizations are,

  • Read authorization
  • Insert authorization
  • Update authorization
  • Delete authorization

Data dictionary is a special type of table that can be accessed and updated by the database system itself. The database system consults the data dictionary before reading and modifying the data.

Friday, 4 July 2014

Web Syndication

Common Web feed icon
    First of all, what is Syndication? Basically syndication is the supply of material for reuse and integration with other material, often through a paid service subscription. The best example of web syndication is Newspaper. News agencies distribute contents to newspapers, they reformat it and integrate it with other copies and publish it.
    Web syndication refers to the websites providing information and the websites displaying it. ie, A section of a website is made available for other websites to use. For the providing sites, it is an exposure across numerous online platform. For the receiving sites, it is an effective way of adding depths to their sites and making it more attractive. Online content syndication is a rapid growing industrial sector in both hardware and software field. In the early days, syndication was a heavy manual process. Then an agreement reached favouring both supplier and customers reached. According to the agreement the customers would simply copy the desired content from the supplier's Web site and paste it into their own. Thus it became an easy process.
    In order to implement this new communication process, a series of XML files are defined. There is no standard format for Web syndication. To use this technology, site owners create or obtain specialized software (such as a content management system) which, in the machine-readable XML format, presents new articles in a list, giving a line or two of each article and a link to the full article or post. Web logs and news websites are common sources for web feeds, but feeds are also used to deliver structured information ranging from weather data to "top ten" lists of hit tunes. The term syndication is used to describe making available a feed for an information source. Like syndicated print newspaper features or broadcast programs, webfeed contents may be shared and republished by other web sites.

Tuesday, 1 July 2014

A Movie Review

THIRA


Thira is 2013 released movie directed by Vineeth Sreenivasan. It casts Dhyan Sreenivasan, Shobhana- the cenral character. The movie deals with human trafficking. This movie is an eye-opener against such crimes taking place in different parts of the country.

The film makes the debut of Vineeth Sreenivasan’s young brother Dhyan Sreenivasan and the return of actress Shobhana to Malayalam cinema after almost a decade. Vineeth Sreenivasan was inspired by the life of Sunitha Krishnan an Indian activist and founder of ‘Prajwal’ an institution that assist trafficked women and girls in finding the shelter.
Movie begins with the introduction of a cardiologist, Rohini Pranab (Shobhana), who apart from her job of a doctor also runs an organization for women which acts against women trafficking and helps orphaned girls. Things get into trouble when some girls from the organization get kidnapped.
Rohini sets out on a mission to find those who are behind her husband's murder and who have trafficked the girls. On the same path, we are introduced to Naveen (Dhyan Sreenivasan), who is in search of his kidnapped sister. Naveen and Rohini meet by chance and come to know that they have the same goal. Rest of the movie focuses on their mission to find the lost ones. The story is set in Kerala and Goa. Both of them finally identify the secret place where the trafficked girls are kept and release with the wise help from Rohini and action from Naveen.
Thira merely reminds us that even those with eyes, see only that which they want to see through the scene of girl being kidnapped in the middle of the city in a day.
The main issue with stories of these kinds is that they have a predictable pattern with real events happening only at the beginning and then towards the end. What keeps the viewers glued on to such films are the portions that connect these two ends. Rakesh Mantodi's script (co-written by Vineeth Sreenivasan) barely manages to make things interesting and gripping beyond a point. Also, the dialogues have been written in an old fashioned style.

. 'Thira' does require an actress of great caliber, and Shobhana delivers an incredible performance and Dhyan Sreenivasan makes a notable debut as well, though he does need to work on his dubbing skills.