Thursday, 6 October 2016

Program Data insulation and Data Abstraction

Program Data insulation and Data Abstraction

In traditional file processing,the structure of data files is embedded in the application programs,so the changes to the structure of a file may require changing all programs that access that file.By contrast,DBMS access programs do not require such changes in most cases.The structure of data files is stored in the DBMS catalog separately from the access programs.We call this property as program-data independence.

In some types of database systems,such as object oriented or object relational systems,users can define operations on data as part of the database definitions.An operation is specified into two parts that is the interface(or signature) and the implementation(or method).User application programs can operate on the data by invoking these operations through their names and arguments,regardless of how the operations are implemented.This property is termed as program-operation independence.

A major purpose of a database system is to provide users with an abstract view of the data.That is,a DBMS provides users with a conceptual representation of data that does not include many of the details of how the data is stored or how the operations are implemented.This property is termed as data abstraction.Usually,data abstraction is implemented at three levels:

  • Physical level:The lowest level of abstraction,describes how the data are actually stored.The physical level describes complex low-level data structures in detail.
  • Logical level:The next higher level of abstraction,describes what data are stored in the database and what relationships exist among those data.The user of the logical level does not need to be aware of this complexity,and is referred as physical data independence or program data independence.  
  • View level:The highest level of abstraction,describes only a part of the entire database.The system may provide multiple views for the same database. 


Characteristics of the Database Approach

 Characteristics of the Database Approach

Before the database systems were introduced,all the data were organised in file-processing system or file-based system.It gave rise to various problems which were solved with the introduction of database systems.So,the advantages of database system over file-based system or file-processing system are:

  • Controlled Data Redundancy:Data redundancy is a condition created within a database or data storage technology in which the same piece if data is held in two separate places .In DBMS,all data of an organisation is integrated into a single database file.The data is recorded in only one place in the database and it is not duplicated.
  • Data Consistency:By controlling the data redundancy,the data consistency is obtained.If a data item appears only once,any update to its value has to be performed only once and the updated value is immediately available to all users.So,as the DBMS has controlled redundancy,hence it enforces data consistency.
  • Easy Retrieval of data:As the data stored in a database system are tabular and interrelated ,so,it is easy to retrieve any information from the database.
  • Limited Data Isolation:As the data stored in a database system are consistent and non-redundant,hence data isolation is limited.
  • Multiple Users or Concurrent Access-function:In a database system,multiple users may work with the same database simultaneously.In this system,the user giving the first request gets the priority liable of the second.
  • Data Security:As the data is centrally stored,it is easy to enforce security standard.It is easy to monitor the users who are accessing the database.Further the Database Administrator (DBA) controls which users have access to what type of information.
  • Faster Processing:As the data are stored in interrelated tables in a database system,so the retrieval of the information becomes easier as compared to the file-based system or file-processing system.
  • Data independence:The separation of data structure of database from the application program that uses the data is called data independence.In DBMS,you can easily change the structure of database without modifying the application program.
There are many other advantages like Data Abstraction,Insulation between programs and data,Backup and Recovery procedures etc.

Wednesday, 28 September 2016

Database Management System

In my last post,I wrote about database management system.So you may ask that what a database management system actually means??
A database management system(DBMS) is a collection of programs that enables users to create and maintain a database.The DBMS is a general purpose software system that facilitates the process of defining,constructing,manipulating and sharing databases among various users and applications.
  • Defining a database involves specifying the data types,structures and constraints of the data to be stored in the database.The database definition or descriptive information is also stored in the database in the form of a database catalog or dictionary,called metadata*.
  • Constructing the database is the process of storing the data on some storage medium that is controlled by the DBMS.
  • Manipulating a database includes functions such as querying the database to retrieve specific database to retrieve specific data,updating the database to reflect changes in the mini world and generating reports from the data.
  • Sharing a database allows multiple users and programs to access the database simultaneously.
An application program accesses the database by sending queries or requests for data to the DBMS.A query is typically a statement requesting the retrieval of information.



 A simplified database system environment.

*metadata: Generally known as data about data. So, it means that it stores various information like type of data, size of data, etc.

Saturday, 17 September 2016

