Thursday, 20 September 2018

How to modify MySQL database configuration in AWS RDS


This decade is too fast then expected by technology leaders. So, let's come to the main point without talking unnecessary thinks.
In this article, I explaining how to modify MySql parameters while you are using AWS RDS (Relational Database Service) for MySql Database.I write this post after fixing an error of "MySql 'max_allowed_packet' bytes error during import database" but you can do anything with MySql database configuration parameters after reading this post. Let's start step by step how to fix this and many more things.
After reviewing this article I understand what I have to do and how.
Here are the following steps.
  1. Go to RDS page and click on "Parameter groups" text located in the left navigation.
    CEHag.png
  2. Now create a new group by clicking on "Create parameter group" orange button.
    yHg2I.png
  3. Fillup parameter group form "Parameter group family" should be MySql version of your RDS instance than "Group name" and "Description" whatever you want.
    O1FWD.png
  4. New "Parameter group" was created as "test" now edit it and increase "max-allowed-packet" by entering "10000000" (10 MB) value should be in Bytes after entering value don't forgot to click on "Save changes" button and make sure value is between 1024 Bytes to 1073741824 Bytes (1073 MB)
    279Bx.png
  5. Now you can see your changes by click on "Preview changes" button.
  6. Now we have to change the "Parameter group" in our RDS instance. SO, modify an instance and select "Parameter groups" which we created.
    TXLlR.png
  7. Now after modifying RDS instance, you should Reboot it to apply your changes.

Read on StackOverflow


It's an output of research and self-motivation to learn something new and make development like Music.😃

Friday, 16 September 2016

How to calculate the difference between two dates using PHP




function DateDiff($startDate, $endDate) {
        
    $startDate = strtotime($startDate);
    $endDate = strtotime($endDate);

    if ($startDate === false || $startDate < 0 || $endDate === false || $endDate < 0 || $startDate > $endDate){
        return false;
    }

    $years = date('Y', $endDate) - date('Y', $startDate);

    $endMonth = date('m', $endDate);
    $startMonth = date('m', $startDate);

    /*** Calculate months ***/
    $months = $endMonth - $startMonth;
    if ($months <= 0) {
        $months += 12;
        $years--;
    }

    if ($years < 0){
        return false;
    }

    /*** Calculate the days  ***/
    $offsets = array();
    if ($years > 0){
        $offsets[] = $years . (($years == 1) ? ' year' : ' years');
    }
    if ($months > 0){
        $offsets[] = $months . (($months == 1) ? ' month' : ' months');
    }
    $offsets = count($offsets) > 0 ? '+' . implode(' ', $offsets) : 'now';

    $days = $endDate - strtotime($offsets, $startDate);
    $days = date('z', $days);

    return array($years, $months, $days);
}

Saturday, 21 May 2016

Hwo to install NodeJS In Ubuntu



Quick video showing you how to setup Node.js with ExpressJs and NPM in Ubuntu in just a few minutes.

Tuesday, 1 December 2015

Ajax file upload with progress Bar

$("form#imageuploadform").on("submit", function (e) {

    var formData = new FormData($(this)[0]);    
    var timestamp = $("form#imageuploadform input#timestamp").val();
    $.ajax({
        url: shr_ajax.ajaxurl,        
        type: 'POST',        
        enctype: 'multipart/form-data',        
        data: formData,
        dataType: "json",
        xhr: function () {
            var myXhr = $.ajaxSettings.xhr();
            if (myXhr.upload) {
                myXhr.upload.addEventListener('progress', progress, false);
            }
                return myXhr;
        },
        cache: false,
        contentType: false,
        processData: false,
        success: function (data) {

            if (data.id == timestamp && data.success === true) {
                alert(data.message);
                $("#import_user_csv").removeAttr("disabled");
                $("#import_user_data_form").css("opacity", "1"); 
           }
            if (data.id == timestamp && data.success === false) {
                alert(data.message);
            }
            $('form#imageuploadform')[0].reset();
        }, 
       error: function (data) {
            console.log(data);
            $('form#imageuploadform')[0].reset();
        }
    });
    e.preventDefault();
});

function progress(e) {

    if (e.lengthComputable) {
        var max = e.total;        var current = e.loaded;
        var Percentage = (current * 100) / max;
        var percent_upload = Math.round(Percentage);
        console.log(percent_upload);
        jQuery("#percent_upload").css("width", percent_upload + "%");
        jQuery("#percent_upload").text(percent_upload + "%");
        if (Percentage >= 100) {
            //alert("Uploading finish.");
        }
    }

}

Sunday, 28 June 2015

Media Queries for Standard Resolutions

/* mobile*/
@media (max-width: 320px) { }


/*Smartphones*/
@media (max-width: 480px) { }


/* Smartphones to Tablets */
@media (min-width: 481px) and (max-width: 767px) { }


/* Tablets */
@media (min-width: 768px) and (max-width: 959px) { }


/* Desktop */
@media (min-width: 960px) and (max-width: 1199px) { }


/* Desktop */
@media (min-width: 1200px) { }

Saturday, 2 May 2015

How do i remove a pre exising customizer setting in wordpress theme



add_action( 'customize_register', 'ruth_sherman_theme_customize_register' );
function ruth_sherman_theme_customize_register( $wp_customize ) {

$wp_customize->remove_control('header_image');
$wp_customize->remove_panel('widgets');

$wp_customize->remove_section('colors');
$wp_customize->remove_section('background_image');
$wp_customize->remove_section('static_front_page');

}

Monday, 9 February 2015

jquery parallax background image

$(document).ready(function(jQuery) {

    $('.my_testimonial').each(function($) {

// assigning the object
var bgobj = jQuery(".my_testimonial");

        jQuery(window).scroll(function($){

            var sco_top = jQuery(window).scrollTop();
            var yPos = -(sco_top / 1.7);

            // Put together our final background position
            var coords = '50% ' + yPos + 'px';
            console.log(coords);

            // Move the background
            jQuery(".my_testimonial").css("backgroundPosition", coords);

        });
    });

});