teleren/devto huggingface dataset:
Top 5 DEV Comments of the Past Week
Tags: bestofdev
Published: 2021-03-25 17:44:18

---
title: Top 5 DEV Comments of the Past Week
published: true
description: 
tags: bestofdev
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvjh80kv1nr41sw6wxke.png
---

This is a weekly roundup of awesome DEV comments that you may have missed.  You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag.


To start off, @milmike gives some great recs on what to jam to [while you code] (https://dev.to/poudyal_rabin/should-i-listen-to-music-while-coding-4ihh).

{% devcomment 1ckab %}

@katieadamsdev weighs in with great insight on how difficult it can be to choose which [JavaScript framework to learn] (https://dev.to/ben/which-javascript-frameworks-are-worth-learning-in-2021-2h8p).

{% devcomment 1cke4 %}


This is a fantastic [Win of the Week] (https://dev.to/devteam/what-was-your-win-this-week-3mm7) @phantas0s! Keep your eyes on my feed for the next round of wins tomorrow!

{% devcomment 1chhn %}


Sometimes, knowing the path ahead can be tricky, but @dastasoft provides some great [React] (https://dev.to/ra1nbow1/what-a-react-developer-needs-to-know-in-2021-3agj) tips to help us see a clear road ahead.

{% devcomment 1ch7f%}

@raphael_jambalos lends knowledge and expertise in this post about choosing a [programming language] (https://dev.to/bobbyiliev/which-programming-language-would-you-start-with-and-why-1l7i) for the first time! Spoiler alert: in their opinion, Python is the way to go 🐍  

{%devcomment 1chgg%} 

---

See you next week for more great comments ✌
How to write CSS even Faster
Tags: webdev, tutorial, css, beginners
Published: 2021-03-25 17:41:28

---
title: How to write CSS even Faster
published: true
description: Emmet abbrivations for CSS and Emmet for CSS
tags: webdev,tutorial,css,beginners
//cover_image: https://miro.medium.com/max/875/0*0oCVg4n5lO84hJSQ
canonical_url: https://sameerkatija.medium.com/how-to-write-css-even-faster-8209bb5c86a3
---

While working on a project, experienced programmers tend to find shortcuts to save their time. They seem to hurry that they shifted to `i++` instead of `i = i + 1` to save time. There are many available options or [plugins available to make your web development workflow easy](https://sameerkatija.medium.com/make-your-web-development-workflow-smooth-with-these-5-vs-code-extensions-c394ab5ca19b). Emmet is one of them.

Emmet is a plug-in for text editors, which makes coding high-speed with the help of some abbreviations. Like in Html we write `html:5` we will get this code

```
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
</body>
</html>
```

This was HTML but you were here to learn how to write CSS faster not HTML. Don’t fret, I will guide you through some of the Emmet abbreviations for CSS which will help your workflow fast and smooth. So, let’s start.

## Emmet for CSS

You might be thinking that emmet is useful for just HTML, but this isn’t the case. you can use Emmet with CSS. Emmet only provides you shorthands for CSS properties. For Example, if we write `m0` we will get `margin: 0;` Let’s explore some other which are commonly used and can help us code faster.

## Emmet Abbreviation for CSS

Emmet Comes with a bunch of shortcuts Like `p` is short for `padding`, `w` for `width`, `h` for `height`, and `m` is short for `margin`. There are some common use cases that we need to discuss before we start working with Emmet.

### CSS Units

If you are typing default values with Emmet CSS abbreviations then you will get `px` as the default unit. If you want some other unit likes em, rem or percentage then you have to use the alias which are

```
e → em
r → rem
p → %
x → ex
```

### Color Values

Emmet supports colors and we can use it to write color shortcuts. Like `c#0` the generated output will be color: `#000000`. Some other use cases are

```
#1 → #111111
#e0 → #e0e0e0
#fc0 → #ffcc00
```

### Separator

While writing many properties in a single line we use `+` to differentiate between properties.

![Giff of code typing](https://media.giphy.com/media/uCU8v2m9PZaCmaWKCN/giphy.gif)

## Conclusion

So, we can see emmet makes CSS writing super easy with these shortcuts. Think of this you can write five lines using one statement. Isn’t this great? If you are interested in learning more check out the cheat sheet available [here](https://docs.emmet.io/cheat-sheet/).
Day 38
Tags: 100daysofcode, programming, javascript
Published: 2021-03-25 17:23:08

Day 38/100 of #100DaysOfCode

codewars

Hours coded: 1.1
Lines of code: 50
Keystrokes: 1058

via @software_hq's #vscode extension https://www.software.com/100-days-of-code
Customizing Your Gumroad Buy Button Using Svelte
Published: 2021-03-25 17:16:51

Gumroad is one of the hottest sites for creators to easily sell their digital products directly to customers with very little eCommerce setup work. You’ve probably seen a number of product on it from incredible creators such as Daniel Vassallo, Jose Rosado, and others. Here I’m going to show how you can customize the Buy Button style to match your website’s design.

We’re going to build this into a reusable Svelte component, and transform it to match the designs used by Russell Brunson on his Traffic Secrets site. He’s a known high-converting internet marketer who has put years of experimentation into learning techniques to optimize conversions, so this is a nuclear-grade sales optimized design.

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

[Read More...](https://www.silasreinagel.com/blog/2021/03/25/customizing-your-gumroad-product-buy-button/)
Video Slider JAVASCRIPT
Tags: javascript, 100daysofcode, html, css
Published: 2021-03-25 17:12:02

the day 95 of challenge #100DaysOfCode 

 Video Slider Using HTML5, CSS3 & JS

Demo : https://video-slider.netlify.app/

Code : https://github.com/saidMounaim/100DaysOfCode/tree/main/Day95
My pet project - what do you guys think?
Tags: python, flask
Published: 2021-03-25 17:11:08

Hey everyone, a short overview of what I've been doing for the past 84 days: I am taking the 100 Days of Code Python course by Angela Yu on Udemy, and during this course, I learned Flask and created a simple blog using it.

For the past 15 days, I've been working on improving that blog and creating a management system that could allow a user with no experience in coding whatsoever to configure and manage his website from A-Z. This focuses on the back-end, and not on the front-end, so it uses a pre-made bootstrap template. I am 14 years old and I'm fairly proud of myself. I'd love to know what you guys think, and how I did on this project.

This is just a pet project that I created in 15 days, I believe and hope that there's a lot more to come.

Here it is:

{% github ethanzrd/restful-blog %}
What the media get very wrong about Bitcoins energy consumption
Tags: lightningnetwork, bitcoin, bitcoinmining, cryptocurrency
Published: 2021-04-02 06:40:08

---
title: What the media get very wrong about Bitcoins energy consumption
published: true
date: 2021-03-25 17:10:43 UTC
tags: lightningnetwork,bitcoin,bitcoinmining,cryptocurrency
canonical_url: https://medium.com/coinmonks/what-the-media-get-very-wrong-about-bitcoins-energy-consumption-98f2fbb8ad17
---

[![](https://cdn-images-1.medium.com/max/1620/1*hI1dHEbQIoYZU5Y60LrF0A.jpeg)](https://medium.com/coinmonks/what-the-media-get-very-wrong-about-bitcoins-energy-consumption-98f2fbb8ad17?source=rss----721b17443fd5---4)

The number of Bitcoin transactions has nothing to do with energy consumption

[Continue reading on Coinmonks »](https://medium.com/coinmonks/what-the-media-get-very-wrong-about-bitcoins-energy-consumption-98f2fbb8ad17?source=rss----721b17443fd5---4)
wait() Vs sleep() Methods In Java
Tags: java
Published: 2021-03-25 17:08:11

wait() :
--------
1) The thread which calls wait() method releases the lock it holds.
2) The thread regains the lock after other threads call either notify() or notifyAll() methods on the same lock.
3) wait() method must be called within the synchronized block.
4) wait() method is a member of java.lang.Object class.
5) wait() method is always called on objects.
6) wait() is a non-static method of Object class.
7) Waiting threads can be woken up by other threads by calling notify() or notifyAll() methods.
8) To call wait() method, thread must have object lock.

sleep() :
----------
1) To call wait() method, thread must have object lock.
2) No question of regaining the lock as thread doesn’t release the lock.
3) sleep() method can be called within or outside the synchronized block.
4) sleep() method is a member of java.lang.Thread class.
5) sleep() method is always called on threads.
6) sleep() is a static method of Thread class.
7) Sleeping threads can not be woken up by other threads. If done so, thread will throw InterruptedException.
8) To call sleep() method, thread need not to have object lock.

