teleren/devto huggingface dataset:
Testing Ansible Collections
Tags: ansible, automation, ansiblecollections
Published: 2021-05-04 12:48:14

Tests for Ansible Collections are a vital ingredient of transitioning from "this module works for me" to a product that our users can use to deploy production environments. Why? There are lots of reasons for this, but the ones we think are the most important are: 

1. Just thinking about how we would go about testing a particular piece of code will help us structure it better. Complex code is hard to test.  

2. **Writing integration tests** allows us to verify our API design. If we are having trouble using our content in test playbooks, our users will have problems, too (and will rightfully hate us for this).  

3. **Running sanity tests** regularly can help us prevent our implementation and documentation from diverging.  

4. Having a comprehensive battery of tests makes it easy to extend our Ansible Collection without breaking existing playbooks. For example, pinning down the public API **using unit tests** is an excellent way to ensure we do not break backward compatibility inadvertently.  

5. Since Ansible Collections are a link between Ansible and automated product, we need to run our integration tests on all supported Ansible and product version combinations. Our users will greatly appreciate it.  

And remember, happy users mean happy bosses. Win-win ;)
Issues using React 17 + Lazy Loading
Published: 2021-05-04 12:24:32

I'm experiencing a couple of issues using React 17 + Lazy Loading. Any idea?

[HMR] Waiting for update signal from WDS... log.js:24
Uncaught undefined react-dom.development.js:11865
Uncaught undefined react-dom.development.js:11865
The above error occurred in one of your React components:
    in Unknown (at src/index.tsx:13)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries. index.js:1
Uncaught undefined bootstrap:858
Uncaught undefined
Python Projects 2021 For Students With Source Code
Tags: python, pythonprojects, techarge
Published: 2021-05-04 12:10:28

Python has become one of the most popular languages. So getting only the theoretical knowledge will be of no use unless and until you don’t work on some real-time projects. Working on such projects will test your Python knowledge and you will get some hands-on experience. Moreover, working on such projects will help you improve your knowledge. 


