teleren/devto huggingface dataset:
A Note to All on Dev.to! I'm Thankful To Be Part of This Community!
Published: 2020-03-28 16:00:01

---
title: A Note to All on Dev.to! I'm Thankful To Be Part of This Community!
published: true
description: 
tags:
---

In our current situation across the world, and for the growing intensity of the situation here in NYC, technology continues to be a passion for me as I use it to help unwind, release stress, and connect with people everywhere. 

During 911, it was said that people were encouraged to go outside and bond with fellow NYers in the aftermath of what happened in the US that day. Community gives people the support, empathy, and courage to face the emotions that happen in these traumatic times.

That community for many of us has gone from our in-person activities to virtual ones. Happy hours, conferences, game nights, and catch-ups all through the screens of our favorite video conferencing software.

I'm thankful for having the dev.to community to help have that same bond and helping me to stay occupied in a time where I continually fight to resist the urge to go outside.

## Community

I have been absolutely ecstatic over the last year or so using this amazing community. 

The support for other developers with listings, help threads, discuss topics, and interesting articles is unmatched, and I have never felt so inclined to be part of the dev community before. 

I'm so happy to read other posts, learn and discover new ideas, all while trying to contribute my own as the web dev industry continuously innovates!

## Followers

To each of my followers (hard to believe I'm currently at 3,800!!), I'm humbled and grateful for each one of you for taking the time from your day to read an article I've written. I appreciate each and every one of you! Thank you!

I want you each to know, I'm here to help you with anything I can - from questions in direct messages to comments on posts for more details, or just an introduction to meet someone new - let's all grow together!

## What Would You Want to Read Next?

There are so many different topics to spend time writing about, especially as I have a bit more time on my hands. 

***I would love to hear what would you want to know more about?!***

Here are my current ideas - interested in any?
- My journey learning Angular for my new role, in-depth posts about the various topics within the framework
- Creating Gatsby Themes
- Javascript learning journey, from basics to advanced topics
- Stories from my career that have made me grow the most
- CSS learning journey, from basics to advanced topics
- Creating the "Perfect" web app
- Firebase with React
- What makes code good or bad? 

Please let me know in the comments! I would love to know how I can help you the most!

Stay safe!
เราไม่ทิ้งกัน.com ผมให้ผ่านครับ
Published: 2020-03-28 16:24:29

ระบบลงทะเบียน **เราไม่ทิ้งกัน.com** เพื่อรับเงินช่วยเหลือที่มีข่าวก่อนหน้านั้นว่าระบบได้ทำการทดสอบมาอย่างดีรองรับคนได้ 58,000 คนต่อ วินาที (ตัวเลขออกมายังสับสับว่าเป็น Con current หรืออะไรแน่) เมื่อเริ่มเปิดบริการก็พบว่าระบบให้บริการล่มไม่สามารถให้บริการได้ เมื่อเช็คดูพบว่าเป็นปัญหาที่ระบบการสร้าง Captcha  ดังรูป ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/yjb21ltfvw1ob8oavy75.png) 
ส่วนตัวคิดว่าตรงนี้ทีม Dev ไม่ได้ทำ Loadtest ที่ดีพอ ซึ่งใครก็พลาดกันได้ หลังจากนั้นระบบก็รวนไปกันใหญ่มีการหลุดหลังบ้านให้ Error ออกมาดังรูป 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wh8r94y6qbq1j55lipap.jpg) 
คล้ายๆว่าจะ config ผิดไม่มี key ส่งไปให้ S3 อันนี้สร้างความงุนงงให้กับคนเฝ้าติดตามมาก เพราะตามที่เห็นระบบทำงานอยู่บน Gcloud แน่ๆสุดท้ายก็พบว่าไม่มีอะไรในกอใผ่มันไม่ใช้ AWS S3 หรอกมันคือ GCS ซึ่งเขาก็ทำ error response ให้ complat กับ S3 แหละ 
หลังจากนั้นไม่นานสภานการณ์ก็ดีขึ้นกลับมาให้บริการได้อย่างเต็มรูปแบบ แม้ว่า Captcha ยังมีปัญหาอยู่บ้างซึ่งถ้าดูกราฟจากที่พี่สมคิดโพสต์จะเห็นได้ว่า api captcha ทำงานกนักมากดังรุป 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nsy5jxohk3c1qtq2nsv6.png)
แต่ที่ยังเป็นปัญหามากกว่าคือ OTP ทาง SMS ซึ่งผมว่าอันนี้น่าจะอยู่นอกเหนิอการควบคุมมีทั้งไม่ส่งหรือส่งช้าจะ Expire ไปกลับมากรอกไม่ทัน 
จนถึงตอนนี้เห็นโพสต์ล่าสุดผ่าน 7 ล้านไปแล้ว 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/v2uc97n6xlposi8aicjo.jpg)

