teleren/devto huggingface dataset:
Wednesday Links - Edition 2021-04-21 
Tags: java, jvm, database, kotlin
Published: 2021-04-21 13:11:51

How to hype Java up again? (6 min read) ☕️
https://jackson.sh/posts/2021-04-java-underrated/

Where premature optimization can lead you? (30s read) 🦟
https://twitter.com/tagir_valeev/status/1384010540767268874?s=19

Pitfalls of integration tests (6 min read) 🧪
https://blog.thecodewhisperer.com/permalink/integrated-tests-are-a-scam

How much you can gain by Spring's DSL for Kotlin bean creation (6 min read) 🧐
https://towardsdatascience.com/a-benchmark-of-spring-annotations-vs-kotlin-dsl-209f54294325

jcstress has been released (1 min read) 🧨
https://twitter.com/shipilev/status/1382619468065542146

Delegation in Kotlin done correctly (4 min read) 🤖
https://blog.frankel.ch/kotlin-delegation/

JEP for deprecation Java's security manager (3 min read) 💩
https://www.infoq.com/news/2021/04/java-security-vote/

How clustered index works under the hood (8 min read) ⚗️
https://vladmihalcea.com/clustered-index/
Which Browser is Better For Developers?
Tags: chrome, firefox, browser, discuss
Published: 2021-04-21 13:10:32

Hey Guys,