View data from a Table

To view data of a table,
Here's the SYNTAXs for viewing the table data -

  1. Selected columns and All rows

    1: select column1,column2, column3, ..., columnN from <table_name>;
    

    Examples -

    1. select Roll_no,Name from student;
    


    1: select Name,Phone_Number from student;
    

  2. Selected rows and All columns

    1: select *from <table_name>
    2: where <condition>;
    

    Examples -

    1: select *from student 
    2: where Name='Trunks'; 
    

    1: select *from student 
    2: where Name='Naruto Uzumaki'; 
    

  3.  Selected rows and Selected columns

    1: select col1,col2,...,colN from <table_name>
    2: where <condition>;
    

    Examples -

    1: select Name,Phone_Number from student 
    2: where Name='Trunks'; 
    

    1: select Roll_no,Name from student 
    2: where Roll_no=15094; 
    

  4. All rows and All columns
    1: select *from <table_name>;
    

    Examples -

    1: select *from student;


Wednesday, 14 September 2016

Update

Update the application here.

Version  - 2.1.2
Download

Update Log -
  • Added category SQL
  • Added new splash screen
  • New icons
  • New header image
  • Other small tweaks

Insert data into Table

Here's how to insert data into a Table.
  • First create a table of suitable attributes. Here's how you create a table - Create a table.
  • Then here;'s the syntax for entering values into that table.
SYNTAX -
1: insert into <table_name>
2: (field names)
3: values (corresponding values);

Examples -
1: insert into student
2: (Roll_no,Name,Address,Phone_Number)
3: values(15121,'Trunks','Capsule Corps',1234567890);

1: insert into student
2: (Roll_no,Name,Address,Phone_Number)
3: values(15226,'Reas Grimmery','High School DxD',0198765432);

1: insert into student
2: (Roll_no,Name,Address,Phone_Number)
3: values(15094,'Naruto Uzumaki','Konohaghure','7777777779');


Create a Table

Here's the syntax of creating a table in SQL,

SYNTAX -
1:  create table <table_name>
2: ( column_name1 datatype(size),
3:   column_name2 datatype(size),
4:   column_name3 datatype(size),
5:   column_name4 datatype(size)); 

Example -
1:  create table student
2: ( Roll_no number(10),
3:   Name varchar2(20),
4:   Address varchar2(30),
5:   Phone_Number number(10)); 

Tuesday, 13 September 2016

SQL - Introduction

  • SQL stands for Structure Query Language. It is also known as SEQUEL.
  • In SEQUEL, we use simple English keywords to interact with the database and get information.
  • A SQL, is used to create a table or a database. It is also used to store data into the database, also to modify data in database.
  • It is also used to manipulate data in the database. We can use truncate, delete, drop data from the database for manipulation.
  • A table is a database object which can store the information in the form of rows and columns.
  • Table holds user data.
  • Every column of the table has a specific datatype.
  • Oracle ensures that, the data which is stored is identical with the datatype of the column.
  • The SQL language has several parts -
    • Data Definition Language(DDL) - It provides commands for defining relation schemas, deleting relations and modifying relation schemas.
    • Data Manipulation language(DML) - It provides the ability to query information from the database and to insert tuples into, delete tuples from, and modify tuples in database.
    • Integrity - It includes commands for specifying integrity constraints that the data stored in the database must satisfy. Updates that violate integrity constraints are disallowed.
    • View Definition - It includes commands for defining views.
    • Transaction Control - It includes commands for specifying the beginning and the ending of transaction.

Monday, 12 September 2016

[program] Hello World


[program 1]

Hello guys, today we will try the famous "Hello World" program. Here's the code:


1:  #include<stdio.h>  
2:  void main()  
3:  {  
4:     printf("Hello World");  
5:  } 


