Month: March 2014

Friend Function

Posted on

#include<iostream.h>

#include<conio.h>

class greater

{

private:

int no1,no2,no3;

public :

greater()

{

no1=4;

no2=7;

no3=1;

}

greater(int x,int y,int z)

{

no1=x;

no2=y;

no3=z;

}

friend int larger(greater &);

};

int larger(greater &g)

{

if(g.no1>g.no2 && g.no1>g.no3)

return g.no1;

else if(g.no2>g.no1 && g.no2>g.no3)

return g.no2;

else

return g.no3;

}

void main()

{

greater g(45,66,56);

cout<<“greater no is “<<larger(g);

 

getch();

}

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

Using 2D Array

Posted on

#include<iostream.h>

#include<conio.h>

 

void main(){

clrscr();

int a[10][10],i,j,sum=0,m,n;

 

cout<<“\nEnter the row and column of matrix: “;

cin>>m;

cin>>n;

 

cout<<“\nEnter the elements of matrix: “;

for(i=0;i<m;i++)

for(j=0;j<n;j++)

cin>>a[i][j];

cout<<“\nThe matrix is\n”;

 

for(i=0;i<m;i++){

cout<<“\n”;

for(j=0;j<m;j++){

cout<<a[i][j];

}

}

for(i=0;i<m;i++){

for(j=0;j<n;j++){

if(i==j)

sum=sum+a[i][j];

}

}

cout<<“\n\nSum of the diagonal elements of a matrix is: “<<sum;

 

getch();

}

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

 

Using XSL

Posted on Updated on

To run this application we have to create to file one is xml and another xsl.

Fourth.xml

<?xml version =”1.0″?><?xml:stylesheet type=”text/xsl” href=”fourth.xsl”?>

<!DOCTYPE firstxsl SYSTEM “first.dtd”>

<firstxsl>

<first>

<heading> stylesheet </heading>

<body> learning xml </body>

</first>

</firstxsl>

Fourth.xsl

<?xml version=”1.0″?><xsl:stylesheet xmlns:xsl=”http://www.w3.org/TR/WD-xsl&#8221; result-ns=”html”>

<xsl:template match=”/”>

<xsl:apply-templates/>

</xsl:template>

<xsl:template match=”*”>

<xsl:apply-templates/>

</xsl:template>

<xsl:template match=”text()”>

<xsl:value-of select=”.”/>

</xsl:template>

<xsl:template match=”first”>

<html>

<font color=”red”>

<xsl:apply-templates select=”heading”/>

<br/>

</font>

<font color=”green”>

<xsl:apply-templates select=”body”/>

</font>

</html>

</xsl:template></xsl:stylesheet>

E. F. Codd’s 12 rules

Posted on

  • · Foundation Rule – A relational database management system must manage its stored data using only its relational capabilities.
  • · Information Rule – All information in the database should be represented in one and only one way – as values in a table.
  • · Guaranteed Access Rule – Each and every datum (atomic value) is guaranteed to be logically accessible by resorting to a combination of table name, primary key value and column name.
  • · Systematic Treatment of Null Values – Null values (distinct from empty character string or a string of blank characters and distinct from zero or any other number) are supported in the fully relational DBMS for representing missing information in a systematic way, independent of data type.
  • Dynamic On-line Catalog Based on the Relational Model – The database description is represented at the logical level in the same way as ordinary data, so authorized users can apply the same relational language to its interrogation as they apply to regular data.
  • · Comprehensive Data Sublanguage Rule – A relational system may support several languages and various modes of terminal use. However, there must be at least one language whose statements are expressible, per some well-defined syntax, as character strings and whose ability to support all of the following is comprehensible:
  1. data definition
  2. view definition
  3. data manipulation (interactive and by program)
  4. integrity constraints
  5. authorization
  6. Transaction boundaries (begin, commit, and rollback).

 

  • · View Updating Rule – All views that are theoretically updateable are also updateable by the system.
  • ·  High-level Insert, Update, and Delete – The capability of handling a base relation or a derived relation as a single operand applies nor only to the retrieval of data but also to the insertion, update, and deletion of data.
  • · Physical Data Independence – Application programs and terminal activities remain logically unimpaired whenever any changes are made in either storage representation or access methods.
  • · Logical Data Independence – Application programs and terminal activities remain logically unimpaired when information preserving changes of any kind that theoretically permit unimpairment are made to the base tables.
  • · Integrity Independence – Integrity constraints specific to a particular relational database must be definable in the relational data sublanguage and storable in the catalog, not in the application programs.
  • · Distribution Independence – The data manipulation sublanguage of a relational DBMS must enable application programs and terminal activities to remain logically unimpaired whether and whenever data are physically centralized or distributed.
  • · Nonsubversion Rule – If a relational system has or supports a low-level (single-record-at-a-time) language, that low-level language cannot be used to subvert or bypass the integrity rules or constraints expressed in the higher-level (multiple-records-at-a-time) relational language.

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

