very basic code which we use offten in our day to day development and sometime we stucked . i write those issue here with simple solution. You will get codes of html, css, javascript, jquery, json,ajax, node.js, vue.js, nuxt.js, php and Mysql
Thursday, November 16, 2017
Friday, November 10, 2017
How to get a given year is a leap year using PHP or Excel/Spreadsheet
Year 1600 was leap year but not 1700.
How to solve this output using php (solution for excel/Spreadsheet is in bottom of the page).
Here is the code.
<?php
$year = 2020;
$dBy4 = gmp_div_r($year, 4);
$answer = 'Not a Leap year';
if($dBy4 == 0) {
$dBy100 = gmp_div_r($year, 100);
$dBy400 = gmp_div_r($year, 400);
if($dBy100 == 0 && $dBy400 == 0) {
$answer = $year.' is a leap year';
}
}
// $dBy4 = gmp_div_r($year, 4);
echo $answer;
?>
Try out this Fiddle
Also here is the solution for EXCEL
Download excel/ spreadsheet
How to solve this output using php (solution for excel/Spreadsheet is in bottom of the page).
Here is the code.
<?php
$year = 2020;
$dBy4 = gmp_div_r($year, 4);
$answer = 'Not a Leap year';
if($dBy4 == 0) {
$dBy100 = gmp_div_r($year, 100);
$dBy400 = gmp_div_r($year, 400);
if($dBy100 == 0 && $dBy400 == 0) {
$answer = $year.' is a leap year';
}
}
// $dBy4 = gmp_div_r($year, 4);
echo $answer;
?>
Try out this Fiddle
Also here is the solution for EXCEL
Download excel/ spreadsheet
Monday, October 23, 2017
CallBack in JavaScript. (Simple javascript function with callback)
function abc(option, callback){
if (option == 1) {
callback // no () here
}
}
function test (){
abc(1, hello())
}
function hello(){
alert('this is hello fnc used as callback');
}
test(); // Finally call here
if (option == 1) {
callback // no () here
}
}
function test (){
abc(1, hello())
}
function hello(){
alert('this is hello fnc used as callback');
}
test(); // Finally call here
Saturday, October 14, 2017
Remove version string (.css?v=2.0.1) from any css and javascript url in wordPress
Here is the code
// Remove query string from static files
function removeJsCssVersionString( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'removeJsCssVersionString', 10, 2 );
add_filter( 'script_loader_src', 'removeJsCssVersionString', 10, 2 );
// Remove query string from static files
function removeJsCssVersionString( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'removeJsCssVersionString', 10, 2 );
add_filter( 'script_loader_src', 'removeJsCssVersionString', 10, 2 );
Sunday, October 1, 2017
[ VueJs Solutions ] - How to remove # in url (Vue 2.0) ?
Problem - http://localhost:8080/about#/
Step to solve this issue-
1. Open YourProjectDirectory/src/router/index.js
2. place this code below above routes: [
mode: 'history',
sample code-
Vue.use(Router)
export default new Router({
mode: 'history',
routes: [
{
path: '/#',
name: 'Hello',
component: Hello
},
{
path: '/about',
name: 'about',
component: about
}
]
})
You want solution like this
Step to solve this issue-
1. Open YourProjectDirectory/src/router/index.js
2. place this code below above routes: [
mode: 'history',
sample code-
Vue.use(Router)
export default new Router({
mode: 'history',
routes: [
{
path: '/#',
name: 'Hello',
component: Hello
},
{
path: '/about',
name: 'about',
component: about
}
]
})
Thursday, April 20, 2017
How to clone IIS apppool and all website for another machine using command line
If you are working in IIS server. you have many websites listed under INSUPLTDVSG.
Suddenly you want same site setting on another laptop.
What you we do...
manual work.... no no...no...
Let me give you a quick solution.
Follow these step.
Step 1. (Perform on the main machine)
1st you have to take backup of all settings such as apppool and websites.
Open Command Prompt and run this command
---------------------------------
In D:/ drive, you will get two file. catch this file and sent it to another machine.
Step 2 ( (Perform on the another machine)
Now it's time to import all data so run this command
----------------------------
Now if your site https:// then you have to make self-sign-certificate. you have to make a certificate,.. once done then bind it with your site.
So, How will do that.
Let's run this command
appcmd set site /site.name:"myapp.com" /+bindings.[protocol='https',bindingInformation='*:443:myapp.com']
run this command as many time as your have sites.
-----------------------------------------------------------------
I am hoping that this article will help you. However, if you got stuck and need additional help, please write a comment below.
Suddenly you want same site setting on another laptop.
What you we do...
manual work.... no no...no...
Let me give you a quick solution.
Follow these step.
Step 1. (Perform on the main machine)
1st you have to take backup of all settings such as apppool and websites.
Open Command Prompt and run this command
%windir%\system32\inetsrv\appcmd list apppool /config /xml > d:\apppools.xml
%windir%\system32\inetsrv\appcmd list site /config /xml > d:\websites.xml
%windir%\system32\inetsrv\appcmd list site /config /xml > d:\websites.xml
---------------------------------
In D:/ drive, you will get two file. catch this file and sent it to another machine.
Step 2 ( (Perform on the another machine)
Now it's time to import all data so run this command
%windir%\system32\inetsrv\appcmd add apppool /in < d:\apppools.xml
%windir%\system32\inetsrv\appcmd add site /in < d:\websites.xml
%windir%\system32\inetsrv\appcmd add site /in < d:\websites.xml
----------------------------
Now if your site https:// then you have to make self-sign-certificate. you have to make a certificate,.. once done then bind it with your site.
So, How will do that.
Let's run this command
appcmd set site /site.name:"myapp.com" /+bindings.[protocol='https',bindingInformation='*:443:myapp.com']
run this command as many time as your have sites.
-----------------------------------------------------------------
I am hoping that this article will help you. However, if you got stuck and need additional help, please write a comment below.
How to send ANSI corrector in mail subject using mail function in PHP
Let's say your subject is - "Cómo estás" (that mean - cómo estás )
if you will send this subject then it will not show properly in an email.
So how to solve this issue-:
if you will send this subject then it will not show properly in an email.
So how to solve this issue-:
$subject = "cómo estás";
mail($to, '=?utf-8?B?'.base64_encode($subject).'?=', $body, $headers);
------------
if this code doesn't work for you then le tme know. I Have another solution too. :-)
Sunday, January 29, 2017
[Resolved] How to cancel all sent friendship request on Facebook at one click
Cancel all pending Friendship Request in 30 second. Just in one click.
Step-: 01 Click on Below Link
Step-: 01 Click on Below Link
https://m.facebook.com/friends/center/requests/outgoing/#friends_center_main
Step -: 02 Right click on page and select inspect
Step -: 03 Paste below code in console and then hit enter. (wait few second to complete the request)
javascript:var inputs = document.getElementsByClassName('_54k8 _56bs _56bt');
for(var i=0; i<inputs.length;i++) {
inputs[i].click();
}
Labels:
cancel facebook request,
facebook,
friendship,
internet
Sunday, January 1, 2017
How to set custom comment limit for textarea like twitter
Subscribe to:
Posts (Atom)