Tuesday, January 24, 2006

Delegates and Events in C# (1.1)

Delegates and Events in C# (1.1)

An excellent article

http://www.akadia.com/services/dotnet_delegates_and_events.html


Debugging ASP.NET Applications with VS 2003


Debugging ASP.NET Applications with VS 2003


after hours of troubleshooting, I found this

If you created the Web project with a full machine name (like machinename.domainname.something), the Web site is recognized as Internet site. So, the default setting of Internet Explorer will impact on the behavior of logging on. In this case, you need to enable logging on with your current user account in "Internet" area with the IE setting.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vsdebug.asp

Thursday, January 19, 2006

Getting Caller method info

Getting Caller method name from method

StackTrace st = new StackTrace();
string str = st.GetFrame(1).GetMethod().Name;

Monday, January 16, 2006

Regular Expression

Regular Expression to select HTML elements from the text

<select.*?</select>

.*? is for lazy (non-greedy) capture of the pattern.

Friday, January 06, 2006

SPS 2003 installation Issue

SPS 2003 installation: Installation ended prematurely because of an error

When re-installing SPS 2003 on a Windows 2003 Server, I got the error "Installation ended prematurely because of an error".
To resolve this issue, I’ve to remove the Windows SharePoint Services 2.0 and then run the setup of SharePoint portal server 2003 again.  This will make the installation of SharePoint Portal Server 2003

Thursday, January 05, 2006

Notes on C# 2.0 (Nullable Types)

C# 2.0 ( Nullable Types)

Nullable types are constructed using the ? type modifier. This token is placed immediately after the value type being defined as nullable. The type specified before the ? modifier in a nullable type is called the underlying type of the nullable type. Any value type can be an underlying type.

int? i;
Point? nullPoint = null;
i = null;
nullPoint = new Point?(point);
public struct Real
  {
    int internalVal;
    public Real(int realNumber)
    {
        internalVal = realNumber ;
    }
}
Real? real = new Real?(new Real(3));
The null coalescing operator takes as arguments a nullable type to the left and the given nullable type’s underlying type on the right. If the instance is null, the value on the right is returned otherwise the nullable instance value is returned.
int? i;
i = 10;
int j = 20;
string str = Convert.ToString(i ?? j);
MessageBox.Show(str);
The statement (i ?? j) returns i if i is not null, otherwise it returns j.

The new ?? binary operator allows you to conditionally test for null and use an alternative value instead. For example, consider the following assignment.
int myvalue = (x != null ? x : 0);
With the ?? operator, this can be rewritten as:
int myvalue = x ?? 0;
This indicates to assign the value of x to the myvalue variable or 0 in the case that x is null.