teleren/devto huggingface dataset:
Synchronous Redo Logging
Published: 2023-04-18 06:20:51

The Synchronous Redo Logging option is the simplest and most strict redo logger. When a transaction is committed by a client application, the transaction redo entries are recorded in the WAL (Redo Log), as follows –

While a transaction is in progress, it is stored in the MOT’s memory.
After a transaction finishes and the client application sends a Commit command, the transaction is locked and then written to the WAL Redo Log on the disk. This means that while the transaction log entries are being written to the log, the client application is still waiting for a response.
As soon as the transaction's entire buffer is written to the log, the changes to the data in memory take place and then the transaction is committed. After the transaction has been committed, the client application is notified that the transaction is complete.
Technical Description
When a transaction ends, the SynchronousRedoLogHandler serializes its transaction buffer and write it to the XLOG iLogger implementation.

Figure 1 Synchronous Logging

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w875lcutjyl6gefwdwkz.png)
Summary
The Synchronous Redo Logging option is the safest and most strict because it ensures total synchronization of the client application and the WAL Redo log entries for each transaction as it is committed; thus ensuring total durability and consistency with absolutely no data loss. This logging option prevents the situation where a client application might mark a transaction as successful, when it has not yet been persisted to disk.

The downside of the Synchronous Redo Logging option is that it is the slowest logging mechanism of the three options. This is because a client application must wait until all data is written to disk and because of the frequent disk writes (which typically slow down the database).
Creating an Index for an MOT Table
Tags: opengauss
Published: 2023-04-19 03:55:01

Standard PostgreSQL create and drop index statements are supported.

For example –

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

The following is a complete example of creating an index for the ORDER table in a TPC-C workload –

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

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

For MOT index limitations, see the Index subsection under the _SQL Coverage and Limitations _section.
Creating/Dropping an MOT Table
Tags: opengauss
Published: 2023-04-19 03:52:21

Creating a Memory Optimized Table (MOT) is very simple. Only the create and drop table statements in MOT differ from the statements for disk-based tables in openGauss. The syntax of all other commands for SELECT, DML and DDL are the same for MOT tables as for openGauss disk-based tables.

**·** To create an MOT table –

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

**·** Always use the FOREIGN keyword to refer to MOT tables.

**·** The [server mot_server] part is optional when creating an MOT table because MOT is an integrated engine, not a separate server.

**·** The above is an extremely simple example creating a table named test with a single integer column named x. In the next section (Creating an Index) a more realistic example is provided.

**·** MOT tables cannot be created if incremental checkpoint is enabled in postgresql.conf. So please set enable_incremental_checkpoint to off before creating the MOT.

**·** To drop an MOT table named test –

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

**·** ALTER TABLE –

support includes Add column, Drop column and Rename column.

For a description of the limitations of supported features for MOT tables, such as data types, see the MOT SQL Coverage and Limitations section.
How to Unhide All Product Images on Product Page in Magento 2
Tags: webdev, magento, magento2tutorials
Published: 2023-04-19 03:46:30

Magento 2 is a profoundly adaptable web based business stage that gives an extensive variety of customization choices for site proprietors, remembering configurable items for Magento 2. 

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

One such customization choice is the capacity to stow away or unhide item pictures on the item page. If you have coincidentally stowed away item pictures and need to make them noticeable once more, this guide will walk you through the course of **_how to Unhide all Product Images on Product Page in Magento 2._**

For more info, visit **_https://webguru.dev/how-to-unhide-all-product-images-on-product-page-in-magento-2/_**
How to setup a local endpoint with express and Node.js
Tags: beginners, tutorial, express, api
Published: 2023-04-19 03:35:56

##Introduction

This guide is for anyone who has ever wanted to setup a local endpoint for use in their projects. This guide assumes that you already have Node.js and express installed. 

##Setup your local server
To start things off, you'll need to create a js file in the root folder of your project.

![Initial folder structure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2xsmcg88ohtoqmniajz.png)

Next, import empress using the following code:
```
const express = require('express');
const app = express();
```
You can then proceed to set your port number as follows:
```
const port = 3000;
```

Now you can setup your basic routing with express. Routing is what determines how your app will respond to client requests from a particular endpoint, in this case your homepage. 
```
app.get("/", (req, res) => {
  res.send("Local server running...");
});
```

Finally, set your app to listen for connections on the previously created port. 
```
app.listen(port, () => {
    console.log(`Listening on port ${port}...`)
})
```
To check if everything is working, open your terminal, navigate to your project folder and run the command `node example.js`. You should get the following response in your terminal:

![App listening on port](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bbeda3lftdw3jlrk54qb.png)

Open your browser and go to `http://localhost:3000/` and the following should be displayed:

