neerav.mehta's blog

Switching to an older version of library while using homebrew

Homebrew is a popular package manager for OS X, one which I use extensively. Sometimes, while upgrading the libraries, it's possible that the new library fails to work and you need to switch to using the older version. This post will describe how to do that.

In my case, I upgraded the boost library from 1.59 to 1.60. The Point Cloud Library (PCL) which depends on boost started failing with this new version and hence I had to switch it back to 1.59. After some search, we found that "brew switch" will do the trick. Here is the command:

Reducing Drupal's page load times using Fastly CDN

If you have ever optimized a Drupal site, you must have heard that you should serve static assets using a Content Delivery Network (CDN). In this post, we'll go over how CDNs help in reducing page load times. We'll cover one CDN, Fastly, in detail. The reason being that in addition to caching static assets, it caches dynamic HTML content as well and since it's built on top of Varnish, it integrates with Drupal seamlessly. This post will cover the following topics:


We'll start from where we left off in the previous article on PHP Interfaces. If you haven't read it, please go and read it now, or get the free eBook on object-oriented programming from the right sidebar (below the content if you are viewing in mobile).


If you are new to object-oriented programming, you might be confused about what an Interface is and how to use it. Read this post to clear that confusion.

Interfaces solve two problems:

Dependency Injection

If you are starting to learn about Drupal 8, you must have come across a term called "Dependency Injection". If you are wondering what it means, then this is the post you should read. Through examples, you will learn why dependency injection is useful for decoupling the code as well as unit testing effectively.


In Object Oriented PHP Programming post, you learned how to create classes and objects and how to use them in your code. In this post, we'll dig a little deeper and introduce the concept of inheritance. You will understand when to use it and the benefits associated with its use. You will understand Method Overriding in PHP. You will also learn when to set the visibility of properties and methods to public, protected or private. We'll continue where we left off in the previous post.

Object Oriented PHP

I am sure that by now you must have heard that Drupal 8 is using Symfony components and is based on object-oriented programming in PHP. If you are a Drupal 7 developer, then you may not know what is object-oriented programming or fail to understand the benefits it offers. In this post, you will learn the basics of object-oriented PHP programming so that you can start developing for Drupal 8.

Configure PHPStorm to debug Drupal 8

Devel module provides dsm() and dpm() functions to output variables on the page for debugging Drupal. But if the problem is more complicated, then that's not sufficient. You can simplify debugging tremendously if you stop code execution using breakpoints and then execute the application one step at a time. All IDEs that support PHP debugging, such as Eclipse, Netbeans, PHPStorm, etc., provide the functionality to put breakpoints in the code. But it requires quite a bit of configuration to make it work.