Okay, now lets understand the program.
  • As stated earlier, "#" is a pre-processor directive. It says the compiler to perform a task before any further execution. "include" is the type of work that is to be done in pre-processing. It includes the header file "stdio.h" with the source code.  "stdio.h"  is a library header file which contains the codes to implement various input/output operations.
  • Then comes the main() function. We know that al lfunctions are user defined functions, but this isn't entirely true. The main function is different. In C programming Language main function is user implemented (user defined) whose declaration is fixed in the compiler. hence we can say that main() is predefined and user defined too because programmer has to write function's body.

    Actually
    main() is an entry point of a program, from where program’s execution starts.
    Program’s execution starts from main(). Main is a thread/process/function which is invoked by operating system automatically when program is being executed.

    There are many flavors of main function, flavors means prototypes. One that we used commonly

        int main(void)

    – it means main will return an integer value after or between in the program’s execution and void represents that there are no argument passing.

    You can also pass arguments while writing main the syntax is

        int main(int argc, char **argv){...}

    One can also use,
     
        void main()
    - it means the main function will return void to the OS.
  • Printf  is a function, a library function at that which is provided by stdio.h header file. When declared it prints the desired information in the console's screen. Note that it is terminated with a semicolon(;), this is a terminator. It terminates the line there. Every line in a program should be terminated with a semicolon.

In case if you want to write the program using int main(),here is the code:

1:  #include<stdio.h>  
2:  int main()  
3:  {  
4:     printf("Hello world");  
5:     return 0;  
6:  }  

In case you are wondering, what is this "return 0 "and why didn't we write earlier.
Well we used void main() earlier. It is the same as int main() with return 0 . As we don't want the program to return anything to the OS, we can use void main() or use int main() with return 0.
Note -:
     Void main() is only used by some compilers in C. Make sure your compiler supports it to use it.
     Turbo C supports void main() for C programming.

Sunday, 11 September 2016

Database: Introduction

Hello guys,
We all use computers today.With this growing use of the computers,it is fair to say that databases play a critical role in almost all areas where computers are used,including business,electronic commerce,engineering,medicine,law,education and library science.So,starting with what is a database?
  • A database is a collection of related data.By data,we mean known facts that can be recorded and that have implicit meaning.
For example, consider the names, telephone numbers, and addresses of people.
These data are mostly stored in a indexed address book or using software such as Microsoft access or excel.This collection or related data with an implicit meaning is a database.
  • A database can be of any size and complexity.An example of a large commercial database is Amazon.com.
  • A database may be generated and maintained manually or it may be computerized.A computerized database may be created and maintained either by a group of application programs written specifically for that task or by a database management system.

Tuesday, 16 August 2016

Variable Declaration and Initialization

Variable Declaration

  • Declaration introduces one or more variables within a program. it reserves memory for the variable.
  • A declaration statement begins with the type, followed by the name of one or more variables.

The general form is-
data_type variablename1, variablename2, variablename3, ..., variablenameN;

  • Variables are declared a three basic places.
  1. When these are declared inside a function, they are called local variables.
  2. When the variables are declared in the definition of the function parameters, these are called formal parameters.
  3. When variables are declared outside all functions, the are called global variables.
for example-

Local Variable Declaration
Formal Parameter

Global Variable Declaration

  • Variables when used in expressions are also referred to as operands.

Initialization 

When a variable is declared, the C compiler doesn't assign any value to the variable, unless it is instructed to do so. Such declaration is called a tentative declaration. When such declaration is made garbage value(a random value) is stored in the variable.

for example-
  int i;      // This declaration is tentative
  int x;
  x=i+5;

Variable is not assigned any known value and contains a garbage value. Therefore the vlaue of x is not defined. This is a bug in the program.

To prevent such pitfalls, always assign a value to the variable during the declaration of the variables. This is known as Initialization.

for example-
  int i=10;
  int x;
  x=i+5;
In  this declaration the value of x is 15.

Saturday, 13 August 2016

Representation of a variable in memory

  • It may be mentioned that a computer provides a Random Access Memory (RAM) for storing the executable program code and the data the program manipulates. 
  • This memory can be thought of as a contiguous sequence of bits, each o which is capable storing a binary digit .
  • Typically, the memory is also divided into groups of eight consecutive bits (called bytes). These bytes are sequentially addressed. 
  For example :-
 
           int salary = 65000;
It causes the compiler to allocate a few bytes to represent salary. The binary conversion of 65000 is 1111110111101000. the compiler uses the addresses of the first byte at which salary is allocated to refer to it. As it is int  2 bytes of memory is allocated.

