Showing posts with label ojas nain. Show all posts
Showing posts with label ojas nain. Show all posts

Friday, September 9, 2011

Slide Show Code Using Javascript by anil kumar nain 9416077273

Slide show code using javascript by anil kumar nain 9416077273


var SlideShowSpeed = 4000;

var CrossFadeDuration = 4;

var Picture = new Array();

Picture[1] = 'images/1.jpg';
Picture[2] = 'images/2.jpg';
Picture[3] = 'images/3.jpg';
Picture[4] = 'images/4.jpg';
Picture[5] = 'images/5.jpg';


var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;

var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++) { preLoad[iss] = new Image(); preLoad[iss].src = Picture[iss]; }
function runSlideShow()
{ if (document.all){ document.images.PictureBox.style.filter="blendTrans(duration=2)"; document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)"; document.images.PictureBox.filters.blendTrans.Apply();} document.images.PictureBox.src = preLoad[jss].src; if (document.all) document.images.PictureBox.filters.blendTrans.Play(); jss = jss + 1; if (jss > (pss)) jss=1;
tss = setTimeout('runSlideShow()', SlideShowSpeed);
}

function setVisible(obj)
{
obj = document.getElementById(obj);
obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
}

paste this function in body tag runslideshow();

and paste following
img name="PictureBox" alt="Images of DSE" src="http://www.blogger.com/images/1.jpg" width="464" height="117"




Monday, July 4, 2011

free IP Address for BSNL LAN For Communcation

communication and conactivity for BSNL
192.168.1.50
255.255....
default gateways 192.168.1.1
use the following DSN server addresses
per fared 218.248.240.208
alternate 218.248.240.135

Wednesday, December 8, 2010

Grid view in asp.net all Edit,Update,RowEditCancel,Delete by anil nain 9416077273

