In a little district west of Washington Square the streets have run crazy and broken themselves into small strips called "places." These "places" make strange angles and curves. One Street crosses itself a time or two. An artist once discovered a valuable possibility in this street. Suppose a collector with a bill for paints, paper and canvas should, in traversing this route, suddenly meet himself coming back, without a cent having been paid on account!
So, to quaint old Greenwich Village the art people soon came prowling, hunting for north windows and eighteenth-century gables and Dutch attics and low rents. Then they imported some pewter mugs and a chafing dish or two from Sixth Avenue, and became a "colony."
At the top of a squatty, three-story brick Sue and Johnsy had their studio. "Johnsy" was familiar for Joanna. One was from Maine; the other from California. They had met at the table d'hôte of an Eighth Street "Delmonico's," and found their tastes in art, chicory salad and bishop sleeves so congenial that the joint studio resulted.
That was in May. In November a cold, unseen stranger, whom the doctors called Pneumonia, stalked about the colony, touching one here and there with his icy fingers. Over on the east side this ravager strode boldly, smiting his victims by scores, but his feet trod slowly through the maze of the narrow and moss-grown "places."
Mr. Pneumonia was not what you would call a chivalric old gentleman. A mite of a little woman with blood thinned by California zephyrs was hardly fair game for the red-fisted, short-breathed old duffer. But Johnsy he smote; and she lay, scarcely moving, on her painted iron bedstead, looking through the small Dutch window-panes at the blank side of the next brick house.
One morning the busy doctor invited Sue into the hallway with a shaggy, gray eyebrow.
"She has one chance in - let us say, ten," he said, as he shook down the mercury in his clinical thermometer. " And that chance is for her to want to live. This way people have of lining-u on the side of the undertaker makes the entire pharmacopoeia look silly. Your little lady has made up her mind that she's not going to get well. Has she anything on her mind?"
"She - she wanted to paint the Bay of Naples some day." said Sue.
"Paint? - bosh! Has she anything on her mind worth thinking twice - a man for instance?"
"A man?" said Sue, with a jew's-harp twang in her voice. "Is a man worth - but, no, doctor; there is nothing of the kind."
"Well, it is the weakness, then," said the doctor. "I will do all that science, so far as it may filter through my efforts, can accomplish. But whenever my patient begins to count the carriages in her funeral procession I subtract 50 per cent from the curative power of medicines. If you will get her to ask one question about the new winter styles in cloak sleeves I will promise you a one-in-five chance for her, instead of one in ten."
After the doctor had gone Sue went into the workroom and cried a Japanese napkin to a pulp. Then she swaggered into Johnsy's room with her drawing board, whistling ragtime.
Johnsy lay, scarcely making a ripple under the bedclothes, with her face toward the window. Sue stopped whistling, thinking she was asleep.
She arranged her board and began a pen-and-ink drawing to illustrate a magazine story. Young artists must pave their way to Art by drawing pictures for magazine stories that young authors write to pave their way to Literature.
As Sue was sketching a pair of elegant horseshow riding trousers and a monocle of the figure of the hero, an Idaho cowboy, she heard a low sound, several times repeated. She went quickly to the bedside.
Johnsy's eyes were open wide. She was looking out the window and counting - counting backward.
"Twelve," she said, and little later "eleven"; and then "ten," and "nine"; and then "eight" and "seven", almost together.
Sue look solicitously out of the window. What was there to count? There was only a bare, dreary yard to be seen, and the blank side of the brick house twenty feet away. An old, old ivy vine, gnarled and decayed at the roots, climbed half way up the brick wall. The cold breath of autumn had stricken its leaves from the vine until its skeleton branches clung, almost bare, to the crumbling bricks.
"What is it, dear?" asked Sue.
"Six," said Johnsy, in almost a whisper. "They're falling faster now. Three days ago there were almost a hundred. It made my head ache to count them. But now it's easy. There goes another one. There are only five left now."
"Five what, dear? Tell your Sudie."
"Leaves. On the ivy vine. When the last one falls I must go, too. I've known that for three days. Didn't the doctor tell you?"
"Oh, I never heard of such nonsense," complained Sue, with magnificent scorn. "What have old ivy leaves to do with your getting well? And you used to love that vine so, you naughty girl. Don't be a goosey. Why, the doctor told me this morning that your chances for getting well real soon were - let's see exactly what he said - he said the chances were ten to one! Why, that's almost as good a chance as we have in New York when we ride on the street cars or walk past a new building. Try to take some broth now, and let Sudie go back to her drawing, so she can sell the editor man with it, and buy port wine for her sick child, and pork chops for her greedy self."
"You needn't get any more wine," said Johnsy, keeping her eyes fixed out the window. "There goes another. No, I don't want any broth. That leaves just four. I want to see the last one fall before it gets dark. Then I'll go, too."
"Johnsy, dear," said Sue, bending over her, "will you promise me to keep your eyes closed, and not look out the window until I am done working? I must hand those drawings in by to-morrow. I need the light, or I would draw the shade down."
"Couldn't you draw in the other room?" asked Johnsy, coldly.
"I'd rather be here by you," said Sue. "Beside, I don't want you to keep looking at those silly ivy leaves."
"Tell me as soon as you have finished," said Johnsy, closing her eyes, and lying white and still as fallen statue, "because I want to see the last one fall. I'm tired of waiting. I'm tired of thinking. I want to turn loose my hold on everything, and go sailing down, down, just like one of those poor, tired leaves."
"Try to sleep," said Sue. "I must call Behrman up to be my model for the old hermit miner. I'll not be gone a minute. Don't try to move 'til I come back."
Old Behrman was a painter who lived on the ground floor beneath them. He was past sixty and had a Michael Angelo's Moses beard curling down from the head of a satyr along with the body of an imp. Behrman was a failure in art. Forty years he had wielded the brush without getting near enough to touch the hem of his Mistress's robe. He had been always about to paint a masterpiece, but had never yet begun it. For several years he had painted nothing except now and then a daub in the line of commerce or advertising. He earned a little by serving as a model to those young artists in the colony who could not pay the price of a professional. He drank gin to excess, and still talked of his coming masterpiece. For the rest he was a fierce little old man, who scoffed terribly at softness in any one, and who regarded himself as especial mastiff-in-waiting to protect the two young artists in the studio above.
Sue found Behrman smelling strongly of juniper berries in his dimly lighted den below. In one corner was a blank canvas on an easel that had been waiting there for twenty-five years to receive the first line of the masterpiece. She told him of Johnsy's fancy, and how she feared she would, indeed, light and fragile as a leaf herself, float away, when her slight hold upon the world grew weaker.
Old Behrman, with his red eyes plainly streaming, shouted his contempt and derision for such idiotic imaginings.
"Vass!" he cried. "Is dere people in de world mit der foolishness to die because leafs dey drop off from a confounded vine? I haf not heard of such a thing. No, I will not bose as a model for your fool hermit-dunderhead. Vy do you allow dot silly pusiness to come in der brain of her? Ach, dot poor leetle Miss Yohnsy."
"She is very ill and weak," said Sue, "and the fever has left her mind morbid and full of strange fancies. Very well, Mr. Behrman, if you do not care to pose for me, you needn't. But I think you are a horrid old - old flibbertigibbet."
"You are just like a woman!" yelled Behrman. "Who said I will not bose? Go on. I come mit you. For half an hour I haf peen trying to say dot I am ready to bose. Gott! dis is not any blace in which one so goot as Miss Yohnsy shall lie sick. Some day I vill baint a masterpiece, and ve shall all go away. Gott! yes."
Johnsy was sleeping when they went upstairs. Sue pulled the shade down to the window-sill, and motioned Behrman into the other room. In there they peered out the window fearfully at the ivy vine. Then they looked at each other for a moment without speaking. A persistent, cold rain was falling, mingled with snow. Behrman, in his old blue shirt, took his seat as the hermit miner on an upturned kettle for a rock.
When Sue awoke from an hour's sleep the next morning she found Johnsy with dull, wide-open eyes staring at the drawn green shade.
"Pull it up; I want to see," she ordered, in a whisper.
Wearily Sue obeyed.
But, lo! after the beating rain and fierce gusts of wind that had endured through the livelong night, there yet stood out against the brick wall one ivy leaf. It was the last one on the vine. Still dark green near its stem, with its serrated edges tinted with the yellow of dissolution and decay, it hung bravely from the branch some twenty feet above the ground.
"It is the last one," said Johnsy. "I thought it would surely fall during the night. I heard the wind. It will fall to-day, and I shall die at the same time."
"Dear, dear!" said Sue, leaning her worn face down to the pillow, "think of me, if you won't think of yourself. What would I do?"
But Johnsy did not answer. The lonesomest thing in all the world is a soul when it is making ready to go on its mysterious, far journey. The fancy seemed to possess her more strongly as one by one the ties that bound her to friendship and to earth were loosed.
The day wore away, and even through the twilight they could see the lone ivy leaf clinging to its stem against the wall. And then, with the coming of the night the north wind was again loosed, while the rain still beat against the windows and pattered down from the low Dutch eaves.
When it was light enough Johnsy, the merciless, commanded that the shade be raised.
The ivy leaf was still there.
Johnsy lay for a long time looking at it. And then she called to Sue, who was stirring her chicken broth over the gas stove.
"I've been a bad girl, Sudie," said Johnsy. "Something has made that last leaf stay there to show me how wicked I was. It is a sin to want to die. You may bring a me a little broth now, and some milk with a little port in it, and - no; bring me a hand-mirror first, and then pack some pillows about me, and I will sit up and watch you cook."
And hour later she said:
"Sudie, some day I hope to paint the Bay of Naples."
The doctor came in the afternoon, and Sue had an excuse to go into the hallway as he left.
"Even chances," said the doctor, taking Sue's thin, shaking hand in his. "With good nursing you'll win." And now I must see another case I have downstairs. Behrman, his name is - some kind of an artist, I believe. Pneumonia, too. He is an old, weak man, and the attack is acute. There is no hope for him; but he goes to the hospital to-day to be made more comfortable."
The next day the doctor said to Sue: "She's out of danger. You won. Nutrition and care now - that's all."
And that afternoon Sue came to the bed where Johnsy lay, contentedly knitting a very blue and very useless woollen shoulder scarf, and put one arm around her, pillows and all.
"I have something to tell you, white mouse," she said. "Mr. Behrman died of pneumonia to-day in the hospital. He was ill only two days. The janitor found him the morning of the first day in his room downstairs helpless with pain. His shoes and clothing were wet through and icy cold. They couldn't imagine where he had been on such a dreadful night. And then they found a lantern, still lighted, and a ladder that had been dragged from its place, and some scattered brushes, and a palette with green and yellow colors mixed on it, and - look out the window, dear, at the last ivy leaf on the wall. Didn't you wonder why it never fluttered or moved when the wind blew? Ah, darling, it's Behrman's masterpiece - he painted it there the night that the last leaf fell."
Thursday, November 12, 2009
1 day Lord decided 2 visit earth..
He saw a man crying.
Lord ask, "y r u crying, my son?"
he said that he was blind.
Lord touched him and he could see . .
God saw another man crying and asked, "y r u crying, my son?"
he said, "Lord, I am a software engineer!" Lord sat down and cried with him...!
Paavam avaruke namme kastam theriyuthu..
He saw a man crying.
Lord ask, "y r u crying, my son?"
he said that he was blind.
Lord touched him and he could see . .
God saw another man crying and asked, "y r u crying, my son?"
he said, "Lord, I am a software engineer!" Lord sat down and cried with him...!
Paavam avaruke namme kastam theriyuthu..
Wednesday, November 11, 2009
Interview Questions and answers for junior level.
What is IL?
(IL)Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. This IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
What is a CLR?
CLR (Common Language Runtime) is the heart of the .NET framework. All Languages have runtime and its the responsibility of the runtime to take care of the code execution of the program. For example Java has JVM(Java Virual Machine) Similarly .NET has CLR.
Following are the responsibilities of CLR
Garbage Collection : CLR automatically manages memory thus eliminating memory leaks. When objects are not referred GC automatically releases those memories thus providing efficient memory management.
Code Access Security : CAS grants rights to program depending on the security configuration of the machine. Example the program has rights to edit or create a new file but the security configuration of machine does not allow the program to delete a file. CAS will take care that the code runs under the environment of machines security configuration.
Code Verification : This ensures proper code execution and type safety while the code runs. It prevents the source code to perform illegal operation such as accessing invalid memory locations etc.
IL(Intermediate language)-to-native translators and optimizer's : CLR uses JIT and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code.
What is a CTS?
In order that two language communicate smoothly CLR has CTS (Common Type System). Example in VB you have "Integer" and in C++ you have "long" these data types are not compatible so the interfacing between them is very complicated. In order to able that two different languages can communicate Microsoft introduced Common Type System. So "Integer" datatype in VB6 and "int" datatype in C++ will convert it to System.int32 which is datatype of CTS.
What is a CLS?
Common Language Specification is a subset of the CTS which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages into one umberlla and CLS is one step towards that. Microsoft has defined CLS which are nothing but guidelines that language to follow so that it can communicate with other .NET languages in a seamless manner.
What is Managed Code?
Managed Code runs inside the environment of CLR i.e .NET runtime. In short all IL are managed code. But if you are using some third party software example VB6 or VC++ component they are unmanaged code as .NET runtime (CLR) does not have control over the source code execution of the language.
What is a Assembly?
Assembly is unit of deployment like EXE or a DLL.
An Assembly consists of one or more files (dlls,exe's,html files etc.) and represents a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies. These resources, types and references are described in a block of data called a manifest. The manifest is part of the assembly, thus making the assembly self-describing.
An assembly is completely self-describing.
An assembly contains metadata information, which is used by the CLR for everything from type checking and security to actually invoking the components methods. As all information is in the assembly itself, it is independent of registry. This is the basic advantage as compared to COM where the version was stored in registry.
Multiple versions can be deployed side by side in different folders. These different versions can execute at the same time without interfering with each other.
Assemblies can be private or shared. For private assembly deployment, the assembly is copied to the same directory as the client program that references it. No registration is needed, and no fancy installation program is required. When the component is removed, no registry cleanup is needed, and no unistall program is required. Just delete it from the hard drive.
In shared assembly deployment, an assembly is installed in the Global Assembly \ Cache (or GAC). The GAC contains shared assemblies that are globally accessible to all .NET applications on the machine.
What are the different types of Assmbly?
There are two types of assembly Private and Public assembly. A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful, e.g. Crystal report classes which will be used by all application for Reports.
What is Namespace?
Namespace has two basic functionality :
Namespace Logically group types, example System.Web.UI logically groups our UI related features.
In Object Oriented world many times its possible that programmers will use the same class name. By qualifying Namespace with clasname this collision can be avoided.
What is the Difference between NameSpace and Assembly?
Assembly is physical grouping of logical units. Namspace logically groups classes.
Namespace can span multiple assembly.
What is Manifest?
Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following
Version of Assembly
Security identity
Scope of the assembly
Resolve references to resources and classes
The assembly manifest can be stored in either a PE file(an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a stand-alone PE file that contains only assembly manifest information.
What is the namespace in which .NET has the data functionality classes?
Following are the namespaces provided by .NET for data management :
System.data
This contains the basic objects used for accessing and storing relational data, such as DataSet, DataTable, and DataRelation. Each of these is independent of the type of data source and the way we connect to it.
System.Data.Oledb
It contains the objects that we use to connect to a data source via an OLE-DB provider, such as OledbConnection, OledbCommand, etc. These objects inherit from the common base classes, and so have the same properties, methods, and events as the SqlClient equivalents.
System.Data.SqlClient
This contains the objects that we use to connect to a data source via the Tabular Data Stream (TDS) interface of Microsoft SQL Server (only). This can generally provide better performance as it removes some of the intermediate layers required by an OLE-DB connection.
System.XML
This contains the basic objects required to create, read, store, write, and manipulate XML documents according to W3C recommendations.
Can you give a overview of ADO.NET architecture?
The most important section in ADO.NET architecture is "Data Provider". Data Provider provides access to datasource (SQL SERVER, ACCESS, ORACLE). In short it provides object to achieve functionalities like opening and closing connection, retrieve data and update data. The four main sections of a data provider :
Connection They are used to connect a data to a Command object.
Command object (This is the responsible object to use stored procedures)
Data Adapter (This object acts as a bridge between datastore and dataset)
Datareader (This object reads data from data store in forward only mode)
Dataset object represents disconnected and cached data. Dataset can have one or more Datatable and relations.
DataView object is used to sort and filter data in DataTable.
What are the two fundamental objects in ADO.NET?
Datareader and Dataset are the two fundamental objects in ADO.NET.
What is difference between dataset and datareader?
Following are some major differences between dataset and datareader :
Datareader provides forward-only and read-only access to data, while the Dataset object can hold more than one table from the same data source as well as the relationships between them.
Dataset is a disconnected architecture while datareader is connected architecture.
Dataset can persist contents while datareader can not persist contents, they are forward only.
What are major difference between classic ADO and ADO.NET?
Following are some major differences between both
As in classic ADO we had client and server side cursors they are no more present in ADO.NET. Note it is a disconnected model so they are no more applicable.
Locking is not supported dur to disconnected model
All data persist in XML as compared to classic ADO where data persisted in Binary format also.
An OledbConnection object is used with an OLE-DB provider
A SqlConnection object uses Tabular Data Services (TDS) with MS SQL Server
What is the use of command objects?
They are used to connect connection object to Datareader or dataset. Following are the methods provided by command object :
ExecuteNonQuery : Executes the command defined in the CommandText property against the connection defined in the Connection property for a query that does not return any row. Returns an Integer indicating the number of rows affected by the query.
ExecuteReader : Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting rowset within the database,allowing the rows to be retrieved.
ExecuteScalar : Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns only single value any other returned columns and rows are discarded. It is fast and efficient when only a "singleton" value is required.
What is the use of dataadapter?
These are objects that connect one or more Command objects to a Dataset object. They provide logic that would get data from the data store and populates the tables in the Dataset, or pushes the changes in the Dataset back into the data store.
An OleDbDataAdapter object is used with an OLE-DB provider.
A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.
What are basic methods of Dataadapter?
There are three most commonly used methods of Dataadapter :
Fill : Executes the SelectCommand to fill the DataSet object with data from the data source. It is also be used to update an existing table in a DataSet with changes made to the data in the original datasource if there is a primary key in the table in the DataSet.
FillSchema : Uses the SelectCommand to extract just the schema for a table from the data source, and creates an empty table in the DataSet object with all the corresponding constraints.
Update : Calls the respective InsertCommand, UpdateCommand or DeleteCommand for each inserted, updated, or deleted row in the DataSet so as to update the original data source with the changes made to the content of the DataSet. This is a little like the UpdateBatch method provided by the ADO Recordset object, but in the DataSet it can be used to update more than one table.
What is Dataset object?
The DataSet provides the basis for disconnected storage and manipulation of relational data. We fill it from a data store, work with it while disconnected from the data store, then reconnect and flush changes back to the data store if required.
(IL)Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. This IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
What is a CLR?
CLR (Common Language Runtime) is the heart of the .NET framework. All Languages have runtime and its the responsibility of the runtime to take care of the code execution of the program. For example Java has JVM(Java Virual Machine) Similarly .NET has CLR.
Following are the responsibilities of CLR
Garbage Collection : CLR automatically manages memory thus eliminating memory leaks. When objects are not referred GC automatically releases those memories thus providing efficient memory management.
Code Access Security : CAS grants rights to program depending on the security configuration of the machine. Example the program has rights to edit or create a new file but the security configuration of machine does not allow the program to delete a file. CAS will take care that the code runs under the environment of machines security configuration.
Code Verification : This ensures proper code execution and type safety while the code runs. It prevents the source code to perform illegal operation such as accessing invalid memory locations etc.
IL(Intermediate language)-to-native translators and optimizer's : CLR uses JIT and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code.
What is a CTS?
In order that two language communicate smoothly CLR has CTS (Common Type System). Example in VB you have "Integer" and in C++ you have "long" these data types are not compatible so the interfacing between them is very complicated. In order to able that two different languages can communicate Microsoft introduced Common Type System. So "Integer" datatype in VB6 and "int" datatype in C++ will convert it to System.int32 which is datatype of CTS.
What is a CLS?
Common Language Specification is a subset of the CTS which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages into one umberlla and CLS is one step towards that. Microsoft has defined CLS which are nothing but guidelines that language to follow so that it can communicate with other .NET languages in a seamless manner.
What is Managed Code?
Managed Code runs inside the environment of CLR i.e .NET runtime. In short all IL are managed code. But if you are using some third party software example VB6 or VC++ component they are unmanaged code as .NET runtime (CLR) does not have control over the source code execution of the language.
What is a Assembly?
Assembly is unit of deployment like EXE or a DLL.
An Assembly consists of one or more files (dlls,exe's,html files etc.) and represents a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies. These resources, types and references are described in a block of data called a manifest. The manifest is part of the assembly, thus making the assembly self-describing.
An assembly is completely self-describing.
An assembly contains metadata information, which is used by the CLR for everything from type checking and security to actually invoking the components methods. As all information is in the assembly itself, it is independent of registry. This is the basic advantage as compared to COM where the version was stored in registry.
Multiple versions can be deployed side by side in different folders. These different versions can execute at the same time without interfering with each other.
Assemblies can be private or shared. For private assembly deployment, the assembly is copied to the same directory as the client program that references it. No registration is needed, and no fancy installation program is required. When the component is removed, no registry cleanup is needed, and no unistall program is required. Just delete it from the hard drive.
In shared assembly deployment, an assembly is installed in the Global Assembly \ Cache (or GAC). The GAC contains shared assemblies that are globally accessible to all .NET applications on the machine.
What are the different types of Assmbly?
There are two types of assembly Private and Public assembly. A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful, e.g. Crystal report classes which will be used by all application for Reports.
What is Namespace?
Namespace has two basic functionality :
Namespace Logically group types, example System.Web.UI logically groups our UI related features.
In Object Oriented world many times its possible that programmers will use the same class name. By qualifying Namespace with clasname this collision can be avoided.
What is the Difference between NameSpace and Assembly?
Assembly is physical grouping of logical units. Namspace logically groups classes.
Namespace can span multiple assembly.
What is Manifest?
Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following
Version of Assembly
Security identity
Scope of the assembly
Resolve references to resources and classes
The assembly manifest can be stored in either a PE file(an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a stand-alone PE file that contains only assembly manifest information.
What is the namespace in which .NET has the data functionality classes?
Following are the namespaces provided by .NET for data management :
System.data
This contains the basic objects used for accessing and storing relational data, such as DataSet, DataTable, and DataRelation. Each of these is independent of the type of data source and the way we connect to it.
System.Data.Oledb
It contains the objects that we use to connect to a data source via an OLE-DB provider, such as OledbConnection, OledbCommand, etc. These objects inherit from the common base classes, and so have the same properties, methods, and events as the SqlClient equivalents.
System.Data.SqlClient
This contains the objects that we use to connect to a data source via the Tabular Data Stream (TDS) interface of Microsoft SQL Server (only). This can generally provide better performance as it removes some of the intermediate layers required by an OLE-DB connection.
System.XML
This contains the basic objects required to create, read, store, write, and manipulate XML documents according to W3C recommendations.
Can you give a overview of ADO.NET architecture?
The most important section in ADO.NET architecture is "Data Provider". Data Provider provides access to datasource (SQL SERVER, ACCESS, ORACLE). In short it provides object to achieve functionalities like opening and closing connection, retrieve data and update data. The four main sections of a data provider :
Connection They are used to connect a data to a Command object.
Command object (This is the responsible object to use stored procedures)
Data Adapter (This object acts as a bridge between datastore and dataset)
Datareader (This object reads data from data store in forward only mode)
Dataset object represents disconnected and cached data. Dataset can have one or more Datatable and relations.
DataView object is used to sort and filter data in DataTable.
What are the two fundamental objects in ADO.NET?
Datareader and Dataset are the two fundamental objects in ADO.NET.
What is difference between dataset and datareader?
Following are some major differences between dataset and datareader :
Datareader provides forward-only and read-only access to data, while the Dataset object can hold more than one table from the same data source as well as the relationships between them.
Dataset is a disconnected architecture while datareader is connected architecture.
Dataset can persist contents while datareader can not persist contents, they are forward only.
What are major difference between classic ADO and ADO.NET?
Following are some major differences between both
As in classic ADO we had client and server side cursors they are no more present in ADO.NET. Note it is a disconnected model so they are no more applicable.
Locking is not supported dur to disconnected model
All data persist in XML as compared to classic ADO where data persisted in Binary format also.
An OledbConnection object is used with an OLE-DB provider
A SqlConnection object uses Tabular Data Services (TDS) with MS SQL Server
What is the use of command objects?
They are used to connect connection object to Datareader or dataset. Following are the methods provided by command object :
ExecuteNonQuery : Executes the command defined in the CommandText property against the connection defined in the Connection property for a query that does not return any row. Returns an Integer indicating the number of rows affected by the query.
ExecuteReader : Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting rowset within the database,allowing the rows to be retrieved.
ExecuteScalar : Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns only single value any other returned columns and rows are discarded. It is fast and efficient when only a "singleton" value is required.
What is the use of dataadapter?
These are objects that connect one or more Command objects to a Dataset object. They provide logic that would get data from the data store and populates the tables in the Dataset, or pushes the changes in the Dataset back into the data store.
An OleDbDataAdapter object is used with an OLE-DB provider.
A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.
What are basic methods of Dataadapter?
There are three most commonly used methods of Dataadapter :
Fill : Executes the SelectCommand to fill the DataSet object with data from the data source. It is also be used to update an existing table in a DataSet with changes made to the data in the original datasource if there is a primary key in the table in the DataSet.
FillSchema : Uses the SelectCommand to extract just the schema for a table from the data source, and creates an empty table in the DataSet object with all the corresponding constraints.
Update : Calls the respective InsertCommand, UpdateCommand or DeleteCommand for each inserted, updated, or deleted row in the DataSet so as to update the original data source with the changes made to the content of the DataSet. This is a little like the UpdateBatch method provided by the ADO Recordset object, but in the DataSet it can be used to update more than one table.
What is Dataset object?
The DataSet provides the basis for disconnected storage and manipulation of relational data. We fill it from a data store, work with it while disconnected from the data store, then reconnect and flush changes back to the data store if required.
Tuesday, November 10, 2009
Some essentials in SQL Server...
What is normalization? what are different types of normalization?
It is set of rules that have been established to aid in the design of tables that are meant to be connected through relationships. This set of rules is known as normalization.
Benefits of normalizing your database will include :
Avoiding repetitive entries
Reducing required storage space
Preventing the need to restructure existing tables to accommodate new data
Increased speed and flexibility of queries, sorts, and summaries.
Following are the three normal forms :
First Normal Form
For a table to be in first normal form, data must be broken up into the smallest units possible. In addition to breaking data up into the smallest meaningful values, tables in first normal form should not contain repetitions groups of fields.
Second Normal Form
The second normal form states that each field in a multiple field primary key table must be directly related to the entire primary key. Or in other words, each non-key field should be a fact about all the fields in the primary key.
Third Normal Form
A non-key field should not depend on other Non-key field.
What is denormalization?
Denormalization is the process of putting one fact in numerous places (its vice-versa of normalization).Only one valid reason exists for denormalizing a relational design - to enhance performance or if we are doing data warehousing and data mining. The sacrifice to performance is that you increase redundancy in database.
What is a candidate key?
A table may have more than one combination of columns that could uniquely identify the rows in a table; each combination is a candidate key. During database design you can pick up one of the candidate keys to be the primary key.
What are the different types of joins? What is the difference between them?
Inner Join
Inner join shows matches only when they exist in both tables.
Example is given below
SELECT Customers.*, Orders.* FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
Left Outer Join
Left join will display all records in left table of the SQL statement. In SQL below customers with or without orders will be displayed.
Example is given below
SELECT Customers.*, Orders.* FROM Customers LEFT OUTER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
Right Outer Join
Right join will display all records in right table of the SQL statement. In SQL below all orders with or without matching customer records will be displayed.
Example is given below
SELECT Customers.*, Orders.* FROM Customers RIGHT OUTER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
What are indexes? what is the difference between clustered and nonclustered indexes?
Indexes in SQL Server are similar to the indexes in books. They help SQL Server retrieve the data quickly.
There are clustered and nonclustered indexes. A clustered index is a special type of index that reorders the way in which records in the table are physically stored. Therefore, table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk.The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.
It is set of rules that have been established to aid in the design of tables that are meant to be connected through relationships. This set of rules is known as normalization.
Benefits of normalizing your database will include :
Avoiding repetitive entries
Reducing required storage space
Preventing the need to restructure existing tables to accommodate new data
Increased speed and flexibility of queries, sorts, and summaries.
Following are the three normal forms :
First Normal Form
For a table to be in first normal form, data must be broken up into the smallest units possible. In addition to breaking data up into the smallest meaningful values, tables in first normal form should not contain repetitions groups of fields.
Second Normal Form
The second normal form states that each field in a multiple field primary key table must be directly related to the entire primary key. Or in other words, each non-key field should be a fact about all the fields in the primary key.
Third Normal Form
A non-key field should not depend on other Non-key field.
What is denormalization?
Denormalization is the process of putting one fact in numerous places (its vice-versa of normalization).Only one valid reason exists for denormalizing a relational design - to enhance performance or if we are doing data warehousing and data mining. The sacrifice to performance is that you increase redundancy in database.
What is a candidate key?
A table may have more than one combination of columns that could uniquely identify the rows in a table; each combination is a candidate key. During database design you can pick up one of the candidate keys to be the primary key.
What are the different types of joins? What is the difference between them?
Inner Join
Inner join shows matches only when they exist in both tables.
Example is given below
SELECT Customers.*, Orders.* FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
Left Outer Join
Left join will display all records in left table of the SQL statement. In SQL below customers with or without orders will be displayed.
Example is given below
SELECT Customers.*, Orders.* FROM Customers LEFT OUTER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
Right Outer Join
Right join will display all records in right table of the SQL statement. In SQL below all orders with or without matching customer records will be displayed.
Example is given below
SELECT Customers.*, Orders.* FROM Customers RIGHT OUTER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
What are indexes? what is the difference between clustered and nonclustered indexes?
Indexes in SQL Server are similar to the indexes in books. They help SQL Server retrieve the data quickly.
There are clustered and nonclustered indexes. A clustered index is a special type of index that reorders the way in which records in the table are physically stored. Therefore, table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk.The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.
OOPS concepts in .net
What is Object Oriented Programming(oops)?
It is a problem solving technique to develop software systems. It is a technique to think real world in terms of objects. Object maps the software model to real world concept. These objects have responsibilities and provide services to application or other objects.
What is a Class?
A class describes all the attributes of objects, as well as the methods that implement the behavior of member objects. It is a comprehensive data type which represents a blue print of objects. It is a template of object.
What is an Object?
It is a basic unit of a system. An object is an entity that has attributes,behavior, and identity. Objects are members of a class. Attributes and behavior of an object are defined by the class definition.
What is the relation between Classes and Objects?
They look very much same but are not same. Class is a definition, while object is a instance of the class created. Class is a blue print while objects are actual objects existing in real world. Example we have class CAR which has attributes and methods like Speed,Brakes,Type of Car etc. Class CAR is just a prototype,now we can create real time objects which can be used to provide functionality. Example we can create a Maruti car object with 100 km speed and urgent brakes.
What are different properties provided by Object-oriented systems?
Following are characteristics of Object Oriented Systems :
Abstraction
It allows complex real world to be represented in simplified manner. Example color is abstracted to RGB. By just making the combination of these three colors we can acheive any color in world. It is a model of real world or concept.
Encapsulation
It is a process of hiding all the internal details of an object from the outside world.
Communication using messages
When application wants to acheive certain task it can only be done using combination of objects. A single object cannot do all the task. Example if we want to make order processing form. we will use Customer object,Order object,Product object and Payment object to acheive this functionality. In short these objects should communicate with each other. This is achieved when objects send messages to each other.
Object lifetime
All objects have life time. Objects are created and initialized necessary functionalities are done and later the object is destroyed. Every object have there own state and identity which differ from instance to instance.
Class hierarchies
In object oriented world objects have relation and hierarchies in between them. There are basically three kind of relationship in Object Oriented World
Association
This is the simplest relationship between objects. Example every customer has sales. So Customer object and sales object have an association relation between them.
Aggregation
This is also called as composition model. Example in order to make a "Accounts" class it has use other objects example "Voucher", "Journal" and "Cash" objects. so accounts class is aggregation of these three objects.
Inheritance
Hierarchy is used to define more specialized classes based on a preexisting generalized class. Example we have VEHICLE class and we can inherit this class make more specialize class like CAR, which will add new attributes and use some existing qualities of the parent class. Its shows more of a parent-child relationship. This kind of hierarchy is called inheritance.
Polymorphism
When inheritance is used to extend a generalized class to a more specialized class, it includes behavior of the top class. The inheriting class often implement a behavior that can be somewhat different than the generalized class, but the name of the behavior can be same. It is important that a given instance of an object use the correct behavior, and the property of polymorphism allows this to happen automatically
What are abstract classes?
Following are features of a abstract class :
You can not create a object of abstract class
Abstract class is designed to act as a base class (to be inherited by other classes). Abstract class is a design concept in program development and provides a base upon which other classes are built.
Abstract classes are similar to interfaces. After declaring an abstract class,it cannot be instantiated on its own,it must be inherited.
In VB.NET abstract classes are created using "MustInherit" keyword. In C# we have "Abstract" keyword.
Abstract classes can have implementation or pure abstract methods which should be implemented in the child class.
What is a Interface?
Interface is a contract that defines the signature of the functionality. So if a class is implementing a interface it says to the outer world, that it provides specific behavior. Example if a class is implementing Idisposable interface that means it has a functionality to release unmanaged resources. Now external objects using this class knowthat it has contract by which it can dispose unused unmanaged objects.
Single Class can implement multiple interfaces.
If a class implements a interface then it has to provide implementation to all its methods.
What is the difference between abstract classes and interfaces?
Following are the differences between abstract and interfaces :
Abstract classes can have concrete methods while interfaces have no methods implemented.
Interfaces do not come in inheriting chain, while abstract classes come in inheritance.
What is a delegate?
Delegate is a class that can hold a reference to a method or a function. Delegate class has a signature and it can only reference those methods whose signature is complaint with the class. Delegates are type-safe functions pointers or callbacks.
What are events?
As compared to delegates events works with source and listener methodology. So listeners who are interested in receiving some events they subscribe to the source.Once this subscription is done the source raises events to its entire listener when needed. One source can have multiple listeners.
It is a problem solving technique to develop software systems. It is a technique to think real world in terms of objects. Object maps the software model to real world concept. These objects have responsibilities and provide services to application or other objects.
What is a Class?
A class describes all the attributes of objects, as well as the methods that implement the behavior of member objects. It is a comprehensive data type which represents a blue print of objects. It is a template of object.
What is an Object?
It is a basic unit of a system. An object is an entity that has attributes,behavior, and identity. Objects are members of a class. Attributes and behavior of an object are defined by the class definition.
What is the relation between Classes and Objects?
They look very much same but are not same. Class is a definition, while object is a instance of the class created. Class is a blue print while objects are actual objects existing in real world. Example we have class CAR which has attributes and methods like Speed,Brakes,Type of Car etc. Class CAR is just a prototype,now we can create real time objects which can be used to provide functionality. Example we can create a Maruti car object with 100 km speed and urgent brakes.
What are different properties provided by Object-oriented systems?
Following are characteristics of Object Oriented Systems :
Abstraction
It allows complex real world to be represented in simplified manner. Example color is abstracted to RGB. By just making the combination of these three colors we can acheive any color in world. It is a model of real world or concept.
Encapsulation
It is a process of hiding all the internal details of an object from the outside world.
Communication using messages
When application wants to acheive certain task it can only be done using combination of objects. A single object cannot do all the task. Example if we want to make order processing form. we will use Customer object,Order object,Product object and Payment object to acheive this functionality. In short these objects should communicate with each other. This is achieved when objects send messages to each other.
Object lifetime
All objects have life time. Objects are created and initialized necessary functionalities are done and later the object is destroyed. Every object have there own state and identity which differ from instance to instance.
Class hierarchies
In object oriented world objects have relation and hierarchies in between them. There are basically three kind of relationship in Object Oriented World
Association
This is the simplest relationship between objects. Example every customer has sales. So Customer object and sales object have an association relation between them.
Aggregation
This is also called as composition model. Example in order to make a "Accounts" class it has use other objects example "Voucher", "Journal" and "Cash" objects. so accounts class is aggregation of these three objects.
Inheritance
Hierarchy is used to define more specialized classes based on a preexisting generalized class. Example we have VEHICLE class and we can inherit this class make more specialize class like CAR, which will add new attributes and use some existing qualities of the parent class. Its shows more of a parent-child relationship. This kind of hierarchy is called inheritance.
Polymorphism
When inheritance is used to extend a generalized class to a more specialized class, it includes behavior of the top class. The inheriting class often implement a behavior that can be somewhat different than the generalized class, but the name of the behavior can be same. It is important that a given instance of an object use the correct behavior, and the property of polymorphism allows this to happen automatically
What are abstract classes?
Following are features of a abstract class :
You can not create a object of abstract class
Abstract class is designed to act as a base class (to be inherited by other classes). Abstract class is a design concept in program development and provides a base upon which other classes are built.
Abstract classes are similar to interfaces. After declaring an abstract class,it cannot be instantiated on its own,it must be inherited.
In VB.NET abstract classes are created using "MustInherit" keyword. In C# we have "Abstract" keyword.
Abstract classes can have implementation or pure abstract methods which should be implemented in the child class.
What is a Interface?
Interface is a contract that defines the signature of the functionality. So if a class is implementing a interface it says to the outer world, that it provides specific behavior. Example if a class is implementing Idisposable interface that means it has a functionality to release unmanaged resources. Now external objects using this class knowthat it has contract by which it can dispose unused unmanaged objects.
Single Class can implement multiple interfaces.
If a class implements a interface then it has to provide implementation to all its methods.
What is the difference between abstract classes and interfaces?
Following are the differences between abstract and interfaces :
Abstract classes can have concrete methods while interfaces have no methods implemented.
Interfaces do not come in inheriting chain, while abstract classes come in inheritance.
What is a delegate?
Delegate is a class that can hold a reference to a method or a function. Delegate class has a signature and it can only reference those methods whose signature is complaint with the class. Delegates are type-safe functions pointers or callbacks.
What are events?
As compared to delegates events works with source and listener methodology. So listeners who are interested in receiving some events they subscribe to the source.Once this subscription is done the source raises events to its entire listener when needed. One source can have multiple listeners.
Tips to increase SQL Server performance...
Following are tips which will increase your SQL performance :
Every index increases the time takes to perform INSERTS, UPDATES, and DELETES, so the number of indexes should not be too much. Try to use maximum 4-5 indexes on one table, not more. If you have read-only table, then the number of indexes may be increased.
Keep your indexes as narrow as possible. This reduces the size of the index and reduces the number of reads required to read the index.
Try to create indexes on columns that have integer values rather than character values.
If you create a composite (multi-column) index, the orders of the columns in the key are very important. Try to order the columns in the key as to enhance selectivity, with the most selective columns to the leftmost of the key.
If you want to join several tables, try to create surrogate integer keys for this purpose and create indexes on their columns.
Create surrogate integer primary key (identity for example) if your table will not have many insert operations.
Clustered indexes are more preferable than nonclustered, if you need to select by a range of values or you need to sort results set with GROUP BY or ORDER BY.
If your application will be performing the same query over and over on the same table, consider creating a covering index on the table.
You can use the SQL Server Profiler Create Trace Wizard with "Identify Scans of Large Tables" trace to determine which tables in your database may need indexes. This trace will show which tables are being scanned by queries instead of using an index.
Every index increases the time takes to perform INSERTS, UPDATES, and DELETES, so the number of indexes should not be too much. Try to use maximum 4-5 indexes on one table, not more. If you have read-only table, then the number of indexes may be increased.
Keep your indexes as narrow as possible. This reduces the size of the index and reduces the number of reads required to read the index.
Try to create indexes on columns that have integer values rather than character values.
If you create a composite (multi-column) index, the orders of the columns in the key are very important. Try to order the columns in the key as to enhance selectivity, with the most selective columns to the leftmost of the key.
If you want to join several tables, try to create surrogate integer keys for this purpose and create indexes on their columns.
Create surrogate integer primary key (identity for example) if your table will not have many insert operations.
Clustered indexes are more preferable than nonclustered, if you need to select by a range of values or you need to sort results set with GROUP BY or ORDER BY.
If your application will be performing the same query over and over on the same table, consider creating a covering index on the table.
You can use the SQL Server Profiler Create Trace Wizard with "Identify Scans of Large Tables" trace to determine which tables in your database may need indexes. This trace will show which tables are being scanned by queries instead of using an index.
Monday, November 9, 2009
Table variables in SQL Server
Microsoft introduced table variables in SQL Server, table variable is used instant of Temporary Tables.
In Table variables we can store our records; the declaration of syntax is very similar to a CREATE TABLE statement.
Example:
Declare @customersvar Table(
Id int identity(1,1),
customerID nchar(5) NOTNULL,
Name varchar(50) ,
Address varchar(max) ,
PhoneNo varchar(50) )
We can write the following INSERT INTO statement to insert values in the table variable.
Insert into @customervar Table (customerID, Name, Address, PhoneNo )
Select customerID, Name, Address, PhoneNo from Customers
We can write the following SELECT statement to populate the table variable.
Select * from @customersvar
And to populate the table variables first fifty values, you can write the following SELECT statement
Select top 50 * from @customersvar
When we create a temporary table (#TABLE) , which physically creates the table in tempdb so it is creates burden . When we create a table variable which is creating in memory so it's much faster.
And we can use table variables when creating batches, stored procedures, and user-defined functions (UDFs).
And also you can UPDATE records in your table variable as well as DELETE records.
Example:
UPDATE @customersvar SET Name = ‘Reema’ WHERE customerID = 158
DELETE FROM @customersvar WHERE customerID = 1020
In Table variables we can store our records; the declaration of syntax is very similar to a CREATE TABLE statement.
Example:
Declare @customersvar Table(
Id int identity(1,1),
customerID nchar(5) NOTNULL,
Name varchar(50) ,
Address varchar(max) ,
PhoneNo varchar(50) )
We can write the following INSERT INTO statement to insert values in the table variable.
Insert into @customervar Table (customerID, Name, Address, PhoneNo )
Select customerID, Name, Address, PhoneNo from Customers
We can write the following SELECT statement to populate the table variable.
Select * from @customersvar
And to populate the table variables first fifty values, you can write the following SELECT statement
Select top 50 * from @customersvar
When we create a temporary table (#TABLE) , which physically creates the table in tempdb so it is creates burden . When we create a table variable which is creating in memory so it's much faster.
And we can use table variables when creating batches, stored procedures, and user-defined functions (UDFs).
And also you can UPDATE records in your table variable as well as DELETE records.
Example:
UPDATE @customersvar SET Name = ‘Reema’ WHERE customerID = 158
DELETE FROM @customersvar WHERE customerID = 1020
Tips to improve performance of web applications
Should try to avoid try-catch blocks which perform poorly, Exceptions should be used only in unavoidable exceptional situations.
Should try to keep JavaScript and CSS in external files and use ‘link’ tags rather than ‘@import’.
Unless it’s necessary should avoid to using ‘Redirect’, Consider ‘Server.Transfer’, it performs better in some conditions.
Should minimize utility of ‘I frames’ in the web pages.
Then images….., correct formatted Images should be used on the basis of its needs, for example: As background image, big image or a screenshot, the effective format is JPG/JPEG. For graphics like button images, header images, footer images, navigation bar images the best format is PNG.
Should try to avoid DOM objects on the web pages, which is heavy weight, it will reduce the performance of web applications.
Should try to keep JavaScript and CSS in external files and use ‘link’ tags rather than ‘@import’.
Unless it’s necessary should avoid to using ‘Redirect’, Consider ‘Server.Transfer’, it performs better in some conditions.
Should minimize utility of ‘I frames’ in the web pages.
Then images….., correct formatted Images should be used on the basis of its needs, for example: As background image, big image or a screenshot, the effective format is JPG/JPEG. For graphics like button images, header images, footer images, navigation bar images the best format is PNG.
Should try to avoid DOM objects on the web pages, which is heavy weight, it will reduce the performance of web applications.
Subscribe to:
Posts (Atom)