![App running in browser](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vjwfr6bt5e6n7ho1je7y.png)

Congrats, your local server is running!

## Creating local endpoint

The first step is to add the JSON file with the data to the root folder of your project. In this example, we have some mock student data. 

![Adding JSON file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2psjvxw8z8ub71dkq6bx.png)

Go back to your server file(example.js), create a new route to a page of your choice(/api) and send your JSON file to this page. 

```
app.get("/api", (req, res) => {
  res.sendFile(__dirname + "/example.json");
});
```

Save the changes, restart your server and navigate to `http://localhost:3000/api` to display the JSON data. You should see the following:


![Endpoint data in webpage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4bbignwxckfispm1eytc.png)

Congrats, you have managed to setup a local endpoint!

##Conclusion
With these steps you will be able to quickly setup a local server and connect to a local endpoint. This can be incredibly useful for testing. From here you will be able to send the data that you need to your app's frontend. I hope this was useful and good luck on your programming journey!


##References
1. [Basic Routing](https://expressjs.com/en/starter/basic-routing.html)
Granting User Permissions
Tags: opengauss
Published: 2023-04-19 03:20:57

The following describes how to assign a database user permission to access the MOT storage engine. This is performed only once per database user, and is usually done during the initial configuration phase.

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

To enable a specific user to create and access MOT tables (DDL, DML, SELECT) –

Run the following statement only once –

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

All keywords are not case sensitive.
1372. Leetcode Solution in cpp
Tags: cpp
Published: 2023-04-19 03:12:54

```cpp
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
    public:
    int maxLength=0;

    void solve(TreeNode* root,int dir,int currLength){
        if(!root) return;
        maxLength=max(maxLength,currLength);
        solve(root->left,0,dir?currLength+1:1);
        solve(root->right,1,dir?1:currLength+1);
    }

    int longestZigZag(TreeNode* root) {
        solve(root,0,0);
        solve(root,1,0);
        return maxLength;
    }
};
```
#leetcode
#challenge
Here is the link for the problem:
Starchart - Milestone 1.0a
Published: 2023-04-19 02:59:17

Last week, I worked on a bunch of things for our 1.0a (alpha) release:  

- **Adding end-to-end tests for DNS Records** 
We were missing a large amount of tests for the DNS Records page. This included checking for different types and values of DNS Records when creation so that only valid values for different types can be created. It also included checking that all values were saved properly, checking edit functionality and delete functionality ([PR](https://github.com/DevelopingSpace/starchart/pull/576))

- **Preparing for Remix v2** 
This was to deal with multiple depreciation warnings as some of the remix specific stuff such as routes, meta tags, `ErrorBoundry` and `CatchBoundry`, and the `formMethod` will [change in v2](https://remix.run/docs/en/main/pages/v2). Therefore, we decided to update to the new methods ([PR](https://github.com/DevelopingSpace/starchart/pull/614))

- **Improving DNS Records table responsiveness** 
The DNS Records table does not look good on small screens. This was to create a better layout for mobile screens. Further PRs would be created to tackle the view for tablet screens and other screen sizes. I basically ended up using Chakra UI's `Show` and `Hide` components to use a different layout on mobile ([PR](https://github.com/DevelopingSpace/starchart/pull/619))

- Small fixes for some test flakiness ([PR](https://github.com/DevelopingSpace/starchart/pull/620)), and adding a missing `*` in emails ([PR](https://github.com/DevelopingSpace/starchart/pull/556))
openGauss Comparison – Disk vs. MOT
Tags: opengauss
Published: 2023-04-19 02:31:01

The following table briefly compares the various features of the openGauss disk-based storage engine and the MOT storage engine.

Table 1 Comparison – Disk-based vs. MOT


Feature

openGauss

Disk Store

openGauss

MOT Engine

Intel x86 + Kunpeng ARM

Yes

Yes

SQL and Feature-set Coverage

100%

98%

Scale-up (Many-cores, NUMA)

Low Efficiency

High Efficiency

Throughput

High

Extremely High

Latency

Low

Extremely Low

Distributed (Cluster Mode)

Yes

Yes

Isolation Levels

READ COMMITTED
REPEATABLE READ
READ COMMITTED
REPEATABLE READ
Concurrency Control

Pessimistic + MVCC

Optimistic + MVCC

Data Capacity (Data + Index)

Unlimited

Limited to DRAM

Native Compilation

No

Yes

Query (by PREPARE command)
Stored Procedures (by PREPARE command)
Replication, Recovery

Yes

Yes

Replication Options

2 (sync, async)

3 (sync, async, group-commit)
openGauss JIT for Stored procedures
Tags: opengauss
Published: 2023-04-19 02:26:15

JIT for Stored Procedures (JIT SP) is supported by the openGauss MOT engine (starting from 5.0 version), and its goal is deliver even higher performance and lower latency.

JIT SP refers to code generation, compiling and execution of stored procedures (SP) by LLVM runtime code generation and execution library. JIT SP is available to SPs accessing MOT tables (only) and is completely transparent to users. SPs with Cross-Tx usage will be executed by standard PLSQL. Acceleration level depends on the SP logic complexity. For example, a real customer application achieved acceleration of 20%, 44%, 300% and 500% for different SPs, shaving microseconds to tens of milliseconds of the SP latency.

During the PREPARE phase of a query invoking an SP, or the first SP execution, the JIT module performs an attempt to translate the SP SQL into a C-based function and compile it in runtime (using LLVM). If successful, the consecutive SP invocations the MOT will execute a compiled function, leading to performance gains. In case of failure to produce a compiled function, the SP will be executed by standard PLSQL. Both scenarios are fully transparent to users.

You may refer to JIT Diagnostics for useful diagnostics information.
openGauss MOT Recovery Concepts
Tags: opengauss
Published: 2023-04-19 02:24:10

The MOT Recovery Module provides all the required functionality for recovering the MOT tables data. The main objective of the Recovery module is to restore the data and the MOT engine to a consistent state after a planned (maintenance for example) shut down or an unplanned (power failure for example) crash.

openGauss database recovery, which is also sometimes called a Cold Start, includes MOT tables and is performed automatically with the recovery of the rest of the database. The MOT Recovery Module is seamlessly and fully integrated into the openGauss recovery process.

MOT recovery has two main stages – Checkpoint Recovery and WAL Recovery (Redo Log).

MOT checkpoint recovery is performed before the envelope's WAL recovery takes place. This is done only at cold-start events (start server). It recovers the metadata first (schema) and then inserts all the rows from the current valid checkpoint, which is done in parallel by checkpoint_recovery_workers, each working on a different table. The indexes are created during the insert process.

When checkpointing a table, it is divided into 16 MB chunks, so that multiple recovery workers can recover the table in parallel. This is done in order to speed-up the checkpoint recovery, it is implemented as a multi-threaded procedure where each thread is responsible for recovering a different segment. There are no dependencies between different segments therefore there is no contention between the threads and there is no need to use locks when updating table or inserting new rows.

WAL records are recovered as part of the envelope's WAL recovery. openGauss envelope iterates through the XLOG and performs the necessary operation based on the xlog record type. In case of entry with record type MOT, the envelope forwards it to MOT RecoveryManager for handling. The xlog entry will be ignored by MOT recovery, if it is 'too old' – its LSN is older than the checkpoint's LSN (Log Sequence Number).

Performance is the key benefit of MOT, and low latency RTO in high availability scenarios is not an exception. With openGauss 5.0 release, MOT engine includes a Parallel Recovery mechanism to achieve low RTO as per openGauss specifications.

In an active-standby deployment, the standby server is always in a Recovery state for an automatic WAL recovery process.

The MOT recovery parameters are set in the mot.conf file explained in the MOT Recovery section.

Previous
openGauss Exception Handling
Tags: opengauss
Published: 2023-04-19 02:21:30

The persistence module handles exceptions by using the Postgres error reporting infrastructure (ereport). An error message is recorded in the system log for each error condition. In addition, the error is reported to the envelope using Postgres’s built-in error reporting infrastructure.

The following exceptions are reported by this module –

Table 1 Exception Handling


Exception Condition

Exception Code

Scenario

Resulting Outcome

WAL write failure

ERRCODE_FDW_ERROR

On any case the WAL write fails

Transaction terminates

File IO error: write, open and so on

ERRCODE_IO_ERROR

Checkpoint – Called on any file access error

FATAL – process exists

Out of Memory

ERRCODE_INSUFFICIENT_RESOURCES

Checkpoint – Local memory allocation failures

FATAL – process exists

Logic, DB errors

ERRCODE_INTERNAL_ERROR

Checkpoint: algorithm fails or failure to retrieve table data or indexes.

FATAL – process exists
openGauss Logging Design Overview
Tags: opengauss
Published: 2023-04-19 02:20:40

Write-Ahead Logging (WAL) is a standard method for ensuring data durability. WAL's central concept is that changes to data files (where tables and indexes reside) are only written after those changes have been logged, meaning after the log records that describe these changes have been flushed to permanent storage.

The MOT Engine uses the existing openGauss logging facilities, enabling it also to participate in the replication process.

Figure 1 Three Logging Options



The RedoLog component is used by both by backend threads that use the MOT Engine and by the WAL writer in order to persist their data. Checkpoints are performed using the Checkpoint Manager, which is triggered by the Postgres checkpointer.
GIT Commands Cheat Sheet
Tags: programming, devjournal, git, cheatsheet
Published: 2023-04-19 01:58:00

## The 77 Commands You Need To Know
 

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


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


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


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2m3q4k8ekwhgs8863v5.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/).
Best practices for collaborating with other developers as a self-taught software developer.
Published: 2023-04-19 01:07:41

Collaborating with other developers as a self-taught software developer requires strong communication, teamwork, and project management skills. It's important to establish clear expectations and timelines, and to be proactive in addressing challenges and conflicts. Also [java full stack developer course fee ](https://www.geekster.in/full-stack-web-development-program)
Participating in pair programming, code reviews, and other collaborative activities can also help you learn from other developers and build your skills.
Tips for acing technical interviews as a self-taught software developer.
Published: 2023-04-19 01:02:18

Acing technical interviews as a self-taught software developer requires a combination of technical expertise, communication skills, and problem-solving abilities. [full stack course](https://www.geekster.in/full-stack-web-development-program) prepares you for acing technical interviews

It's important to prepare thoroughly for interviews by researching the company and the position, practicing coding challenges and whiteboard problems, and honing your communication skills through mock interviews and role-playing exercises.
Services em Angular
Tags: angular, frontend, javascript, beginners
Published: 2023-04-19 00:51:23

Salve! Bem vindo a essa série de postagens sobre angular, elas serão destinadas aos iniciantes com propósito de simplificar o entendimento de partes desse framework, espero que goste!!

Linkedin: (<u>https://www.linkedin.com/in/caiohrff/</u>)

Uma classe de serviço no angular é responsavel por várias funções dentro de uma aplicação, vamos listar algumas delas bem como explicações com exemplos

## 1. Injeção de Dependência
Uma classe de serviço deverá ser capaz se ser injetada em outros componentes da aplicação, a mesma deverá ser passada ao contrutor desse componente e tendo assim acesso a todos os métodos desse serviço, abaixo temos um exemplo em prática de um componente injetando o serviço **DataService**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wad4tlnoj4dd8l58fhy.PNG)


## 2. Compartilhamento de dados
Como citado anteriomente, ao injetar o serviço, o componente agora terá acesso a todos os métodos. Os serviços são usados para compartilhar dados entre diferentes componentes, diretivas e outros serviços na aplicação.


## 3. Requisições HTTP
Uma classe de serviço deve ser capaz de fazer requisições HTTP e interagir com APIs RESTful ou outras fontes de dados.
Abaixo um exemplo de código de uma requisição a uma API de pokemons onde se obtem dados do mesmo.

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


## 4. Operações assíncronas
As operações assíncronas, como a obtenção de dados de um servidor ou a atualização de um banco de dados, são comuns em aplicações modernas. Uma classe de serviço pode ser usada para realizar essas operações de forma assíncrona e retornar os resultados para outros componentes ou serviços.


## 5. Gerenciamento de estado
Uma classe de serviço pode ser usada para gerenciar o estado de um componente ou da aplicação em geral, usando as técnicas de gerenciamento de estado do Angular, como o NgRx.


## 6. Regras de negócio
O serviço pode conter algumas regras que não queremos passar ao componente. Alguns exemplos são contas, manipulação de dados e algumas outra operações importantes.


## 7. Configuração e inicialização
Uma classe de serviço pode ser usada para configurar e inicializar a aplicação, definindo as configurações globais e iniciando os recursos necessários para a aplicação funcionar corretamente.


É indispensável o uso desse tipo de classe em uma aplicação simples ou complexa, por conter essas inúmeras responsabilidades são bem flexiveis para garantir o bom funcionamento dos componentes e do sistema, o limite será sua necessidade apenas!
Product Photography Studio in Houston, Texas
Tags: photography, photostudio
Published: 2023-04-19 00:42:27

We are a Houston-based product photography studio established in 2003 to provide fast, affordable, and high-quality [product photography services in Houston](https://welpix.com/product-photography-in-houston/). Our impressive client list includes well-known names such as Lululemon, David Jones, Sass n Bide, and Ecoya. Our goal is to make your products stand out in the fiercely competitive online sales environment by ensuring they look their very best, are powerful, and command attention.

We believe in building close and professional relationships with our clients based on trust, good values, and a helpful approach to succeed together. With our wealth of knowledge and experience, we can offer tailored packages to meet your specific needs, from still product photography to 360-degree product shots or videos, clothing on invisible mannequins, flat-lays, or even on live models. Whatever your requirements, we have you covered with exceptional services and creative concepts to make your products shine and drive sales.