Grid view in asp.net all Edit,Update,RowEditCancel,Delete by anil nain 9416077273
Abstract: This program tells us how write code for Grid View Example with Edit,Update,RowEditCancel,Delete,Delete Multiple Rows using Check Box, CheckAll/UnCheckAll item of checkbox using dataset.Assumptions-We are using SQL Server Express/SQL SERVER 2005 editions as Database.Table Name- StudentsFields- RollNo, SName, Course, Doj(Date of Joining), FeePaid –For detail description of Database goto bottom of page.Take GridView control on page and set the ID property to GridView1.Go to property builder by right click on GridView -> Show Smart Tag -> Edit Columns. Uncheck Auto-Generate Field from the Property window.Add three TemplateField Column for RollNo, SName, Course, Doj(Date of Joining), FeePaid, & Delete Button in template field. Add Edit button from CommandField Group from Property Window.TemplateField Colums have ItemTemplate, Alternating Item Template, Edit Template, Header Template, Footer Template. Each template columns Item Template field contains Label Control & Edit Template contains TextBox control for Editing item. Set the Binding Field name to the Text Property of both controls for each template field to the respective Database Column Name i.e Eval("SName"). Similarly others also.Set the DataKeyNames property of GridView to Primary Key Column of DataBase i.e. RollNo. This property binds the database column field value to each row of gridview as a Unique Identifier.Set the data bindings for Delete Button for CommandArgument Eval("RollNo"); for saving the ID column value from database for fetching the ID field value while Deleting the Record. Set the CommandName property to Delete Button to CMDDelete.
The CommandName property can contain any string name which can be used to recognize the type of command invoked from gridview. Because when any of the event generated in GridVeiw it fires RowCommand Event. In this event we have to handle the Delete Button Code. Instead if you are using default Delete Button of GridView then register for RowDeleting event of GridView and for accessing Unique ID columnvalue from database you need to fetch the id from DataKeys collection of GridView. For e.g.int RollNo = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value); Place the Textbox control in the grids Footer template for Adding new record. Set the CommandName to CMDAdd for Add button.Register events for Edit, Update, Cancel button of gridview – RowEditing, RowUpdating, RowCancelEditing. View in GridViewTo view data in gridview is very simple. Just create a DataSet using SqlDataAdapter’s Fill method and set the GridViews DataSource Property to DataSet.Create a Method to Bind the GridView to DataSource named BindGrid. This method fetches data from the GetStudents method which returns DataSet from Employees table.Call the BindGrid on Page_Load in !IsPostBack block to fill the grid by default.//Code for displaying data in grid view private void BindGrid()
{ GridView1.DataSource = GetStudents(); GridView1.DataBind(); }
//Code for connectioning to the server private DataSet GetStudents() { DataSet ds = new DataSet(); SqlConnection conn = new SqlConnection("Data Source=saibaba;Initial Catalog=GENERALEXAMPLE;User ID=sa;pwd=sa1"); SqlDataAdapter da = new SqlDataAdapter("Select * From Students", conn); try
{ da.Fill(ds); return ds; } catch (Exception ex) { throw new Exception(ex.Message); } finally { conn.Close(); conn.Dispose(); } return null; } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindGrid(); } } Edit in GridViewFor Editing Register RowEditing event of GridView. To switch the normal mode to Edit mode of gridview EditIndex property plays important role. EditIndex specifies which row is in edit mode by setting RowIndex to it. By default EditIndex of gridview is -1 (Normal mode). If you want to edit 3rd Row – then set the EditIndex to 2 (Row index starts from 0,1,2..).After setting editindex refresh the grid by calling BinGrid. GridViewEditEventArgs object knows the current row index so getting row index of the selected row in gridveiw is not big deal;
just e.NewEditIndex (e object of GridViewEditEventArgs).protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{ GridView1.EditIndex = e.NewEditIndex; BindGrid();
}Cancel in GridViewFor Cancel just reset the GridView editindex to default i.e. -1 and refresh the grid.protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{ GridView1.EditIndex = -1; BindGrid();
}Update in GridViewFor Update register RowUpdating event of the gridview. Find the Unique id for updating the row from DataKeys collection of gridview.protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int RollNo = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
//Find Text boxex
TextBox TSName1 = GridView1.Rows[e.RowIndex].FindControl("TSName") as TextBox;
TextBox TCourse1 = GridView1.Rows[e.RowIndex].FindControl("TCourse") as TextBox;
TextBox TDoj1 = GridView1.Rows[e.RowIndex].FindControl("TDoj") as TextBox;
TextBox TFeePaid1 = GridView1.Rows[e.RowIndex].FindControl("TFeePaid") as TextBox;
if (TSName1 != null && TCourse1 != null && TDoj1 != null && TFeePaid1 != null)
UpdateStudent(RollNo, TSName1.Text.Trim(), TCourse1.Text.Trim(), DateTime.Parse(TDoj1.Text.Trim()),Decimal.Parse(TFeePaid1.Text.Trim())); GridView1.EditIndex = -1; BindGrid(); }Custom Delete in GridViewFor Delete register RowCommand event of the gridview. Find the Unique id for deleting the row from DataKeys collection of gridview. Check for CommanName and invoke delete method for the selected row.Add in GridViewAdding from GridView is just some trick with Footer Template. I added textboxes and a add button in the footer row of the gridview. When u are in Normal mode it is visible else it is invisible to synchronize between edit and add. Like Updating find the Textbox and pass the values to Addemployee method likeprotected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("CMDDelete")) { int RollNo = Convert.ToInt32(e.CommandArgument); DeleteStudent(RollNo); //Refresh Grid BindGrid(); } else if (e.CommandName.Equals("CMDAdd")) { TextBox TSName1 = GridView1.FooterRow.FindControl("TSName") as TextBox; TextBox TCourse1 = GridView1.FooterRow.FindControl("TCourse") as TextBox; TextBox TDoj1 = GridView1.FooterRow.FindControl("TDoj") as TextBox;
TextBox TFeePaid1 = GridView1.FooterRow.FindControl("TFeePaid") as TextBox; if (TSName1 != null && TCourse1 != null && TDoj1 != null && TFeePaid1 != null) { AddStudent(TSName1.Text.Trim(), TCourse1.Text.Trim(), DateTime.Parse(TDoj1.Text), Decimal.Parse(TFeePaid1.Text.Trim())); BindGrid(); }
}}
See below for completed code including Check All/ Uncheck All, Deleting multiple rows
ASPX Page







Grid view in asp.net all Edit,Update,RowEditCancel,Delete by anil nain 9416077273

Saturday, September 25, 2010

Calculating Age with ActionScript by anil nain 9416077273


