Wednesday, 31 July 2013

Thursday, 25 July 2013

What is .htaccess?

What is .htaccess?


Using .htaccess files lets you control the behavior of your site or a specific directory on your site. For example, if you place an .htaccess file in your root directory, it will affect your entire site (www.coolexample.com). If you place it in a /content directory, it will only affect that directory (www.coolexample.com/content).
.htaccess works on our Linux servers.
Using an .htaccess file, you can:
  • Customize the Error pages for your site.
  • Protect your site with a password.
  • Enable server-side includes.
  • Deny access to your site based on IP.
  • Change your default directory page (index.html).
  • Redirect visitors to another page.
  • Prevent directory listing.
  • Add MIME types.
.htaccess files are a simple ASCII text file with the name .htaccess. It is not an extension like .html or .txt. The entire file name is .htaccess. For more information on how to set up .htaccess files, visit Apache's Website

Monday, 22 July 2013

Reset Auto Increment Value In MySql

ALTER TABLE tableName AUTO_INCREMENT = 22

Import Excel or CSV File To MySql Using Query

Import Excel or CSV File To MySql Using Query

load data local infile 'path\file.csv' into table Table_Name  fields terminated by ',' enclosed by '"' lines terminated by '\n';

Saturday, 6 July 2013

Access Specifiers In .Net

Access Specifiers In .Net

Public -- As name specifies, it can be accessed from anywhere.If a member of class is defined as public then it can be accessed anywhere.

Private -- Accessible inside the class only through member functions.

Protected -- protected variables can be used with in the class as well as the classes that inherits this class
 

Friend/Internal -- Friend and Internal mean the same. Friend is used in VB.Net.Internal is used in C#. Internal can be accessed by all classes with in an assembly but not from outside the assembly.

Protected Internal -- Visible inside the assembly through objects and in derived classes outside the assembly through member functions.

Object Oriented Programming Concepts (OOPS) in C#.net

1. Object             - Instance of Class
2. Class               - Blue print of Object
3. Encapsulation    - Protecting our Data
4. Polymorphism   - Different behaviors at different instances
5. Abstraction        - Hiding our irrelevant Data
6. Inheritence        - One property of object is acquiring to another property of object

Monday, 1 July 2013

Create a Excel file and Add Data Into it Using Asp .Net Using C#

Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader( "Content-Disposition", "attachment;filename=registrationData.xls" );
this.EnableViewState = false;
 
using ( StringWriter sw = new StringWriter() )
    using ( HtmlTextWriter htw = new HtmlTextWriter( sw ) )
    {
        //  Create a table to contain the grid
        Table table = new Table();
 
        //  Gridline to box the cells
        table.GridLines = System.Web.UI.WebControls.GridLines.Both;
 
        List columns = new List() {
        "Sent", "Sent Date", "User Name", "Last Name", "First Name",
        "Work Phone", "Work Email",    "Number of Tickets", "Street Address 1",
        "Street Address 2",    "City", "State", "Zip Code" };
 
        TableRow tRow = new TableRow();
        string value;
 
        foreach ( string name in columns )
            tRow.Cells.Add( new TableCell() { Text = name } );
 
        table.Rows.Add( tRow );
 
 
        // BackColor = System.Drawing.Color.Blue
        foreach ( var usr in UserData )
        {
            tRow = new TableRow();
 
            value = ( usr.ticketsSent == null ) ? "N" : usr.ticketsSent.Value.ToString();
            tRow.Cells.Add( new TableCell() { Text = value } );
 
            value = ( usr.ticketsSentDate == null ) ? string.Empty : usr.ticketsSentDate.Value.ToShortDateString();
 
            tRow.Cells.Add( new TableCell() { Text = value } );
            tRow.Cells.Add( new TableCell() { Text = usr.userName } );
            tRow.Cells.Add( new TableCell() { Text = usr.lastName } );
            tRow.Cells.Add( new TableCell() { Text = usr.firstName } );
            tRow.Cells.Add( new TableCell() { Text = usr.workNumber } );
            tRow.Cells.Add( new TableCell() { Text = usr.workEmail } );
            tRow.Cells.Add( new TableCell() { Text = usr.ticketsRequested.Value.ToString() } );
            tRow.Cells.Add( new TableCell() { Text = usr.address1 } );
            tRow.Cells.Add( new TableCell() { Text = usr.address2 } );
            tRow.Cells.Add( new TableCell() { Text = usr.city } );
            tRow.Cells.Add( new TableCell() { Text = usr.state } );
            tRow.Cells.Add( new TableCell() { Text = usr.zipCode } );
 
            table.Rows.Add( tRow );
        }
 
        //  Htmlwriter into the table
        table.RenderControl( htw );
 
        //  Htmlwriter into the response
        HttpContext.Current.Response.Write( sw.ToString() );
        HttpContext.Current.Response.End();
   }

IE7 Issues Text Indent

                 Unfortunately IE 7 is still widespread among the users hence while theming we have to give special importance to the grea...