Skip to main content


Showing posts from September, 2014

File Pointer in C

In order to use files it is mandatory to learn the file Input / Output operations. Learning of these is nothing but to understand the functions to write data into a file, to read data from a file, etc. For at any of such operations the file must be opened. The file opening operation is done through a pointer variable called as file pointer. So, file pointer is nothing but a variable which is declared and then I to any required physical file. All the I/O operations are done to physical file through the logical file.
A File Pointer is a special type of pointer variable of the type FILE that is used to store the address of a physical file.
FILE I/O is almost identical to the console and terminal I/O operations. The pnntf() function is used to display the data on the screen. And in file handling we use fprintf() to write the data into the file. We use scanf() function to read the data from the keyboard. And in file handling we use fscanf() to read the data from the file. This is called f…

File Structure in C

The file meant for a C programmer is nothing but a data file. Using C programs the data in the form of character or characters is stored permanently on the secondary storage device. In file handling such programs are designed that store data in file and read back data from the file. It means the file replaces the input/output devices for I/O operations. Rather than displaying the data on the output device monitor, it can be written to the file or the data can be read from the file instead of the input device like keyboard. Contents of a file describe the structure of a file.

The way how the contents of a file are being managed or decided is called as file Structure. It may be character, fields, records or block of records.

Each and every data stored in a file can be treated simply as character. So, the character is simplest unit of transfer. In its simplest structure a file can contain a character. More number of characters can be stored in file to make it meaningful. If the transfer…

File System Basics

The hard disk drive used as secondary storage device in the computing system provide  place to store data. The only way to store and access data on a hard disk drive is by either specifying the data’s physical location in terms of cylinder, head, and sector or by its logical location the block number on the disk. For a programmer specifying and referring the data like this is too difficult. So the operating system takes care of this by means of providing a good file system.
The operating system easily keeps track of the things stored on disks. It is nothing but a way of filing data in an easily accessible way. This is the major role played by the file system. In order to access such data on the disk the programmer is required to write ‘file-handling’ programs. The data on the secondary storage is stored only by means of file.
With reference to Operating System like "Linux", a File System is the whole structure in which the FILES are organized, stored and named especially for…

How to Add or Remove CSS class from element: jQuery

Earlier article was about to using basic jQuery syntaxes and changing default behaviour of html elements in MVC. As html easily provide to include CSS classes to change the design of an element or we can say anything on the web-page. The same operation can easily be performed by using jQuery according to some conditions or on some events triggering.

Add CSS class: To add a class using jQuery, programmer have to use the function addClass() which have some parameters including property name and the value to be assign.
Add below style on the page:
<style>    a.test {        font-weight: bold;    }</style> This above style will make font-weight: bold for the anchor tag using this css class. To add this CSS class on the anchor tag, write the following line of code:

$( "a" ).addClass( "test" );

Remove Class: On click of this anchor tag or some other element, we can simple remove this class by using the below line of code:

