Welcome to my blog.

Post on this blog are my experience which I like to share. This blog is completely about sharing my experience and solving others query. So my humble request would be share you queries to me, who knows... maybe I can come up with a solution...
It is good know :-)

Use my contact details below to get directly in touch with me.
Gmail: nadarmuthukumar1987@gmail.com
Yahoo: nadarmuthukumar@yahoo.co.in

Apart from above people can share their queries on programming related stuff also. As me myself a programmer ;-)

Tirupati Balaji Darshan


Best Add-ons for Firefox

1. Web Developer


The Web Developer extension adds various web developer tools to a browser. read more...





2. Firebug

 Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page... read more...



3. ColorZilla

Advanced Eyedropper, Color Picker, Gradient Generator and other colorful goodies... read more...



4. MeasureIt

Draw a ruler across any web page to check the width, height, or alignment of page elements in pixels. read more...



5. YSlow

YSlow analyzes web pages and why they're slow based on Yahoo!'s rules for high performance web sites. read more...







6. FireFTP

FireFTP is a free, secure, cross-platform FTP/SFTP client for Mozilla Firefox which provides easy and intuitive access to FTP/SFTP servers. read more...







7. Adblock Plus

Annoyed by adverts? Troubled by tracking? Bothered by banners? Install Adblock Plus now to regain control of the internet and change the way that you view the web. read more...



8. Tab Mix Plus

Tab Mix Plus enhances Firefox's tab browsing capabilities. It includes such features as duplicating tabs, controlling tab focus, tab clicking options, undo closed tabs and windows, plus much more. It also includes a full-featured session manager. read more...






9. FireShot

FireShot creates screen shots of web pages entirely. read more...







10. Dummy Lipsum

Generate "Lorem Ipsum" dummy text read more...









11. Font Finder

Font Finder is created for designers, developers and typographers. It allows a user to analyze the font information of any element on a page, copy any piece(s) of that information to the clipboard, and perform inline replacements to test new layouts. read more...




12. Download Statusbar

View and manage downloads from a tidy statusbar - without the download window getting in the way of your web browsing. read more...






13. JSView

All browsers include a "View Source" option, but none of them offer the ability to view the source code of external files. Most websites store their javascripts and style sheets in external files and then link to them within a web page's... read more...

Get Connection String from Config file

When I was trying to access my connection string from class file using below code 
string con = ConfigurationSettings.ConnectionStrings["Conn"].ConnectionString;
I was getting below error.
'System.Configuration.ConfigurationSettings' does not contain a definition for 'ConnectionStrings'
After Google I came you with the solution below,
System.Configuration.ConfigurationSettings.AppSettings
is obsolete. You need to use different class called ConfigurationManager to access information from the configuration file. To Access connection string, your code would look like
string con = System.Configuration.ConfigurationManager.ConnectionStrings["Conn"].ConnectionString

Lord Krishna


Play the ringtone using below player.

Download:
Link 1
Link 2

Sahara Aamby Valley












Just imagine... which place is this????
Whether... Dubai, Malaysia, Singapore, USA, Germany or any other???

NO
IT IS SAHARA AAMBY VALLEY (INDIA, NEAR PUNE, LONAVALA)

Aamby Valley City is a township developed by the Sahara Group in Pune district in the Indian state of Maharashtra. It is about 23 km away read more...

Avoid re-post on refresh

When a user presses the Browser's Refresh button (Or F5/Ctrl+R etc.) the browser resends the last request data to the server.
This action causes an Unexpected Re-Post action (if there was one).
In some cases, it can be very problematic (For example, in shopping website when the user clicks on "Add to Cart" button and then presses the Refresh button - the item will be added twice !!!)

Solution
We will store a unique code (in my case Guid) on both client and server and compare them on every request action. If the two codes are not equal, the action will be canceled and the page will reload ('GET' method).

Designer File