Calculating Age with ActionScript
बी अनिल nain 9416077273
Here is a simple ActionScript 3 class to calculate the age in Years, Months and Days for a given date.
public class CalculateAge {
public var years:Number;
public var months:Number;
public var days:Number;
public function CalculateAge(year:Number,month:Number,date:Number) {
var seconds:Number=convertToSeconds(year,month-1,date);
years=getYears(seconds);
days=getDays(seconds);
months=getMonths(seconds);
}
private function getMonths(timeInSecs:Number):Number {
var totalMonths=Math.floor(days/30);
return totalMonths;
}
private function getYears(timeInSecs:Number):Number {
var totalYears:Number=Math.floor(timeInSecs/(60*60*24*365.25*1000));
return totalYears;
}
private function getDays(timeInSecs:Number):Number {
var totalDays:Number=Math.floor(Math.floor(timeInSecs/(60*60*24*1000)))%365.25;
totalDays=Math.floor(totalDays%30);
return totalDays;
}
private function convertToSeconds(year:Number,month:Number,date:Number):Number {
var birth_date:Date=new Date(year,month,date);
var cur_date:Date=new Date ;
var inSecs:Number=cur_date.getTime()-birth_date.getTime();
return inSecs;
}

}
Usage:
//CalculateAge(year, month, date);
var myAge:CalculateAge = new CalculateAge(1970, 11, 1);
trace(myAge.years); // will return years
trace(myAge.months); // will return months
trace(myAge.days); // will return days

Tuesday, May 18, 2010

Database Administrator by anil nain 9416077273

Database Administrator by anil nain 9416077273

Database Administrator by anil nain 9416077273
One of the main reasons for using DBMS is to have central control of both the data and the processes that access those data. The person who has such central control over the system is called the database administrator (DBA). The functions of the DBA include the following:
· Schema Definition: The DBA creates the original database schema by writing a set of definitions that is translated by the DDL (Data Defn. Lang.) Compiler to a set of tables that is store permanently in the data dictionary.
· Storage Structure and Access-Method Definition: The DBA creates appropriate storage structures and access methods by writing a set of definitions, which are translated by the DDL compiler.
· Schema and Physical-Organisation Modification: Programmers accomplish the relatively rare modifications either to the database schema or to the description of the physical storage organisation. By writing a set of definitions that is used by either the DDL compiler or the data-storage and data defn. language compilers to generate modifications to the appropriate intend system-tables (for example, the data dictionary).
· Growing of Authorisation for Data Access: The granting of different types of authorisation allows the DBA to regulate the parts of the database, which various users can access.
· Integrity-Constraint Specification: The data values stored in the database must satisfy certain consistency constraints e.g., perhaps the number of hours an employee may work in 1 week may not exceed a specified limit .
Database Administrator by anil nain 9416077273

Saturday, March 20, 2010

The 25 most difficult questions you'll be asked on a job interview by anil nain 9416077273


