Showing posts with label Programming Concepts. Show all posts
Showing posts with label Programming Concepts. Show all posts

Saturday, 6 February 2016

Difference between System.String and System.StringBuilder classes


String is meant to store some character data.

StringBuilder is meant to manipulate character data.

Although we manipulate character data using String as well, but it is not efficient, as every time we do a new instance of the String class is created.

StringBuilder class that is optimized for string concatenation. It provides the same benefits as using a character array in C/C++, as well as automatically growing the buffer size (if needed) and tracking the length

Page.IsValid and Page.Validate in Asp.net

After validating we may thing that we have built a secure application but a hacker could disable JavaScript and bypass all our validators ! This is where the Page.Validate() method and more importantly, the Page.IsValid property come in.
Page.IsValid is a property to check whether page validation succeeded or not

The Page.Validate() method is fired automatically by controls that have the CausesValidation property set to true. Note that the Button control’s CausesValidation property is true by default.

We should check this property only after calling the Page. Validate () method, or set the CausesValidation property to true which is by default true for button control.

Example :

protected void btnLogin_Click(object sender, EventArgs e)
{
    Page.Validate(); //optional here because it is required only if buttons's  CausesValidation property is set to false but it is true by default

    if (!Page.IsValid)
    {
        return;
    }     
    //write your login code here
}

Friday, 4 January 2013

CABINET FILE (.cab)


In Microsoft program development, a cabinet is a single file created to hold a number of compressed files. During installation of a program, the compressed files in a cabinet are decompressed and copied to an appropriate directory for the user. A cabinet file usually has the file name suffix of ".cab".

Wednesday, 26 December 2012

Delete Duplicate Rows From Table


If your table become like this


id name salary no

1abc10001
2xyz20002
3pqr30003
4abc10001
5xyz20002
6pqr30003

 then you can remove duplicate row by using T-sql statement


DELETE
FROM  tbl_Duplicate
WHERE ID IN
(
SELECT MAX(ID)
FROM tbl_Duplicate
GROUP BY no
)



Tuesday, 11 December 2012

DAEMON


DAEMON

A process that runs in the background and performs a specified operation at predefined times or in response to certain events.

Such process in UNIX is called demon and in Windows it is called service.

For eg: print spoolers, e-mail handlers, anti-virus, etc.

Thursday, 29 November 2012

DAEMON


A process that runs in the background and performs a specified operation at predefined times or in response to certain events.

Such process in UNIX is called demon and in Windows it is called service.

For eg: print spoolers, e-mail handlers, anti-virus, etc.

Tuesday, 27 November 2012

BANANA CODE


It is a slang term that describes endless loop of code.

Origin: Banana word contains repetitive "an" characters.

Wednesday, 21 November 2012

Pair Programming

Pair Programming

An programming practice in which two engineers participate in one development effort at one workstation. Each member performs the action the other is not currently doing: While one types in UnitTests the other thinks about the class that will satisfy the test, for example.