ในฐานะ Dev คนนึงการกู้ระบบใหญ่ขนาดนี้กลับมาทำงานต่อได้ใน 2 ชม. และรองรับการลงทะเบียนจำนวน 7 ล้านคนได้นี่ผมคาระทีมงานเลยครับต่อให้ขวัญต๋งกับงักเยทำศึกก็ไม่เกินนี้ เต็ม 10 ผมให้ 9 สรุปว่า  ผมให้ผ่าน ครับ   
 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ru2568hzkqyl7tw35vrl.jpg)
Gérer un projet agile avec Gitlab
Tags: gitlab
Published: 2020-03-28 17:03:18

Définir les types de spécification fonctionnelle


L’ Issue est la notion centrale pour définir une spécification. J’ai choisi de les catégoriser en plusieurs types avec des Labels :

Epic: C’est une macro-fonctionnalité discutée et qualifiée avec les parties prenantes. L’Epic a un format libre et peut être accompagné de wireframe. On affecte un label Ready lorsqu’elle est entièrement validée par le client.

Story : C’est une fonctionnalité discutée et partagée avec l’équipe. Elle est liée à une Epic et suit les critères INVEST. peut avoir du contenu riche comme des liens vers d’autres Issues ou des sous-tâches ou conditions à cocher.



Task : C’est une tâche technique proposée par l’équipe nécessaire à la réalisation d’une Story. Elle suit les critères SMART.
Bug : C’est un problème relevé par l’équipe découvert en cours de développement et qui ne peut être résolu rapidement. Elle nécessite une repriorisation dans le backlog avec le PO.
Organiser le backlog
Gitlab permet de définir des Boards. Le principe est d’afficher un tableau de colonnes appelées Lists qui correspondent chacune à un Label. Nous pouvons faire des glisser-déposer pour modifier le statut d’une Issue. Nous définissons deux Boards, un pour le backlog produit, l’autre pour le backlog de développement.

Le backlog produit s’organise autour des Epics. Il est priorisé avec les labels de statut de la manière suivante :



High,Medium et Low : J’ai défini trois niveaux de priorisation mais cela peut être différent pour votre contexte. Il convient également de limiter le nombre d’EPICs importants et urgents.

- Backlog : Une Epic en High passe en Backlog lorsque son périmètre est délimité avec un label Ready et le développement est confirmé avec le client. Ce n’est qu’à ce moment que l’Epic est discuté avec l’équipe et décomposé en Stories.

Rejected : Il est important de garder une trace des idées formulées mais non retenues. L’Epic est généralement clôturé lorsqu’il est rejeté.

Le backlog de développement s’organise autour des Stories. Il est organisé avec des labels de statut sur l’état de développement :


Backlog : Cette liste est partagée avec les Epics ce qui permet de faire la transition entre les deux backlogs. On met un label Draft lorsque la Story est encore en cours de rédaction.

To Do : La Story ou la Task ou le Bug est au préalable discuté, estimée et assignée. Il convient de la prioriser en fonction des dépendances de développement.

Doing : La Story ou la Task ou le Bug est en cours de réalisation par l‘Equipe. Test : La Story ou la Task ou le Bug est développé par l’Equipe, il doit être vérifié par un autre membre de l’Equipe puis par le PO.

Une fois la Story validée par le PO, l’Issue est fermée.

source : https://medium.com/innovation-sandbox-fr/g%C3%A9rer-un-projet-agile-simplement-avec-gitlab-d942193b52c1
JS Delivery Best Practices?
Tags: javascript, discuss
Published: 2020-03-28 21:58:23

At my current company we build our js with rollup, package it, and then publish it as a versioned package to a self-hosted repo. No built files are committed to git. We use lerna to publish canary builds during dev. For prod we manually run a build process to publish the full prod version.

Recently some coworkers at my company have suggested this process is too complicated. One in particular is pushing for us to commit built/generated files straight to git. Now I know this is bad practice, and I've simply accepted this without really thinking about why. Looking around for info hasn't turned up much. One solid point is that you're setting yourself up for consistent merge conflicts since every merge should contain a newly built version of the project. If the project has been touched since you branches then your built files will conflict with the newly built files in the original branch.

What do you guys think? How do you deliver your js? Why is it bad practice to commit js files to git?
Linux Test Session with $top [unedited]
Published: 2020-03-29 06:21:06

