Thursday, December 3, 2009

VB.NET Class

If the class inherit another class, you may use the baseclass sub new as follows:
Class ChildClass
Inherits BaseClass
Public Sub New(text As String)
MyBase.New(text)
End Sub
End Class


Reference: Here

More inheritance lessons

Microsoft Enterprise Library Exception Logging error

Did you encounter this error?
The type 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' cannot be resolved. Please verify the spelling is correct or that the full type name is provided.

Simply add Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll as the reference to your project.

Reference: here

Tuesday, December 1, 2009

Remove Identity column in a table

Reset Identity in MS SQL

Remove the IDENTITY Property from an Existing Column in SQL Server 2000

Removing IDENTITY from existing column

Subquery sample

create table T3 (a int unique clustered, b int)

insert T1 values(0, 0, 0)
insert T1 values(1, 1, 1)

select
case
when T1.a > 0 then
(select T3.b from T3 where T3.a = T1.b)
else
T1.c
end
from T1


Reference: here

Thursday, July 2, 2009

Append string in front to StringBuilder

Here's how to append string in front for StringBuilder
StringBuilder sb = new StringBuilder();
sb.Append("sample");
sb.Insert(0, "firststring ");
string s = sb.ToString();

Reference: here

Tuesday, June 30, 2009

A potentially dangerous Request.Cookies value was detected from the client

A potentially dangerous Request.Cookies value was detected from the client (AppEvtStat="Deal...").

Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case.

To resolve this:
Add validateRequest="false" on the Page element like below

<%@ Page validateRequest="false" %>

Reference: here

Monday, June 29, 2009

Firefox enable windows authentication

To enable windows authentication on your domain.

1. Open Firefox

2. Enter on url textbox: about:config

3. Locate the following preference names and put as the value the comma separated values of the address roots.

network.automatic-ntlm-auth.trusted-uris
network.negotiate-auth.delegation-uris
network.negotiate-auth.trusted-uris


Your value should look something like this: localhost, server1, server2, serverX, something.com

Reference: here