Design patterns types

Creational Patterns
  • Abstract Factory:- Creates an instance of several families of classes
  • Builder: - Separates object construction from its representation
  • Factory Method:- Creates an instance of several derived classes
  • Prototype:- A fully initialized instance to be copied or cloned
  • Singleton:- A class in which only a single instance can exist 

Structural Patterns  

  • Adapter:-Match interfaces of different classes
  • Bridge:-Separates an object’s abstraction from its implementation.
  • Composite:-A tree structure of simple and composite objects.
  • Decorator:-Add responsibilities to objects dynamically.
  • Façade:-A single class that represents an entire subsystem.
  • Flyweight:-A fine-grained instance used for efficient sharing.
  • Proxy:-An object representing another object.

Behavioral Patterns  

  • Mediator:-Defines simplified communication between classes.
  • Memento:-Capture and restore an object's internal state.
  • Interpreter:- A way to include language elements in a program.
  • Iterator:-Sequentially access the elements of a collection.
  • Chain of Resp: - A way of passing a request between a chain of objects.
  • Command:-Encapsulate a command request as an object.
  • State:-Alter an object's behavior when its state changes.
  • Strategy:-Encapsulates an algorithm inside a class.
  • Observer: - A way of notifying change to a number of classes.
  • Template Method:-Defer the exact steps of an algorithm to a subclass.
  • Visitor:-Defines a new operation to a class without change. 
Courtesy: Sheela

What is design patterns?

Design patterns are documented tried and tested solutions for recurring problems in a given context. So basically you have a problem context and the proposed solution for the same. Design patterns existed in some or other form right from the inception stage of software development. Let’s say if you want to implement a sorting algorithm the first thing comes to mind is bubble sort. So the problem is sorting and solution is bubble sort. Same holds true for design patterns.

Courtesy: Sheela

Download .dll or .exe files from IIS server.

If try to download he exe or dll file from the IIS server, you will get 404 file error. But this is incorrect settings in the IIS.

Why:
IIS Manager >> Website/VD >> Properties >> Home Directory >> Application Settings

Execute permissions set to "Scripts and Executables" in IIS.
 
Resolution:
IIS Manager >> Website/VD >> Properties >> Home Directory >> Application Settings

Set Execute permissions to "Scripts only" in IIS.

Data provider or other service returned an E_FAIL status.

When you are trying to retirve data from oracle database from classic ASP. You will get the bellow error.

Microsoft Cursor Engine error '80004005'
Data provider or other service returned an E_FAIL status.
/localhost/file.asp, line 68


For this you need to add NVL function for the null value column

Microsoft Cursor Engine error '80004005'

When you are trying to retirve data from oracle database from classic ASP. You will get the bellow error.

Microsoft Cursor Engine error '80004005'
Data provider or other service returned an E_FAIL status.
/localhost/file.asp, line 68


For this you need to add NVL function for the null value column

Oracle output on HTML file

SET MARKUP HTML ON SPOOL ON HEAD "<TITLE>SQL*Plus Report</title> -
<STYLE TYPE='TEXT/CSS'><!--BODY {background: ffffc6} --></STYLE>"
SET ECHO OFF
SPOOL employee.htm

SELECT sysdate from dual;
BY modified_date ASC;
SPOOL OFF
SET MARKUP HTML OFF
SET ECHO ON

What is the maximum length of a URL?

Microsoft Internet Explorer (Browser) : Microsoft states that the maximum length of a URL in Internet Explorer is 2,083 characters, with no more than 2,048 characters in the path portion of the URL. In my tests, attempts to use URLs longer than this produced a clear error message in Internet Explorer.

Firefox (Browser) : After 65,536 characters, the location bar no longer displays the URL in Windows Firefox 1.5.x. However, longer URLs will work. I stopped testing after 100,000 characters.

Safari (Browser) : At least 80,000 characters will work. I stopped testing after 80,000 characters.

Opera (Browser) : At least 190,000 characters will work. I stopped testing after 190,000 characters. Opera 9 for Windows continued to display a fully editable, copyable and pasteable URL in the location bar even at 190,000 characters.

Apache (Server) : My early attempts to measure the maximum URL length in web browsers bumped into a server URL length limit of approximately 4,000 characters, after which Apache produces a "413 Entity Too Large" error. I used the current up to date Apache build found in Red Hat Enterprise Linux 4. The official Apache documentation only mentions an 8,192-byte limit on an individual field in a request.

Microsoft Internet Information Server : The default limit is 16,384 characters (yes, Microsoft's web server accepts longer URLs than Microsoft's web browser). This is configurable.

Constant & Static Readonly fields

Constant
const field can never be modified and must be initialized where it is declared
class Company
{
    public const string CompanyName = "RK Inc";
}

Static Readonly
class Company
{
    public static readonly string CompanyName = "RK Inc";
    staticCompany()
    {
        CompanyName = "My Company";
    }
}
Assigning the value to a readonly field outside the class will throw the following error:
Company.CompanyName = "My Company";

A static readonly field cannot be assigned to (except in a static constructor or a variable initializer)

MSMQ Format Name and Host Name

General MSMQ Format Names:
QueueInfo.FormatName = "DIRECT=Protocol:Address\Queue"
QueueInfo.FormatName = "DIRECT=OS:ComputerName\Queue"
QueueInfo.FormatName = "PUBLIC=QueueGUID"
QueueInfo.FormatName = "PRIVATE=ComputerGUID\Queue"

Sample pathnames and direct format names for both public and private queues.

Path Names
.\RKQueue References a public queue named RKQueue on the local machine.
server01\RKQueue References a public queue named RKQueue on a machine named server01 (local queues can be referenced with a machine name as well).
.\private$\RKQueue References a private queue named RKQueue on the local machine.
server01\private$\RKQueue References a private queue named RKQueue on a machine named server01.
Direct Format Names
Formatname:DIRECT=OS:.\RKQueue References a public queue named RKQueue on the local machine.
Formatname:DIRECT=OS:server01\RKQueue References a public queue named RKQueue on a machine named server01.
Formatname:DIRECT=TCP:127.0.0.1\private$\RKQueue References a private queue named RKQueue on the local machine.

FormatName:Public= 5A5F7535-AE9A-41d4-935C-845C2AFF7112
FormatName:DIRECT=SPX: NetworkNumber; HostNumber\QueueName
FormatName:DIRECT=TCP: IPAddress\QueueName
FormatName:DIRECT=OS: MachineName\QueueName
"PRIVATE=ComputerGUID\Queue"
FormatName:DIRECT=http://<client name>/msmq/<queue name>
FormatName:DIRECT=https://<client name>/msmq/<queue name>

Advantage of SQL Server .NET data provider

ADO.NET provides several different methods to access SQL Server data, including OLE DB.NET, ODBC.NET, SQLXML, and the SQL Server .NET data provider. Of all of these, the SQL Server .NET data provider is the fastest, as much as 30-40% faster than the others. The SQL Server .NET provider uses TDS (Tabular Data Stream, which is the native SQL Server data format) to communicate with SQL Server.

IP address in ADO.NET connection string

When you specify a server in an ADO.NET connection string, use the server's IP address, not the server's DNS name. By using an IP address instead of a DNS name, name resolution does not have to occur, reducing the amount of time it takes for a connection to be made. A server's IP address can be used to specify either a default or named instance of a server running SQL Server. If you are running a cluster, use the virtual SQL Server IP address.