teleren/devto huggingface dataset:
What is a Merkle Tree?
Published: 2021-09-16 21:32:30

Merkle trees, sometimes referred to as hash trees, were invented in 1979 by Ralph Merkle. Merkle Trees are a data structure that expands upon the topics of binary trees and cryptographic hashes. Merkle trees have unique applications in distributed systems like [Interplanetary File Storage Service(IPFS)](https://www.ipfs.com/), [Bitcoin](https://bitcoin.org/en/), and [Ethereum](https://ethereum.org/en/). 

## The Binary Tree

A key distinction of a binary tree is that it can only have two children per node, whereas a regular tree can have many children for each node. A child node with no children is called a leaf node. Here is a simple diagram of a tree of depth = 2. The depth is the amount of levels of parent nodes. The binary tree can only have two children per node. 

![Binary Tree](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/by1uy89xz3bc7ynf0w9y.png)

## Cryptographic Hashes

A cryptographic Hash is a mathematical function that is "one way" meaning once you have a hash of a value, you can't use the hash function to obtain the original input value. A unique hash value is produced by first breaking all data into a numerical representation that is then fed to a hash function. Good hash functions also have the following properties:

- It is extremely unlikely that two values would produce the same hash (called a hash collision)
- It is computationally difficult for an individual to obtain the data from a hash
- The hash is fast to Compute
- They are deterministic, meaning the same value will always produce the same hash
- A small change in the input should produce a drastically different change in the output

## Merkle Trees

Now that we have an overview of the foundational concepts that make up a merkle tree we are ready to dive in. To introduce a Merkle tree, first imagine a distributed system that needs to distribute data across a network. The data would first be broken down into files or chunks and then sent out to corresponding network nodes. But how would you know that an untrusted entity didn't tamper with any of the data? This is where the Merkle Trees come in. The Merkle Tree is a binary tree where the nodes are hashed. For example say you have four files noted 1-4 that contain pertinent information. Each file would be hashed and the hash values would make up the leaves of our tree, where node D = H(1), E = H(2), F = H(3), G = H(4). Then the parents of the nodes are hashes of the concatenation of their child nodes. For example node B = H(H(1), H(2)) and node C = H(H(3),H(4)). The root node is computed in the same way as a hash of the hash values of node B and C. 

With this data structure, as long as the root node is from a trusted source, one can verify the integrity of any of the other files with information from an untrusted source.
How to use printer on Linux
Tags: cups, printer, linux
Published: 2021-09-16 21:04:48

## Hello everyone,
For those who think that using a printer is difficult on Linux, here is a little guide on how to install, configure and use any printer on any Linux distribution.

ps. Sorry if my english is not so good... I'm just learning.

## Step 1: Download cups
Open your terminal and type:


```
sudo pacman -S cups
```
> You can use *pacman* or *apt-get* or other package manager

## Step 2: Start CUPS

```
sudo systemctl start cups
```

## Step 3: Enable CUPS

```
sudo systemctl enable cups
```

### Step 4: Configure CUPS

```
sudo nvim /etc/cups/cupsd.conf
```

Scroll down and find "Show shared printers on the local network" section. Here, you will find an entry title, "Browsing Off". Change this "Browsing On"

```
# Show shared printers on the local network.
Browsing On
BrowseLocalProtocols dnssd
```

Next, find the "Only listen for connections from the local machine" section and change.

```
# Only listen for connections from the local machine.
Port 631
Listen /run/cups/cups.sock
```

Now, find the "Restrict access to the server" section and add "Allow @LOCAL".

```
# Restrict access to the server...
<Location />
	Order allow,deny
	Allow @LOCAL
</Location>
```

And, find the "Restrict access to the admin pages" section. If you want to modify here.

```
# Restrict access to the admin pages...
<Location /admin>
	AuthType Default
	Require valid-user
	Order allow,deny
	Allow @LOCAL
</Location>
```
Finally, save and exit.

## Step 5: Restart CUPS

```
sudo systemctl restart cups
```

## Step 6: Add your printer in CUPS

Open your browser and type: localhost:631

![localhost631](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9bqme1ngas76lgbz2dhp.png)

In the page, click in Administration.

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

A login screen will appear.

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

>The username is: root and password is the same that you use in your root.

Inside Administration, click in **Find New Printers**, then we will find printers that are within CUPS range, but if we want, we can do it manually clicking in **Add Printer**

![administration inside](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l0p799zsc01ymcz9p5s2.png)

## Step 7: Verify Succesful Setup of CUPS Print Server

Now, we will verify if the printer that we add is ready to use.

## Step 8: Open Printer 

Open your linux distribution.

In my case, I use gnome as a desktop environment, so I will find in settings.

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

Click in add.

![add printer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sn6aij392c882y7oiuz1.png)


And finally, add our printer.
I hope I was helpfull. I tried to be as brief as possible, but if you want to go deeper about CUPS, I leave the links below.

### FONTS
https://wiki.archlinux.org/title/CUPS
https://www.cups.org/
https://ubuntu.com/server/docs/service-cups
https://linuxhint.com/cups_print_server_ubuntu/
Translate to Braille
Tags: python, braille, vscode
Published: 2021-09-16 20:29:12

In 2015, there were an **estimated 253 million** people with visual impairment worldwide. Of these, **36 million were blind** and a further 217 million had moderate to severe visual impairment (MSVI). Many blind people use Braille for reading purposes. 
Braille is the world's __most popular tactile reading and writing system__.
In the below program, I have shown a way to convert English to Braille, another program, I’m working on is to convert image to speech.
___Program takes into account alphabets, numbers, puntuations and symbols.___

Created using Python 3.9 (Latest version) -download [here](https://www.python.org/downloads/windows/)

### Defining translation values based on Grade 1 Braille
       alphaBraille = ['⠁', '⠃', '⠉', '⠙', '⠑', '⠋', '⠛', 
       '⠓', '⠊', '⠚', '⠅', '⠇','⠍', '⠝', '⠕', '⠏', '⠟', '⠗', 
       '⠎', '⠞', '⠥', '⠧', '⠺', '⠭', '⠽', '⠵', ' ']
       numBraille = ['⠼⠁', '⠼⠃', '⠼⠉', '⠼⠙', '⠼⠑', '⠼⠋', 
       '⠼⠛', '⠼⠓', '⠼⠊', '⠼⠚']
       alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 
        'j', 'k', 'l', 'm','n', 'o', 'p', 'q', 'r', 's', 't', 
        'u', 'v', 'w', 'x', 'y', 'z', ' ']
       nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9','0']

###Logic
    
        if len(translateToBraille) > 0 : 
        for n in translateToBraille.lower():
            if n in alphabet:
                inputString += alphaBraille[alphabet.index(n)]
            elif n in nums:
                inputString += numBraille[nums.index(n)]
            elif n in puntuation:
                inputString += puntuationBraille[puntuation.index(n)]
            elif n in character:
                inputString += characterBraille[character.index(n)]
        print(inputString)


#To test our cases 
translateToBraille = 'This is good day & Tony what are you planning to do @ the mall ?'

#Output 

![output in braille shown in Visual Studio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/feb32ggm6keogym91wn1.jpg)

Code in [Github](https://github.com/swapanroy)
Reach me on my  [Twitter](www.twitter.com/royswapan)

Note: Thanks to Paul for this photo via @unsplash 🎁 



Other item to look into: 
{% post https://dev.to/swapanroy/currency-converter-with-python-9ef %}

{% post https://dev.to/swapanroy/dictionary-using-api-calls-in-python-with-audio-pronunciation-3hjp %}
Text 2 Html converter
Tags: javascript, showdev
Published: 2021-09-16 20:23:20

Static Site Generator for the OSD600 course that converts .txt to .html

## Features
* Support for custom stylesheets
* Custom output directory

## Installation
To run this script you need to:
1. `git clone https://github.com/tcvan0707/txt2html.git && cd txt2html`
2. `npm install`

## Example
Running `npm start -- -i hello.txt` containing
```
Hello world!

This world is beautiful
```

will generate output file `dist/hello.html` containing
```
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>hello</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">

</head>
<body>
<p>Hello world!</p>
<p>This world is beautiful</p>
</body>
</html>
```

## Usage
```
Usage: txt2html.js [options]

Options:
  -h, --help        Show help message                                  [boolean]
  -v, --version     Show current version                               [boolean]
  -i, --input       Input txt file / directory with txt files         [required]
  -o, --output      Path to folder with generated files        [default: "dist"]
  -s, --stylesheet  Adds custom CSS to generated html
```

## GitHub repo
View soure code on [GitHub](https://github.com/tcvan0707/txt2html)
LENNAH - A simple static site generator
Tags: opensource, cpp
Published: 2021-09-16 18:19:04

For our first assignment we are to make a SSG in whatever language we want. So I decided to make mine is C++ because its been a while since I last did any C++. I've been taking a lot of web development courses two semesters ago but not really many C++, and I just learned C# at my co-op job over the summer. So my C++ is a little rusty so I figured this is the best project to get the rust off again. 

So here is LENNAH, my simple static site generator! Why is it called LENNAH? I just randomly got a character from a game and liked the name.

LENNAH takes a txt file or a folder containing txt file(s) and converts them into html files with simple formatting.

## Features
- The first line of the txt will be set as the HTML title and be given \<h1> tags
- If a folder is given as the input path it can recursively search deep folders within it

## How to use
1. Clone the repo from [here](https://github.com/joshuali7536/LennahSSG).
1. Get the absolute path of the LennahSSG.exe (e.g. C:\Users\\\<Username>\LennahSSG\Debug\LennahSSG.exe)
1. Open the console and enter the path followed by an argument

### Arguments
Argument | Description
------------ | -------------
`-h`, `--help` | Displays the help information
`-v`, `--version` | Displays the current version number
`-i <PATH>`, `--input <PATH>` | Converts txt file(s) at the `<PATH>` to html

## Example
Here's a little example of how to use LENNAH
```
C:\Users\User\LennahSSG\Debug\LennahSSG.exe -i "Silver Blaze.txt"
```
This will result in this [sample html page](http://joshuali7536.github.io/LennahSSG).

More features will be added throughout my open source course so I'm excited to see what comes next for LENNAH!
Basic TypeScript {Day - 28}
Tags: 100daysofcode, javascript
Published: 2021-09-16 17:58:47

#100daysofcode {Day - 28}

Gaining basic knowledge about TypeScript...!
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k64o60tsrwwv9diu6kf3.jpg)
Run tests 2-3x faster on average
Tags: ruby, testing, showdev
Published: 2021-09-16 17:48:51

I have been working on rspec-tracer that allows you to **detect flaky tests** with no additional effort and provides **better insights on dependencies** between various components in your project by analyzing specs and their dependencies by generating HTML reports. The gem safely skips all such tests with no dependent files changed, resulting in at least **2-3x faster test execution** on average.

https://github.com/avmnu-sng/rspec-tracer
Codecademy CS101 Final Project: Electric 7's
Tags: python, codenewbie, codecademy
Published: 2021-09-16 17:48:04

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6cy79852cdos13ztoxc7.png)

# Introduction
I've been taking the Computer Science course on Codecademy for a little over a month and the final project for the 101 course is to create a terminal game using python. Originally I was going to create a text based adventure game, but after a night with some friends where we wanted to play a game but lacked the cards required to play, decided that this would be a more useful way to spend my time. I'm happy I made the change since this required me to think outside the box a few times to figure how to make the game work.

# Design
The program takes in the number of players, using this information to to later split the deck between players. The deck is created by iterating through 1-13 and each suit, adding the two together to make each card. Once this is accomplished the 7's are removed and the remaining cards are shuffled and dealt to a variable to represent each players hand.

In order to iterate through the players, I created a play function that adds one to itself after each turn taken until the count reaches 48, the number of cards left in the deck after removing the 7's. The program then begins running through the play function, which prints the current cards that have already been played and the players hand. The player is prompted to pick a card to add to the playing field. Depending on the input, the program decides if the player gives or takes drinks as well as how many based on the range of cards in that suit. This is then repeated for each player until the game is complete and the program ends.

If you would like to try it out or look at the code, the github repo is [here](https://github.com/nealhannon/electric_7s)

# Possible Refactoring
I would possibly like to go back and retry making this program using object oriented programing. I feel like the code was slightly long for what the program does and feel like OOP may help reduce the size of the code.
OSD600 Static Site Generator (Release 0.1)
Tags: javascript, osdssg, opensource, realease01
Published: 2021-09-16 17:23:13

OSD600 Static Site Generator(osdssg) allows users to generate HTML file(s) from raw data and files. This tool will run by using the command-line.

**Language:** 
- JavaScript

**Supporting packages:**
- yargs 
- node-html-parser

**Features:**
- Generating an HTML file from user's file input.
- Generating HTML file(s) from user's folder input (Each file inside the directory will generate 1 HTML file).
- File(s) generated will be stored inside new created "dist" directory.
- "dist" folder will renew every time a new command-line executed (Old file(s) will be deleted and new file(s) will be added).
- Creating a title inside head tag and transforming the first line of the text to h1 tag.
- Creating stylesheet link tag if users use --stylesheet or -s flag.

**Options:**
-v,--version: Show current version of osdssg
-h,--help: Display all options available
-i,--input: Input file or directory and generate HTML file(s)

**Installation:**
```
git clone https://github.com/nguyenhung15913/OSD600-SSG.git
cd OSD600-SSG
npm install // install all the packages required
npm link // link my-command file with package.json so that you can use the osdssg command
```

**Usage:**
```
osdssg -i <file's location> // (If file name has whitespaces, put it into a double quote e.g: osdssg -i "Silver Blaze.txt")
osdssg --input <directory's location> // Read all files inside and creates html files for each
```

**Example 1:** 
- Generate an .txt file into .html file. You can see that the "Silver Blaze.txt" is inside the root folder.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r3e5k1sf4x235ck9jk4a.PNG)
As a result, index.html is created inside "dist" directory with new title and a h1 text at the top of the body tag.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xj4is3a5cpybm6vgcccn.PNG)

**Example 2:**
- Generate all files inside a directory into HTML files with stylesheet link added. "dir1" is inside the root folder
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zyn91q1vydeewm4rx8lg.png)

- New files are generated inside "dist" (old index.html has been removed) and link tag has been added to each html file.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/muou5tr7gamwwig6wlw4.PNG)

Note: This is first version of the program so it may contain some errors. If you catch some, feel free to contact me.

Email: hnguyen97@myseneca.ca
Repo link: https://github.com/nguyenhung15913/OSD600-SSG
Android JUnit5 Gradle: No tests found for given includes Error
Tags: android, gradle, testing, java
Published: 2021-09-16 17:21:30

Hi I hope you're an android developper.

I will share how to solve the common problem "No tests found for given includes ...".

## The Error
It occurs after we finished to add JUnit5 dependencies to gradle, wrote and run tests.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iac4znzzme3i6vvzkjx9.PNG)


## Before the error

I was on Android Studio 3.6 and using gradle 3.6.4. And when I upgraded Android Studio to the latest version Arctic Fox Patch 2, my tests did not run anymore.

So I decided to upgrade the version of JUnit 5.3.2 to 5.7.2 with no success. Then I started searching.

## Common Solution

The common solution I found was to update the build.gradle file like this

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r3tpfpaaha9o3fthedtv.PNG)