A two-byte integer whose address is 1215

Thursday, 11 August 2016

Data Types of C



Classification Of data types

  • C has five Basic data types -
  1. Character - keyword used is char.
  2. Integer - keyword used is int.
  3. Floating Point - keyword used is float.
  4. Double precision floating point - keyword used is double.
  5. Void - keyword used is void.
  • C has four type qualifiers also known as type modifiers. They precede the basic data types.
  1. short
  2. long
  3. signed
  4. unsigned
  • A type modifier alters the meaning of the base data type to yeild a new type. The following points should be noted.
  1. Each of these modifiers can be applied to the base type int .
  2. The modifiers signed and unsigned can also be applied to the base type char.
  3. In addition long can be applied to double.
  4. When the base type is omitted from a declaration, int is assumed.
  • A complete list of possible data types is mentioned below.
  1. bool
  2. char
  3. unsigned char
  4. signed char
  5. int
  6. unsigned int
  7. signed int
  8. short int
  9. unsigned short int
  10. long int
  11. unsigned long int
  12. signed long int
  13. float
  14. double
  15. long double

  • Then there are three types of Derived data types -
    1. Array
      • It is a collection of similar type of data (or data types) stored in contiguous memory location
    2. Function
      • A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.
    3. Pointer
      • A pointer is a variable which contains the address in memory of another variable. We can have a pointer to any variable type.

  • Then there are also three types of User-defined data types -
    1. Union
      • A union is a special data type available in C that allows to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. Unions provide an efficient way of using the same memory location for multiple-purpose.
    2. Structure
      • A structure in the C programming language is a complex data type declaration that defines a physically grouped list of variables to be placed under one name in a block of memory, allowing the different variables to be accessed via a single pointer or variable of type struct. "Class" is c++ is an advanced version of structure.
    3. Enumeration
      • Enumerated Types allow us to create our own symbolic names for a list of related ideas. The keyword for an enumerated type is enum.


Monday, 8 August 2016

Tokens, Keywords, Identifiers and Variables

Tokens 
In a passage of text and usual words and punctuation marks are called Tokens. In a C program the smallest individual unit are also known as Tokens.




Keywords 
  1. Keywords have predefined uses and cannot be used for any other purpose in a C program.
  2. They are used by compiler to compile the program.
  3. They are always written in lowercase letters.
  4. There are Thirty two (32) keywords defined in C.

  Identifiers
  
An identifier is a sequence of characters created by the programmer to identify or name a specific object. The sequence of characters may be letters, digits, and the special character ('_' )known as an underscore.  They include variables, arrays,functions, pointers, etc.

Rules for creating Identifiers
  1. Identifiers are case sensitive.
  2. Only alphabets can be used as the first character of the identifier. 
  3. An identifier should not be a keyword  

Variables
  • A variable is an identifier for a memory location in which data can be stored and recalled. 
  • Variables are used for holding data values so that they can be utilized in various computations in a program.
  • All variables have two different attributes -
  1.  A data type is established when a variable is defined. Once defined, the type of C variable cannot be changed.
  2.  The value can be changed by assigning new value to the variable. The type of the values depends upon the data type of the variable.

Wednesday, 27 July 2016

A Simple C Program

Lets write a basic C program.

In order to write up your first C program, You have to download IDEs to compile and run your programs. There are various C programs available on the internet. I'm currently using Turbo c++.
Here's a link
So, lets get started.


Compiling and Running C Programs

Compiling C program requires working with four kinds of files ---


  • Regular Source Code Files - These files contain function definitions and have an extension '.C '.
  • Header Files - These files contain declarations (also known as function prototypes) and various pre-processor statements. They are used to allow source code files to access externally defined functions. Header files have '.h ' extension.
  • Object Files - These files are produced as the output of the compiler. They consist of various function definitions in binary form, but they are not executable by themselves.object files have '.obj ' extension.
  • Binary Executable - These are produced as the output of a program called  'Linker'. The linker links together a number of object files to produce a binary file that can be directly executed. They have no suffix in UNIX but have '.exe ' on Windows.

Monday, 25 July 2016

