teleren/devto huggingface dataset:
RabbitMQ with Nodejs Part 2
Tags: node, javascript, rabbitmq, programming
Published: 2021-02-02 14:38:01

In the [previous post](https://dev.to/outspoken_dev/rabbitmq-with-nodejs-part-1-3n98), We had our introduction with the message broker and rabbitmq, In this post, we will discuss the first component ie. Connection

##Connection
Below are the few properties which will help us to understand the connection to rabbitmq 
    1. One client library connection uses a single TCP connection. In order for a client to successfully connect with a message broker.
    2. Connections should not be opened by the client for each individual operation.
    3. Once the client connects successfully, it can publish and consume messages.
    4. When the connection is no longer needed, it should be closed to save on resources.

##Lifecycle:
Below are the major lifecycle component of a connection with the message broker ( RabbitMQ )
    1. Application configures the client library to use a certain connection endpoint (e.g. hostname and port)
    2. The library resolves the hostname to one or more IP addresses
    3. The library opens a TCP connection to the target IP address and port
    4. After the server has accepted the TCP connection, a protocol-specific negotiation procedure is performed
    5. The server then authenticates the client
    6. The client now can perform operations, each of which involves an authorization check by the server.
    7. Once the requirement is completed, a connection is closed.
###Example Code to establish a connection in nodejs application 
```
const amqp = require('amqplib');
const connection = await amqp.connect('amqp://localhost');
// your application logic
connection.close();
```

##Logging and Monitoring:
RabbitMQ logs all inbound client connections that send at least 1 byte of data. Connections that are opened without any activity will not be logged. This is to prevent TCP load balancer health checks from flooding the logs.

Successful authentication, clean and unexpected connection closure will also be logged.

##Interface : 
The following interface of a connection is provided to us by 
[amqplib module](https://www.npmjs.com/package/amqplib)
```
{
    close(): Promise<void>;
    createChannel(): Promise<Channel>;
    createConfirmChannel(): Promise<ConfirmChannel>;
    connection: {
        serverProperties: ServerProperties;
    };
}
```

Read More -> https://www.rabbitmq.com/connections.html

Note: I am writing for the first time and will highly appreciate any feedback or suggestions.
Find me on [Linkedin](https://www.linkedin.com/in/lalit292929/)
#30DaysofFlutter
Tags: flutter, beginners, challenge, 30daysofflutter
Published: 2021-02-02 14:28:24

## **First things First: What is Flutter**
Flutter is Google’s open source UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase. It’s one of the fastest growing, most in-demand cross platform frameworks to learn and is used by freelance developers and large organizations around the world.

In Flutter everything is a Widget. So you build your App with existing Widgets and build new ones. You can use existing Widgets and build new Widgets. You can think of it as jig-saw puzzle, where you put together several pieces (Widgets) to complete the puzzle (application).

## **30 Days of flutter**
*#30DaysOfFlutter* is an open for all initiative by Flutter Community to help developers who have experience in building apps using different SDKs and technology and aspiring app developers learn more about building apps using Flutter.

### **Day 1**
In the [orientation session,](https://www.youtube.com/watch?v=-feG_q_0j3Y) We spent some time to appreciate efforts of Flutter-Community for flutter's journey from being just an open-source project to becoming one of the most liked and preferred platform by developers.
Here are some glimpse...![Screenshot from 2021-02-01 22-37-16](https://dev-to-uploads.s3.amazonaws.com/i/kwesmjji93n1d6gc98zc.png)
![Screenshot from 2021-02-01 23-02-05](https://dev-to-uploads.s3.amazonaws.com/i/fbueiqx9a10bxv3k3um0.png)
 
Then we had a thorough walk-through about the [resources](https://events.withgoogle.com/30-daysofflutter/content-resources/#content) we will be using and to get along with the flutter environment followed by live installation of Flutter

As we went through the session we also got to know, various ways to interact  with the [Community](https://flutter.dev/community) and to even contribute to the flutter project by making our own widgets and also various other ways of contribution.

If you have still not registered for the #30DaysofFlutter challenge, you still have a chance to [register.](https://events.withgoogle.com/30-daysofflutter/#content)
Spare some time and visit [Flutter-community website,](https://flutter.dev/community) get connected to become part of such an amazing open-source community!!

I hope this article will help you understanding more about Flutter and its wonderful Community.
Python Prowess: Day 2
Tags: python, codenewbie
Published: 2021-02-02 14:23:04

Funny got to know python has indent sensitivity along with the case sensitivity! 

Here is the program to calculate XOR from 1 to n

```
def xor(n) :
    if n % 4 == 0 : 
        return n 
  
   
    if n % 4 == 1 : 
        return 1
  
    
    if n % 4 == 2 : 
        return n + 1
  
    
    return 0
    
if __name__ == "__main__" :
    n = 5
    print(xor(n))
```
Output - 1
🌼Please comment if you have any suggestions or encouraging words.🌼
How to Run GitHub Actions on Forks
Tags: github, githubactions, devops
Published: 2021-02-02 14:07:13

GitHub provides a label on the user to identify them as a first-time contributor. This label is helpful because it's also exposed in API and provides a path for an excellent first-time contributor experience. 

![Screen Shot 2021-02-02 at 8.41.11 AM](https://dev-to-uploads.s3.amazonaws.com/i/z8ighl6tptqgbmy0e8k2.png) 

The GitHub Action team maintains an Action called [first-interaction](https://github.com/actions/first-interaction), and it provides some inputs to give a welcome message. Contributors. Now, this is more than just a simple, hello message.

{% github https://github.com/actions/first-interaction no-readme %}

To enable this functionality, we need our workflow to run pull requests originated from forks. We can achieve this with the [pull_request_target](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target). 

The **pull_request_target** event runs in the context of the base of the pull request, rather than in the merge commit as the pull_request event does. This prevents executing unsafe workflow code from the head of the pull request that could alter your repository or steal any secrets you use in your workflow.

Now we can welcome first-time contributors into our project on their first interaction.

Learn more GitHub Actions tips in our [Community Support Forums](https://github.community/c/github-ecosystem/37).

{% link https://dev.to/github/what-are-github-actions-3pml %}
Hello
Published: 2021-02-02 14:02:15

---
title: Hello
published: true
description: Como vocês estão?
tags: 
//cover_image: https://unsplash.com/photos/SymZoeE8quA
---

Faz muito tempo que eu não escrevo, mas é uma atividade que certamente me faz falta.

Comecei a falar de tecnologia em blogs tem muitoooooo tempo, por quase 3 anos, eu mantive o https://somoswindev.wordpress.com/ onde eu falava sobre azure e outras tecnologias Microsoft, que ironia vindo de alguém que hoje trabalha para a AWS. 

Antes disso eu tive páginas de facebook que remetem a 2011 ou 2012, uma pena não ter mais registros dessa época (Sorry fb.. mas você tava fazendo mal para minha saúde mental).

![Print screen da tela do meu antigo blog](https://dev-to-uploads.s3.amazonaws.com/i/2hhyetas22x65qdsg2ep.png) 



Escrever sempre foi a minha forma preferida de compartilhar conhecimento. Mas a parte contrária a isso é como eu odeio manter a infraestrutura de um blog ou ter que lidar com as limitações de plataformas hosted de blogs.

Já tentei usar o grande wordpress, inclusive foi a plataforma que eu mais escrevi mas acho pouco produtiva hoje em dia, tentei o Medium, mas a politica de pay wall deles me deixa enjoado, conhecimento é para ser livre e de comum acesso, chega a ser errado você priva as pessoas do acesso em uma era que tanto precisamos, também já passei pelo stackoverflow e etc. Acho que me encontrei bem aqui no dev.to, vamos ver se consigo retornar ao hábito de escrever.

Fique a vontade para mandar mensagem e comentário, inclusive, faço o convite de me dizer o que você gostaria de ver por aqui? Eu pretendo falar sobre JavaScript, meu processo de aprendizado de python, Arquitetura de sistemas, vida, ciência e tudo que dê na cabeça :) 

Aproveitando que já ta por aqui, dá uma olhadinha no meu [primeiro post](https://dev.to/matheusmonte/criando-seu-site-com-github-pages-sem-codigo-4op) para valer

Até mais gente! Bom vê-los por aqui!
You can't just migrate to Vue 3 (now)
Tags: vue, javascript
Published: 2021-02-02 14:02:10

[![Issue](https://dev-to-uploads.s3.amazonaws.com/i/rrth25awqmjttay7w1wv.png)](https://github.com/vuejs/vue-next/pull/1600)

Recently I moved [SiteInspector](https://github.com/siteinspector/siteinspector) open-source app to Vue 3 and discovered that Vue 3 template compiler has a serious flaw in the default whitespace trimming strategy which makes it unreasonably hard to upgrade existing Vue.js apps.

Vue 3 template compiler removes whitespaces before HTML tag if it starts with a new line in the template.
This "feature" eliminates visible margins between UI components and there is no way to change this via compiler settings.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wiwkpp8owd7aeif7xuba.png)

Margins between buttons are missing as a result of Vue 3 whitespace trimming strategy.

```html
<template>
  <a href="/">Link1</a>
  <a href="/">Link2</a>
  <a href="/">Link3</a>
</template>
```

Vue 3 template compiler doesn't respect new lines and removes whitespaces from the rendered HTML. 

```html
<a href="/">Link1</a><a href="/">Link2</a><a href="/">Link3</a>
```

When the correct "trimmed" output should be the following:

```html
<a href="/">Link1</a> <a href="/">Link2</a> <a href="/">Link3</a>
```

So if you take a simple HTML page and render it via Vue 3 template compiler you will see a different picture on your screen - all buttons and links will be smashed together and won't move to the next line in the parent container on a smaller mobile screen.

The best way to fix it for SiteInspector was to add mandatory whitespaces via text interpolation:

```html
<template>
  <a href="/">Link1</a>
  {{ ' ' }}
  <a href="/">Link2</a>
  {{ ' ' }}
  <a href="/">Link3</a>
</template>
```

Hopefully, this issue will be resolved soon so `{{ ' ' }}` can be removed with a single grep command.
Day 3: Hex Colour
Tags: 100daysofcode, java
Published: 2021-02-02 14:01:38

Given three integers between 0 and 255, corresponding to the red, green, and blue channel values of a color, find the hex string for that color.

```java
public class DayThree {

    public static void main(String[] args) {

        System.out.println(hexColor(255, 99, 71));
    }

    public static String hexColor(int a, int b, int c) {

        String aHex = "#" + Integer.toHexString(a);
        String bHex = Integer.toHexString(b);
        String cHex = Integer.toHexString(c);

        if (a == 0) {
            aHex = aHex.concat("0");
        }
        if (b == 0) {
            bHex = bHex.concat("0");
        }
        if (c == 0) {
            cHex = cHex.concat("0");
        }

        return aHex.concat(bHex).concat(cHex).toUpperCase();

    }
}
```
What is indexOf() in JavaScript?
Tags: webdev, javascript, codenewbie, programming
Published: 2021-02-02 13:56:50

After a long time, a new post on JavaScript methods is here... Let's learn about the `indexOf()` method. 

---

## indexOf()

It accepts two parameters: The required parameter of `searchValue` indicates the content you want to search for in a string. 

The optional start parameter indicates the position of the string in which the search will begin. If not specified, the search will start at the beginning.  `indexOf` is case sensitive but can be sued with regex case-insensitive modifier. 

**TLDR: Returns the position of starting point of work or -1 if not found. 

---

```js
const movieQuote = "I'm in a glass case of emotion!"

console.log(movieQuote.indexOf("emotion", 20)); 

//output
23

console.log(movieQuote[23]); 
//output
e
```

---

### Use Case

`indexOf` can creatively be used for many things, including validation. This is used for dynamic content by finding a word and displaying that content as output or in the example below, push the item into a new array if not already existent. 

```js
const updateVegetablesCollection = (veggies, veggie) => {
    if (veggies.indexOf(veggie) === -1) {
        veggies.push(veggie); 
        console.log(`New veggies collection is: ${veggies}`); 
    } else if (veggies.indexOf(veggie) > -1) {
        console.log(`${veggie} already exists in the veggies collection.`); 
    }
}

let veggies = ['potato', 'tomato', 'chillies', 'green-pepper']; 

updateVegetablesCollection(veggies, 'spinach'); 
//output
New veggies collection is : potato,tomato,chillies,green-pepper,spinach

updateVegetablesCollection(veggies, 'spinach'); 
//output
spinach already exists in the veggies collection.
```



----

🤩Thanks For Reading | Happy Learning🥂


Get weekly newsletter of amazing articles I posted this week and some offers or announcement. Subscribe from <a href="https://mailchi.mp/9f73b65b9c38/rahulism" target="_blank">Here</a>

<a href="https://www.buymeacoffee.com/rahxuls" target="_blank"> <img src="https://res.cloudinary.com/rahulism1/image/upload/v1608182430/bmc_nbxakd.png"></a>
You can write whole website in just single web page.
Tags: html, webdev
Published: 2021-02-02 13:52:30

I'm using `:target` for creating this [repo](https://github.com/gauravnumber/website)

CSS
```
section {
  display: none;
}

section:target {
  display: block;
}
```

HTML
```
<a href="#home">Home</a>
<a href="#about">About</a>

<section id="home">
You can create whole website just in single page.
</section>
	
<section id="about">
This is my tiny project. I'm love create code. I'm intersting for making code, program, websites.
</section>
```

Every time you click on those links `#home`, `#about`.
Adding on your current URL.
`:target` is responding on any `#` value. You see `section:target` all section visible.
ValidationErrorsCollection: Braintree I don't know why I'm getting this error
Published: 2021-02-02 13:45:05

I'm using braintree in application. some time ago it worked without any problem. now it doesn't always work and when it doesn't. I get this error on console: ValidationErrorsCollection.
Node.js code
```

    const gateway = new braintree.BraintreeGateway({
        environment:  braintree.Environment.Sandbox,
        merchantId:   process.env.BRAINTREE_MERCHANT_ID,
        publicKey:    process.env.BRAINTREE_PUBLIC_KEY,
        privateKey:   process.env.BRAINTREE_PRIVATE_KEY
    });
    
    
    exports.generateToken = (req, res) => {
    	gateway.clientToken.generate({}, function(err, response) {
    		 //Se verdade vamos trazer o token
    			if(err){
    				res.status(500).send(err)
    			}else{
    				res.send(response)
    			}
    	});
    };
    
    exports.processPayment = (req, res) => {
    	let nonceFromTheClient = req.body.paymentMethodNonce
    	let amountFromTheClient = req.body.amount
    
    	//charge
    		
    	
    	let newTransaction = gateway.transaction.sale({
    		amount: amountFromTheClient,
    		paymentMethodNonce: nonceFromTheClient, 
    		options: {
    			submitForSettlement: true
    		}
    	}).then(function (result) {
    		  if (result.success) {
    		    res.json(result);
    		  } else {
    			  console.log(result.errors)
    			//res.status(500).json(error); 
    		  }
    		  }).catch(function (err) {
    		  	console.error(err);
    		  });
    
    }

```
Running GitHub Actions on Forks
Tags: github, action, devops
Published: 2021-02-02 13:43:48

GitHub provides a label on the user to identify them as a first-time contributor. This label is helpful because it's also exposed in API and provides a path for an excellent first-time contributor experience. 

![Screen Shot 2021-02-02 at 8.41.11 AM](https://dev-to-uploads.s3.amazonaws.com/i/z8ighl6tptqgbmy0e8k2.png) 

The GitHub Action team maintains an Action called [first-interaction](https://github.com/actions/first-interaction), and it provides some inputs to give a welcome message. Contributors. Now, this is more than just a simple, hello message.

{% github https://github.com/actions/first-interaction no-readme %}

To enable this functionality, we need our workflow to run pull requests originated from forks. We can achieve this with the [pull_request_target](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target). 

The **pull_request_target** event runs in the context of the base of the pull request, rather than in the merge commit as the pull_request event does. This prevents executing unsafe workflow code from the head of the pull request that could alter your repository or steal any secrets you use in your workflow.

Now we can welcome first-time contributors into our project on their first interaction.

_This is part of my 28 days of Actions series. To get notified of more GitHub Action tips, follow the GitHub organization right here on Dev._

Learn more about GitHub Actions in our [Community Support Forums](https://github.community/c/github-ecosystem/37).

{% link https://dev.to/github/what-are-github-actions-3pml %}
CSS Text Outline | Nike Shoes Parallax Text Effect 

Tags: html, css, beginners, 100daysofcode
Published: 2021-02-02 13:36:18

***Hello guys in this tutorial we will create a Nike shoe parallax text outline effect using Html And Css***

<a href="https://blog.stackfindover.com/nike-shoes-parallax-text-outline-effect/" rel="dofollow">Download Code</a>

###Nike Shoes Parallax Text Effect Output:###
{% youtube Y88lC9wEyrI %}

###Nike Shoes Parallax Text Effect CodePen Output:###
**We will update soon :)**
Publish to Dev.to via RSS
Tags: guide, publishing, howto, placeholder
Published: 2021-02-02 13:27:02

---
title: Publish to Dev.to via RSS
published: true
description: 
tags: guide, publishing, howto, placeholder
//cover_image: https://direct_url_to_image.jpg
series: "Publishing on Dev.to"
---

Ignore this one for now dear reader, just testing out the publish via RSS feature. :pray:

Here's a cute puppy for your troubles:

![cute puppy on his back paddling his legs](https://media.giphy.com/media/Lr2YomhIBU8LK/giphy.gif)
Create a "Series" from Markdown Editor
Tags: howto, tutorial, guide
Published: 2021-02-02 13:23:03

---
title: Create a "Series" from Markdown Editor
published: true
description: You ever wondered how people are creating a series of posts here on dev.to? Wonder no more
tags: howto, tutorial, guide
//cover_image: https://direct_url_to_image.jpg
series: "Publishing on Dev.to"
---

This is not anything new, but the instructions are a bit buried so I'm hoping that this write-up saves the next person the "duckduckgo-ing" and comment-reading I had to do.

First, what are we talking about. By Series, I'm talking about the badge that appears at the top of certain posts. For example, take a series of Book Notes by [@danlebero](https://dev.to/danlebrero/) the top of each post is decorated with links to the other posts in the series:

![screenshot of the top of the first post in the series, showing the badge](https://dev-to-uploads.s3.amazonaws.com/i/rvkjgfgjcjerkt7wr4dg.png)

If you want to create a series, you can do so using the "Rich" editor as shown here:

{% link dzhavat/a-short-guide-on-how-to-make-the-series-widget-on-dev-4o9f %}
 
Unfortunately, once you set the `series` value via the rich-editor, it won't switch back to the Markdown editor even if you revert your settings. I quite prefer the writing & thinking in markup so this was quite a deal-breaker for me.

After hunting around the comments, I found the answer in the last place I'd look: [The User Manual, in the `Front Matter` section](https://dev.to/p/editor_guide#front-matter). Here's what the meta-data for this post looks like:

```
---
title: Create a "Series" from Markdown Editor
published: true
description: You ever wondered how people are creating a series of posts here on dev.to? Wonder no more
tags: howto, tutorial, guide
series: "Publishing on Dev.to"
---
```

Basically, you just set the `series` key in the header and the new post gets added to the series. 

Thank you for reading, let me know if this works for you and give it a :heart: if it saved you some time so it's easier for others to find it. :pray:
10+ Top TYPO3 Bootstrap Templates (Free & Premium)
Tags: typo3, typo3template, t3terminal
Published: 2021-02-02 13:14:52

Being a web designer you must be knowing how valuable Bootstrap technology is in creating eye-catching yet responsive websites based on HTML, CSS, and the extensions of JavaScript. 

Many TYPO3 developers choose to build templates with TYPO3 Bootstrap CSS. TYPO3 Bootstrap templates are ones with a responsive grid-based framework that helps beginners, as well as professional designers, develop their own website straightforwardly. 

Complete review of the blog at- https://t3terminal.com/blog/typo3-bootstrap-template/
How to do TYPO3 Localization with Crowdin?
Tags: typo3, typo3localization, typo3crowdin
Published: 2021-02-02 13:11:11

Whenever you ask TYPO3 people, Why TYPO3? In most cases, they will because we love the state-of-the-art Multilingual feature of TYPO3. Of course, the multi-language content handling is incredible, but there was one little painful topic about - How to localize extension or template’s static labels? Where to translate TYPO3 backend labels? And so on. Here, Georg and his team decided to make it cool and modern with Crowdin.com! This topic is new for TYPO3 people! Keep reading the article to know, why & how modern TYPO3 localization works with the Crowdin platform?

One of the beauties of TYPO3 is the Multilingual & Localization feature of the backend & frontend. After 20+ years, the TYPO3 community decided to improve and modernize localization with TYPO3 Crowdin cloud-based SaaS solution. In this article, you will find helpful TYPO3 translation insights for TYPO3 editors, administrators, and developers.

Checkout complete blog at- https://t3terminal.com/blog/typo3-crowdin-localization/
Daily Developer Jokes - Tuesday, Feb 2, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-02-02 13:00:18

---
title: "Daily Developer Jokes - Tuesday, Feb 2, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Tuesday%2C%20Feb%202%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12597371ee1.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Why did the programmer come home crying?"

___A:___ His friends were always boolean him.
 -->