Even adding it under adroid section in build.gradle file or in the build.gradle itsef, I got the following error, when I tried to sync or rerun you test:  

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/heiq8y7hlhybj0xkezzg.PNG)

I dig more deeper on gradle, finally I've found out the solution

## The solution

Just remove the common solution and add lines like on the screenshot

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i757h75lyjcebq4oarbu.PNG)

And after that, sync the project with the gradle file, and run the test. 

The tests is instantiated and....

 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/97vz6d5hgw7saa6ju7mb.PNG)
As we wrote a good test...

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w1sqi81svdkd4qc3fgqn.PNG)


## Conclusion

No matter what happens as an error, reading the documentation is one of the best places to start searching for a solution.
An awesome tool
Tags: github, opensource, software, developer
Published: 2021-09-16 17:20:42

Tired of updating GitHub profle-README with latest features again & again?

If yes, then @rahuldkjain  has developed a tool to do the same for you in just 1 click 🤓. This is a must try tool, I tried it out and it was just awesome.

[![Live Tool](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cb8j02gp7sfsrl1t8xsr.png)](https://rahuldkjain.github.io/gh-profile-readme-generator/)
Java Series Iterations
Tags: java, programming, computerscience
Published: 2021-09-16 16:56:14

```java
/*
series.java
    This program prints a series of numbers for each iteration of 
    t so that a, b and n create the series.
by: Scott Gordon
*/
import java.util.*;
import java.io.*;

class Solution{
    public static void main(String []argh){
        Scanner in = new Scanner(System.in);
        int t=in.nextInt();
        for(int i=0; i<t; i++){
            int a = in.nextInt();
            int b = in.nextInt();
            int n = in.nextInt();
            int x = a;
            for(int j=0; j<n; j++){
                x += b * Math.pow(2, j);
                System.out.print(x + " ");
            }
            System.out.println();
        }
        in.close();
    }

```
Photo by <a href="https://unsplash.com/@jonasjacobsson?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Jonas Jacobsson</a> on <a href="https://unsplash.com/s/photos/java?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
30+ Awesome CSS Background Animation
Tags: html, css, javascript, beginners
Published: 2021-09-16 16:52:04

Hello Friends, in this article I have listed 30+ Awesome CSS Background Animation Examples. Check out these excellent Background Effect which are available on CodePen.

### Best Background Animation In CodePen
***In this collection, I have listed over 30+ best Background Animation Check out these Awesome CSS Background Effects like: #1 SVG Animated Background, #2 Pulse Background Animation, #3 Gradient background animation and many more***

#### #1 SVG Animation Background
Awesome SVG Background Animation, which was developed by Yoshiyuki ITO. Moreover, you can customize it according to your wish and need.

{% codepen https://codepen.io/thanks2music/pen/VmJjaG %}


#### #2 Galaxy Background Animation
Galaxy Background Animation which was updated by Rahul. Moreover, you can customize it according to your wish and need.

{% codepen https://codepen.io/stack-findover/pen/eYWPwPV %}

#### #3 CSS Pulse Background Animation
Pure CSS Pulse Background Animation which was updated by Bruno Pereira do Nascimento. Moreover, you can customize it according to your wish and need.

{% codepen https://codepen.io/brunopereiradonascimento/pen/ZjLNmO %}


#### #4 Infinite Moving Clouds background animation

Infinite Moving Clouds background animation which was updated by Animation Bro. Moreover, you can customize it according to your wish and need.

{% codepen https://codepen.io/animationbro/pen/QWbpqwR %}


#### #5 Floating Color Orbs

Floating Color Orbs Animation which was updated by Alison Quaglia. Moreover, you can customize it according to your wish and need.

{% codepen https://codepen.io/hylobates-lar/pen/bGEQXgm %}


### <a href="https://blog.stackfindover.com/css-background-animation-examples/">Check all CSS Background Animation</a>
A simple static site generator: The GREAT Site Generator v0.1
Tags: opensource, cpp
Published: 2021-09-16 16:50:27

For my first project in open source development, I created a static site generator which takes text files and converts them into HTML. It's called The GREAT Site Generator. Currently it's not so *great* as the name implies, but I am excited to be working on new features. 

As part of this project, I will be collaborating with developer @luigizaccagnini on his site generator as well, written in Javascript. Hopefully we can work to improve each others projects and make them useful tools for all to use! 

You can read more about The GREAT Site Generator and how to use it on [Github](https://github.com/drew5494/the-great-site-generator).