###$top
-Shows live processes currently running
-Only shows processes for a certain period of time (Like a drawback)
-The **$ps** command fails to show trend of processes that are being swapped in and out of memory; thus **$top** command
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1do502zst62sz6onwiin.png)

#First Line:
Shows general system information
-Current time
-How long the system has been up
-The number of users logged in
-The load average

*more about the load average:
The load average is displayed in three different time marks:
- 1-minute
- 5-minute
- 15-minute

It's not uncommon for the 1 minute mark to be high, but if the 15 minute mark is high then system is in ***trouble***

_If load average starts getting over 2, it generally is high value. But it is also subjective to the system and the processes being run._

#Second line
The second line shows general process info (called tasks)
-Running process
-Sleeping process
-Stopped process
-Zombie process (Process has stopped but parent has not responded)

#Third line
The third line shows general CPU utilization info broken down into several categories (Eg system process vs user process etc)

#Fourth and Fifth line
Shows system memory stat: used, free etc


##Finally
The detail list of currently running process.

##PID
The process ID of the process
##USER 
The user name of the owner of the process
##PR 
The priority of the process
##NI
The nice value of the process (This is used to determine priority)

##VIRT
The total amount of virtual memory used by process 
Virtual memory is created taking space of actual physical/secondary memory called swap space.

##RES
The total amount of physical memory used by the process

##SHR
The amount of memory the process is sharing with other processes
##S
The process status:
- D Interruptible sleep
- R Running
- S Sleeping
- T Traced or stopped
- Z Zombie

##%CPU
The amount of CPU time the process is using

##MEM
The share of available physical memory the process is using

##TIME+
The amount of CPU time the process has used since starting

##COMMAND
The command line name of the process (programs started)




#Press f while $top is running to get additional interactive menu
Quarantine Days Of A Developer Without PC
Tags: python, datascience, writing, womenintech
Published: 2020-03-29 13:56:11

This is the story about stucking in my mom’s house without my own computer. It’s a sad story but I can handle it , right now.
At the beginning of the March ,I was in Istanbul and my mom’s voice was not okay on the phone. My elder brother and I was worried about her . Because she has chronic heart disease. So , suddenly I decided to go to visit her. It just happen spontaneously. I bought the earliest ticket I can find and get in the bus.
 	I bought the earliest ticket I can find and get in the bus. I was so rushed. So i couldn't pick up the PC bag .
	Generally, there is no problem at the beginning. It was a little vacation for me after the deadline of big projects and the other exhausting things. After two weeks , COVID-19 epidemic started and influenced the whole country. At that point, there was no choice to get back to Istanbul. I was stuck in to my mom’s house without my PC. 
	Fortunately, I had backed up my projects via cloud services before the disaster. So, I have somethings to work but not good enough. There is my old computer in the house. I had to setup the all IDEs I use on it. Some of the packages didn’t work and made me crazy. Anaconda Navigator runs too slowly and 32bit version’s UI is kind a weird.
	These days , I am trying to stay calm and do some python exercises on spyder.I will data visulations and write some articles about Data Science soon

Wish me luck
Improving a snippet of code
Tags: java
Published: 2020-03-29 14:39:25

---
title: Improving a snippet of code
published: true
description: I show ways in which I believe one method in a class could be improved.
tags: java
---

While working on an Open Source project, I came across this piece of code:

```java
public void clear() {
        Object[] items = this.items;
        for (int i = 0, n = size; i < n; i++)
            items[i] = null;
        size = 0;
    }
```

I thought this was a great opportunity to share how it might be improved.

Notes: 
* Size is a field declared in the class.
* For simplicity, I have replaced `T[]` with `Object[]` in this article. This is a parameterized class in the source code.

# 1. Braces around the loop

Although Java will happily compile the code, braces should wrap the for loop:

```java
public void clear() {
        Object[] items = this.items;
        for (int i = 0, n = size; i < n; i++) {
            items[i] = null;
        }
        size = 0;
    }
```

This clarifies that `size = 0;` is not contained within the loop.

# 2. A redundant local variable

The class declares a field called `items`, which is an Array of Objects. This method starts by assigning that Array to a local variable, also named `items`, which is then used in the loop.
However, there is no reason that this field cannot be referenced from within the loop, therefore making the local variable redundant:

```java
public void clear() {
        //Object[] items = this.items;
        for (int i = 0, n = size; i < n; i++)
            this.items[i] = null;
        size = 0;
    }
```

# 3. Another redundant variable, within the loop