Source Code File
protected void Page_Load(object sender, EventArgs e)
    {
        CancelUnexpectedRePost();
    }
 
    private void CancelUnexpectedRePost()
    {
        string clientCode = _repostcheckcode.Value;
 
        //Get Server Code from session (Or Empty if null)
        string serverCode = Session["_repostcheckcode"] as string  ?? "";
 
        if (!IsPostBack || clientCode.Equals(serverCode))
        {
            //Codes are equals - The action was initiated by the user
            //Save new code (Can use simple counter instead Guid)
            string code = Guid.NewGuid().ToString();  
            _repostcheckcode.Value = code;
            Session["_repostcheckcode"] = code;
        }
        else
        {
            //Unexpected action - caused by F5 (Refresh) button
            Response.Redirect(Request.Url.AbsoluteUri);
        }
    }
Now you can drag the User Control to every page you want to handle that problem, or you can drag it to your Master Page to handle the problem in the entire site.

?? Operator

Starting with how to assign null value type to non-nullable type.
Nullable types are declared in one of two ways:
System.Nullable<T> variable
-or-
T? variable
Where T can be any value type including struct; it cannot be a reference type.

Examples of Nullable Types
int? i = 10;
double? d1 = 3.14;
bool? flag = null;
char? letter = 'a';
int?[] arr = new int?[10];

Now coming to the main point, ?? operator

One of the best features of C# is the ?? "null coalescing" operator.  This provides a nice way to check whether a value is null, and if so return an alternate value.
The ?? operator defines the default value to be returned when a nullable type is assigned to a non-nullable type. If you try to assign a nullable type to a non-nullable type without using the ?? operator, you will generate a compile-time error.
The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand.

Example
class NullCoalesce
{
    static int? GetNullableInt()
    {
        return null;
    }

    static string GetStringValue()
    {
        return null;
    }

    static void Main()
    {
        // ?? operator example.
        int? x = null;

        // y = x, unless x is null, in which case y = -1.
        int y = x ?? -1;

        // Assign i to return value of method, unless
        // return value is null, in which case assign
        // default value of int to i.
        int i = GetNullableInt() ?? default(int);

        string s = GetStringValue();
        // ?? also works with reference types. 
        // Display contents of s, unless s is null, 
        // in which case display "Unspecified".
        Console.WriteLine(s ?? "Unspecified");
    }
}
The ?? operator works for both reference types and value types.
We can achieve the same by using ternary operator (that most are familiar with), then why to use null coalescing operator ?

Advantage:

Well, first of all, it's much easier to chain than the standard ternary:
string anybody = parm1 ?? localDefault ?? globalDefault;
vs
string anyboby = (parm1 != null) ? parm1 
               : ((localDefault != null) ? localDefault 
               : globalDefault);
It also works well if null-possible object isn't a variable:
string anybody = Parameters["Name"] 
              ?? Settings["Name"] 
              ?? GlobalSetting["Name"];