The 25 most difficult questions you'll be asked on a job interview
Being prepared is half the battle.
If you are one of those executive types unhappy at your present post and embarking on a New Year's resolution to find a new one, here's a helping hand. The job interview is considered to be the most critical aspect of every expedition that brings you face-to- face with the future boss. One must prepare for it with the same tenacity and quickness as one does for a fencing tournament or a chess match.
1. Tell me about yourself.
Since this is often the opening question in an interview, be extracareful that you don't run off at the mouth. Keep your answer to a minute or two at most. Cover four topics: early years, education, work history, and recent career experience. Emphasize this last subject. Remember that this is likely to be a warm-up question. Don't waste your best points on it.
2. What do you know about our organization?
You should be able to discuss products or services, revenues, reputation, image, goals, problems, management style, people, history and philosophy. But don't act as if you know everything about the place. Let your answer show that you have taken the time to do some research, but don't overwhelm the interviewer, and make it clear that you wish to learn more.
You might start your answer in this manner: "In my job search, I've investigated a number of companies.
Yours is one of the few that interests me, for these reasons..."
Give your answer a positive tone. Don't say, "Well, everyone tells me that you're in all sorts of trouble, and that's why I'm here", even if that is why you're there.
3. Why do you want to work for us?
The deadliest answer you can give is "Because I like people." What else would you like-animals?
Here, and throughout the interview, a good answer comes from having done your homework so that you can speak in terms of the company's needs. You might say that your research has shown that the company is doing things you would like to be involved with, and that it's doing them in ways that greatly interest you. For example, if the organization is known for strong management, your answer should mention that fact and show that you would like to be a part of that team. If the company places a great deal of emphasis on research and development, emphasize the fact that you want to create new things and that you know this is a place in which such activity is encouraged. If the organization stresses financial controls, your answer should mention a reverence for numbers.
If you feel that you have to concoct an answer to this question - if, for example, the company stresses research, and you feel that you should mention it even though it really doesn't interest you- then you probably should not be taking that interview, because you probably shouldn't be considering a job with that organization.
Your homework should include learning enough about the company to avoid approaching places where you wouldn't be able -or wouldn't want- to function. Since most of us are poor liars, it's difficult to con anyone in an interview. But even if you should succeed at it, your prize is a job you don't really want.
4. What can you do for us that someone else can't?
Here you have every right, and perhaps an obligation, to toot your own horn and be a bit egotistical. Talk about your record of getting things done, and mention specifics from your resume or list of career accomplishments. Say that your skills and interests, combined with this history of getting results, make you valuable. Mention your ability to set priorities, identify problems, and use your experience and energy to solve them.
5. What do you find most attractive about this position? What seems least attractive about it?
List three or four attractive factors of the job, and mention a single, minor, unattractive item.
6. Why should we hire you?
Create your answer by thinking in terms of your ability, your experience, and your energy. (See question 4.)
7. What do you look for in a job?
Keep your answer oriented to opportunities at this organization. Talk about your desire to perform and be recognized for your contributions. Make your answer oriented toward opportunity rather than personal security.
8. Please give me your defintion of [the position for which you are being interviewed].
Keep your answer brief and taskoriented. Think in in terms of responsibilities and accountability. Make sure that you really do understand what the position involves before you attempt an answer. If you are not certain. ask the interviewer; he or she may answer the question for you.
9. How long would it take you to make a meaningful contribution to our firm?
Be realistic. Say that, while you would expect to meet pressing demands and pull your own weight from the first day, it might take six months to a year before you could expect to know the organization and its needs well enough to make a major contribution.
10. How long would you stay with us?
Say that you are interested in a career with the organization, but admit that you would have to continue to feel challenged to remain with any organization. Think in terms of, "As long as we both feel achievement-oriented."
11. Your resume suggests that you may be over-qualified or too experienced for this position. What's Your opinion?
Emphasize your interest in establishing a long-term association with the organization, and say that you assume that if you perform well in his job, new opportunities will open up for you. Mention that a strong company needs a strong staff. Observe that experienced executives are always at a premium. Suggest that since you are so wellqualified, the employer will get a fast return on his investment. Say that a growing, energetic company can never have too much talent.
12. What is your management style?
You should know enough about the company's style to know that your management style will complement it. Possible styles include: task oriented (I'll enjoy problem-solving identifying what's wrong, choosing a solution and implementing it"), results-oriented ("Every management decision I make is determined by how it will affect the bottom line"), or even paternalistic ("I'm committed to taking care of my subordinates and pointing them in the right direction").
A participative style is currently quite popular: an open-door method of managing in which you get things done by motivating people and delegating responsibility.
As you consider this question, think about whether your style will let you work hatppily and effectively within the organization.
13. Are you a good manager? Can you give me some examples? Do you feel that you have top managerial potential?
Keep your answer achievementand ask-oriented. Rely on examples from your career to buttress your argument. Stress your experience and your energy.
14. What do you look for when You hire people?
Think in terms of skills. initiative, and the adaptability to be able to work comfortably and effectively with others. Mention that you like to hire people who appear capable of moving up in the organization.
15. Have you ever had to fire people? What were the reasons, and how did you handle the situation?
Admit that the situation was not easy, but say that it worked out well, both for the company and, you think, for the individual. Show that, like anyone else, you don't enjoy unpleasant tasks but that you can resolve them efficiently and -in the case of firing someone- humanely.
16. What do you think is the most difficult thing about being a manager or executive?
Mention planning, execution, and cost-control. The most difficult task is to motivate and manage employess to get something planned and completed on time and within the budget.
17. What important trends do you see in our industry?
Be prepared with two or three trends that illustrate how well you understand your industry. You might consider technological challenges or opportunities, economic conditions, or even regulatory demands as you collect your thoughts about the direction in which your business is heading.
18. Why are you leaving (did you leave) your present (last) job?
Be brief, to the point, and as honest as you can without hurting yourself. Refer back to the planning phase of your job search. where you considered this topic as you set your reference statements. If you were laid off in an across-the-board cutback, say so; otherwise, indicate that the move was your decision, the result of your action. Do not mention personality conflicts.
The interviewer may spend some time probing you on this issue, particularly if it is clear that you were terminated. The "We agreed to disagree" approach may be useful. Remember hat your references are likely to be checked, so don't concoct a story for an interview.
19. How do you feel about leaving all your benefits to find a new job?
Mention that you are concerned, naturally, but not panicked. You are willing to accept some risk to find the right job for yourself. Don't suggest that security might interest you more than getting the job done successfully.
20. In your current (last) position, what features do (did) you like the most? The least?
Be careful and be positive. Describe more features that you liked than disliked. Don't cite personality problems. If you make your last job sound terrible, an interviewer may wonder why you remained there until now.
21. What do you think of your boss?
Be as positive as you can. A potential boss is likely to wonder if you might talk about him in similar terms at some point in the future.
22. Why aren't you earning more at your age?
Say that this is one reason that you are conducting this job search. Don't be defensive.
23. What do you feel this position should pay?
Salary is a delicate topic. We suggest that you defer tying yourself to a precise figure for as long as you can do so politely. You might say, "I understand that the range for this job is between $______ and $______. That seems appropriate for the job as I understand it." You might answer the question with a question: "Perhaps you can help me on this one. Can you tell me if there is a range for similar jobs in the organization?"
If you are asked the question during an initial screening interview, you might say that you feel you need to know more about the position's responsibilities before you could give a meaningful answer to that question. Here, too, either by asking the interviewer or search executive (if one is involved), or in research done as part of your homework, you can try to find out whether there is a salary grade attached to the job. If there is, and if you can live with it, say that the range seems right to you.
If the interviewer continues to probe, you might say, "You know that I'm making $______ now. Like everyone else, I'd like to improve on that figure, but my major interest is with the job itself." Remember that the act of taking a new job does not, in and of itself, make you worth more money.
If a search firm is involved, your contact there may be able to help with the salary question. He or she may even be able to run interference for you. If, for instance, he tells you what the position pays, and you tell him that you are earning that amount now and would Like to do a bit better, he might go back to the employer and propose that you be offered an additional 10%.
If no price range is attached to the job, and the interviewer continues to press the subject, then you will have to restpond with a number. You cannot leave the impression that it does not really matter, that you'll accept whatever is offered. If you've been making $80,000 a year, you can't say that a $35,000 figure would be fine without sounding as if you've given up on yourself. (If you are making a radical career change, however, this kind of disparity may be more reasonable and understandable.)
Don't sell yourself short, but continue to stress the fact that the job itself is the most important thing in your mind. The interviewer may be trying to determine just how much you want the job. Don't leave the impression that money is the only thing that is important to you. Link questions of salary to the work itself.
But whenever possible, say as little as you can about salary until you reach the "final" stage of the interview process. At that point, you know that the company is genuinely interested in you and that it is likely to be flexible in salary negotiations.
24. What are your long-range goals?
Refer back to the planning phase of your job search. Don't answer, "I want the job you've advertised." Relate your goals to the company you are interviewing: 'in a firm like yours, I would like to..."
25. How successful do you you've been so far?
Say that, all-in-all, you're happy with the way your career has progressed so far. Given the normal ups and downs of life, you feel that you've done quite well and have no complaints.
Present a positive and confident picture of yourself, but don't overstate your case. An answer like, "Everything's wonderful! I can't think of a time when things were going better! I'm overjoyed!" is likely to make an interviewer wonder whether you're trying to fool him . . . or yourself. The most convincing confidence is usually quiet confidence.

