teleren/devto huggingface dataset:
Custom injecting logic for NestJS with support multi providing
Tags: nestjs, multi, inject, providers
Published: 2022-02-23 18:06:49

## Installation

```bash
npm i --save nestjs-custom-injector
```

## Links

https://nestjs-custom-injector.site15.ru/api - Demo application with nestjs-custom-injector.
https://github.com/EndyKaufman/nestjs-custom-injector-example - Example generated with nest cli for "Usage" sections in readme.

## Usage

Create common interface with token in **animal-provider.interface.ts**

```typescript
export const ANIMAL_PROVIDER = 'ANIMAL_PROVIDER';

export interface AnimalProviderInteface {
  type: string;
  say(): string;
}
```

Create first type of logic for cats in **animal-cats.service.ts**

```typescript
import { Injectable } from '@nestjs/common';
import { AnimalProviderInteface } from './animal-provider.interface';

@Injectable()
export class AnimalCatsService implements AnimalProviderInteface {
  type = 'cat';
  say(): string {
    return 'meow';
  }
}
```

Create second type of logic for dogs in **animal-dogs.service.ts**

```typescript
import { Injectable } from '@nestjs/common';
import { AnimalProviderInteface } from './animal-provider.interface';

@Injectable()
export class AnimalDogsService implements AnimalProviderInteface {
  type = 'dog';
  say(): string {
    return 'woof';
  }
}
```

Create controller **animals.controller.ts**

```typescript
import { Controller, Get, Query } from '@nestjs/common';
import { CustomInject } from 'nestjs-custom-injector';
import {
  AnimalProviderInteface,
  ANIMAL_PROVIDER,
} from './animal-provider.interface';

@Controller('animals')
export class AnimalsController {
  @CustomInject(ANIMAL_PROVIDER, { multi: true })
  private animalProviders!: AnimalProviderInteface[];

  @Get('animal-types')
  animalTypes() {
    return this.animalProviders.map((animalProvider) => animalProvider.type);
  }

  @Get('what-says-animals')
  whatSaysAnimals() {
    return this.animalProviders.map(
      (animal) => `${animal.type} say ${animal.say()}`
    );
  }

  @Get('who-say')
  whoSay(@Query('voice') voice: string) {
    const animal = this.animalProviders.find(
      (animal) => animal.say() === voice
    );
    if (!animal) {
      return { error: `I don't know who say ${voice}` };
    }
    return `${animal.type} say ${animal.say()}`;
  }
}
```

Append all logic to main app module **app.module.ts**

```typescript
import { Module } from '@nestjs/common';
import { CustomInjectorModule } from 'nestjs-custom-injector';
import { AnimalCatsService } from './animal-cats.service';
import { AnimalDogsService } from './animal-dogs.service';
import { AnimalsController } from './animals.controller';