FILE HANDLING

Posted on Updated on

  • A file is a collection of data stored in a disk with a specific name and a directory path. When a file is opened for reading or writing, it becomes a stream.
  •  The stream is basically the sequence of bytes passing through the communication path. There are two main streams: the input stream and the output stream.
  • The input stream is used for reading data from file (read operation) and the output stream is used for writing into the file (write operation).
  •  The System.IO namespace has various classes that are used for performing various operations with files, like creating and deleting files, reading from or writing to a file, closing a file, etc.
  • The following table shows some commonly used non-abstract classes in the System.IO namespace:

I/O Class

Description

BinaryReader

Reads primitive data from a binary stream.

BinaryWriter

Writes primitive data in binary format.

BufferedStream

A temporary storage for a stream of bytes.

Directory

Helps in manipulating a directory structure.

DirectoryInfo

Used for performing operations on directories.

DriveInfo

Provides information for the drives.

File

Helps in manipulating files.

FileInfo

Used for performing operations on files.

FileStream

Used to read from and write to any location in a file.

MemoryStream

Used for random access of streamed data stored in memory.

Path

Performs operations on path information.

StreamReader

Used for reading characters from a byte stream.

StreamWriter

Is used for writing characters to a stream.

StringReader

Is used for reading from a string buffer.

StringWriter

Is used for writing into a string buffer.

 

FILESTREAM CLASS

  • The FileStream class in the System.IO namespace helps in reading from, writing to and closing files. This class derives from the abstract class Stream.
  •    To create a FileStream object to create a new file or open an existing files. The syntax for creating a FileStream object is as follows:

 

Dim <object_name> As FileStream = New FileStream(<file_name>, <FileMode Enumerator>, <FileAccess Enumerator>, <FileShare Enumerator>)
  • For example, for creating a FileStream object F for reading a file named sample.txt:
Dim f1 As FileStream = New FileStream("test.dat", FileMode.OpenOrCreate, FileAccess.ReadWrite)


Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: www.vissicomp.com

DATA STRUCTURE

Posted on

  •  Data structure is an arrangement of data in a computer’s memory or even disk storage. An example of several common data structures are arrays, linked lists, queues, stacks, binary trees, and hash tables.
  • Algorithms, on the other hand, are used to manipulate the data contained in these data structures as in searching and sorting.
  •  Many algorithms apply directly to a specific data structures. When working with certain data structures you need to know how to insert new data, search for a specified item, and deleting a specific item.
  •  Commonly used algorithms include are useful for:
  •   Searching for a particular data item (or record).
  •  Sorting the data. There are many ways to sort data, i.e. simple sorting and Advanced sorting.
  •  Iterating through all the items in a data structure. (Visiting each item in turn so as to display it or perform some other action on these.)

CHARACTERISTICS OF DATA STRUCTURE

Data Structure Advantages Disadvantages
Array Quick inserts
Fast access if index known
Slow search
Slow deletes
Fixed size
Ordered Array Faster search than unsorted array Slow inserts
Slow deletes
Fixed size
Stack Last-in, first-out acces Slow access to other items
Queue First-in, first-out access Slow access to other items
Linked List Quick inserts
Quick deletes
Slow search
Binary Tree Quick search
Quick inserts
Quick deletes
(If the tree remains balanced)
Deletion algorithm is complex
Red-Black Tree Quick search
Quick inserts
Quick deletes
(Tree always remains balanced)
Complex to implement
2-3-4 Tree Quick search
Quick inserts
Quick deletes
(Tree always remains balanced)
(Similar trees good for disk storage)
Complex to implement
Hash Table Very fast access if key is known
Quick inserts
Slow deletes
Access slow if key is not known
Inefficient memory usage
Heap Quick inserts
Quick deletes
Access to largest item
Slow access to other items
Graph Best models real-world situations Some algorithms are slow and very complex

Posted By -Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

Data Warehousing – Security

Posted on

  •  The objective data warehouse is to allow large amount of data to be easily accessible by the users. Hence allowing user to extract the information about the business as a whole. But we know that there could be some security restrictions applied on the data which can prove an obstacle for accessing the information. If the analyst has the restricted view of data then it is impossible to capture a complete picture of the trends within the business.
  • The data from each analyst can be summarised and passed onto management where the different summarise can be created. As the aggregations of summaries cannot be same as that of aggregation as a whole so It is possible to miss some information trends in the data unless someone is analysing the data as a whole.

Factor to Consider for Security requirements

  • The following are the parts that are affected by the security hence it is worth consider these factors.
  • User Access
  • Data Load
  • Data Movement
  • Query Generation

