teleren/devto huggingface dataset:
OpenGauss common log introduction: WAL log
Published: 2023-03-21 03:25:37

WAL log
WAL (Write Ahead Log, also known as Xlog) is a standard method for implementing transaction logs, and the corresponding logs must be persisted before persistent modification of data files (the carriers of tables and indexes). If a data file is to be modified, it must be done after these modification operations have been recorded in the log file, that is, after the log records describing these changes are flushed to permanent storage. When the system crashes, you can use the WAL log to restore openGauss.

Log file storage path

Taking a database node as an example, it is in the "/gaussdb/data/data_dn/pg_xlog" directory by default.

Where "/gaussdb/data/data_dn" represents the data directory of the openGauss node.

Log file naming format

Log files are stored in the form of segment files, each segment is 16MB, and divided into several pages, each page is 8KB. The naming instructions for the WAL log are as follows: the name of a segment file consists of 24 hexadecimal characters, which are divided into three parts, and each part consists of 8 hexadecimal characters. The first part represents the timeline, the second part represents the log file label, and the third part represents the segment label of the log file. Timelines start with 1, log file numbers and log file segment numbers start with 0.

For example, the first transaction log file on the system is 000000010000000000000000.

Explanation:  These numbers are generally used sequentially (it will take a very long time to use up all available numbers), but there are also cases of circular use.

Description of log content

The content of the WAL log depends on the type of recorded transaction, and the WAL log can be used for recovery when the system crashes.

By default, openGauss will first read the WAL log for recovery each time it starts.

maintenance advice

WAL logs play an important role in abnormal database recovery. It is recommended to back up WAL logs regularly.
OpenGauss common log introduction: performance log
Published: 2023-03-21 03:18:17

performance log
The performance log mainly focuses on access performance issues of external resources. The performance log refers to the log that the database system detects the running status of physical resources during operation, and the performance detection when accessing external resources, including access detection information of external resources such as disks. When a performance problem occurs, you can use the performance log to locate the cause of the problem in a timely manner, which can greatly improve the problem-solving efficiency.

Log file storage path

The performance log directory of the database node is in the corresponding directory in "$GAUSSLOG/gs_profile".

Log file naming format

Naming rules for performance logs of database nodes:

postgresql-create-time.prf

By default, a new log file will be generated at 0 o'clock every day or when the log file is larger than 20MB or the database instance (database node) is restarted.

Description of log content

The default format of the log content of each line of the database node:

Host name + date + time + instance name + thread number + log content.
2348. Leetcode Solution in cpp
Tags: cpp
Published: 2023-03-21 03:15:28

===============================================================
#description:
Given an integer array nums, return the number of subarrays filled with 0.

A subarray is a contiguous non-empty sequence of elements within an array.

 

Example 1:

Input: nums = [1,3,0,0,2,0,0,4]
Output: 6
Explanation: 
There are 4 occurrences of [0] as a subarray.
There are 2 occurrences of [0,0] as a subarray.
There is no occurrence of a subarray with a size more than 2 filled with 0. Therefore, we return 6.
Example 2:

Input: nums = [0,0,0,2,0,0]
Output: 9
Explanation:
There are 5 occurrences of [0] as a subarray.
There are 3 occurrences of [0,0] as a subarray.
There is 1 occurrence of [0,0,0] as a subarray.
There is no occurrence of a subarray with a size more than 3 filled with 0. Therefore, we return 9.
Example 3:

Input: nums = [2,10,2019]
Output: 0
Explanation: There is no subarray filled with 0. Therefore, we return 0.
 

Constraints:

1 <= nums.length <= 105
-109 <= nums[i] <= 109
===============================================================
#Solution:

```cpp
class Solution {
 public:
  long long zeroFilledSubarray(vector<int>& nums) {
    long long ans = 0;
    int indexBeforeZero = -1;

    for (int i = 0; i < nums.size(); ++i)
      if (nums[i])
        indexBeforeZero = i;
      else
        ans += i - indexBeforeZero;

    return ans;
  }
};

```
#Leetcode
#challenge 
Here is the link for the problem:
https://leetcode.com/problems/number-of-zero-filled-subarrays/
Zerando HackerRank ( 18 )
Published: 2023-03-21 03:14:40

