teleren/devto huggingface dataset:
How would you tackle this NodeJS project?
Tags: javascript, npm, nginx, devops
Published: 2021-05-19 15:11:26

Hello!

I work at a startup and have been working on a cool project NodeJS based project. Even though, it is a WordPress position, when I'm free, I take my time to work on interesting projects. Given what we're trying to achieve in this soon-to-be proprietary system, I noticed optimization issues with it. I tried bombarding the endpoints with 200 requests at a time and `pm2 monit` showed a few issues.

Before I talk about the pm2 stats, I would like to talk about what the system actually does. We sent a domain name to our endpoint, for example, say, dev.to. The endpoint makes an entry to database and it emits an event to analyze that website. The endpoint quickly does what it is supposed and sends back a 200 response but the process afterwards takes a lot of time as it involves HTTP requests a huge sets of things it needs to analysis the website for, a long with Puppeteer, potentially a lot of loops with hundreds, if not thousands of iterations.

What I talked about above, resulted in at almost 100% of CPU usage in PM2 stats, the heap was almost 100% too, EventEmitter gave us memory leaks warnings. Given that there is no queue or in-memory DS like Redis, I think the event loop was overwhelmed with 200 requests at the same time which involves a lot of processing! I'm not happy with the results and will present issues further down the road.

NOTE: Keep in mind that the slow process I am talking about takes place on an app level. The ExpressJS route only emits and event to start the process for that specific domain that it just saved into the database. I did this because there was no need to keep a user waiting for 10 seconds!

I discussed this with my boss and he encouraged me to take time and ask for help around the community. This is why I am here! Have you worked on such a project? If so, how did you handle it? What would you recommend me to do in this case? Should I go for cronjobs instead of event based system? Would really appreciate an answer.

Thank you! Also, if you have any questions regarding the project, let me know and I shall answer them.
How to run Redis on Windows
Tags: redis, windows
Published: 2021-05-19 16:06:31

1. Download Redis from here 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/155wys7phy8uadnq4daj.PNG)
2. Unzip zip file.
3. You will see redis-server.exe and redis-cli.exe
4. Run redis-server.exe by double clicking that.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gvd90w6eip7uimu0qc8q.PNG)
5. Minimize that windows and start redis-cli.exe
6. Type ping it should response pong.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4eevd9yw2lbkfafn5umy.PNG)
Java Vs JavaScript 
Tags: java, javascript
Published: 2021-05-19 15:44:44

Without wasting your valuable time, let's directly head over on the difference.

| No. | Java | JavaScript |
| --------- |:---------:| -------:|
| 1. | it is both compiled and interpreted language | it is compiled language|
| 2. | It is OOP **programming** language | It is OOP **scripting** language |
| 3. | It can runs on virtual machine as well as on browser also | it can only runs on browser |
| 4. | It is class based language and it cannot run without class | It is prototype based language |
| 5. | It is standalone language which is executed by the JVM (java virtual machine) that's need to be compilde into "byte code" | It is not a standalone language. It Must be placed inside an HTML document to function and executed by the web browser|
| 6. | It has the file extension as .java | It has the file extension as .js |
| 7. | It s strongly typed language means when we declare any variable we need to specified the data type. eg. int a; here 'a' will only store integer value.| It is loosely typed language means we need not have to specified the data type instead we need to write either var or let or const keyword.| 
| 8. | source code in this is hidden as it is compiled into the unreadable byte code. | The source code can be read by any person as it is written in plain text. |
| 9. | Java is developed by keeping "security of code" as the primary motive that can be achieved through JVM. | JavaScript is less secured and you have to make efforts to secure it's coding from the cross-site scripting. etc. |
| 10. | Java is mostly used in android development, backend web development and to create standalone application. | JavaScript is used in frontend as well as in back end web development. |

**Thank You for reading :>**
Job Search Update: 😔
Tags: watercooler, discuss
Published: 2021-05-19 15:38:54

## Context 

