teleren/devto huggingface dataset:
Maximizing the Power of Child Processes in Node.js: Real-world Examples
Tags: node, javascript, webdev, programming
Published: 2023-01-13 15:12:44

Node.js is a popular open-source JavaScript runtime that allows developers to build scalable and high-performance web applications. One of the most powerful features of Node.js is its ability to handle child processes. Child processes allow you to spawn new processes, run shell commands, execute scripts, or even fork multiple processes to handle a heavy workload. In this blog post, we will discuss how to use child processes in Node.js and provide real-world examples of how they can be used to improve the performance and scalability of your application.

## Using the Child Process module
The built-in `'child_process'` module in Node.js provides several methods for spawning and managing child processes. The most commonly used methods are 'exec', 'spawn', and 'fork'.

'exec' method: This method allows you to...Read more:

{% embed https://bracketorbits.vercel.app/post/maximizing-power-child-processes-nodejs-real-world-examples %}
What was your win this week?
Tags: discuss, weeklyretro
Published: 2023-01-13 15:10:10

Hey folks! 👋

Hope y'all all have fabulous weekends!

Looking back on this past week, what was something you were proud of accomplishing?

All wins count — big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Fixing a tricky bug
- Shooting hoops 🏀

---

![Michael Jordan's final dunk in Space Jam... he's flying through the air from half court while the Monstars are grabbing his legs and trying to pull him down. His arm stretches out like a cartoon and he kinda dunk-shoots it into the goal right as the buzzer goes off to end the game.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l08z5v9ka4yrfdzbmnj8.gif)
Pass Arguments As An Object in JavaScript
Tags: javascript, tutorial, webdev
Published: 2023-01-14 22:17:18

---
title: Pass Arguments As An Object in JavaScript
published: true
date: 2023-01-13 15:00:25 UTC
tags: javascript,Javascript,tutorial,webdev
canonical_url: https://www.jenniferbland.com/pass-arguments-as-an-object/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/79qls6oam2cs0ue0zkeo.png
---

When you learn to program in JavaScript, you learn to name the arguments that you pass into a function. I am going to show you why you should pass your arguments to a function as an object. Once you see why you will never go back to naming every argument you pass into a function. I promise you.

## Example of naming arguments

I have a function called `createBook`. The function takes 6 arguments:

- title
- subtitle
- author
- publisher
- datePublished
- descr


<!--more-->

Here is an example of my function and how you would call it:

```javascript
const createBook = (title, subtitle, author, publisher, datePublished, descr) => {
  // code goes here
}

createBook('Make 7 Real World Apps in Vue 2', '', 'Jennifer Bland', 'Gumroad', '2022', 'Learn how to create 7 real world apps using Vue 2');
```

If you were to look at this code, you would not have any idea what each of these arguments was much less know the correct order in which you have to enter them.

## Passing Arguments As An Object

I can make your life easy by showing you how to pass arguments as an object. Here is what it looks like:

```javascript
const createBook = ({ title, subtitle, author, publisher, datePublished, descr }) => {
	// code goes here
}

createBook({
	author: 'Jennifer Bland',
	publisher: 'Gumroad',
	title: 'Make 7 Real World Apps in Vue 2',
	descr: 'Learn how to create 7 real world apps using Vue 2',
	datePublished: '2022'
	subtitle: ''
});
```

Now when you come across this code, it is clear what parameters are being passed to the function. Bonus: you don't have to worry about the order of the arguments since we are using destructuring in the function.

## Buy My Book

I did write a book titled 'Make 7 Real World Apps in Vue 2'. If you are interested in reading it, you can [get it on Gumroad](http://https://jenniferbland.gumroad.com/l/CMnHu?_gl=1*icqykf*_ga*OTY3ODk1ODQwLjE2NzI1Mzk2MDU.*_ga_6LJN6D94N6*MTY3MzEwNTg0Ny40LjEuMTY3MzEwNzEwMy4wLjAuMA.. "get it on Gumroad").

## Let's Connect

Thanks for reading my article today. If you like my content, please consider [buying me a coffee](https://www.buymeacoffee.com/JenniferBland) ☕.
The Benefits of Building Blockchain Applications with Python.
Tags: blockchain, web3, python, programming
Published: 2023-01-13 15:00:00

The innovative technology of blockchain has recently been getting a lot of attention. Transactions on a blockchain are recorded and verified in a distributed digital ledger. It is used in a wide variety of fields, from banking to medicine, to name just two, to ensure the safety and efficacy of data storage and transaction processing.

Numerous applications, including blockchain apps, have been developed using the Python programming language. Python’s high-level language structure and adaptability make it ideal for designing blockchain applications. Python’s library and framework support for building smart contracts, digital wallets, and decentralized applications simplifies the process of making blockchain-based applications (DApps).

Cryptocurrency exchanges, decentralized exchanges, and distributed ledger technology (DLT) apps are just some of the blockchain-based applications built with Python. It can also be utilized in the creation of DLT solutions for distributed, secure data storage and tracking. Python is also utilized to create artificial intelligence (AI) based solutions used in blockchain applications, such as fraud detection and increasing the veracity of transaction records.

Blockchain applications written in Python can be made more reliable and resistant to hacking than older methods. By using Python, programmers may make business-friendly apps that are more robust, safe, and affordable. In addition, Python’s accessibility makes it a popular choice for building blockchain-based apps.
Building GUI Applications with Python.
Tags: programming, python, beginners, gui
Published: 2023-01-13 14:56:35

Python is an excellent language for developing GUI apps due to its power, flexibility, and ease of learning. The built-in modules and functions in Python make it easy to create basic graphical user interfaces. Python’s Tkinter package offers a robust set of resources for creating graphical user interfaces. To make GUIs, developers turn to Tkinter, a library of modules. With this package, Python users can take advantage of a powerful and portable windowing toolkit that works with any OS.

Create forms, menus, dialog boxes, and more with Tkinter’s graphical user interface building blocks. Tkinter also has many UI elements, or “widgets,” from which to choose when developing a user interface. Tkinter additionally offers event support for actions like mouse clicks and key presses.

Not only Tkinter, but a plethora of other GUI frameworks and utilities have been developed for Python. Qt is a well-liked graphical user interface (GUI) framework that works on a variety of operating systems besides Windows and Mac OS X and Linux. The Qt library can be used with the Python language thanks to PyQt. PyGTK is a widely used graphical user interface library that supports the GNOME desktop. wxPython is yet another well-liked GUI package for developing GUI programs that run on several platforms.

The Python programming language is ideal for creating graphical user interfaces. Python makes it simple to construct robust and aesthetically pleasing GUI apps thanks to its straightforward syntax and abundance of GUI tools and frameworks.
Protect Your System from Install Scripts in npm packages
Tags: npm, node, javascript, security
Published: 2023-01-13 14:40:25

Fellow developers, utilizing open source dependencies in your projects can bring many benefits, but it's important to be aware of the potential dangers as well. One hidden risk to watch out for are **Install Scripts**. 

Install scripts are scripts that run automatically when a dependency is installed and can be used for tasks such as transpiling source code and fetching remote resources. However, they can also be used to execute malicious code on your system, potentially stealing data, encrypting files for ransom, or launching other attacks.

Using install scripts is a common method for spreading malware via npm packages, so it's essential to take extra precautions to protect yourself from malicious install scripts.

## Blocking Install Scripts to avoid malware
Although it's possible to disable install scripts in package managers like npm, they by default automatically execute Install scripts automatically by default.

### Option 1 - do it manually
One way to block install scripts and avoid malware is to disable them manually by using `npm install --ignore-scripts`. However, this may be a challenge to enforce for an entire company or across all environments.

![Block Install Scripts Policy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/094ctk303g39jd0uenr2.png)


### Option 2 - automatic enforcement for an entire company
Another option is to use a **Dependency Firewall**, such as [Bytesafe](https://bytesafe.dev), which allows you to quarantine unwanted open source packages with vulnerabilities or non-compliant licenses. The platform provides a policy engine where you define the open source usage and security rules and the Dependency Firewall does the enforcement.

The security policy **Block Install Scripts** for npm firewalls and registries can block all npm packages with pre- and post-install scripts, allowing you to use packages with confidence knowing they have been reviewed for potential security risks.

Keep in mind, packages may depend on install scripts, so some initial review work may be required.
What Does the AWS CDK Bootstrap Command Do?
Tags: aws, cdk, awscdk, bootstrap
Published: 2023-10-27 07:50:53

---
title: What Does the AWS CDK Bootstrap Command Do?
published: true
date: 2023-01-13 14:30:44 UTC
tags: #aws #cdk #awscdk #bootstrap
canonical_url: https://blog.mikaeels.com/what-does-the-aws-cdk-bootstrap-command-do
---
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/13vixseii7ed1m5z6le3.jpeg)
The AWS Cloud Development Kit (CDK) is a software development framework for defining cloud infrastructure as code. The CDK Bootstrap command is a key part of the CDK tooling that sets up your AWS environment to use the CDK. In this post, we'll explore what the CDK Bootstrap command does and provide an example of how to use it.

When you first start using the CDK, you need to run the Bootstrap command to set up your environment. This command creates a CloudFormation stack in your AWS account that contains the necessary permissions and resources for the CDK to deploy your infrastructure. The command is typically run once per AWS account and region.

The CDK Bootstrap command creates an S3 bucket and an IAM role that are used to store the CloudFormation templates that the CDK generates. The command also creates a set of permissions that allow the CDK to create and manage resources in your AWS account. The IAM role created by the bootstrap command is named `AWSCDKBootstrapRole` and it has permission to create, update, and delete CloudFormation stacks, as well as read and write to the S3 bucket.

When you run the bootstrap command it will show you the details of what it will create and prompt for confirmation before creating it.

Here is an example of how to use the CDK Bootstrap command to set up an environment for the `us-east-1` region:

```
cdk bootstrap --region us-east-1

```

It's also possible to pass an explicit profile name, as well as other parameters.

```
cdk bootstrap --profile my-profile --region us-east-1

```

<mark>Note</mark>: The bootstrap command requires AWS CLI credentials to be configured and it will use the default profile if no profile is specified.

Additionally, it's important to mention that, this command will also create a CloudFormation Stack named `CDKToolkit` which contains the necessary permissions and resources for the CDK to interact with your AWS environment.

In this post, we've discussed what the AWS CDK Bootstrap command does and provided an example of how to use it to set up your AWS environment for use with the CDK. The bootstrap command is a critical step in getting started with the CDK and should be run before you deploy any CDK infrastructure.
Master the Basic Art of Making HTTP Requests with Javascript
Tags: javascript, webdev, beginners, tutorial
Published: 2023-01-13 14:21:03

You can use the fetch() function to make HTTP requests in JavaScript. The fetch() function is a modern way to make HTTP requests in JavaScript, and it's supported by most modern browsers.

Here's an example of how you can use fetch() to make an HTTP GET request to an API endpoint:

```Javascript 
fetch('https://api.example.com/endpoint')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error))
```


This example makes a GET request to the specified API endpoint and logs the response data to the console. The response.json() method parses the response data as JSON, and the .then() method is used to handle the response data asynchronously. The .catch() method is used to catch any errors that occur during the request.

You can also use fetch() to make POST requests, or requests with other HTTP methods, by specifying the method in the options object that you pass to fetch(). For example:

```Javascript 
fetch('https://api.example.com/endpoint', {
  method: 'POST',
  body: JSON.stringify({key: 'value'}),
  headers: {
    'Content-Type': 'application/json'
  }
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error))
```


This example makes a POST request to the specified API endpoint with a JSON payload in the request body. The Content-Type header is set to application/json to specify the format of the request body.
Welcome to SURGE, A cryptic dystopian world.
Tags: webdev, web3, blockchain
Published: 2023-01-13 14:06:25

Surge is an Anime PFP Collection that features lore-based digital collectibles. Commenced as a vision inspired to provide value-driven digital collectibles that fixate on filling the gap between Web2 and Web3. The surge will impact the building of an educational hub alongside anime fans that will magnetize web2 individuals to the adaptation of WEB3 through our IP. Our emphasis on building yourself rather than spoon-feeding will remain active until we build a vigorous community. Your bandits grant you access to a community divided into 4 Syndicates, each accommodating a purpose in the cryptic city of Surge. The project is founded by the experienced individuals of WEB3 space with immense prosperity in their careers. Surge is backed by WEB2 investors, which consist of businessmen across the world, and WEB3 professionals, which range from economists to technical analysts, and advisors to provide the best home for holders. The surge will be building a community to train 5000 professionals that will dominate the space. Syndicates originated as a community that serves a purpose, wherever you may go you will be known by your origins.

We are thrilled to share that we have recently received an outpouring of positive feedback on social media. Our community has been praising our efforts and the positive impact we have had on their lives. [SurgeNFT](https://twitter.com/TheSurgeNFT)
Paracetamol.js💊| #197: Explica este código JavaScript
Tags: spanish, webdev, javascript, programming
Published: 2023-01-13 14:00:00

## **<center>Explica este código JavaScript</center>**
#### <center>**Dificultad:** <mark>Básico</mark></center>

```js
const f= (arr) => {
  return arr.reduce((acc, item) => {
    return `${acc}${item}`
  },'')
}

console.log(f(["h","o","l","a"]));
```

A. `["hola"]`
B. `["h","o","l","a"]`
C. `hola`
D. `aloh`

Respuesta en el primer comentario.

---

Respuesta:
C. `hola`

Cuando estamos aprendiendo el método `reduce` de javascript siempre recomiendo hacernos una pequeña tabla:

| iteración | acc    | item |
|-----------|--------|------|
| 1ra       | `''`   | `h`  |
| 2da       | `h`    | `o`  |
| 3ra       | `ho`   | `l`  |
| 4ta       | `hol`  | `a`  |
| 5ta       | `hola` | -    |

Ahora si podemos ver iteración por iteración que es lo que ocurre en el ejercicio. Con el tiempo y la practica no será necesario recurrir a una tabla.

Cosas a tener en cuenta:
* `acc` empieza como una cadena vacía.
* Usamos **template literals* de ES6 para la concatenación en el cuerpo del `reduce`.
times(n, fn) in JS/TS + Python.
Tags: javascript, beginners, cleancode, programming
Published: 2023-01-13 13:59:01

Hey! Did you know that in JS not only null and undefined but some ephemerical **_<u>empty</u>_** value is existing? :) 

But let's first talk about not very common, but few times appieared in the real life during my programming career.

Let's take a look on a different implementations of a function when we need to do something N times in a row (i.e. generate random chars by executing provided algorithm).

I will introduce some score system to more easily describe pros and cons of the solutions such as readability and efficiency with score rate from 1 (no) to 5 (yeah!). 

#### Using _pad_ function and array spreading

```javascript
const times = (n, fn) => [...''.padEnd(n)].map(fn);
```
_readability_: **2** - it's readable, but after some time :) 
_efficiency_: **2** - everytime is a new array created, spreading functionality, _padEnd_ function, _map_ function

#### Array Array
```javascript
const times = (n, fn) => Array.from(Array(n), fn);
```
_readability_: **3** - better then before, but still looks fancy. Let's do a short break of all that happend here: 
* `Array(n)` gives us an empty array. Not null, not undefined, but _empty_. 
* `Array.from` an empty array will convert values from `empty` to _undefined_.
* The second argument for `Array.from` is a funtion that will be executed against every value in the array.

_efficiency_: **3** - here we creating array of undefined from an empty array (what should be cheap at least memory wise). 

#### for 
```javascript
const times = (n, fn) => {
  for (let i = 0; i < n: i++) {
    fn();
  }
}
```
_readability_: **4** - for me it's not the best approach from the fancy code point of view, but it's really readable and similar to many other languages structures. Yeasy for beginners and new-comers
_efficiency_: **4** - everytime is a new array created, spreading functionality, _padEnd_ function, _map_ function

### Python bonus
As I've started to learn Python - there is an additional example in this language. It's always interesting to compare syntaksis when learning a new language :) 

```python
def times(n, fn):
  [fn() for _ in range(n)]
```

Not too much hacks, super concise, readable and much relays on the language core abilities itself. Love it!

_readability_: **5**
_efficiency_: **5**


### Conclusion 

As we can see - the function implementation can be short and easy to re-use, without any 3rd party libs needed. 
Please, provide your solutions and scores in the comments! 

Meanwhile you can take a look (on your own risk!) on how code can be bloated and shrink in the sope of one simple task/chank of functionality. [From 180 to 6 lines](https://dev.to/dnim/refactoring-from-6-to-180-lines-4fmh) ;)
조직 문화가 아니라 고객이다
Tags: 고객, 문제해결
Published: 2023-01-13 13:55:05

조직 문화, 조직 구조 이런 이야기에 파묻혀 지낸지 오래다. 분명 필요한 일이고 이것이 적시에 적절한 문화와 구조로 돌아가지 않는 경우 여러 문제가 생긴다. 그러나 이렇게 문화와 구조 안에서 생긴 문제를 해결하는데 집중하다보면, 결국 문제만 해결하다가 시간이 다 간다. 

2022년. 문득 우리가 도대체 무얼 하고 있는가 돌아보게 되었다. 우리가 애초에 이 조직과 동료들과 함께 무얼 하고 싶었던 것인가? 어떤 문제를 풀고 싶었던 것인가? 미션과 비전을 다시 돌아보게 되었다. 우리에겐 고객이 존재한다. 잠재 고객도 있고 현 고객도 있으며, 우리 서비스를 떠나 연락이 닿지 않는 고객도 있다. 그 고객들은 시기마다 단계별로 문제들을 가지고 있으며, 우리는 unlock human potential을 위해 다양한 각도에서 문제 해결을 위해 힘을 쓴다. 

우리 조직과 구성원, 회의체, 경영진, 리더십 단에서 언제 마지막으로 고객과 고객 문제 해결을 위해 치열하게 토론하고 결정하고 액션을 취했는가 부끄러웠다. 조직 안에 해야 할 일은 조직이 커지면서 산더미같이 쌓이게 마련이다. 끝이 보이지 않는다. 과업이 끊이지 않는 경우 문제가 나를, 우리 조직을 이끌게 된다. 가끔 그 문제는 해결해야만 하는 것이 아닐 때가 있다. 

문제 중심이 아닌, 기회 중심으로 시선을 돌려야 했다. 이는 리더들만이 할 수 있다. 팔로워는 리더들이 바라보는 시선에 묶이기 쉽기 때문이다. 시선을 돌리는 것은 책임을 져야 하는 일이다. 그래서 리더가 해야 한다. 문제 중심이 아니라 고객 중심으로 생각해야 한다. 우선순위는 우리끼리 상상하는게 아니라 고객이 정해야 한다. 고객에게 물어보고 고객과 이야기하다보면, 우리가 생각하고 있는 문제가 문제가 아닌 경우가 많으며, 더더욱이 그것은 조직 문화나 조직 구조가 아니다. 

22년 중요한 회의마다, 의사결정이 필요할 때마다 다음과 같이 발언, 질문하곤 했다. 
"우리 고객에게 최선이 되는 방향은 어떤 것인가요? 그 기준으로 의사결정 합시다"
조금 멋있어 보이지만 부끄럽게도 크게 도움이 되진 못했다. 

23년, 내가 해야 하는 일은 저런 멋드러진 발언이 아니라, 실제 저 마음으로 실제 의사결정을 하고, 고객 가치 창출을 위해 미친듯이 몰입해야 한다. 나 혼자만이 아니라 우리 조직 전체가 그렇게 되게 만들기 위해 수단과 방법을 가리지 않아야 한다. 

이걸 우리 조직이 함께 하려면, 끊임없이 왜 그렇게 해야 하는지 소통하고 정렬해야 한다. 우리 조직엔 미션 드리븐된 동료 크루분들이 많다. 그래서 충분한 시간을 가지고 이야기하면 소통과 정렬에 문제가 없다. 물론 쉽지많은 않다. 오해도 생기고, 누락도 생긴다. 하지만 결국 우리는 궁극적으로 신뢰하는 동료 안에서, 팀 안에서 답을 찾아나갈 것이다. 

2년 전부터 계속 읊어왔던 문장이 있다. 새로 합류한 조직 크루 동료 분들에게 문화 온보딩 시에도 사용했던 발언인데 다음과 같다
"제가 생각하는 조직 문화는, 조직의 미션, 비전, 목표 달성을 위한 도구와 환경이라 생각합니다"

생각만 할게 아니라 실제 그렇게 해야겠다. 아무리 멋드러진 core value, 조직 문화 블로깅을 적어봤자 결국 조직의 문화는 의사결정권자들의 인격과 행동, 발언이 되기 마련이다. 조직에 문제가 생기면 모두 리더 책임이다. 내 책임이다. 구성원들 탓 할 수가 없다. 이 내용 역시 스스로 말하기에 뭔가 멋있어 보이지만, 실제 스스로 소화해 내기엔 너무나도 고통스럽다. 방심하면 금방 누군가를 비난하고 싶어지고 핑계를 대고 싶은게 솔직한 심정이다. 그래도 마음을 다잡고 그러면 안 되지, 내가 행동하고 내가 가져가야 하는 숙제지 하고 마무리하곤 한다. 

23년, 말이 아닌 행동의 내가 되길 바라며. 문제가 아닌 기회, 고객 중심으로 나와 조직 전체가 24/7 생각하며 몰입하길
고객의 칭찬과 고객의 리텐션, 고객의 가치 발견에 우리 모두의 노력과 성과가 연결되기를 희망한다.
day 4 reactjs
Published: 2023-01-13 13:33:50

## short circuit operator

```
import React, { useState } from 'react';
// short-circuit evaluation
// ternary operator

const ShortCircuit = () => {
  const [text, setText] = useState('');
  const [isError, setIsError] = useState(false);
  // const firstValue = text || 'hello world';
  // const secondValue = text && 'hello world';

  return (
    <>
      {/* <h1>{firstValue}</h1>
      <h1>value : {secondValue}</h1> */}
      {/* {if(){console.log('hello world')}} */}
      <h1>{text || 'john doe'}</h1>
      <button className='btn' onClick={() => setIsError(!isError)}>
        toggle error
      </button>
      {isError && <h1>Error...</h1>}
      {isError ? (
        <p>there is an error...</p>
      ) : (
        <div>
          <h2>there is no error</h2>
        </div>
      )}
    </>
  );
};

export default ShortCircuit;

```

## Ternary oprator with show and hide component

```
import React, { useState, useEffect } from 'react';

const ShowHide = () => {
  const [show, setShow] = useState(false);
  return (
    <>
      <button className='btn' onClick={() => setShow(!show)}>
        show/hide
      </button>
      {show && <Item />}
    </>
  );
};

const Item = () => {
  const [size, setSize] = useState(window.innerWidth);
  const checkSize = () => {
    setSize(window.innerWidth);
  };
  useEffect(() => {
    window.addEventListener('resize', checkSize);
    return () => {
      window.removeEventListener('resize', checkSize);
    };
  }, []);

  return (
    <div style={{ marginTop: '2rem' }}>
      <h1>Window</h1>
      <h2>size : {size}</h2>
    </div>
  );
};

export default ShowHide;

```
SOAX Wins the Winter 2023 Top Performer Award
Tags: proxy, award, sourceforge
Published: 2023-01-13 13:20:04

[SOAX](https://new.soax.com/?utm_source=devto&utm_medium=social&utm_term=post) Wins the Winter 2023 Top Performer Award in Proxy Servers from SourceForge

[SOAX](https://new.soax.com/?utm_source=devto&utm_medium=social&utm_term=post), a provider of premium residential and mobile proxies, is proud to be a winner of the Top Performer award from SourceForge, the world’s largest software reviews and comparison website.

To win the Winter 2023 Top Performer award, each winner had to receive enough high-rated user reviews to place the winning product in the top 10% of favorably reviewed products on SourceForge, which demonstrates the utmost quality that SOAX delivers to customers.

## About [SOAX](https://new.soax.com/?utm_source=devto&utm_medium=social&utm_term=post)

A provider of premium worldwide residential and mobile proxies for web scraping of any scale.