1

Create a timestamp in c# (using Datetime)


Hi wondering how to create a timestamp in c# using Datetime values, use the method below. 
public static String GetTimestamp(this DateTime value)
{
    return value.ToString("yyyyMMddHHmmssffff");
}

0

FULL FORMS OF BANKS IN INDIA


ICICI- INDUSTRIAL CREDIT AND INVESTMENT CORPORATION OF INDIA 


SBI - STATE BANK OF INDIA 


IDBI - INDUSTRIAL DEVELOPMENT BAN K OF INDIA 


NABARD- NATIONAL BANK FOR AGRICULTURE AND RURAL DEVELOPMENT 


HDFC - HOUSING DEVELOPMENT FINANCE CORPORATION 


HSBC - HONGKONG AND SHANGHAI BANK CORPORATION 


IFCI - INDUSTRIAL FINANCE CORPORATION OF INDIA 


ICFAI - INSTITUTE OF CHARTERED FINANCIAL ANALYSTS OF INDIA 


PNB- PUNJAB NATIONAL BANK
4

The timeout period elapsed prior to completion of the operation or the server is not responding.

"The timeout period elapsed prior to completion of the operation or the server is not responding."


Reason:
Whenever you try to retrieve huge amount of data from a database, the query execution time increases, if you have a low connection timeout value set, this error is shown.


Solution:
Set ConnectionTimeout property of the SqlConnection Class to a higher value.


Refer:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectiontimeout.aspx
0

GIF images for google+


Click on the image if it does not load.
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
0

Clear an Array in c#


string[] arr = new string[4];
arr[0] = "000";
arr[1] = "111";
arr[2] = "222";
arr[3] = "333";
 
Array.Clear(arr, 0, arr.Length);

0

How to use Stopwatch in C#


Create an object of Stopwatch class and start it, then execute the method, logic whose execution time is to be calculated. Next stop the watch shown below.

Stopwatch watch = new Stopwatch();
watch.Start();           

for (int i = 0; i < 100000; i++)
{
   for (int j = 0; j < 20000; j++)
   { 
                    // To waste some time....:P
   }
}
watch.Stop();
double time_wasted = watch.Elapsed.TotalSeconds;
// To round 
double time_wasted_rounded = Math.Round(watch.Elapsed.TotalSeconds);
0

How to limit decimal places in double


Here I am limiting the decimal places to 3 in a double.
 
 double old_value = 3.142356;
 double new_value = Math.Round(old_value, 3);
:)
0

How to block a website

1.       Open Run, and type in ‘C:\Windows\System32\drivers\etc’, press enter. A folder should open up with the following contents.

2.       From the above files, open the “hosts” file using a notepad. The following is how the contents of this file should appear.

Now we will have to edit this “hosts” file, so as to block certain sites, which in this scenario are
 1. Yahoo.com and
 2. Bing.com.
The following changes are required for the same…


3.       Now try opening these websites using any of the browsers. The site will not open instead an error message will be shown. You can block any number of websites using this method.



Cheers!
6

Create Horizontal Menu Bar using HTML and CSS


Following is a simple demonstration of how to get a horizontal menu bar using HTML (using <ul> / <li>) and CSS.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title>Sample by Yasser.</title>
  <style type="text/css">
.hovermenu ul{
font: bold 18px calibri;
height: 25px;
}

.hovermenu ul li{
list-style: none;
display: inline;
}

.hovermenu ul li a{
padding: 10px 25px 10px 25px;
text-decoration: none;
float: left;
color: white;
background-color: rgb(15,41,77);
border: 1px solid rgb(15,41,77);
}

.hovermenu ul li a:hover{
background-color: #e5e5e5;
color:rgb(15,41,77);
}
</style>
 </head>

 <body>

<div class="hovermenu">
<ul>
<li><a href="">Menu1</a></li>
<li><a href="">Menu2</a></li>
<li><a href="">Menu3</a></li>
<li><a href="">Menu4</a></li>
<li><a href="">Menu5</a></li>
</ul>
</div>

</body>
</html>

Expected Output:

 Cheers!
0

How to do SELECT TOP @Param in a Stored Procedure?

 How to do SELECT TOP @Param in a Stored Procedure? 

Here I have created an integer param which is used later in the SELECT statement.

CREATE PROCEDURE [dbo].[SP_get]
@my_param int   
AS
BEGIN
      SET NOCOUNT ON;

SELECT TOP (@top_param) col1, col2, col3
      FROM TableName 
 

2011 ·Code-Studio by yrus.