Last year I wrote a Dev.to post entitled [How long did you have to wait?](https://dev.to/jamesncox/how-long-35co).

I detailed my job application experience at the time, having applied to quite a few roles and receiving literally zero calls. It was a rough time, and I received a lot of great feedback from that article.

## Update

Fast-forward to now, 15 months after graduating bootcamp, and still unemployed: 

Yesterday I received a rejection email from a company I had been interviewing with for several weeks. This one really stung. 

I even [tweeted](https://twitter.com/MemRook/status/1394734126515859461?s=20) about it and was blessed with an incredible amount of support, feedback, and advice. 

This company had reached out to me. They wanted to hire several juniors and thought I would be a great fit. I was very transparent with my experience and they were transparent with their hiring process. I loved the company culture and thought this would be an ideal fit for both them and myself. 

I had to create a todo app for a code challenge, and I went above and beyond their criteria. I had so much fun with it, I even put it in my portfolio. Check out The Matrix Todo app here:

[![The Matrix Todo with the Matrix green scroll code as a background](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/70w7s5felohrx9byojt0.jpg)](https://the-matrix-todo.netlify.app/)

Yesterday they informed me they wanted more senior developers and that they appreciate my time and effort, but I was no longer in consideration.

## Conclusion

Looking for your first developer role can be incredibly stressful. It is a full-time job itself, and in many cases a mentally-draining grind that can often feel like there is no hope.

I want you to know that if you are in a similar situation, I see you. And I am here for you if you need to talk about your experiences or just rant about anything.

This post is meant to both offer insight and support for anyone else struggling to find their first role.

I believe that a big factor in finding your first role is about being in the right place at the right time. 

I want to thank everyone who has been so kind and supportive this entire process. Thank you to my community for always being there for me. 

If you feel alone, please know you are NOT alone. Reach out to me or someone you trust and I will help you connect with some great people who will embrace your journey and support you however they can. 

Let me know in the comments if you have any specific stories or experiences you would like to share. We need to lift each other up in these moments and realize that we are all in this together. 

Thank you for reading. Much love and respect ❤️🙏❤️🙏❤️🙏
LaTeX Images: Images and Files in another path
Tags: latex, codenewbie
Published: 2021-05-19 14:51:38

Hello, how are you? :)

Do you remember that we talked about figures, the `graphicx` package, and the `\includegraphics` command? 

Well, we were supposing that our images were on the same *level* of our document, it is, in the same folder. But what can we do if that is not our case, what if our image is in another folder? What can we do? There are three options, let's check them all

1. Images in the same level
2. Images in a folder that is inside the current folder
3. Images in a folder that is outside the current folder

> These situations also work with another kind of files, for example, other LaTeX documents, you just change the `\includegraphics` for the desired command

# Option 1. Images in the same level

If the image is at the same level, we just use the `\includegraphics` command in the usual way

```LaTex
\includegraphics{nameOfTheImage.extension}
```

# Option 2. Images in a folder that is inside the current folder

To illustrate this, we are going to suppose that the folder where the images are is called `Images`, so 

- Just one folder

```LaTeX
\includegraphics{Images/nameOfTheImage.extension}
```

- More than one folder

If our images are inside the folder `Images` which is inside `Fn-1`, and so on until `F1`

```LaTeX
\includegraphics{F1/.../Fn-1/Images/nameOfTheImage.extension}
```

Did you catch the idea? You need to put the name of ***all*** the folders until reach the folder where the image is

# Option 3. Images in a folder that is outside the current folder

The way that we tell the computer *to go back* is with `..`, yes, two dots `..`

> The `..` command goes back one level in our directory

Yes? Let me explain this with an example: 

Let's suppose that we are in the directory `Documents/MyFolders/LaTeX`, and that in `MyFolders` we also have the folders `Music`, `Pics`, `Videos` (and also `LaTeX`) but we are already there, so, if we are in `Documents/MyFolders/LaTeX` and we write `..` it tells to the computer *go back one level*, this is going to place us in `Documents/MyFolders` and now we can access any of the folders that are in that *level*, these are `Music`, `Pics`, `Videos` and `LaTeX`. Let's take this structure to illustrate the examples 

- Let's suppose we have our image *one level up* of our current folder, we need to write 

```LaTeX
\includegraphics{../nameOfImage.extension}
```

So according to our example, the image is in the `MyFolders` folder

- What happens if my image is in the `Pics` folder?, well if we are in the `LaTeX` folder we need to *go back* and then go tho the `Pics` folder, this is 

```LaTeX
\includegraphics{../Pics/nameOfImage.extension}
```

Did you catch the idea? You first need to *reach* the folder where is the folder which has the image and then go to the desired folder
Moving from senior developer to tech lead
Tags: career, development, senior
Published: 2021-05-19 15:33:36

Hello guys,

I need your advice about moving forward to a tech lead position. Now, I'm **senior .NET developer with 10 years of experience**. All my experience is focused on .NET stack. I'm supporting all my team mates and proposing good solutions for our daily problems. I have a good knowledge with algorithms, design patterns, Angular, databases, and so on. 

**Is it early to take this step? so, when should I say that "Now, I can say I'm a tech lead :)"**. Is it hard to be a tech lead, or it is just the same duties as supporting team mates? 

Thanks in advance for your help.
Understanding Docker: part 33 – Tools: Skopeo
Tags: docker, devops, beginners, cloud
Published: 2021-05-19 15:28:06

---
title: Understanding Docker: part 33 – Tools: Skopeo
published: true
description: Serie of sketchnotes about Docker. Explaining in a visual way Docker principles.
tags: Docker, DevOps, beginners, Cloud
series: Understanding Docker in sketchnotes
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g72vbtf9nd0nmctja0qx.jpg
---

Understanding Docker can be difficult or time-consuming. In order to spread knowledge about Cloud technologies I started to create sketchnotes about Docker. I think it could be a good way, more visual, to explain Docker (and other technologies like Kubernetes and Istio).

We continue the series of Docker sketchnotes with an useful tool: skopeo!

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

As usual, if you like theses sketchnotes, you can follow me, and tell me what do you think. I will publish others sketchs shortly :-).

If you are interested, I published all the sketchnotes on Docker (and new ones!) to make a "book" of 93 pages: ["Understanding Docker in a visual way"](https://gumroad.com/aurelievache#YTLzM).
Find Cheat Sheet
Tags: find, cheatsheet, os
Published: 2021-05-19 15:23:23


### Examples

```bash
find . -name '*.jpg'
find . -name '*.jpg' -exec rm {} \;
```

```bash
find . -newerBt "24 hours ago"
```

```bash
find . -type f -mtime +29 # find files modified more than 30 days ago
```
### Actions

```bash
-exec rm {} \;
-print
-delete
```

### Condition flow

```bash
\! -name "*.c"
\( x -or y \)
```

### Access time conditions

```bash
-atime 0           # Last accessed between now and 24 hours ago
-atime +0          # Accessed more than 24 hours ago
-atime 1           # Accessed between 24 and 48 hours ago
-atime +1          # Accessed more than 48 hours ago
-atime -1          # Accessed less than 24 hours ago (same a 0)
-ctime -6h30m      # File status changed within the last 6 hours and 30 minutes
-mtime +1w         # Last modified more than 1 week ago
```

These conditions only work in MacOS and BSD-like systems (no GNU/Linux support).

### Conditions

```bash
-name "*.c"
```

```bash
-user jonathan
-nouser
```

```bash
-type f            # File
-type d            # Directory
-type l            # Symlink
```

```bash
-depth 2           # At least 3 levels deep
-regex PATTERN
```

```bash
-size 8            # Exactly 8 512-bit blocks 
-size -128c        # Smaller than 128 bytes
-size 1440k        # Exactly 1440KiB
-size +10M         # Larger than 10MiB
-size +2G          # Larger than 2GiB
```

```bash
-newer   file.txt
-newerm  file.txt        # modified newer than file.txt
-newerX  file.txt        # [c]hange, [m]odified, [B]create
-newerXt "1 hour ago"    # [t]imestamp
```

### Usage
{: .-prime}

```bash
find <path> <conditions> <actions>
```

### Reference
* [Find Cheat Sheet](https://cheatsheetmaker.com/find) - [Cheat Sheet Maker](https://cheatsheetmaker.com)
Reflecting on writing tests
Tags: devjournal, womenintech, beginners
Published: 2021-05-19 15:13:45

During the last few weeks, I was occupied with writing tests for our application. My biggest surprise was to find that I enjoy writing tests. Now I can fully understand the importance of having tests in your application. Tests have the power to minimize the breaking changes to the app and helps to build a stronger application.

Personally, it helped me to understand the application we designed better. I can see now why writing tests make you a better developer. By writing tests and seeing that some of them have failed, we have improved our codebase. I also loved that writing tests give you the freedom to work independently on the part of the app you are testing. 

This time we didn’t follow strict TDD practices. First, we built the features, and now we are testing them. It gave us an advantage of seeing the App live. It’s not a common approach, but it provided us a better understanding  of what we are testing. 

Big shout-out to Arit for the opportunity to learn how to write tests and the importance of it, and sharing her love for writing tests. Her enthusiasm is very motivating.
Draw Entity-Relationship Diagrams (ER)
Tags: database, beginners, productivity
Published: 2021-05-19 15:11:56

### [DbDiagram](https://dbdiagram.io/home)
A free, simple tool to draw ER diagrams by just writing code.
Designed for developers and data analysts.
- Online
- It may import from MySQL, PostgreSQL, SQLServer and Rails(schema.rb)
- Enjoy the Efficiency of Writing Code: You type and an ER diagram appears. Your fingers never need to leave your keyboard.
- Generate SQL statements: Directly generate SQL statements to create your database tables.
- Export to Images and PDFs: Create beautiful PDFs of your ER diagram to circulate internally. Who says ERDs are so difficult to create?
- One Click Sharing Share your diagrams online with your colleagues and customers with just one click.
- Integrate with your SQL Databases: Quickly generate your diagrams from SQL dump files.
- Integrate with Popular Web Frameworks: Or if you use popular web frameworks like Rails or Django, simply upload your schema.rb or models.py file!
How to kill a process on localhost port on Ubuntu & Windows
Published: 2021-05-19 15:04:49

We'll be using port number 3000 as the example

# Ubuntu

### Option 1:
Step One: 
Get the process id
```
sudo netstat -lpn |grep :3000
``` ​
You will get an output similar to this 
```
tcp6  0  0 :::3000    :::*    LISTEN    1234/node
```
Step Two: 
Now that you have the process id - which is 1234 ​in this example
Kill the process using the code below
```
kill -p 1234  OR  kill -9 1234
``` ​
### Option 2:
``` ​
fuser -k 3000/tcp
``` ​

# Windows

Step One
Open up cmd.exe (we may need to run it as an administrator, but this isn't always necessary). Run the below command:
`netstat -ano | findstr :<PORT>`
``` ​
netstat -ano | findstr :3000
``` ​
The arrow shows the PID (process identifier). Locate the PID of the process that's using the port you want.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/re8h58cyjd6bgq4ftagh.jpg)

Step Two
`taskkill /PID <PID> /F`	
``` ​
taskkill /PID 4692 /F
``` ​

Step Three
You can check if the operation was successful by re-running the command in "Step 1". You shouldn't see any more search results for that port number.
#LearnInPublic
Tags: learninpublic, challenge
Published: 2021-05-19 14:58:14

Make it a point to learn at least one new thing a day. At _least_ one. Even if it feels like life has gone all topsy-turvy on you, your plans have gone awry, everything has been set on fire, and you just can't seem to get anything right — position yourself to learn that _one_ new thing... And aim to start today. I promise you, it will be well worth it.

I made a promise to myself to make learning a habit and to #LearnInPublic, sharing the tidbits of knowledge that I gain throughout my journey. I encourage you to do the same and to, whenever possible:

* Re-read your notes
* Teach others what you know
* _Write_ about the things that you've learned
* Take deep dives to boost your knowledge
* Apply what you learn
* Ask a lot of questions
* [#LearnInPublic](https://dev.to/t/learninpublic)
* Have fun!


--

_Image source: Horvath, Ferenc. December 9, 2017. https://unsplash.com/photos/4gKHjKG7ty4_
Numpy in Python.
Tags: python
Published: 2021-05-19 14:39:11

Introduction
Numpy which stands for Numeric Python is a Python library used for working with arrays. It also has functions for working in the domain of linear algebra, Fourier transform, and matrices.

NumPy was created in 2005 by Travis Oliphant as an open-source project and one can use it freely.

Why Numpy?
Numpy is a Python library that is written in Python, but the parts that require fast computation are written in C or C++. For this reason, working with Numpy array is much faster than working with Python lists.

Numpy being an open-source project has thousands of contributors working to keep NumPy fast, friendly, and bug-free. Numpy is hugely popular these days due to its use in various fields and tasks.

Uses of Numpy :
Numpy has numerous uses. Normal arithmetic and statistical operations are simple to implement Numpy. Various trigonometric calculations can also be done. Other uses are broadcasting, linear algebra, matrix operations, stacking, copying and manipulating arrays.
7 dicas para freelancers (muito importantes)
Tags: freelancer, freela, servicos, trabalhos
Published: 2021-05-19 14:35:32

Freelancer certamente não é para todos, mas para a maioria, pode ser a solução para melhorar o equilíbrio entre trabalho/vida pessoal ou se tornar o próprio patrão. Esteja você pensando em freelancer, apenas começando ou trabalhando por conta própria, aqui estão 7 dicas que todo freelancer deve empregar:

1. Calcule taxas e como cobrar
Sua taxa horária básica = (Salário mensal + despesas mensais + lucro mensal) / horas de trabalho faturáveis ​​mensais.

Mas, qual será a melhor escolha de cobrança do meu serviço ? Pesquise os prós e os contras de cobrar por hora ou por taxas fixas de projeto, diárias ou pacotes de preços.

2. Sempre tenha um contrato
Um contrato ajuda freelancers a solidificar várias coisas : a taxa negociada entre você e o cliente, os parâmetros e escopo do projeto, prazos, revisões ou cancelamentos de projetos e reembolso. Os contratos também ajudam a protegê-lo de possíveis questões jurídicas, divergências e garantem que você seja pago por seu trabalho. Você pode encontrar recursos para contratos em sites como LegalZoom.

3. Certifique-se de fazer o serviço somente após a plataforma acusar o pagamento.
Pode ser difícil estar lá sozinho. Portanto, você quer ter certeza de que receberá o pagamento por seu trabalho árduo. Antes de iniciar qualquer trabalho certifique-se de que o seu cliente tenha pago para o Freela Web  antes, poís nos somos a maior garantia para que você possa receber certinho! Não recomendado mas se você quiser pode enviar uma cobrança personalizada e receber ⅓ adiantado ⅓ na metade do projeto e o final ⅓ na conclusão, isto recomendado somente para valores mais altos, ou escolha outra porcentagem de pagamento que funcione melhor para você ou seu negócio. VER MATÉRIA COMPLETA www.freelaweb.com.br/blog
How to populate nested document in MongoDB.
Tags: mongodb, node, javascript, beginners
Published: 2021-05-19 14:20:06

Recently I run into a situation where I needed to fetch nested mongodb document data and wasted my 1 hour. If you are facing the same this is for you.

Here is the stackoverflow - [Populate nested array in mongoose](https://stackoverflow.com/questions/19222520/populate-nested-array-in-mongoose)


I used this query - 

```javascript
public courseListRead(): Promise<ICourse[]> {
    return this.courseModel.find().sort({
      index: 1
    }).populate('instructor').populate({
      path: 'categories',
      populate: {
        path: 'posts',
        model: 'CourseCategoryPost'
      }
    }).exec();
  }
``` 
To populate nested documents you have to use `.populate()` method like above.

I'm very beginner at MongoDB.

Thanks.