Dev

Thursday, 28 July 2016

Difference between designing a relational database and an object database

  What are the main difference between designing a relational database and an object database?
Ans:

The main difference between designing a relational database and an object database are given below

  • Object database have better performance than relational database.
  • A relational databases relies on the relational model, on the other hand a object database             relies on the OOP.
  • The relational model organizes information in a set of tables each are composed of rows             and columns. Each column represents a property and each row represents an entity.
  • In a object oriented database each element resembles a object from the object oriented               paradigm.
  • It is reasonable easy to map object into relational databases.
  • In an object oriented database we will directly store the object into a DB, by using this              method we can store the images, videos, audio into a DB. But in Relational DB we will             store the data in the form of a relation.
What is the difference between structured and unstructured complex object

Unstructured Complex Objects
An unstructured complex object facility provided by a DBMS permits the storage and retrieval of large objects that are needed by the database application. Typical examples of such objects are bitmap images and long text strings (such as documents); they are also known as binary large objects, or BLOBs for short. These objects are unstructured in the sense that the DBMS does not know what their structure is—only the application that uses them can interpret their meaning. For example, the application may have functions to display an image or to search for certain keywords in a long text string. The objects are considered complex because they require a large area of storage and are not part of the standard data types provided by traditional DBMSs. Because the object size is quite large, a DBMS may retrieve a portion of the object and provide it to the application program before the whole object is retrieved. The DBMS may also use buffering and caching techniques to prefetch portions of the object before the application program needs to access them. 

The DBMS software does not have the capability to directly process selection conditions and other operations based on values of these objects, unless the application provides the code to do the comparison operations needed for the selection. In an OODBMS, this can be accomplished by defining a new abstract data type for the uninterpreted objects and by providing the methods for selecting, comparing, and displaying such objects. For example, consider objects that are two-dimensional bitmap images. Suppose that the application needs to select from a collection of such objects only those that include a certain pattern. In this case, the user must provide the pattern recognition program as a method on objects of the bitmap type. The OODBMS then retrieves an object from the database and runs the method for pattern recognition on it to determine whether the object includes the required
pattern.

Structured Complex Objects
A structured complex object differs from an unstructured complex object in that the object’s structure is defined by repeated application of the type constructors provided by the OODBMS. Hence, the object structure is defined and known to the OODBMS. As an example, consider the DEPARTMENT object shown in Figure 11.01. At the first level, the object has a tuple structure with six attributes: DNAME, DNUMBER, MGR, LOCATIONS, EMPLOYEES, and PROJECTS. However, only two of these attributes—namely, DNAME and DNUMBER—have basic values; the other four have complex values and hence build the second level of the complex object structure. One of these four (MGR) has a tuple structure, and the other three (LOCATIONS, EMPLOYEES, PROJECTS) have set structures. At the third level, for a MGR tuple value, we have one basic attribute (MANAGERSTARTDATE) and one attribute
(MANAGER) that refers to an employee object, which has a tuple structure. For a LOCATIONS set, we have a set of basic values, but for both the EMPLOYEES and the PROJECTS sets, we have sets of tuple-structured objects. 



Friday, 24 June 2016

Degree of homogeneity of DBMS

Degree of homogeneity of DBMS

If all servers (or individual local DBMSs) use identical software and all users (clients) use identical software, the DDBMS is called homogeneous; otherwise, it is called heterogeneous. Another factor related to the degree of homogeneity is the degree of local autonomy. If there is no provision for the local site to function as a stand-alone DBMS, then the system has no local autonomy. On the other hand, if direct access by local transactions to a server is permitted, the system has some degree of local autonomy. 

At one extreme of the autonomy spectrum, we have a DDBMS that "looks like" a centralized DBMS to the user. A single conceptual schema exists, and all access to the system is obtained through a site that is part of the DDBMS—which means that no local autonomy exists. At the other extreme we encounter a type of DDBMS called a federated DDBMS (or a multidatabase system). In such a system, each server is an independent and autonomous centralized DBMS that has its own local users, local transactions, and DBA and hence has a very high degree of local autonomy. The term federated database system (FDBS) is used when there is some global view or schema of the federation of databases that is shared by the applications. On the other hand, a multidatabase system does not have global schema and interactively constructs one as needed by the application. Both systems are hybrids between distributed and centralized systems and the distinction we made between them is not strictly followed. We will refer to them as FDBSs in a generic sense. 


In a heterogeneous FDBS, one server may be a relational DBMS, another a network DBMS, and a third an object or hierarchical DBMS; in such a case it is necessary to have a canonical system language and to include language translators to translate subqueries from the canonical language to the language of each server. 




Friday, 13 May 2016

