teleren/devto huggingface dataset:
What is Throttling? How to implement it in JS?
Tags: javascript, webdev, beginners, productivity
Published: 2022-11-14 17:30:32

> _[In the previous post we talked about debounce. Click on this link if you'd like to know about debouncing.](https://dev.to/dileepreddyaella/debounce-in-js-how-and-when-to-use-1lo3)_

---

Throttling is a method used to limit the number of times a function can be executed.

> **Throttling - No matter how many times a function is fired, it will be executed only once in a given time interval**
 

Let's say we have an expensive function which does heavy computation or calls a costly 3rd party API.

```javascript
const expensive = () => {
  console.log('Expensive function');
}
```

We can limit the number of times the function can be executed by using throttling. Let's write a simple throttle function.

```javascript
const throttle = (fn, delay) => {
  let wait = false;

  const throttledFunction = () => {
    if (wait) return; // If wait is true, it means the timer
// is still running and the function shouldn't be executed

    fn();
    wait = true;
    setTimeout(() => {
      wait = false;
    }, delay);
  
  return throttledFunction;
}

const inExpensive = throttle(expensive, 1000);
```

Our throttle function takes a callback function and delay and returns its throttled counterpart(inExpensive).

But wait, our throttle function cannot handle arguments. Let's improve it a bit so that it can take arguments.

```javascript
const throttle = (fn, delay) => {
  let wait = false;
  let storedArgs = null;

  const throttledFunction = (...args) => {
    if (wait) {
      storedArgs = args;
      return
    }

    fn(...storedArgs);
    wait = true;
    setTimeout(() => {
      wait = false;
    }, delay);
  }

  return throttledFunction;
}
```


Thanks for reading!....



https://medium.com/walkme-engineering/debounce-and-throttle-in-real-life-scenarios-1cc7e2e38c68
https://www.freecodecamp.org/news/javascript-debounce-example/
https://egghead.io/lessons/javascript-build-lodash-debounce-from-scratch
Why I'm fed up with Agile (but not really)
Tags: agile
Published: 2022-11-14 17:23:27

I've noticed this is a click-baity title, which is the point of this post.

Do most modern software engineers know anything different?  I interviewed at a software company some time ago, and they asked "have you ever worked in an agile software environment". And I was so surprised to hear the question that it almost came across as a red flag to me.  

I'm probably biased by the types of companies I've worked for, but I think many modern software engineers don't have an intuitive understanding of Agile, because we don't have an intuitive understanding of what it is being compared to.  I would imagine the only types of places really doing waterfall development are government and government contractors.  Maybe we need a new paradigm or a different way of talking about the problem.  Maybe we need a set of measurements by which we talk about software development project management.

What are the different axis by which we talk about software development project management?
Created my first python program
Tags: python
Published: 2022-11-14 17:20:06


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hcd9709i68itp522ykdv.png)It's very basic and im pretty sure that i have a lot of inefficient code that code be replaced, but it was the only way i was able to run the program without it crushing.
The idea behind it is to create a randomizer or a lottery app to help me and my team decide who gets to work overtime.
Please let me know if you think that there is a lot of room for improvement or to change the way I wrote the code and if there is any specific modules i could have used`.
Link: 
https://github.com/ZenoSsam/Final-project-cs101.git
What are the Technologies Used in Medusa
Tags: medusa
Published: 2022-11-14 17:16:35

---
title: What are the Technologies Used in Medusa
published: true
description: A list of technologies that we must know before going ahead in the contributions
tags: medusa
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-14 17:15 +0000
---

I have joined the project and I have seen many things, so I need to organise myself and my thoughts to master them :

* Node/NPM
* Yarn
* TypeScript
* TypeORM
* SQLite
* PostGresSQL
* Redis
* Docker
* Next
* React
* TailWind
* Ubuntu
* Git/GitHub
* ...

If you don't know them let's make a little sort

FrontEnd
* Next
* React
* TailWind

BackEnd
* Redis
* TypeORM
* SQLite
* PostGresSQL

DevOps
* Git/GitHub
* Node,NPM/Yarn
* Ubuntu
* Docker

A lot around JavaScript and node/yarn, also JSX all surrounded by **TypeScript**

For the moment I don't say which part of the project uses which technology because I think like a FullStack and also I don't know all the technologies that are used in the project but I am writing again/still [my CookBooks](https://github.com/nazimboudeffa?tab=repositories&q=cookbook) to let you know where I am in this knowledge

The docs are quite understandable and it's a pleasure to just clone a repository and type `npm install` or `yarn add` and see your shop just going live on localhost in few commands

At the starting point I have used my little PC with Windows to start contributing but after that I have tested on a fresh Ubuntu and it's really fine

Before working on the project that I want to develop wich is instant-market.com a domain name that without the dash it actually costs 20.000$, I want to develop a marketplace, multivendor, dropshippong and so

Yes, beacause don't miss that medusa is the Open Source alternative on Shopify

But Shopify needs you only to click on a button and pay 29 bucks/month

So what about medusa, will it be cheaper ? I hope so

Will it be deployable in few clicks on Netlify or Railways, I really hope that

So, what the technology stack we need to be expert at deploying a medusa solution

What is the future business plan of someone that specialise in medusa deployments

Do we need to be experts in the technology stack that we've seen at the beggining of this short article

We'll see all this in detail in some articles that I will write and will explain what is the stack we need to know
The Rollercoaster of Learning to Code
Published: 2022-11-14 17:16:08

As my first blog in the tech industry, I would like to start by sharing some personal feelings about it. It's what I call the rollercoaster of emotions.

Like many other new techs, I'm also switching careers, from the construction industry over to something completely new and different from what I had done my entire life. Not to say every other steps and sacrifices one makes to commit to such an intense, but rewarding program. 

The excitement mixed with anxiety for the first day of class soon went away by having the pleasure of meeting a lot of nice people. Everyone there with similar goals and determination to learn to code and ace their dream job. Just by being part of this community is such a humbling experience. I'm lucky to have supportive instructors and cohort! What else could I ask for? 

However, even knowing I have such an amazing learning support, and enjoyed what I have learned so far; the "Imposter Syndrome", something I learned in Phase One, comes and goes without a warn. And that is what has been the hardest to me to deal with it. It's hard not to overthink just a bit sometimes, and watch movies play and re-play over and over again in your head. I feel it's because you care enough about it. And like it or not, unfortunately learning something new requires getting out of your comfort zone; it has its ups and downs where you enjoy what you are learning until it becomes too hard, or you get stuck in the "rabbit hole". 

I hope that sharing some personal feelings here does not scare anybody away and can help anybody else dealing with it. As a wise man once said: "It's a marathon that you're running, not a 5k race". I'm focused on the main goal and I know it's doable. I'm looking forward to learn and grow as a software engineer.
.toLowerCase() or not to Lowercase
Tags: javascript, programming, tutorial, beginners
Published: 2022-11-14 17:15:30



.toLowerCase() is a method in JavaScript that is used to convert any string to lowercase. The return value for it is also a string. 

There are many reasons as to why someone would need to use it. One example would be if someone has a search bar on their website. Since user input is unpredictable, we need to make sure we are handling the user input in the best way possible. We should convert the strings into one case which is why we were making it all lowercase. Doing that will ensure that the results will match the search. 


Let’s look at how .toLowerCase() works!

First, lets declare a string with the name of stringOne:
```JavaScript 
const stringOne =  “Let’s see HOW .toLowerCase() Works”
```
Then, we will use the syntax for .toLowerCase() on this string:
```JavaScript
StringOne.toLowerCase()
```
Finally, we can console.log the string with and without the new syntax to see the difference:
```JavaScript
console.log(stringOne);
console.log(stringOne.toLowerCase());
```
Now, let's see what the console.log shows us:
```
Let’s see HOW .toLowerCase() Works
let’s see how .tolowercase() works
```
If we did not have this method, we would have to manually parse the string using regular expressions. That would take a really long time!
Making another PR to a repo
Published: 2022-11-14 17:10:05

Hi everyone,

This week I worked on [Astro reactive library](https://github.com/ayoayco/astro-reactive-library), a repo that I previously worked on for Hacktoberfest. Astro reactive library uses the Astro framework to let you build reactive user interfaces.

The [issue](https://github.com/ayoayco/astro-reactive-library/issues/175) was to add a `setValue` method to the FormGroup class. This would allow anyone using Astro to set the values of any form controls in that form group. For example:

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

should produce the following result:


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

Since I was familiar with this repo, I didn't have to learn the documentation. The first thing I did was find the file where I had to make my changes. After finding the [file](https://github.com/ayoayco/astro-reactive-library/blob/main/packages/form/core/form-group.ts), I needed to figure out how I would implement the method. I looked in the [form-control](https://github.com/ayoayco/astro-reactive-library/blob/main/packages/form/core/form-control.ts) to see what properties each form control has and how I could use those properties in my implementation. I found that each form control has a `name` and `value` property that I could use. So, after figuring this out, I created my first implementation for the method. I also updated a demo page I created during Hacktoberfest to use the new method and submitted a [PR](https://github.com/ayoayco/astro-reactive-library/pull/191).

The repo owner reviewed my PR and requested I make some changes, specifically to an ESLint error and to change my method implementation to be more efficient. After making the changes, they approved my PR and merged.
What is DRY Code
Tags: javascript, webdev, programming, beginners
Published: 2022-11-14 16:53:52

## What is DRY Code
"Don't repeat yourself" (DRY) is a [principle](https://en.wikipedia.org/wiki/Principle?fbclid=IwAR3wzuZM9FH5ve3XCQ2HbnDp4kcACtsqNGZpgimXcrtbZSoxU0cXNwcuOjQ#Principle_as_axiom_or_logical_fundament) of [software development](https://en.wikipedia.org/wiki/Software_development_process?fbclid=IwAR1EnfFUWDEqFb0YR7woFF7gEBik1i4nvc9O-EMfAL0kzxcUSH3ymQ3KLrM) aimed at reducing repetition of software patterns,[1] replacing it with abstractions or using data normalization to avoid redundancy.

The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system".It usually means refactoring code by taking something done several times and turning it into a loop or a function. DRY code is easy to change, because you only have to make any change in one place.

Examples of Non-DRY and Dry Code
```javascript
  let drinks = ['lemonade', 'soda', 'tea', 'water'];
  let food = ['beans', 'chicken', 'rice'];
  //non DRY code
  console.log(drinks[0]);
  console.log(drinks[1]);
  console.log(drinks[2]);
  console.log(drinks[3]);

  console.log(food[0]);
  console.log(food[1]);
  console.log(food[2]);

  // DRY code
  function logItems (array) {
    for (let i = 0; i < array.length; i++) {
      console.log(array[i]);
    }
  }

  logItems(drinks);
  logItems(food);

