If a class implements an interface, Then that class need to provide implementations for all the methods declared in an Interface. Consider the following code snippet.

This can be a trouble if we need to add a new method to the interface so as to extends the functionality of our Interface, as adding a new method to Interface will require all child classes of that interface to implement the new method.

So, To solve this problem default methods were introduced in java 8.

Consider following code snippet

So, In the above code snippet, we have added newMethod() as…

Java 8 introduced lambda expressions long back in 2014. Let's see how it can be used in some of the real-world scenarios.

Lambda expression is basically

  1. Anonymous function
  2. Without return type
  3. Without modifier

Lambda expression can only be used with “Functional Interface”. Any interface satisfying the following conditions can be called a “Functional Interface”

  1. Has only one abstract function
  2. Can have any number of static methods
  3. Can have any number of default methods

The interface can be validated for “Functional Interface” with “@FunctionalInterface” annotation.

@FunctionalInterfaceinterface Test{   public void m1();   default void m2(){}   public static void m3(){}}


Many a time we ran into a low storage problem on ubuntu and we start searching for disk usages using some utility like “Disk Usage Analyser”.

And you some significant disk usage by “/var/lib/snapd/snaps” directory

snaps in /var/lib/snapd/snaps folder

You can see there are multiple snaps for slack in the above screenshot.

slack_37.snap & slack_38.snap

And we don’t need slack_37.snap anymore as we already have a newer version of slack installed.

So to identify and remove such unnecessary old version of snaps we can use the following bash commands

  1. List all snaps we use
snap list — all

2. Get disabled snaps name and…

It is very common that we have to use multiple types of navigator in our project.

Consider the following flow for example

LoginFlow (Stack Navigator)
MainFlow (Bottom Navigator)
-Accounts(Stack Navigator)

We have three different navigators here. Now when a user tries to signout using signout screen we might have to navigate the user back to the SignIn screen.

Note both SignIn and SignOut screens belongs to the different navigators.


So, the above line will not work from the SignOut screen.

To solve this problem we react-navigation provides the following option

this.props.navigation.navigate(  NAVIGATOR NAME,  {},  NavigationActions.navigate({    routeName: ROUTENAME FROM THE NAVIGATOR,  }));

So in our case, we can use the following code to solve the problem

this.props.navigation.navigate(  "LoginFlow",  {},  NavigationActions.navigate({    routeName: "SignIn",  }));

It can be installed using the following command on terminal

sudo apt install phpmyadmin

You might have to run the update command before installing

sudo apt-get update

After installing PHP my admin you can access it through browser using


It might return 404 error. You have to create a soft link as follow

sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin

Detailed explanation here https://bit.ly/2DcHD8M

You might have to install mbstring extension for phpmyadmin to work

sudo apt install php-mbstring

After installing phpmyadmin on ubuntu, when you try to access it using browser http://localhost/phpmyadmin it might give 404.

The phpmyadmin is installed in ‘/usr/share/phpmyadmin’ directory. we need to link the above directory with our document root i.e ‘/var/www/html’ by default

The following command will create a soft link in ‘/var/www/html’ (Your document root might be different it has been changed by you).

sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin

There are a few steps we need to perform

  1. Install Apache
  2. Install PHP
  3. Configure “DirectoryIndex” on Apache

Installing Apache

open terminal (alt+ ctrl + t) and type the following command

sudo apt update
sudo apt install apache2

This will install an Apache web server on your machine. You can check the apache status by using the following command.

sudo service apache2 status

you should get output like following

File operations in PHP

When we consider any real world application, File management is one of the most commonly used feature. It could be saving the file uploaded by user in appropriate folder, verifying the file type and file size, changing the file permissions, resizing image etc.

Php provides file management functions which we can use to accomplish such file operations in our applications.

We will go through various file functions available in php.

Opening a file

Php ‘fopen()’function is used to open a file. It returns a file resource or a pointer to a file specified in the parameter.

Send email using PHPMailer with your Gmail account details. M

It is very common to send email in web applications. We will see how we can use PHPMailer (third party library) to send email

Create a new directory maildemo in your web server document root directory

Document root for linux based systems
Document root for mac

Open your terminal and go to the newly-created directory. We will use composer to install PHPMailer. Composer is used to manage dependencies in PHP projects. We can use PHPMailer without using composer but it is good practice to use composer whenever possible…

Youtube has a awesone feature called suggested videos, which we can find below video player on mobile devices and on the right side on desktop devices.

Suggested videos on mobile devices

Kiran Bhor

Cofounded Accunity Services (Software Consultancy Firm) and Passionate Coder at Heart. reach me at kiran@accunityservices.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store