teleren/devto huggingface dataset:
Implement a true "sleep" function in Node.js
Tags: webdev, javascript, node, sleep
Published: 2024-05-06 03:45:08

Node.js is a JavaScript runtime environment based on the Chrome V8 engine, utilizing a single-threaded, event-driven, and non-blocking I/O model. Since JavaScript is inherently single-threaded, the conventional thread sleep mechanism, such as Thread.sleep in Java, is not suitable for Node.js as it would block the entire event loop, thereby affecting the execution of all tasks.

However, if you wish to implement a "sleep-like" behavior without impeding the progress of other asynchronous operations, you can employ Promises along with setTimeout to simulate asynchronous waiting. This method allows the event loop to continue processing other tasks during the waiting period, emulating concurrent execution. Below is a straightforward example:

```
function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}


async function yourAsyncFunction() {
    console.log('Execution begins');
    await sleep(2000); // Simulates a "sleep" for 2 seconds
    console.log('Resumes after 2 seconds');
}

yourAsyncFunction();
console.log('This line prints immediately');
```

In this example, the sleep function returns a Promise that resolves after a certain number of milliseconds, enabling the use of the await keyword within an asynchronous function to "pause" without blocking the rest of the code. The statement console.log('This line prints immediately') executes right away, demonstrating the non-blocking nature.
I need help make a code with this
Tags: help
Published: 2024-05-06 03:32:47

The Travel Problem (TSP Problem) finds a cycle that goes through all classes, each class once, and returns to the starting point such that the Total Cost of the process is minimum.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t8o8cq5wauff5wxdb6vo.jpeg)
Caching is one of the Unsung Heroes of Application Performance
Tags: webdev, programming, performance
Published: 2024-05-06 03:30:00

Is your website feeling sluggish with all the visitors it's getting? If your database became the bottleneck then don't worry! I've got just the solution to speed things up. Check out our latest blog post where I explained how caching can make your website fast. Learn why it's important, what mistakes to avoid and easy ways to set it up.

{% embed https://lulaguide.substack.com/p/caching-is-one-of-the-unsung-heroes %}
Take stock of the easily overlooked functions of productivity application RunFlow
Tags: productivity, buildinpublic, development, tooling
Published: 2024-05-06 03:04:48

In this article, we will show you some functions which are easily overlooked but very practical of RunFlow.

> Don't know about RunFlow yet? [Start learning here](https://github.com/myrestop/myblog/blob/master/runflow_basic_point.md).

### Pin Action Window

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t49qebs7q51042k6omb3.gif)

> You can also toggle the window pinned state by double-clicking the `Ctrl` key, you can also customize this shortcut key on the `Hot Event` settings page.

### Preview The Result of The Menu

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aizmh1f8wngqbu48cu64.gif)

### Open The Copied URL From Your Clipboard In Your Browser

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f996v0q92wb2uaa6v9s7.gif)

### Input Multiple Lines

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4de53obr7thh1oeyp0wz.gif)

> Press `Ctrl+Enter` or `Shift+Enter` to start a new line.

### Pin Result

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1yj3vcj1hkvb074crswn.gif)

> Pinned results will always display at the front of the list.

### Thanks

This article takes stock of those functions that are easily overlooked but are very useful.
How to Start Learning JavaScript
Tags: webdev, javascript, beginners, programming
Published: 2024-05-06 02:04:00

Our first step is that well, we need to get started.

There is hundreds of possible courses out there, there are hundreds of tutorials.

All of them will work.

But if you want me to tell you exact recommendations, here are my two favorite ones.

The first one is absolutely free and it is called the Odin project.

This is what I personally started with back in the day because I was broke and I was following the freeway to start learning web development.

At the very least, I recommend you read like the first couple of sections because they are explanations of how the web works and all of this is really really excellent.

It is just text based article. But if you are looking for a free way to learn JavaScript, at this stage of your learning, you should go through the foundation sections of the Odin project, is absolutely excellent.