Requirements

  • Adding the security will affect the performance of the data warehouse, therefore it is worth determining the security requirements early as possible. Adding the security after the data warehouse has gone live, is very difficult.
  •  During the design phase of data warehouse we should keep in mind that what data sources may be added later and what would be the impact of adding those data sources. We should consider the following possibilities during the design phase.
  • Whether the new data sources will require new security and/or audit restrictions to be implemented?
  • Whether the new users added who have restricted access to data that is already generally available?
  • This situation arises when the future users and the data sources are not well known. In such a situation we need to use the knowledge of business and the objective of data warehouse to know likely requirements.

 

Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com

Introduction to ADO.NET

Posted on Updated on

  • ADO.NET is an object-oriented set of libraries that allows you to interact with data sources. Commonly, the data source is a data base, but it could also be a text file, an Excel spread sheet, or an XML file.
  •  There are many different types of data bases available. For example, there is Microsoft SQL Server, Microsoft Access, Oracle, Borland Interbase, and IBM DB2, just to name a few.

 

Data Providers

  •  ADO.NET allows us to interact with different types of data sources and different types of data bases. However, there isn’t a single set of classes that allow you to accomplish this universally. Since different data sources expose different protocols, we need a way to communicate with the right data source using the right protocol. Some older data sources use the ODBC protocol, many newer data sources use the OleDb protocol, and there are more data sources every day that allow you to communicate with them directly through .NET ADO.NET class libraries.
  •  ADO.NET provides a relatively common way to interact with data sources, but comes in different sets of libraries for each way you can talk to a data source. These libraries are called Data Providers and are usually named for the protocol or data source type they allow you to interact with.
  • Below table  lists some well known data providers, the API prefix they use, and the type of data source they allow you to interact with. ADO.NET Data Providers are class libraries that allow a common way to interact with specific data sources or protocols. The library AP Is have prefixes that indicate which provider they support.
Provider Name API prefix Data Source Description
ODBC Data Provider Odbc Data Sources with an ODBC interface. Normally older data bases.
OleDb Data Provider OleDb Data Sources that expose an OleDb interface, i.e. Access or Excel.
Oracle Data Provider Oracle For Oracle Data Bases.
SQL Data Provider Sql For interacting with Microsoft SQL Server
Borland Data Provider Bdp Generic access to many data bases such as Interbase, SQL Server, IBM DB2, and Oracle.

TRANSACTION

Posted on

  •  A transaction can be defined as a group of tasks. A single task is the minimum processing unit of work, which cannot be divided further.
  • An example of transaction can be bank accounts of two users, say A & B. When a bank employee transfers amount of Rs. 500 from A’s account to B’s account, a number of tasks are executed behind the screen. This very simple and small transaction includes several steps: decrease A’s bank account from 500

ACID PROPERTIES

A transaction may contain several low level tasks and further a transaction is very small unit of any program. A transaction in a database system must maintain some properties in order to ensure the accuracy of its completeness and data integrity. These properties are refer to as ACID properties and are mentioned below:

  • Atomicity: Though a transaction involves several low level operations but this property states that a transaction must be treated as an atomic unit, that is, either all of its operations are executed or none. There must be no state in database where the transaction is left partially completed. States should be defined either before the execution of the transaction or after the execution/abortion/failure of the transaction.
  • Consistency: This property states that after the transaction is finished, its database must remain in a consistent state. There must not be any possibility that some data is incorrectly affected by the execution of transaction. If the database was in a consistent state before the execution of the transaction, it must remain in consistent state after the execution of the transaction.
  • Durability: This property states that in any case all updates made on the database will persist even if the system fails and restarts. If a transaction writes or updates some data in database and commits that data will always be there in the database. If the transaction commits but data is not written on the disk and the system fails, that data will be updated once the system comes up.
  • Isolation: In a database system where more than one transaction are being executed simultaneous

Test Your Mathematical Logic

Posted on

1. Which number should come next in this series?

25,24,22,19,15

A. 4
B. 5
C. 10
D. 14

Correct answer: C
Explanation: The pattern decreases progressively: -1, -2, -3, -4, -5

 

2. Which number should come next in this series?

3,5,8,13,21,

A. 4
B. 21
C. 31
D. 34

Correct answer: D
Explanation: 3+5=8, 5+8=13 and so on.

 

3. Which number should replace the question mark?

17

8

5

5

13

7

5

4

6

12

6

3

10

6

4

?

A. 4
B. 5
C. 6
D. 7

Correct answer: A

(For each row the sum of the first two columns is equal to the multiple of the last two columns)

 

4. Which number should replace the question mark?

8

5

21

35

32

12

32

28

31

4

?

28

A. 3
B. -2
C. -6
D. 48

 

Correct answer: C

(For each row subtract the second column from the first column. The result is equal to the sum of the digits in the last column.)

 

Vissicomp Technology Pvt. Ltd.

Website -: www.vissicomp.com