E no décimo oitavo episodio desta serie que queima os miolos, vamos abordar um problema envolvendo um visualizador de PDF's.

O problema descrito está relacionado à determinação da área de destaque em um visualizador de PDF quando um bloco contíguo de texto é selecionado. Nesse visualizador, cada palavra é destacada independentemente e a seleção é destacada com um retângulo azul. Dado um conjunto de alturas de caracteres para cada letra minúscula do alfabeto inglês e uma _string_ de palavras, o objetivo é determinar a área de destaque assumindo que todas as letras têm a mesma largura.

Para calcular a área de destaque, deve-se determinar a altura da letra mais alta na _string_ selecionada e multiplicá-la pelo número de letras na _string_ selecionada, assumindo que todas as letras têm a mesma largura. A altura de cada letra é dada pelo conjunto de alturas de caracteres de entrada correspondente a cada letra.

Para isso vamos criar a função "designerPdfViewer", essa função vai receber 2 parametros **h** e **word**.

O parâmetro h é um array de números inteiros que corresponde às alturas de cada letra do alfabeto, em que cada posição do array representa uma letra, começando pela letra "a" na posição 0 e terminando na letra "z" na posição 25. Por exemplo, se h for [1, 3, 1, 3, 1, 4, 1, 3, 2, 5, 5, 5, 5, 1, 5, 5, 1, 5, 2, 5, 5, 1, 5, 5, 5, 5], isso significa que a letra "a" tem altura 1, a letra "b" tem altura 3, a letra "c" tem altura 1 e assim por diante.

O parâmetro word é uma string que representa uma palavra. A função designerPdfViewer é responsável por calcular a área ocupada pela palavra na tela, considerando que a largura de cada letra é sempre igual a 1. Para isso, a função utiliza o parâmetro h para obter a altura de cada letra da palavra e, em seguida, calcula a altura da letra mais alta presente na palavra. Essa altura máxima é multiplicada pelo comprimento da palavra para obter a área total ocupada na tela.

Para obter a altura de cada letra da palavra, a função utiliza os métodos split("") e map(). O método split("") é utilizado para separar cada letra da palavra em um array. Em seguida, o método map() é utilizado para percorrer cada letra do array e obter sua altura correspondente no array h. Para isso, a expressão w.charCodeAt() - 97 é utilizada para obter o código Unicode da letra e subtrair 97, resultando em um número de 0 a 25 correspondente à posição da letra no array h.

Por fim, a função Math.max() é utilizada para obter a altura da letra mais alta presente na palavra, que é multiplicada pelo comprimento da palavra para obter a área total ocupada na tela.

Nossa função vai ficar assim: 

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

E assim fechamos mais um desafio.
openGauss Default Permission Mechanism
Tags: opengauss
Published: 2023-03-21 03:05:05

A user who creates an object is the owner of this object. By default, Separation of Duties is disabled after database installation. A database system administrator has the same permissions as object owners. After an object is created, only the object owner or system administrator can query, modify, and delete the object, and grant permissions for the object to other users through GRANT by default.

To enable another user to use the object, grant required permissions to the user or the role that contains the user.

openGauss supports the following permissions: SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, CREATE, CONNECT, EXECUTE, USAGE, ALTER, DROP, COMMENT, INDEX, and VACUUM. Permission types are associated with object types. For permission details, see GRANT.

To remove permissions, run REVOKE. Object owners have implicit permissions (such as ALTER, DROP, COMMENT, INDEX, VACUUM, GRANT, and REVOKE) on objects. That is, once becoming the owner of an object, the owner is immediately granted the implicit permissions on the object. Object owners can remove their own common permissions, for example, making tables read-only to themselves or others, except the system administrator.