See more at https://javaconceptoftheday.com/difference-between-wait-and-sleep-methods-in-java/
Execute Date Format In Cron
Tags: notes, linux, cron, date
Published: 2021-03-26 20:14:02

---
title: Execute Date Format In Cron
published: true
date: 2021-03-25 17:00:00 UTC
tags: Notes,linux,cron,date
canonical_url: https://clavinjune.dev/en/blogs/execute-date-format-in-cron/
---

Escaping `%` in crontab using `\%`

example

```bash
0 0 * * 5 cat ~/log >> \
~/log-`date +"\%Y-\%m-\%d"` && \
> ~/log

```
What is stability?
Tags: stability, think, act, morethinking
Published: 2021-03-25 16:57:45

---
title: What is stability?
published: true
description: Think about it. Act on it. Then think about it some more.
tags: stability, think, act, morethinking
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38ssy61hjud8pp7ik60i.jpg
---

If your entire development team went on vacation for a week. Would your software survive the week without taking an outage or becoming unusable?

If the answer is no, find solutions for stability. Look at those areas you know will have issues without constant divine developer intervention. Focus on creating a software ecosystem that is robust and reliable. "You are what you eat" same goes for the software you create ("feed"). 

If the answer is yes, congrats you have leveled up. Would your software survive the month?

*Rinse and Repeat*


These are just some thoughts and questions, take them or leave them. Most things in our industry become outdated and unusable in a relatively short period of time. I want you to take a step back and think about this, think about the why. Software as a whole has suffered in a lot of areas because of the perpetual cycle of chaos ("act first, think later") that we have allowed to become the norm. 

Will your software survive?
Assumptions of Linear Regression
Tags: opensource, machinelearning, beginners, datascience
Published: 2021-03-25 16:56:25

**Assumptions of Linear Regression**

Due to the parametric nature of regression, it is restrictive in nature. Hence due to this, it fails to deliver good results with data sets which doesn't fulfil its assumptions.
Following are the assumptions:

* Linear Relationship
* No correlation of error terms
* Constant Variance of error terms
* No correlation among independent variables
* Error normally distributed.

Now let's understand what this terms actually mean....

1. **Linear or Additive Model**: If you fit a model to a non-linear, non-additive dataset, the regression algorithm would fail to capture the trend mathematically, thus result in an inefficient model. Also, this will lead to an erroneous prediction on an unseen dataset.

2. **No correlation of error terms**: The presence of correlation in error terms drastically reduces model's accuracy. This is usually occurs in time series models where the next instant is dependent on previous instant. If the error terms are correlated , the estimated standard errors tend to underestimate the true standard error.
    * This is also known as autocorrelation.

3. **Constant Variance of error terms**: This phenomenon exists when the independent variables are found to be moderately or highly correlated. In the model with correlated variables, it becomes difficult to find out which variable is actually contributing to predict the response variable.
     * It also leads to increase in standard error.
     * This is also called as Multicollinearity.

4. **No Correlation among independent variables**: The presence of non-constant variance in the error terms results in heteroskedasticity.
    * Generally , non-constant variance arises in presence of 
     outliers or extreme leverage values. Look like , these values 
     get too much weight, thereby disproportionality influences 
     the model's performance. When this phenomenon occurs, the 
     confidence interval for out of sample prediction tends to be 
     unrealistically wide or narrows. 
    * This is also known as heteroskedasticity.


5. **Normal Distribution**: If error terms are non-normally distributed , confidence intervals may become too wide or narrow.
   * Once confidence interval becomes unstable, it leads to 
   difficulty in estimating coefficients based on minimization of 
   least squares.
   * Presence of non-normal distribution suggests that there are a 
   few unusual data points which must be studied closely to make a 
   better model. 