{% reddit https://www.reddit.com/user/RithikDeveloper754/comments/mvf7a7/which_browser_is_best_for_developers/ %}

I would love to hear your responses guys!

Thanks and Remember...


# Keep Coding Y'All 👨🏻‍💻
Add tables to DevTo posts
Tags: devto, markdown
Published: 2021-04-21 13:06:15

```markdown
| Header 1   | Header 2 | Header 3  |
|------------|----------|-----------|
| Foo        | Bar      | Baz       |
| :pig:      | :cat:    | :dog:     |
| Lorem      | Ipsum    | Dolor     |
| :star:     | :skull:  | :fire:    |
```

# Result
| Header 1   | Header 2 | Header 3  |
|------------|----------|-----------|
| Foo        | Bar      | Baz       |
| :pig:      | :cat:    | :dog:     |
| Lorem      | Ipsum    | Dolor     |
| :star:     | :skull:  | :fire:    |

# Editor's guide
For all the rest, see [DevTo editor's guide](https://dev.to/p/editor_guide) :pencil:
UI Dev Newsletter #53
Tags: webdev, html, css, javascript
Published: 2021-04-21 12:47:58

- [CSS is a Strongly Typed Language](https://bit.ly/3dv9IHB)
Eric Bailey explains how CSS is strongly typed language, lists all possible types of values, and offers some proof.


- [Overflow Issues In CSS](https://bit.ly/3v32xwa)
Ahmad Shadeed explores the causes of overflow issues and how to solve them using DevTools and other methods.


- [Say Hello To CSS Container Queries](https://bit.ly/3uZqnck)
Ahmad Shadeed explains why we need container queries, how they could make our life easier, and how to achieve more powerful components and layouts.


- [Prevent overflow with overflow: clip](https://bit.ly/3tClIgk)
Pete LePage announces Chrome 90 supports a new overflow property 'clip' that prevents any scrolling for the box, including programmatic scrolling.


- [The best approach to lazy load images for maximum performance](https://bit.ly/2Qz69qU)
Adrian Bece explains how to use image lazy loading in browsers that do and don't support native lazy load.


- [Quick Tips for High Contrast Mode](https://bit.ly/3mZnbus)
Sarah Higley covers some surprising behavior of Windows High Contrast mode.


- [CSS Generators](https://bit.ly/3dsCqc6)
Marko Denic shares a collection of the best CSS generators that could help you avoid time-consuming tasks.


- [uiwtf](https://bit.ly/3tIZ7Pf)
uiwtf is an experimental laboratory of user interface patterns and interactions that make you think 'what the f**k?' in a thought-provoking way.



Happy coding!

[Subscribe to the newsletter here!](https://bit.ly/34155z3)
Cypress Commands (Get, Click, Find)
Tags: testing, javascript, webdev, tutorial
Published: 2021-04-21 12:18:54

In this tutorial, we will cover some commonly used Cypress Commands such as Get, Click and Find. We will also take a look at how to find the text of a particular element.

### Cypress Get & Click Command
One of the most commands that you will use in Cypress is the ‘Get’ command. The ‘get’ command is used to access one or more DOM elements by a selector.

**Usage:**
![commands-get](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3xekt9mgrb63g3b5dxxg.png)

---

### Cypress Get Text of an Element
There are multiple ways to get the text of an element in Cypress.

1 – Easiest option is via the assertion method:

![commands-text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1uwut5ejkqxkv675lvor.png)

2 – This option you can use if you need to manipulate the text first:

![carbon-gettext](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c3mujly4gsldaheyfvmy.png)

---

###  Cypress Find Command
The ‘find’ command is used to get the descendant of a particular selector. For example, in the below code we are first accessing the nav menu by the id selector and then finding all the list items within the nav using the ‘find’ command.

![find-command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ohlogw38izyib0gct7r8.png)

---

#### Check out the video below to see learn more about the Get, Click, and the Find commands –

{% youtube jyDr97ubWMQ %}

---

📧 Subscribe to my [mailing list](https://automationbro.com/mailing-list) to get access to more content like this 

👍 Follow [automationbro](https://twitter.com/automationbro) on Twitter for the latest updates

...

I love coffees! And, if this post helped you out and you would like to support my work, you can do that by clicking on the button below and buying me a cup of coffee -

<a href="https://www.buymeacoffee.com/automationbro">![Buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/i/4aw2ub3f4qkyjk0ivwt4.png)</a>

You can also support me by liking and sharing this content.

Thanks for reading!
Tasker App develop in react native for 724.one
Tags: reactnative, react, ios, android
Published: 2021-04-21 12:41:37

This app is a tasker app for taking notes of import things it have audio, video and document storage functionality. user can easily access his/her desire things.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p87wujzhsxkffg0h0rh1.jpg)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bfnswuzcivpe08d0x39f.jpg)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qnk7n3trz3q71919nt8h.jpg)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7je20rkpnpt69rdhtgi3.jpg)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fynczjgx1g5k1gttgy5a.jpg)
FileUpload in node-ts using formidable module

Published: 2021-04-21 12:28:37


class FileUploader {

    FileUploader() {}

    async uploadFile(req: Request, res: Response) {
        let data: any = {
            files: []
        }

        let form: any = new Formidable.IncomingForm({
            multiples: true,
            keepExtensions: true,
            uploadDir: uploadDir
        })

        form.on("fileBegin", (name: string, file: any) => {
            const [fileName, fileExt] = file.name.split(".");
            const newFileName = `${fileName}_${new Date().getTime()}.${fileExt}`;
            data.files.push(newFileName);
            file.path = path.join(uploadDir, newFileName);
        })


        form.parse(req, async (err, fields, files) => {
            try {

                //get other fields
                data = {
                    ...data,
                    ...fields
                };
                if (err) return res.status(500).json({
                    error: err
                });
                return res.status(200).json({
                    success: true,
                    data
                })

            } catch (error) {
                res.json({
                    success: false,
                    error: "Error occured"
                })
            }
        });

    }

}



![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3w25rzarfu3ub96nw590.png)
Broaden the view
Tags: watercooler, webdev, opensource, privacy
Published: 2021-04-21 12:14:54

We develop [Offen](https://www.offen.dev/?utm_source=forum), a fair and self hosted web analytics software that treats operators and users as equal parties. Here's what's been happening over the past eight weeks. 

**Widescreen**
We have further optimized our display features. The Auditorium for operators now makes better use of screen real estate on desktop devices. Also, we have optimized the display of bar charts in mobile view.

**Offen is now available in German, English and recently also in French.**
Our consent banner and the Auditorium for operators and users are available in the respective language. If you would like to support our fair approach to web analytics by contributing Spanish, Portuguese or other language versions, please do not hesitate to [request an invite.](https://www.offen.dev/?utm_source=forum)

**More secure**
Our Docker image of the application are so far running as `root.` This would theoretically give the possibility to inject malicious code into Offen.
*This did not happen in any Offen version.* But to fix this possible vulnerability, all images published from now on will run the application as a non-privileged `offen` user.

**Coming up**
We want to present Offen and the idea of fair data transfer behind it to a professional audienc. Recommendations for relevant talks and conferences worldwide are very welcome. Got something in mind that we should apply for? [Let us know.](https://www.offen.dev/?utm_source=forum)
Local Analysis: are you getting the value you deserve from it?
Published: 2021-04-21 12:13:27

This live session is today!

Allow me to share here our first ever webinar :tada:

We'll provide an overview of static code analysis, and detail how you can set up the CLI to run code analysis on your build server. 

You'll also get a better sense of the benefits and what you can achieve with a single command, as our experts, **André Meira** and **Hélio Rocha** will be showcasing the CLI tool performing analysis on the code before committing it. 

What you can achieve with a single command, and how to make the most out of it; you'll get better insights on how to execute code analysis locally and its advantages.

Join us at 12 pm ET (9 am PT, 5 pm Lisbon). 
[Register here](https://hubs.li/H0LGpsl0)
The case of the binary logical operators '&&' and '||' in Javascript
Tags: javascript
Published: 2021-04-21 12:06:01


In Javascript the binary logical operators '&&' and '||' behave differently compared to the same operators in a programming language like Java.
This is because javascript binary logical operators can return even a number or a string, not just true or false!
And again this is possible because Javascript has this concept of 'Truthy' and 'Falsy'.

Anything of the below is considered as false by javascript:
''
false
NaN
null
undefined

Everything else is considered as true

Here is a short post on how the above concept affects the binary logical operators in javascript:

https://fullstackdeveloper.guru/2021/04/21/how-the-binary-logical-operators-and-differs-in-javascript-from-java/
How I did 1777 PLN from 100 PLN? | My first Bug Bounty
Tags: cybersecurity, security, beginners
Published: 2021-04-21 12:00:26

Let's start by explaining what platform I found the bug on.

## Codenga

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2lhxaih20wxjr5rbaobt.png)

[**Codenga**](https://codenga.pl/) is a Polish platform where we can buy interactive courses.
The entire course takes place on the platform.

## Where did it start?

I took part in the contest on Codenga fanpage on Facebook. The prize in the course was a voucher worth 100 PLN. It consisted in guessing the number of practical tasks solved by the students over the year of the platform's existence. The number was listed in the newsletter I was subscribed to, so I had the winning in my pocket.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ero3iet4y3f8mjpnb36o.jpg)

## So, let's go to the title part

I selected courses with a total value of 98 PLN and added them to my cart. After applying the voucher the price was 0 PLN, I confirmed the order and from then on I had the ordered courses in my account.

It could end there, but out of curiosity I checked to see if the voucher balance was now 2 PLN, or if it was a one-time voucher.

To my surprise, the course that was added to the cart to check if the coupon is still active was discounted not by 2 PLN, but 100%!

I notified customer service via the chat available on the website.
On recommendation, I also wrote a message to the Codenga contact email describing the situations and asking for permission to publish this article.

As a test, I checked how much I could buy with this voucher.
It turns out that the voucher has an infinite number of uses.
This indicates a bug in the platform code, which I did not look for on my own because the problem has already been reported.

For the price to be zero, the value of the cart could not exceed 100 PLN. In this way I placed 20 orders not exceeding 100 PLN with a total value of 1777 PLN.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dtep0bupzi7a0pkmxyt8.png)

## Summary

As a reward, I can keep the courses.
Thanks to my curiosity I found my first Bug Bounty :)
Daily Developer Jokes - Wednesday, Apr 21, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-04-21 12:00:21

---
title: "Daily Developer Jokes - Wednesday, Apr 21, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Wednesday%2C%20Apr%2021%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12590a84b94.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ What are computers' favorite snacks?

___A:___ Microchips, phish sticks, and cookies. But just a few bytes of each.
 -->
E-commerce modules worth extracting in the code
Tags: programming, watercooler
Published: 2021-04-21 11:58:36

When you work on a non-trivial e-commerce application the complexity is usually, well non-trivial too.

E-commerce is one of this kind of apps, where just following a CRUD approach may not be enough.

Here is a list of modules (definitely not a full list) that might be worth having as separate, in order to avoid coupling.

## Ordering

This is a classic one. If you have no modules in your e-commerce code then you can call it Ordering anyway, because that's the most important. 
Some possible operations (commands) here:
- initiate an order (usually with some items from the cart)
- confirm the order (so that other modules are aware)

## Ecommerce

I recently like to call this Ecommerce - a module which contains the logic around the cart concept.

## Catalog

This module allows adding products to the offer visible to the clients.

## Inventory

Keep track of how many items are left. Sometimes booking too.

## Pricing

Pricing is usually not as trivial as just assigning a price to one product. USually we have a whole range of pricing strategies that change over time. It's nice to encapsulate them and keep it separate from other modules.

## Payments

Keep track of what was paid for. Sometimes your order will be paid in multiple payments, sometimes it's not fully paid. Sometimes you pay for multiple orders with one payment - hadle this logic here.

# Sample application with ecommerce modules

I'm working on sample application which shows some of those concepts. It started as a ordering system, but now it's in a process of becoming an e-commerce app too.

[https://github.com/RailsEventStore/cqrs-es-sample-with-res](https://github.com/RailsEventStore/cqrs-es-sample-with-res)


Are there any other modules that you like to extract in ecommerce apps? Share them in the comments :)
Building TikTok's record button using Framer Motion & React
Published: 2021-04-21 11:51:44

{% youtube UnTBtDDyN2M %}

## Summary

The TikTok record button is a deceivingly complicated UI element with some interesting moving parts, so I thought it would be perfect for a tutorial. In the guide above, we'll build a fully animated record button using nothing but React, Framer Motion (a fantastic animation library), and TypeScript.

## Project Files

All the project files are available to download and use yourself over on my website, [CodeSnap.io.](https://codesnap.io/course/react-bites/tiktok-record-button)

## Demo

{% codesandbox agitated-shockley-cdzuy %}

## Thanks!

Thanks for watching - any and all feedback is greatly appreciated, and please share it around if you think it'll be useful to anybody else. If you're interested in learning more, I've got loads more video and written content over on my website, [CodeSnap.io.](https://codesnap.io).
Un Brexit de medio pelo
Tags: xaviermitjavila, brexit
Published: 2021-04-21 11:41:45

---
title: Un Brexit de medio pelo
published: True
description: Durante las últimas semanas, mi día a día me ha llevado a tener contacto con el Reino Unido y, como sabéis, esto es sinónimo de Brexit. Hace mucho que hablamos del Brexit y del posible impacto que esto tendría en la economía. Precisamente por eso se ha retrasado su implementación hasta ese año. Qué follón que tenemos organizado, allí arriba.
tags: xaviermitjavila, brexit
//cover_image: http://xaviermitjavila.com/wp-content/uploads/2021/04/Xavier_Mitjavila_Moix_articulo_brexit.png
---

Durante las últimas semanas, mi día a día me ha llevado a tener contacto con el Reino Unido y, como sabéis, esto es sinónimo de Brexit. Hace mucho que hablamos del Brexit y del posible impacto que esto tendría en la economía. Precisamente por eso se ha retrasado su implementación hasta ese año. Qué follón que tenemos organizado, allí arriba.

Aquí tenéis un ejemplo. La edad no perdona y tras una ligera miopía histórica ahora ya llegamos a la presbicia. Pues bien, las lentes de contacto de prueba hechas en Inglaterra (no me preguntéis por qué) y que tenían que llegar en una semana han tardado dos meses en hacerlo. La razón: el Brexit.

Otro ejemplo. Unos amigos con el hijo estudiando en Londres le enviaron una bolsa después de Reyes con cosas de la tierra para que las pudiera disfrutar a pesar de estar en el extranjero. La bolsa no ha llegado nunca a Londres y después de muchas reclamaciones lo han recibido de nuevo en Barcelona. La razón: el Brexit. Parece que habrían tenido que declarar que se trataba de "productos sin valor comercial".

"Si esto sucede en el ámbito más doméstico y personal, ¿qué debe estar pasando a nivel empresarial?", Me pregunté. La respuesta es muy clara. A finales del mes de marzo el comercio entre el Reino Unido y España se había desplomado un 39%, y no parece que esto vaya a cambiar en los próximos meses, ya que los problemas con los nuevos trámites necesarios y la aparición de nuevas barreras están dificultando el comercio más básico.

La decisión de salir de la Unión Europea se tomó en una votación democrática y sus dirigentes políticos han aplicado este mandato. Nada que decir, pues. Pero lo que habría sido necesario es que aquellos que velan por el "bien común", allí y aquí, con todo el tiempo que han llegado a tener, hubieran evitado el desastre actual. Esto, sin embargo, significaría pedir a los políticos que actuaran con la eficiencia de los empresarios y, por tanto, sería pedir demasiado.
Java – Convert Excel File to/from JSON (String/File) – using Apache Poi + Jackson
Tags: java, excexcel, apachepoi, jackson
Published: 2021-04-21 11:17:17

https://grokonez.com/java/java-convert-excel-file-to-from-json-string-file-using-apache-poi-jackson

Java – Convert Excel File to/from JSON (String/File) – using Apache Poi + Jackson


In the tutorial, Grokonez shows how to convert Excel File to JSON String or JSON File and vice versa with Java language by examples.

<!--more-->

<iframe width="560" height="315" src="https://www.youtube.com/embed/VqfYbxbYp5I" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

<h2>Dependencies</h2>

<pre><code class="language-html">&lt;dependency&gt;
	&lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
	&lt;artifactId&gt;poi-ooxml&lt;/artifactId&gt;
	&lt;version&gt;3.17&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
	&lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
	&lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
	&lt;version&gt;2.8.5&lt;/version&gt;
&lt;/dependency&gt;</code></pre>
<h2>Excel to JSON</h2>
<h3>Excel File to JSON String</h3>
We do 2 steps:
– Step 1: Read Excel File into Java List Objects
– Step 2: Convert Java List Objects to JSON String

-> Excel File: <a href="https://grokonez.com/wp-content/uploads/2019/02/customers-1.xlsx">customers</a>

<img src="https://grokonez.com/wp-content/uploads/2019/02/convert-excel-file-to-from-json-file-string-excel-file.png" alt="convert-excel-file-to-from-json-file-string---excel-file" width="415" height="162" class="alignnone size-full wp-image-16892" />

More at:

https://grokonez.com/java/java-convert-excel-file-to-from-json-string-file-using-apache-poi-jackson

Java – Convert Excel File to/from JSON (String/File) – using Apache Poi + Jackson
Edit PDF files with Python
Tags: python, productivity, tutorial, showdev
Published: 2021-04-21 11:13:27


I like to test Python in different situations, it just makes my life easier in many situations. Python allows me to automate things that are normally repeated and boring, so I can focus on important aspects of my job. Today I will show you how can you edit PDF files with python.

In this example I will be using [ReportLab](https://pypi.org/project/reportlab/). 
The ReportLab Toolkit. An Open Source Python library for generating PDFs and graphics.

This is our original pdf:
![enter image description here](https://i.ibb.co/VS34xP9/org.png)


Let's jump to the code!

First we need to import dependencies

```python
from PyPDF2 import PdfFileWriter, PdfFileReader
import io
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
```
First we will create a new PDF with Reportlab, in this part we will also define our `font color` and the `font size`:

```python
packet = io.BytesIO()
can = canvas.Canvas(packet, pagesize=letter)
can.setFillColorRGB(1, 0, 0)
can.setFont("Times-Roman", 14)
can.drawString(72, 655, "Hello from Python")
can.save()
```
Then we move to the beginning of the StringIO buffer:

```python
packet.seek(0)
new_pdf = PdfFileReader(packet)
```
read your existing PDF
```python
existing_pdf = PdfFileReader(open("original.pdf", "rb"))
output = PdfFileWriter()
```
The we add the "watermark" (which is the new pdf) on the existing page;

```python
page = existing_pdf.getPage(0)
page.mergePage(new_pdf.getPage(0))
output.addPage(page)
```
And finally, write "output" to a real file:
```python
outputStream = open("destination.pdf", "wb")
output.write(outputStream)
outputStream.close()
```
This is our result:

![enter image description here](https://i.ibb.co/6DyZXFg/dest.png)

Thank you all.