Monday, February 8, 2010

Data Fragmentation, Replication, and Allocation Techniques for Distributed Database Design by anil nain

Data Fragmentation, Replication, and Allocation Techniques for Distributed Database Design

In this lesson, we discuss techniques that are used to break up the database into logical units, called fragments, which may be assigned for storage at the various sites. We also discuss the use of data replication, which permits certain data to be stored in more than one site, and the process of allocating fragments-or replicas of fragments-for storage at the various sites. These techniques are used during the process of distributed database design. The information concerning data fragmentation, allocation, and replication is stored in a global directory that is accessed by the DDBS applications as needed.

Data Fragmentation

In a DDB, decisions must be made regarding which site should be used to store which portions of the database. For now, we will assume that there is no replication; that is, each relation- or portion of relation- is to be stored at only one site. We will discuss replication and its effects later in this section. We also use the terminology of relational databases - similar concepts apply to other data models. We assume that we are starting with a relational database scheme and must decide how to distribute the relations over various sites.

Before we decide on how to distribute the data, we must determine the logical units of the database that are to be distributed. The simplest logical units are the relations themselves; that is, each whole relation is to be stored at a particular site. In our example, we must decide on a site to store each of the relations EMPLOYEE, DEPARTMENT, PROJECTS, WORKS ON and DEPENDENT. In many cases, however, a relation can be divided into smaller logical units for distribution. For example, consider the company database shown in the company. We may want to store the database information relating to each department at the computer site for that department. A technique called horizontal fragmentation can be used to partition each relation by department.

