teleren/devto huggingface dataset:
A Quick Crypto/Web3 Primer
Tags: blockchain, web3
Published: 2022-03-25 03:32:00

Want a quick start on Crypto and Web3?

Then keep reading!

## Eras of the Web

- Web1 - Google, Amazon
  - Users consume content
- Web2 - Facebook, Uber
  - Users create content
- Web3 - Ethereum, OpenAI
  - User own content

Where Web3 and Crypto align is they both seek to:

- Use technology to help the disadvantaged
- Fix what’s wrong with the internet today


## Blockchain Architecture

#### Current: 

- Client <-> Server
- Owned by Some Company
- Monopolistic, Single points of failure

#### Blockchain
 
- P2P Networks
- Validators that keep the network honest 
- Decentralized governance & permissions
- Global state
- Multiple points of failure


## Blockchain trades technical scalability for social scalability

4 layers to understand blockchain:

0. Hardware & Networking (A Computer)
1. Consensus & Settlement (Bitcoin and Eth)
2. Smart Contracts (MAKER & UniSwap)
3. Wallets & UI (MetaMask & Compound)

## Last 10 Years of Crypto

3 waves of activity
- 2010-2012: Bitcoin, Architecture(Miners + Exchanges)
- 2012-2016: New L1 Blockchains, Privacy + Alt Coins
- 2016-2020: DeFi, Layer2, Smart Wallet apps, NFT Marketplaces

Skepticism was rising after the 2018 crypto bubble crash.
But insiders realize each cycle brings the capital needed to invest in critical infrastructure

- Decentralized Exchanges
- Lending Protocols
- L1 Blockchains
- Stablecoins
- Smart Wallets
- Developer Tools
- Storage Protocols

## Rise of NFTs

Currently, when you upload a file

- The file is copied to an organizations backend
- Ownership is transferred to that org

Blockchains enable

- Individual Ownership
- Public access
- Provenance
- Composability

## How can NFT's help Creators?

Content creators can use NFT's to

- collect royalties from the trade of their asset
- grant benefits to holders
- create token-gated communities

## Future of NFTs

Is it the McRib NFT? NO

Creator DAO's

- Many ways of fundraising for projects
- Community-led decision making
- Transparent capital flows
- Employees and customers share in the upside

Starting a global corporation will be as simple as creating a group chat

## Curator Economy

Most people on the internet are curators, not creators

#### Traditional Curators (Magazines, Channels etc):

- Opaque process
- tiny % of the population

#### Future Curators:

- More like angel investors
- Invest in projects you care about

Currently, we have

- Cryptocurrency
- Cryptofinance

Soon we will have

- Cryptosocial
- Cryptocommerce
- Cryptowork
- Cryptofirms
- Cryptostates

## In Closing

Thanks for reading along. 
I plan on writing more educational content on crypto. Thank you

This thread was my personal notes summarizing a presentation by Patrick Rivera 
A summary of the presentation by Patrick Rivera
https://docs.google.com/presentation/d/1sUpk0gbvRQelH0MUIOqjNeGe8nwRH4mhrhDHmI6qh4M/edit#slide=id.g442eb61d9d_0_710
Crystal View Context
Tags: crystal, html
Published: 2022-03-25 03:27:39

This article is meant to be more of a public note than anything.

I have found myself wondering why several Ruby gems that allowed you to create HTML in plain ruby still required you to have separate files instead of putting them in plain ol' ruby objects. As I'm working on my Crystal implementation of Roda, it finally occurred to me why. It's to be able to manage scope. All of those languages didn't require calling the methods _on_ anything, the methods were just there. It's because the file is run in the context of a class that provides those messages.

Now why did I put Crystal in the title but only talk about Ruby? Well, we have a context issue in Crystal and we've struggled with it a fair amount. There's ECR which does some fancy macro things but ultimately just copy/pastes the ECR file directly into the place where `ECR.render` is called. Over in Lucky, though, we make HTML through Crystal code and they are separate objects. One of the pains of that is passing in the HTTP context for things like link helpers and CSRF tokens. Buuuut, if the Crystal code was in a separate, non-Crystal file, we could still have all the functionality of Lucky's html building, but with the context control of ECR.

I am sticking with ECR right now in my library, but I might experiment more in the future. One advantage of this over ECR is that I don't have to do any pre-processing to pull out the fancy tags for embedding crystal into regular HTML.
A schema first development toolkit for protobuf
Tags: api, protobuf, grpc, go
Published: 2022-03-25 03:27:06

