psubbiah93@gmail.com

Tuesday, 2 February 2016

Automatic close Bootstrap Alert

$("#error-alert").fadeTo(3000, 500).slideUp(900, function(){
    $("#error-alert").alert('close');
});


Sunday, 31 January 2016

PHP: date function to get month of the date

PHP: date function to get month of the date






What does your "data variable" look like? If it's like this:
$mydate = "2010-05-12 13:57:01";
You can simply do:
$month = date("m",strtotime($mydate));

Monday, 4 January 2016

Jquery $.ajax PHP Calling


$.ajax({ url: '/my/site',
         data: {action: 'test'},
         type: 'post',
         success: function(output) {
                      alert(output);
                  }
});

Wednesday, 2 December 2015

Change Page URL without Refreshing Page

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
    function ChangeUrl(page, url) {
        if (typeof (history.pushState) != "undefined") {
            var obj = { Page: page, Url: url };
            history.pushState(obj, obj.Page, obj.Url);
        } else {
            alert("Browser does not support HTML5.");
        }
    }
    $(function () {
        $("#button1").click(function () {
            ChangeUrl('Page1', 'Page1.htm');
        });
        $("#button2").click(function () {
            ChangeUrl('Page2', 'Page2.htm');
        });
        $("#button3").click(function () {
            ChangeUrl('Page3', 'Page3.htm');
        });
    });
</script>
<input type="button" value="Page1" id="button1" />
<input type="button" value="Page2" id="button2" />
<input type="button" value="Page3" id="button3" />

Monday, 30 November 2015

Add MyqlData Using Package Manager Console


1. Open Package Manager Console

View->Other Window-> Package Manager Console

Type :

PM> Install-Pacakge MySql.Data

PM> Install-Package EntityFramework

Then go to web.config add the following line after the tag

 


 invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
the app.confing should be like this


  
    
    
name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
name="MonkeyFist" connectionString="server=localhost;user id=root;password=mypass;database=mydb" providerName="MySql.Data.MySqlClient" /> version="v4.0" sku=".NETFramework,Version=v4.5" /> type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> invariant="MySql.Data.MySqlClient" /> name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> xmlns="urn:schemas-microsoft-com:asm.v1"> name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" /> oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />

Saturday, 21 November 2015

Social Share Button on Right Side


CSS


body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}

.share-btn-wrp {
list-style: none;
display: block;
margin: 0px;
padding: 0px;
width: 32px;
left: 0px;
position: fixed;
}
.share-btn-wrp .button-wrap{
text-indent:-100000px;
width:32px;
height: 32px;
cursor:pointer;
transition: width 0.1s ease-in-out;
}
.share-btn-wrp > .facebook{
background: url(images/share-icons.png) no-repeat -42px 0px;
}
.share-btn-wrp > .facebook:hover{
background: url(images/share-icons.png) no-repeat -4px -0px;
width:38px;
}
.share-btn-wrp > .twitter{
background: url(images/share-icons.png) no-repeat -42px -34px;
}
.share-btn-wrp > .twitter:hover{
background: url(images/share-icons.png) no-repeat -4px -34px;
width:38px;
}
.share-btn-wrp > .digg{
background: url(images/share-icons.png) no-repeat -42px -68px;
}
.share-btn-wrp > .digg:hover{
background: url(images/share-icons.png) no-repeat -4px -68px;
width:38px;
}
.share-btn-wrp > .stumbleupon{
background: url(images/share-icons.png) no-repeat -42px -102px;
}
.share-btn-wrp > .stumbleupon:hover{
background: url(images/share-icons.png) no-repeat -4px -102px;
width:38px;
}
.share-btn-wrp > .delicious{
background: url(images/share-icons.png) no-repeat -42px -136px;
}
.share-btn-wrp > .delicious:hover{
background: url(images/share-icons.png) no-repeat -4px -136px;
width:38px;
}
.share-btn-wrp > .gplus{
background: url(images/share-icons.png) no-repeat -42px -170px;
}
.share-btn-wrp > .gplus:hover{
background: url(images/share-icons.png) no-repeat -4px -170px;
width:38px;
}
.share-btn-wrp > .email{
background: url(images/share-icons.png) no-repeat -42px -408px;
}
.share-btn-wrp > .email:hover{
background: url(images/share-icons.png) no-repeat -4px -408px;
width:38px;
}

@media all and (max-width: 699px) {
.share-btn-wrp{
width: 100%;
text-align: center;
position: fixed;
bottom: 1px;
}
.share-btn-wrp .button-wrap {
display: inline-block;
margin-left: -2px;
margin-right: -2px;
}
}

JavaScript

$(document).ready(function(){
    var pageTitle = document.title; //HTML page title
    var pageUrl = location.href; //Location of this page
$('.share-btn-wrp li').click(function(event){
var shareName = $(this).attr('class').split(' ')[0]; //get the first class name of clicked element
switch(shareName) //switch to different links based on different social name
{
case 'facebook':
OpenShareUrl('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(pageUrl) + '&title=' + encodeURIComponent(pageTitle));
break;
case 'twitter':
OpenShareUrl('http://twitter.com/home?status=' + encodeURIComponent(pageTitle + ' ' + pageUrl));
break;
case 'digg':
OpenShareUrl('http://www.digg.com/submit?phase=2&url=' + encodeURIComponent(pageUrl) + '&title=' + encodeURIComponent(pageTitle));
break;
case 'stumbleupon':
OpenShareUrl('http://www.stumbleupon.com/submit?url=' + encodeURIComponent(pageUrl) + '&title=' + encodeURIComponent(pageTitle));
break;
case 'delicious':
OpenShareUrl('http://del.icio.us/post?url=' + encodeURIComponent(pageUrl) + '&title=' + encodeURIComponent(pageTitle));
break;
case 'gplus':
OpenShareUrl('https://plus.google.com/share?url=' + encodeURIComponent(pageUrl) + '&title=' + encodeURIComponent(pageTitle));
break;
case 'email':
OpenShareUrl('mailto:?subject=' + pageTitle + '&body=Found this useful link for you : ' + pageUrl);
break;
}
});
function OpenShareUrl(openLink){
//Parameters for the Popup window
        winWidth    = 650; 
        winHeight   = 450;
        winLeft     = ($(window).width()  - winWidth)  / 2,
        winTop      = ($(window).height() - winHeight) / 2,
        winOptions   = 'width='  + winWidth  + ',height=' + winHeight + ',top='    + winTop    + ',left='   + winLeft;
        window.open(openLink,'Share This Link',winOptions); //open Popup window to share website.
        return false;
}
});


HTML

   

   

   
  • Digg it

  •    
  • Stumbleupon

  •    
  • Delicious

  •    
  • Google Share

  •    


    Truncate All tables in mysql

    Truncate all tables in mysql using one comment


    SELECT CONCAT('truncate table ',table_name,';')
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_SCHEMA = 'table_name'
    AND TABLE_TYPE = 'BASE TABLE';

    Execute the above comment it shows the truncate comment like below

    truncate table table1;
    truncate table table2;
    truncate table table3;
    truncate table table4;
    truncate table table5;

    Copy the Comment & paste to the SQL editor and run the comment....