The second one which is my personal favorite is [The 2 Hour Web Developer](https://karlgusta.gumroad.com/l/eofdr/680bkf4) Essentially what this is, is a full course from completely zero to becoming a web developer.

And the thing that I always say is that it doesn't matter what resources you pick.

Just pick something that you resonate with.

Happy Coding!
Karl ⛹️

P.S. Congratulations on the guys that have joined yesterday and today. Welcome to the family! If you are new, [you can subscribe here](karlgusta.substack.com) and hopefully the family won't be full by then.
On Premise Face Recognition SDK and Liveness Detection SDK by FacePlugin
Tags: python, ai, machinelearning, datascience
Published: 2024-05-06 01:49:51

In today’s digital age, where security and privacy are crucial, on premise face recognition SDK and liveness detection SDK technologies play critical roles in protecting sensitive information and assuring the legitimacy of identities.

The importance of security and privacy in today’s digital environment cannot be emphasized. With the rise of cyber threats and data breaches, businesses must prioritize the security of sensitive information and the integrity of their systems.

On premise face recognition SDK and liveness detection SDK provide effective answers to these issues while ensuring user convenience and accessibility.

An on premise face recognition SDK includes the tools and algorithms required to incorporate face recognition features directly into local applications or systems.

Read full article here.
https://faceplugin.com/on-premise-face-recognition-liveness-detection-sdk/
Lotus365 Betting and Casino Site - Lotus 365 India Online
Tags: sport, casino, ipl, betting
Published: 2024-05-06 01:24:13

Lotus365, a limited liability company established under Curacao’s legal framework, advises players to avoid unauthorized sources for account creation. Our registration process is direct and independent, eliminating the need for intermediaries [Lotus365 App](https://www.lotus365service.com/).
Ricco Hải Dương cung cấp sản phẩm gạch ốp lát chính hãng giá tốt tại Hải Dương và Hưng Yên
Tags: webdev, javascript, beginners, tutorial
Published: 2024-05-06 01:18:48

Ricco Hải Dương phân phối các mẫu gạch ốp lát đẹp loại ưu đến từ các nhà sản xuất, thương hiệu nổi tiếng nhất hiện nay và phân loại sản phẩm rõ ràng
để khách hàng dễ dàng lựa chọn. Gạch ốp lát do Ricco Hải Dương cung cấp đã được tin tưởng sử dụng tại hàng nghìn công trình trên toàn quốc:
từ những công trình dân sinh đến những công trình trọng điểm, tầm cỡ lớn.
https://minhhaiplaza.wordpress.com/2023/12/19/ricco-minh-hai-nha-cung-cap-thiet-bi-ve-sinh-chat-luong-gia-uu-dai/
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jnqvx82le1qxr0qgwbck.jpg)
Información de Stack Overflow
Tags: python, devops, webscraping
Published: 2024-05-06 01:13:07

Este código está destinado a extraer información de la página de preguntas Stack Overflow y almacenarla en un archivo de Texto.

Importando las bibliotecas necesarias: `request` para hacer las solicitudes HTTP, `BeautifulSoup` de `bs4` para analizar HTML y `pandas` para manejar los datos en forma de Dataframe.

```
import requests
from bs4 import BeautifulSoup
import pandas as pd

# User agent para protegernos de baneos
headers = {
    "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/71.0.3578.80 Chrome/71.0.3578.80 Safari/537.36"
}

# URL Semilla
url = "https://stackoverflow.com/questions"

# Requerimiento al servidor
respuesta = requests.get(url, headers=headers)

# Paseo del arbol con beautifulsoup
soup = BeautifulSoup(respuesta.text)
# Encontramos elemento por ID
contenedor_de_preguntas = soup.find(id = "questions")
# Encontrar varios elemntos por tag y por clase
lista_de_preguntas = contenedor_de_preguntas.find_all("div", class_ = "s-post-summary")

# Crear una lista para almacenar los datos
datos = []

# Iteramos elemnto por elemento
for pregunta in lista_de_preguntas:

    # MÉTODO 1: Método tradicional
    # Dentro de cada elemento iterado encontrar un tag
    texto_pregunta = pregunta.find("h3").text 
    # Encontrar por clase
    descripcion_preguntas = pregunta.find(class_='s-post-summary--content-excerpt').text
    # Limpieza de texto
    descripcion_preguntas = descripcion_preguntas.replace("\n", "").replace("\r", "")
    print(texto_pregunta)
    print(descripcion_preguntas)
    print()

    # Agregar los datos a la lista
    datos.append([texto_pregunta, descripcion_preguntas])

# Agregar un DataFrame con los datos
df = pd.DataFrame(datos, columns=["Pregunta", "Descripcion"])

# Guardar el Dataframe como un archivo de texto txt
df.to_csv("preguntas_stackoverflow.txt", sep="\t",
          index=False)

# Imprimir el dataframe
print(df)
```
MMOexp: Diablo 4 players are axis on its already most-popular chic
Tags: games
Published: 2024-05-06 01:10:16

Diablo 4 players are axis on its already most-popular chic | MMOEXP　

Diablo 4 players are gradually allowance on <a href="https://www.mmoexp.com/Diablo-4/Gold.html">Diablo 4 Gold</a> the Archimage actuality the affliction chic in the absolute game.

Back in aboriginal June, aloof a few canicule afterwards Diablo 4 aboriginal launched, it was arise that the Archimage was the best accepted chic in the absolute game, somehow assault out the Necromancer. The tables admission now absolutely angry on the once-supreme chic though, as players are boring dubbing it the affliction chic in Diablo 4.

Just below, there's a amazing affidavit from a Archimage adept with over 330 hours put into their actualization so far. The chic is allegedly accepting a absolutely adamantine time allowance any Nightmare Alcove aloft Bank 70, and this accumulated with an allegedly underwhelming Apotheosis Lath agency this amateur is done with their Archimage chic until at <a href="https://www.mmoexp.com/Diablo-4/Gold.html">buy Diablo IV gold</a> atomic Division 2 or 3 of Diablo 4.

A Diablo 4 hotfix alleviative a ashamed ancillary adventitious could hit this anniversary | MMOEXP
How to Install Drozer using Docker
Tags: android, security, programming
Published: 2024-05-06 00:35:11



Drozer is a security testing framework for Android, which allows you to easily scan for vulnerabilities in Android components. Typically, this involves scanning activities, content providers, broadcast receivers, and services. In this article, you will learn how to install Drozer and connect it to a local Android emulator.

There are two components available for Drozer. The first component is the Drozer agent. This component is installed on your Android device. The Drozer agent acts as a server, running on port 31415. The Drozer client runs on any computer and it is designed to send requests to the Drozer agent. With these two components together, you can scan you Android applications for vulnerabilities. Let's get started with installing the Drozer agent!

## Installing the Drozer Agent

To connect to a device, Drozer uses an agent application. This application is available on the [Drozer repository](https://github.com/WithSecureLabs/drozer-agent/releases/latest). To install the agent on your device, first, download the agent APK. Once you have downloaded the apk, use adb to install the app using the following command:

```   
adb install drozer-agent.apk
``` 

After this command completes, locate the drozer agent application on your device. Tap the app to open it. The main app screen will provide you with the ability to start the Drozer embedded server. Tap the button labelled Off to activate the server.

The Drozer server runs on port 31415 of your device. To allow this port to be reachable, you need to forward the port using the following adb command:

```
adb forward tcp:31415 tcp:31415
``` 

Your drozer agent is now ready to accept connections from the drozer client!

## Installing the Drozer client

Drozer provides you with a variety of methods for installing the Drozer client. For this tutorial, we will use the Docker version of Drozer. To start, ensure that your have Docker installed on your computer.

You can install and run Drozer through Docker using a single command:

```
docker run -it --add-host host.docker.internal:host-gateway withsecurelabs/drozer console connect --server host.docker.internal
``` 

This command creates a connection between the Docker image and your local computer. With the connection created, it downloads the withsecurelabs/drozer image and runs the console connect command to connect to your local emulator. Once this is complete you will receive a shell that is connected to the Drozer agent! You are now up and running with Drozer.

## Learn More About Android Penetration Testing with OliveStem

Want to learn more about Drozer and Android penetration testing? Check out our [Android penetration testing course](https://olivestem.net/courses/android-penetration-testing)!
Rails Designer v0.11.0 released: new Command Menu
Tags: rails, tailwindcss, ruby, webdev
Published: 2024-05-06 00:00:00

[Version 0.11.0 was just released](https://railsdesigner.com/changelog/#0-11-0) with **three new components**!

Let's jump right into what's new at [Rails Designer](https://railsdesigner.com/):


#### 📦 New

- [Command Menu Component](https://railsdesigner.com/components/command-menu/)
 ![image.png](https://assets.buttondown.email/images/828fbebd-670f-4ac9-ace4-a2ec30723740.png?w=960&fit=max) 
- [Button Component](https://railsdesigner.com/components/buttons/)
- [Grids Component](https://railsdesigner.com/components/grids/)
 ![image.png](https://assets.buttondown.email/images/95cd4e0b-e8bf-4e2f-a0e2-e7a01efd4642.png?w=960&fit=max) 


#### 💅 Additions

- Added new [Tabs Component](https://railsdesigner.com/components/tabs/#messages) variant


#### 🎷🐛 Bugfix

- Fix icon comment on Modal Component variant


## From the Blog

- [ViewComponent over Turbo Stream Broadcasts](https://railsdesigner.com/viewcomponents-in-turbo-streams/)
- [Hidden Gems of Tailwind CSS](https://railsdesigner.com/hidden-gems-tailwind/) (this one was shared far and wide; **seeing thousands of visits**)! 🤯
- [How to Work with Forms inside Forms in Rails](https://railsdesigner.com/forms-inside-forms/)

## Other things

Last week I released a new gem: [rails_icons](https://railsdesigner.com/introducing-rails-icons/). It is an **icon library-agnostic gem**. And will soon be included by default in Rails Designer.

**Interested in sharing Rails Designer with the Ruby on Rails community? [Become an affiliate (and get 25% commision)](https://railsdesigner.com/affiliates/)!** 🤑
Good parts for good business
Tags: webdev, javascript, typescript, productivity
Published: 2024-05-05 23:49:23

1. Why bad parts exist?
2. Bad psychology:
- Use all features
- Feel swag in writing cryptic/magic code


Change title to: 
Engineering for Product market fit

https://excalidraw.com/#json=4uUA0hRxIpvuSSymw_S5v,nnQBwwkFyUBy4KfDHb3FFg
HOW TO CREATE WINDOW VIRTUAL MACHINE IN AWS & HOW TO CONNECT TO IT.
Published: 2024-05-05 23:18:07

## CLICK ON EC2 INSTANCE
## LAUNCH AN INSTANCE


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iwmq4meltp2lheynu3zp.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wgrjuqr3ln0s5xwwzjdh.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jqej5jxusi2g2anypjyg.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tg7vhmdd6rawk5gad92a.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ztc0z51je66gaud7n5hh.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wc93z0fjra8t6irzvc7q.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nu6xclhpku5q67p5pahv.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38vf62jkpw4l2ejjbn03.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uvm3kva3i8x9oe4mnky2.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m6ujy3qcllygg65bczoc.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fiwj248m0y8kmtdzlhuh.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p3opk27z6xmfmoqstf3t.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lee0fvz3354cequhf4xx.JPG)
Smoke for pseudo 3d arcade
Tags: python, pygame, retro, 2d
Published: 2024-05-05 22:56:20

Today I spent some time creating smoke for car sprites of my pseudo 3d racing arcade. Smoke is not obligatory stuff, but today I saw that my son (testing the game) like the appearing of the smoke very much. So I decided to pay more attention to it and made my best to draw it as good as I can. First of all I studied Pinterest to see how people draw drift smoke. I got couple of ideas, made couple of attempts and that's it! I have the smoke. Now I need to make second picture to animate it)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2dm0er8vnq1yvhxtrws.png)
Improve your content searching/filtering workflow productivity with regexp-it-cli
Tags: regex, node, cli, productivity
Published: 2024-05-05 22:33:32

## Involve regular expressions to solve different kind of tasks regarding text content

Let me introduce a nodejs library called [regexp-it-cli](https://github.com/akgondber/regexp-it-cli) - cli tool that provides content searching/filtering functionality by regular expressions. It has plenty of features, some of them will be highlighted in this post.

I am going to demonstrate some use cases where this tool would be applicable.

### Regexp playground

You can experiment with regular expression by passing some content as a source and executing your trial regular over it. For example, display only matched parts for specified regexp:

{% embed https://gist.github.com/akgondber/93b7a73686ddecc3210dabcab5771398 %}




### Show some content in slide mode

Have you ever wanted a find functionality without dealing with manually movement handling to the next match but automatically  see the next matches with some interval? Slide mode to the rescue! Use the `--slide-mode` option optionally providing also `--slide-delay` specifying a delay in seconds you'd like:

{% embed https://gist.github.com/akgondber/04d89904d0d9f0955076a1b66387f2da %}


### Filtering content between sections
You can use regexp in a source only after/before specified `--after-regexp` and `--before-regexp`:


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

{%embed https://gist.githubusercontent.com/akgondber/28ece2c49eacfa5377e8e24718d87ac2/raw/797699fa1c46f99fdac9ec19ec1ee3ef38dba438/playground.gif %}

### Displaying first and last match
Display only first/last match by providing the `--only-first-match` / `--only-last-match` flag

```bash
$ regexp-it-cli --url "https://raw.githubusercontent.com/inversify/InversifyJS/master/src/container/container.ts" --regexp "throw.*" -m -q --only-first-match
```

{% embed https://gist.github.com/akgondber/f74810cb34bb768c73ea695fb9cca6f6 %}

### Using predefined patterns

Use predefined patterns instead of specifying `--regexp` yourself by using `--regexp-pattern` option.

regexp-it-cli --file "samples/misc.txt" --regexp-pattern "urlLine" -e -m -q

{% embed https://gist.github.com/akgondber/0dfd09639ac229f3e728c128e6a76b9f %}


### Specify starting/ending line from a source to be used as a content

Apply filter to content that is going to be used a source for a regular expression by using the `--starting-line-number`, `--ending-line-number` options.

{%embed https://gist.github.com/akgondber/9fd57c0a5bf194673b366a49961f877c %}
Understanding the DOM: A short guide to web pages structure
Published: 2024-05-05 22:26:54

DOM, which stands for Document Object Model is a representation of a document (HTML) in a hierarchical form. It portrays a document using a tree-like model. Each element is viewed as an object and is related to other elements as parent or child. When writing HTML codes, there are elements that are placed under/within other elements. For example, an input element could be placed within a div tag. The Div tag acts as the parent while the input tag is the child. It should be noted that a parent element can have more than one child element in it. 
The illustration of the hierarchy level which DOM gives also makes it easy to manipulate the information and styles in an HTML document using a programming language like JavaScript or Python. The DOM gives accessibility to the element as an object, the properties, methods and events of the element. 
The document and its components are represented as nodes with the document itself as the parent nodes and the components as child nodes. These components could be elements, attributes or text contents.
As mentioned earlier, JavaScript, which is a scripting language, can be used to manipulate DOM. It has defined methods that can select any element using the tag name, class name or the id name. Using an example, I will be explaining how to select HTML elements.
Const elementName = document.getElementById(“idName”). This line uses an ID name to select.
Const elementName = document.getElementsByClassName(“className”) . Using classnames

Note that the code for ID has element while that for ClassName has elements. This is because an ID name can only refer to one element while ClassName can be used for a bunch for element with similar style. There are also other ways to find elements such as: getElementByTagName, querySelectorAll and others. 
Using a step-by-step guide, I will be demonstrating how to add a “p” element to an existing Div tag with a class name of “div”. 
1.	First step is to select the existing div element.
     const bigDiv = document.getElementsByClassName("div")
2.	Next step is to create a p element
        const paragraph = document.createElement("p")
3.	Then, create a text which will be in the paragraph
     const newText = document.createTextNode("This is a paragraph.")
4.	Append the formed text to the paragraph
     paragraph.appendChild(newText)
5.	Append the paragraph to the existing div
                     bigDiv.appendChild(paragraph)
 

I hope this short article is able to break down what DOM means and how it can be used. For more information, you can check out “W3Schools” or “MDNDocs”.
#1544. Make The String Great
Published: 2024-05-05 21:57:44

https://leetcode.com/problems/make-the-string-great/description/?envType=daily-question&envId=2024-04-05

```javascript
var makeGood = function (s) {
    const stack = [];

    for (const char of s) {
        if (
            stack.length &&
            Math.abs(char.charCodeAt() - stack[stack.length - 1].charCodeAt()) === 32
            ) {
            stack.pop();
        } else {
            stack.push(char);
        }
    }

    return stack.join('');
};

```