I am recently working on a project called skemaloop, which is a schema-first or schema driven development toolkit that can help you start your API journey. 

You can find it here. 
https://skemaloop.dev

It is a project that is still in early stage, and I will keep writing articles to introduce the functions of this toolkit and collect feedback from the dev community.
How To Create List And Grid View Using JavaScript
Tags: javascript, css, html, beginners
Published: 2022-03-25 03:07:43

In this example, we will see how to create a list and grid view using javascript. many times clients have requirements like a toggle between list and grid view. So, for list view and grid view in HTML, we are using a piece of HTML, CSS, and jquery.

here I will give you an example list and grid view using jquery. So, copy the below code and get the output of the list and grid view example in javascript.

In this example, I have created one file and added HTML code CSS code, and javascript.

> Create HTML file

Create an HTML file and the below code in your file. 

```
<div id="container">
<center><h1>
How To Create List And Grid View Using JavaScript - Techsolutionstuff
</h1><br>
    <div class="buttons">
        <button class="grid">Grid View</button>
        <button class="list">List View</button>
        </div></center>
    
    <ul class="list">
        <li style="background:lightgray">Item 1</li>
        <li>Item 2</li>
        <li style="background:lightgray">Item 3</li>
        <li >Item 4</li>
        <li style="background:lightgray">Item 5</li>
        <li>Item 6</li>
        
    </ul>
</div>
```
 
Read Also : StartOf And EndOf Functions Example Of Carbon

 
> Add CSS

Now, add some CSS for list view and grid view. 

```
h1 {font-size:22px; margin-top:20px;}

.grid, .list {padding:15px;}

#container ul { list-style: none; }

#container .buttons { margin-bottom: 20px; }

#container .list li { width: 100%; border-bottom: 1px; margin-top:5px; margin-bottom: 5px; padding: 5px; }

#container .grid li { float: left; width: 20%; height: 50px; border: 1px solid #CCC; padding: 20px; }
```
 
> Add JavaScript

In this step, we are adding some javascript for change list and grid view. 

```
$('button').on('click',function(e) {
    if ($(this).hasClass('grid')) {
        $('#container ul').removeClass('list').addClass('grid');
    }
    else if($(this).hasClass('list')) {
        $('#container ul').removeClass('grid').addClass('list');
    }
});
```
And finally, you will get output like the below image.

![how_to_create_list_and_grid_view_using_javascript_output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0e2ptayi2eir9d4ktr2q.png)

---

You might also like :

