Sign in

Tech Enthusiast | Undergraduate | Blogger
Photo by Florian van Duyn on Unsplash

When building a web application, one of the most challenging things is inserting images using input boxes and cropping them according to a given aspect ratio. So by reading this article, you can solve these troubles mentioned above when developing a web project. Let’s get started.🎊

STEP 1: Create a React JS application

You’ll need to have Node >= 10.16 and npm >= 5.6 on your machine, to create a react project.

Use the below commands to create a react application in your favorite IDE and run.

Select the application name as you preferred. npx create-react-app <application-name>

npx create-react-app image-crop
cd image-crop
npm start

I am using…

“A lot of problems we face in life, be it business, finance, including logistics, container ship loading, aircraft loading -these are all knapsack problems,” — Carsten Murawski

Photo by Jeremy Bishop on Unsplash

What is Dynamic Programming?

In this article, I am going to discuss solving knapsack problems using dynamic programming. Dynamic Programming is a method for solving some types of problems in polynomial time.

Dynamic Programming solutions are faster than the exponential brute process such as recursion, and their correctness can be easily demonstrated. Before we can learn how to think dynamically about a problem, we must first understand:

  1. Overlapping Subproblems
  2. Optimal Substructure Property

If you are not familiar…

Browsers can store key-value pairs in a better way than using cookies.

Photo by Andrew Neel on Unsplash

In this article, I am going to discuss HTML web storage that is used in Web browsers. Let’s dive into the explanation.

What are cookies?


Browser cookies are identified and read by “key-value” pairs. These tell cookies where to be sent and what data to recall. Cookies are stored in web browsers that contain users’ information, and they can store the user’s browsing activity, such as user’s details that entered through form fields and payment information.

There are two types of cookies that are more important.

• Persistence cookie

This cookie…

Understanding the greedy algorithm

Photo by Red Zeppelin on Unsplash

Let’s think of an array of stick-lengths, find which three sticks form a non-degenerate triangle such that:

  • the triangle has a maximum perimeter
  • if there are two or more combinations with the same value of maximum perimeter, output the one with the longest side.
  • Output -1 if not possible

Are you confused about the non-degenerate triangle?

If a, b and c are the sides of the triangle, and if the following 3 conditions are true, then it is a non-degenerate triangle.

Basics of Model-View-Controller Architecture

Photo by Paul Skorupskas on Unsplash

What is MVC architecture?

The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components is built to handle specific development aspects of an application. MVC is one of the most frequently used industry-standard web development frameworks to create scalable and extensible projects.

Photo by Derzulya Zaza on Unsplash

A stack is an abstract data type that consists of a predefined capacity. It allows adding and removing elements in a particular order. When every time an element is added, it goes to the top of the stack. Stack enables all data to operations at one end only. So the only element that can be removed is the element at the top of the stack, and only one item can be read or removed at a given time.

The above feature makes it a LIFO (Last-In-First-Out) data structure. Here, the element which is inserted last is accessed first. In stack…

Photo by Kai Wenzel on Unsplash

Google Sign-In, simplifying your integration with Google APIs. A user has the option of revoking access at any time to an application. OAuth was developed as an authentication protocol, so the result of any OAuth flow is that the app obtains an access token. Something about the user’s account can be got or modified. On its own, the permission token says nothing about but who the user is.

In this article, I will discuss how to complete an essential integration with Google Sign-In with Node JS and Passport JS.

Initializing a NodeJS Project

To begin with, let’s create an Express Application. Create a new…

Flutter is a new Open Source framework created by Google that focuses on the creation of cross-platform applications. Flutter primarily targets iOS and Android but is increasingly adding support for desktop platforms too.

Photo by Denis Cherkashin on Unsplash

In this article, I am going to discuss the most useful Widgets that we need when we are going to develop a flutter application.

  1. AppBar class
  2. Scaffold class
  3. Container class

1. AppBar class

AppBar is usually the topmost component of the app (or sometimes the bottom-most), it contains the toolbar and some other common action buttons. All the components in a flutter application is a widget or a combination of…

One of the main reasons to use threads in Java is to make a task run parallel to another task.

Photo by Alex Palmer on Unsplash

Why we use Threads in Java?

We use Threads to make Java applications faster by doing multiple things at the same time. In technical terms, Thread helps us to achieve parallelism in Java programs. Since the CPU is high-speed and it even contains multiple cores, just one Thread cannot take advantage of all the cores. This means our costly hardware will remain idle for most of the time.

Using multiple threads, we can take full advantage of multiple cores by serving more clients and serving them…

The Map interface is not a subtype of the Collection Interface. Therefore it behaves a bit differently from the rest of the collection types.

Photo by Dariusz Sankowski on Unsplash

In my previous article, we discussed Java lists, queues, and sets in the Java Collection Interface. If you are not familiar with lists, queues, and sets. Let’s dive into Java Map Interface.

What is the Java Map Interface?

The Map interface is present in java.util package and represents a mapping between a key and a value. The Map interface is not a subtype of the Collection Interface. Therefore it behaves a bit differently from the rest of the collection types.

A Map…

Pulsara Sandeepa

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