News Articles java

Web Sockets v/s HTTPS

HTTP and Web Socket both are communication protocols used in client-server communication. HTTP/HTTPS: HTTP is essentially a request/response protocol in the client-server computing model, and the primary communication mode of the World Wide Web. The HTTP protocol is unidirectional protocol works on the top of TCP protocol which is a connection-oriented transport layer protocol, we […]

Find Duplicate String and Letters from a Given string – Java(Collections)

** Program to find Duplicate String and Letters from a Given string – Java(Collections) ** package Test; import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.Set; public class Program1 { public static void findDuplicateWords(String str) { // 1. Split the String – String Array formation String[] s = str.split(” “); // 2. Crate a HashMap to […]

Spring Boot REST API authentication best practices using JWT (2022)

1. Overview In this tutorial I will explain how you can implement production ready, token based REST API authentication using JWT (JSON Web Tokens). Further we will use these tokens to identify our acting user in a HTTP request to our API. For this tutorial we will use MongoDB to persist our user data, you […]

What is this “Polymorphism”? — The A-Z easy explanation you might be looking for

What is this “Polymorphism”? — The A-Z easy explanation you might be looking for We all have learned about the word “Polymorphism”, maybe in academic life or in professional life. Though the word seems tough to spell, the concept is really easy to understand. The theory in the book or even on the internet this concept is explained […]

How to pass text as input in a POST request body with Jax-RS

Use MediaType.TEXT_PLAIN in the @Consumes annotation and then you have access to the text content as string @POST @Path(“organisation”) @Consumes(MediaType.TEXT_PLAIN) @ApiOperation(value = “Create bookmark from text”) @ApiResponses({ @ApiResponse(code = 201, message = “Bookmark successfully created.”, response = Bookmark.class), @ApiResponse(code = 403, message = “Forbidden”) }) public Response createBookmark(@ApiParam(“Bookmark”) String boookmark, @Context UriInfo uriInfo) throws JAXBException […]

100 Languages Speedrun: Episode 57: Scala

Scala is one of the JVM languages trying to dethrone Java. Currently Kotlin is leading this race by a lot, but Scala, Clojure, and Groovy are all quite popular, with JRuby being somewhat behind them in the race. This post is about Scala 2. Scala 3 is currently being developed, which plans to make fundamental […]

Striver's SDE Sheet Journey – #15 Majority Element (>N/2 times)

Problem Statement :- Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array. Example Input : nums = [2,2,1,1,1,2,2] Result : 2 Solution 1 using sorting,we can easily […]

How To Send Multiple SMS With Twilio in Spring Boot

Building an SMS alert system in Java Continue reading on Level Up Coding » Source: Level Up Coding

A Guide to writing to better comments

Introduction You’re probably thinking,” what’s new with comments?” and you’ll be right to think that. Often times, not much thought is put into writing a comment. They are mostly ignored and considered secondary(albeit as they should be) but this negligence has led many programmers into writing very awful comments. for example: In order to avoid […]

You're running untrusted code!

Last December, Log4Shell shortened the nights of many people in the JVM world. Worse, using the earthquake analogy caused many aftershocks after the initial quake. I immediately made the connection between Log4Shell and the Security Manager. At first, I didn’t want to write about it, but I’ve received requests to do so, and I couldn’t […]

java traditional method to remove duplicate String

I just saw a post in dev someone solved same problem using collections in java. so i thought let me try the same problem to solve in traditional way` public class Main { public static void main(String[] args) { String s=”abbvcddgtttt”; char c[]=s.toCharArray(); char cc[]=new char[c.length]; int index=0; char same=’ ‘; for(int i=0;i<c.length;i++) { for(int […]

Remove Duplicate Characters from given string(Java)

Program to print to Remove Duplicate Characters from given string package InterviewPrograms; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; public class RemoveDuplicateFromString { public static void main(String[] args) { String str = “abbaaca”; char y[] = str.toCharArray(); int size = y.length; Map<Character, Integer> map = new LinkedHashMap<>(); int i = 0; while (i != size) { […]

Reverse Each word in a String

Program to Reverse each word in String package InterviewPrograms; import java.util.Scanner; public class ReverseEachWord { // Method 01 public static String revWordsOfString(String str) { // s1.Split the String with whitespace String[] words = str.split(” “); // s2. Using for each loop read each word and reverse it String revstr = “”; for (String w : […]

Reverse of a String

Write a program to Reverse a String package InterviewPrograms; import java.util.Scanner; public class ReverseString { private static String reveresedString = “”; //Method 01 – Using String methods public static String revString(String str) { int len = str.length(); for (int i = len – 1; i >= 0; i–) { reveresedString += str.charAt(i); } return reveresedString; […]

Bubble sort explained to a 6-year-old kid

You’re a programmer, right? But do you rally think like programmers (or computer scientists) do? When going for job interviews, you’re likely to meet data structure and algorithm questions. This helps companies make sure they hire a systematic problem solver developer. In this shot, I want you to learn more about one of the simplest […]

Build a social network app with ReactJS, Spring Boot and MongoDB

I have developed a small social network web app for educational purpose and want to share this with the community. This app is built with ReactJS for frontend, Java Spring Boot for backend and MongoDB as the database. The app tries to mimic a few functions of Twitter, including: Create post with text and image […]

Will a couple of line markers in IDE make your microservice code mode readable?

Writing microservices has never been easy and does not become easier with growing codebases. All the complexity strives from tons of interactions between the moving parts of your applications. And then we had this year’s holidays and I had enough free time to think about it. Many complex measures can be used to make the […]

Java vs JavaScript | Detailed comparison | All-time-dev

Introduction Today we are going to compare Java and JavaScript. All the points of the post are well-detailed and got covered from Google and other websites. So, if you like posts like this and want to read more posts like this then you can visit our blog and don’t forget to share our post on […]

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.