System catalogs and views are visible to either system administrators or all users. System catalogs and views that require system administrator permissions can be queried only by system administrators. For details, see System Catalogs and System Views.

The database provides the object isolation feature. If this feature is enabled, users can view only the objects (tables, views, columns, and functions) that they have the permission to access. System administrators are not affected by this feature. For details, see ALTER DATABASE.
openGauss Administrators
Tags: opengauss
Published: 2023-03-21 03:00:44

Initial Users
The account automatically generated during openGauss installation is called an initial user. An initial user is the system, monitoring, O&M, and security policy administrator who has the highest-level permissions in the system and can perform all operations. This account has the same name as the OS user used for openGauss installation. You need to manually set the password during the installation. After the first login, change the initial user's password in time.

An initial user bypasses all permission checks. You are advised to use an initial user as a database administrator only for database management other than service running.

System Administrators
A system administrator is an account with the SYSADMIN attribute. By default, a database system administrator has the same permissions as object owners but does not have the object permissions in dbe_perf mode.

To create a system administrator, connect to the database as the initial user or a system administrator and run the CREATE USER or ALTER USER statement with SYSADMIN specified.

""
CREATE USER sysadmin WITH SYSADMIN password "xxxxxxxxx";
or

""
ALTER USER joe SYSADMIN;
To run the ALTER USER statement, the user must exist.

Monitor Administrator
A monitor administrator is an account with the MONADMIN attribute and has the permission to view views and functions in the dbe_perf schema. The monitor administrator can also grant or revoke object permissions in the dbe_perf schema.

To create a monitor administrator, connect to the database as a system administrator and run the CREATE USER or ALTER USER statement with MONADMIN specified.

""
postgres=# CREATE USER monadmin WITH MONADMIN password "xxxxxxxxx";
or

""
postgres=# ALTER USER joe MONADMIN;
To run the ALTER USER statement, the user must exist.

O&M Administrator
An O&M administrator is an account with the OPRADMIN attribute and has the permission to use Roach to perform backup and restoration.

To create an O&M administrator, connect to the database as an initial user and run the CREATE USER or ALTER USER statement with OPRADMIN specified.

""
postgres=# CREATE USER opradmin WITH OPRADMIN password "xxxxxxxxx";
or

""
postgres=# ALTER USER joe OPRADMIN;
To run the ALTER USER statement, the user must exist.

Security Policy Administrator
A security policy administrator is an account with the POLADMIN attribute and has the permission to create resource tags, anonymization policies, and unified audit policies.

To create a security policy administrator, connect to the database as an administrator and run the CREATE USER or ALTER USER statement with POLADMIN specified.

""
postgres=# CREATE USER poladmin WITH POLADMIN password "xxxxxxxxx";
or

""
postgres=# ALTER USER joe POLADMIN;
To run the ALTER USER statement, the user must exist.
Conte sua história
Tags: wecoded, braziliandevs
Published: 2023-03-21 02:37:02

Eu era da área de Arquitetura e Urbanismo, em agosto de 2018 entrei no curso técnico em Informática para Internet pois vi alguns conteúdos sobre casas inteligentes. Eu não tinha ideia do que estava por vir, aos meus 27 anos de idade tive o primeiro contato com código, com a linguagem _JavaScript_ (a qual não funcionava muitas vezes pois eu escrevia a tag errada).

A cada aula, aprendendo um pouquinho mais, um passo de cada vez, criando pequenos grandes projetos... foi assim que em um semestre eu troquei a graduação em Arquitetura e Urbanismo por Ciência da Computação.

Eu me sentia realmente bem conseguindo desenvolver os projetos, aprendendo com os erros (que eram muitos), me envolvendo com projetos de extensão dentro da faculdade, achava tudo tão incrível que queria mostrar para outras pessoas, porém não sabia muito bem como. Apesar de ir bem nas disciplinas, eu ainda não me sentia capaz de compartilhar o que estava aprendendo, junto com a ansiedade e dificuldade de comunicação que sempre tive, tinha mais alguma coisa que eu não sabia descrever.

