teleren/devto huggingface dataset:
WebsiteColorsAI - Launch 🎨
Tags: ai, chatgpt, openai, startup
Published: 2023-05-14 22:46:46

{% embed https://youtu.be/IQz8jw6k_10 %}

Hello everyone! It's Bryam 👋

Based on how popular my first AI tool was, and the amount of people that signed up for it. I decided to build another AI tool called WebsiteColorsAI.

I started working on WebsiteColorsAI with the goal of helping others speed up the design process when building websites, especially, when it comes to choosing colors.

In most of my projects, I always struggle trying to find the "ideal" color palette and more than that, I spend a lot of time trying to find out and researching what other websites are using which is time-consuming and slows me down quite a bit when trying to build and deploy projects.

With WebsiteColorsAI, you can immediately find out what color palettes are other websites using and save a ton of time when it comes to choosing colors for your websites.

The tool is quite inexpensive as each token costs $1. The pricing is $5 for 5 tokens which means you get to generate color palettes for 5 different websites. Also, when you sign up, you get 1 free token to try the tool. (Use it wisely)

I hope this tool proves to be useful for many.

It would mean the world to me if you could try out the tool and give me some feedback, suggestions, ideas, etc.

[WebsiteColorsAI](https://websitecolorsai.com)

[Twitter](https://twitter/balt1794)

Thank you! 😊
The actual usage of Python versions May 2023 by Mr. Bard
Tags: python, statistics, versions, usage
Published: 2023-05-14 22:44:34

The Google Bard says that the actual usage of [Python](https://nezirzahirovic.gumroad.com/l/python) versions today is as follows: 

- Python 3: 80.3%
- Python 2: 15.3%
- Other versions: 4.4%

As you can see, Python 3 is the most popular version of Python, with a usage share of over 80%. This is because Python 3 is a major revision of the Python language that was released in 2008. Python 3 introduces a number of new features and changes that make it a more modern and powerful language.

Python 2 is the second most popular version of Python, with a usage share of over 15%. Python 2 was released in 2000 and is the older version of the language. Python 2 is still supported by the Python Software Foundation, but it is no longer being actively developed.

Other versions of Python, such as Python 3.1, Python 3.2, and Python 3.3, have a usage share of less than 5%. These versions of Python are no longer supported by the Python Software Foundation and are not recommended for use.

If you are new to [Python](https://nezirzahirovic.gumroad.com/l/python), I recommend that you use Python 3. Python 3 is the future of the Python language and it is the version that is most widely used.

Here is also my little contribution to Python community FREE Interviewing e-book for your next interview preparation [The Python Interview Handbook 2023](https://nezirzahirovic.gumroad.com/l/python-free) there you can find more e-books which can help you in getting your next programming role.
[Gumroad](https://nezirzahirovic.gumroad.com)
More details about e-books at [InterviewBible.com](https://www.interviewbible.com)
Setup your environment
Published: 2023-05-14 22:26:51

# Setup your environment.
In order to experiment with these contracts, you'll need to

1.- Clone the SoroswapFinance `core` repo:
```bash
git clone https://github.com/soroswap/core
```


2.- Run the `quickstart.sh` script
```bash
cd core
bash quickstart.sh standalone
```

This script will create the `soroban-network` Docker network, and will open two Docker containers:
(a) A Stellar Quickstart container that will be used to run a local standalone soroban blockchain.
(b) A Soroban-Preview docker container. Currently in PREVIEW-8

This last container is important for developers that might be developing different projects with different SDK versions. Currently, Soroswap.Finance is supporting PREVIEW-8, so the Docker image to be used will be:

`stellar/quickstart:soroban-dev@sha256:a057ec6f06c6702c005693f8265ed1261e901b153a754e97cf18b0962257e872`

and


`esteblock/soroban-preview:8`


3.- Enter to the `soroban-preview-8` docker container in order to run scripts inside:
```bash
docker exec -it soroban-preview-8 bash
```

Also, if you don't want to copy or write this line all the time, you can just run the `run.sh` script

```bash
bash run.sh
```

As this is optional, this is important to be able to interact with the protocol using the correct soroban CLI version. 

Once you are inside the `soroban-preview-8` container, you are ready to experiment with the `SoroswapPair` or the `SoroswapFactory` contract!
The Factory contract
Published: 2023-05-14 22:25:56

# The SoroswapFactory contract
Creates one Liquidity Pool Token smart contract per unique token pair.

In the next chapter we will see, step-by-step how to experiment with this contract using the soroban CLI.

Here is the contract interface:
```rust

pub trait SoroswapFactoryTrait{
    // Sets the fee_to_setter address and sets the pair_wasm_hash to create new pair contracts
    fn initialize(e: Env, setter: Address, pair_wasm_hash: BytesN<32>);

    /*  *** Read only functions: *** */

    // feeTo is the recipient of the charge.
    // function feeTo() external view returns (address);
    fn fee_to(e: Env) -> BytesN<32>;

    // The address allowed to change feeTo.
    // function feeToSetter() external view returns (address);
    fn fee_to_setter(e: Env) -> Address;

    // Returns the total number of pairs created through the factory so far.
    // function allPairsLength() external view returns (uint);  
    fn all_pairs_length(e: Env) -> u32;

    // Returns the address of the pair for token_a and token_b, if it has been created, else address(0) 
    // function getPair(address token_a, address token_b) external view returns (address pair);
    fn get_pair(e: Env, token_a: BytesN<32>, token_b: BytesN<32>) -> BytesN<32> ;

    // Returns the address of the nth pair (0-indexed) created through the factory, or address(0) if not enough pairs have been created yet.
    // function allPairs(uint) external view returns (address pair);
    fn all_pairs(e: Env, n: u32) -> BytesN<32>;

    // Returns a bool if a pair exists;
    fn pair_exists(e: Env, token_a: BytesN<32>, token_b: BytesN<32>) -> bool;

    /*  *** State-Changing Functions: *** */

    // function setFeeTo(address) external;
    fn set_fee_to(e: Env, to: BytesN<32>);

    // function setFeeToSetter(address) external;
    fn set_fee_to_setter(e: Env, new_setter: Address);
    
    //Creates a pair for token_a and token_b if one doesn't exist already.
    // function createPair(address token_a, address token_b) external returns (address pair);
    fn create_pair(e: Env, token_a: BytesN<32>, token_b: BytesN<32>) -> BytesN<32>;
}

```
The Pair Contract
Published: 2023-05-14 22:24:26


The SoroswapPair Contract implements the token interface (hence, it  has the same functions that any Stellar Asset Contract) and it also has the specific functions for a liquidity pool to exist:

In the next chapter we will see, step-by-step how to experiment with this contract using the soroban CLI.

Here is the contract interface:
```rust
pub trait SoroswapPairTrait{
    // Sets the token contract addresses for this pool
    fn initialize_pair(e: Env, factory: Address, token_a: BytesN<32>, token_b: BytesN<32>);

    // Returns the token contract address for the pool share token
    fn share_id(e: Env) -> BytesN<32>;

    fn token_0(e: Env) -> BytesN<32>;
    fn token_1(e: Env) -> BytesN<32>;

    // Deposits token_a and token_b. Also mints pool shares for the "to" Identifier. The amount minted
    // is determined based on the difference between the reserves stored by this contract, and
    // the actual balance of token_a and token_b for this contract.
    fn deposit(e: Env, to: Address, desired_a: i128, min_a: i128, desired_b: i128, min_b: i128);

    // If "buy_a" is true, the swap will buy token_a and sell token_b. This is flipped if "buy_a" is false.
    // "out" is the amount being bought, with in_max being a safety to make sure you receive at least that amount.
    // swap will transfer the selling token "to" to this contract, and then the contract will transfer the buying token to "to".
    fn swap(e: Env, to: Address, buy_a: bool, out: i128, in_max: i128);

    // transfers share_amount of pool share tokens to this contract, burns all pools share tokens in this contracts, and sends the
    // corresponding amount of token_a and token_b to "to".
    // Returns amount of both tokens withdrawn
    fn withdraw(e: Env, to: Address, share_amount: i128, min_a: i128, min_b: i128) -> (i128, i128);

    fn get_rsrvs(e: Env) -> (i128, i128);

    fn my_balance(e: Env, id: Address) -> i128;

    fn factory(e: Env) -> Address;
}

pub trait TokenTrait {
    fn initialize(e: Env, admin: Address, decimal: u32, name: Bytes, symbol: Bytes);

    fn allowance(e: Env, from: Address, spender: Address) -> i128;

    fn incr_allow(e: Env, from: Address, spender: Address, amount: i128);

    fn decr_allow(e: Env, from: Address, spender: Address, amount: i128);

    fn balance(e: Env, id: Address) -> i128;

    fn spendable(e: Env, id: Address) -> i128;

    fn authorized(e: Env, id: Address) -> bool;

    fn xfer(e: Env, from: Address, to: Address, amount: i128);

    fn xfer_from(e: Env, spender: Address, from: Address, to: Address, amount: i128);

    fn burn(e: Env, from: Address, amount: i128);

    fn burn_from(e: Env, spender: Address, from: Address, amount: i128);

    fn clawback(e: Env, admin: Address, from: Address, amount: i128);

    fn set_auth(e: Env, admin: Address, id: Address, authorize: bool);

    fn mint(e: Env, admin: Address, to: Address, amount: i128);

    fn set_admin(e: Env, admin: Address, new_admin: Address);

    fn decimals(e: Env) -> u32;

    fn name(e: Env) -> Bytes;

    fn symbol(e: Env) -> Bytes;
}

```
The Soroswap.Finance Protocol: an Introduction
Published: 2023-05-14 22:22:12

# Soroswap.Finance
Open-source AMM protocol for providing liquidity and trading Stellar Assets in Soroban. With SDK and easy to use frontend.

The Soroswap Protocol is committed to contributing to the Soroban ecosystem by providing 100% open-source smart contract protocols and libraries that any project can use as building blocks. 

Our goal is to create a user-friendly front-end with tested and working smart contracts that implement UniswapV2, with future plans to incorporate UniswapV3 features to reduce impermanent loss. 

# Developer Links:
The Soroswap.Finance protocol has (for the moment) one repository:

* [soroswap/core](https://github.com/soroswap/core)

# Introduction and Motivation:

The Soroswap Protocol is inspired in [UniswapV2](https://github.com/Uniswap/v2-core/)  (written in Solidity) and in the liquidity_pool contract available in the [stellar repository](https://github.com/stellar/soroban-examples).

The Soroswap.Finance protocol consists in:

1.- A **Liquidity Pool** contract (The **SoroswapPair** contract): They serve as automated market makers (AMM) and keep track of pool token balances. In Soroban, these contracts implements the Stellar token interface

2.- A **Factory** contract (The **SoroswapFactory** contract):  Creates one Liquidity Pool Token smart contract per unique token pair.


With this approach, any user can start a new liquidity pool pair from the front-end, and hence without knowing how to code, or without needing to manually deploy a smart contract using the soroban-cli software.

Follow this series in order to know about the v0.1 of the Soroswap.Protocol
Node.js and C/C++ APIs: How Superheroes, Sidekicks, and Steroids Make Your Backend Super-Fast (with Asynchronous I/O as Robin)
Published: 2023-05-14 22:14:27

So, you may be wondering why Node.js is so fast and efficient. Is it powered by magic? Well, no. It's powered by C and C++ APIs, which are like the caffeine that keeps developers going when they're pulling all-nighters.

But seriously, the V8 engine is written in C++, which means it's like the superhero that Node.js relies on to do all the heavy lifting. And the C and C++ APIs are like the sidekicks that help Node.js fight off slow I/O operations and perform complex tasks.

Think of it like this: Node.js is like a superhero, and the C and C++ APIs are like the gadgets and tools in the superhero's utility belt. Without those gadgets, the superhero would be just a regular person with a cape and some fancy tights.

And let's not forget about native addons, which are like the steroids that give Node.js super strength. They allow developers to perform computationally intensive tasks with lightning-fast speed, like the Flash on a caffeine high.

But wait, there's more! Asynchronous I/O is like the Robin to Node.js's Batman. It helps keep things running smoothly, like a well-oiled machine. And without it, well, let's just say your application might end up as slow as the sloth in Zootopia.

So, there you have it. Node.js is like a superhero with an awesome team of sidekicks and gadgets, all working together to fight off slow I/O operations and perform complex tasks with lightning-fast speed. And if you're not using Node.js, well, you're missing out on the caffeine-fueled, superpowered awesomeness that it has to offer.

#NodeJS #CPlusPlus #CProgramming #BackendDevelopment #NativeAddons #AsynchronousIO #V8Engine #TechnicalWriting #HumorInTech #FullStackDevelopment #WebDevelopment #CodeFaster
Web Scrapper using NodeJS, Express, Cheerio and Axios
Tags: javascript, node, express, npm
Published: 2023-05-14 21:51:35

## Web Scrapper

A web scraper is a software tool or program that automates the process of collecting data from websites. It uses automated scripts or bots to extract data from web pages by reading and analyzing the HTML code of the page. Web scrapers can be used to extract a wide range of data, such as product prices, reviews, social media posts, and more.

Web scraping has become increasingly popular in recent years as a means of gathering data for research, market analysis, and business intelligence. However, it is important to note that some websites explicitly prohibit web scraping in their terms of service, and scraping certain types of data may be illegal in some jurisdictions. As such, it is important to ensure that you are not violating any laws or policies before using a web scraper.

Here we will create a very basic version of a web scrapper which will allow us to scrap HTML data from websites.

## Steps

- Make sure you have node installed with the latest version.

`node --version`


- Start by creating a directory and run `npm init` , this 
   will create a package.json file which will help in  
   dependency management and script management, create an  
   index.js file next.

- Install four packages using npm:

- `npm i express`
- `npm i cheerio`
- `npm i axios`
- `npm i nodemon`

- Now in your package.json, change the "start" in the "scripts" to `nodemon index.js`. Your package.json will start looking something like this.

![Image json-file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/33qg3sbt388n7n55nhtc.png)

- Now in your index.js, load the modules using:

```
const express = require('express')
const cheerio = require('cheerio')
const axios = require('axios')
```
- Create a listening port like this:

```
const PORT = 8000
const app = express()
app.listen(PORT , ()=> console.log(`Server running on port ${PORT}`))
```
- Now take the url of the website which you want to scrape and store the url in any variable.

- Then using axios create a promise and url as its parameters.

```
axios(url)
    .then(response => {
        const html = response.data
        const $ = cheerio.load(html)
        const articles = []
        $('li', html).each(function() {
            const title = $(this).text()
            const url = $(this).find('a').attr('href') 
            articles.push({
                title,
                url
            })
        })
        console.log(articles)
    }).catch(err => console.log('Error occured'))
```
- Here articles is an array which will store the scrapped data. In the above code I have scrapped a website to get data of all the <li> tag and if they have any <a> tag then the links.

- Finally add all the data to the articles array.

- The final code would start appearing like this :

![Image finale-code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oym420pq2ckuk6umosij.png)

- Now in the terminal run `npm start` to see the results.

Output of above code:

![Image output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l787ei91rln20o0tfulp.png)
How To utilize #chatgpt and #Bard to train #opensource #LLMs ?
Tags: chatgpt, bard, openai, google
Published: 2023-05-14 21:49:29

Seeing big corps investing Billions in order to have a MOAT concerning AI and ML, which could lead eventually to tame the opensource initiative this time maybe once for all... adding the users data privacy concerns,  and lying AIs... the question here how can we as individuals and opensource community keep the opensource LLMs competitive ?
JavaScript Scope
Tags: scope, functional, javascript, variables
Published: 2023-05-14 21:45:00

**Introduction**

In this blog post, I'll explain the scope and how to use it to your advantage when writing code. I'll also look at some common scoping issues and how to solve them. Let's get started!

**Types of scope**

In JavaScript, scope refers to the current context of your code. This context determines where you can access certain variables and functions. In other words, where you decide to define a variable or function in JavaScript impacts where you can access it later. So, if you define a variable inside a function, you can only access it inside that function.

**There are 3 types of scope in JavaScript**
-     Global scope
-     Function scope
-     Block scope

**Global Scope**

Global scope means that a variable or function is available anywhere in your code. This is the default scope for variables and functions in JavaScript.
Let's take a look at an example:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/90tuntneqm4yt8tcu188.png)
In the code snippet above, I have defined a variable called 'animal' with a value of 'cat'. I have also defined a function called 'printAnimal', which prints the value of 'animal' to the console. Because I have defined 'animal' in the global scope, I can access it inside the 'printAnimal' function.

**Function Scope**

Function scope is similar to a local scope in that variables and 
each function creates a new scope. However, there is one key difference: Variables defined inside a function are not accessible from outside the function.
Let's take a look at an example:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kdrgrn9rm5fimt5ruziw.png)
In the code snippet above, I have defined a function called 'printAnimal'. I have also defined a variable called 'animal' with a value of 'cat'.
Because I have defined 'animal' inside the 'printAnimal' function, I can only access it inside that function. If I try to access 'animal' outside of the function, I will get an error.

**Local Scope**

I can use let and const keywords inside the Block Scope in JavaScript. Variables declared inside a { } block cannot be accessed from outside the block
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ae0wbaulj231evhvgx8m.png)
In the code snippet above, I have defined a variable called 'animal' with a value of 'dog'. I have also used the 'let' keyword to create a block scope for the variable inside the { } block.
Because I have defined 'animal' using the 'let' keyword, I can access it inside the code block. However, 'animal' is not available in the global scope. Therefore, if I try to access 'animal' outside of the code block, I will get an error.
Manipulating the DOM with JavaScript 101
Published: 2023-05-14 21:44:07

## What is DOM?

DOM stands for Document Object Model, a programming interface that allows web developers to manipulate HTML and XML files. Using scripting languages such as JavaScript, developers can access and modify the structure, style and content of the DOM to generate dynamic and interactive web pages. In this post, we'll go over the basic steps to manipulate the DOM with JavaScript.

## Access DOM Elements

First and foremost, we need to access the element in the DOM that we need to modify. This can be done in a number of ways, but my favorite way is by the method of **`.querySelector()`**. It would be best to assign that element to a variable. The syntax looks like below:

- **Access element based on id**

`const idName = document.querySelector('#idName');`

- **Access element based on a class**

`const className = document.querySelector('.className');`

- **Access element based on a tag**

`const h2 = document.querySelector('h2');`

To access all elements sharing the same class or tag, use **`.querySelectorAll()`**

**Access all h2 elements**
`const h2 = document.querySelectorAll('h2');`


## Adding and Removing HTML Elements

Adding or removing HTML elements is one of the most common ways to manipulate the DOM with JavaScript. Before adding an element, we first would need to create it. To create a new element, we use the **`.createElement()`** method:

`const newDiv = document.createElement('div');`

After that, we would want to use **`.append()`** to add the new **`div`** element to a another element:

For example, we would like to add it to the end of the `body` element, we would first need to grab the body element

```
const body = document.querySelector('body');
body.appendChild(div);
```

To remove an element from the DOM, we can use the **`.remove()`** method.Of course, we need to start by retrieve the element we would like to remove:

```
const example = document.querySelector('#example');
example.remove();
```

## Modifying HTML Element Attributes

It is also possible to modify HTML element attributes such as **`class`**, **`id`**, **`src`**, and **`href`** using JavaScript. See examples below:

**- Retrieve the image we want to update**

```
const image = document.querySelector('#imageID');
image.src = "new URL";
```
**- Add a new class to an element**
```
const element = document.querySelector('#elementID');
element.classList.add('newClass');
```
**- Remove a class from an element**
`element.classList.remove('className');`

As you can see, DOM manipulation with JavaScript is a powerful tool for creating dynamic and interactive user interfaces. Once you are proficient in manipulating the DOM with JavaScript, you can open up a world of possibilities for web development projects. In this post, we only cover the most basic DOM manipulation methods. If you're interested in learning more, head to [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) for more detailed documents.

Happy coding!
Vote Guide for AGE Community
Tags: apacheage, postgres
Published: 2023-05-14 21:39:57

## Introduction
These steps will help you to review the required checks to vote on the upcomming releases

we will apply that on AGE 1.3.0 and PG 11 release
[release files](https://dist.apache.org/repos/dist/dev/age/PG11/1.3.0.rc0/)

### 1- Check Hash
  
using the following command
```sh
sha512sum apache-age-1.3.0-src.tar.gz
```
then compare the result with the value on apache-age-1.3.0-src.tar.gz.sha512

### 2- Check Signature
download the keys from [this link](https://downloads.apache.org/age/KEYS) and verify using the following command
```sh
gpg --import KEYS
gpg --verify apache-age-1.3.0-src.tar.gz.asc apache-age-1.3.0-src.tar.gz
```

### 3- Check Binary Files
using the following command
```sh
find . -type f -executable
```
### 4- check Regression Tests
using the following command
```sh
# in source code folder
make installcheck PG_CONFIG=pg_config
```
then check the following manually 
- Tags and links.
- Validity of release notes.