$( "a" ).removeClass( "tes…

Handling Errors and Exceptions using RAISERROR: SQL

A REISEROR statement is used to return messages to the business applications that are executing the SQL statements. This statement uses the same format as a system error or warning message generated by the database engine. Consider an example of an application that is executing a batch. If an error occurs while executing this batch, an error message will be raised and sent to the application. The application in turn will include the code to handle the error.

You can also return user-defined error messages by using the RAISERROR statement. A REISERROR severity of 1; to 19 executed in the TRY block causes the control to be transferred to the associated CATCH block.

Consider the following example of the AdventureWorks database that stores the details of the shift in which the employees work. You need to update the Shift table to update the time of a shift. While updating the shift details, you need to ensure that the difference between the start time and the end time is eight hours. If …

Introduction to file handling

Introduction to file handling  File system basics Standard streams in c File structure FILE pointer Opening and closing a file File handling functions File types, Text and Binary Input / Output operations on file Reading a character using getc() Writing a character using putc() Using feof() Working with string using fputs() and fgets() Using fprintf() and fscanf() Using fread() and fwrite() Direct Access file fseek()
Introduction to file handling  Main memory of the computing system is used to store temporary data that is processed to produce information. The data stored in memory is not permanent. When the system is switched off we lose the data stored in main memory. It is because of the volatile nature of main memory. But most of the time storing of data permanently for the sake of future reference is necessary. Of course in almost all organization storing of data is compulsory to produce very important resource "information". This data can be stored permanently only on …

EnableClientScript in ASP.NET Vaildation, How to disable it

Script is a short of code, run on any browser, must to enable Java Script. If you want to enable validation along with the page then must to enable java script of the browser for running validation. That's type of validation is known as client side validation.
Let's start to learn about EnableClientScript property of control, if you will set true then validation is enable on single click or you can say validation enable on onfocus.
How to disable it
Controls_Id_name . EnableClientScript = false;

Breadth First Traversal in Graph

Graph Traversals Traversing a graph is nothing but to visit or process all the nodes of the graph once and only once. two techniques are popular to traverse the graph. They are Breadth first traversal and depth first traversal. In both the traversal techniques the traversing starts from one of the nodes of the graph and from that starting node all other node are explored. In case of Breadth first traversal from the starting node all the adjacent nodes of that node are explored and the process of exploring is continued. In case of Depth first traversal only one adjacent node (from the adjacent nodes) is explored and the process of exploring continues. Understanding adjacent node is important in both the techniques of graph traversal. Breadth First Traversal: As the name of the traversal techniques suggests the traversal explores the nodes of graph by breadth. It means all the adjacent nodes of one selected node are explored first. From the start node all the adjacent nodes of that nod…

Handling Errors and Exceptions using Try-Catch: SQL

When you execute a query, it is parsed for syntactical errors before execution. If the syntax is correct, it is compiled and executed. Sometimes, due to factors, such as incorrect data, an error can occur during execution even if the query is syntactically correct. The errors that occur at run time are known as exceptions.

Consider an example. There is a primary key constraint applied on the EmployeeID attribute of the Employee table. When you try to insert an employee ID that already exists in the table, an error occurs while executing the INSERT statement.

When a database server provides database support to a business application, errors generated while executing the SQL statements can be handled in two ways:

By adding error-handling code to the batch by using the TRY-CATCH construct.By returning the error to the business application by using the RAISERROR statement and handling the error in the application.
Using TRY-CATCH A TRY-CATCH construct includes a TRY block followed by a CA…

Adjacency List Representation in Graph

In case of adjacency list representation 'n' number of singly linked lists are used to represent a graph of 'n' number of nodes. The adjacent nodes are represented as nodes of the individual linked lists representing each node (vertex). If there are no adjacent nodes then the linked list of the respective vertex point to NULL. Consider the following undirected graph:

The adjacency list representation is:

In the above adjacency list representation the external pointer '1' contains the address of the first adjacent node of node 1 of graph. The linked list is the adjacency list of node 1. The first node of the list contains the address of second adjacent node 4. Similarly the node 4 contains the address of the last adjacent node of node 1 i.e. node 6. The link of the last node points to NULL. In this way the linked lists are created for all the vertices (nodes) of the graph. Consider the following digraph:

The adjacency list of the above digraph is:

Consider the …

Adjacency matrix representation in Graph

Pictorially it is very the graph can be represented very easily and analysis can be done quite normally. But there is no direct pictorial data structure available to represent the graph. The basic data structure serve the purpose to store the graph in the memory. The data structures two-dimensional array and linked list most commonly used to represent the graphs. If the graph is represented using two dimensional array then the representational is called as "adjacency matrix representation" and if the linked list is used to represent the graph then the representation is called as "adjacency list representation". Adjacency Matrix Representation: A two dimensional array of size nxn can be used to represent the graph where 'n' is the number of vertices of the graph. 'n' number of rows are used to represent the vertices and 'n' number of columns are used for each vertex. The matrix entries depend on the type of graph. If the graph is undirected …

How to use Case and While statement in Batches: SQL

Database developer can use the CASE as well as While statement in situation where several conditions need to be evaluated.
Using CASE statement The CASE statement evaluates a list of conditions and returns one of the possible results. You can use the IF statement to do the same task. However, you can use a CASE statement when there are more than two conditions that check a common variable for different values. The syntax of the CASE statement is:

WHEN Boolean_expression THEN expression
[ [WHEN Boolean_expression THEN expression] […..] ]
[ELSE expression]
Boolean_expression specifies a bollean expression that is evaluated when using the CASE construct.Expression is the resultant expression that is executed when the Boolean expression evaluates to TRUE. This can be a constant, a column name, a function, a query, or any combination of arithmetic, bit-wise, and string operators.
In a simple CASE construct, a variable or an expression is compared with the Boolean expression in e…

How to use Constructs in Batches for Conditional Execution: SQL

SQL Server allows you to use programming constructs in the batches for conditional execution of statements. For example, you need to retrieve data based on a condition. If the condition is not satisfied, a message should be displayed.

The SQL Server allows you to use the following constructs to control the flow of statements:

IF…..ELSE statementCASE statementWHILE statement
Using the IF….ELSE Statement

You can use the IF…..ELSE statement for conditional execution of SQL statements. A particular action is performed when the given condition on evaluates to TRUE and another action is performed when the given condition evaluates to FALSE.
The syntax of IF….ELSE statement is:

IF Boolean_expression
{sql_statement | statement_block}
{sql_statement | statement_block}]