In this style of `for` loop in Java, 3 things are defined in the parentheses - a variable or variables to be used within the loop (usually `i`), a condition for determining if the loop should continue, and finally how the loop should progress.

In this particular code, a local variable `n` is declared and assigned to the `size` field. This is then used in the end condition - the loop shall only execute while `i` is less than `n`.

Cutting out the middle man, this is effectively saying that the loop shall only execute while `i` is less than `size`, and so, we can simplify the code:

```java
public void clear() {
        Object[] items = this.items;
        for (int i = 0; i < size; i++)
            items[i] = null;
        size = 0;
    }
```

# Bringing the changes together

To recap, we started with this block of code:

```java
public void clear() {
        Object[] items = this.items;
        for (int i = 0, n = size; i < n; i++)
            items[i] = null;
        size = 0;
    }
```

After our changes, this is simplified and clarified to:

```java
public void clear() {
        for (int i = 0; i < size; i++) {
            items[i] = null;
        }
        size = 0;
    }
```
What are the small things you've automated?
Tags: discuss, automation, coding, devhabits
Published: 2020-03-29 16:19:49

Sometimes I feel like a magician because as a developer, I get to build whatever comes to my mind - whether it's a new product or a small script to automate tedious activities. The latter is what I'd like to ask you, awesome peeps, about. But first...

## My story

I've been working on my new [developerHabits Youtube channel](https://www.youtube.com/channel/UCJLZwePkNHps5Bv7VwISyTA). Additionally, I finally opened an [Instagram account](https://www.instagram.com/p/B-Ud6K8nW5f/), where I plan to post tips&tricks about development and habits.

As I wanted the posts to look nice, I created a template in Sketch for all my short-text posts.

