How to fix the node-gyp Bcrypt issue on windows

Run this command:

npm install –global –production windows-build-tools

It will install require python version and required Microsoft Visual c++ version on the system which are required to compile the bcrypt library from source.


How to populate model field values in Edit form in Laravel 5.3

You have started with Laravel 5.3, and you are not using the HTML/Form Package whose examples you will find all over the internet to make CRUD functionality, you may be wondering as how to fetch the values in Edit form.

You cannot just replace the value=”{{ old(field_name) }}” since you also need the validation to show us the earlier entered values which.

Solution is to use the second parameter on old() function, so the value attribute of field becomes {{ old(field_name, $model->field_name) }} which will work in both cases. It will populate the field with initial model value and validate and fill the earlier entered value in case of failed validation.

I am assuming that you have passed the fetched model in $user variable and passed it from controller to the view.


public function getProfile()
   return view('user.edit', ['user' =>  Auth::user()]);


So, the form looks like


<form class="form-horizontal" role="form" method="POST" action="{{ route('put_profile') }}">
     <input type="hidden" name="_method" value="PUT" />
     {{ csrf_field() }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
     <label for="name" class="col-md-4 control-label">Name</label>
<div class="col-md-6">
         <input id="name" type="text" class="form-control" name="name" value="{{ old('name', $user->name) }}" autofocus>
         @if ($errors->has('name'))
            <span class="help-block">
            <strong>{{ $errors->first('name') }}</strong>
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
     <label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
          <input id="email" type="text" class="form-control" name="email" value="{{ old('email', $user->email) }}" >

          @if ($errors->has('email'))
          <span class="help-block">
               <strong>{{ $errors->first('email') }}</strong>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
     <button type="submit" class="btn btn-primary">Save</button></div>

Laravel 5.2 and Angular moustaches issues

img55c7b18b8bd2eIf you are going to use Angularjs with Laravel 5.2 framework, chances are there you will stick in moustaches issue. By Moustaches issues I mean the curly braces used as template tags in Blade template system (like ‘{{ $variablename }}’). This causes issue with Angularjs because Angular also uses curly braces for its variable replacement with model values.

So, the solution is to add ‘@’ sign before the starting braces like:

@{{ variablename }}

This will prevent blade template engine to parse these curly braces and leave it for Angularjs for its processing.

Multiple Instances of Same parameter in PDO Statement


PDO is a good initiative by PHP to use instead of mysql_(…) functions. You can bypass a lot of security risks by using prepared statements. But it has a drawback as well which seems quite foolish to me.



When you write a SQL statement to be executed after prepareing it, you replace the actual values with what we call Parameters or Params.

$sql = “Select * from course where id=:courseId”;
$dbh->execute([‘:courseId’ => 1]);

In these statements, I am writing a sql statement to select all coulmns of table course where id is a param, then prepare it for execution and then pass the value of the actual parameter that needs to be replaced on run time. Upto this point, this all makes sense and works perfectly. Things change when you have more than one instances of same param and you expect the PDO to replace these all instances for you. like:

$sql = “Select * from course where id=:courseId or related_id=:courseId”
$dbh->execute([‘:courseId’ => 1]);

in this sql statements, you are trying to fetch all the rows where either id matches or related_id matches the ‘:courseId’ param which you will provide to PDO for execution. In this scenario, you will get an error:

“Invalid parameters number”

This is quite silly as you must be assuming PDO to replace all instances with provided param value, but it does not. For this statement to work, you need to replace second instance of ‘:courseId’ to some thing like ‘:courseId2’ or any other param and then providing value for that variable.

$sql = “Select * from course where id=:courseId or related_id=:courseId2”
$dbh->execute([‘:courseId’ => 1, ‘courseId2’ => 1]);

Quite surprising, but this is how they programmed it!

Multiple attachments not going with PHPmailer v5

A bug in the PHPMailer v5 has been stopping me from sending multiple attachments in a mail. It was quite a confusing thing coz it I checked everything in my PHP code time and again. Somehow, after googling for this, i got my answer; it is actually a bug in PHPmailer v5.

This is how I recified the bug.

  1. Open the file class.phpmailer.php
  2. Goto line number 1236
  3. Change
    7=> 0
  4. Save the file and try.

Thanks for the contributors, it saved my time.

Planner 0.14.4 complete progress issue

I have been using the Planner for quite a long time. Its a very good software for Project Management and Planning. Over the time many improvements have been made in the project. The latest stable release you can find at is 0.14.4. I upgraded from 0.14.2 on my Vista Laptop. Everything is fine, however a strange thing I noted is that the complete progress of any task does not move beyond 75%. I tried on subtasks and individual tasks, but invain.

Finally, I consulted planner development team regarding this issue and Rhian Geleick guided me the temporary solution for the bug. The solution is

  1. Go to the installtaion directory of planner
    <INSTALL DIR>/share/planner/glade.
  2. Edit the file named ‘’ in this directory, in any of the text editors
  3. Goto Line number 236, and change
    <property name=”adjustment”>0 0 100 10 25 25</property>
    <property name=”adjustment”>0 0 100 10 25 0</property>
  4. Anyone using the priority field should should also change line number 257
    <property name=”adjustment”>0 0 9999 1 10 10</property>
    <property name=”adjustment”>0 0 9999 1 10 0</property>
  5. Save the file and then Check in Planner. The bug is rectified.

Thanks for the Planner Team for their timely support.

Enable mod_rewrite in apache

If you are using Windows OS and want to enable mod_rewrite module here is how to do it.
This is the general configuration guideline both for Windows and Linux server:


1. Find the httpd.conf file (usually you will find it in a folder called conf, config or something along those lines)
2. Inside the httpd.conf file uncomment the line LoadModule rewrite_module modules/ (remove the pound ‘#’ sign from in front of the line)
3. Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out.

For Windows, find the following section in httpd.conf file:

DocumentRoot "C:/path/to/my/root" 

# Each directory to which Apache has access, can be configured with respect 
# to which services and features are allowed and/or disabled in that 
# directory (and its subdirectories). 
# First, we configure the "default" to be a very restrictive set of 
# permissions. 

Now modify the option for AllowOverride to look like this:
<Directory />
Options All
AllowOverride All