Streams in JAVA

Streams in Java

In this post, we are going to discuss about: what streams are in context of CS their support in Java lazy evaluation in streams how to create finite and infinite streams how streams along with functions help in writing declarative code Stream by definition is a sequence of data which can be finite or infinite. Wikipedia: Stream is a sequence of data elements made available overtime. A Stream can be thought of as items on conveyer belt being processed one at a time rather than in batches....

June 12, 2020 · 7 min · Vivek Bhadauria

Tinkering with Xms in JVM

In this post, I am going to share my observation after playing with Xms parameter in JVM on different Operating Systems. Initially, my understanding of Xms was that Xms is the minimum heap space the JVM should get before starting the Java process, if this much main memory (RAM) isn’t available then program should not start. So I wrote a simple program which just outputs a String. // Simple program that I ran with different Xms values public class Test { public static void main(String[] args) { System....

May 9, 2020 · 3 min · Vivek Bhadauria

Add BasicAuth in SparkJava Webapp

In this post, I am going to show you how to add Basic Authentication to your SparkJava webapp in Kotlin. Spark Java : Its a micro-framework for creating web applications in Kotlin and Java 8 with minimal effort. Basic Authentication : Its simply an Authorization header whose value is Basic base64encode(usename:password) So if username and password is admin and admin. Base64 encoding of admin:admin is YWRtaW46YWRtaW4= Value of header will be...

September 25, 2019 · 2 min · Vivek Bhadauria

Mocking with Mockito

This is going to be a short post about an issue that I faced in my office project. Context: I was working on a project that generates an output file based on the data that is read by some input files. Now the size of the input files can vary and in my case, it went up to 50GB. So when the program was executing on the cloud environment (will call ENV further in post), there wasn’t enough space left in the PVC (Persistant Volume Claim) for this file and the program crashed due to full PVC....

July 19, 2019 · 3 min · Vivek Bhadauria

Use Psiphon on Mac OS And Linux

Psiphon is a tool that gives you uncensored access to internet content. Currently Psiphon is available for Android, iOS and Windows. This post will take you through steps to get uncensored access to internet content on you Mac and Linux machines. NOTE : You need an Android Device as we will be routing traffic from MAC and Linux machines to the Android device. Download Psiphon App on your Android Device Go to Play Store and install Psiphon app....

November 18, 2018 · 4 min · Vivek Bhadauria

Using iText To Edit PDF In Android

In this article, we are going to learn how to integrate and use iText library to edit PDFs in Android. You app idea might require you to create or edit PDF as an intermediate or final step. iText is the best library to create or edit PDFs. Integrate iText in your Project Adding iText is similar to adding any other library/dependency in your android project. Add statement below in you app....

August 13, 2018 · 3 min · Vivek Bhadauria

Uploading, Processing and Downloading Files in Flask

In this article, we are going to learn how to handle files from server i.e how to facilitate uploading and download for files in Flask. This is quite a common requirement for webapps nowadays. Some examples are : All the image editing sites online require uploading of image, then process them online and provide processed image for downloading. Sites that allow users to edit pdf online require uploading, processing and allowing users to download processed file....

April 7, 2018 · 6 min · Vivek Bhadauria

FFmpeg : Automate Filtering and Editing Videos

Hello again, I am a huge fan of anime, (Dragon Ball and Naruto) in particular. I saw some channels uploading Anime videos bypassing YouTube’s copyright detection. So I looked on the ways and mostly involved some video editing software and you have to invest a lot of your time. So I wanted to automate the process that takes in input as a Video and modifies its properties so that it would bypass YouTube’s Copyright detection and quality of video should still be watchable....

December 8, 2017 · 3 min · Vivek Bhadauria

How Snapchat detects when screenshot is taken (Hypothesis)

While my friend was playing “That Level Again” game he mentioned there was a level in between when he had to take screenshot of Game Screen to pass that level (Weird right!). As I know a little bit about Mobile Development I thought they might be having some special permission to do so. To be sure I went ahead and asked to see all the permissions that game app was taking and it was just taking READ_STORAGE_SPACE permission....

November 10, 2017 · 3 min · Vivek Bhadauria

GSOC - 17 Pocket Science Lab : FOSSASIA

This is a little late for this post but anyways I drafted it during the GSOC-17 only, so I am posting it with some modification. My proposal for FOSSASIA PSLab was selected. Title : Develop an Android Science App for PSLab Experiments. A brief intro about Pocket Science Lab, its an Open Source Hardware Device which provides a lot of functionality that is required to perform a general scientific experiment. You can do a lot of other activities like monitoring motion using MPU6050 sensor by the add-on sensors which the device support....

October 29, 2017 · 3 min · Vivek Bhadauria