Learning Red hat - A Linux OS

An operating system is a program that manages the computer hardware. It also provides a basis for application programs and acts as an intermediate between the user and the computer hardware.


A computer system can be divided roughly into four components:
  • The Hardware
  • The Operating System
  • The Application Programs
  • The Users
The Hardware - provides the basic computing resources with the help of the Central Processing Unit (CPU), the memory, the input/output devices.
The Application Programs -  They define the ways in which these resources are used to solve user's computing problems. For instance, word processors, spreadsheets, compilers, web browsers, etc.
The Operating system is similar to a government. Like a government, it performs no useful function by itself. It simply provides an environment within which user or other programs can do useful work.


Most of us are acquainted with the Windows operating system, provided by Microsoft. Aside this, there are other operating systems like Linux, Unix, Solaris, etc.
Each OS(operating system) is different from another as they use different scheduling algorithms, solve their critical section problems differently, that is, they perform the tasks in different ways.




So, lets start understanding Linux operating system. In the next posts on this topic we will be using Red Hat OS (v 7.1).


In 1969 three software engineers,
  • Dennis Ritchie
  • Richard Stallman
  • Ken Thompson
developed an operating system named 'UNIX'.




UNIX was based on C programming language. It was not open source but hardware dependent like HP to HP, or IBM to IBM, etc. It was set up in Bell Labs at AT&T (American Telecom and Telegraph) Company.




In  1991, Linus Torvalds, a student of Helsinki University developed "MINIX" kernel and developed a new OS known as LINUX.




LINUX is an open source OS. It is not hardware dependent.

Sunday, 24 July 2016

Need to Learn C

There are a large number of programming languages in the world today - C++, C#, Java, Ada, BASIC, Perl, etc. Even so, there are several reasons to learn C. Some of them are -


  • C is a common language.
  • C is a small language. C has only 32 keywords. This makes it relatively easy to learn compared with bulkier languages.
  • C is a stable language. The ANSI for C was created in 1983. The language has not been revised since then.  However, this doesn't mean that all C code is standard. In newer languages, the standard changes regularly and often.
  • C is a quick language. A well written C program is likely to be quick as or quicker than a well written program in any other high level language.
  • C is a core language. A number of popular languages are based on C. Having learnt C, it will be much easier to learn languages that are largely partly based upon C. Such languages include C++, Java, Perl.


It is often said that C is the second best language for any given programming task. The best language depends on the nature of the particular task but the second best language is C, whatever the task.

Saturday, 23 July 2016

History of C

The story started with the Common Programming Language (CPL) which was turned into Basic Combined Programming Language (BCPL) by Martin Richards. This was essentially a type-less language, which allowed the user the direct access into the computer's memory. This made the language useful to programmers.


Ken Thompson at Bell Labs, USA  wrote his own variant of BCPL and called it B. In due course, the designers of UNIX modified it to produce a programming language called C.
Dennis Ritchie, also at Bell Labs, is credited for designing C in the early 1970s. Subsequently, UNIX was rewritten entirely in C. In 1983, an ANSI standard for C emerged making it acceptable internationally.


Ninety percent of the code of the UNIX operating system is written in C. The name C is doubly appropriate being the successor of B and BCPL.


C is a mid-level programming language, not as low level as assembly and not as high level as BASIC.

Friday, 22 July 2016

Lets Start With "C"

Hey guys.
In the previous posts we learnt about the way in which the computers works. Lets take another step in learning a language. Every interface that we use now has gone through a lot of upgrades and enhancements. Even the web browsers that we use now has gone through a lot of testing and previous versions and a lot of codes have been implemented on it. But we can't understand those codes right now just like we cannot run before learning to walk first.


So, lets start with an elementary programming language "C" (spelt see).


C programming language is one of the old programming languages and is not much used in the present day. But it helped in designing many operating system in their early days. It is one of the basic languages that every programmer knows.


So, Lets start this journey with our first programming language - "C".




Book Followed-
Computer Fundamentals and Programming in C - Pradip Dey, Manas Ghosh, Oxford Publication.

Thursday, 21 July 2016

Languages Computer Speak