Here Is the list of python projects that you must should try:
1.[PYTHON GUI CALENDAR USING TKINTER](https://techarge.in/python-gui-calendar-using-tkinter/)
2.[PYTHON: SHUTDOWN COMPUTER WITH VOICE](https://techarge.in/python-shutdown-computer-with-voice/)
3.[Python: GUI Calendar](https://techarge.in/python-gui-calendar/)
4.[Covid-19 Tracker Application Using Python](https://techarge.in/covid-19-tracker-application-using-python/)
5.[Country Date and Time using Python](https://techarge.in/country-date-and-time-using-python/)
6.[Alarm clock GUI application with tkinter](https://techarge.in/alarm-clock-gui-application-created-tkinter/)
7.[Currency Converter in Python](https://techarge.in/currency-converter-in-python/)
8.[Python Rock Paper Scissors Game](https://techarge.in/python-rock-paper-scissors-game/)
9.[StopWatch using Python](https://techarge.in/stopwatch-using-python/)
10.[Python YouTube Downloader with Pytube](https://techarge.in/python-youtube-downloader-with-pytube/)

Plus one Bonus

11.[Python YouTube Downloader with Pytube](https://techarge.in/python-text-to-speech/)


For More Check out [Techarge](www.techarge.in)
Daily Developer Jokes - Tuesday, May 4, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-05-04 12:00:16

---
title: "Daily Developer Jokes - Tuesday, May 4, 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%20May%204%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/5e1259a37a785.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:
A new database query walks into a bar.

The server says "Sorry, cache only."
 -->
SPIFFS Error:esptool not found!
Tags: esp32, arduino, spiffs, esptool
Published: 2021-05-04 11:36:57

今天在 Arduino IDE 下使用 ESP32 Sketch data upload 功能一直錯誤：

![](https://i.imgur.com/LWNM8Rd.png)

爬文了之後才發現, [arduino-esp32fs-plugin](https://github.com/me-no-dev/arduino-esp32fs-plugin) 會在 ESP32 的 package 下 espressif\esp32\tools 尋找並執行 esptool.exe 檔, 但此資料夾下只有 Python 版本的 esptool.py 檔, esptool.exe 是在 espressif\esp32\tools\esptool 下, 只要複製到上述資料夾下就可以正常運作了。

從他的原始碼也可以看到：

![Screenshot_20210511-083707](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ljf9d6n7txo485sdlal.png)
![Screenshot_20210511-095528](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7kbmgg3di6mgn4j3sv6.jpg)
 
在 Windows 平台上, 它會尋找 .exe 的 esptool。
Spike APIs with Postman
Tags: api, design, postman
Published: 2021-05-04 11:27:52

[Postman](https://www.postman.com/) is an incredibly useful tool for exploring, collaborating on, and testing APIs and API design. For me, its strengths lay in the ease and flexibility of [spiking](https://en.wikipedia.org/wiki/Spike_(software_development)) out solutions with existing or new APIs.

We can investigate or design an API with [Collections](https://www.postman.com/collection/), a logical grouping of sequential API calls. An example can be seen below.

![Screenshot 2021-05-04 at 12.04.05](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xmxvrykk73ne8ig97p2o.png)

[Variables](https://learning.postman.com/docs/sending-requests/variables/) support the flows we want to investigate, providing shared state between APIs calls.  The variable can be specified at a global environment level or scoped to the collection.

Below is an example of a [Pre-request script](https://learning.postman.com/docs/writing-scripts/pre-request-scripts/), the script is associated with a particular API call and runs before the API is invoked. In this example we evaluate [Dynamic variables](https://learning.postman.com/docs/writing-scripts/script-references/variables-list/) and then set collection variables that'll be used in this API call.

```javascript
const orgId = pm.variables.replaceIn('{{$randomUUID}}');
const orgName = pm.variables.replaceIn('{{$randomCompanyName}}');

pm.collectionVariables.set("_orgname", orgName);
pm.collectionVariables.set("_orgid", orgId);
```

These variables are interpolate using the `{{ var }}` syntax.

![Screenshot 2021-05-04 at 12.03.52](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q7rpou3xl4zxmeoarn2z.png)

More often though, we need the result of the API for a later call in the collection. This can be achieved with [Tests](https://learning.postman.com/docs/writing-scripts/test-scripts/) which in this scenario is acting as a post-request script rather than running any assertions. Tests come into their own when we integrate with CI pipelines beyond the design phase.

```javascript
const d  = JSON.parse(responseBody);

if(d?.access_token){
    pm.collectionVariables.set("_token", d.access_token);
}
```

We can use the same variable interpolation to set the Authorisation bearer token.

![Screenshot 2021-05-04 at 12.05.27](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d38gd6764ajhzyfvlr09.png)
 
Before Postman I would have relied on prototyping in the browser and/or NodeJS to spike out API flows and architectures. Postman provides a much faster workflow, with the added benefit of feeding into other pre and post design activities including collaborative design and documentation.
Building a Real-Time Leaderboard app Using Redis
Published: 2021-05-04 11:12:42

---
title: Building a Real-Time Leaderboard app Using Redis
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

![Screenshot 2021-05-04 at 4.42.05 PM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/plcj058garxylrfeg3dg.png)
 

The concept of a leaderboard—a scoreboard showing the ranked names and current scores (or other data points) of the leading competitors—is essential to the world of computer gaming, but leaderboards are now about more than just games. They are about gamification, a broader implementation that can include any group of people with a common goal (coworkers, students, sales groups, fitness groups, volunteers, and so on).

Leaderboards can encourage healthy competition in a group by openly displaying the current ranking of each group member. They also provide a clear way to view the ongoing achievements of the entire team as members move towards a goal. Gamification of tasks and goals via leaderboards is a great way to motivate people by providing them with constant feedback on where they rank in comparison to other group members. Done well, this can lead to healthy competition that builds group cohesion.

Want to know how to build a Real-Time Leaderboard app using Redis, follow the link https://developer.redislabs.com/howtos/leaderboard
Tips to test SSL parameters in command line
Published: 2021-05-04 11:08:55

During an Istio set-up with all the SSL Stuff, I had some issues with SSL. So I found the following commands to do some tests.

---

# Check the certificate exposed by an endpoint
With OpenSSL, we can check if an endpoint support a specific version of TLS, and if yes, with which certificate.

## Request
*Example to test google.com on port 443 with TLS 1.2*
> openssl s_client -connect google.com:443 -tls1_2

To test with other versions of TLS, you just need to change *tls1_2* by *tls1_1* or *tls1_3*.

## Answer
*Example of an answer where the endpoint support TLS 1.2*
```
CONNECTED(00000003)
depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
verify return:1
depth=0 CN = example.com
verify return:1
---
Certificate chain
 0 s:/CN=example.com
   i:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
 1 s:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
   i:/O=Digital Signature Trust Co./CN=DST Root CA X3
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIFDjCCA/agAwIBAgISA0nt67i+GAazJs4e+bBSMqB6MA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD
ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xNzA1MjMyMTU5MDBaFw0x
NzA4MjEyMTU5MDBaMBcxFTATBgNVBAMTDGluaXNtZWFpbi5pZTCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBANLrc8IH2BP51XLhR6L2/IjRuNYcoj6UH58K
NzA4MjEyMTU5MDBaMBcxFTATBgNVBAMTDGluaXNtZWFpbi5pZTCCASI.........
dl0=
-----END CERTIFICATE-----
subject=/CN=example.com
issuer=/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
---
No client certificate CA names sent
Peer signing digest: SHA512
Server Temp Key: ECDH, P-384, 384 bits
---
SSL handshake has read 3019 bytes and written 463 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: DF39CB241F6580C6E6570E0E9827D7F8615A71A76359DB4F9D1B9D3AD
    Session-ID-ctx:
    Master-Key: 12E8FF788E15AAA2E95BE35C5864784B90ED5A9AE8352AFE98C7DCADB04E
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1502214066
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
---
closed
```

---

# Do curl with a specific version of TLS
Sometimes you need to do some calls with a specific version of TLS. So here, with curl, you can add parameters to define which version of TLS you want to use.

> curl --tlsv1.2 --tls-max 1.2

---

# Retrieve supported ciphers list
If you are not sure about which ciphers are supported by your server, you can use the following command to list them.

## Request
> openssl ciphers -v

## Answer
*Example of one line representing a cipher. Normally you should have a couple of lines like this one.*
```
...
ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD
...
```

---

I hope it will help you!

*Please don't hesitate to give me feedback to help me to improve my writing skills.*
How to Create Central Bank Digital Currency (CBDC) over XinFin (XDC) Network?
Tags: xinfin, digitalcurreny, cbdc, xdc
Published: 2021-05-04 10:49:01

Abbreviated from Central Bank Digital Currency, CBDCs are digital or electronic representations of national fiat currencies. Leveraging distributed ledger technologies such as blockchain, CBDCs enable central banks to increase payment efficiency while drastically lowering transaction costs.

Although similar to cryptocurrencies such as bitcoin or ether, CBDCs have substantial distinctions. While the former is mostly unregulated, CBDCs function under the governance of a nation’s central financial authority. Furthermore, CBDCs are mostly stablecoins, backed by physical assets of value, such as gold or other foreign currencies; this eliminates the volatility crisis facing ordinary cryptocurrencies.

Combining these factors, then, CBDCs are more secured, efficient, transparent, and cost-minimized versions of money deposited in your bank account. In 2020, China’s central bank began an experiment with digital yuan in Suzhou, Chengdu, and Xiong’an. According to its governor, Li Bo, the ‘testing had shown that the issuance and distribution mechanism of the digital yuan, or e-CNY, are compatible with the existing financial system, and help minimize the impact on the banking sector.’

Following suit, the Reserve Bank of India has also expressed plans to explore CBDCs; so have Bank of England, Bank of Canada, and the central banks of Uruguay, Thailand, Venezuela, Sweden, and Singapore, among others. Against this backdrop, let us discuss how central banks can build robust CBDCs over the XinFin Digital Contract (XDC) network.

Creating CBDCs with XinFin XDC Network

Having discussed the overall benefits of using blockchains for CBDCs, and especially why central banks might prefer using XinFin, let us now look at the creation process. As such, based on the asset backing them, CBDCs can be of four broad types: fiat-collateralized, crypto-collateralized, commodity-collateralized, and non-collateralized.

While collateralized CBDCs usually have a 1:1 backing, non-collateralized ones leverage Seigniorage Shares Systems. But for each of these types, the process of creating CBDCs on XinFin is mostly similar and extremely easy. It only takes a few minutes, and the steps are as follows:

Step 1: Visit the MyContract website, to start creating your stablecoin, either on the XinFin Mainnet or the XinFin Apothem Network.

Step 2: Log in to the portal, either with XinPay or your private key.

Step 3: Enter the details of your stablecoin, such as name, symbol, supply, and so on.

Step 4: Review the details carefully; mistakes can lead to loss of funds and also credibility among potential users.

Step 5: Click on the ‘Issue Token’ button, and voila, your CBDC is ready for use; confirm the issuance using XinFinScan.

Read original article: https://www.thecryptoupdates.com/how-to-create-central-bank-digital-currency-cbdc-over-xinfin-xdc-network/
Binary Search Trees
Tags: design, analysis, algorithms
Published: 2021-05-04 10:48:25

A Binary Search tree is organized in a Binary Tree. Such a tree can be defined by a linked data structure in which a particular node is an object. In addition to a key field, each node contains field left, right, and p that point to the nodes corresponding to its left child, its right child, and its parent, respectively. If a child or parent is missing, the appropriate field contains the value NIL. The root node is the only node in the tree whose parent field is Nil.
1. In-Order-Tree-Walk (x): Always prints keys in binary search tree in sorted order.

INORDER-TREE-WALK (x) - Running time is θ(n)
 1. If x ≠ NIL.
 2. then INORDER-TREE-WALK (left [x])
 3. print key [x]
 4. INORDER-TREE-WALK (right [x])
2. PREORDER-TREE-WALK (x): In which we visit the root node before the nodes in either subtree.

PREORDER-TREE-WALK (x): 
 1. If x ≠ NIL.
 2. then print key [x]
 3. PREORDER-TREE-WALK (left [x]).
 4. PREORDER-TREE-WALK (right [x]).
How to Image Validation in Laravel ?
Published: 2021-05-04 10:47:52

So the file validation in file size to validate the file in laravel application. Now in case of string, it validates the length in characters. So now we need to a new validation option: image dimensions for image uploads. Now the validation rule is called dimensions.

public function solution(Request $request)
{
    $request->validate([
        'image' => 'required|image|mimes:jpg,png,jpeg,gif,svg|max:2048|dimensions:min_width=100,min_height=100,max_width=1000,max_height=1000',
    ]);

}

<a herf="https://codingspoint.com/how-to-image-validation-in-laravel"> Details</a>
Create Ascii art with Python
Tags: python, showdev, tutorial
Published: 2021-05-04 10:44:11

Hello all, in today's quick tutorial I will show you a small Python script that converts image files into beautiful ASCII art. 

This is our test image: 

![enter image description here](https://i.ibb.co/P4P16kN/test1.jpg)
Let's jump to the code:

First we need to import our dependencies:
```python
import sys
from PIL import Image
from termcolor import colored
import colorama
```
First we need to read our image:

```python
colorama.init()
try:
    image_path = sys.argv[1].strip('-')
except:
    image_path = input('test1.jpg')
```
then we will be converting it into grayscale

```python
class AsciiArt:
    def __init__(self, img_path):
        self.path = image_path
        self.img = Image.open(self.path)

    def image(self):
```
after that, we resize the image:

```python
		width, height = self.img.size
		aspect_ratio = height/width
		new_width = 120
		new_height = aspect_ratio * new_width * 0.55
		img = self.img.resize((new_width, int(new_height)))
```
new size of image, and we convert image to greyscale format
```python
		img = img.convert('L')
		pixels = img.getdata()
```
replace each pixel with a character from array
```python
		chars = ["B", "S", "#", "&", "@", "$", "%", "*", "!", ":", "."]
        new_pixels = [chars[pixel//25] for pixel in pixels]
        new_pixels = ''.join(new_pixels)
```
split string of chars into multiple strings of length equal to new width and create a list

```python
		new_pixels_count = len(new_pixels)
        ascii_image = [new_pixels[index:index + new_width]
                  for index in range(0, new_pixels_count, new_width)]
        ascii_image = "\n".join(ascii_image)
        print(ascii_image)
```
write to a text file.
```python
	  file = "ascii_image.txt"
      with open(file, "w") as f:
            f.write(ascii_image)
            print(colored(f"saved art image to file as {file}", "yellow"))
```

Last step:
```python
if __name__ == "__main__":
    AsciiArt(image_path).image()
```
This is our final result -  
![enter image description here](https://i.ibb.co/bHDsJ16/final.png)

Thank you all.
Matthew Brannelly | Rebranding Failure Reasons
Tags: rebranding, strategy, businessgrowth
Published: 2021-05-04 10:33:24

According to Matthew Brannelly, companies are constantly looking for ways to make their brand relevant says Matthew Brannelly. Many of them re-strategize to change the brand identity through rebranding. 

Read on as Matthew Brannelly, the founder of Orbit and NFP hub, a company what  works with NFPs to become more efficient and achieve their goals explains why rebranding often fails.
https://foolic.com/business/why-rebranding-fails
What about PHP components? Ok, let's create. Part 1. Working with headers.
Tags: php, programming, webdev
Published: 2021-05-04 10:30:51

I do a lot of programming in PHP and every time something starts that doesn't reach the end, and so on. As a result of thinking, I realized that every time I decide to write my own system, framework or something else, I run into a problem. The problem is that I do everything around for the system to work, and not the system itself, or I write too dependent code. As a result, I decided that it was worth taking the time to write only components that will not depend on something personalized, but can depend on each other. This approach is also a bit weird, but still passing an interface to work is better than initializing another class inside a class. For example, for some component it will be necessary to use a database, but we do not know exactly what methods are there, so we operate with our own interface, where we ask to implement a class with such and such a method. Something we have gone from the topic to abstraction.
And so, I began to make my written projects in pieces. As a result, nothing efficient came out, as there were strong dependencies. I had to write again ... The first component that I decided to implement was working with headers. Why exactly he? Because most of the work is built around the communication between the server and the client. And here, just, you need to work with headers.
For all my components, I decided to adhere to the same logic of organizing the file structure: a folder for interfaces, a folder for exceptions, and the class file itself. The folder with interfaces must contain at least 1 interface for the class. There may be no exceptions in the folder with exceptions, because you don't always need to have personal exceptions.

```
src/
--- interfaces/
--- --- ClassInterface.php
--- exceptions/
--- --- ClassException.php
--- Class.php
```

Now let's briefly talk about the methods that are available in the class for working with headers.

1. set(array $params)
2. add(array $params)
3. remove(string $key)
4. removeAll()
5. has(string $key)
6. get(string $key)
7. getAll()

I don’t think it’s necessary to give a clear explanation of the methods, but if you are interested, you can look at the [GitHub repository](https://github.com/mepihindeveloper/php-headers). True, now I'm translating my work into English, so don't be too surprised.

And at the end of the part, I want to note that there will be even more classes in the future. I try not to clutter up the post with code, since you can all look at [GitHub](https://github.com/mepihindeveloper/php-headers). You can also download the project from [composer packagist](https://packagist.org/packages/mepihindeveloper/php-headers).
Technical Documentation Services
Tags: technicaldocumentationservices, technology
Published: 2021-05-04 09:59:51

ThinkPalm provides a comprehensive technical document creation and maintenance service that aids in the achievement of content objectives for your processes, products, and services. With technology easing its way through ever-increasing complexities while reducing human effort in service, the time has come for seamless product information delivery from the point of sale to deployment. 
Learn more about our service offering: https://thinkpalm.com/services/tech-documentation-services/