teleren/devto huggingface dataset:
Final Thoughts on Speed Run Ethereum 🚀
Tags: web3, blockchain, solidity, javascript
Published: 2023-03-03 18:15:10

## TLDR

If you are a beginner to medium in web3 then speed run ethereum is most definitely worth spending time on. It will help you learn new stuff or expose you to topics that you can then rabbit hole into or maybe even help you revise some stuff that you might already know 🤓

## Things to take care of

- Some of the code or config might be a bit outdated so check them first and if you can't figure out what is wrong, every challenge has a telegram group that you can join and just ask your questions there
- For beginners it is recommended to learn solidity and basics of blockchain before starting
- Challenges might seem to be a bit simple, use them as a start and discover/research about more stuff related to that topic

## Topics covered

- Core Solidity
- NFTS
- ERC20 Tokens
- VRF
- DEX
- L2 Scaling
- Multisig Wallets

## Thoughts

I personally enjoyed completing all the challenges 😊 got to revise some of the solidity basics as well as learn and explore new topics. I liked working with scaffold-eth 🏗️ its a great tool for quickly getting your project up although there is a lot of polishing to be done. Looking forward to scaffold-eth 2, it seems to have a better tech stack and UI, hopefully the code is a bit cleaner too 😜 Finally happy to be a part of [buidlguidl](https://buidlguidl.com/) community 💪😌✌️
CSS: Fixing background color bleed in rounded corners
Tags: css, webdev, frontend, tutorial
Published: 2023-03-03 18:14:17

While doing one of [frontendmentor.io](https://www.frontendmentor.io/)'s challenges, I encountered a weird artifact that happens when a nested div and its parent with different background colors, both have rounded corners which causes the background color of the parent div to bleed/show at the rounded corner:

![CSS rounded corner color bleed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v3n7jflj8qp8nuymqf19.png)

After searching, the answer seemed to be that:

1. It's just an anti-aliasing issue and can't be helped.
2. Using `background-clip: padding-box;` or `overflow: hidden;` which didn't work for me.

Since I just couldn't let it go and pretend it doesn't exist, I came up with three ways to fix the issue:

### 1. Avoiding the problem altogether!
Instead of having a nested div, put the divs on top of each other and position them with `position: absolute;`
This way, the parent div can have a shorter height and not be behind the rounded corners to begin with. but I like to avoid using absolute positioning as much as possible so...
### 2. Pushing the nested div to the bottom a little!
By moving the nested div to the bottom by a little amount like `0.1rem` (using `position: relative;`), the anti-aliasing issue is fixed and no color bleed happens. but it messes up the spacing by `0.1rem` so can't have that...
### 3. Removing the background color of the parent div from the affected area
By applying the background color only to the top part of the parent div we can solve this issue without moving stuff around. the best way to do it is using `linear-gradient`. for example `linear-gradient(#color 0%, #color 50%, transparent 50%, transparent 100%);` will apply the background color only to the top half of the parent div.

#### Live example
color bleed : https://colorbleed.netlify.app/
color bleed fixed using the 3rd method : https://colorbleedfix.netlify.app/

You can check the source of this challenge on [my GitHub](https://github.com/rashidshamloo/fem_024_time-tracking-dashboard/)
HOW TO ISTALL APACHE AGE AND PSQL FROM SOURCE ON YOUR MACHINE
Tags: postgres, apacheage, database, agedb
Published: 2023-03-03 17:58:03

Are you looking to install Apache AGE and PostgreSQL from source on your Linux machine? Well, you've come to the right place. In this article, we will be breaking down the installation process into three parts to help make it easier for you to follow along. Before we begin, please note that this guide is intended for Linux users.

## Part 1: Making Directories and Installing Dependencies
The first step is to create some directories to save and install AGE and PostgreSQL. Here's how you can do it:

```
mkdir age_installation
cd age_installation
mkdir pg
cd pg
```
Once you've created the directories, you need to install some dependencies. Here's the command to install them:

```
sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison

```
You can also install the PostgreSQL dev server with the following command:

```
sudo apt install postgresql-server-dev-11
```
To read more about this please visit [this](https://age.apache.org/age-manual/master/intro/setup.html#postgres-11).

## Part 2: Installing PostgreSQL and AGE from Source
In this part, we will be installing PostgreSQL and AGE one by one. Let's start with PostgreSQL.

## PostgreSQL
First, you need to install the version of PostgreSQL that is compatible with AGE. For this guide, we will be using version 11.8. To download and extract it, use the following command:

```
wget https://ftp.postgresql.org/pub/source/v11.18/postgresql-11.18.tar.gz && tar -xvf postgresql-11.18.tar.gz && rm -f postgresql-11.18.tar.gz

```

Once the download is complete, you need to install PostgreSQL. Use the following commands:

```
cd postgresql-11.18

# configure by setting flags
./configure --enable-debug --enable-cassert --prefix=$(pwd) CFLAGS="-ggdb -Og -fno-omit-frame-pointer"

# now install
make install

# go back
cd ../../
```
You can choose to install PostgreSQL in a different path, but for this guide, we will be installing it in the same directory.

## Installing AGE
After successfully installing PostgreSQL, it's time to download and install AGE. You can download AGE from the Apache AGE GitHub repository using the following command:

```
git clone https://github.com/apache/age.git

```
To install AGE, use the following commands:

```
cd age/

# install
sudo make PG_CONFIG=/home/hammad/age_installation/pg/postgresql-11.18/bin/pg_config install

# install check
make PG_CONFIG=/home/hammad/age_installation/pg/postgresql-11.18/bin/pg_config installcheck
```

## Conclusion
That's it! You have successfully installed Apache AGE and PostgreSQL from source on your Linux machine. In the next article, we will be creating a database and initializing it. Stay tuned!
How to simplify your if statements
Tags: javascript, webdev, cleancode
Published: 2023-03-03 17:41:16

Nested conditionals can make your code harder to read and change—especially if you nest them more than one level.

Below, I'll show an example of a function that returns a discount for the provided user.

- It should give a 20% discount for all regular users.
- But if the user has a premium membership, it will give a 40% discount.
- Gold users take the highest discount: 60%.
- If the user is banned, however, it should not give any discount.

Without guard clauses, I'll write this function like this:

```js
function getDiscountForUser(user) {
  let result
  if (user.isBanned) {
    result = 0
  } else {
    if (user.isPremium) {
      result = 40
    } else {
      if (user.isGold) {
        result = 60
      } else {
        result = 20
      }
    }
  }
  return result
}
```

I'll show you below how guard clauses can make it much simpler. But first, what are guard clauses?

## What are Guard Clauses?

Guard clauses are the checks you put at the beginning of a function to check for the unusual conditions.

A usual (or called normal) condition is the condition that represents most cases for the needed behavior—in this case it's regular users getting a 20% discount. Anything other than that is called an unusual condition.

Guard clauses also return immediately if true—preventing other conditions from running.

Here's how the same function looks but with guard clauses:

```js
function getDiscountForUser(user) {
  if (user.isBanned) return 0
  if (user.isPremium) return 40
  if (user.isGold) return 60

  return 20
}
```

With the beauty of guard clauses, the function became way much easier to read and change.
Como converter um valor de tipo VARCHAR em um valor JSON no Oracle PL/SQL
Tags: oracle, beginners, plsql, braziliandevs
Published: 2023-03-03 17:40:28

_Venho aqui criar este post para ficar um pouco mais fácil do que foi para mim._ 📝

- 
Vamos usar a função JSON_OBJECT().

A função JSON_OBJECT() cria um objeto JSON a partir de uma lista de pares chave/valor. Você pode usar a função JSON_OBJECT() para criar um objeto JSON com uma única chave e valor, como mostrado no exemplo abaixo:

```
DECLARE
  my_varchar VARCHAR2(4000) := '{"name":"John", "age":30}';
  my_json JSON_OBJECT_T;
BEGIN
  my_json := JSON_OBJECT_T.parse(my_varchar);
  DBMS_OUTPUT.PUT_LINE(my_json.get_string('name')); -- Output: John
  DBMS_OUTPUT.PUT_LINE(my_json.get_number('age')); -- Output: 30
END;
/
```

Nesse exemplo, a variável my_varchar contém uma string JSON. A função JSON_OBJECT_T.parse() é usada para converter a string em um objeto JSON. Em seguida, os métodos get_string() e get_number() são usados para obter os valores das chaves "name" e "age", respectivamente.

> 
Se você tiver múltiplos objetos JSON em uma única string, pode usar a função JSON_ARRAY() para criar um array JSON a partir deles e, em seguida, iterar sobre o array usando um laço FOR.


_Não esqueça de deixar seu like_ ❤️

**Linkedin**: https://www.linkedin.com/in/antonio-rodrigo-wanderley-serra/
**GitHub**: https://github.com/antoniorws
Move fast, break less
Tags: beginners, programming, productivity, testing
Published: 2023-03-03 17:34:43

I received the first critical feedback of my career after my first promotion. Even though I was having more impact on my projects, my manager told me that I needed to change something or else we would have a serious problem.

Career growth for junior engineers comes from completing larger features. But, writing more code makes it easier to break things, which will slow your career growth. This article explains two ways to move fast without breaking anything.


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

I got my first promotion through sheer volume of work. I shipped larger features by averaging ~5 code changes a day. I could’ve gotten promoted with less output if I had discussed expectations for the next level with my manager (which I will address in a future post). But that wasn’t the main thing slowing my growth.

{% twitter 1623745298920255489 %}

The main issue was that I sometimes broke things because I was making so many changes. My manager warned me this would become a serious problem if I didn’t change so I came up with ways to move fast without breaking anything. There are two main tactics which worked well for me:

Batching test plans - I spent a lot of time testing every code change I made. To make testing faster, I created large stacks of commits that were all loosely related on the same code path. I then ran tests covering the entire stack all at once. For a stack of 10 commits, I only paid the cost of testing once while making sure nothing broke.

Gating almost all changes - I began using feature flags so that users couldn’t access code paths while I worked on them. That way I could land code as fast as I wanted without worrying about breaking anything. Then when I was ready to release the code, I would verify everything all at once by turning on the flag for a small population while monitoring it.

Look for ways to optimize your workflow to become more productive. In this case, I saved a ton of time on testing by batching and gating features. Code review is another major bottleneck that can slow you down as I discussed in this Twitter thread:

{% twitter 1626239233429237760 %}

Now it’s your turn: aside from testing and code review, are there any other major bottlenecks in your workflow that slow you down? If you learned something helpful consider [subscribing to my Substack for new posts](https://www.developing.dev/) every Friday.

Thanks for reading,
Ryan Peterman
Python classes and objects tutorial
Tags: python, programming, tutorial, codenewbie
Published: 2023-03-03 17:24:31

Python is a object oriented programming language, it supports [class and objects](https://www.programdoc.com/python/classes-objects).

1. class name should start with first letter as caps.
2. variables inside a class are called as attributes.
3. function inside a class are called as methods.
4. `self` keyword is used to refer the attributes and methods that belongs to the class, using the `self` we can directly access the attribute and method inside the class.

simple class syntax:
```py
class Myclass():
   pass
```

## Class constructor
```py
class Myclass():
   def __init__(self):
      pass
```
**__init__** is a special method in python which as a constructor, it will be called when declaring an object.

## Declaring a class object
```py
class Myclass():
   def __init__(self):
      print("I'm Constructor")

myObject = Myclass()

Output:
I'm Constructor
```
by default constructor method get called, we are not directly calling any method in the class.

## Passing value to constructor
```py
class Myclass():
   def __init__(self, x, y):
      print("I'm Constructor")
      print("x:", x)
      print("y:", y)

myObject = Myclass(5, 10)

Output:
I'm Constructor
x: 5
y: 10
```

## Assign value to class attributes
```py
class Myclass():
   def __init__(self, x, y):
      self.x = x
      self.y = y

myObject = Myclass(5, 10)
```
even thought the argument `x` and `self.x` looks same but they are different, self is used to refer the attribute belong to the class, argument `x` is only accessible inside the __init__ block.

## Class Methods
```py
class Myclass():
   def __init__(self, x, y):
      self.x = x
      self.y = y
      
   def access(self):
       print("x:", self.x)
       print("y:", self.y)

myObject = Myclass(5, 10)
myObject.access()

Output:
x: 5
y: 10
```
value for x and y are assigned in the constructor function even though it can be accessed anywhere inside the class since it belong to the class.

## Create multiple class objects
```py
class Myclass():
   def __init__(self, x, y):
      self.x = x
      self.y = y
      
   def access(self):
       print("x:", self.x)
       print("y:", self.y)

myObject1 = Myclass(5, 10)
myObject1.access()

myObject2 = Myclass(20, 30)
myObject2.access()

Output:
x: 5
y: 10
x: 20
y: 30
```
Consider the objects as storage space, any action made to the object only belongs to it, it won't affects other objects.



## Explore Other Related Articles
[Python Recursion Function Tutorial](https://dev.to/max24816/python-recursion-function-tutorial-3jmo)
[Python Lambda Function Tutorial](https://dev.to/max24816/python-lambda-function-tutorial-1o30)
[Python If, If-Else Statements Tutorial](https://dev.to/max24816/python-if-if-else-statements-tutorial-2g4k)
[Python Function Tutorial](https://dev.to/max24816/python-function-tutorial-5fh0)
[Python break and continue tutorial](https://dev.to/max24816/python-break-and-continue-tutorial-57kj)
[Python While Loop tutorial](https://dev.to/max24816/python-while-loop-tutorial-463f)
Personalizando um aplicativo utilizando Emotion
Tags: react, beginners
Published: 2023-03-03 15:20:22

A biblioteca Emotion é uma biblioteca de estilos para o React que permite escrever estilos CSS em JavaScript. Ela é uma alternativa para outras bibliotecas de estilos populares, como o Styled Components e o CSS Modules.

Com o Emotion, você pode escrever seus estilos diretamente em seu arquivo JavaScript, o que torna o código mais fácil de gerenciar e permite que você tenha uma maior flexibilidade e controle sobre seus estilos. Além disso, a biblioteca Emotion é altamente performática e fornece recursos adicionais para otimizar o desempenho de seus estilos.


Uma das razões para usar Emotion seria devido a suas vantagens em relação com outras bibliotecas como:

1. Escrita de estilos em JavaScript 

Ao escrever estilos em JavaScript, você pode usar as funcionalidades do próprio JavaScript para criar estilos dinâmicos e reutilizáveis.

2. Melhoria do desempenho

Emotion usa uma técnica chamada de "estilos dinâmicos" que ajuda a melhorar o desempenho de seus estilos. Com estilos dinâmicos, a biblioteca mantém apenas um único estilo CSS e aplica as propriedades dinâmicas necessárias por meio de JavaScript. Isso ajuda a reduzir a quantidade de código CSS que precisa ser enviado ao navegador, o que pode melhorar significativamente o desempenho do seu aplicativo.

3. Integração fácil com outras bibliotecas

A biblioteca Emotion é compatível com Redux e React Router podendo integrar ela a seu projeto pessoal.


Vale ressaltar que sua forma de sintaxe lembra bastante outra biblioteca conhecida, a chamada Styled Component. Embora as duas sejam bem diferentes: Emotion é uma ótima biblioteca de CSS para JS. Por outro lado, para opções de estilo mais exclusivas e complexas, os Styled-Components podem ser o melhor caminho a seguir.

Vejamos um exemplo do Emotion em ação estilizando alguns componentes:

```
import { css } from '@emotion/react'

const buttonStyles = css`
  background-color: blue;
  color: white;
  padding: 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;

  &:hover {
    background-color: darkblue;
  }
`

function Button() {
  return <button css={buttonStyles}>Clique aqui</button>
}
```
No caso acima é passo um tipo de estilização para o botão. Conseguimos ver algumas diferenças com o Styled-Component pois ele importa o css de @emotion/react enquanto a outra biblioteca o styled da biblioteca baixada.

Com isso conseguimos ver o que é Emotion, seu uso e até algumas diferenças com outras bibliotecas, sendo útil para otimização e facilidade de sua aplicação.
Trigger CircleCI Workflow. AKA Simple Deploy Button
Published: 2023-03-03 16:52:17

---
series: Serverless & Containers
---

Very simple, no parameters needed, no enums, no booleans... just a really easy way to trigger a deploy with CircleCI. We can do this making use of the [trigger_source](https://circleci.com/docs/variables/#pipeline-values) pipeline value. When you click the button in CircleCI to "Trigger Pipeline" the value would be `api` vs something like `webhook`.

```yaml
version: 2.1
jobs:
  deploy:
    machine:
      image: ubuntu-2204:current
    steps:
      - run: echo 'Deploying...'
workflows:
  deploy:
    when: { equal: [ api, << pipeline.trigger_source >> ] }
    jobs:
      - deploy
```

If your workflow needs a test job, consider doing something a bit more complicated. Here we use two `when` conditions to work with a parameter.

```yaml
version: 2.1
parameters:
  workflow:
    type: enum
    default: test
    description: The workflow to trigger.
    enum: [test, deploy]
jobs:
  test-job:
    machine:
      image: ubuntu-2204:current
    steps:
      - run: echo 'Testing...'  
  deploy-job:
    machine:
      image: ubuntu-2204:current
    steps:
      - run: echo 'Deploying...'
workflows:
  test:
    when: { equal: [ test, << pipeline.parameters.workflow >> ] }
    jobs:
      - test-job
  deploy:
    when: { equal: [ deploy, << pipeline.parameters.workflow >> ] }
    jobs:
      - deploy-job
```

Now your CircleCI config will run tests by default and you can easily trigger a deploy via any branch using the "Trigger Pipeline" button.

![Screen capture of the CircleCI application. This shows the trigger pipeline UI which has the Add Parameter disclosure open. The options Parameter type, Name, and Value have been set to string, workflow, deploy.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5b23gl0yk10sqpv3hur.png)
How to think together; a way to better pair programming sessions
Tags: programming, productivity, career
Published: 2023-03-03 16:37:23

Software Engineering relies heavily on communication with others; teammates, product owners, designers, engineering managers, stakeholders. Yet so often we are trained to work and think alone. This is a shame because working together can lead to higher quality code, a better product, and — in the end — a happier end user.

Software Engineers can collaborate in many ways and forms. One of them is Pair Programming. Pair programming is a software development technique where two developers work together on one machine.

Though this sounds easy, it is not that simple. Pair programming involves a lot of communication and collaboration. It requires empathy and interpersonal skills and it can be difficult to manage a successful session. Pairing is an amazing tool, but it is a tool that we need to practice together before we can reap its benefits.

Let’s go over some ways to learn how to think together.

**Set a clear goal and remember it**
At the start of a pairing session, you need to discuss the scope of the session. What is it you want to achieve? When is that goal met? How much time do we want to spend? Make it clear for both of you what it is you want to get out of the session before you start.

**Your way is not the only way**
There are thousands of ways to look at a problem, implement code, or debug something. The key is that we must never think our way is the only correct way. Pairing is not a race where only one person can win. You both want to solve a problem, which is finishing the task you’re working on. You’re both on the same team. Take time to analyze your colleague’s solution before pushing yours onto them.

**Be aware of the knowledge gap**
One of my early pairing experiences was with a programmer who was much better than me. They bulldozed through the problem and seemed to have forgotten there was a huge knowledge gap between us. Seeing this much more experienced programmer taking up all the space made me feel intimidated and I got scared to speak up, ask questions, and share ideas.

Though it’s understandable that I shut down, it’s unnecessary. I learned later on that — when my pair has more experience on a topic — asking questions is beneficial for both of you. It can lead to fruitful discussions and better solutions. Even though your co-worker has more experience, explaining certain topics is just as valuable to them as it is to you.

When you’re the more experienced one in a pair, don’t assume that the other person can’t contribute. You might be wearing blinders when approaching a problem, and a different view can lead to a better solution.

**Reflect**
Pair programming can be mentally exhausting and draining. Reflect during the session to assess if the pace is manageable and sustainable. If it’s not, adjust accordingly.

When we learn how to explain ourselves, work well together, listen actively and treat each other with respect and kindness, we can get the most out of pair programming. It’s just a skill that we need to learn, that’s all.