Here you'll find solutions to some of the common problems you may have encountered during development as well as quick start code snippets to help you get started with popular frameworks.

Functional interface in Java

Quick example

Join without foreign key constraint in Sequelize

Sequelize is a great ORM for Express which supports not just MySQL but also PostgreSQL and SQLite. Just like any other ORM, to perform JOIN queries using models you need to first define an association between the two tables (models). This association can be hasOne, hasMany, belongsTo and so on. Now this becomes tricky if […]

Login with Google Account using PHP

In this article we’ll learn how you can let your app users login with Google Account into your PHP web application using Google PHP Client version 2. It’s assumed that you have already installed composer and are using a version of PHP greater than 5.4. To view the entire code please visit this gist. Create […]

Creating bar charts using D3

In this article you’ll learn the basics of creating charts using svg and D3. Above is what we’ll be creating by the end of this tutorial. Creating charts with just svg svg with single rect and minimal styling Before proceeding further it’s noteworthy to have a quick overview of how to create charts using svg […]

Getting all CSV files in directory and subdirectories using Python

Below is the code import os from glob import glob PATH = “/home/someuser/projects/someproject” EXT = “*.csv” all_csv_files = [file for path, subdir, files in os.walk(PATH) for file in glob(os.path.join(path, EXT))] print(all_csv_files) That’s it !! While above code is written for searching csv files recursively in directory and subdirectory; it can be used to search for […]

Cheatsheet of git commands

Get current branch git branch Above command will list out all the branches in your current working directory that you checked out. The current active branch will have a asterik mark before it. Switch to different branch Say you are working on master branch. Now you need to switch to branch named develop git checkout […]

Enable mod_rewrite in LAMP

mod_rewrite is an Apache module that allows to rewrite requested urls on the fly using rule based rewrite engine. In simple language it is the module that empowers your .htaccess file. It is not activated by default. So you’ll notice your htaccess rules won’t work on fresh install of Apache. In this tutorial we’ll see […]

Change root of apache in LAMP (Ubuntu and Debian Linux)

This tutorial is for changing root directory of apache server on Debian system like Ubuntu. When you install apache (or LAMP) by default the root directory of apache is /var/www/html. When doing development on local machine you might want to change this to some directory in your home directory. Advantage of doing this is you […]

Enable virtual hosts with self signed SSL on WAMP

Let’s say you have a website on you wamp server by name project. So there’s a directory project in your C:\wamp\www directory. Also visiting http://localhost/project on the browser takes us to your project website. Now we want to set up a virtual host with self signed SSL certificate so that we can visit our website […]

Design Patterns in PHP: Factory, Strategy and Singleton

What are design patterns Design patterns are coding strategy followed by developers. It’s just like an architectural plan followed in building houses. As per theory it can defined as “A general solution to commonly occurring problems in software design”. Instead of talking about what Design patterns are let’s have a look at some real world […]

Installing PHPUnit on Windows

Below are the steps to install PHPUnit on Windows. Irrespective of whether you are using WAMP or XAMP installation steps shall remain the same. Step I: Create a directory named bin in C drive. Step II: Now add the path C:\bin to your environment. To do this click on Windows icon and right click on […]

Cheatsheet of useful MongoDB command line commands

In this article we have listed few yet very useful and very commonly used MongoDB commands. This article is not a tutorial on MongoDB but a list of useful commands for MongoDB; so this is kind of cheatsheet of MongoDB commands. How to take backup of MongoDB database Run the below command in command prompt […]

A bootstrap compatible pagination function in PHP for database queries

This tutorial covers usage of a custom PHP function to generate paginated links for records fetched from database. This function uses HTML markup as per Bootstrap framework. It also supports adding additional query string to each paginated link.

Best practices in PHP

There has been always a fuzz about the best practices to be followed while programming in PHP. Unlike Python, PHP doesn’t add any restrictions or has any hard and fast rule for indentations. Be it naming conventions for class names or functions or be it positioning of braces; each developer follows his own standards as […]

Use gmail for your domain email

In this article we’ll learn how to configure your personal Gmail account to use your domain email address. Gmail allows adding 5 such addresses. Mails will be sent through your servers SMTP server but you’ll be able to send and receive them in Gmail.