Depois de um ano de faculdade, vieram mais mudanças. Pandemia, aulas a distancia, dificuldades, decidi parar um pouco, por um semestre. Foi nesse tempo 'ocioso' que tive a sorte de conhecer **pessoas incríveis** e consegui entender aquela coisa que me impedia de mostrar para o mundo o que eu queria.


> ### REPRESENTATIVIDADE


Conhecer pessoas e histórias com as quais eu me identificava, poder contar a minha história e meus medos em um lugar seguro, ter apoio e incentivo, era isso que eu precisava para começar.

Então comecei, em dezembro de 2020 consegui um notebook, instalei alguns programas, peguei uma lista de exercícios e abri uma live na Twitch. Foi assim o começo da minha jornada com objetivo inicial de melhorar minha comunicação. Além disso, também quis mostrar que se for tua vontade, **tu podes ocupar esse lugar**, podes compartilhar o que tu aprendeu sem precisar ser expert ou nunca errar, até porque através de erros podemos aprender cada vez mais.

Por fim, agradeço **imensamente** à todas que vieram antes de mim, vocês que me deram coragem e possibilitaram que eu trilhasse esse caminho de uma maneira mais segura. Espero muito que eu possa inspirar e encorajar mais pessoas que se identificam com a minha história a darem seus primeiros passos e crescerem ao _infinito e além_.


---