Okay, its time to learn a way to interact with the computer. Just like any other forms of communication interacting with computer involves languages.
There are basically 3 types of languages when it comes  interacting with a computer.
1. Higher level language
2. Lower level language
3. Assembly language

  • High level languages are the language that can be easily understood by a human being. For an instance, English is a high level language.
  • Lower level language is understood by the computers. Hence it is also known as 'Machine Language'. It consists of zeroes and ones that interact directly with the hardware components of the computer.
  • An assembly language is the first step to improve programming structure and make machine language more readable by humans. An assembly language consists of a set of symbols and letters. It can be called the second generation language since it no longer uses 1s and 0s to write instructions, but terms like MOVE, ADD, SUB and END.

High level languages can be written and executed in all computers but this isn't the case with machine language. Machine language varies from one computer to another.

Earlier Assembly Languages were used to write programs, but recently high level languages are used. Programmers still use the assembly language when speed is essential or when they need to perform an operation that isn't possible in a high-level language.

The high level languages cannot be understood by the computer, as it only understands lower level language which are written in zeroes and ones. Let say there are two people who cannot understand each other, that is they speak different languages. So, in that case a third person is required who understands both their languages and interprets to them. Likewise, there are certain programming bodies who convert the language between the machine and the user. There are three types of convertors,
1. Compiler
2. Interpreter
3. Assembler

Compiler and Interpreter convert high level languages to machine languages.

  • Compiler scans the entire program once and then converts it into machine language which can then be executed by computer's processor. In short compiler translates the entire program in one go and then executes it. Interpreter on the other hand first converts high level language into an intermediate code and then executes it line by line.
  • The execution of program is faster in compiler than interpreter as in interpreter code is executed line by line.
  • Compiler generates error report after translation of entire code whereas in case of interpreter once an error is encountered it is notified and no further code is scanned. Example Python is an interpreted language whereas C,C++ are compiled languages. Java however uses both compiler and interpreter.

Assembler is used for converting the code of assembly language into machine level language.

Wednesday, 6 July 2016

Lets Begin

Hello Again,
 
We have all used a computer. And we all know how to create files, open them, copy files, and all other things. Basically we all know how to operate a computer. We can do anything on a computer. So, how does the computer understand what we are trying to do? It doesn't have a mind. So, how does it does all those things?

Basically, computer is nothing but a set of capacitors and conductors.  It just operates differently when the input current is altered. Hence comes the 0s and 1s. When current is passed into a  hardware part it is taken as 1 and when there is no current it is taken as 0.
So, based on current on , current off the device performs differently. So, it can be said that computer only understands the language of 0s and 1s.

Now that raises another question. How does computer understand all that we say just by 0s and 1s?
Actually the number of zeros and ones are not limited.
For example, "1000100010111" is different from"100010" which is also different from "100011".
As there is no limit the number of times 0s and 1s are used, computer can understand a lot of things.

But how do we know how many 0s and how many 1s to be written?
There always a possibility of concurrency and duplication . Lets say, i want my computer to take 101 as A , 1011 as B and so on. But my friend's computer takes 1001 as A, 11001 as B and so on. So, here comes a problem. As computer was to be used world wide it was not possible for everyone to have their own key assignments, it had be same everywhere. A lot of companies tried to assign standard values. And at last ASCII (American Standard Code for Information Interchange) came into existence.

Introduction

Hello, Everyone.

Welcome to the world of computers. Today everything we see is directly or indirectly made by computers. Knowing computers and interacting with it has become a necessity.
Everyday a lot of people start a new day in the binary world.
For all those people who want to learn more about computers, and want to learn ways to interact with it, this site will serve you to the fullest.

This site is setup by a couple of students whose lives have been transformed by the world of technology. We wanted to learn more about this world, the digital world. But we had to face a lot of challenges. Gathering information, finding appropriate software, understanding concepts are few among the among the difficulties that we faced. So, we developed this site for all those people who are just beginning their journey in the world of computers.

This site will feature learning computer languages,finding useful software, programming codes. Apart from those, it will also serve as a knowledge center for students who can gather useful information.Feel free to comment for doubts and improvements and we will respond ASAP.

Thank You.