```
### CONCLUSION
Whenever you finish writing some code, you should always look back to see if there is any way you can DRY it up, including:using descriptive variable names, taking repetitive bits of code and extracting them into a function or loop.

Connect me on [facebook](https://web.facebook.com/profile.php?id=100083195016286)
Questions
Published: 2022-11-14 16:49:59

I'm building a photo uploader with all the DevOps bells and whistles. I am using this post to host all my questions. Once I answer them, I'll add the answers to them.

As of November 14, 2022, the way I'm thinking of building it is:

TODO: create a diagram and show here

React application
- How should I serve it?
- Should I deploy it to a server running nginx? And why?
- Should I serve it as a single staticfile hosted on a bucket?
- Should I use Docker?

Django application
- How do I add data monitoring?
- I will use Docker to serve this application. What base image should I use?
- I have an application server + a task queue. How do I get these two to talk each other?
- How do I spin up new instances and have the load balancer know about them?
- How do I spin up new instances in response to data monitoring?
- What should I use to manage the database?
- How do I get my local build to upload images to one bucket and production build to upload to another?

Misc
- How do I manage environment variables in production?
- When I push changes to main, how do I create a hook to deploy my latest changes?

Docker
- How do I expose my docker container to the outside world?
How to improve terragrunt pipeline ?
Tags: devops, sre
Published: 2022-11-14 16:46:00

Working with **Terragrunt** is really cool because we can apply a lot of terraform stuff at once! But when we have a lot of stuff to init, validate, plan, apply... it can take a lot of time and disk space.

---

# Cache
If you are working with 50 terragrunt declaration in a project, by default terraform will download the provider for **each** declaration! Because, by default, providers are downloaded in the folder of the declaration.

So if you are using always the same providers, use a cache!

From the [**terraform documentation**](https://developer.hashicorp.com/terraform/cli/config/config-file#provider-plugin-cache), we can see that we only need to :
- declare an environment variable 

`export TF_PLUGIN_CACHE_DIR="$HOME/.terraform.d/plugin-cache"`
- or declare in the CLI configuration 

`plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"`
``

