Tuesday, August 31, 2010

Top with percent in Sql Server 2005


In Sql Server if you want Specific percent of rows from table then you can use percent keyword 

Query to select all rows   
Select * from Employee

Query to select Top 2 Rows
Select top 2 * from Employee

Query to select 40% rows of total rows
Select top 40 percent * from Employee


Monday, August 16, 2010

Verbatim String in C#

I used to wonder, if I coud somehow represent "\" as "\" instead of the escape sequence  for black slash ("\\") in string. I have precisely come across this feature today in C-sharp and I would like to share it with you all.Especially in my last articles when I used the paths I did not feel like using "\\".
Other than the regular string literals, C# supports what is called as Verbatim string literals.Verbatim string literals begin with @" and end with the matching quote. They do not have escape sequences.
string path = @"C:\Program Files\My Program"; //verbatim literal
string path2 = "C:\\Program Files\\My Program"; //regular literal

string msg = @"Hello,
                        This is a multi-line string"; //verbatim literal

string msg2 = "Hello,\nThis is multi-line string"; //regular literal

Wednesday, August 11, 2010

this Keyword in C#

The this keyword refers to the current instance of the class. Static member functions do not have a this pointer. The this keyword can be used to access members from within constructors, instance methods, and instance accessors.

Example

In this example, this is used to qualify the Employee class members, name and alias, which are hidden by similar names. It is also used to pass an object to the method CalcTax, which belongs to another class.





































Output

Name: John M. Trainer
Alias: jtrainer
Taxes: $240.00

Monday, August 2, 2010

Now its time for desi Browser

If you are using Internet Explorer or Firefox or Chrome or Opera or Safari for browsing give it a Desi change with Epic – A New Browser from India. The Epic browser is developed by Bangalore based Hidden Reflex and is based on Mozilla and is available for free. What is very important is the news of Epic could give Moksha or liberation to millions of Indian netizens who are stuck with Internet Explorer 6.

Download - Epic browser here at the official website.