Tuesday, April 15, 2014

How does === means different than == in JavaScript?

These two operators do not mean the same and does different operation too.
== verifies if the compared values are equal
=== verifies if the variables that are compared have the same value and are the same type
JavaScript's standard equality operators (== and !=) check if two expressions are equal (or not equal). If the two operands are not of the same type, JavaScript attempts to convert the operands to an appropriate type for the comparison. Values are considered equal if they are identical strings, numerically equivalent numbers, the same object, identical Boolean values, or (if different types) they can be coerced into one of these situations.
JavaScript's identity (strict equality) operators (=== and !==) behave identically to the equality operators except no type conversion is done, and the types must be the same to be considered equal. Here are a few examples:
"3" == 3 // true
"3" === 3 // false
1 == true // true
1 === true // false
"1" == true // true
"1" === true // false

Code snippet:

<script type="text/javascript">
   var a = 5;
   var b = '5';
   var c = 5;
   if(a==b)
   {
      document.write('a and b have the same value');
   }

   if(a===b)
   {
      document.write('a and b have the same value and the same type');
   }
   if(a===c)
   {
      document.write('a and c have the same value and the same type');
   }
</script>


Saturday, April 12, 2014

Use your Windows Phone 7 device as a portable

A simple registry edit turns your WP7 device into a USB drive.

Open the Registry Editor (regedit), go to HKEY_LOCAL_MACHINE\SYSTEM and then expand the CurrentControlSet\Enum\USB folder.

Search for PortableDeviceNameSpaceExcludeFromShell and there you will get the other setting which are need to set are below:

> Change ShowInShell from 0 to 1.
> Change PortableDeviceNameSpaceExcludeFromShell from 1 to 0.
> Change EnableLegacySupport from 0 to 1. That's it. If there's more than one Windows Phone 7 device listed.

Cheers! Now all done.

Note: Remember to take backup before doing any registry changes..