Thursday, December 29, 2005

Wednesday, December 28, 2005

Regular Expression: Multiple replacement in one go

One of the overloaded form of Regex.Replace function takes MatchEvaluator delegate as a parameter. We can use this form to achieve multiple (conditional) replacement in one go.

For Example:
// Replace Textboxes
string regex = "\\
";
System.Text.RegularExpressions.RegexOptions options = ((System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace
| System.Text.RegularExpressions.RegexOptions.Multiline)
| System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(regex, options);
pageContent = reg.Replace(pageContent,new MatchEvaluator(RemoveFormElement));

protected string RemoveFormElement(Match m)
{
if(m.Value.IndexOf("RemoveFeedback") != -1)
{
string feedback = Regex.Replace(txtFeedback.Text,"\\n","
"
);
return ""+feedback+"";
}
else if (m.Value.IndexOf("RemoveContextHeader") != -1)
{
return ""+ contextHeader +"";
}
else
{
return m.Value;
}

}

Monday, December 05, 2005

Useful Window Tricks

Check out these 10 useful window tricks.

http://www.practicalpc.co.uk/computing/windows/top10tricks1.htm

Binding of DictionaryBase object with Datagrid instead of Collection Object

Following excerpts demonstrate how we can bind dictionary object with datagrid.

<asp:Label id="Label1" runat="server" Width="64px">
<%#((DictionaryEntry)Container.DataItem).Key %>
<br>
<%# ((TestApplication.ContactsInfo)((DictionaryEntry)Container.DataItem).Value).age%>

Prometric Test Centers in India

To find out prometric centers of your preferred location, visit following link:
http://www.register.prometric.com/Centers.asp

Following are some of the centers in New Delhi:

SQL STAR INTERNATIONAL LTD
NEW DELHI, Delhi 110003
Phone: 24601539 Site Code: IIU1 3RD FLOOR,
ANDHRA ASSOCIATION BULDING
24 & 25,
LODHI ROAD

C-NET EDUCATION
NOIDA, Uttar Pradesh
Phone: 5320373,2440594 Site Code: IIF94 D-3
SECTOR -10

IACL (Institute of Advance computer Learning)
NEW DELHI, Delhi 110049
Phone: 55484641 Site Code: IIG66 IACL
H-28,2ND-FLOOR
SOUTH EXTENSION PART-I

CMC LIMITED
NEW DELHI, Delhi 110058
Phone: 25572355 Site Code: IIG29 C-58,9TH FLOOR, SHAHPURI TIRATH SINGH TOWER
BEHIND JANAK CINEMA, JANAKPURI

VIVEKANAND INSTITUTE OF COMPUTER EDUCATION(VICE)-MOBILE SITE
DELHI, Delhi 110009
Phone: 55278088 Site Code: IIM83 VIVEKANAND INST. OF COMPUTER EDUCATION-MOBILE
2647
HUDSON LINE
NEAR NORTH CAMPUS
PATEL CHEST