And then your stuff will go faster and you won't need to download each and every time all the providers.

---

# Parallel execution
With the previous solution, your pipeline will accelerate a lot, but maybe to much thread will start at the same time and will try to do some update on cache files.

So you can have some **"text file busy"** error.

In this case *(or if you want to optimize your terragrunt configurations)*, you can use the following option : 

```hcl
--terragrunt-parallelism 4
```

With this, you will limit the number of parallel execution. *([Terragrunt documentation](https://terragrunt.gruntwork.io/docs/features/execute-terraform-commands-on-multiple-modules-at-once/))*. 

For sure it will slow the execution, but you will be sure to avoid file conflicts *(for example)*.

---

I hope it will help you! 🍺

---

<center><h3>You want to support me?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
Comment améliorer son pipeline terragrunt ?
Tags: devops, french
Published: 2022-11-14 16:46:00

Travailler avec **Terragrunt** est vraiment cool car on peut effectuer des traitements sur tout un ensemble de blocs Terraform d'un seul coup! Mais quand on a beaucoup d'éléments sur lequels on doit faire un init, plan, apply... ça peut prendre beaucoup de temps et d'espace disque.

---

# Cache
Imaginons que vous travaillez avec 50 déclarations terragrunt dans un projet. Par défaut, terraform va télécharger les providers **utilisé par chacun** car, par défaut, les providers sont stockés dans le dossier où se trouve la déclaration!

Donc si vous utilisez toujours les même providers, utilisez un cache!

D'après la [**documentation terraform**](https://developer.hashicorp.com/terraform/cli/config/config-file#provider-plugin-cache), il suffit de :
- déclarer une variable d'environnement 

`export TF_PLUGIN_CACHE_DIR="$HOME/.terraform.d/plugin-cache"`
- ou de l'ajouter dans la déclaration du CLI

`plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"`
``

Avec ça, votre pipeline ira bien plus vite et vous libèrera de l'espace disque en retirant les téléchargements inutiles.

---

# Parallélisme
Avec la solution précédente, votre pipeline va s'accélérer, mais peut être qu'il va avoir des soucis car il essaie de faire trop de choses en même temps et va essayer avec plusieurs exécutions de toucher à un même fichier. Générant des erreurs "text file busy" par exemple.

Dans ce cas *(où si vous voulez optimisez vos configurations terragrunt)*, vous pouvez utiliser l'option suivante *( [Terragrunt documentation](https://terragrunt.gruntwork.io/docs/features/execute-terraform-commands-on-multiple-modules-at-once/))*: 

```hcl
--terragrunt-parallelism 4
```

Ce paramètre va vous permettre de limiter le nombre d'exécution parallèles, donc va ralentir votre pipeline, mais vous évitera des soucis ou vous permettra de l'optimiser vis à vis de la machine que vous utilisez pour le faire rouler.

---

J'espère que ça vous aidera! 🍺
Luos uses PlatformIO
Tags: microservices, opensource, platformio, luos
Published: 2022-11-14 16:27:48

🚀 Luos uses PlatformIO, allowing users to easily use and share services and developments on a unified environment.

▶️  https://www.luos.io/docs/tools/platformio

💬 PlatformIO is a user-friendly and extensible integrated development environment with a set of professional development instruments, compilers and debuggers. PlatformIO provides modern and powerful features to simplify the creation and delivery of embedded products.
Tauri + NodeJS: Alternative to Electron
Tags: webdev, javascript, tauri, node
Published: 2022-11-14 16:27:40

Tauri is a framework for building binaries for all major desktop systems. The main advantage **is using Rust under the hood and webview for serving our frontend app**. Thanks to such a setup apps produced by Tauri are fast and small. But it couldn’t fully replace the electron — until now!

## Start with NodeJS then move to Rust

The learning curve of Rust can be overwhelming. That was my case. I made 3 tries to start writing some basic code in rust. I’m getting better and better every time but I can’t be that productive as I’m in NodeJS.

**Tauri has a sidecar, a way to embed external binary running with your app.** Thanks to this we can run node binary alongside our app and communicate with it!

Here are [Tauri sidecar docs](https://tauri.app/v1/guides/building/sidecar) if you want to know more about how it works.

## Taurine

Although it’s not straightforward how to make it sidecar work with node.   
I made small starter repo. You can find it here [https://github.com/marcincodes/taurine](https://github.com/marcincodes/taurine "https://github.com/marcincodes/taurine").

### How does it work?

To run NodeJS as a sidecar we need to pack it into binary. **Taurine is bundling your server code and preparing it for packing into a single binary.** Using Vercel’s [pkg](https://github.com/vercel/pkg) CLI tool we can compile it into a single executable binary. That binary is running with the Tauri application.

Wait… there are more. Taurine comes also with support for [Fastify](https://github.com/fastify/fastify) and [tRPC](https://github.com/trpc/trpc).

In development, taurine will reload binary when you save server-related files.

### Comparison with Electron

Tauri has a small footprint by default but what about when we pack NodeJS binary with our app? The result of this is surprising. **Taurine app is 3 times smaller than** [**electron app**](https://github.com/electron/electron-quick-start)**.** Compiled the Tauri app in `.app` the format has **63MB** and the electron app in the same format has **205MB**.

Learn more about the [comparison of Taurine and electron](https://github.com/marcincodes/taurine#comparison-with-electron).

## Roadmap

Taurine is more like PoC and supports only React. I want to extend taurine further. I want to make it frontend agnostic, the same as Tauri is now. Also, comparison to Electron is not enough. There are other alternative interesting libraries like [Socket SDK](https://sockets.sh/).

Let me know what you think about Taurine! You can find me on Twitter: [https://twitter.com/marcin_codes](https://twitter.com/marcin_codes "https://twitter.com/marcin_codes")
The impact of open source on cybersecurity
Tags: discuss, cybersecurity, security, opensource
Published: 2022-11-14 16:10:02

Hey community, I’m trying to research the use of open-source components in the security space and figured this would be the best place to start.

Had a few questions that I wanted to ask
1. What is your process for approving an open-source solution?
2. Does your company secure it’s SDLC (software development life cycle)?
3. What tools do you use to keep your SDLC secure?
4. In your opinion, what are the biggest pros and cons of using open-source tools in cybersecurity?
Appreciate your time.
HTTP methods in RESTful API development
Tags: webdev, programming, node, mongodb
Published: 2022-11-14 16:07:57

so today topic is API;
API is Application programming interface we have some 4 most used method 
GET
POST
PUT
DELETE

before we jump into GET,POST,PUT,DELETE, method lets talk about  is  why we need to use API what is the main reason 

well our website have front-end and back-end we cant connect our front-end to our database. This is where back-end comes  where we will create logic for our front-end side so we can send data to our database and recall it when needed 

we make API to connect our front-end with our database 

GET 
This method is use to get all the data that is currently in our database we can show this data to our front-end by using fetch method or a library Axios that help us fetch data from API

POST
This method is use to send data from our front-end to our database it could be number string picture or anything we can also use schema if we using  monogoose  to make sure the correct form of data is been send to our backend

PUT
This method is used to update the data for example we need to a list of product because there price has been change 

DELTE
you can tell from the name what this method going to do well yeah its going to delate the data that has been store in our backend 

this is just a basic knowledge what is happening in backend but believe me there is a lot to learn
If you had time to learn something new in the tech field, what would you learn?
Tags: discuss, career, webdev
Published: 2022-11-14 16:04:49

---
title: If you had time to learn something new in the tech field, what would you learn?
published: true
description: 
tags: discuss, career, webdev
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-14 15:28 +0000
---
There are so many awesome advancements in tech happening all the time. If you had no restrictions, what would you learn?