Subhash Sharma

Subhash Sharma
Subhash Sharma

This is Subhash Sharma(Software Engineer) Blog

Welcome to this blog and find every solution.............

Search This Blog

Software Engineer(Subhash Sharma)

Software Engineer(Subhash Sharma)
Software Engineer

Monday, February 14, 2011

View state Data stored?

Where is the View state Data stored?
ViewState data is stored in the hidden field. When the page is submitted to the server the data is sent to the server in the form of hidden fields for each control. If th viewstate of the control is enable true the value is retained on the post back to the client when the page is post backed

candidate key, alternate key, composite key.

■Define candidate key, alternate key, composite key.
■A candidate key is one that can identify each row of a table uniquely. Generally a candidate key becomes the primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys. A key formed by combining at least two or more columns is called composite key.

Session

InProc means where the session variable will be stored in the procesor .
OutProc are the session modes like Stateserver and Sqlserver
In Stateserver session variables are stored in application domain
In Sqlserver session mode session variable is stored in sql server


The StateServer mode uses a stand-alone Microsoft Windows service that is independent of IIS and can run on a separate server.
In this case the session state is serialized and stored in memory in a separate process that is managed by the aspnet_state.exe file.
This has got some performance drawbacks due to the overhead involved in serialization and de-serialization of objects.
The main primary advantage of storing the Session State in a State Server is that it is not in the same process as the ASP.NET and a crash of ASP.NET
would in no way destroy the session data. Secondly, this mode of Session State storage enables to share the information across a web garden or a web farm.

Rememeber that this mode is slow compared to the InProc mode as it is stored in an external process

Session default Expiration

Session default Expiration : is 20 Minute

Xslt

XSLT - a language for transforming XML documents
XSLT is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML. Normally XSLT does this by transforming each XML element into an (X)HTML element.

XPath - a language for navigating in XML documents
XSL-FO - a language for formatting XML documents

XSLT stands for Extensible Stylesheet Language Transformations. This language used in XSL style sheets to transform XML documents into other XML documents.

XSLT is based on template rules which specify how XML documents should be processed. An XSLT processor reads both an XML document and an XSLT style sheet. Based on the instructions the processor finds in the XSLT style sheet, it produce a new XML document. With XSLT we can also produce HTML or XHTML from XML document. With XSLT we can add/remove elements and attributes, rearrange and sort elements, hide and display elements from the output file. Converting XML to HTML for display is probably the most common application of XSLT today.

use Xslt with Xml

XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents.


//Xslt

The element element extracts the value of a selected node.

The element can be used to select the value of an XML element and add it to the output.

XSLT is a language for transforming XML documents into XHTML documents or to other XML documents.



--------------------------------------------------------------------------------


?xml version="1.0" encoding="iso-8859-1"?>
!-- Edited by XMLSpy® -->
xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

xsl:template match="/">
html>
body>
h2>My CD Collection /h2>
table border="1">
tr bgcolor="#9acd32">
th>Title /th>
th>Artist /th>
/tr>
xsl:for-each select="catalog/cd">
tr>
td>
xsl:value-of select="title"/>
/td>
td>
xsl:value-of select="artist"/>
/td>
/tr>
/xsl:for-each>
/table>
/body>
/html>
/xsl:template>
/xsl:stylesheet>

//Xml