Horizontal Fragmentation

A horizontal fragment of a relation is a subset of the tuples in that relation. The tuples that belong to the horizontal fragment are specified by a condition on one or more attributes of the relation. Often, only a single attribute is involved. For example, we may define three horizontal fragments on the EMPLOYEE relation with the following conditions (DNO=5),(DNO=4), and (DNO=1), each fragment contains the EMPLOYEE tuples working for a particular department. Similarly, we may define three horizontal fragments for the PROJECT relation, with the conditions (DNUM=5),(DMUN=4), and(DMUN=1), each fragment contains the PROJECT tuples controlled by a particular Department. Horizontal fragmentation divides a relation horizontally by grouping rows to create subsets of tuples, where each subset has a certain logical meaning. These fragments can then be assigned to different sites in the distributed system. Derived horizontal fragmentation applies the partitioning of a primary relation (DEPARTMENT in our example) to other secondary relations (EMPLOYEE and PROJECT in our example), which are related to the primary via a foreign key. This way, related data between the primary and the secondary relations gets fragmented in the same way.

Vertical Fragmentation

Each site may not need all the attributes of a relation, which would indicate the need for a different type of fragmentation. Vertical fragmentation divides a relation “vertically” by columns. A vertical fragment of a relation keeps only certain attributes of the relation. For example, we may want to fragment the EMPLOYEE relation into two vertical fragments. The first fragment includes personal information-NAME, DATE, ADDRESS, and SEX- and the second includes work-related information-SSN, SALARY, SUPERSSN, DNO. This vertical fragmentation is not quite proper because, if the two fragments are stored separately, we cannot put the original employee tuples back together, since there is no common attribute between the two fragments. It is necessary to include the primary key or some candid key attribute in every vertical fragment so that the full relation can be reconstructed from the fragments. Hence, we must add the SSN attribute to the personal information fragment.

Notice that each horizontal fragment on a relation R can be specified by a sCi (R) operation in the relational algebra. A set of horizontal fragments whose conditions C1, C2, …, Cn include all the tuples in R —that is, every tuple in R satisfies (C1 OR C2 OR … OR Cn)—is called a complete horizontal fragmentation of R. In many cases a complete horizontal fragmentation is also disjoint: that is, no tuple in R satisfies (Ci and Cj) for any i ¹ j. Our two earlier examples of horizontal fragmentation for the EMPLOYEE and PROJECT relations were both complete and disjoint. To reconstruct the relation R from a complete horizontal fragmentation, we need to apply the UNION operation to the fragment.

A vertical fragment on a relation R can be specified by a pLi (R) operation in the relational algebra. A set of vertical fragments whose projection lists L1, L2, …, Ln include all the attributes in R but share only the primary key attribute of R is called a complete vertical fragmentation of R. In this case the projection lists satisfy the following two conditions.

L1 L2 … Ln = ATTRS(R)

Li Lj = PK(R) for any i ¹ j, where ATTRS(R) is the set of attributes of R and PK(R) is the primary key of R.

To reconstruct the relation R from a complete vertical fragmentation, we apply the OUTER UNION operation to the vertical fragments (assuming no horizontal fragmentation is used). Notice that we could also apply a FULL OUTER JOIN operation and get the same result for a complete vertical fragmentation, even when some horizontal fragmentation may also have been applied. The two vertical fragments of the EMPLOYEE relation with projection lists L1 = (SSN, NAME, BDATE, ADDRESS, SEX) AND L2 = (SSN, SALARY, SUPERSSN, DNO) constitute a complete vertical fragmentation of EMPLOYEE.

