teleren/devto huggingface dataset:
TPScore: transactions per second metrics made easy
Tags: blockchain, polkadot, opensource, web3
Published: 2023-09-26 10:56:55

## Basic idea

TPScore simplifies TPS Data Analysis for non-technical users in the Polkadot Ecosystem.

TPScore aims to provide non-technical users in the Polkadot ecosystem with an accessible and user-friendly platform for analyzing TPS (Transactions per Second) data. Our goal is to bridge the gap between technical intricacies and user-friendly visualization, empowering individuals to make informed decisions about blockchain adoption, investment, and development.

## How it was build

The project was build for the [Web3 Foundation Grants Program](https://grants.web3.foundation/). TPScore consists of two main parts:

- [ETL System](https://github.com/BCS-Labs/tpscore-etl-system)
- [User Interface (UI) with Data Visualizations](https://github.com/BCS-Labs/tpscore-web-client)

### ETL System

We retrieve blockchain data using either the [Subscan API](https://support.subscan.io/#introduction) or connect to the public endpoints of parachains using the [Substrate interface library](https://pypi.org/project/substrate-interface/1.0.3/). Also we use Apache Airflow to ensure streamlined data processing.

To calculate the average TPS, we take the number of transactions within the last 100 blocks. We fetch raw data at regular intervals of every 10 minutes. This raw data then undergoes processing within Airflow's DAGs using Python Operators, ensuring efficient data transformation and preparation. Finally, the processed data is stored in a MySQL database.

### User Interface

We use [Next.js](https://nextjs.org/) as our full-stack framework. It allows to both retrieve data from the MySQL database and render React app on a server. 

To visualize data, we use a simple and concise UI: the grid of cards with the blockchain's name and TPS. We expect one common use case: users go to our website and scan through all chains to find a desired one. So we simplify this process by adding handy sorting and searching functionality.

## How to use it

Go to [tpscore.xyz](https://tpscore.xyz/) and grasp real-time transactions per second metrics for the desired blockchain in Polkadot ecosystem.

## How to contribute

We provide detailed guide for both [ETL System](https://github.com/BCS-Labs/tpscore-etl-system#readme) and [User Interface](https://github.com/BCS-Labs/tpscore-web-client#readme). You can easily spin up local development setup with Docker by following simple steps from READMEs. Also we provide inline documentation for you. Core logic is fully covered by unit tests, so you can contribute without fear of breaking anything.
Cascading deletion and configuration in Entity Framework 🔥
Tags: csharp, aspdotnet, tutorial, entityframework
Published: 2023-09-26 10:55:20

Cascading deletion is a mechanism that allows you to delete a parent unit, causing all dependent units to be automatically deleted. This is useful in situations where a dependent entity cannot exist without a parent entity.

In Entity Framework, cascading deletion is configured using the <code>DeleteBehavior</code> property of the relationship between entities. It can take the following values:

<hr>

1. <code>Cascade</code> - the dependent unit will be deleted automatically when the parent unit is deleted.

2. <code>Restrict</code> - removing the parent unit will throw an exception if the dependent unit is still existing.

3. <code>NoAction</code> - deleting the parent entity will have no effect on the dependent entity.

4. <code>SetNull</code> - the foreign key of the dependent unit will be set to null when the parent unit is deleted.

<hr>

Here are the steps to configure cascading delete in Entity Framework:
<br>

## ⚡️ Model Definition:
Ensure that your data models (classes representing entities) have the appropriate attributes and configurations that define the relationships between them. For example, you can use the <code>ForeignKey</code> or <code>InverseProperty</code> attributes to specify relationships between entities.

<code>
public class Parent
{
    public int ParentId { get; set; }
    public string Name { get; set; }
    public ICollection<Child> Children { get; set; }
}

public class Child
{
    public int ChildId { get; set; }
    public string Name { get; set; }
    public int ParentId { get; set; }
    public Parent Parent { get; set; }
}
</code>


## ✨ Fluent API Configuration:
If you are using Fluent API, you can define cascading delete in the <code>OnModelCreating</code> method in your <code>DbContext</code> class. Here's an example of cascading delete:

<code>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Parent>()
        .HasMany(p => p.Children)
        .WithOne(c => c.Parent)
        .HasForeignKey(c => c.ParentId)
        .OnDelete(DeleteBehavior.Cascade);
}

</code>
In the above example, <code>OnDelete(DeleteBehavior.Cascade)</code> specifies that deleting a parent record will also result in the deletion of all its children.
<br><br>

## 🍂 Database Update:
After defining the relationships and cascading delete, you need to update your database. You can use EF Core migrations to automatically apply these changes to the database.

<code>
add-migration Init
</code>
<code>
update-database
</code>
Now, when you delete a parent record, all the related child records will be automatically deleted from the database.

Remember that cascading delete has consequences, so use it carefully. Make sure you understand which records will be deleted before using it to avoid data loss. 🌱
Descubra o Segredo da Busca Binária em Java: A Caça ao Tesouro Eficiente! 📚🔍💎
Tags: java, algorithms, beginners, braziliandevs
Published: 2023-09-26 10:42:31

A **busca binária** é como encontrar um número em um livro, mas de uma maneira muito inteligente! 📚 Imagine que você tem um livro onde os números estão em ordem, da menor página para a maior. Agora, você quer encontrar o número 42. O que você faz?

1. 
Primeiro, você abre o livro na metade (página 50, por exemplo, se o livro tem 100 páginas). 📖

2. 
Você olha para o número na página onde você abriu o livro.

3. 
Se o número for menor que 42, você sabe que o 42 só pode estar na metade das páginas maiores. Então, você fecha a primeira metade do livro.

4. 
Se o número for maior que 42, você sabe que o 42 só pode estar na metade das páginas menores. Então, você fecha a segunda metade do livro.

5. 
Agora, você repete o processo a partir do ponto 1, mas agora em apenas metade do livro.

6. 
Você continua fazendo isso até encontrar o número 42 ou perceber que ele não está no livro.
Em Java, podemos fazer a busca binária em um vetor da mesma forma! 

**Aqui está um exemplo de código:**

```
public class BuscaBinaria {

    public static int buscaBinaria(int[] vetor, int alvo) {
        int esquerda = 0;
        int direita = vetor.length - 1;

        while (esquerda <= direita) {
            int meio = (esquerda + direita) / 2;

            if (vetor[meio] == alvo) {
                return meio; // Encontrou o número!
            } else if (vetor[meio] < alvo) {
                esquerda = meio + 1; // Procurar na metade direita
            } else {
                direita = meio - 1; // Procurar na metade esquerda
            }
        }

        return -1; // O número não está no vetor
    }

    public static void main(String[] args) {
        int[] vetor = {1, 4, 8, 15, 42, 50, 67, 99};
        int alvo = 42;

        int resultado = buscaBinaria(vetor, alvo);

        if (resultado != -1) {
            System.out.println("Encontrou o número " + alvo + " na posição " + resultado);
        } else {
            System.out.println("Número " + alvo + " não encontrado no vetor.");
        }
    }
}
```

Neste código, a função buscaBinaria recebe um vetor ordenado e um número alvo. Ela usa a busca binária para encontrar o número e retorna a posição onde o número foi encontrado ou -1 se não foi encontrado.

A busca binária é uma maneira muito eficiente de encontrar itens em listas ordenadas, como vetores, porque corta o espaço de busca pela metade a cada passo. É como uma caça ao tesouro eficaz! 🏴‍☠️🗺️

LinkedIn: https://www.linkedin.com/in/antonio-rodrigo-wanderley-serra/
GitHub: https://github.com/antoniorws
Let's measure
Published: 2023-09-26 10:31:12

I’m guilty of undermeasuring. With the next side project I want to change that, and see if I can do better. Basically I want to  use my abilities to program, to help my everyday routines. It’s mainly about integrating all the great tools already known and finding a different approach to use them.

For now I want to leave out the details of the implementation, but to give you a glimpse of what the starting point looks like. I've already established a foundational setup that allows me to configure commands similar to the following example:


```yaml
---
commands:
  - name: hello-world
    description: >
      Greet a planet
    executor:
      type: shell
      command: echo "Hello ${planet}!"
    parameters:
      - name: planet
        description: The planet you want to greet.
        type: string
        autocomplete:
          - Earth
          - Pluto
```

Building something like this is really fun, but you can easily get off track. I think the best way to guardrail my efforts is to define what I want to achieve and measure the outcomes. It might be difficult to find, but I’m sure it’s possible.

> All important decision makers could benefit from learning that anything they really need to know is measurable. _[How to measure anything : finding the value of “intangibles” in business. Douglas W. Hubbard. – 2nd ed.]_

So let’s find out what we want to measure.


1. Is Usage Success?
I go with a definite maybe. First self deception is a thing, so an easy way to rate the commands used, will hopefully add quality as a dimension. Something `cli rate-last [1-5]`, will help me capture my emotion in the moment, even if I only rate exceptional usage.
Secondly, success is more than just usage. I want to track the projects I use my app with and evaluate the success of the project (failing and learning is fine) and the impact of the app.

2. Integrating as focus
Third party software and services are so integral to my work and a major part of the vision. That’s why I want to track it besides the general success. The app might have integrations backed in, but it’s not its main purpose. So all software and services which are triggered, used or configured with my app, should be tracked.

I’m aiming at the following:
- Reaching 200 calls per week of the app within the two months,
- no more than 20/100 bad calls,
- 10 integrations

I’ll follow-up on how I collect the data.
WordPress behind a reverse proxy (with Polylang)
Tags: apache, wordpress
Published: 2023-09-26 14:16:10

---
title: WordPress behind a reverse proxy (with Polylang)
published: true
date: 2023-09-26 10:26:24 UTC
tags: apache,Wordpress
canonical_url: https://daniele.tech/2023/09/wordpress-behind-a-reverse-proxy-with-polylang/
---

Reverse proxy are very helpful but sometimes they are complicated...

The post [WordPress behind a reverse proxy (with Polylang)](https://daniele.tech/2023/09/wordpress-behind-a-reverse-proxy-with-polylang/) appeared first on [Daniele Mte90 Scasciafratte](https://daniele.tech/eng).
A Comprehensive Step-By-Step Guide on Integrating TailwindCSS with NodeJS, Express and EJS
Published: 2023-09-26 10:24:16

In my latest blog post, I've created a comprehensive guide that will take you on a journey through the integration of Tailwind CSS with Node.js, Express, and EJS. Whether you're a seasoned developer looking to streamline your workflow or a newcomer eager to learn the ropes of this powerful stack, this guide has something for everyone. By the end, you'll be equipped with the knowledge and tools to create beautifully styled web applications with efficiency and ease. Read on to unlock the full potential of your web projects!

[Link to the blog](https://devhelphub.hashnode.dev/a-comprehensive-step-by-step-guide-on-integrating-tailwindcss-with-nodejs-express-and-ejs)
Posting on Bluesky Social using Python in 1 minute
Tags: bluesky, python, atprotocol, api
Published: 2023-09-26 08:03:05

Here I will explain quickly how to make a post on Bluesky using its underlying technology ([ATProtocol](https://atproto.com/)).

First, you need to implement a method to login to Bluesky by creating a session using your regular username and password:

```python
def bsky_login_session(host: str, handle: str, password: str) -> dict:
    resp = requests.post(
        host + "/xrpc/com.atproto.server.createSession",
        json={"identifier": handle, "password": password},
    )
    resp.raise_for_status()
    return resp.json()
```

Then you will create a post. Let's say a simple post containing a text and an image:

```python
def create_image_post(host: str, handle: str, password: str, text: str, image_url: str):
    session = bsky_login_session(host, handle, password)

    now = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")

    post = {
        "$type": "app.bsky.feed.post",
        "text": text,
        "createdAt": now,
        "embed": upload_images(host, session["accessJwt"], image_url)
    }

    # Post payload
    resp = requests.post(
        host + "/xrpc/com.atproto.repo.createRecord",
        headers={"Authorization": "Bearer " + session["accessJwt"]},
        json={
            "repo": session["did"],
            "collection": "app.bsky.feed.post",
            "record": post,
        },
    )
    resp.raise_for_status()
```

Now let's test it:

```python
if __name__ == '__main__':
    host = 'https://bsky.social'
    handle = 'yourhandel.bsky.social'
    password = 'your password'

    create_image_post(host, handle, password, 'Cats are awesome', 'images/my_cat.jpg')
```

As simple as that! You could make your own personalized Bluesky **bots** which post stuff on the site. It's pretty straightforward and easy to set up, isn't it?

Happy coding
Al
How to Upgrade / Update Firmware of Your Seagate Driver Tutorial
Tags: hdd, firmware, seagate, tutorial
Published: 2023-09-26 10:21:23

First download release of openSeaChest

Open a CMD as administrator

Enter inside folder where you will find `openSeaChest_Basics.exe`

Execute below command to find your driver serial number

`openSeaChest_Basics.exe openSeaChest_Firmware --scan`

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

Then type seagate firmware download to google

Enter your serial number to the Firmware Downloads and search your firmware


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

Then download latest firmware


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

Then extract it into openSeaChest folder


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

I also renamed for easy call from CLI

Then look PID of your disk that you want to update


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

Then modify this command according to you and execute it. It will update the firmware. Remember this can cause data loss so always backup files and later verify them. I have a byte comparison file verification software that I have coded. I am using it to verify.

`openSeaChest_Basics.exe SeaChest_Firmware -d PD1 --downloadFW SN04.lod`

After this turn off your computer. Not just restart. Wait 15 seconds and turn on again. Now when you scan disks you should see new firmware.

As in my case you see one of the drive is SN04 and the other one is SN03. 

Hopefully I will record a video tutorial to upgrade SN03 one.
CRUD APPLICATION WITH REACTJS AND CODEIGNITER 4
Tags: webdev, react, reactjsdevelopment
Published: 2023-09-26 10:17:51

Build a powerful **CRUD Application** With ReactJs and Codeigniter 4 – learn to create, read, update, and delete data seamlessly.

Are you set to grow your web development abilities? In this tutorial, we’ll show how to use the powerful combination of React.js and CodeIgniter 4 to build a fully functional CRUD Application With ReactJs and Codeigniter 4. You’ll have a solid foundation on how to create dynamic web apps that can manage data operations without interruptions.

Prerequisites

Make sure you have the following resources and information before we begin the tutorial on the CRUD Application With ReactJs and Codeigniter 4:

1. Basic familiarity with HTML, CSS, and JavaScript.
2. Basic familiarity with MySQL and PHP.
3. For the React.js part, npm and Node.js were installed.


**_Topics We’ll Cover_**

- [Creating the Development Environment Set](https://rrtutorials.com/creating-the-development-environment-set/).

1. npm and Node.js installation.
2. Downloading the Xampp Server and Setup the Environment.

-  [Set up the Application or backend Using CodeIgniter 4](https://rrtutorials.com/setup-the-codeigniter-4-application/).

1. Let’s download the latest version of CodeIgniter 4.
2. Set up an application using CodeIgniter in htdocs.

- [Creating the Backend or API using CodeIgniter 4](https://rrtutorials.com/api-with-codeigniter-4/)

1. Set up the database and configure it.
2. Creating the Controller and API.
3. Setup the Routing.

- [Using React.js to create the front end](https://rrtutorials.com/crud-frontend-in-reactjs/)

1. Creating a New React App 
2. Adding Components for Each CRUD Operation.

- [CRUD Functionality Implementation](https://rrtutorials.com/crud-functionality-with-codeigniter-4-and-reactjs/)

1. Data Gathering from the Backend
2. Making Brand-New Items
3. Updates to Existing Items
4. Deleting the Items

Each step in this tutorial will be broken down into clear guidance, working samples of the code, and explanations. By the conclusion, you’ll have a fully functional CRUD application that showcases the abilities of CodeIgniter 4 for backend data management and React.js for frontend interaction.

So let’s start the journey of developing a CRUD application together, whether you’re an experienced programmer trying to expand your skill set or someone who’s ready to learn. Let’s get going!

> You can visit or read the full post ([Full Post](https://rrtutorials.com/crud-application-with-reactjs-and-codeigniter-4/)) on this link and if you have any query related to the topic feel free to ask. I definitely reach you as soon as possible.  😊😊🥳🥳😍😍
Functional Programming: an accumulator of methods to transform objects in Javascript
Tags: functional, javascript, node
Published: 2023-09-26 10:09:15

While I was trying to solve a problem within my code, I had to modify an object by applying a set of transforming methods. I had to do the same with a whole array of strings, all requesting the same set of transformers to be applied.

Since I am a big fan of Functional Programming I wanted to use a `map-reduce` approach. I came up with a generic method leveraging the native `reduce` method of `Array` objects, the idea is to “accumulate” a string which at each iteration becomes both the result of the last transformation method and the input for the next transformation method.

Here is a placeholder:

```javascript
const tranformers = [s => s.trim(), s => s.toUpperCase()];

const multiTransform = (str) => tranformers.reduce(
  (accumulator, currentValue) => {
    return currentValue(accumulator);
  },  // reduce callback
  str // initial value
);

console.log("Expecting the value 'HELLO WORLD' from `multiTransform` method:", multiTransform(" hello world "));
```

And in order to show how it can be applied to a set of strings, I will leverage the brand new [Node.js Native Test Runner](https://nodejs.org/api/test.html), which is still experimental but can be used from versions of Node.js >= v18.0.0 LTS (or either v16.17.0):

```javascript
import assert from 'node:assert';
import test from 'node:test';

test('array transformation', (t) => {
  const arr = [" alice ","bob"," paul"];
  assert.deepEqual(["ALICE","BOB","PAUL"], arr.map(multiTransform));
});

---
> ✔ array transformation (1.886ms)
```

In vanilla Javascript, soon everything can become a mess due to the nature of the language, which is weakly typed. So the idea behind this *accumulator pattern* is to apply a certain number of transformations to a set of homogeneous objects; `Strings` are the most straightforward example of course. 
Another possibility is that transformation methods include the capability to receive different object types and transform them according to the type of the object itself.
MSK Serverless - kafka-console-producer error with Kafka 3.4.0 version
Published: 2023-09-26 10:04:37

I have been working with MSK Serverless and kafka-clients 3.4.0. Everything worked as it should when I used * for a topic name.

arn:aws:kafka:region:account-id:topic/cluster-name/cluster-uuid/*

But, when I had specified a topic name and tried to produce to it: arn:aws:kafka:region:account-id:topic/cluster-name/cluster-uuid/private-topic-1

I got the following error: Caused by: org.apache.kafka.common.errors.ClusterAuthorizationException: Cluster authorization failed

So, I decided to use two terminals in parallel: 1: kafka-3.0.0 2. kafka-3.4.0

I made the same configuration for both version. The same command(kafka-console-producer) works on the version 3.0.0, but failed on the version 3.4.0 (Cluster authorization failed).

I decided to try multiple version, and conclusion is that everything works as it should up to kafka 3.0.1 version. Producer start failing with the 3.0.1 version.

Consumer works with the specified topic on the version 3.4.0. So the problem is in the producer.

As I read, MSK Serverless works with the kafka 2.8.1 version, but is there any way to fix this issue, so I can use kafka-clients 3.4.0. I don't want to downgrade kafka-clients version on my Java project.
What Is Oogle?
Tags: webdev, opensource, ai, machinelearning
Published: 2023-09-26 10:00:51

Donald Knutt 
Hierarchy, search

System Symbols F(AN:NA)

Dynamic Einstein coordination. Every point of Ogle (point of view) from Quantum Physics approach is potentially the separate Universe.

Metadata yielding. Only your personal Oogle, yield, your approach to the Metadata of potentially quantum internet is making you human. From Oogle paradigm we have common Metadata and personal approach, personal Einstein coordinate and personal quantum yield, variety vector, Wich is creating personal reality.

Quantum Field Theory has same abbreviation for Quantum Fungible Token. System Of Symbols basically has 2 quantum fields - ideal and material, and only one variety vector, we call it Oogle.

Hawking Black Hole Temperature provides sense from Optical Gravitational Lensing. Every Black Hole is O.G.Lense, it has Event Horizon, Wich can be ogled only from inside. But Hawking proofs it has sence.

Each Oogle is the center of gravity of the universe. Dark 🌑 Matter from the other universes dynamic points of ogling. Oogle has quantum vector of variety, defining, what it will be next. Being observed is a particle. Being a wave 🌊 - a dark matter. Dark Matter and Energy is 60-90% of World's gravity. Only 5% of matter is being observed now. James Webb and Euclid lenses observe now.

Dark Matter has major gravity.

Oogle is the approach to the Dark Matter ideal Field transaction to the Material Field of observed matter.
Which one is better option for maintaining application with Two Databases or single database with Multiple Schemas
Published: 2023-09-26 09:56:33


I'm Working as Database backend Team for eCommerce Project using Django Python,

My question is we are planning for different Domains for each Country with different vendors and users based on country.

**Which one is better option for application and why ??
A. Single Database with Two Schemas.
B. Two database for each domain.**

can anyone help me with the above question?