Distribution Transparency

Distribution Transparency

 An important goal of a distributed system is to hide the fact that its processes and resources are physically distributed across multiple computers. A distributed system that is able to present itself to users and applications as if it were only a single computer system is said to be transparent. Let us first take a look at what kinds of transparency exist in distributed systems. After that we will address the more general question whether transparency is always required. Types of Transparency The concept of transparency can be applied to several aspects of a distributed system, the most important ones shown in Fig. below:
Figure: Different forms of transparency in a distributed system

Access transparency deals with hiding differences in data representation and the way that resources can be accessed by users. At a basic level, we wish to hide differences in machine architectures, but more important is that we reach agreement on how data is to be represented by different machines and operating systems. For example, a distributed system may have computer systems that run different operating systems, each having their own file-naming conventions. Differences in naming conventions, as well as how files can be manipulated, should all be hidden from users and applications.

An important group of transparency types has to do with the location of a re-source. Location transparency refers to the fact that users cannot tell where a re-source is physically located in the system. Naming plays an important role in achieving location transparency. In particular, location transparency can be achieved by assigning only logical names to resources, that is, names in which the location of a resource is not secretly encoded. An example of a such a name is the URL http://www.prenhall.com/index.html. which gives no clue about the location of Prentice Hall's main Web server. The URL also gives no clue as to whetherindex.html has always been at its current location or was recently moved there. Distributed systems in which resources can be moved without affecting how those resources can be accessed are said to provide migration transparency. Even stronger is the situation in which resources can be relocated while they are being accessed without the user or application noticing anything. In such cases, the sys-tem is said to support relocation transparency. An example of relocation transparency is when mobile users can continue to use their wireless laptops while moving from place to place without ever being (temporarily) disconnected.

As we shall see, replication plays a very important role in distributed systems. For example, resources may be replicated to increase availability or to improve performance by placing a copy close to the place where it is accessed. Replication transparency deals with hiding the fact that several copies of a resource exist. To hide replication from users, it is necessary that all replicas have the same name. Consequently, a system that supports replication transparency should generally support location transparency as well, because it would otherwise be impossible to refer to replicas at different locations.

Tuesday, 8 March 2016

Sample ER Diagrams


Fig: ER Diagram of car- insurance company
 ________________________________________________________________________________
Fig: ER Diagram for marks Database
 _________________________________________________________________________________
Fig: ER Diagram for Hospital
 _______________________________________________________________________________
Fig: ER Diagram for University

Monday, 11 January 2016

Tag libraries, Namespaces

Meaning of  Tag Libraries: 

In a Web application, a common design goal is to separate the display code from business logic. Java tag libraries are one solution to this problem. Tag libraries allow you to isolate business logic from the display code by creating a Tag class (which performs the business logic) and including an HTML-like tag in your JSP page. When the Web server encounters the tag within your JSP page, the Web server will call methods within the corresponding Java Tag class to produce the required HTML content.



Namespaces
Advantages
  • It helps us avoid real name clashes with other XML vocabularies.
  • Moreover, namespaces may be used, if XML documents will be distributed to others, when name collisions may really become an issue.

Disadvantages
  • Namespaces, increases the size of XML documents.
  • With namespaces, we need to be extra careful while writing applications (all our programming expressions, querying & creating the XML nodes must be namespace aware). This namespace-awareness overhead (effort to create, and maintain) should be incurred, only if an application requires it (i.e, if management of name collisions isreally needed).



Sunday, 10 January 2016

File Handling

File Handling concept in C#.

File handling simply deal with creating, reading, deleting and editing files. Website can handle local files. It can read from, and write to, a text file on the disk. The code can run on any server with file system privileges—and also a local development machine
There are some methods of File which is mostly used in Real application.
1.    Create :-In this mode New File will be created .If  File is Exist then It will be Overridden.
How to create a File using C# File class ?
In order to create a new File using C# File class , we can call Create method in the File class.
CSharp Code : File.Create("c:\\testFile.txt");

2.     Append :-  In Append mode Existing File will be open and contents will be written from Last .If File  is not Exist then new File will be created. Append mode is used Between two Files.

3.    Create New:-In this mode New File will be created, if File is already Exist then it will thrown Exception.

4.    Open:- In this Existing file will be opened if file  is not Exist then it will be thrown Exception. 

5.    OpenRead:- In this Opens the Existing File for Reading the Contents.

6.    Truncate:-In this  Existing File will be open and the Entire contents of the file will be removed.But if the file is not Exist then it will be thrown Exception.
 StreamReader Class:
§  Flush():- Flush function is used for immediately save the File contents from Buffer to Memory.
§  Close():-Close function is used for closing the file.If we do not write close() statement in our program then File will be always open mode ,then No other person will be used this File at that time. This is the reason for using close statement in  the File Program.
§  Read()- It is used for Reading the Value using File Stream.
§  Read-line():-It is used  for Read  the value  using File Stream in a File Line by Line.
§  Peek():- It returns next value but not use it.
§  Seek():- It is used for Read/Write a values at any positions in a file.
StreamWriter Class:
§  close()-->Close function is used for closing the file.
§  Flush():-Flush function is used for immediately save the File contents from Buffer to Memory.
§  Write():- It is used for writing a File using File stream class.


§  WriteLine():- It is used to write a File Line by Line using File stream.

How a Domain Name is translated to an IP Address?

How a Domain Name is translated to an IP Address?

DNS (Domain Name System) is what translate domain name (for eg. www.google.com) into an IP address that our browser can use (for eg. 173.194.35.148). Before the page is loaded, the DNS must be resolved so the browser can establish a TCP connection to make the HTTP request. The DNS Resolution process starts when the user types a URL address on the browser and hits Enter.

On the Internet, many communications programs deal only with IP addresses, yet allow their users to specify machines in terms of their host names (or alias host names). Or a program which already knows the IP address must determine the domain name for the network to which the machine is connected. Such programs must somehow convert the host names into IP addresses (or vice versa) behind the scenes. How do they achieve this translation between IP addresses and host names?

The mapping of host names to IP addresses is handled through a service called Domain Name Service (DNS). Rather than require individual machines, applications, or users to keep up with the constant changes in host names and IP addresses, a series of special DNS servers across the world (known as "name servers") keep track of the name/address information for all the computers on the Internet. Applications that need to determine an IP address from a host name (or vice versa) contact the local "name server" to supply this information.

For instance, if you use a web browser to check out the site "web.mit.edu", the program actually first contacts your local DNS machine to obtain the IP-address that matches the host name you provided; then the program uses that IP address to complete your request.

DNS is used much more frequently than is usually supposed: virtually every activity that moves information across the network (getting web documents, transferring files, sending or receiving electronic mail) relies on DNS.


Anonymous access and Windows Authentication

Authentication:

Authentication: Authentication is the process of determining the identity of a user based on the user’s credentials. The user’s credentials are usually in the form of user ID and password, which is checked against any credentials' store such as database. If the credentials provided by the user are valid, then the user is considered an authenticated user.
In ASP.NET there are different ways in which authentication is performed as discussed below:

   1)               Anonymous Access: There is no authentication performed and the user is treated as       anonymous user by IIS.

Sometimes it is necessary or possible to access any data from remote server or database without any authenticated person. If the data is easily accessible without any authentication (i.e username and password) that means the user accessing those data or file has an anonymous access. There is no difference between a user who is “anonymously authenticated” and an unauthenticated user. There can be many situations where anonymous authentication is useful.


    2)      Windows Authentication: Provides information on how to use Windows authentication in conjunction with Microsoft Internet Information Services (IIS) authentication to secure ASP.NET applications. This is the default authentication mode in ASP.NET and it is set in web.config file of the application.

Windows Authentication uses the security features of Windows clients and servers. Unlike Basic authentication, initially, it does not prompt users for a user name and password. The current Windows user information on the client computer is supplied by the web browser through a cryptographic exchange involving hashing with the Web server. If the authentication exchange initially fails to identify the user, the web browser will prompt the user for a Windows user account user name and password.

Windows authentication is generally used if the users accessing the application belong to same organization.
This authentication method uses Windows accounts for validating users' credentials. This type of authentication is very good for intranet Web sites where we know our users.


What is session? What are uses of session?

Q. What is session? What are uses of session?
A session is a way to store information (in variables) to be used across multiple pages. Unlike a cookie, the information is not stored on the users computer rather session is stored in server.
When you work with an application, you open it, do some changes, and then you close it. This is much like a Session. The computer knows who you are. It knows when you start the application and when you end. But on the internet there is one problem: the web server does not know who you are or what you do, because the HTTP address doesn't maintain state.
Session variables solve this problem by storing user information to be used across multiple pages (e.g. username, favorite color, etc.). By default, session variables last until the user closes the browser. So; Session variables hold information about one single user, and are available to all pages in one application.

Fig : For every client session data is stored seperately

The following example shows how to create session variables in an ASP.NET page for the first and last name of a user, and set them to values retrieved from TextBox controls.
Session["FirstName"] = FirstNameTextBox.Text;
Session["LastName"] = LastNameTextBox.Text;

and to show this on page:

string username = Session["FirstName"] as string;
label1.Text = "Welcome" + Username;

