Facebook Account password mystery

In my previous post, I explained how we can play with Google account username. In this post, I will let you know something about Facebook account.

As Google ignores periods in username, Facebook ignores the "CAPITAL CASE" letters in password.

Means if your Facebook password is abcd, you can also use Abcd or ABcd or ABCD or any combination of small and capital letters.


This is a bit surprising because in 99.99% cases, we think that passwords are case sensitive (& it should be due to the security reason).

But Facebook has a different logic.When we use a desktop or Laptop, we can easily identify that our "CAPS" lock is ON or OFF & we always take care about it.
But when we use our android device or iphone etc & try to enter any string then most of the time, by default First letter will be "CAPITAL CASE" letter & use may experience "Invalid Password" error.

To get rid off this situation, Facebook has started to ignore "CAPITAL CASE" letters or vice versa to enhance the user experience of their mobile app.

Now, when you will use your Facebook app, no need to worry about Capital/Small case letters. Just enter your password & enjoy the Facebook.

Google Account login mystery



1. If your username contains a dot (.), then you can also login to your google account by skipping that dot.
E.g: abc.xyz can be accessible by abcxyz. (but account login will be displayed as abc.xyz)

2. If your username doesn't contains any dot (.), you can split your username by placing any number of dots (.) & try to login to your account.

E.g: if my login id is abcxyz then I can use either abc.xyz or abc.x.y.z or abc...xyz etc. (whatever combination you want).

This is because Google has started to ignore periods.

So, you can take advantage by creating several Email Alias of your single Google Account & use them for different purpose.
E.g: abcxyz for your personal use, abc.xyz for friends etc.

I have tried all above test cases & works fine for me. There may be some exceptions E.g: If two different people created two different login as abcxyz & abc.xyz etc. I haven't tried this but I hope this will also work.

This is (may be) just like the Email Alias in outlook.com (previous hotmail.com).

Have Fun !!!!!!!!

How to detect browser & its version using javascript

Yesterday, one of my friend asked me how I can detect the browser & its version using javascript?

I suggested him to use $.browser. I wrote a sample code for him but when I tried to execute the code, it raised an error. $.browser is undefined. It was a bit surprise for me because I used it in several projects.
When I checked the jQuery documentation, I found that $.browser was removed in jQuery 1.9.

OK, no problem. I checked the Modernizr ( a JavaScript library that detects HTML5 and CSS3 features in the user’s browser ).

You can use the below script to identify browser & its version.
Based on the stackoverflow user Code's code snippet:
http://stackoverflow.com/a/13480430/1392485


var BrowserDetect = {
       init: function () {
       this.browser = this.searchString( this.dataBrowser ) || "Other";
       this.version = this.searchVersion( navigator.userAgent ) || this.searchVersion( navigator.appVersion ) || "Unknown";
    },
 
    searchString: function ( data ) {
            for ( var i = 0; i < data.length; i++ ) {
                var dataString = data[i].string;
                this.versionSearchString = data[i].subString;
                if ( dataString.indexOf( data[i].subString ) != -1 ) {
                    return data[i].identity;
                }
            }
        },
 
        searchVersion: function ( dataString ) {
            var index = dataString.indexOf( this.versionSearchString );
            if ( index == -1 ) return;
            return parseFloat( dataString.substring( index + this.versionSearchString.length + 1 ) );
        },
 
        dataBrowser:
            [
                { string: navigator.userAgent, subString: "Chrome", identity: "Chrome" },
                { string: navigator.userAgent, subString: "MSIE", identity: "Explorer" },
                { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" },
                { string: navigator.userAgent, subString: "Safari", identity: "Safari" },
                { string: navigator.userAgent, subString: "Opera", identity: "Opera" },
            ]
        };
        BrowserDetect.init();
You can then simply check for:

BrowserDetect.browser == 'Explorer';

BrowserDetect.version <= 9;


You can also modify the script to include more browsers.

Happy coding !!


How to get current page URL in JavaScript/JQuery

Sometimes, we need to access the current URL in our JavaScript/JQuery code. We need to get any query string value or we need to check URL for any specific value/sub domain.
There are a lot of situations when we want to fetch current URL in our code. There are several ways to do this. Here, I am discussing some of them.
I will use the below URL to test the output.

http://www.mysite.com/abc.aspx?qs1=test1&qs2=test2

Using classical JavaScript:

Property            Result
=================================================================================
window.location                     http://www.mysite.com/abc.aspx?qs1=test1&qs2=test2
window.location.href              http://www.mysite.com/abc.aspx?qs1=test1&qs2=test2
window.location.pathname     /abc.aspx
window.location.hostname     www.mysite.com
window.location.host             www.mysite.com         (it will also include port number also, if you have mentioned any)
window.location.protocol       http:

If we are using JQuery, we can use all above properties or alternatively we can use JQuery syntax also:

$(location).attr('href')

We can use below function to get Absolute URL:

function getAbsolutePath() {
    var loc = window.location;
    var pathName = loc.pathname.substring(0, loc.pathname.lastIndexOf('/') + 1);
    var absoluteUrl = loc.href.substring(0, loc.href.length - ((loc.pathname + loc.search + loc.hash).length - pathName.length));
    return absoluteUrl;
}

Happy Coding !!

Database Error while attaching a database file


There is a very common error wend going to attach database in SQL Server 2008R2. It generally gives the error:
"CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file... (Microsoft SQL Server, Error 5123)"
The problem is due to two different login do detach and attach.
So the files, when detached, were owned by the first login, but attach failed because the login that was used was not the owner of the mdf and ldf files.
We can detach the database by:
EXEC sp_detach_db mydb;
We can attach the database by:
CREATE DATABASE mydb
ON
(FILENAME='C:\MSSQL\mydb.mdf'),
(FILENAME='C:\MSSQL\mydb.ldf')
FOR ATTACH;

To solve this problem we have to give the full permission to both mdf and ldf file to attach login name by right clicking the file and selecting property and then security and then adding login name.