Boolean_expression specifies the condition that evaluates to either TRUE or FALSE. Sql_statement specifies a T-SQL statement.Statement_block is a collection of T-SQL statements.
The following example retrieves the pay rate…

How to Change Default Behaviour of element in jQuery

Earlier article was about installing and embedding jQuery on our web-pages, and then using jQuery selectors to perform some events. These events can be easily written on the same page or may be in another javascript file having extension (js).

jQuery provides simple function to prevent the default behavior of any event on the web page. I have an anchor tag on the page and on the click on that tag I am redirecting the user on the website.

Now to cancel this redirection programmer can use:

$( document ).ready(function() {
    $( "a" ).click(function( event ) {

The above code will can cancel all the redirection of all the anchor tag on the page. If you want to prevent the behavior for some specific element then use their id or may be class selector. Selectors have discussed in earlier article, you can get more help out there.

Let’s suppose we have a form filling out all the details by the user and at the last there is a …

Implementing Batches in SQL Server and Guidelines

As a database developer, you might need to execute more than one SQL statement to perform a task. For example, when a new employee joins AdventureWorks, Inc., you need to insert the employee details in the database. The details of the employees are stored in more than one table. Therefore, you need to execute an insert statement into store the details in each table. In such a case, you can send all the SQL statements together to the SQL Server to be executed as a unit. This helps in reducing the network traffic.
Creating Batches A batch is a group of SQL statements submitted together to the SQL Server for execution. While executing batches, the SQL Server compiles the statements of a batch into a single executable unit called an execution plan. This helps in saving execution time.

Consider an example. You have to execute 10 statements and you are executing them one by one by sending 10 requests. This process takes time if your queries are in queue. All statements together in a batch,…

How to add jQuery to Web Pages: MVC

Programmer must include jQuery library on the web pages (views in case of MVC) to be execute all the functions/event/triggers written for that page in jQuery.  This article will lists all the options may be used to use jQuery on the pages.

To include jQuery there are two options which are basically used:
Include jQuery from googleDownload and then add a reference on your page. (
All the js files have two versions and can be downloaded through the website given above:
Development version:  uncompressed and readable, used for testing purposeProduction version: compressed and not readable, used on live sites.

In earlier article, we have studied about layout files and a simple view file that is used to render styles/scripts on the pages in MVC. So to include jQuery or any other file on the page we have two ways i.e.
Add reference on view: adding a reference on the view individually will only en…

Graph Introduction

Graph is a non-linear data structure which is a collection of nodes also called as vertices and edges also called as arcs. So, if 'G' is a Graph mathematically it is represented as, G=(V,E) where 'V' is the non empty set of vertices 'E' is the set of edges. The edge if it exists in the graph connects any two nodes only. There may be more than one edge connecting the same nodes. If the edges in a graph show direction then such edges are called as directed edges and the graphs containing such directed edges are called as directed graphs or simply digraphs. If the graph contains undirected edges (represented by straight lines) then it is called as undirected graph or simply graph.

Set of vertices, V={A,B,C,D,E,F,G} Set of edges, E={AB,AD,AF,BC, CE, DE, EG, FG}
In undirected graph the edge AB is similar to BA. Only one representation is considered. But in a directed graph the edge AB means, the edge starts from A and ends in B. Directed Graph or digraph:
Set of ve…

Types of Java Programs

Java is a programming language, by which we can design a new program or a software. It have many features, such as

Object Oriented LanguageSupport Cross PlatformPlatform independentStrongly typed languageMachine Dependent(JVM- Java Virtual Machine)Use Reference in place of pointer So you can make a new application in it. Java Support four types of application such as Console Based Application(Core Java)Client Based Application (Applet, Swings)Web Based Application (Applet, Servlet, JSP)Mobile Based Application (Android)1. Console Application- It also known as command based application. In which we can work only with non-GUI application. Suppose we want to create a new folder in system then what to do in DOS(console based). First of all we write a command for this, like mkdir. If you solve same problem in window(GUI) then do not need to write command for this, simply use mouse pointer and make a new folder.
Diagrammatic view of console window

2. Client based application : That applicatio…

How to Bind DropDownList with Enum MVC

Earlier article was about to bind DropDownList with simple select list of type selectlistitems. These select list may by any type of list either from database or temporary for that view only. In this article we will create an enum, then create a select list through that enum and finally will bind that to drop-down list.

Create an Enum like I have, named OptionType

enum OptionTypes

After creating enum, write a class that will work like a helper to create select list for that enum:

public static class EnumHelper
// Get the value of the description attribute if the   
// enum has one, otherwise use the value.  
public static string GetDescription<TEnum>(this TEnum value)
var fleid = value.GetType().GetField(value.ToString());

if (fleid != null)
var attributes = (DescriptionAttribute[])fleid.GetCustomAttributes(typeof(DescriptionAttribute), false);

if (attributes.Length > 0)
return attributes[0].Description;

return value.ToString();

/// <summary>

Student Information Project in PHP

Introduction Student information management system is a software application to  maintain the records related to student information , Fees status , marks and attendance.
Objective of the project The main objective of application is to automate the existing system manually maintain the record of student information ,marks , attendance and student search to be computerized. So searching  will be faster.
ApplicationsThis software covers following area

    It  is very  useful for schools and colleges.   All record is computerized to we can use it for colleges. Hardware and Software requirements 1. Dual core pc for server machine.
2. XAMPP for server machine
Future Scope
Can be used for ERP Application Project Snap Shot

How to Download the projectMail to me : Project contains Project ReportProject CodeProject PPT

Online result showing project in ASP.NET

Introduction This is the web application, in which you can get result of your all semester exam. After completing the exam you will get total result via this application. The main objective of this application is to get the result from any where, Suppose you are  a student, and  you loss your mark sheet when you go for interview. Before taking interview you can get result via college website.
Hardware and Software requirementHardware : Dual Core PC for Server machine, where you setup your project.
Software : IIS Web Server, DOTNET framework 4.0, SQL Server 2008.

How to run the application on client machine Step-1 : Open this website in visual studio 2010
Step-2 : Run the application via ctrl+f5
Step-3 : Search the result via SPN Number, which is include in database
Step-4 : Insert new record via admin panel.

Project nap Screen

Home screen show the links for navigate the application. After enter the SPN number into the project you can enter into the result page, which is shown above.