Two horizontal fragments that are neither complete nor disjoint are those defined on the EMPLOYEE relation by the conditions (SALARY > 50000) and (DNO = 4); they may not include all EMPLOYEE tuples, but may include common tuples. Two vertical fragments that are not complete are those defined by the attribute lists L1 = (NAME, ADDRESS} and L2 = {SSN, NAME, SALARY}; these lists violate both conditions of a complete vertical fragmentation. Mixed (Hybrid) Fragmentation. We can intermix the two types of fragmentation, yielding a mixed fragmentation. For example, we may combine the horizontal and vertical fragmentations of the EMPLOYEE relation given earlier into a mixed fragmentation that includes six fragments. In this case the original relation can be reconstructed by applying UNION and OUTER UNION (or OUTER JOIN) operations in the appropriate order. In general, a fragment of a relation R can be specified by a SELECT-PROJECT combination of operations pL (sC (R). If C = TRUE (that is, all tuples are selected) and L ¹ ATTRS(R), we get a vertical fragment, and if C ¹ TRUE and L = ATTRS(R), we get a mixed fragment. Notice that a relation can itself be considered a fragment with C = TRUE and L = ATTRS(R). In the following discussion, the term fragment is used to refer to a relation or to any of the preceding type of fragments.

A fragmentation schema of a database is a definition of a set of fragments that includes all attributes and tuples in the database and satisfies the condition that the whole database can be reconstructed from the fragments by applying some sequence of OUTER UNION ( or OUTER JOIN) and UNION operations. It is also sometimes useful—although not necessary—to have all the fragments to be disjoint except for the repetition of primary keys among vertical (or mixed) fragments. In the latter case, all replication and distribution of fragments is clearly specified at a subsequent stage, separately from fragmentation.

Distributed Database Concepts by anil nain


Distributed Database Concepts

Distributed database (DDB) - It is a collection of multiple logically interrelated databases distributed over a computer networks and a distributed database management system (DDBMS) as a software system that manages a distributed database while making tie distribution transparent to the user. A collection of files started at different nodes of network and the maintaining of Inter relationship among them via hyperlinks has become a common organisation on the internet, with file of web pages.

Advantages of Distributed Databases

Distributed database management has been proposed for various reason ranging from organizational, decentralisation and economical processing to greater autonomy. We highlight some of these advantages here.

1. Management of distributed data with different level of transparency: Ideally, a DBMS should be distribution transparent in the sense of hiding the details of where each file (table, relation) is physically stored within the system. Consider the company database that is spread over the network as shown in Figure 6.4.




Figure 6.4: Data distribution and replication among distributed database

Where Employees, Projects and Works_ On are the relation in the Company Database as follows:

EMPLOYEE

FNAME

LANAME

SSN

BDATE

ADDRESS

SEX

SALARY

PROJECT

PNAME

PNUMBER

PLOCATION

DNUM

WORKS_ON

ESSN

PNO

HOURS

· Distributed or network transparency: This refers to freedom for the user from the operational details of the network. It may be divided into location transparency and naming transparency.

Location transparency: It refers to the fact that the command used to perform a task is independent of the location of data and the location of the system where the command was issued.

Naming Transparency: It implies that once a name is specified, the named objects can be accessed unambiguously without additional specification

· Replication transparency: As we show in above figure copies of data may be stored at multiple sites for better availability, performance, and reliability. Replication transparency makes the user unaware of the existence of copies.

· Fragmentation transparency: Two types of fragmentation are possible. Horizontal fragmentation distributes a relation into sets of tuples (rows) and Vertical fragmentation distributes a relation into sub relation where each sub relation is defined by a subset of the column of the original relation. A global query by the user must be transformed into several payment queries. Fragmentation transparency makes the user unaware of the existence of fragments.

1. Increased reliability and availability: Reliability is broadly defined as the probability that a system is running (not down) at a certain point of time, whereas availability is the probability that the system is continuously available during a time interval. When the data and DBMS software are distributed over several sites, one site may fail while other sites continue to operate. Only the data and software that exists at the failed site cannot be accessed. In a centralised system, failure at a single site makes the whole system unavailable to all users.

2. Improved performance: A DDBMS fragments the database by keeping the data closer to where it is needed most. Data localisation reduces the contention for CPU and I/O services and simultaneously reduces access delays involved in Wide Area Network. When a large database is distributed over multiple sites, smaller database exist at each site. As a result, local queries and transactions accessing data at a single site have better performance because of the smaller local databases.

3. Easier Expansion: In a distributed environment, expansion of the system in terms of addition of more data, increasing database size, or addition of more processors is much easier.

anil nain, surekha nain, ojas nain,


Friday, September 4, 2009

DBMS Objective questions by anil nain 9416077273

DBMS Objective questions by anil nain 9416077273
CHAPTER-1
Solved examples
Fill in the blankhs
A DBMS is an interface between ______ and ______ requests. (physical databse, user)
The ______ sub-system provides facilities to optimise DBMS performance. (performance)
Protection and control of database access is the responsibilities of _______ sub-system. (security management)
One of the responsibilities of a ______ is to create database schema. (DBA)
A rectangle in ERD representstion represents ________. (entity set)

T/F
A database is large collection of rather unrelated data.(F)
Data independence is a desirable characteristic of a DBMS.(T)
Information is processed data.(T)
The desirable characteristics of data processing are speed, volume and accuracy.(T)
SQL is a universal database query language.(T)
Unsolved
Fill in the blanks
<<<<>>>>
T/F
1. Logical data independency is easier to achieve than physical data independence.
2. DDL and DML are two different names fo rthe same thing.
3. C and COBOL are examples of DBMS.
4. Query optimization means arranging the queries so that the response time is minimized.
5. The three models of database are heirarchy, network and relational.



CHAPTER-2
Solved
Fill in the blanks
Primary key is ______ level constraint. (column)
The maximum number of characters that can be stored in a CHAR type fo data is _____. (255)
_______ data type can store unstrucrured data. (raw)
_______ operation returns a sub-set of attribute set from a table.(projection)
_______ operation creates new table from two given tables.(join)

T/F
Average, maximumand minimum are aggregate functions that return a single value.(T)
Rollback is the act of undoing certain transaction back to a given point. (T)
Once COMITted the operations performed on database cannot be undone.(T)

Unsolved
Fill in the blanks
<<<<>>>>>
T/F
Referential constraints requires an attibute be used in two tables.
All primary keys are candidate keys but not vice-versa.
Every SELECT command must have one or two WHERE cluses in it.
SQL is the only database language.
Every table must have at least one primary key and three candidate keys.


CHAPTER-3

Solved examples
Fill in the blanks
A relation is in ______ if and only if it is in ___ NF and every non-key attribute is irreducibly dependent on the primary key. (2NF, 1)
______ is the process of relational databse design. (normalization)
T/F
If a table is in 2NF, it may be or may not be in 1NF. (F)
Fourth normal form uses multiple dependency criteria for relation decomposition.(T)

Unsolved
Fill in the blanks
<<>>>
T/F
A table is in 4NF if it is in 3NF and has no multiple sets of multivalued dependencies.
Normailization is an aid to database design.
BCNF has more merits than 3NF.
5NF is the maximum level of normalization possible in the normalization of databse.
Dependency is the basis of normalization.


CHAPTER-4
Solved examples
Fill in the blanks
Natural join is a _______operation. (commutaive)
The graphical representation of a query is ________. (query tree)
T/F
All the queries are equally faster. (F)
Natural join and cartesian product are one and the same operations.(T)

Unsolved
Fill in the blanks
<<<>>>
T/F
Canonical representation of a query tree is also minimum spanning tree.
The order in which operations are cariied out on a relation is significant for the execution speed.
In a cascade sequence of projections, the last one can be ignored.
The four operations of natural join, join, union and intersections are individually associateive.
Heuristics may be applied in query optimization.

CHAPTER-5
Solved examples
Fill in the blanks
A binary lock can have ______ states. (two)
In the ______phase the number of locks increases from zero to maximum. (growing)

T/F
Time stamp is a unique identifier to identify a transaction. (T)
2-phase locking does not guarantee strict schedule.(F)
Unsolved
Fill in the blanks
<<<<<>>>>
T/F
ACID are properties of a transaction.
More storage is neede to apply multiple concurrency techniques.
A red lock is also known as shared lock.
Locking technique always ensures serializability.
Concurrency can occur only in a multi-processor database systems.


CHAPTER-6
Solved examples
Fill in the blanks
Client-server architecture is used to implement _________. (distributed database)
________ implies that once a name is specified, the named objects can be accessed without additional specification.
T/F
A horizontal fragment of a relation is a subset of the tuples in that relation.(T)
Semijoin operations intend to reduce the number of tuples in a relation before it is tranferred.

Unsolved
Fill in the blanks
A _______ is that part of distributed system which makes a request to other parts for a service.
Distributes transparency means _____.
____ is a multidatabase system.
A set of vertical fragments of a relation R, whose projection lists include all the attributes in R but share only the primary key attribute is called _________ vertical fragmentation of R.
To reconstrct a relation from a vertical fragments sequence of ________ operations is employed.

T/F
A client may act as a server for another application.
A distributed database may be highly redundant for performance improvement.
A distributed database uses network to communicate with its components.
Location transparency means that the database should behave differently depending on the location from which iit is being accessed.
Distributed database query optimization focuses on reducing the size of the fragments to be transferred.