- **_[Read Also : Copy To Clipboard JQuery Example](https://techsolutionstuff.com/post/copy-to-clipboard-jquery-example)_**

- **_[Read Also : How To Generate QRcode In Laravel](https://techsolutionstuff.com/post/how-to-generate-qrcode-in-laravel)_**

- **_[Read Also : How To Get Current User Location In Laravel](https://techsolutionstuff.com/post/how-to-get-current-user-location-in-laravel)_**

- **_[Read Also : How To Create Dynamic Bar Chart In Laravel](https://techsolutionstuff.com/post/how-to-create-dynamic-bar-chart-in-laravel)_**
Leetcode: Symmetric Tree (Kotlin)
Tags: kotlin, leetcode, algorithms, programming
Published: 2022-03-25 02:16:34

Symmetric Tree is an “Easy” tagged Leetcode problem. The problem states “Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).”

They give us two examples:


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

**Brainstorming:**

We can have a queue to check if the root’s left and right children are identical.

These are the steps we can take to arrive at our solution:
Create a queue and add the root twice to the queue.

1. As long as there is a TreeNodes in the queue, we will take two TreeNodes.

2. If they are both null, we have arrived at null leaf nodes, so continue.

3. Next, if either node is null, we will return false since we already are checking if both are null beforehand. This is similar to the given Example 2.

4. Lastly, we also need to check if the values are the same. Of course, if the values are not the same, they are not symmetric.

5. We will add each of the two current nodes opposite nodes to the queue.

Code:
{% embed https://gist.github.com/cmcoffeedev/a4b00b244a037575e3a2ea6463b5be53 %}

Codelab version of this solution: 
https://cmcoffeedev.com/codelabs/leetcode-symmetric-tree/index.html#0

Video Solution: 
{% embed https://www.youtube.com/watch?v=SwPFOnS-P4Y %}
Leetcode — Kth Smallest Element in a BST (Kotlin)
Tags: leetcode, kotlin, algorithms, programming
Published: 2022-03-25 02:01:30

This is a medium Leetcode problem that wants you to find the kth smallest value (1-indexed) of every value in the Binary Search Tree. I will show you two approaches I took to solve this.

https://leetcode.com/problems/kth-smallest-element-in-a-bst/

First I will show you the problem statement, examples and constraints given. 

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


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


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


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

Since this is a Binary Search Tree we can do an in-order traversal to get the values sorted.

**Recursive Inorder Traversal**
For the recursive inorder solution we can create an ArrayList of Int and pass it to our inorderTraversal function. We can add the values to the list at each recursive call.

1. Create an ArrayList of Int and pass it to our inorderTraversal function.

2. For the inorderTraversal function, we will have a base case that returns if the tree node passed is null.

3. Add the values to the list at each recursive call.

4. Return list[k-1] as our answer. They mention “k” starts at 1 indexed.

{% embed https://gist.github.com/cmcoffeedev/6db4eba4e3d96424d33f9133bb2d8aff %}


**Iterative Inorder Traversal**

1. Create a stack of nullable TreeNode
root and k are immutable so we need to create mutable copies.

2. We can create a variable called temp or current as a copy for the root TreeNode. We can use indexToFind as a copy for k.

3. We will have nested while loops. The outer most while-loop will check if temp is null or the stack is empty.

4. The inner while loop will traverse all of temps left children and push them to the stack.

5. After traversing the left children we will eventually hit a null node. We can then pop from the stack and set that node as temp, which will be the last leaf node we touched.

6. We can pre decrement the indexToFind variable each time we get to this point. When the value is 0, we have found the index we are looking for so we can return the value. Set temp to temp’s right child.

Alternatively we can add the values to a list and return list[k-1] as we did in the recursive traversal.

{% embed https://gist.github.com/cmcoffeedev/1671cea5a0bc2a912b4d09490f88288d %}

Codelab version of this solution: https://cmcoffeedev.com/codelabs/leetcode-kth-smallest/index.html?index=..%2F..index#0

Video Solution:
{% embed https://youtu.be/hujtxlzHgQk %}
Leetcode — Valid Parentheses (Kotlin)
Tags: leetcode, kotlin, java, algorithms
Published: 2022-03-25 01:45:20

The Leetcode problem Valid Parenthesis is a very popular interview problem asked at companies such as Amazon and Facebook.

They give you a string that can include curly braces, square brackets, and parentheses. Test examples and output given in the problem statement are shown below:

![Valid Parentheses Examples](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4b45ysct7gdwrk2pbq26.png)

One edge case to consider is if there are only opening “parentheses” in the string. Another edge case to consider is what if there is only 1 character? The constraints in the problem mention there will at least be 1 character and we can be sure it will only be curly braces, square brackets, and parentheses.


![Valid Parentheses Constraints](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jn12a79sh1a4dji4wtrn.png)

The approach I took for this problem was to make a HashMap of closing “parentheses” characters as the keys and their open counterparts as the values. I will make a character array from the string, to loop through each character. I will use a stack to hold the opening “parenthesis”.

1. Check if there is a closing character.

2. If it is not a closing character, add it to the Stack (It is an opening character).

3.If there is a closing character and the Stack is empty, return false.

4. If there is a closing character and the stack is not empty, use it as a key to the HashMap to get the matching opening character. Pop from the stack and compare it with the value you got from the HashMap. If they are not equal, return false.

5. After looping through the array, we can handle the two edge cases by checking the size of the Stack. If it is not empty return false.

6. Finally, return true if the string of parentheses is valid.

The last step handles a string only having opening parenthesis because we will only add to the stack if there are opening characters and only pop if there are closing characters. This also handles the edge case of having only 1 character (in the loop).

My final code:

{% embed https://gist.github.com/cmcoffeedev/259d93a00f80f97ab257ba737faca30c %}

Codelab version of this solution: 
https://cmcoffeedev.com/codelabs/leetcode-valid-parentheses/index.html?index=..%2F..index#0

Video solution:
{% embed https://www.youtube.com/watch?v=chvVUv1tStE %}
SOLID - ISP
Tags: solid, poo, oop
Published: 2022-03-25 01:36:34

**Princípio da segregação de interfaces**

> Nenhum cliente deve ser forçado a depender de métodos que não utiliza.

Onde podemos dizer que clientes são nossas classes e essas não devem depender de métodos que nunca vão utilizar.

**Por exemplo:**

Suponhamos que temos uma interface _**IBanhoPet**_ com os métodos **_LimparPatas()_**, **_LimparAsas()_** e **_Secar()_** e criamos uma classe **_BanhoPardal_** e outra **_BanhoGato_** que implementam essa interface. 

```c#
public interface IBanhoPet
{
    void LimparAsas();
    void LimparPatas();
    void Secar();
}
```

A classe **_BanhoPardal_** utiliza todos os métodos que a interface nos diz para implementar. Já a classe **_BanhoGato_** não precisa utilizar o método **_LimparAsas_()**, afinal, gatos não possuem asas. Porém também não podemos deixar de implementá-lo, pois uma interface é como um contrato que nos obriga a utilizar todos os seus métodos. Logo, estamos ferindo o princípio da segregação de interfaces.

**Solução:**

Criamos uma interface **_IBanhoGato_** que possui os métodos **_LimparPatas_**() e **_Secar_**() e outra **_IBanhoAve_** que possui os mesmos métodos da **_IBanhoGato_** com a adição do método **_LimparAsas_**() e as nossas classes implementam as suas respectivas interfaces.

```c#
public interface IBanhoGato
{
    void LimparPatas();
    void Secar();
}
```

```c#
public interface IBanhoAve
{
    void LimparAsas();
    void LimparPatas();
    void Secar();
}
```
Fácil, né!?
Josephus Problem | Iterative Solution | Java
Tags: java, problemsolving, 100daysofcode
Published: 2022-03-25 01:30:12

**History**
Josephus Problem is theoretical game named after flavius Josephus, he  was historian, who was trapped along with his 40 soldiers in cave. Instead of surrendering to roman soldiers they choose to commit to suicide by drawing lots. Josephus states, by the grace of god or by luck, they were the only two to remain alive and surrender to roman soldiers. 

**Problem**
There are 'n' number of people standing in a row waiting to be executed and only one remains alive. The problem has two values, one is the number of people and other is the way they are executed.

**Example**

```

Input : N = 5, K = 2
Output : 3
Firstly, the Person at position 2 is out, 
then position 0 goes out, then position 4
Finally, the Person at position 1 is out. 
So the Person at position 3 survives.

Input : 7 4
Output : 2

```
**Solution**

```
Time Complexity: theta(2^n)
Space Complexity: theta(1)

import java.util.Scanner;
import java.util.Arrays;

public class Jos {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int temp = n;
        int count = 0;
        boolean[] arr = new boolean[n];
        Arrays.fill(arr, true);
        for (int i = 0; i < temp; i++) {
            if (n != 1) {
                if (arr[i])
                    count++;
                if (count == k) {
                    arr[i] = false;
                    count = 0;
                    n -= 1;
                }
                if (i == temp - 1) {
                    i = -1;
                }

            } else {
                break;
            }
        }
        for (int j = 0; j < arr.length; j++) {
            if (arr[j])
                System.out.println(j);
        }
    }
}

```
Python: Syntax and Semantics
Tags: tutorial, programming, python, coding
Published: 2022-03-25 01:19:20



### SYNTAX
The syntax of a programming language refers to the order to which different elements are combined to from valid expressions. These elements may be words, operators, or phrases. The syntax of a programming language doesn't have any relationship with the meaning.

An example of a syntax rule for programming is the assignment statement:

`print(expression)`

This is a valid syntax for using the print statement in python. If we try this without the closed bracket --> print(expression, it'll return a SyntaxError since we didn't follow the correct syntax.


<hr>

### SEMANTICS
Semantics emphasizes the meaning of a program, so it'll be understandable and easy to predict the outcome of execution.Semantics provides significant information needed to understand a program
For example

```
while <Boolean expression> :
	<statement>
```

This is the general form of a WHILE statement in python. For the semantics,  when the value of the boolean expression is met, the embedded statement would run.

```
<statement>
while <Boolean expression>:
```

The code above has no valid meaning because, we placed the statement before the starting the While loop. In this case the syntax is correct, but the semantics is wrong.

<hr>

Another example is when we try to divide an integer by a string.
For instance

```
x = 3
y = "Richie"

print(x/y)
```

The syntax for the code above is correct, but the semantics is wrong, because it doesn't send a valid meaning. An integer can not be divided by a string.
What is Kubernetes and why do you need it ?
Tags: kubernetes, minikube, docker
Published: 2022-03-25 01:15:16

Kubernetes, or k8s, is an open source platform that helps to manage containers. It eliminates many of the manual processes involved in deploying and scaling containerized applications

More details at this [link] (https://belowthemalt.com/2022/03/10/what-is-kubernetes-and-why-do-you-need-it/)
Web Development Fundamentals - Clients & Servers
Tags: webdev, frontend
Published: 2022-03-25 01:04:50

## Client

A client is a process that basically requests data from a server. As we're talking about the web, the browsers are clients requesting HTML pages from servers.

## Server

Process providing service/data for a client

## Client/Server Model

Clients requesting data from servers

> Note: A piece of code/machine/software can be both server and client at the same time because it could act as a client requesting data from a database and serving a service as a server.

We've been used to associate Clients to Frontend and Servers to Backend


About the codebase executing on the client and the server:

### Client

- End-users can see all of the code (Browsers)
- Need to be fast
- Low computing power (depends on the end-user)
- Cannot access Database directly (you can store information in the Browser, but in this case, we need information/data shared across users)

### Server

- Hidden code and implementation details
- Slow (compared to clients because we need to wait on the network)
- Scalable computing power (💰💰💰💰💰)
- Can access Database easily and share information across users
March 24th, 2022: What did you learn this week?
Tags: discuss, weeklyretro, weeklylearn
Published: 2022-03-25 00:38:25

It's that time of the week again. So wonderful devs, what did you learn this week? It could be programming tips, career advice etc.

<center>

![Image of the brain](https://media.giphy.com/media/ojmB7lOn3VUU8/giphy.gif)
</center>

Feel free to comment with what you learnt and/or reference your TIL post to give it some more exposure.

{%tag todayilearned %}
<!--
And remember, if something you learnt was a big win for you, then you know where to drop it as well.👇👇🏻👇🏼👇🏽👇🏾👇🏿

{%link https://dev.to/devteam/what-was-your-win-this-week-4h3g %}

<center>

![Little kid making a fist as if to say "Yes!"](https://media.giphy.com/media/6brH8dM3zeMyA/giphy.gif)
</center>
-->
Treasure data digdag visualization
Tags: treasuredata
Published: 2022-03-25 00:02:42

Treasure data is a leading CDP platform and leverages dig-dag for data pipelines within itself. digdag is similar to airflow where we define tasks inside a dag 
and is available as an open source. The CDp is a powerful platform but unfortunately no easy way to visualize the pipelines which makes it hard for onboarding 
when there are some complex pipelines already built. So I had the below sequence of steps to solve this problem for myself.

## Solution Approach
- Create Visualization
- Make it colorful
- Update the graph everytime there is a code change.
- Make it part of CICD

[Navigate to html](https://anilkulkarni87.github.io/treasure-data-digdag-graph/)

## Installation

```sh
pip install -r requirements.txt
```

## Usage example
- Update Line 131 with the project where the graphs need to be updated.
- Execute the python program to generate the graphs.


#### TODO
- Parametrize the dir_name (Line 131) 
- Create github workflow to generate graphs when there are changes.
    - Identify the changes at the folder level 
    - Execute the python script tp build graph for each folder with a change
    - Commit the graphs back to the branch
    

### References
- https://github.com/y-abe/digdag-graph
What imposter did this?
Tags: impostersyndrome, jobs
Published: 2022-09-21 16:54:13

---
title: What imposter did this?
published: true
date: 2022-03-25 00:00:00 UTC
tags: impostersyndrome,jobs
canonical_url: https://jhall.io/archive/2022/03/25/what-imposter-did-this/
---

Have you ever suffered from imposter syndrome? I sure have. Especially at a new job. I always feel a bit out of my depth.

But you know what else happens a lot at a new job?

I find myself looking at code and thinking “What idiot did this?”

How ironic.

I have the confidence to critique code that was clearly done by someone with less experience than me at this new job… and at the same time I’m afraid I don’t have enough experience to edit the code.

What?

Maybe I’m not the imposter I think I am.

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._