![Instagram posts](https://dev-to-uploads.s3.amazonaws.com/i/fu5scotnxrml2qbonhi4.png)

After creating 2 of those images I found it's time-consuming to change the text, export the file and start again...

**So as a true developer, I created a script to automate this job.**

What it does:
- Reads an array of texts
- For each text element, replaces my Sketch template's placeholder text
- Saves the file as a .png

![Making life easier through automation](https://dev-to-uploads.s3.amazonaws.com/i/ijj1a6jdeichcaob19qx.png)

So now all I have to do is just...come up with quality content!

It took me just about an hour, but when I finally finished, I was really happy, as it's something real and saves me time in the long run.

That leads me to my question...

## What are the small things you've automated to make your life easier?
Python: Pros and Cons of Lambda
Tags: python
Published: 2020-03-31 15:33:40

---
title: Python: Pros and Cons of Lambda
published: true
date: 2020-03-29 15:36:00 UTC
tags: Python
canonical_url: https://coderscat.com/python-pros-and-cons-of-lambda
---

![2020_03_29_python-cons-and-pros-of-lambda.org_20200330_002955.png](https://coderscat.com/wp-content/uploads/2020_03_29_python-cons-and-pros-of-lambda.org_20200330_002955.png)

Figure 1: Photo by Z S on Unsplash

## Basics for lambda

`lambda` is a keyword in Python, we use it to create an anonymous function. So we also call lambda functions as anonymous functions.

But what’s anonymous functions?

Normal function defined like this:

```python
def sum_two(x, y):
    x + y

print(sum_two)
print(type(sum_two))

#<function sum_two at 0x10f54eb18>
#<type 'function'>
```

From the result, **sum\_two** is the name of the defined function, it’s type is ‘function’.

Compared to normal function, anonymous function is a function without a name:

```python
print(lambda x, y: x + y)
print(type(lambda x, y: x + y))

#<function <lambda> at 0x108227f50>
#<type 'function'>
```

## The benefits of lambda

But, why we want a function without a name?

Because **naming is too damn hard**! Think about how much time you spent on naming(variables, functions, classes) when you are programming.

In fact, not all functions deserved a name.

Some functions are used temporarily and we don’t need them later. We use a lambda function to saving time for naming and get better readability.

Suppose we need to add 2 to each element in a list, instead of use normal function:

```python
def add_2(x):
    return x + 2

lst = [3,5,-4,-1,0,-2,-6]
map(add_2, lst)
```

We could use `lambda` to finish the same computation in one line:

```python
map(lambda x: x +2, lst)
```

This is simplicity. We can write a lambda function with no hassle.

There are other functions like `filter`, `reduce`, `sorted`, they receive lambda function as a parameters.

## The pitfall of lambda

The purpose of `lambda function` is to improve the code’s readability. So if the logic of a function is not simple, we should not use lambda.

A simple rule is: **don’t use lambda for the functions whose lengths are more than one lines**.

Think about this code snippet, could you understand this code easily?

```python
f = lambda x: [[y for j, y in enumerate(set(x)) if (i >> j) & 1] for i in range(2**len(set(x)))]
```

Obviously, this code is difficult to understand. The intention of this code is to get all the subsets from a `set`.

```python
a = {1, 2, 3}
print(f(a))
# [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]]
```

In this case, we should use a normal function with a proper name:

```python
def powerset(s):
    N = len(s)
    result = []
    for i in range(2 ** N):
        combo = []
        for j, y in enumerate(s):
            if (i >> j) % 2 == 1:
                combo.append(y)
        result.append(combo)
    return result

print(powerset(a))
```

The post [Python: Pros and Cons of Lambda](https://coderscat.com/python-pros-and-cons-of-lambda) appeared first on [Coder's Cat](https://coderscat.com).
Natty Theme
Tags: vscode, design, theme, extension
Published: 2020-03-30 14:07:39

### It's like snazzy but natty

I'm a big fan of the [iterm2-snazzy](https://github.com/sindresorhus/iterm2-snazzy) colours, but I never found a nice port to vscode that I could stick with in the long run so I decided to make my own

Natty has a darker background for higher contrast and doesn't make much use of red — as I like to think red should be for errors — I am still thinking of what else to customize but it's in good shape for general use already

### Here's some previews 🎨

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

### Where next

Little details really bother me, so eventually I would like to have a much stronger level of customization and tweaks on things like punctuation, operators, language specific quirks and editor specific controls

I would also love to have this be a shared theme among many other development tools I use

I am open to contributions, suggestions, feedback and help. Feel free to check it out on [GitHub](https://github.com/this-fifo/natty-theme) and the [vscode marketplace](https://marketplace.visualstudio.com/items?itemName=this-fifo.natty)

☺️
Suggestion for developing web pages with HTML
Tags: html, productivity, devlive, webdev
Published: 2020-03-29 17:29:42

The process for designing a web page is much more complex than simply knowing and writing code in this language. Actually, many web developers write it without having yet understood its **philosophy** and its true utility in the web creation process.

Why do i say this? Well, when I started designing web pages and learning about this language, I did it indiscriminately, without respect. My only wish was to move quickly to CSS to make sense of everything I had created in HTML. As the years have passed, I have learned the importance of paying true attention to this language, because by doing so, I greatly shortened my development time.

I think if you are a beginner (or not) and you think it makes no sense to spend a lot of time taking care of your HTML code, you should continue reading this post. So, what should you consider in your next web project?

-   Use semantic tags correctly. Remember that HTML was created to  **describe the structure of the information**  of a web page (not the presentation). That is the true purpose of HTML.  
    
-   Do **not**  **saturate** the code with  **unnecessary divs.**  Before you start coding, preview your design using a sketch or wirefrime and visualize it as boxes, select the necessary containers for your design, you will see that they will not be as many as you imagine.  
    
-   My advice is to  **always think of your code as reusable**. For this case, the  **BEM methodology**  will be your ally and the one that will avoid thousands of problems with your CSS. Creating reusable components will make your life easier in your current project, and in future ones.  
    

They are only recommendations for my colleagues and new members in the world of web development. And how I always say:  **Practice makes perfect.**
【WordPress】同じカテゴリ内でランダムに関連記事生成
Tags: wordpress
Published: 2020-03-30 06:12:20

```
<div class="newcontentarea">
<?php
$categories = get_the_category($post->ID);
$category_ID = array();
foreach($categories as $category):
  array_push( $category_ID, $category -> cat_ID);
endforeach ;
$args = array(
  'post__not_in' => array($post -> ID), // 今読んでいる記事を除く
  'posts_per_page'=> 6,
  'category__in' => $category_ID,
  'orderby' => 'rand', // ランダムに記事を選ぶ
);
$query = new WP_Query($args);
if( $query -> have_posts() ): while ($query -> have_posts()) : $query -> the_post();
?>
<div class="newcontentarea2">
<a href="<?php the_permalink();?>">
	<div class="newcontentarea3">
		<div class="innerarea">
			
	<?php if(has_post_thumbnail()): ?> 
    <?php the_post_thumbnail(); ?>
<?php else: ?>
    <img class="lazyload" data-src="★★NOIMAGEパス★★" alt="no image">
<?php endif; ?>
	<h3><?php the_title();?></h3>
		</div>
</div>
	</a>
 </div>       
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>

</div>
```