A session ends if a user has not requested or refreshed a page in the application for a specified period. By default, this is 20 minutes. If you want to set a timeout interval that is shorter or longer than the default, use the Timeout property.
The example below sets a timeout interval of 5 minutes:

<%
Session.Timeout=5
%>
Uses of session
-          Carrying information as a client travels between pages.
-          One page data can be stored in session variable and that data can be accessed from other pages.
-          Session can help to uniquely identify each client from another
-          Session is mostly used in ecommerce sites where there is shopping cart system.
-          It helps maintain user state and data all over the application.
-          It is easy to implement and we can store any kind of object.
-          Stores client data separately.
-          Session is secure and transparent from the user.
Disadvantages of session:
-          Performance overhead in case of large volumes of data/user, because session data is stored in server memory.


Friday, 8 January 2016

What are anti overload techniques in web server?

 What are anti overload techniques in web server?
At any time web servers can be overloaded because of:
  • -          Too much legitimate web traffic
  • -          Thousands or even millions of clients hitting the web site in a short interval of time (DDoS) Distributed Denial of Service attacks
  • -          Computer worms
  • -          Millions of infected browsers and/or web servers
  • -          limited on large web sites with very few resources (bandwidth, etc.)
  • -          Client requests are served more slowly and the number of connections increases so much that server limits are reached
  • -          Web servers required  urgent maintenance or upgrade
  • -          Hardware Software failures

To partially overcome load limits and to prevent overload we can use techniques like:
  • -          Managing network traffic by using: Firewalls, Block unwanted traffic
  • -          HTTP traffic managers- redirect or rewrite requests having bad HTTP patterns
  • -          Bandwidth management and traffic shaping
  • -          Deploying web cache techniques
  • -          Use different domains to serve different content (static and dynamic) by separate Web servers,
  • -          Add more hardware resources
  • -          Use many web servers

These technique to limit the load on websites are called anti-overload techniques in web server.


Saturday, 2 January 2016

HTTP and FTP Functions

HTTP Functions:
The HTTP functions let you manipulate information sent to the browser by the Web server, before any other output has been sent.
Function
Description
Sends a raw HTTP header to a client
Syntax: header(string, replace, http_response_code)
Returns a list of response headers sent (or ready to send)
Syntax: headers_list()
To determine whether or not the headers have been sent yet, use the headers_sent() function.
Checks if / where the HTTP headers have been sent
Syntax: headers_sent(file,line)
Defines a cookie to be sent along with the rest of the HTTP headers
Syntax: setcookie(name,value,expire,path,domain,secure,httponly);
A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too.
Defines a cookie (without URL encoding) to be sent along with the rest of the HTTP headers
Syntax: setrawcookie(name,value,expire,path,domain,secure);

FTP Functions:
The FTP functions give client access to file servers through the File Transfer Protocol (FTP).
The FTP functions are used to open, login and close connections, as well as upload, download, rename, delete, and get information on files from file servers. Not all of the FTP functions will work with every server or return the same results.
Some FTP Functions are given below:
ftp_alloc — Allocates space for a file to be uploaded
ftp_cdup — Changes to the parent directory
ftp_chdir — Changes the current directory on a FTP server
ftp_chmod — Set permissions on a file via FTP
ftp_close — Closes an FTP connection
ftp_connect — Opens an FTP connection
ftp_delete — Deletes a file on the FTP server
ftp_exec — Requests execution of a command on the FTP server
ftp_fget — Downloads a file from the FTP server and saves to an open file
ftp_fput — Uploads from an open file to the FTP server
ftp_get_option — Retrieves various runtime behaviours of the current FTP stream
ftp_get — Downloads a file from the FTP server
ftp_login — Logs in to an FTP connection
ftp_mdtm — Returns the last modified time of the given file
ftp_mkdir — Creates a directory
ftp_nb_continue — Continues retrieving/sending a file (non-blocking)
ftp_nb_fput — Stores a file from an open file to the FTP server (non-blocking)
ftp_nb_get — Retrieves a file from the FTP server and writes it to a local file (non-blocking)
ftp_nb_put — Stores a file on the FTP server (non-blocking)
ftp_nlist — Returns a list of files in the given directory
ftp_put — Uploads a file to the FTP server
ftp_pwd — Returns the current directory name
ftp_quit — Alias of ftp_close
ftp_rename — Renames a file or a directory on the FTP server
ftp_rmdir — Removes a directory
ftp_set_option — Set miscellaneous runtime FTP options
ftp_site — Sends a SITE command to the server
ftp_size — Returns the size of the given file
ftp_ssl_connect — Opens an Secure SSL-FTP connection