How to add harvard referencing to Microsoft word 2010

It is very easy to add harvard referencing style to Microsoft word. Just follow my steps to do it.

Firstly, download the styles from Github as a zip. Open the zip file and extract.

Secondly, copy and paste the styles you want from the folder to your MS World style directory.

My MS Word style directory can be found in:

C:\Program Files (x86)\Microsoft Office\Office14\Bibliography\Style

I have pasted the harvard style and my folder looks like this:

Lastly, close any existing MS Word projects and Open MS Word as an administrator. Click on the References tab and Style option as shown in the Image below. That’s it, now you can choose the newly added bibliography.

Please follow and like us:

Basic Post Redirect Get (PRG) design pattern in PHP

Post/Redirect/Get (PRG) is a web development design pattern that is used by the developers to prevent unwanted form resubmissions on their software. In software engineering, the term design pattern is an existing reusable solution to an occurring problem within a given condition in software design. It is a description for how to implement the very best solution of a certain problem in the software development.  

POST is one of the most common HTTP methods.

Some other notes on POST requests:

  • POST requests are never cached
  • POST requests do not remain in the browser history
  • POST requests cannot be bookmarked
  • POST requests have no restrictions on data length
Post/Redirect/Get Design pattern solution on succesful login

Since POST requests cannot be bookmarked by the browser, we need to implement the the post / redirect / get design pattern to prevent form submission duplicates. E.g. when a users submits a form and reloads the web pages, if not implementing PRG, the form will get resubmitted resulting in unwanted behaviour.

Below is a basic script in PHP of PRG.

//store current url into a variable  
$self = htmlspecialchars($_SERVER["PHP_SELF"]);  
//if form is submitted via POST method  
if ($_POST) {  
    //303 redirect to the same page  
    header('Location: ' . $self, true, 303);  
    //exit from the current script  
Please follow and like us:

How I add an admin in WordPress in functions.php without being an admin

You can add an admin user in WordPress without being an admin. All you need to do is to add the below PHP code inside your theme’s functions.php file.

Firstly,  you need to insert the code inside the functions.php file found in  your website themes folder. You can upload the code via FTP or by accessing the Web Server directly via Cpanel.

The file functions.php is located in the following path:

You will need to edit the lines 2,3,4 of the below code with your new admin credentials. Change and save.

function wpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = '';
if ( !username_exists( $user )  && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
} }

The new user is now created. Now, I recommend to delete this code from your functions.php for security reasons.

Finally, you can login with your new admin credentials via your website login url:

Good Luck!

Please follow and like us:

How to setup Angular 6 with Node.js and create the first web app

In this tutorial i will explain how to setup angular 6 with node.js and specifically to use the  Angular cli – a command line interface to scaffold and build angular apps using nodejs style (commonJs) modules. Firstly we need to install node.js. Node.js is a runtime environment that comes with npm (node package manager). Npm manages the different dependencies an Angular project has. The below article will explain step by step the whole procedure.

  • Download and install Node.js

The very first step, if you haven’t already done before, is to download and install node.js on your computer. You can download the latest version from node.js official website. Once you have installed it, you will be able to run npm commands directly from command prompt to  install Angular cli packages

Continue reading How to setup Angular 6 with Node.js and create the first web app

Please follow and like us:

Display Names differ from Usernames in WordPress?


Do users register in your WordPress website and their profile display name is different than their registered Username? Well all you need to do is to add the below code in your functions.php file. This php code will force usernames to be the same as display names. Note that it is always recommended to write the code in the functions.php file located inside a child-theme because you will not lose any modifications you write there, even if you update your theme.


function wpse_filter_user_data( $data, $update, $id) {
  if( isset( $data[ 'user_login' ] ) ) {
    $data[ 'display_name' ] = $data[ 'user_login' ];
    return $data;
  $user = get_user_by( 'email', $data[ 'user_email' ] );
  $data[ 'display_name' ] = $user->user_login;
  return $data;
add_filter( 'wp_pre_insert_user_data', 'wpse_filter_user_data', 10, 3 );

Please follow and like us:

Using Jquery-Ajax and PHP Mail function to send emails

In this tutorial, i will show you how to make a functional html contact form using Jquery-Ajax and php using the built in php mail function. Firstly i will download the html template  from codepen. Then we need to create the JavaScript code to collect user’s data which will be asynchronously sent to php. In PHP we will setup the headers and send the email.

Step 1: Find the html template (Design)

Firstly, we need to find the html template we like. There are lots of great html contact form templates that you can download for free. Personally, in this tutorial i used Minimalistic contact form found on colorlib. You can download it from codepen. To download as zip file, you can click on the export button on the bottom right of the page. Click and choose Now we have our template ready and we are ready to proceed with the JavaScript code.

Continue reading Using Jquery-Ajax and PHP Mail function to send emails

Please follow and like us:

Php price calculation using checkboxes

Hello, in this tutorial, i will show you how to calculate price in php webpage using html checkboxes.

Step 1: Create the html form

The first thing you need to do is to create the html document and make the form with the checkboxes.

<form action="index.php" method="get">
<input name="choice[]" type="checkbox" value="1" /> Chicken, Price: 8 Euros<br/>
<input name="choice[]" type="checkbox" value="2" /> Meat, Price: 10 Euros <br/>
<input name="choice[]" type="checkbox" value="3" /> Potatoes, Price: 2.50 Euros<br/>
<input name="choice[]" type="checkbox" value="4" /> Salad, Price: 5 Euros <br/>
<input type="submit" value="order" />

The above code gives the following output:

Chicken, Price: 8 Euros
Meat, Price: 10 Euros
Potatoes, Price: 2.50 Euros
Salad, Price: 5 Euros

Step 2: Create the php code

It is required to make a new index.php  file, since the form action is set to index.php. Index.php is the file we will write the below code.

        if(isset( $_GET["choice"] ))
        $food = $_GET["choice"];
        $c = count($food);
        $price = 0.0;
            if($food[$i] == 1){
                $price = $price + 8;
                echo "You have selected chicken<br>";
            if($food[$i] == 2){
                $price = $price + 10;
                echo "You have selected meat<br>";
            if($food[$i] == 3){
                $price = $price + 2.50;
                echo "You have selected potatoes<br>";
            if($food[$i] == 4){
                $price = $price + 5;
                echo "You have selected salad<br>";
        }//end for
        echo "<br>Final Price is:" .$price. "<br>";
        }//end isset
            echo 'Please choose something!';

A complete result of this tutorial is like below:

Chicken, Price: 8 Euros
Meat, Price: 10 Euros
Potatoes, Price: 2.50 Euros
Salad, Price: 5 Euros


You can watch the video tutorial on youtube.

Please follow and like us: