If you want it to be unprintable, you could stop newbie users from
printing directly from the page by putting:
<style type="text/css" media="print">
body { display: none }
</style>
Between the <head> tags.
If you want it to be unprintable, you could stop newbie users from
printing directly from the page by putting:
<style type="text/css" media="print">
body { display: none }
</style>
Between the <head> tags.
Here is the script
<script LANGUAGE="JavaScript1.1">
<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("YOUR MESSAGE HERE");
return false;
}
return true;
}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
// End -->
</script>
Generally TOP clause is used to perform SELECT on top n results. This feature of TOP is extended in SQL 2005 so that we can also use expression apart from int, bigint and percent to perform query and also extended to be used in UPDATE and DELETE statements.
In SQL 2000
syntax: select Top N [Percent]
EX:
select Top 10 * from TableName
or
select Top 10 Percent * from TableName
n specifies how many rows are returned. If PERCENT is not specified, n is the number of rows to return. If PERCENT is specified, n is the percentage of the result set rows to return
Drawbacks:
We could not parameterize.
It will work only for select statements.
If we want to restrict the number of rows affected by a select at runtime, or restrict the rows affected by an update or delete you had to explicitly describe the rows using a join or where clause, or you could cheat a bit by using ROWCOUNT, like this
set rowcount 10 delete from table where payratefieldname=1 set rowcount 0
It will work but the risk is if for some reason rowcount is not set to 0 then the other statements will also restricted to 10.
All these drawbacks are overcome in SQL 2005 by introducing Expression in syntax.
In SQL 2005
syntax: select Top (Expression) [Percent]
EX:
Is the numeric expression that specifies the number of rows to be returned. expression is implicitly converted to a float value if PERCENT is specified; otherwise, it is converted to bigint.
Ex:
select Top 10 * from TableName
or
select Top 10 Percent * from TableName
or we can set at runtime as
Declare @ int
SET @topNum = 10
select TOP (@topNum) * from
For select statements you must specify parentheses if you are passing a parameter, otherwise they are optional
Select Top (@topNum) * from TableName Select Top 10 * from TableName
When doing an update or delete, you have to use the parentheses in both cases:
Delete Top (@topNum) from employeesDelete Top (10) from TableName update Top (@topNum) TableName set fieldname = @fieldvalue update Top (10) from employees set fieldname = @fieldvalue This is nice tricky change introduced in SQL 2005
At times you might want to know how much screen real estate a user has before opening several new browser windows. You also might want to find out if they have a high-color display capable of showing a detailed color image. The following code shows how to learn the user's screen real estate and color depth. The total screen size includes unusable areas like the icon tray on Windows or the menubar on the Mac. The available screen size attributes subtract these system-reserved areas from the total screen size. For multi-screen systems, Internet Explorer will return the size of the monitor it is on, while Netscape returns the size of both monitors combined.
<HTML> <HEAD> <TITLE>Detecting the user's hardware</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" ALINK="#6600FF" VLINK="#CC0000"> <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript"> <!-- document.writeln("Total Screen size = ", screen.width, " x ", screen.height); document.writeln("<P>"); document.writeln("Available Screen size = ", screen.availWidth, " x ", screen.availHeight); document.writeln("<P>"); document.writeln("Color depth = ", screen.colorDepth); //--> </SCRIPT> </BODY> </HTML>
How to retrieve all Server Environment variables at one go. Just place
this code in .aspx page run it.
<div>
<table width="70%" align="center">
<tr bgcolor="#FF9900">
<td width="25%" align="center">
ServerVariable:
</td>
<td width="75%">
Value
</td>
</tr>
<% foreach(string Item in Request.ServerVariables){ %>
<tr>
<td width="25%">
<%= Item %>
</td>
<td width="75%">
<%=Request.ServerVariables[Item]%>
</td>
</tr>
<% } %>
</table>
</div>
Following is the table containing a list of server environment variables.
Using:
VB: Request.ServerVariables("Variable")
C#: Request.ServerVariables["Variable"]
| Variable | Description |
|
| All HTTP headers sent by the client. |
|
| Retrieves all headers in raw form. The difference between |
|
| Retrieves the metabase path for the Application for the ISAPI DLL. |
|
| Retrieves the physical path corresponding to the metabase path. IIS converts the |
|
| The value entered in the client's authentication dialog. This variable is available only if Basic authentication is used. |
|
| The authentication method that the server uses to validate users when they attempt to access a protected script. |
|
| The name of the user as it is derived from the authorization header sent by the client, before the user name is mapped to a Windows account. This variable is no different from |
|
| Unique ID for client certificate, returned as a string. Can be used as a signature for the whole client certificate. |
|
| bit0 is set to 1 if the client certificate is present. bit1 is set to 1 if the cCertification authority of the client certificate is invalid (it is not in the list of recognized CAs on the server). |
|
| Issuer field of the client certificate (O=MS, OU=IAS, CN=user name, C= |
|
| Number of bits in Secure Sockets Layer connection key size. For example, 128. |
|
| Number of bits in server certificate private key. For example, 1024. |
|
| Serial number field of the client certificate. |
|
| Issuer field of the server certificate. |
|
| Subject field of the server certificate. |
|
| Subject field of the client certificate. |
|
| The length of the content as given by the client. |
|
| The data type of the content. Used with queries that have attached information, such as the HTTP queries GET, POST, and PUT. |
|
| The revision of the CGI specification used by the server. The format is CGI/revision. |
|
| The value stored in the header Note The server interprets any underscore (_) characters in |
|
| Returns the value of the Accept header. |
|
| Returns a string describing the language to use for displaying content. |
|
| Returns the cookie string that was included with the request. |
|
| Returns the name of the Web server. This may or may not be the same as |
|
| Returns a string that contains the URL of the page that referred the request to the current page using an HTML <A> tag. Note that the URL is the one that the user typed into the browser address bar, which may not include the name of a default document. If the page is redirected,
|
|
| Returns a string describing the browser that sent the request. |
|
| Returns ON if the request came in through secure channel (SSL) or it returns OFF if the request is for a non-secure channel. |
|
| Number of bits in Secure Sockets Layer connection key size. For example, 128. |
|
| Number of bits in server certificate private key. For example, 1024. |
|
| Issuer field of the server certificate. |
|
| Subject field of the server certificate. |
|
| The ID for the IIS instance in textual format. If the instance ID is 1, it appears as a string. You can use this variable to retrieve the ID of the Web-server instance (in the metabase) to which the request belongs. |
|
| The metabase path for the instance of IIS that responds to the request. |
|
| Returns the Server Address on which the request came in. This is important on multi-homed computers where there can be multiple IP addresses bound to the computer and you want to find out which address the request used. |
|
| The Windows account that the user is impersonating while connected to your Web server. Use |
|
| Extra path information as given by the client. You can access scripts by using their virtual path and the |
|
| A translated version of |
|
| Query information stored in the string following the question mark (?) in the HTTP request. |
|
| The IP address of the remote host making the request. |
|
| The name of the host making the request. If the server does not have this information, it will set |
|
| The name of the user as it is derived from the authorization header sent by the client, before the user name is mapped to a Windows account. If you have an authentication filter installed on your Web server that maps incoming users to accounts, use |
|
| The method used to make the request. For HTTP, this is GET, HEAD, POST, and so on. |
|
| A virtual path to the script being executed. This is used for self-referencing URLs. |
|
| The server's host name, DNS alias, or IP address as it would appear in self-referencing URLs. |
|
| The port number to which the request was sent. |
|
| A string that contains either 0 or 1. If the request is being handled on the secure port, then this will be 1. Otherwise, it will be 0. |
|
| The name and revision of the request information protocol. The format is protocol/revision. |
|
| The name and version of the server software that answers the request and runs the gateway. The format is name/version. |
|
| Gives the base portion of the URL. |
Following are the key differences between them :-
√ Structure are value types and classes are reference types. So
structures use stack and classes use heap.
√ Structures members can not be declared as protected, but class members
can be. You can not do inheritance in structures.
√ Structures do not require constructors while classes require.
√ Objects created from classes are terminated using Garbage collector.
Structures are not destroyed using GC.