vs
string anybody = (Parameters["Name"] != null ? Parameters["Name"] 
                 : (Settings["Name"] != null) ? Settings["Name"]
                 :  GlobalSetting["Name"];
The chaining is a big plus for the operator, removes a bunch of redundant IFs

Secondly, The ternary operator requires a double evaluation or a temporary variable.
string result = MyMethod() ?? "default value";
while with the ternary operator you are left with either:
string result = (MyMethod () != null ? MyMethod () : "default value"); 
which calls MyMethod twice, or:
string methodResult = MyMethod ();
string result = (methodResult != null ? methodResult : "default value"); 
Either way, the null coalescing operator is cleaner and, I guess, more efficient.

Third it is readable

Disadvantage:

Only problem is the null-coalesce operator doesn't detect empty strings.
string result1 = string.empty ?? "dead code!";
string result2 = null ?? "coalesced!";

OUTPUT:
result1 = ""
result2 = coalesced!

Well it is the null -coalescing operator, not the nullOrEmpty -coalescing operator.
You can achieve the same with Extension methods

Play video file

Recently I got a requirement, where I wanted to play video file on the website.
The video files which I got is in .avi format.
I tried a lot to play the .avi file but I failed, and finally I give up.
Later I tried the same by converting the .avi file to .swf file with below code and done with the work.
               
OR
 
Note: To use the above code, just replace the string "VIDEOPATH" with your video file path. e.g. Videos/demo.swf To know more about the attributes used on the object tag click me

Best Windows Computer Application

1. KDiff
KDiff is a program that compares or merges two or three text input files or directories,
shows the differences line by line and character by character (!),provides an automatic merge-facility and read more...

Difference between Trigger and Stored Procedure

  1. Stored procedures cannot run automatically, they have to be called explicitly by the user.But triggers are executed automatically when particular event (like insert, update, delete) associated within the database object (like table) gets fired. 
  2. Stored procedures can be scheduled through a job to execute on a predefined time, but we can't schedule a trigger.
  3. Stored procedure can accept the parameters from users whereas trigger cannot accept parameters from users.
  4. We can use the transaction statements like begin transaction, commit transaction and rollback inside a stored procedure but we can't use the transaction statements inside a trigger. 
  5. A Trigger can call the specific Stored Procedures in it, but the reverse is not true.

Convert Gridview to Datatable

To copy your Gridview datasource directly into a datatable, without using any loop, one can use BindingSource Class.
Below is the example:
BindingSource bs = (BindingSource)GridView1.DataSource;
DataTable dt = (DataTable)bs.DataSource;
OR
if (GridView1.HeaderRow != null)
    {
        for (int i = 0; i < GridView1.HeaderRow.Cells.Count; i++)
        {
            dt.Columns.Add(GridView1.HeaderRow.Cells[i].Text);
        }
    }

    //  add each of the data rows to the table
    foreach (GridViewRow row in GridView1.Rows)
    {
        DataRow dr;
        dr = dt.NewRow();

        for (int i = 0; i < row.Cells.Count; i++)
        {
            dr[i] = row.Cells[i].Text.Replace(" ","");
        }
        dt.Rows.Add(dr);
    }

    //  add the footer row to the table
    if (GridView1.FooterRow != null)
    {
        DataRow dr;
        dr = dt.NewRow();

        for (int i = 0; i < GridView1.FooterRow.Cells.Count; i++)
        {
            dr[i] = GridView1.FooterRow.Cells[i].Text.Replace(" ","");
        }
        dt.Rows.Add(dr);
    }

Get selected value in Checkboxlist

Hello Everybody,

Yesterday I was facing a problem getting the current value of the checkboxlist.

I have tried using the selected value, as I thought that would give me the current value of the checkbox, but it appears to be giving me the first value that is selected all the time.

I have also tried to use the selectedItem property, but that does the same as I would expect, because the property says it get the item with the lowest value.

After searching i came up with the solution which is below...
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
    string value = string.Empty; 
    string result = Request.Form["__EVENTTARGET"]; 
    string[] checkedBox = result.Split('$'); 
    int index = int.Parse(checkedBox[checkedBox.Length - 1]);
    if (CheckBoxList1.Items[index].Selected)
    { 
         value = CheckBoxList1.Items[index].Value; 
    }
}

Best Android Phone Applications

1. Twitter


Official Twitter app for Android.
Follow your interests: instant updates from your friends, industry experts, favorite celebrities, and what’s happening around the world. Get short bursts of timely information on the official Twitter app. read more...

2. Google Docs
 
 

Create, edit, upload and share your documents with the Google Docs app. Designed for Android to save you time finding your docs. Edits to your documents appear to collaborators in seconds. Make quick changes to read more...

3. TuneIn Radio

 

Browse and listen to radio -- live, local and global. Listen to the world. TuneIn is a new way to listen to the world through live local and global radio from wherever you are. Whether you want music, sports, news read more...

4. eBuddy Messenger

 

Chat on multiple MSN, Facebook, Yahoo, AIM, ICQ, GTalk, MySpace & Hyves accountsChat everywhere with eBuddy Messenger. Stay always connected with all your friends and family on MSN (Windows Live read more...

5. Evernote
Evernote turns your Android device into an extension of your brain.
New York Times ‘Top 10 Must-Have App’, Winner: TechCrunch Crunchies, Mashable Awards and the Webbys. read more...

Twitter Delicious Facebook Digg Stumbleupon Favorites More