Wednesday, April 11, 2007
HTML Table Sort
Many a times we have a table populated with data and we want to sort on a specific column. It doesn't makes sense to hit the server for data that we already have. The solution is to use DOM to sort the data and repopulate table using JavaScript. There are a number of such scripts available on net and a simple Google search returns a lot of results. For e.g. try searching for "HTML table sorting". One very simple to use script is available at http://webfx.eae.net/dhtml/sortabletable/sortabletable.html.
Tuesday, February 27, 2007
Regex | Validate email
There are a number of JavaScript modules available online which validates email address. But there are instances when a valid mail address is also invalidated for e.g. some assume all domains end in .com, .net, .edu, or .org; and other invalidate mail ID with a + in the local-part. RFC 2822 (former RFC 822) describes the format of mail address.
So, here's the JavaScript code to validate the e-mail address as per RFC. Please correct it if there are any discrepancies.
function checkMail(emailAdd)
{
var regExobj = /^[-!#$%&'*+/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/0-9=?A-Z^_a-z{|}~])*@[a-zA-Z](-?[a-zA-Z0-9])*(\.[a-zA-Z](-?[a-zA-Z0-9])*)+$/;
return(regExobj.test(emailAdd));
}
So, here's the JavaScript code to validate the e-mail address as per RFC. Please correct it if there are any discrepancies.
function checkMail(emailAdd)
{
var regExobj = /^[-!#$%&'*+/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/0-9=?A-Z^_a-z{|}~])*@[a-zA-Z](-?[a-zA-Z0-9])*(\.[a-zA-Z](-?[a-zA-Z0-9])*)+$/;
return(regExobj.test(emailAdd));
}
.Net Free Charting Solution | ZedGraph
ZedGraph is a set of classes, written in C#, for creating 2D line and bar graphs of arbitrary datasets. The classes provide a high degree of flexibility -- almost every aspect of the graph can be user-modified. At the same time, usage of the classes is kept simple by providing default values for all of the graph attributes. The classes include code for choosing appropriate scale ranges and step sizes based on the range of data values being plotted.
ZedGraph also includes a UserControl interface, allowing drag and drop editing within the Visual Studio forms editor, plus access from other languages such as C++ and VB. ZedGraph is licensed under the LGPL.
ZedGraph Home Page: http://zedgraph.org/wiki/index.php?title=Main_Page
ZedGraph Tutorial: http://codeproject.com/csharp/zedgraph.asp
Wednesday, January 17, 2007
Create Comments Faster | Visual Studio 2005
GhostDoc is an add-in for Visual Studio .NET 2003 and 2005 that tries to automate XML documentation. With GhostDoc installed, you move the cursor into the method or property you want to document, invoke the "Document This" command using either the source editor's context (right-click) menu or a hotkey, and GhostDoc will create an XML documentation comment. The result for
public void AppendHtmlText(HtmlProvider htmlProvider){...}
would be:
///
/// Appends the HTML text.
///
/// The HTML provider.
public void AppendHtmlText(HtmlProvider htmlProvider)
{
...
}
Some more examples are:
///
/// Gets the at the specified index.
///
///
public string this[int index] {
get { ... }
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
///
/// Gets or sets a value indicating whether
/// this is cool.
///
///
///true if cool; otherwise, false .
///
public bool Cool
{
get { return true; }
set { ; }
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
///
/// Determines the size of the page buffer.
///
///
/// Size of the initial page buffer.
///
public int DeterminePageBufferSize(int initialPageBufferSize)
GhostDoc can be downloaded from here.
public void AppendHtmlText(HtmlProvider htmlProvider){...}
would be:
///
/// Appends the HTML text.
///
/// The HTML provider.
public void AppendHtmlText(HtmlProvider htmlProvider)
{
...
}
Some more examples are:
///
/// Gets the
///
///
public string this[int index] {
get { ... }
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
///
/// Gets or sets a value indicating whether
/// this
///
///
///
///
public bool Cool
{
get { return true; }
set { ; }
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
///
/// Determines the size of the page buffer.
///
///
/// Size of the initial page buffer.
///
public int DeterminePageBufferSize(int initialPageBufferSize)
GhostDoc can be downloaded from here.
Tuesday, January 16, 2007
Smart Paster | Add-In for Visual Studio
SmartPaster is a plug-in for Visual Studio .NET 2003 and 2005 that allows text on the clipboard to be pasted in a format compatible with C# and Visual Basic code. SmartPaster can be downloaded from here.
Subscribe to:
Posts (Atom)