Conheça mais pessoas maravilhosas: [Feministech](https://feministech.com.br/)


**Enjoy!**
Kubernetes Commands Cheat Sheet
Tags: devops, kubernetes, programming, devjournal
Published: 2023-03-21 02:31:00

## The 31 Commands You Need To Know 


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


Thanks for reading this.

If you have an idea and want to build your product around it, schedule a call with [me](https://calendly.com/pragyanatvade).

If you want to learn more about DevOps and Backend space, [follow me](https://dev.to/pragyanatvade).

If you want to connect, reach out to me on [Twitter](https://twitter.com/pragyanatvade) and [LinkedIn](https://www.linkedin.com/in/pragyanatvade/).
NBA Team encyclopedia
Published: 2023-03-21 02:15:59

**Writing the 1st article in a series about the scope of what your going to be building**
We are building a encyclopedia for NBA teams, specially we are going to be writing about how the team did throughout the history, the amount of championships they won, the hall of fame players they have and their win lost ratio. Our main functions and layout would be team icon UI and collapsible UI. In the collapsible UI, there will be more details of the team.

**Include images of how you are conceiving the API for the elements involved and the names**
This is a screenshot of our API in JSON file.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59by9ouscalc8mtitp7g.png)

**What properties do you think you'll need**
We will need onclick functions and buttons for all the drop downs, classes for the images, descriptions, and stats and CSS for all the fonts and images. 

**What sort of information will need to come from the backend to make this work?**
We would need all the championships, hall of fame players and wins/loses ratio state for the teams.

**Either using a screen cast, taking screen shots, links to your code, show how you'll apply concepts from the Homework**
The map function maps each element to one instance of a team and the team list. We use this in our project to map our elements of name, description and other details.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ulninkwwzoq7r38uchee.png)

**Relate it to what you'll have to do in order to pull this off for Project 2**
Our approach to project 2 will be similar to this project. We will use imported data to display the information and improve the website.
S3 File Upload & Download using .NET7 Blazor WASM & WebApi
Tags: dotnet, webassembly, aws, blazor
Published: 2023-03-21 02:11:10

In this series, We are going to see how to create a Blazor Web Assembly application that will connect with the AWS S3 services and do file uploads and downloads into S3 buckets. An ASP NET Core WebAPI application will be acting as an intermediate backend service that will handle the request from the Blazor application and do the appropriate actions in the AWS S3.

We will use .NET 7 for this tutorial as it is the latest at this time. In the next chapter, you will find out how to set up AWS IAM users.
Python mediated kinetic exchange (a Battleship clone)
Published: 2023-03-21 02:03:18

As a capstone project for my intro to programming (python) course at Codecademy I chose to program the classic board game Battleship. 

I structured the code into two classes: Grid, which covers a total of 4 grids, one guesses grid and one ship grid for each player and Ship which covers different ships created for each player. Both classes highlight the flexibility inherent in object oriented programming as Grid works for many custom sizes and Ship supports all different ship types and sizes seen in the board game.

After the definition of these two classes, the rest of development consisted of completing core gameplay functionality and interaction implemented with methods. Many common python data types were used, dictionaries, lists, 2D lists, strings, booleans and integers. Coming from other languages and teachings from my time back in school I did not think dictionaries would be that useful.  It turns out my first big python project here needed them several times!

The biggest challenge was a subtle bug that escaped unit testing of two individual functions.  After using Ship.is_valid_placement() and Ship.place_ship() with the same ship starting location index I discovered several out of index errors and ship overwrites/incorrect placements at runtime. 

To trace this bug I used print() statements to track location indexes throughout the two methods and they revealed that the location index was modified during checks along the length of the proposed ship as specified but what was unknown was that this was performed on the location index and not a copy of one. After checking for a good location then trying to place a ship there this led to the ship being placed several spaces away. Changing is_valid_placement() to work on a copy of the location coordinates using b = a.copy() resolved the logic errors as both functions now started with the same location.

Python has reduced the complexity of returning and managing datatypes passed to functions as passed values are referenced and modified directly, but when your habits from other languages kick in it can go sideways quick!

Overall it was a fun project to make and a great learning experience bringing all the fundamentals of python together with memories playing the game growing up.

Published code as seen below can be found at [my GitHub](https://github.com/aerostar105/singleplayergames)

![Main gameplay loop and terminal output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/co8aesbjp4kufqel1ezx.png)
openGauss Establishing Secure TCP/IP Connections in SSH Tunnel Mode
Tags: opengauss
Published: 2023-03-21 02:02:48

Background
To ensure secure communication between the database server and its clients, secure SSH tunnels can be established between the database server and clients. SSH is a reliable security protocol dedicated to remote login session and other network services.

Regarding the SSH client, the SSH provides the following two security authentication levels:

Password-based security authentication: Use an account and a password to log in to a remote host. All transmitted data is encrypted. However, the connected server may not be the target server. Another server may pretend to be the real server and perform the man-in-the-middle attack.
Key-based security authentication: A user must create a pair of keys and put the public key on the target server. This mode prevents man-in-the-middle attacks while encrypting all transmitted data. However, the entire login process may last 10s.
Prerequisites
The SSH service and the database must run on the same server.

Procedure
OpenSSH is used as an example to describe how to configure SSH tunnels. The process of configuring key-based security authentication is not described here. OpenSSH provides multiple configurations to adapt to different networks. For more details, see documents related to OpenSSH.

Establish the SSH tunnel from a local host to the database server.

""
ssh -L 63333:localhost:8000 username@hostIP
 NOTE:

The first digit string (63333) of the -L parameter indicates the local port ID of the tunnel and can be randomly selected.
The second digit string (8000) indicates the remote port ID of the tunnel, which is the port ID on the server.
localhost is the IP address of the local host, username is the username on the database server to be connected, and hostIP is the IP address of the database server to be connected.
WK 10 HW Blog Post
Published: 2023-03-21 01:58:27

- The API is being used by taking the properties in the roster.json file and sending it to the map in the team-roster.js file. That map is then rendered out in the .js file. 


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


- Since athletes are the basis of the card, the properties will consist of the name, position, stats/details label, as well as the more generic properties like an image and the top/bottom text. All this information from the backend is necessary in order to properly create "templates" for the athlete cards.

 

- For Project 2, we'll have to use these same concepts to create micro frontends (badges) that can be easily replicated and altered individually. Once again, data will need to be pulled from a .json file by an API, then rendered with a map. 

An example of the type of map that is going to be implemented:

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