Sunday, December 28, 2008

Ordinal Number

In linguistics, ordinal numbers are the words representing the rank of a number with respect to some order, in particular order or position (i.e. first, second, third, etc.). Its use may refer to size, importance, chronology, etc. They are adjectives and, at least in English, precede the nouns they are modifying.
They are different from the cardinal numbers (one, two, three, etc.) referring to the quantity.
Ordinal numbers are alternatively written in English with numerals and letter suffixes: 1st, 2nd or 2d, 3rd or 3d, 4th, 11th, 21st, 477th, etc. In some countries, written dates omit the suffix, although it is nevertheless pronounced. For example: 4 July 1776 (pronounced "the fourth of July ... "); July 4, 1776, ("July fourth ..."). When written out in full with "of", however, the suffix is retained: the 4th of July. In other languages, different ordinal indicators are used to write ordinal numbers.
In American Sign Language, the ordinal numbers first through ninth are formed with gestures similar to those for the corresponding cardinal numbers with the addition of a small twist of the wrist.

Table Frames And Rules

<table
frame="frame value"
rules="rules value">
...</table>
 
Which table border sides to draw
Which inner-table rules to draw
 


In conjunction with borderattribute, you can also specify exactly how to display the frame around your table and the border lines or 'rules' dividing rows and columns.

These are detailed below:

  • frame="frame value" ~ Although not widely used, the frameattribute is officially part of the HTML 4.01 Specification and serves to define exactly how to display the border or 'frame' surrounding your table. To do this, place the frame="frame value" attribute-value pair in your <table> tag where frame value equals one of the following and will display the table sides defined in the respective definition:
    voidNo frame is drawn (default value).
    aboveOnly the top side is drawn.
    belowOnly the bottom side is drawn.
    hsidesOnly the top and bottom sides are drawn.
    vsidesOnly the left and right sides are drawn.
    lhsOnly the left-hand side is drawn.
    rhsOnly the right-hand side is drawn.
    boxAll four sides are drawn.
    borderAll four sides are drawn.
  • rules="rules value"~ Also not widely used (largely because web authors seldom use tables astables), the rules attribute will define which lines or rulesto draw between rows and columns in your table. To do this, place the rules="rules value" attribute-value pair in your <table> tag where rules valueequals one of the following and will display the rules defined in the respective definition:
    noneNo rules are drawn (default value).
    groupsRules drawn between row groups and column groups.
    rowsRules are drawn between rows only.
    colsRules are drawn between columns only.
    allRules are drawn between all rows and columns.

Note that the table frame and rules can be drawn in the absence of the borderattribute. However if the border attribute is expressed and has a value of "0", it will override any values entered for frame or rules(frame will default to void while rules will default to none).


Example 1 - SOURCE CODE

<table border="4" bordercolor="#808080"
frame="hsides" rules="rows">
   <tr><td>Cell content...</td><td>Cell content...</td></tr>
   <tr><td>Cell content...</td><td>Cell content...</td></tr>
   <tr><td>Cell content...</td><td>Cell content...</td></tr>
</table>



Example 1 - RESULT
Cell content...Cell content...
Cell content...Cell content...
Cell content...Cell content...

Friday, December 26, 2008

SQL Connection Pooling

Connection pooling increases the performance of Web applications by reusing active database connections instead of creating a new connection with every request. Connection pool manager maintains a pool of open database connections. When a new connection is requested , pool manager checks if the pool contains any unused connections and returns connection if available.


If all connections in the pool are busy and the maximum pool size has not been reached, then new connection is created and added to the pool. When the pool reaches its maximum size all new connection requests are being queued up until a connection in the pool becomes available or the connection attempt times out.

These are four parameters that control most of the connection pooling behavior

Max Pool Size - the maximum size of your connection pool. Default is 100

Min Pool Size - initial number of connections which will be added to the pool upon its creation. Default is zero

Connect Timeout - controls the wait period in seconds when a new connection is requested, if this timeout expires, an exception will be thrown. Default is 15 seconds.

Pooling - controls if your connection pooling on or off. Default as you may've guessed is true. Read on to see when you may use Pooling=false setting.

eg.

connstring="server=myserver;database;abcdefg;Min pool size=5;Max pool size=100;connection timeout=15;pooling=yes"

Most of the Connection problems are because of Connection Leaks

SqlConnection conn=new SqlConnection(constring);
conn.Open();
//do some thing
conn.Close();
while executing the functionality if Exception occurences, then for sure connection wont be closed , to close connection explicitly .. the simple way is ..

SqlConnection conn=new SqlConnection(constring);

try{
conn.Open();
//do some thing
}
finally()
{
conn.Close();
}

Disable Context Menu In Browser

There are a number of situations where we don't want the user interacting with our website to have right click the content and get context menu for options like save images, copy text and etc. To do this we have a simple javascript available as follows:

<script language="javascript" type="text/javascript">
  function disableRightClick(){return false;}
  document.oncontextmenu = disableRightClick;
</script>