have a solution

Friday, August 1, 2014

Select First Option of Select-Box Using Jquery

This is a simple script to select first option of a select-box using jquery
    $("#CardCountry").val($("#CardCountry option:first").val());    

Saturday, July 19, 2014

Trim Dropdown Options Using JQuery

This is the HTML of my dropdown list. I have whitespace before and after each of option for this select/ dropdown. And here is a easy way to trim these option values using jQuery each method and javascript trim method.

Tuesday, December 17, 2013

How To: Create Facebook App in 2 Minutes (With Pictures)

If you are assigned a task of working with an Facebook App and want to try-out by creating an App from scratch; Just follow these easy five Step and it will cook you a 'Five Step Facebook App'

First of all Login to Facebook, check your updates and notifications ,When you get rid of repeated photos and notification;
Go to the url :  and start creating your Five Step Facebook App.

1. First Create an App on Facebook. For this Click on 'APP' menu from top-menu and then Click on 'Create New App'

Step 1: Creating a Facebook App
Step 1: Creating a Facebook App

2. As you will set the App Name and click on 'SAVE'. It will navigate to 'Dash-Board'. You can check your APP ID and APP Secret under Dashboard.
Step 2 :  Dashboard | Facebook App
Step 2 :  Dashboard | Facebook App

3. Now Click on 'Settings' from Left menu. You will be navigated to 'BASIC' tab. Here You should do some basic preparation for your App.
Note APP ID : ***********
     APP Secret: ********** (Click on 'SHOW' will let you know your App Secret, Keep this really secret)
     App Name : You can change the App name here.
     Email : Set the email here you  want to be notified at.
Step 3 : Basic Setting For Facebook App
Step 3 : Basic Setting For Facebook App

4. And now the important part of the setting where you would set the Page as CallBack Uri or OAuth Redirect URI
(This will be a page under your domain. And Facebook will revert with Oauth Token. Let say: callback.aspx)

Step 4 : Advance Setting | Setting Callback URL for OAuth Redirection URL
Step 4 : Advance Setting | Setting Callback URL for OAuth Redirection URL

5. One more thing and we are Done with creating an App on Facebook. Just Enable(ON) the setting 'Stream post URL security' on migration page.

Step 5 : Disable 'Stream post URL security'
Step 5 : Disable 'Stream post URL security'

Click on 'Save Changes' the last time in Step 5. You have created a Facebook App Successfully.
Now You can utilize your Newly Created Facebook App from your website/Application

Saturday, October 12, 2013

It Happens Only in India

What do you think is this ???

This image belongs to a famous temple  Maa Chamunda Tekri in Dewas. Generally its a saying in Hindu and Muslim religion that if you tie a thread or band in temple somewhere, it may get your 1 wish come true. 
But till now I was believing and noticing this thing working with "Thread" only. Today I watched a gate of temple packed of small polythene packs. People are actually using incense sticks in temple and the polythene packet of these sticks to get their wish come true.

Interesting isn't it . . . It happens only in India !!!

Tuesday, July 23, 2013

How To Eat Like Animals

No description required for this one.

A Roadside School In Ahmedabad

A roadside school in Ahmedabad(Gujrat)
A road-side school in Ahmedabad(Gujrat)
In Ahmedabad(Gujrat), It’s a school on road side started in 2001 by Mr.Kamal Bhai Parmar, now his son run this school. Beside the school is a main road, vehicles pass-away from there and near are the benches where students used to study. When its lunch- time , students get mid day meal here. The more important thing about this school is, all the students here having poor background and can't afford the fees/books/lunch, this all managed by the school owner himself.
Definitely he is not making money out of it but creating some good wishes for himself.

While writing the above line of this post it reminded me dialogue from a Hindi Movie (Once Upon A Time In Mumbai) where Ajay Devgan has a dialogue “Dua Me Yaad Rakhna”
If you want to do something do it anyways !!!

Monday, July 15, 2013

How To: Set Connection Timeout in SQL SERVER

If you have just started SQL SERVER and frustrated because its asking you for username/password everytime you execute a query or try to open a window for new query. Then a simple reason behind that is connection timeout of your SQL SERVER(i am using 2008).

How to: Set Connection Timeout in SQL SERVER
Microsoft SQL Server Connection Properties

Just follow these steps :
  1. Click on File -> Connect Object Explorer
  2. This will make Login panel appears again.
  3. Now Click on Connection Properties and set Connection Timeout to a bigger value(I set it here to 3600 seconds = 1 hour)