@Module({
  ...
  imports: [
    ...
    CustomInjectorModule.forRoot(),
    CustomInjectorModule.forFeature({
      providers: [{ provide: ANIMAL_PROVIDER, useClass: AnimalCatsService }],
    }),
    CustomInjectorModule.forFeature({
      providers: [
        { provide: ANIMAL_PROVIDER, useValue: new AnimalDogsService() },
      ],
    }),
    ...
  ],
  controllers: [
    ...
    AnimalsController
    ...
  ]
  ...
})
export class AppModule {}
```
Empleos en Data y Analytics LATAM — Feb 2022 - III
Published: 2022-02-23 17:59:28

Te compartimos las ofertas laborales del mes para áreas de Data, Analytics y Cloud 👨‍💻👩‍💻.

✅[Data Analyst- Archstone LATAM (Perú, Lima)]
(https://pe.indeed.com/ver-empleo?cmp=Archstone-LATAM&t=Research+data+analyst&jk=cc097d17c0674348&q=Data+Analyst&vjs=3)
✅[Data Engineer- AIRA (Colombia, Cundinamarca)]
(https://co.indeed.com/viewjob?jk=8711d3c8524834d6&tk=1fsjreemiu41q802&from=serp&vjs=3)
✅[Data Scientist - Globant (Ecuador, Guayaquil)]
(https://ec.indeed.com/viewjob?jk=6fe17a52d9d409f2&tk=1fsjrfe6fhidb800&from=serp&vjs=3)
✅[Machine Learning Analyst - BairesDev SA (Chile, La Serena)]
(https://cl.indeed.com/viewjob?jk=8b63a30cb04c099b&tk=1fsjrhn6fu432802&from=serp&vjs=3)
✅[Data Analyst - BorgWarner (Mexico, Irapuato)]
(https://mx.indeed.com/viewjob?jk=60b205ddf142076a&tk=1fsjrk3uqt493800&from=serp&vjs=3)
✅[Data Engineer- Toptal (Bolivia, Cochabamba)]
(https://www.linkedin.com/jobs/view/2924314840/?eBP=NotAvailableFromMidTier&recommendedFlavor=ACTIVELY_HIRING_COMPANY&refId=K%2Bn3yzrihnq%2Bgb5mTnE9pw%3D%3D&trackingId=ejoMoRfToiFKUwx3Nkbn5w%3D%3D&trk=flagship3_search_srp_jobs)
✅[Data Scientist - Visa (Argentina, Buenos Aires)]
(https://ar.indeed.com/viewjob?jk=e68c4bcc540d24de&tk=1fsjrndi5u1b6803&from=serp&vjs=3)
✅[Machine Learning Analyst - Canonical (Venezuela, Caracas)]
(https://ve.indeed.com/viewjob?jk=cd3890a64be92544&tk=1fsjroqtsu43l800&from=serp&vjs=3)


Aprende, aplica y crece en proyectos de Data y Analytics en Cloud.

Visita nuestra página:
👉🌐 datahack.la
The road map to learning Python
Published: 2022-02-23 17:39:08


When it comes to learning any programming language there are key fundamentals that you have to keep in your mind and that's not necessary the syntax but the way of thinking. Programming or coding is pretty much about thinking rather than just typing on the keyboard. So the challenging question that people ask.
Where do I start from?

Today we live in an ocean of knowledge with so many resources but very little guidance or roadmap to achieving your goals. 
Here is a proven roadmap that I have to say has been of great benefit to me and I will refer to it as I document lessons I took to learning python.




![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gwzpxld73kgue2lhjvb2.PNG)
https://roadmap.sh/python
Lógica  e Linguagem de Programação Lean
Published: 2022-02-23 17:34:54

O lean é uma linguagem de programação funcional que facilita a escrita de código correto e sustentável, mas podemos também usar como um provador de teoremas, podemos definir conceitos matemáticos, escrever programas, podendo provar as propriedades desses programas, sobre as definições matemáticas. A programação enxuta é uma metodologia focada em otimizar a eficiência e minimizar o desperdício de aplicativos de software durante seu design e criação. Essa metodologia pode ser aplicada em toda a organização e envolver todas as partes interessadas no desenvolvimento e entrega de um aplicativo de software. A programação enxuta era um conceito da indústria japonesa adotado pelos EUA durante os anos 80. Seu principal objetivo é a melhoria contínua do produto em todos os níveis e estágios operacionais. Na programação lean, os defeitos de software são uma parte aceita do desenvolvimento de aplicativos e a eliminação deles é um objetivo principal. Isso envolve reduzir a quantidade de código associado a produtos sem erros, o que, por sua vez, reduz estoques e desperdícios inflados. Por exemplo, pedaços menores de código pré-testado e sem erros são frequentemente usados para criar aplicativos maiores para atender às necessidades do cliente. Se implementada adequadamente, a programação enxuta pode fornecer um produto completo dentro do orçamento e com maior eficiência, aumentando, por fim, a satisfação do cliente. Como em qualquer metodologia, o aspecto mais difícil da programação lean geralmente pode convencer os programadores a implementar novos métodos de desenvolvimento. O desenvolvimento de software enxuto é uma filosofia de desenvolvimento de software que visa otimizar a produção de aplicativos e produtos de software e torná-los mais eficientes. A filosofia é popularmente atribuída ao livro com o mesmo título de Mary e Tom Peppendieck. Também evoluiu com base em estratégias comuns de manufatura enxuta em indústrias físicas implementadas pela Toyota Project Systems. No desenvolvimento de software lean, vários objetivos se aplicam, incluindo como: 
Eliminar desperdício;
Amplifique o aprendizado;
Entregue o mais cedo e mais rápido possível;
Capacitar pessoas;
Avaliar a integridade do projeto;
Veja o projeto de forma abrangente.
Muitos desses objetivos amplos são expressos na forma de esforços específicos. Por exemplo, a eliminação de desperdícios ocorre de várias formas, desde a criação de módulos de desenvolvimento mais inteligentes até a descoberta de novas maneiras de escrever código. Em geral, o desenvolvimento de software lean se fundiu com outra filosofia chamada “desenvolvimento ágil de software”, que governa a maneira como programadores e designers trabalham juntos e fornece diretrizes e estruturas úteis para o desenvolvimento de software como um todo.

Referências:
https://www.youtube.com/watch?v=kTQZiyniYYI
https://youtu.be/POHVMMG7pqE
https://www.youtube.com/watch?v=NbXkhPmUvug

https://www.youtube.com/watch?v=arwiwBPZA-0

https://open.spotify.com/episode/1Hoc1CZ13HQukuqXMqG8qA?si=ikX-62qNRFGobOCIqJFf6w&utm_source=whatsapp
Loopple Landing Pages - Bootstrap 5 Website Builder
Tags: css, html, webdev, webcomponents
Published: 2022-02-23 17:30:26

Hi,

I recently launched the option to build Landing Pages/Websites using Loopple drag and drop builder.

The first theme that we integrated is the Soft UI Design System, a Bootstrap 5 Design System built by Creative Tim.

Links:

[Soft UI Landing Page Builder](https://www.loopple.com/theme/soft-ui-design-system)
[Loopple Website](https://www.loopple.com/)
[Loopple GitHub](https://github.com/Loopple/loopple)

Any feedback would be gratefully received!

Thank you!
Installing Cypress and knowing the structure
Tags: cypress, beginners, testing, javascript
Published: 2022-02-23 17:30:17

Hello guys! What's going?
It was a long time that I publish a post, but it better late than never, right?

Well, to start, we'll open our terminal and create a paste.

`$mkdir myFirstTest`

Next, inside the paste, we will to install dependencies by cypress.
`
$cd myFirstTest
$npm init -y
$npm install cypress --save-dev
`
When we install cypress in our project just appear this thinks:

![installing-cypress](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7de7k1kvhmaovegvkiue.png)

 
But don't worry, we just need to run with this command to start cypress.

`npx cypress open`

Appear a windows like this:
![cypress-windows](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzywwkzbtvyeld1h6wu8.png)
 

Nice, we can see two paste: **1-getting-started** and **2-advanced-examples** and inside this paste there are a lot of examples that cypress show us to learn.

You can see this examples, it's very interesting and bring us a vision that how we can create our test.


When we run for the first time cypress, he will create any other thinks as like we saw.

![paste-cypress](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqwcvla3vtn5i7nhevh3.png)

### Structure of Cypress project
- Nice, let's talk about `cypress.json` file:

In this file, we will to put our configuration about cypress, we can put it what kind of files cypress will run or what it the default time out and more.

- `cypress` paste
![structure-cypress](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uqgpplfpv6rgwyix6nfu.png)
Here, we will have 4 paste as like image show.

![structure-cypress2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9mlr3ycvakahatjyi6b.png)

**fixture**= Usually we put it environment variables.
![fixture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qknyz9o7amhh8w2cfpw8.png)

**integration** = We put it our test files, they finish with ".spec.js", I will not said "always" finish with ".spec.js" because we can change to cypress read others files, for example at the work we use ["cucumber"](https://github.com/TheBrainFamily/cypress-cucumber-preprocessor#installation) to organized our test to better way, In this configuration we put it to read ".feature" files. It's nice to use, I can teach to use in other occasion.

![integration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uvsf7s1w7f6g9bjaze58.png)

**plugins** = As like said the name, in this paste, we add plugins to the project.
![plugins](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3b7nirss05ecf3a8tyab.png)

**support** = In this paste we can organized other files and integrate with files of **integration** paste.
 
I hope that you liked it, just remember that all these things are in the Documentation of  [Cypress.io](https://www.cypress.io/), and if you have any questions you can send me, I'll be happy to help you!
Day-30 Training at Ryaz
Tags: javascript, beginners, node, webdev
Published: 2022-02-23 17:29:13

- Date:23/02/2022
- Day:Wednesday

Today, I started at about 10:40 am as I was to follow the course with Mosh collection- The node express course with would clear all my basics and would led me to work more comfortably so, I started with first module so, and first module contained firstly the path through we would learn that we would be able to create restful api and know about promises and how to store data using mongo db and further it would include difference between synchronous and asynchronous await functions and in other part I learnt how to install node using terminal and after this in next module it taught about that node.js is runtime platform for running javascript code and it also explained that we use it to build API which stands for Application Programming Interface moreover the instructor explained that node.js is great for prototyping and agile development and after this the instructor explained about benefits of using node as it let us to write 33% less code, and its app works faster.then wrote first node program and then node architecture.Also I worked sometime for improvement of Task.
Alternative to Amazon DynamoDB Time to Live (TTL)
Tags: aws, ttl, dynamodb, elasticache
Published: 2022-02-23 17:09:20

## Scenario:
- Certain data lose relevance after a specified time.
- So create records in datastore that should exists only for a specified time from the creation time.
- Time can be anything from 1 second to hours. 

**Example Case:** Make the record expire within 10 seconds of its creation time.

**Option 1:** Application based timer (Not Recommended)
Whenever Application creates a record it has to trigger a timer as shown below JavaScript example timer:

```
/*
setTimeout's not the right way to keep track of timer... Let's assume it works for explaining this option.
*/
setTimeout(function() {
    purgeRecord(recordId);
}, 10000);
```
_Problem:_ An Application receiving thousands of request per second has to create those number of timers. This option is not scalable.

**Option 2:** Amazon DynamoDB - (Not Recommended)
DynamoDB per-partition scanner background process automatically and continuously evaluates the expiry status of items in the table.

_Problem:_
Amazon DynamoDB TTL typically deletes expired items within 48 hours of expiration. Scan & Filter by timestamp not a scalable option.
This option works best if your TTL is minimum 48 hours.
Not matching with our scenario of expiring items in 10 seconds.

**Option 3:** Amazon Elasticache (Recommended)
Redis compatible Amazon Elasticache honours TTL by seconds.
_Code example:_

```
redis_client.set('key', 'value', {
  EX: 10
});
```
Matches with our 10 seconds expiring scenario.

Please let me know your thoughts or other options in comments.

Image by <a href="https://pixabay.com/users/sadia-343889/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=396862">Sadia</a> from <a href="https://pixabay.com//?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=396862">Pixabay</a>
Best SSD for laptop
Tags: ssd, computer, programming, laptop
Published: 2022-02-23 16:32:58

To speed up your laptop, you should definitely consider an SSD or solid state drive. Available in a variety of capacities and form factors, if your desktop has user-expandable storage, it will definitely fit the internal SSD (Solid State Drive) of your desktop or even laptop. At this point, whether you want to reduce boot times completely or get affordable mass storage, you have an SSD for all your storage needs.

**[read full article](https://www.ninechoice.in/2022/02/best-ssd-for-hp-laptop-price-in-india.html)**
Learn how to how to create apps for business communication. Join our Live Coding Session!
Tags: javascript, tutorial, webdev, beginners
Published: 2022-02-23 16:51:33


Are you sometimes in a situation, when you have a severe problem or question and would even consider paying money to someone who can contact you with a person that knows the solution? In business people do this all the time, that’s how commissions work.

**You can be that someone 😎** 

In LiveChat Developer Platform, we encourage external developers to create extensions to our product – [LiveChat](https://www.livechat.com?utm_source=devto&utm_medium=referral&utm_campaign=lcs5), which allow our clients *(35k of them!)* to communicate with their customers via new channels. Many of our integrations were built this way, for example this [integration with WhatsApp](https://www.livechat.com/marketplace/apps/whatsapp-business/?utm_source=devto&utm_medium=referral&utm_campaign=lcs5). Our customers can buy them in our [Marketplace](https://www.livechat.com/marketplace/?utm_source=devto&utm_medium=referral&utm_campaign=lcs5), to further adjust LiveChat to their business needs.

**Long story short**, we invite you to help our customers support their clients, which they wouldn’t be able to reach without custom integrations. We help you create, market and sell your apps – **it’s a great source of passive income.**

**If you would like to know more about our framework, we’d like to invite you for our upcoming event!** Recently, we released [Chat Widget Adapters](https://developers.livechat.com/docs/extending-chat-widget/chat-widget-adapters?utm_source=devto&utm_medium=referral&utm_campaign=lcs5), thanks to which it’s now possible to integrate the LiveChat’s Chat Widget with websites using popular frameworks such as React, Angular, and Vue.

On this occasion, we’re running Live Coding Session, where together with [Maciej Walaszczyk](https://www.livechat.com/team/#maciej-walaszczyk?utm_source=devto&utm_medium=referral&utm_campaign=lcs5) from our Product Team you’ll learn:

- How to use framework-specific Chat Widget Adapters
to make the Chat Widget an integral part of a website.
- How to use the [Agent App SDK](https://developers.livechat.com/docs/extending-agent-app/agent-app-sdk/?utm_source=devto&utm_medium=referral&utm_campaign=lcs5) and [rich messages](https://developers.livechat.com/docs/extending-chat-widget/rich-messages/?utm_source=devto&utm_medium=referral&utm_campaign=lcs5) to customize and add interactivity to website or product.
- How to combine all that knowledge to build an application in the [Developer Console](https://developers.livechat.com/console?utm_source=devto&utm_medium=referral&utm_campaign=lcs5).

{% youtube ncqV9Pt5j2M %}

Let’s meet and learn together!

[[SAVE YOUR SEAT]](https://developers.livechat.com/live-coding-customize-chat-widget-experience/?utm_source=devto&utm_medium=referral&utm_campaign=lcs5)
Day 5/100, 100 Days of Code
Tags: javascript, beginners, codenewbie, devjournal
Published: 2022-02-23 16:46:05

Forgot to post yesterday! But I **absolutely** did wake up early and get some coding done. Almost 2hours. I worked on a few different methods for iterating through an array

- **.forEach()**
- **.map()**
- **.filter()**
- **.findIndex()**

Seemed a lot easier for me to understand the lessons today, which is better than most days.
Technical leadership: monitoring X autonomy
Published: 2022-02-23 16:28:18

---
title: Technical leadership: monitoring X autonomy
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---
Looking at my career, I can say that I have more experience and theoretical background in matters related to technology, especially in the area of software development. This fact is due to having done a graduate degree in Computer Science and having read a good amount of books and many posts, and putting a large number of products into production. I say this because, despite leading technical teams for a little over a decade and reading good books and posts, I feel safer writing about technology than about leadership. So consider that when reading this post :)

In this post, I'd like to share a tiny "framework" that I've been using regularly in my 1-1 meetings with people on my teams. Then, I try to describe to them two aspects of leadership, which I have demonstrated in this image:

[![monitoring_autonomy](https://eltonminetto.dev/images/posts/monitoring_autonomy.png)](https://eltonminetto.dev/images/posts/monitoring_autonomy.png)

On the one hand, we have the monitoring that leadership must do concerning people's work and careers. On the other hand, people have the autonomy to carry out their work. At both ends of the spectrum are two characteristics that I find very harmful in leadership: micromanagement and absence. I regularly ask the people I lead whether I'm getting too close to either extreme. My goal is balance monitoring and autonomy, but this pendulum can swing a little to one side, depending on things like the maturity of the team and the business. But in no possible scenario do I see any reason for a lead to go to one of the extremes outlined above.

As I mentioned at the beginning of the post, I came to this conclusion empirically. If you know of any theory, book, or text that confirms this notion of mine or refutes it, please share it in the comments.
Get rid of an MS SQL Server database in SingleUserMode
Tags: sqlserver, sql, sledgehammersolution
Published: 2022-02-23 16:22:24

Yesterday i while trying to run some tests against a database with a copy of our production data the program i was working on was crashing with strange errors. When trying to connect to the database via sql server management studio i was greeted with all kinds of errors. "The database is in single user mode, no connection allowed" and so on... Looked for every possible app that was connected to this database and deactivated it. Waited for the nightly restart of the database server. Still not possible to connect. 

While googling i today i found the stored procedure **sp_who2** which **lists you all the active connections to you databases**. 

With the command **kill** you are able to **terminate the connection**. 

Example: 

```sql
sp_who2
Kill 51

```

After this i was able to connect again, delete and restore the database. I'm a bit short on time thats why i'm not investigating any further. But if this comes up again i will dig deeper.