Full Customized JQuery Datepicker Calender with PHP

<style type=”text/css” >
.myweekend span.ui-state-default { color: red; }

.Highlighted a{
background-color : Green !important;
background-image :none !important;
color: White !important;
font-weight:bold !important;
font-size: 12pt;
color: #2E3192;
color: #2E3192;


/* —- choice day value between 0~6 (Sunday ~ Saturday) —– */
$first_weekend = “5”; //for Friday day value is 5
$second_weekend = “6”; //for Saturday day value is 6

/* — Define All Holidays as you wish —- */
$all_holiday_dates = array(
‘0’ => ‘2015-01-04’, //4th Jan 2015 (Eid-e Miladunnabih holiday)
‘0’ => ‘2015-02-21′, //21th Feb 2015 (Shahid Dibash (Language Martyrs’ Day))
‘1’ => ‘2015-04-26’, // 26th March 2015 (BD Indipendance Day)
‘2’ => ‘2015-12-16’, // 16th December 2015 (BD Victory Day )
‘3’ => ‘2015-12-25’, // 25th December 2015 (Christmas day )

<label for=”datepicker”>Date:</label>
<input type=”text” class=”datepicker” id=”date” placeholder=”Enter Date here”>

<script src=”http://code.jquery.com/jquery-1.7.2.js”></script&gt;
<script src=”http://code.jquery.com/ui/1.8.18/jquery-ui.js”></script&gt;

<!– for weekend selector –>
<link rel=”stylesheet” href=”http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css&#8221; />


var first_weekend = “<?php echo $first_weekend;?>”;
var second_weekend = “<?php echo $second_weekend;?>”;

var array = <?php echo json_encode($all_holiday_dates)?>

$(‘#date’).datepicker({dateFormat: ‘dd/mm/yy’,firstDay: 6,
beforeShowDay: function(date){
var string = jQuery.datepicker.formatDate(‘yy-mm-dd’, date);
var weekend = date.getDay() == first_weekend || date.getDay() == second_weekend;

return [ array.indexOf(string) == -1 && !weekend, weekend ? ‘myweekend’ : ”]





Efficient way to find Date Difference in PHP

If you’re using PHP 5.3 >, this is by far the most accurate way of calculating the difference:

$date1 = new DateTime("2010-07-06");
$date2 = new DateTime("2010-07-09");

$diff = $date2->diff($date1)->format("%a");


The date_diff() function returns the difference between two DateTime objects.

Syntax: date_diff(datetime1,datetime2,absolute); $date1=date_create(“2013-03-15”); $date2=date_create(“2013-12-12”); $diff=date_diff($date1,$date2); echo $diff->format(“%R%a days”);

Removing Special Characters from uploaded file name in PHP

Uploaded file name is very vital to insert, update and retrieve media or other data. sometimes during uploading files filename contains some special characters (like $%^& etc.) which create complexity. that’s why we try to avoid special characters in our filename in the database. we can remove special characters from the uploaded filename by using a simple regular expression.

preg_replace(‘/[^a-zA-Z0-9_ -]/s’,”,$string);

If we want to keep some specific special character like “(  ) / . % – &” then we just need to change it as follows

preg_replace(‘/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s’,”,$string);    [It removes “(  ) / . % – &” from filename]


Turn Off Deprecated type Warning in PHP

sometimes in our PHP website a unwanted warning appears called “Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in D:\xampp\htdocs\opencart\system\database\mysql.php on line 7″. 

this is just a simple warning nothing so serious, so we can easily stop this type of warning from our website. To do so we need to add a Line of code to the top of the .php file like the following:


error_reporting(E_ALL ^ E_DEPRECATED);

Or just add @ in front of mysql_connect () function like this:

@mysql_connect($hostname, $username, $password);

by following these two procedure we can easily remove unwanted Deprecated type errors.

Move a WordPress website from localhost to live Server

To Host a WordPress website in the Live Server from the localhost we have frequently faced some difficulties, it occurred mainly due to our local MySQL database information. During installation of WordPress in our localhost our MySQL database saves the localhost server information like host address. so when we try to transfer our WordPress site from localhost or other server to Live Server our website doesn’t work properly. To overcome these difficulty we need to follow some procedure. let’s discuss it bellow

Firstly, we need to copy all the necessary WordPress website files (including theme and plugins) to the live server via FTP/FTPs

Secondly, export database of that WordPress site from localhost MySQL and opened it with text editor (like notepad++, sublime text 3 etc.). then replace all the paths from “http://localhost/name_of_your_site” to “http://donaim-name/

Third, after fixing the paths import that database to live sites database. now your WordPress website at live server is ready to use

Fourth, If your site returns some error like index error: paths not found then you need fix the site and home paths by going WP dashboard->setting->general settings edit two field with your server site address “WordPress Address (URL)” and “Site Address (URL)”

Or add the following two lines in the wp-cofig.php file and save it.


N.B. if you add those two lines of code in your wp-config.php file remember you can’t edit the dashboard->setting->general settings fields anymore.

Fifth, If pages and posts of the WordPress are not appears correctly or returns some error like “index error: wordpress/index.php not found” then just simply edit the .htaccess file in the WordPress home folder and fix overwrite path from “localhost_filename/index.php” to “live_server_filename/index.php”

Finally Done! enjoy your live WordPress website visiting….

Build openGL in CodeBlocks

To build openGL on CodeBlocks we should follow these little instractions

1.  Download Glut Library .zip file

2. Copy glut.h file to drive: \CodeBlocks\MinGW\include\GL folder

3. Copy glut.lib file to drive: \CodeBlocks\MinGW\lib folder

4. Copy glut,dll file to C:\Windows\System32or C:\Windows\System32 folder

then follow these steps carefully

step 1:  Open the code block you will see window as below and click on create new porject link, like this

codeblock opening page

step 2: click on GLUT project as shown in image below
click next


write project title name ,give path to save project and write projec filename will create by default from   project title name.

codeblocks  UI

After that click next.

step 3: now give the path “Drive:\CodeBlocks\MinGW” for glut location

codeblocks UI

Then click next.

codeblocks UInow enter the finish button

step 4:

codeblocks coding UI

now you see the project is created and you will get default main.cpp file don’t forget to write  “#include<windows.h>” header file otherwise you will get error now built and run it will see window as below.

codeblocks Output Window

your project is created you can write your own code.