Tuesday, March 2, 2010

Sample regular expression - Numeric, Decimal, Alphanumeric

Hi all,

Please find the sample regular expressions

  1. Numbers only regular expression – ^[0-9]*$
  2. Decimal numbers with 2 floating point compulsory regular expression – ^([0-9]*)(\.[0-9]{2})?$
  3. Alphabets only regular expression – ^[a-zA-Z]*$
  4. Alpha numeric string regular expression – ^[a-zA-Z0-9]*$
  5. Alpha numeric and white space regular expression – ^[a-zA-Z0-9 ]*$

If you want to see how to build regular expressions you can see my article

Thursday, February 11, 2010

.Net 4.0 and Visual Studio 2010 have new feature/function string.IsNullOrWhiteSpace() for strings

.Net framework 4.0 have new feature to check string.

string.IsNullOrWhiteSpace(<your input>)

Previously we had used function string.IsNullOrEmpty to check whether string is empty or null and then we execute the code. But in that case if the string has one or more white space then we had to use string.Trim() function to trim the white space. In some cases if we forget to check those conditions it may cause problems in application later.

Now with string.IsNullOrWhiteSpace we can achieve it with single line of code.

That’s a great new function in .Net 4.0

del.icio.us Tags:

.Net Rocks

Visual Studio 2010 RC has just released

Hi All

Microsoft has released Visual Studio 2010 RC and it is available to download.

You can download it from the link http://www.microsoft.com/downloads/details.aspx?FamilyID=457bab91-5eb2-4b36-b0f4-d6f34683c62a&displaylang=en

The link contains download for Visual Studio 2010 Ultimate RC ISO file.

Visual Studio 2010 Ultimate RC requirements are

1.6Ghz processor

1 GB ram on x86 processor or 2GB on x64

3 GB hard disk space

and Direct X 9

Saturday, January 30, 2010

LINQ queries for integer and string array

In this post i will show some basic queries which we can make on the array in .Net environment.

First of all we will see LINQ query for integer array.

 

   1:  int[] intArray = { 1, 5, 7, 15, 19, 20 };
   2:  var query = from i in intArray
   3:              where i % 5 == 0
   4:              select i;

 

In above example i had defined an integer array as intArray. above LINQ query will select all the integer value which can be divisible with 5.

So its output will be {5, 15, 20}

This was basically searching functionality. Now if you need to sum all the values within array, you can achieve it with below LINQ statement

   1:  int sum = intArray.Sum();

And it will give you sum of all the array

For average the array in LINQ you need to write

   1:  int avg = intArray.Average();

 

Now lets take another example of a string array.

   1:  string[] strArray = {"red", "blue","green", "black", "yellow" };
   2:  var query = from s in strArray
   3:              where s.StartsWith("b")
   4:              select s;

 

Now in this example i have an array of string containing various color name. Above LINQ query will select all the name that starting with be.

So its output will be {“blue”, “black”}

LINQ provide developers a great way to use logic that we can build in C# and LINQ will handle it.

There are much more functionality LINQ provides like concate, reverse, first, last, etc.

Google transliteration IME in 14 new indian languages - Fyoq News

Check out this article

 
 

Sent to you by Nirav Bhatt via Google Reader:

 
 

via Sci/Tech - Google News on 1/28/10


Little About (blog)

Google transliteration IME in 14 new indian languages
Fyoq News
Today Google India announced officially the availablity of Google transliteration in 14 languages. These fourteen Indian languages are Arabic, Bengali, Farsi (Persian), Greek, Gujarati, Hindi, Kannada, Malayalam, Marathi, Nepali, Punjabi, Tamil, ...
Google intros language translator applicationCIOL
Google launches applications to type in 14 languagesThe Hindu

all 16 news articles »

 
 

Things you can do from here: