teleren/devto huggingface dataset:
Improve your programming skills with 2 beers!
Tags: programming, productivity, startup, jokes
Published: 2021-07-22 16:03:21

Alas! Imposter syndrome is real… One day, it hit me so hard I said, “Enough is enough. I have to do something about it.” So, I started going through Reddit, Youtube and every other platform that’s ever existed, looking for ways to be a ‘better programmer’. Hours of scrolling and all I could find was Leetcode, practice and other stuff you’d find everywhere. I wanted to give up until I came across the Ballmer Peak.

> The theory that computer programmers obtain quasi-magical, superhuman coding ability when they have a blood alcohol concentration percentage between 0.129% and 0.138%.

![Drunk Programmer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ksg3lyu4iivek5muiob.jpg)
[Photo by thom masat on Unsplash]
That’s what Urban Dictionary has to say about this. In layman’s terms, drink two beers and becoming a literal programming god. Honestly, I don’t believe in this. Any sane person would know that you’d find programmers laying drunk on-campus of many of the tech giants the moment they set up a bar next to the cafe.
A little bit of googling may prove otherwise. Some articles have even compared booze to Popeye’s spinach! Steve Ballmer, is an incredibly energetic guy (not kidding check out his retirement speech). You’d think that with all this energy he’d have to spend a lot of time letting it out of him but instead he used to sit around, observing people (and himself). This constant observation led him to see the effects of this graph:

![Ballmer Peak](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dtpeu3ad1wh3fqicdaj9.png)
source: http://ballmerpeak.web.elte.hu
As we can infer from the graph given, moderate alcohol consumption does yield a notable increase in creative output. If we remove the typing out of it, programming is just creativity with computer software. The language is your paint, the functions you use, your style and the billions of devices capable of running the code, your canvas.
In my opinion, whenever people drink alcohol their brains tend to be unable to focus on things at hand which makes them carefree. If a person has a carefree attitude, they may not worry about the future and tend to take bold steps like trying out the wildest solution to fix the code.
This is a pretty cool phenomenon, would I try it before coding rounds? Certainly not. But if you wanted an excuse to drink beer you’ve got it :). Additionally, if you’re interested in maintaining the blood alcohol levels check this out: https://github.com/alexcrist/ballmer-peak.
Day 9: Uping the problem rating
Published: 2021-07-22 16:01:49

---
published: true
series: Competitive Programming
title: 'Day 9: Uping the problem rating'
---

### Disclaimer:
> I am a beginner in competitive programming, and this is me documenting my learnings. So, anything I say is just what I think at the moment and should not be taken as hard truths.

### Problem 1: [Taxi](https://codeforces.com/problemset/problem/158/B)


```cpp
using vi = vector<int>;

#define all(x) begin(x), end(x)
#define forn(i, n) for(int i = 0; i < n; i++)

main() {
  int n;
  cin >> n;
  vi v(5, 0);
  forn(_, n) {
	int g;
	cin >> g;
	v[g]++;
  }
  // every four will require one car
  int four = v[4]; 
  // every three will require one car
  int three = v[3];
  // it can take groups of one too
  v[1] -= min(v[1], v[3]);
  // a car can take two groups of two and change
  int two = v[2]/2 + v[2]%2;
  int rem = v[2]%2;
  v[1] -= min(v[1], rem*2);
  int one = v[1]/4 + (v[1]%4 != 0);

  int ans = one + two + three + four;
  cout << ans;
}
```
The above solution was the first accepted solution I could come up with.

This one is more cleaner [Greedy Approach]
```cpp
using vi = vector<int>;

#define forn(i, n) for(int i = 0; i < n; i++)
#define all(v) begin(v), end(v)
#define endl '\n'

main() {
  int n;
  cin >> n;
  vi v(n);
  for(auto& e: v) cin >> e;
  sort(all(v));
  int i = 0, j = n-1;
  int ans = 0;
  while(i <= j) {
	int curr = v[j];
	while(i < j && curr+v[i] <= 4) {
	  curr += v[i++];
	}
	j--;
	ans++;
  }
  cout << ans;
}
```

### Problem 2: [Interesting Drink](https://codeforces.com/problemset/problem/706/B)

I was initially afraid to solve the problem seeing `dp` in the tags. But then I hid the tags, and went for the 
problem. lol.

Just check the number of places whose booze price is less than or equal to the price the man can pay.
Binary Search.

```cpp
using vi = vector<int>;

#define forn(i, n) for(int i = 0; i < n; i++)
#define all(v) begin(v), end(v)
#define endl '\n'

main() {
  int n;
  cin >> n;
  vi v(n);
  for(auto& e: v) cin >> e;
  sort(all(v));
  int q;
  cin >> q;
  forn(_, q) {
	int p;
	cin >> p;
	auto it = upper_bound(all(v), p);
	cout << distance(begin(v), it) << endl;
  }
}
```

## Algorithm

We didn't learn any new algorithm today.
How to Get Project Ideas to Practice JavaScript
Tags: javascript, webdev, beginners
Published: 2021-07-22 15:58:45

**Practising is, by far, the best way to learn JavaScript.** No matter if you read hundreds of articles or watch dozens of courses, you need to practice coding to really learn. However, for many beginners, it's hard to come up with ideas. Which ideas or projects should I create to practise?

**Create simple clones of your favourite websites or web applications**. That's what I've always done to practice coding when I was younger. **If you're at the very early stages of your learning journey, copy only the basic functionality.** For example, if you want to build a Reddit clone, just make it display the posts of a single subreddit.

A good source of projects ideas is VanillaJSProjects.com. This site was created by developer [Chris Ferdinandi](https://gomakethings.com/), and has 21 project ideas that you can try. Even though they are intended for Vanilla JavaScript, you can make the projects using any UI framework or library. [You can access the project list here](https://vanillajsprojects.com).

## What If a Project Becomes Too Hard?

That could be discouraging, but **don't worry. Just make the project simpler!** You can go back to it later.

In this case, practising programming is like working out. If you go to the gym for the first time, you start lifting small weights. Little by little, you'll become stronger and you can increase the weights.

If you're starting out, start doing small things. If you are consistent, **these simple projects will become easier over time**, and that's the time to increase the difficulty a bit.

---

Become a Better JavaScript Developer! My newsletter has easy, actionable steps to level up your JavaScript skills, right to your inbox. [Click here to subscribe](https://nicozerpa.com/newsletter)
my view of dev.to
Published: 2021-07-22 15:30:43

we have chance to turn this into a good society environment i fled facebook because of the developer toxicity and others things from what I learned is:
this becomes what we make it i saw a post where the op blamed dev.to but the truth is we all make what it is. if we just be good and help each other this can be our own haven for coders and tech lovers to share views and projects instead of everything going on the world. I hope this helpes
Convert Multiple AWS Instance Store Volumes into Single Volume using LVM
Tags: aws, cloudskills
Published: 2021-07-22 13:24:02


Step 1: Launch EC2 Instance with Instance type “d2.xlarge”. 
●	“D2.xlarge” comes with 3 instance store Volumes, Each volume having “2TB” Volume.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/or5lxe17mkmorj91cabp.png)

●	We can check volumes in the servers with command lsblk
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dvfglirh74iw0srj4xpe.png)
  
Step 2: Initialize devices to use with the LVM in order to do this, we need to use the pvcreate command.

●	pvcreate is used to initialize disk or partitions that will be used by LVM
●	It can either initialize a complete physical disk or a partition on physical disks.
 ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ravkdcv947xqopb7m7by.png)
 
Step 3: Display device attributes for this, we need to use the pvdisplay command to display information about physical disks. # pvdisplay 
 ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c9j76lovdk5u8u0zy2t1.png)
 
Step 4: Create the LVM volume group. Once the devices are initialized, we can create the LVM volume group.

●	A group of physical volumes or disks are combined together into a single storage file which is referred to as the LVM volume group.
●	For this, we used the vgcreate command to create a volume group by providing the name of the volume group and the path of actual physical volumes.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vj52ryrc1jegt28hm7y7.png)
  
●	Command “vgscan”, which scan all disks for LVM volume groups. 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0rtzhf4w4g3zp4okk7f.png) 
 
Step 5: Create logical volume from the logical volume Group.
 ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0t2b7x35c2xws5hqlmb4.png)
 
●	Once the logical volumes are created, we can view their status using the “lvdisplay” command.
 ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p7387ps5b98do6oz4qr8.png)
 
Step 6: Format your logical volumes. Once the logical volumes are created, we can format them using any filesystem like ext4, XFS, and more.
 ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l002y5k2ygzqeij9b1te.png)
 
Step 7: Mount newly created logical volume to /opt
 ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ufdprpx493todj6gmg6v.png)
Here's why software engineers choose Linux over Windows for programming
Tags: linux, programming, beginners, codenewbie
Published: 2021-07-22 15:06:31

This articles was firstly published on my [own](https://blog.suhailkakar.com) blog [here](https://blog.suhailkakar.com/heres-why-software-engineers-choose-linux-over-windows-for-programming)


I was a big fan of Windows OS, and have been using it for years because it is user-friendly, well-designed, and convenient. However, since I started programming I found that a Linux distro (such as Ubuntu, Manjaro, and Arch) is the best Operating System to start with.

In this article, I am going to share, why I most of the software engineers choose Linux over Windows for programming



1. ### Pre-installed Compilers
The primary reason behind the popularity of Linux is the availability of compilers or interpreter. You don't have to download them yourself. On the other hand, Windows does not come with pre-installed compilers.

2. ### Open Source
Unlike Windows OS which is commercial, Linux is an open source software that is freely available to download. There are hundreds of Linux distributions available out of which almost five-hundred distro are in active development.

3. ### Community Support
All newcomers can find help on any of the Linux forums. If you are stuck somewhere in your development process or need help in your coding process, just Google it and you can find several Linux based helpful resources.

4. ### Performance
Linux is much powerful and versatile than Windows. It is light-weight OS, which makes it faster than Windows. You will notice a significant improvement in speed on a Linux distro when you start working it.

5. ### Secure
Linux is considered to be more secure than Windows. No antivirus is needed. Since it is open source, several developers are working on it and everyone can contribute code. It is likely that someone will find a vulnerability long before hackers can target a Linux distro. 

6. ### Shell
If Linux does not have what you need, you can still get all the functionalities that you need from the command line. Simply enter the command and it will atomically download and install the package. Which saves a lot of efforts.
Dart - Comments
Tags: dart, flutter, programming
Published: 2021-07-22 15:03:18

The comments are notes that developers can add in source code and are ignored by compilers. It's an **art** of describing what your code does and may be why. These comments are not evaluated.

It increases the code readability for other developers as well as self that allows to provide information of what tricky things are done within the code for better understanding and maintenance.

In this article, we will look into different types of comments supported by Dart.

The comments in Dart can be done in following different ways:

- Single-line comments `//`
- Multi-line comments `/* ... */`
- Single-line Doc comments `///`
- Multi-line Doc comments `/** ... */`

## Single-line comments in Dart

Single line comment can be done by **`//`** i.e **double slash** or **double forward slash**.

```dart
// this is a single-line comment
```

## Multi-line comments in Dart

Multi-line comment also known as **block comment**. It can be done by **`/* ... */`**.

```dart
/*
  this is a multi-line comment
  we can also wrap code that is quite useful during debugging or development
*/
```

Dart [guide](https://dart.dev/guides/language/effective-dart/documentation#dont-use-block-comments-for-documentation) suggests us to single-line comment `//`. The block comment `(/* ... */)` should only be used **temporarily** to comment out a section of code.

## Single-line Doc comments in Dart

Doc comments parsed by [dartdoc](https://github.com/dart-lang/dartdoc) generates [beautiful doc pages](https://api.dart.dev/stable) from them. A comment is any comment that appears before a declaration is called as Doc comment.

**Doc comments also supports Markdown formatting**

Single line Doc comment can be done by **`///`** i.e **triple slash** or **triple forward slash**.

You can find usage of it in [dart:io](https://github.com/dart-lang/sdk/blob/master/sdk/lib/io/io.dart) library available on GitHub

```dart
/// this is a single-line comment
```

## Multi-line Doc comments in Dart

Multi line Doc comment can be done by **`/** ... \*/`\*\*. Below is an example of multi-line Doc comment.

```dart
/**
  * ** Important:** Browser-based apps can't use this library.
  * Only the following can import and use the dart:io library:
  *   - Servers
  *   - Command-line scripts
  *   - Flutter mobile apps
  *   - Flutter desktop apps
  */
```

Read the complete post on our site [Dart - Comments](https://meshworld.in/dart-comments/)

Read others post on our site [MeshWorld](https://meshworld.in)

Hope you like this!

Keep helping and happy 😄 coding
UI Dev Newsletter #66
Tags: html, css, javascript, a11y
Published: 2021-07-22 14:43:07

- [The performance effects of too much lazy-loading](https://web.dev/lcp-lazy-loading/)
Rick Viscomi and Felix Arntz share data-driven advice for lazy-loading images with Core Web Vitals in mind.


- [Meta Theme Color and Trickery](https://css-tricks.com/meta-theme-color-and-trickery/)
Manuel Matuzović explores the possibilities of a 'theme-color' meta tag.


- [Why Accessibility?](https://dev.to/colabottles/why-accessibility-26mf)
Todd Libby explains why accessibility should be an equal citizen of your project.


- [Designing a chair: A story about Junior vs. Senior Designers.](https://uxdesign.cc/designing-a-chair-a-story-about-junior-designers-vs-senior-designers-24be40b1d2cb)
Stan Reimgen explains the difference between junior and senior designers, which could be applied to developers.


- [Lexical grammar](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar)
MDN contributors describe everything about JavaScript's lexical grammar from control characters and white space to automatic semicolon insertion and browser compatibility.


- [Why I am not the King](https://www.kevinpowell.co/article/why-i-dont-like-being-called-the-king-of-css/)
Kevin Powell shares a lot of helpful CSS resources and professionals in his humble post.


- [Trends Come And Go, But JavaScript Is Forever](https://www.dottedsquirrel.com/javascript-language/)
Aphinya Dechalert explores a little into the history of JavaScript and its good and bad parts.


- [Frustrating Design Patterns: Broken Filters](https://www.smashingmagazine.com/2021/07/frustrating-design-patterns-broken-frozen-filters/)
Vitaly Friedman describes how to design better filters on the web.



Happy coding!

[Subscribe to the newsletter here!](https://buttondown.email/starbist)
5 machine learning project in less than 5 minutes using Github Co-Pilot.
Tags: showdev, watercooler, machinelearning
Published: 2021-07-22 14:41:13

#### Github Copilot is a AI pair programmer build and developed by Github.

**I have used Copilot and build 5 computer vision and natural language processing machine learning based projects and it take me hardly less than 5 minutes.**

You can see this video, where I have live demonstrated that.

#### [5 ML project in less than 5 minutes.](https://youtu.be/5XMf4p1i8Jk)

Do comment, if you have any doubt.
Thanks for reading.
ERR_CLEARTEXT_NOT_PERMITTED from Android WebView
Tags: errors, android, webview
Published: 2021-07-22 14:12:37

If you're seeing that kind of error: ERR_CLEARTEXT_NOT_PERMITTED when trying to open a localhost url into Webview in Android then you need to allow that to be possible opening, here's how to do it:

You need to create that xml file into res/xml:

```xml 
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>
```

and after that in AndroidManifest.xml you need to add:

```xml
    <application
        ...
android:networkSecurityConfig="@xml/network_security_config"
```

It's done.
#COPYING OF ELEMENTS FROM ONE ARRAY TO ANOTHER ARRAY
Published: 2021-07-22 14:08:37

#Initialize array     
arr1=[]
l=int(input("enter the length of the list :"))
print("enter list elements")
for i in range(0,l):
    n=int(input("enter numbers "))
    arr1.append(n)

     
#Create another array arr2 with size of arr1    
arr2 = [None] * len(arr1);    

#Copying all elements of one array into another    
for i in range(0, len(arr1)):    
    arr2[i] = arr1[i];     
     
#Displaying elements of array arr1     
print("Elements of original array: ");    
for i in range(0, len(arr1)):    
   print(arr1[i]),    
     
print();    
     
#Displaying elements of array arr2     
print("Elements of new array: ");    
for i in range(0, len(arr2)):    
   print(arr2[i])
COPYING ELEMENTS FROM ONE ARRAY INTO ANOTHER ARRAY
Published: 2021-07-22 14:02:01

#Initialize array     
arr1=[]
l=int(input("enter the length of the list :"))
print("enter list elements")
for i in range(0,l):
    n=int(input(" "))
    arr1.append(n)

     
#Create another array arr2 with size of arr1    
arr2 = [None] * len(arr1);    

#Copying all elements of one array into another    
for i in range(0, len(arr1)):    
    arr2[i] = arr1[i];     
     
#Displaying elements of array arr1     
print("Elements of original array: ");    
for i in range(0, len(arr1)):    
   print(arr1[i]),    
     
print();    
     
#Displaying elements of array arr2     
print("Elements of new array: ");    
for i in range(0, len(arr2)):    
   print(arr2[i])
Install a specific version of a dependency for Npm, Pip, Gem, and more
Tags: programming, devops, npm, go
Published: 2021-07-22 13:57:21

**Package managers** are commonly used in software development in order to benefit from existing dependencies such as open-source libraries. *npm* is our favorite tool at [Promyze](https://promyze.com?utm_source=DevTo&utm_medium=referral). While developers often use associated manifest files to list external dependencies, they can also use the **command line version** to install a dependency. Common questions in such cases: how to install a specific version of a library? Should we use symbols such '@', '^', '=' or something else? 

This post is a quick reminder for how to achieve that for several package managers. 

## APK (Alpine)
```bash
apk add mysql-client=10.5.11-r0
```

## APT (Ubuntu/Debian)

```bash
apt-get install mysql-client=8.0.19-0ubuntu5
```

## Composer (PHP)

```bash
composer require amphp/mysql:2.1.0
```

## Gem (Ruby)

```bash
gem install mysql -v 2.9.0
```

## Go Modules (Go)

```bash
go get -u github.com/go-sql-driver/mysql@v1.6.0
```

## Npm (JavaScript/Typescript)

```bash
npm install mysql@2.18.1
```

## Nuget (.NET)

```bash
nuget install MySql.Data -Version 8.0.26
```

## Pip (Python)

```bash
pip install mysqlclient==1.4.0
```

## Yarn (JavaScript/Typescript)

```bash
yarn add mysql@2.18.1
```

Feel free to comment to add your suggestions, we'd be glad to update the post !
Road To An Internship - Grinding Period [3/3]
Tags: javascript, typescript, tailwindcss, codenewbie
Published: 2021-07-22 13:53:36

Hey folks!

This is the last part of my "Road to an Internship" series, we'll be continue talking about my Grinding Period and the my discovery of new technologies. If you haven't read the previous parts, be sure to check them out:
- [Starting Off](https://blog.codechem.com/road-to-an-internship-starting-off-03)
- [Moving On](https://blog.codechem.com/road-to-an-internship-moving-on-13)
- [The Rough Break](https://blog.codechem.com/road-to-an-internship-the-rough-break-23)


### Grinding Period 💪

As I was finishing the last project I started getting more involved in the developer communities and I met [Lazar](https://nikolovlazar.com/). Still to this day, he's one of my biggest inspirations - his portfolio website inspired and truly astonished me. I peeked around and I love what he does for programmers and he gave me a lot of tips on what technologies to learn and improve on. It motivated me a lot when I met other hardworking developers who are working through their problems just like me. 

Like always, I decided to start a pet project, but this time it was special - I recreated my website  [Andrej's Tunes](https://andrejs-tunes.herokuapp.com/) using Next.js, Tailwind and I decided to move on from Javascript to Typescript. You can find the source code  [here](https://github.com/aacevski/andrejs-tunes). It was quite a productive period and I was very happy with the outcome.

After the positive feedback, I started getting interested in new technologies, some of the frameworks I was experimenting with were: 
- [Blitz.js](https://blitzjs.com/)
- [Strapi](https://strapi.io/)
- [Amplification](https://amplication.com/)

Then I decided to apply for my internship at [CodeChem](http://codechem.com/) where there was an Open Day. CodeChem's Open Day is the first event I attended hosted by a programming company but it was genuinely fun. We had a challenge - it was to recreate the game Bejewled. I had a lot of fun and after some time, I secured the long awaited internship.

### Final Words 🙌

I hope I managed to motivate some junior developer who're struggling with their code right now. With a lot of love and persistence - you can truly learn any technology, framework or anything - really. On top of that, this was a fun way of me to look on how I've improved these past months and I know that the fire within me won't stop burning anytime soon!