Tips n Tracks

  • Increase font size
  • Default font size
  • Decrease font size
  • default color
  • black color

Reference

Sample image

Microsoft .NET Framework Get Details.

Sample image

Microsoft .NET Framework Get Details.

Reference

Sample image Microsoft .NET Framework Get Details.
Sample image

Microsoft .NET Framework Get Details.


Text and Data Manipulation with Regular Expressions in .NET Development


Text and Data Manipulation with Regular Expressions in .NET Development

Regular expressions(or regex) is a language used for more sophisticated form and text processing. They are often used to perform complex search-and-replace operations, and to validate that text data is well-formed. Today, regular expressions are supported by most programming languages, as well as many scripting languages (like Perl, ASP, Visual Basic, .NET, C#, Java, JSP, PHP,Python, ColdFusion, Tcl, Ruby and many other languages), editors (EmEditor, TextPad), applications (Microsoft Word, Microsoft Excel, StarOffice, OpenOffice), databases(MySQL, SQL Server), and command-line tools.

Here we see a hands on approach to solve the needs of the majority of RegEx to manipulate data. I have try my best to provide ready to use source for lattest version of ASP.NET, VB.NET, C#.NET. All the example described here are tested with Visual Studio 2008. I have try to cover all important and mostly used regular expressions. If you face with any error or you have new idea which needed to be cover here. Please drop your feedback for me. Ok!, let’s get started…


Read the rest of this entry »

Create Temporary virtual table (or a records set) with SQL Server Stored Procedure


Create Temporary virtual table (or a records set) with SQL Server Stored Procedure

Some time we need to create a virtual table to manipulate data without affecting the actual data in the actual table. You can create a virtual table by two ways. Using CREATE TABLE statement and with DECLARE statement.

Let’s consider, I have student table(tblStudent) contain sName, sAddress, ClassId and class table(tblClass) contain classId and ClassName. Now I want to SELECT Name, Address and ClassName based on string pattern and Stored it to a virtual table.

First of all take a look at our table structure…

Table 1 – tblStudent
SrNo sName sAddress ClassId
1 Lucy Redmond 1
2 Sam SmallVilla 1
3 Mitchell Mumbai 1
4 Scott SmallVilla 2
5 Kathryn Redmond 3
6 Frank Mumbai 1
  ….
2000 Jay Mumbai 3


Read the rest of this entry »

Pause a Console Application for User Input


Pause a Console Application for User Input or Pause Command in a Console Application

While working with C# or VB.NET Console Applications, you may require to pause for the user input or display a message to the user. Console application window get exit as the program execution finished. Following Piece of code will do it for you.

C#.NET

using System;
using System.Collections.Generic;
using System.Text;
 
namespace Pause {
   class Program {
      static void Main(string[] args)
    {
     Console.WriteLine("Press any key to continue…");
     Console.ReadLine(); //Pause
    }
   }
}


Read the rest of this entry »

Read XML data from a URL by using Visual C#


Read XML data from a URL by using Visual C#

C# has a powerful and flexible namespace System.Xml to manipulate XML. System.Xml namespace provides the XMLTextReader class to read XML (Extensible Markup Language) from a URL (Uniform Resource Locator).

Now we want to read xml file test.xml (http://localhost/test.xml) located at your localhost. You can also use www.tipsntracks.com site map at "http://www.tipsntracks.com/sitemap.xml". let us look at structure of test.xml, I am going to used.


Read the rest of this entry »

Finding Last line in the text using regular expressions with .net


Finding Last line in the text using regular expressions with .net

In this regular expressions, we are going to find last line in the text.

Regular Expression Pattern

.+Z$

A description of the regular expression:

Any character, one or more repetitions
End of string or before new line at end of string
End of line or string

How It Works

This regular expression will check for Any character, one or more repetitions of End of string or before new line at end of string.


Read the rest of this entry »

Finding First line in the text using regular expressions with .net


Finding First line in the text using regular expressions with .net

In this regular expressions, we are going to find first line in the text.

Regular Expression Pattern

\A.*

A description of the regular expression:

Beginning of string
Any character, any number of repetitions

How It Works

This regular expression will check for Beginning of line followed by Any character.


Read the rest of this entry »