cd>
title>Bridge of Spies /title>
artist>T`Pau /artist>
country>UK /country>
company>Siren /company>
price>7.90 /price>
year>1987 /year>
/cd>
cd>
title>Private Dancer /title>
artist>Tina Turner /artist>
country>UK /country>
company>Capitol /company>
price>8.90 /price>
year>1983 /year>
/cd>
cd>
title>Midt om natten /title>
artist>Kim Larsen /artist>
country>EU /country>
company>Medley /company>
price>7.80 /price>
year>1983 /year>
/cd>
cd>
title>Pavarotti Gala Concert /title>
artist>Luciano Pavarotti /artist>
country>UK /country>
company>DECCA /company>
price>9.90 /price>
year>1991 /year>
/cd>
cd>
title>The dock of the bay /title>
artist>Otis Redding /artist>
country>USA /country>
company>Atlantic /company>
price>7.90 /price>
year>1987 /year>
/cd>
cd>
title>Picture book /title>
artist>Simply Red /artist>
country>EU /country>
company>Elektra /company>
price>7.20 /price>
year>1985 /year>
/cd>
cd>
title>Red /title>
artist>The Communards /artist>
country>UK /country>
company>London /company>
price>7.80 /price>
year>1987 /year>
/cd>
cd>
title>Unchain my heart /title>
artist>Joe Cocker /artist>
country>USA /country>
company>EMI /company>
price>8.20 /price>
year>1987 /year>
/cd>
/catalog>

Friday, February 11, 2011

Heap Vs Stack(Value Type(Stack) and Reference Type(Heap))

//Link for Stack Vs Heap
http://www.c-sharpcorner.com/uploadfile/rmcochran/csharp_memory01122006130034pm/csharp_memory.aspx


Stack vs. Heap: What's the difference?

The Stack is more or less responsible for keeping track of what's executing in our code (or what's been "called"). The Heap is more or less responsible for keeping track of our objects (our data, well... most of it - we'll get to that later.).

Think of the Stack as a series of boxes stacked one on top of the next. We keep track of what's going on in our application by stacking another box on top every time we call a method (called a Frame). We can only use what's in the top box on the stack. When we're done with the top box (the method is done executing) we throw it away and proceed to use the stuff in the previous box on the top of the stack. The Heap is similar except that its purpose is to hold information (not keep track of execution most of the time) so anything in our Heap can be accessed at any time. With the Heap, there are no constraints as to what can be accessed like in the stack. The Heap is like the heap of clean laundry on our bed that we have not taken the time to put away yet - we can grab what we need quickly. The Stack is like the stack of shoe boxes in the closet where we have to take off the top one to get to the one underneath it.

The Stack is self-maintaining, meaning that it basically takes care of its own memory management. When the top box is no longer used, it's thrown out. The Heap, on the other hand, has to worry about Garbage collection (GC) - which deals with how to keep the Heap clean (no one wants dirty laundry laying around... it stinks!).

What goes on the Stack and Heap?

We have four main types of things we'll be putting in the Stack and Heap as our code is executing: Value Types, Reference Types, Pointers, and Instructions.

Value Types:

In C#, all the "things" declared with the following list of type declarations are Value types (because they are from System.ValueType):

bool
byte
char
decimal
double
enum
float
int
long
sbyte
short
struct
uint
ulong
ushort
Reference Types:

All the "things" declared with the types in this list are Reference types (and inherit from System.Object... except, of course, for object which is the System.Object object):

class
interface
delegate
object
string
Pointers:

The third type of "thing" to be put in our memory management scheme is a Reference to a Type. A Reference is often referred to as a Pointer. We don't explicitly use Pointers, they are managed by the Common Language Runtime (CLR). A Pointer (or Reference) is different than a Reference Type in that when we say something is a Reference Type is means we access it through a Pointer. A Pointer is a chunk of space in memory that points to another space in memory. A Pointer takes up space just like any other thing that we're putting in the Stack and Heap and its value is either a memory address or null.

How is it decided what goes where? (Huh?)

Ok, one last thing and we'll get to the fun stuff.

Here are our two golden rules:

A Reference Type always goes on the Heap - easy enough, right?


Value Types and Pointers always go where they were declared. This is a little more complex and needs a bit more understanding of how the Stack works to figure out where "things" are declared.
The Stack, as we mentioned earlier, is responsible for keeping track of where each thread is during the execution of our code (or what's been called). You can think of it as a thread "state" and each thread has its own stack. When our code makes a call to execute a method the thread starts executing the instructions that have been JIT compiled and live on the method table, it also puts the method's parameters on the thread stack. Then, as we go through the code and run into variables within the method they are placed on top of the stack.