This will only make you free from this issue only. I hope you'll find other issues to surf web in some time !!! :P

Friday, June 21, 2013

jQuery Menu

I was just surfing stackoverflow and found a question about Navigation Menu. Just picked the solution from there and modified a bit to get a sleek one around.

And here is the recipe:

  1. Create a Place Holder Div for the navigation menu. Now add some divs(Menu Items) to this container. 
  2. This div will work as container for the Main Menu and Submenu under it. 
  3. Now Add a paragraph and a UL - LI structure under each of Menu Item Div created in last step.
  4. We can add some a-tags in LIs to work as a link.
  5. I have added some simple css style to get it noticeable. You can apply yours to make it handsome.

Thats all to do with HTML.



Ok so now we just have to add some jQuery that will Do some animation for our menu. We are using all around 3(of these 5) very simple methods of jQuery:
  1. .mouseenter() : It triggered when you mouse enters an element bound with this method.
  2. .mouseleave() : It triggered when you mouse enters an element bound with this method.
  3. .slideup('slow/fast/time in ms') : It hides an element with a effect of sliding it up.
  4. .slidedown('slow/fast/time in ms') : It shows an element with a effect of sliding it down.
  5. .slideToggle('slow/fast/time in ms') : It will toggle/change the state in between up/down.
we have to set just two things,
  1. Whenever someone hover the menu show the the submenu that is combination of .mouseenter() + .slidedown()
  2. And when it hover-out hide submenu that is combination of .mouseleave() + .slideup()
Oh forget to write,we are binding these jQuery methods on html elements on DOM ready(No wonder you know jQuery Ready event). Here is the jQuery code looks like :
$(document).ready(function() {
    $('.selector').mouseenter(function (){
        $(this).find('> ul').slideToggle('slow');
    $('.selector').mouseleave(function (){
    $(this).find('> ul').slideToggle('slow');

Here is fiddle demo:

Thursday, March 21, 2013

Google Conversion Tracking Using Contact Form 7 Without Redirection

I was searched for the problem at least a day and found nothing that works Cool.
All the solutions to set a Google Conversion Tracking for wordpress suggest to redirect the user to a "thank-you.html" page , and to put there the actual Javascript code for Google Coversion Tracking.

Some suggested to use an iFrame while displaying "Successful Form submission", and this sparked the idea to set the actual Google Conversion Tracking Javascript code to the field where we set Thanks-giving message.

Here is my Google Conversion tracking code Script that I have to fire after successful submission of contact-form-7.

Google AdSense Script

I just append this code to the input box where we use Successful Form Submission message. i.e. (Thanks. We will contact you soon. < Google Conversion tracking code Here >)

Contact Form 7

As the response msg generated through contact form 7, it also runs the google script containing code for Adsense. This is working cool for me.
Comments Welcome . . .

Wednesday, March 13, 2013

How to switch between two CSS files on a page

The basic idea for changing applied CSS is to tells the browser which one is to be used. For the purpose we have to do 3 things : 1. Use 2 CSS files in our page as given below (with title tag, we will later recognize these files through title):

2. Change the applied CSS file so theme can be changed. we can set two buttons somewhere on page so we can switch theme when we click on any of them.


2. Tells browser to memorize , what is our current CSS , so it would render the right one for the user. For this we are using javascript and doing 3 things here :
to set Cookie and a function to switch the current CSS applied to other one, and a method to read cookie to get current CSS applied during page loads

function setActiveStyleSheet(title) {
    var i, a, main;
    for (i = 0;
    (a = document.getElementsByTagName("link")[i]); i++) {
        if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
            a.disabled = true;
            if (a.getAttribute("title") == title) a.disabled = false;
function getActiveStyleSheet() {
    var i, a;
    for (i = 0;
    (a = document.getElementsByTagName("link")[i]); i++) {
        if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
    return null;
function getPreferredStyleSheet() {
    var i, a;
    for (i = 0;
    (a = document.getElementsByTagName("link")[i]); i++) {
        if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title")) return a.getAttribute("title");
    return null;
function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    } else expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    return null;
window.onload = function (e) {
    var cookie = readCookie("style");
    var title = cookie ? cookie : getPreferredStyleSheet();
window.onunload = function (e) {
    var title = getActiveStyleSheet();
    createCookie("style", title, 365);
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();

Download Demo