These are the assumptions you need to get a better linear model.
Why JSON Web tokens are required?
Tags: javascript, jwt, webdev, http
Published: 2021-03-23 15:05:35

JSON web tokens (acronym JWT, pronounced at JOT) were introduced in 2010 as a means of communication between two parties in the form of a JSON object. They can be encrypted and are popularly used over session id in authorisation mechanism in a server client architecture. Let's discuss what has made it so prevalent.
### Server-Client Architecture
In this scenario, if a client requests a protected page(https://dev.to/new) from a server(by protected I mean the one shielded with some authentication mechanism), the server renders a login page . User( the term client and user are used interchangeably ) enters the user credentials and is successfully logged in. If in a subsequent request, the client requests the same url (https://dev.to/new), server has no way of knowing that it has already authenticated this user and re-renders the login page.
#### Solution1
##### Session id
So as a solution to the above problem, the concept of session id was introduced wherein the server creates a new session when a client requests anything for the first time. It then  stores and passes the session id back to the client so that it can identify the client in case of any subsequent requests. Though it is a feasible solution and widely used, it has its own drawbacks.
##### Drawbacks
As the number of requests increase, there is a need for  increased scalability.
##### Vertical scalability
 Increase the number of resources for a server. It is an expensive solution
##### Horizontal scalability
Increase the number of servers.

Though the latter is feasible, the downside is that as you increase the number of servers, you need to put a load balancer in front of it which is responsible for request management. Now, the requests can go to any server irrespective of the client requesting it. So, if a user1 is authenticated with server1 and requests the same page again, and now the request goes to server2, some mechanism is need to tell server2 that user1 is already authentication. Hence, there is a need of storing the session ids in a database or in an alternate solution, keep the servers in sync at all times which comes with its own overhead.
#### Solution 2
##### JWT
For servers implementing JWT, there is no need of session storage. When a client requests a protected resource, server creates a JWT token and passes it to the client. JWT can contain user data along with other information in an encrypted format. Server does not store the JWT token, rather it stores the encryption key, so the next time user requests the same resource, server uses the key to decrypt and identify the client.
Hosting a Python Socket app?
Tags: python, socket, networking, server
Published: 2021-03-25 16:45:13

So, I'm doing a thing which is essentially a terminal emulator running on a server. People can connect over ncat/nc and interact from there.
The only dependencies are `socket` and `time`.
Is there a free, cloud hosting service that can do this? It isn't at all CPU intensive due to being very simple, and the entire thing is 64 lines of code, including blank lines for readability.
Cheers in advance.
Kotlin Emojis Riddle 😈
Tags: kotlin, riddle, bug, sanga
Published: 2021-03-25 16:36:26

What's wrong with this Kotlin code?

```
val emojis = listOf(“❤️️“, “🍔”)
val emojiIndex = someNullableInt ?: 0 % (emojis.size - 1)
val selectedEmoji = emojis[emojiIndex]
```

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

## Let's decompile it to java code:
```
List emojis = CollectionsKt.listOf(new String[]{“❤️️“, “🍔”})
int emojiIndex = someNullableInt != null ? someNullableInt : 0 % (this.emojis.size() - 1);
String selectedEmoji = (String)this.emojis.get(emojiIndex);
```

Can you see the problem now?



the answer is below, don't look straight away :)

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

## Answer: 
In case someNullableInt is not null, emojiIndex will be assigned with the original value of someNullableInt and not its modulo.
This can cause indexOutOfBoundException.

## how can we fix it?

the answer is below, don't look straight away :)

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

To fix it we need to add () around someNullableInt ?: 0 -> ``` val emojiIndex = (someNullableInt ?: 0) % (emojis.size - 1) ```

Which will compile to the following java code:
```
List emojis = CollectionsKt.listOf(new String[]{“❤️️“, “🍔”})
int emojiIndex = (someNullableInt != null ? someNullableInt : 0) % (this.emojis.size() - 1);
String selectedEmoji = (String)this.emojis.get(emojiIndex);
```

as you can see, now it will do modulo as expected. Case solved.

### Thank you for reading, look for our next Byte
_Made with ❤️ by [Sanga](https://www.sanga.app)_
Free Article on NLP Classification With Transformers
Tags: python, tensorflow, machinelearning, deeplearning
Published: 2021-03-25 16:28:46

https://towardsdatascience.com/multi-class-classification-with-transformers-6cf7b59a033a

[Free access here](https://towardsdatascience.com/multi-class-classification-with-transformers-6cf7b59a033a?sk=544872025c2283c54cf4294814b8cae3)

Transformers have been described as the fourth pillar of deep learning, alongside the likes of convolutional and recurrent neural networks.

However, from the perspective of natural language processing — transformers are much more than that. Since their introduction in 2017, they’ve come to dominate the majority of NLP benchmarks — and continue to impress daily.

The thing is, transformers are damn cool. And with libraries like HuggingFace’s transformers — it has become too easy to build incredible solutions with them.

So, what’s not to love? Incredible performance paired with the ultimate ease-of-use.

In this article, we’ll work through building a multi-class classification model using transformers — from start-to-finish.
Easy(ish) Language Classification With BERT in TensorFlow
Tags: python, deeplearning, datascience, machinelearning
Published: 2021-03-25 16:24:08

{% youtube pjtnkCGElcE %}

*Chapters for each section of the video (preprocessing, model build, prediction) are in the video timeline.*

Transformers have been described as the fourth pillar of deep learning, alongside the three big neural net architectures of CNNs, RNNs, and MLPs.

However, from the perspective of natural language processing - transformers are much more than that. Since their introduction in 2017, they've come to dominate a majority of NLP benchmarks - and continue to impress daily.

What I'm saying is, transformers are damn cool. And with libraries like HuggingFace's transformers - it has become too easy to build incredible solutions with them.

So, what's not to love? Incredible performance paired with the ultimate ease-of-use.

In this video, we'll work through building a multi-class classification model using transformers - from start-to-finish.
What's the difference between Coding and Programming?
Tags: healthydebate, discuss, watercooler, language
Published: 2021-03-25 16:03:43

---
title: What's the difference between Coding and Programming?
published: true
description: 
tags: healthydebate, discuss, watercooler, language
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kn6ufoyv1pckzo2ga0sv.jpg
---

There isn't a difference. They're two different words that mean the same thing. They can be used interchangeably in most contexts.

Like, sure, playing weird synthesizers is 'MIDI Programming' and you can't really swap it out for 'MIDI Coding' and you wouldn't call TV shows 'TV Coding' but in the context of work with software, yeah, they mean the same thing.

This happens all the time:

* Are you a 'developer,' a 'programmer,' or a 'software engineer?' It's an identical job at three different companies.

* I've yet to meet someone who can nail down the actual difference between UI and UX

{% twitter 700569863371227136 %}

* Which jobs are 'Ops' and which jobs are 'IT'? I feel like I've never worked in IT since I don't know how to set up a phone system, but I *have* worked at a company where the whole software team had `department: IT` printed on their paychecks

# how does this happen?

I'm not a linguist so I can't tell you why this happens in general. I will note this is not a specific issue to tech: words and terms that have the same meaning are so common [they wrote a book about it](http://www.gutenberg.org/ebooks/10681). What I can say is that part of the reason specific to text is marketing. It's just *so* tempting to try and label your product (which is kinda sorta similar to other stuff) as something so new and exciting it *deserves a whole new word*.

{% twitter 1370157889525014528 %}

User Interface? nah dog, we got a whole User *Experience*. We're like if a web page could also go paragliding with you on the beach.

Usually this doubling of terminology is kinda hard to spot: coders all have different jobs on different stacks so it seems like language differences must point to meaningful distinctions. Some programmers know how every version of a mobile browser renders the `<em>` tag, some know about limitations of a Unix file system. If you give those two people different labels, it sort of seems to make sense.

If you're unsure if this is right, try doing a find-replace of your terms and see if it reads right. If two words can be used interchangeably in the same context, guess what you've discovered a new synonym. 

Happy coding/programming!