teleren/devto huggingface dataset:
Unearthing Security issues in web apps Part-1
Published: 2020-11-20 07:35:07

Security is the most important area which many application developer’s and its management never invest on.
Here is my story how did I find security issues effortlessly and got awarded with huge bounty.
Jazz Cinemas-Avengers-EndGame IMAX
Jazz Cinemas are the biggest Cinema Theatre Company in India. Where I was able to purchase 3 thousand Rupees worth movie tickets, cold beverages and snacks for me and my friends for just One Rupee. Yes you heard it right.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bwphkbrbp06daudh4xlu.png)

The hacking technique was simple. I just intercepted the movie ticket cart Purchase call with the help of BurpSuite Community Edition app and modified the amount with Just one rupee for the movie Avengers-EndGame IMAX.
Tada!! The Purchase was successful. I was not sure if there will be a manual check at the Theatre, but there is none. Myself with my friends were able to go to the movie theatre with the hack produced ticket and even at the interval time we received our beverages and snacks.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/x7dolhl7cx3iomeuwi01.png)

They didn’t find anything suspicious or the manual check even after 10 days of the Incident. Of-course what to expect from a corporate and the vulnerable IT team. But its time to be honest with the victims. I mailed them the vulnerability details and acknowledged the issue. Felt Proud!
Cloud Service Performance Improvement
Published: 2020-11-20 07:33:43

I have successfully completed more than dozens of Performance improvement operations in my apps hosted in Cloud. The recent encounter was very important one and I have set a significant milestone improvement.
Tech Spec: Java, Spring Boot, MySql, Redis, Kafka, AWS.
Let me jump into the details of what I have accomplished and how.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gcarlac4lgvyhp78vaup.png)

The Great Issue:
Customers in an entire Data Center started facing slowness occasionally. The slowness issue started piling up over a period of time. In one fine day, all of a sudden we received lots of reports from customers.
Solution:
Phase #1: (Quick & Immediate Solution)
To the rescue I volunteered the operation to lead and work in field. Application server logs are just fine, except some locks timeout logged here and there. I came up with the idea of increasing the lock time bit more, with below configuration.
innodb_lock_wait_timeout=500
which was 5 seconds of waiting time for the lock to release and acquire it.
Good News!! The issues was temporarily solved. I knew it was not the permanent or Optimized solution. I started digging where is the real issue lies in code. In the Purchase Order (Module A) module flow, we have an option to create payments from bulk PO (Module A). The action dries up the MySql Thread Pool high by repeatedly calling DB read operations for the same Process Order (Module B) resources.
With patience and Step by Step debugging I was able to find and reproduce the issue and I had planned for the fix. Caching to the Rescue.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xudbtex25fohp1hqvn64.png)

Phase #2:
With the help of simple HashMap to maintain the Process order (Module B) id and its associated objects. I was able to drastically reduce the unnecessary DB hits depends on the number of objects selected in bulk operation.
Guess What!! I saved the day. That’s what I thought when I realized the local cache didn’t fully solved the issue, when the users’ of an org distributed and pursuing the operation. Thankfully I was able to identify the issue before shipping the solution to Production by implementing the solution with Redis.
Phase #3: (Final Solution)
Extracted the Purchase Order (Module A) and Process Order (Module B) handling code from the Monolithic Financial Application System to a separate Micro-Service.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mi1pnkdqdcckd4o1d5lf.png)

Have done end-to-end configuration from DB, Distributed Caching, AWS instance, BitBucket Code repo for the new PO (Module A & B)microservice.
Hurray! Its up and live. Tiny ideas, hard-work and well planned execution yields more than 70% of time Saving in Latency.
Results:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/d846sgjk4iv0luu9mu1v.png)

Happy Coding!!
— Ashok Chakravarthi
What do you love most about coding?
Tags: discuss, javascript, beginners, watercooler
Published: 2020-11-20 06:40:59

# Introduction

