Thursday 1 April 2021

How To Install Laravel 8 On Windows


Step 1 – Prerequisite to Install Composer On Windows

Step 2 - Open Command Prompt (Windows key + R Then write cmd and Press Enter Key)    


Step 3 - Go to WWW dir in cmd where is your Wamp dir. (Ex: D:\wamp64\www> )

Step 4 - Write below command and press Enter key. It will be take a couple of minutes for installation.

=> D:\wamp64\www> composer create-project --prefer-dist laravel/laravel laravel_demo "8.*"


Step 5
- Start Laravel Project (laravel_demo)

=> php artisan serve

Friday 5 March 2021

Add and remove a class on click using jQuery

 


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script>
jQuery(document).ready(function(){
jQuery('#btnSubmit').on('click', function() {
jQuery(this).addClass('toggle').removeClass('codepen');   
});
});
</script>

According To Question:

#jQuery add remove class onclick codepen
#Add Class jQuery
#jQuery Onclick Remove Class And Addclass
#toggle class jQuery
#Onclick Add And Remove Class To Body
#Add Class JavaScript
#jQuery Add Class On Click
#Remove Class In JavaScript
#Add Remove Class Onclick By jQuery


Saturday 20 February 2021

Change Div Order In Mobile View By jQuery

 

Web View

                             
                           Before Change              After Change 



<html>
    <head>
<title>Change Div Order In Mobile View By jQuery.</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
        <style type="text/css">
           body{
padding:20px;
   }
            #container {
                width:100%;
                margin: 0 auto;
text-align: center;
            }
.display_inline{
border: 2px solid;
width: auto;
display: inline-block;
padding: 150px 100px;
margin: 22px;
font-size: 50px;
color: #fff;
font-family: emoji;
}
#div1{
background:#1a3a5f;
}
#div2{
background:#79286c;
}
@media only screen and (max-width: 600px) {
.display_inline{
width: auto;
display: block !important;
bolder:2px solid red;
padding: 10%;
}
}
           
        </style>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
    </head>
    <body>
       
        <div id="container">
            <div id="div1" class="display_inline">
<div class="center">
Div One
                </div>
                
            </div>
            <div id="div2" class="display_inline">
<div class="center">
                    Div Two
                </div>
            </div>  
        </div>
<script type="text/javascript">
function listenWidth( ) {
if (jQuery(window).width() <= 600) {
jQuery("#div2").remove().insertBefore(jQuery("#div1"));
} else {
jQuery("#div2").remove().insertAfter(jQuery("#div1"));
}
}
jQuery(document).ready(function(){
listenWidth();
});
jQuery(window).resize(function() {
listenWidth();
});
</script>
    </body>
</html>


According To Question:

#Change Div Position In Mobile
#How To Change Div Position In Responsive
#jQuery Change Order Of Divs
#Change Order Of Divs Responsive
#Div Order Change jQuery
#jQuery Change Column Order
#Javascript Reorder Divs
#Change Div Position By jQuery


Monday 4 January 2021

Perfect Ranking With Ties Using By PHP Array

 


<?php

#Ex:  Short Set Ranking Hosting Provider Founded By Year

// INPUT

$Hosting_Years = array(

    'Bluehost' => 2003,

    'Dreamhost' => 1996,

    'Hostinger' => 2004,

    'HostGator' => 2002,

    'A2 Hosting' => 2001,

    'GreenGeeks' => 2008,

    'WP Engine' => 2010,

    'Inmotion' => 2001,

    'SiteGround' => 2004,

    'Nexcess' => 2000,

);


function setRanking($standings) {

    $rankings = array();

    arsort($standings);

    $rank = 1;

    $tie_rank = 0;

    $prev_score = -1;

    foreach ($standings as $name => $score) {

        if ($score != $prev_score) {  //this score is not a tie

            $count = 0;

            $prev_score = $score; 

            $rankings[$name] = array('score' => $score, 'rank' => $rank);

        } else { //this score is a tie

            $prev_score = $score;

            if ($count++ == 0) {

                $tie_rank = $rank - 1;

            }

            $rankings[$name] = array('score' => $score, 'rank' => $tie_rank);

        }

        $rank++;

    }

    return $rankings;

}


// OUTPUT 

$set_Host_Ranking = setRanking($Hosting_Years);

foreach($set_Host_Ranking as $host => $value){

    echo "<br> Rank: ".sprintf("%03d", $value['rank']). " &emsp; Founded in  : ".$value['score']. "&emsp; Host: ".$host;

}

?>

According To Question:

#Ranking/Position on value of array in PHP

#Rank Of An Element In An Array

#What Is Rank Of An Array

#Array Ascending Order In PHP

#PHP Sort Multidimensional Array By Value Alphabetically

#Ksort Multidimensional Array PHP

#PHP Sort Multidimensional Array By Key

Sunday 3 January 2021

Formatting A Number With Leading Zeros In PHP


<?php

#Ex:  Make 4 Digit Integer Or Zerofill An Integer In PHP

// INPUT

$start_number = 1;

$end_number = 100;

for($i=$start_number; $i <= $end_number; $i++ ){

    echo "<br> #: ".sprintf("%04d",  $i);  

}

// OUTPUT

#: 0001

#: 0002

#: 0003

#: 0004

#: 0005

#: 0006

#: 0007

#: 0008

#: 0009

#: 0010

.

.

.

#: 0100

?> 

According To Question:

#add zero after number in php

#php number format: 0001, 0002, 0003 ...

#make number 2 digit php

#php leftpad number

#php force two digit number

#php sprintf

#str_pad in php

#php left fill