![Coding](https://dev-to-uploads.s3.amazonaws.com/i/oi2rwsde00xo9ou6jwsl.gif)

Programming is one of the most exciting as well as sometimes stressful job to do. Despite many failures, we are still here to do more coding. We love to code and make our ideas come into life. So let's discuss "What you most loved about coding?".

# My Experience

I am exposed to coding since  4 years but recently I started giving more time to coding and developing different programs. In this process, I learned many things about coding. 
I love coding because
- We can build anything
- It helps to improve problem-solving skills
- It challenges our brain to think critically as well as out of the box.

# Discuss
- What you loved most about coding and why?
What's your experience with TailwindCSS?
Tags: watercooler, css, tailwindcss, ui
Published: 2020-11-20 06:39:52

---
title: What's your experience with TailwindCSS?
published: true
description: 
tags: watercooler, css, tailwind, ui
cover_image: https://snipcart.com/media/205228/tailwindcss-tutorial.png
---
TailwindCSS has been around for a while (first alpha release back in November 2017) and certainly has got a lot of traction in the front-end scene since then. A couple of days ago v2.0 got released.

Have you built any projects with TailwindCSS? Maybe you even use it daily as your main styling option? Or for you, it has always been just-another-framework not worth being taken too seriously?
Best Resources to Learn Machine Learning Online in 2021
Tags: machinelearning, datascience, career
Published: 2020-11-20 06:39:49

Machine Learning is very powerful and popular. Many people are shifting their careers into the Machine learning field. But when it comes to learning machine learning, most of us stuck and don’t know where to learn. That’s why I thought to collect and combine all the **best resources(courses,books, tutorials, & YouTube Videos) to learn machine learning online.**


So give your few minutes and find out the best resources to learn machine learning. You can bookmark this article so that you can refer to this article later.

##**Resources to Learn ML-**

For your convenience, I have created separate tables for each resources. So let’s start with online courses-
[Click to continue reading...](https://www.mltut.com/best-resources-to-learn-machine-learning-online/#resources-to-learn-ml)
What's your fav SSR framework: Next, Nuxt, Nest or Sapper?
Tags: discuss, ssr, nextjs, nuxt
Published: 2020-11-20 06:38:37

---
title: What's your fav SSR framework: Next, Nuxt, Nest or Sapper?
published: true
description: 
tags: discuss, ssr, next, nuxt
cover_image: https://miro.medium.com/max/2560/1*EBMCZQwnQA4zfoitTgYzpg.png
---
Next, Nuxt and Nest are server-side rendering frameworks, based on React, Vue and Angular. There is also Sapper, a new tool based on Svelte.

So far I've tried just Next, and I loved it. And as much as I love Svelte (especially for smaller apps), I'm not sure I want to try Sapper, as it is still in early development and experimental.

What SSR frameworks have you tried and which one did you like best?
C# 9.0 Value-based Equality
Tags: csharp, programming
Published: 2020-11-20 06:16:10

`Object` class comes with two static methods, `Equals` and `ReferenceEquals`. `record` overrides this to check the equality of values one by one recursively. That means even if for two different `record` objects having same set of properties and the values will be equal. 

```csharp
public record Employee
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
}
```
For two different objects with different property values,

```csharp
//A developer
var developer = new Employee() { FirstName = "Wriju", LastName = "Ghosh" };
//an intern
var juniordev = developer with { FirstName = "Wrishika" };

Console.WriteLine("First Name is different");
Console.WriteLine("=======================");
Console.WriteLine("Reference Equal : {0}",ReferenceEquals(developer, juniordev)); //False
Console.WriteLine("Equals : {0}",Equals(developer, juniordev)); //False
```

If we create one more record with same property value,
```csharp
//Junior dev gets a promotion and name changed and matches with the senior dev
var seniordev = juniordev with { FirstName = "Wriju" };
Console.WriteLine("First Name is same");
Console.WriteLine("=======================");
Console.WriteLine("Reference Equal : {0}", ReferenceEquals(developer, seniordev)); //False
Console.WriteLine("Equals : {0}", Equals(developer, seniordev)); //True

```
GitHub README for easy to understand code
Tags: github, opensource, csharp
Published: 2020-11-20 05:51:42

One of the things I really love is a good readme file. Finding a decent readme file with great documentation makes things so much easier.

On a few of my [Live Streams](https://www.twitch.tv/videos/751410803), I took the time out to go through some of my repos and add Readme Files. Adding good information to your repo not only reminds you what it is, but also gives the community all the information they need.

{% github mishmanners/unity-project %}

## Good Readme files

A good Readme file should contain a few things. Firstly it should say what the repository is. Why does that repository exist? What is the project? What can you do with it?

If it's an open source project then there's a few other things you'll want to include. Ensure you have a good guide on how to contribute and what you're looking for in your  contributors. Help first timers (either to your project or to open source) understand what they need to do to be part of your community.

Do you have a Discord? Or other community platform? Add those in the Readme. Add a link to your website, testimonials, social media, etc. Remember, if you're running an open source project, then the Readme file is one of the first things your community will see. You want to make them feel welcomed and informed.

## Readme Profiles

Did you know you can now create Readmes for your GitHub Profile too? This was launched as [GitHub Profile Readme](https://docs.github.com/en/free-pro-team@latest/github/setting-up-and-managing-your-github-profile/managing-your-profile-readme). I did a [live stream on it](https://www.twitch.tv/videos/693078485) plus you can check out more information on how to create yours:

{% twitter 1294348292130836482 %}

Your GitHub Profile Readme should showcase you to the world. This is similar to the way an open source Readme is designed to showcase its project to the world. You can add lots of assets to your Readme like gifs, images, code, and anything else that can be written in markdown.

If you have an awesome GitHub Readme Profile, or you've come across an amazing Open Source Readme, I'd love to lay eyes on it. Put a link in the comments below and I'll be watching them all!
How to contribute to Nim language?
Tags: nim
Published: 2020-11-20 06:06:10

[Nim language](https://nim-lang.org) is a great and wonderful language. It's powerful and elegant. It is new but promising. It deserves more attentions.

Nim language is a community driven [project](https://nim-lang.org) which encourages more people to contribute to it.

If you want to contribute to Nim, I recommend you read [Nim Docs](https://nim-lang.org/documentation.html) first. You maybe find some typos and improvements from there.

If you need some challenges, you could try to solve some problems labeled [easy](https://github.com/nim-lang/Nim/issues?q=is%3Aissue+is%3Aopen+label%3AEasy) or [documentation](https://github.com/nim-lang/Nim/issues?q=is%3Aissue+is%3Aopen+label%3ADocumentation). 

Then if you have more knowledge about Nim language, you could add some features from other mature language or some functions your library needs which are common to use(maybe need [RFC](https://github.com/nim-lang/RFCs)).

If you want to solve more complex problems, I recommend you to check something labeled `JS` or `codegen` which tends to be more easy to solve.

Finally I recommend you to read [Contributing Guide](https://nim-lang.org/docs/contributing.html) which introduces more details you need to pay attention to.

If you have some problems about Nim language, welcome to ask in [Nim Discord Server](https://discord.gg/fhxcMcn).
Type Safety in C++
Tags: cpp, beginners, computerscience, oop
Published: 2020-11-20 05:48:39

---
title: Type Safety in C++
published: true
description: Promoting and demoting types in C++
tags: cpp, beginner, computerscience, oop
cover_image: https://images.unsplash.com/photo-1515974256630-babc85765b1d?ixlib=rb-1.2.1&auto=format&fit=crop&w=2550&q=80
series: Programming 101 with C++
---

C++ **enforces types**, that means, every variable has a type and then that is its type **forever** and it can't be changed.

Expressions like 2 or 2+2 also have a type.

It is **okay** to **"promote"**
* put an integer (eg 2) into a float

The compiler will however **warn** you if you **"demote"** and throw away information
* put a floating point number (say 4.9) into an integer

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mxoome0i0itubnbezbbd.png)

This applies for variables initialised using **auto** as well.

Some combinations are just not allowed and will result in **compiler errors**
* put a string into an int
* multiply a string and a float

Do try out the narrowing example shared by [Sandor](https://dev.to/sandordargo) in the comments.

Please leave out comments with anything you don't understand or would like for me to improve upon.

Thanks for reading!
Intro to web development(a series) HTML5 to
Tags: html, tutorial, webdev, programming
Published: 2020-11-20 05:46:05

Web development in simply the process of creating a website, it can be divided into:
<ol>
<li>frontend (client side) and </li>
<li> backend (server side).</li>
</ol>
<br>
The frontend deals with what the user sees and what the user will experience, we use languages like:
<ul>
 <li>HTML5, XML (for structure and data collection)</li>
 <li>CSS (for the design) and </li>
<li>JavaScript (for sending request and Making the website more dynamic).</li>
</ul>
<br>
the backend deals with the storage and manipulation of data based on requests sent by the frontend, we use languages like:
<ul>
<li>php </li>
<li>python</li>
<li>C#</li>
<li>dart</li>
<li>java</li>
<li>
 we also use runtime environments like node.js.</li>
</ul>
.

#### **HTML 5**
![HTML img](https://dev-to-uploads.s3.amazonaws.com/i/e8qdoq4pgcag4jsue9rv.jpeg)
We will be looking at HTML5 which is hyper text markup language, it is used to create the structure of the website, it is the foundation of a website, it makes use of tags for it's syntax e.g
<br>
<pre>
&lt;p&gt; hello &lt;/p&gt;
</pre>
<br>
The series will continue....
<br>
Edited:
 Part 2 - [intro to HTML](https://dev.to/blackpandan/html-tutorial-with-mobile-phone-254d)
<br>
JavaScript filter() method
Tags: javascript
Published: 2020-11-20 04:53:02

I figured I've never really done an explanation on Array method in JavaScript. These are methods to make our lives way easier.

To explain how you must understand before these methods existed, we would have to make a manual loop and create a filter in there.

## Using the Javascript filter() method

Let's make a list of items with prices.

```js
const items = [
  { name: 'T-shirt plain', price: 9 },
  { name: 'T-shirt print', price: 20 },
  { name: 'Jeans', price: 30 },
  { name: 'Cap', price: 5 }
];
```

Now let's say we want to filter out all the items over 10$.

```js
const filter = items.filter(item => item.price > 10);
// [ { name: 'T-shirt print', price: 20 }, { name: 'Jeans', price: 30 } ]
```

How this syntax works:

```js
const new = original.filter(function);
```

Where new will be our new to use array, original is the source and we pass the function we want to apply.

So how it looked before?

Something like this.

```js
let output = [];
for(var i = 0; i < items.length; i++) {
  if (items[i].price > 10) output.push(items[i]);
}
// [ { name: 'T-shirt print', price: 20 }, { name: 'Jeans', price: 30 } ]
```

Also works fine, but especially when it comes to more advanced filters the array method makes it so much quicker.

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Reclaim 25% of Java Heap Memory and Lower Your Cloud Bills
Tags: java, java11, string
Published: 2021-07-03 07:28:59

---
title: Reclaim 25% of Java Heap Memory and Lower Your Cloud Bills
published: true
date: 2020-11-20 04:52:10 UTC
tags: java, java11, String
canonical_url: http://bazlur.com/2020/11/reclaim-25-of-java-heap-memory-and-lower-your-cloud-bills/
---

### You can save up to 25% of heap memory using latest java which means less cloud bills

Do you know that you can save up to 25% of your heap memory and your cloud bills without any effort?

Well, that’s true. Many exciting features have been added to the latest Java recently, and I’m going to cover one of them in this article, so please bear with me.

We all know, Strings are the most used object in any Java application. In fact, it takes up almost half of the heap size of a Java application. Did you know?

Before delving into this much further, let me answer your obvious question, which I know you’d ask: how are strings made of?

Well, Strings are nothing but an array of characters, well, at least it used to be. If you open the String class from JDK 8, you will be able to see it.

However, unlike C, an array of char is not a String in the Java programming language, and neither a String nor an array of char is terminated by ‘\u0000’ (the NUL character).

Nevertheless, a String object in Java is also immutable, which means the String content never changes, while an array of char has mutable elements.

Ref: [https://docs.oracle.com/javase/specs/jls/se14/html/jls-10.html#jls-10.9](https://docs.oracle.com/javase/specs/jls/se14/html/jls-10.html#jls-10.9)

We will write about String immutability in another article. Rather get into the thing that I initially intended here.

In Java 8 and pre-Java 8, a **_char_** array is used in a **_String_**. A **_char_** takes 2 bytes of memory. That means, to store one character, you need 16 bits of memory. For example, if you write “Hello” you’d need an object of an array, and that would have 5 characters

The total size of a String = size of array object itself + size of 5 characters + array holds an integer for its length

= 8 bytes for array object header + 5 \* 2bytes + 4 bytes

= 8 + 10 + 4

= 22 bytes

However, most western locals nowadays need only 8 bits byte array to encode them. That’s why Java 11 introduces the new compact strings that encode a string with an 8-bit byte array instead of a char array. Unless they explicitly need 16-bit characters. These strings are known as [**_compact strings_**](https://openjdk.java.net/jeps/254).

Hence, the size of an average string in java 11 is roughly half the size of the same thing in java 8.

On average, 50% of a typical Java heap may be consumed by string objects. This will vary from application to application, but on average, the heap requirement for such a program running with java 11 is only 75% of that same program running in java 8.

This is huge savings.

The `-XX:+CompactStrings` flag controls this feature

If you want to disable it, you can use this flag **_-XX:-CompactStrings._**

That’s all for today.
React + Tailwind 2; in 2 minutes
Tags: react, tailwindcss, npm
Published: 2020-11-20 00:40:56

*If you are interested in developer trends you should check out my new newsletter at: [unzip.dev](https://unzip.dev)*

---

I tried following most of the tutorials online, most of them had some missing parts (or only worked with yarn), let's get this going now, no BS.

## Create a React app
`npx create-react-app project-name`

## Install all the packages
```
npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9 postcss-cli
```
*This fixes [PostCSS 8 errors](https://tailwindcss.com/docs/installation#post-css-7-compatibility-build), will update this guide when it gets fixed (it is identical to the latest build)*

## Setup PostCSS
Create anew file `touch postcss.config.js` in the root of the project, with the contents:
```
module.exports = {
	plugins: {
	  tailwindcss: {},
	  autoprefixer: {},
	}
  }
```

## Initialize tailwind
```
npx tailwindcss init
```

## `tailwind.css` file
Put it in `src/tailwind.css`, contents:
```
@tailwind base;
@tailwind components;
@tailwind utilities;
```

## Change the `package.json` scripts
```
  "scripts": {
    "start": "npm run watch:css && react-scripts start",
    "build": "npm run watch:css && react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "watch:css": "postcss src/tailwind.css -o src/index.css"
  },
```

## Test
in `App.js`
```
import './App.css';

function App() {
  return (
    <div className="App">
      <div className="bg-blue-500">
        This should be blue
      </div>
    </div>
  );
}
```

## Start!
`npm start`
Which type of tech company should I work for?
Tags: career, jobsearch
Published: 2020-11-20 04:49:07

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nbngg1crt9dacw9cp5ao.jpg)

Technology industry is one of the fastest growing industries today. Even with global pandemic and economic pressures, tech companies are hiring as they are scaling for growth. Therefore, it's no brainer that if you're looking for a job in a growing industry, tech industry is the answer. 

However, you might be wondering if all tech companies are the same. The answer is that they are not. There are pros and cons to working for smaller tech companies which are at their infancy, to working for famous public tech companies like FAANG (Facebook, Amazon, Apple, Netflix and Google). 

I've put together a comparison chart as a helpful tool in decision making when you're deciding between working for a small startup vs a public tech company. In one glance, all the pros and cons. There are some exceptions to the rule though, for example, if you joined a venture bet / Horizon 3 team within a large public tech company, there will naturally be more opportunities for greenfield projects and exploring new tech. 

So my recommendation is to look at this comparison chart, think about what are more important "features" for you in the current stage of your career and make an informed decision. 

Good luck!
November 19th, 2020: What did you learn this week?
Tags: weeklylearn, discuss, weeklyretro
Published: 2020-11-20 04:40:02

It's that time of the week again. So wonderful devs, what did you learn this week? It could be programming tips, career advice etc.

<center>

![Boss from the Office Space movie sipping his coffee in front of a cubicle](https://media.giphy.com/media/lSVL6vdhdZVPW/giphy.gif)

</center>

Feel free to comment with what you learnt and/or reference your TIL post to give it some more exposure.

{%tag todayilearned %}

<center>

And remember, if something you learnt was a big win for you, then you know where to drop it as well.👇👇🏻👇🏼👇🏽👇🏾👇🏿

{%link https://dev.to/devteam/what-was-your-win-this-week-24ff %}

![A show host dancing a winning in their seat](https://media.giphy.com/media/l3q2Z6S6n38zjPswo/giphy.gif)
</center>