teleren/devto huggingface dataset:
Installation on a Single Node
Tags: opengauss
Published: 2023-03-23 02:33:28

1.Create a user group dbgroup.

```
groupadd dbgroup
```

2.Create a common user omm in the dbgroup user group and set the password to Gauss_234.

```
useradd -g dbgroup omm
passwd Gauss_234
```

3.Log in to the host where the openGauss package is installed as user omm and decompress the openGauss package to the installation directory (for example, /opt/software/openGauss).

```
tar -jxf openGauss-x.x.x-openEuler-64bit.tar.bz2 -C /opt/software/openGauss
```

4.Assume that the decompressed package is stored in the /opt/software/openGauss directory. Go to the simpleInstall directory.

```
cd /opt/software/openGauss/simpleInstall
```

5.Run the install.sh script to install openGauss.

```
sh install.sh  -w xxxx 
```
In the preceding command, -w indicates the initial database password (specified by gs_initdb). This parameter is mandatory for security purposes.

6.After the installation is complete, check whether the process is normal by using ps and gs_ctl.

```
ps ux | grep gaussdb
gs_ctl query -D /opt/software/openGauss/data/single_node
```

Run the ps command to display information similar to the following:

```
omm      24209 11.9  1.0 1852000 355816 pts/0  Sl   01:54   0:33 /opt/software/openGauss/bin/gaussdb -D /opt/software/openGauss/single_node
omm      20377  0.0  0.0 119880  1216 pts/0    S+   15:37   0:00 grep --color=auto gaussdb
```

Run the gs_ctl command to display information similar to the following:

```
gs_ctl query ,datadir is /opt/software/openGauss/data/single_node
HA state:
    local_role                     : Normal
    static_connections             : 0
    db_state                       : Normal
    detail_information             : Normal

Senders info:
    No information

 Receiver info:
No information 

```
openGauss Introduction to the CopyManager Class
Tags: opengauss
Published: 2023-03-23 02:27:45

CopyManager is an API class provided by the JDBC driver in openGauss. It is used to import data to the openGauss database in batches.

Inheritance Relationship of CopyManager
The CopyManager class is in the org.opengauss.copy package and inherits the java.lang.Object class. The declaration of the class is as follows:

""
public class CopyManager
extends Object
Construction Method
public CopyManager(BaseConnection connection)

throws SQLException

Common Methods
Table 1 Common methods of CopyManager


Return Value

Method

Description

throws

CopyIn

copyIn(String sql)

-

SQLException

long

copyIn(String sql, InputStream from)

Uses COPY FROM STDIN to quickly import data to tables in a database from InputStream.

SQLException,IOException

long

copyIn(String sql, InputStream from, int bufferSize)

Uses COPY FROM STDIN to quickly import data to tables in a database from InputStream.

SQLException,IOException

long

copyIn(String sql, Reader from)

Uses COPY FROM STDIN to quickly import data to tables in a database from Reader.

SQLException,IOException

long

copyIn(String sql, Reader from, int bufferSize)

Uses COPY FROM STDIN to quickly import data to tables in a database from Reader.

SQLException,IOException

CopyOut

copyOut(String sql)

-

SQLException

long

copyOut(String sql, OutputStream to)

Sends the result set of COPY TO STDOUT from the database to the OutputStream class.

SQLException,IOException

long

copyOut(String sql, Writer to)

Sends the result set of COPY TO STDOUT from the database to the Writer class.

SQLException,IOException
Preparing the Software and Hardware Installation Environment
Tags: opengauss
Published: 2023-03-23 02:26:05

This section describes the preparations for installation. It is recommended that servers to be deployed on openGauss have the same software and hardware configurations.

**Hardware requirements**
Table 1 lists the minimum hardware requirements of the openGauss server. When planning the hardware configuration of a product, consider the data scale and expected database response speed. Plan hardware as required.
**Table 1 Hardware requirements**

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

**Software Requirements**
**Table 2 Software requirements**

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


**Software Dependency Requirements**
**Table 3 describes the openGauss software dependency requirements.**

You are advised to use the default installation packages of the dependent software in the listed OS installation CD-ROMs or sources. If the software does not exist, refer to the recommended versions of the software.

Table 3 Software dependency requirements

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2narqyv8u2c1mow0vtwh.png)
Obtaining and Verifying an Installation Package
Tags: opengauss
Published: 2023-03-23 02:22:52

**Procedure**
Download the installation package of the corresponding platform from the openGauss community.

Log in to the openGauss community and download the latest installation package of the corresponding platform. For individual developers or non-enterprise-level environments, download the simplified installation package (without installing components such as the OM).
Click Download.
Check the installation package.

Decompress the installation package and check whether the installation directory and files are complete. Run the following commands in the directory where the installation package is stored:

```
mkdir openGauss
tar -jxf openGauss-x.x.x-openEuler-64bit.tar.bz2 –C openGauss
ls -lb openGauss/
```

Run the ls command to display information similar to the following:

```
total 90296
drwx------ 3 root root     4096 Mar 31 21:18 bin
drwx------ 3 root root     4096 Mar 31 21:18 etc
drwx------ 3 root root     4096 Mar 31 21:18 include
drwx------ 4 root root     4096 Mar 31 21:18 jre
drwx------ 5 root root     4096 Mar 31 21:18 lib
drwx------ 5 root root     4096 Mar 31 21:18 share
drwx------ 2 root root     4096 Mar 31 21:18 simpleInstall
-rw------- 1 root root       32 Mar 31 21:18 version.cfg
```
openGauss Running the INSERT Statement to Insert Data
Tags: opengauss
Published: 2023-03-23 02:19:23

Run the INSERT statement to write data into the openGauss database in either of the following ways:

Use the client tool provided by the openGauss database to write data into openGauss.

For details, see Inserting Data to Tables.

Connect to the database using the JDBC or ODBC driver and run the INSERT statement to write data into the openGauss database.

For details, see Connecting to a Database.

You can add, modify, and delete database transactions for the openGauss database. INSERT is the simplest way to write data and applies to scenarios with small data volume and low concurrency.
openGauss Importing Data
Tags: opengauss
Published: 2023-03-23 02:15:42

You can use INSERT, COPY, or \copy (a gsql meta-command) to import data to the openGauss database. The methods have different characteristics. For details, see Table 1.

Table 1 Import modes


Mode

Characteristics

INSERT

Insert one or more rows of data, or insert data from a specified table.

COPY

Run the COPY FROM STDIN statement to write data into the openGauss database.

Service data does not need to be stored in files when it is written from other databases to the openGauss database through the CopyManager interface driven by JDBC.

\copy, a gsql meta-command

Different from the SQL COPY statement, the \copy command can read data from or write data into only local files on a gsql client.

NOTE:
\copy applies only to small-scale data import in good format. It does not preprocess invalid characters or provide error tolerance. Therefore, \copy cannot be used in scenarios where abnormal data exists. COPY is preferred for data import.

Running the INSERT Statement to Insert Data

Running the COPY FROM STDIN Statement to Import Data

Using a gsql Meta-Command to Import Data

Using gs_restore to Import Data

Updating Data in a Table

Deep Copy

ANALYZE Table

Doing VACUUM to a Table

Managing Concurrent Write Operations
Will AI eat jobs for the entry-level…🤔🤔
Published: 2023-03-23 02:03:37

AI has the potential to automate certain tasks and processes, which could lead to job displacement in some industries. However, it’s important to note that AI is not a one-size-fits-all solution and there are certain tasks and jobs that are not easily automated.

Entry-level jobs may be more vulnerable to automation because they often involve routine and repetitive tasks that can be easily performed by AI. However, there are also many entry-level jobs that require human interaction and creativity, such as customer service, marketing, and design, which are less likely to be replaced by AI.

It’s also important to remember that AI can create new job opportunities as well. As AI technology advances, new roles will emerge that require specialized skills in areas such as data science, machine learning, and AI development.

Overall, it’s difficult to predict the exact impact that AI will have on entry-level jobs, but it’s likely that there will be both job displacement and job creation as a result of AI’s increasing use in the workplace.
Zerando HackerRank ( 20 )
Published: 2023-03-23 02:01:14

E no vigésimo episódio desta serie que queima os miolos, vamos abordar um problema envolvendo o crescimento de uma árvore que cresce de uma forma um tanto diferente.

Neste problema temos uma árvore utópica que passa por 2 ciclos de crescimento a cada ano. Na primavera dobra de altura e no verão aumenta em 1 de altura (seja qual for o sistema de medição que você queira usar). O objetivo da função é gerar a altura da árvore após um certo número de ciclos de crescimento.

Se quisermos saber a altura da árvore após 5 ciclos de crescimento, calcularemos atribuindo este valor a variável **n** da seguinte forma:

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

Nossa entrada **n** é a variável que conterá o número de ciclos de crescimento. Contamos a altura da árvore a partir do ciclo de crescimento 0.

No ciclo 0, a altura inicial da árvore é 1.

No ciclo 1, a árvore dobra de altura, então sua altura agora é 2.

No ciclo 2, a árvore aumenta de altura em 1. A altura da árvore é 3.

No ciclo 3, a árvore dobra de altura novamente, então sua altura agora é 6.

No ciclo 4, a árvore aumenta de altura em 1. A altura da árvore agora é 7.

No ciclo final, a árvore dobra de altura, tornando a altura da árvore 14.

A função produzirá 14.

Começamos a ver um padrão ao ver como chegamos à nossa resposta. Começando no ciclo 1, se o número do ciclo for ímpar, a árvore dobra de altura. Se for par, a árvore só aumenta de altura em 1.

Para trabalhar isso na nossa função, atribuiremos isso a duas variáveis desta forma:

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

Nossa variável de ciclo nos ajudará a rastrear a altura da árvore em cada ciclo de crescimento conforme contamos de 1 a n. Conhecemos a altura inicial da árvore no ciclo 0, então queremos começar a medir a altura da árvore a partir do ciclo 1.

A variável de altura manterá a altura da árvore. A função produzirá esta variável. Começamos a contar por 1, pois é a altura inicial da árvore.

Em seguida, usamos um loop _while_ desta forma:

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

Queremos que nosso loop _while_ continue em loop até que nossa variável de ciclo não seja maior que nossa entrada n.

Em nosso exemplo acima, notamos que se o ciclo de crescimento for um número ímpar, a árvore dobrará de altura. Portanto, independentemente da altura atual da árvore, nós a multiplicamos por 2.

**OBS**: A equação dentro da instrução _if_, height *= 2;, é uma forma abreviada de escrever height = height * 2;.

Se o ciclo de crescimento for um número par, incrementamos a altura da árvore em 1.

Depois que o loop passa pela instrução _if_, incrementamos a variável do ciclo para podermos medir a altura da árvore no próximo ciclo de crescimento.

Depois que o loop é feito, retornamos a variável de altura.

Nossa função completa vai ficar desta forma:

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

E assim fechamos mais um desafio.
Journey into Python
Tags: python, webdev, beginners, programming
Published: 2023-03-23 01:36:16

Hi All,

I recently graduated from Flatiron Schools Software Engineering program. Thanks to hard work and a lot of studying I am now able to call myself a Full Stack Software Engineer. Before I began my journey I tried teaching myself Python but felt that I needed a more structured environment so I stopped. 

Now that I am done with the program I wanted to add more to my tech stack to help myself stand out more with employers. 

During my first couple labs and readings, I feel as though Python is easier to learn than I previously thought, I am really excited to continue my journey and learning the language that got me interested in programming to begin with.

I will continue to post as my journey continues, thank you all for reading!
Delete Your Dev Environment Regularly
Published: 2024-01-29 04:47:29

---
title: Delete Your Dev Environment Regularly
published: true
date: 2023-03-23 00:42:04 UTC
tags: 
canonical_url: https://alex.party/posts/2023-03-23-delete-your-dev-environment-regularly/
---

I have recently had the opportunity to muse about process and how we maintain a system. One of the things in particular that I have been thinking about the most is onboarding new people into your project.

In my ideal situation, a developer being able to have a local copy of code up and running should only be limited by the speed of their internet connection. The best way to ensure this is the case is to regularly delete your dev environment and clone a fresh copy down. This gives you a great opportunity to ask some questions:

- How long does it take for you to get set up?
- Is the documentation correct and easily accessible?
- Is it clear who can be contacted if there are questions?
- What is the process for contributing?
- How can someone report an issue?

A lot of these questions are typically answered in a README file, and many projects have multiple files to instruct for how to help out. I **highly** recommend that you go ahead, delete your dev setup today, and document the steps it takes to get it up and running. Future you, and future contributors will thank you. A lot. Seriously.
🔍 RxDB: The Reactive Database Solution for Angular Apps 🌐
Tags: webdev, javascript, rxdb, angular
Published: 2023-03-23 00:30:00

RxDB is a powerful library that provides an intuitive and flexible way to work with NoSQL databases in JavaScript. It allows developers to easily create and manage databases across different device with sync


## 📈  Use Cases for RxDB

1. **🌍 Progressive Web Apps (PWAs)**: PWAs are web applications that function like native apps and can be installed on a user's device. With RxDB, PWAs can offer offline capabilities, real-time data synchronization, and automatic data conflict resolution.

1. **💼 Enterprise Applications**: Enterprise applications often require large amounts of data to be stored and managed, as well as real-time data synchronization across multiple devices. RxDB offers a scalable and efficient solution for these complex requirements.

1. **📊 Analytics Dashboards**: Analytics dashboards require fast data retrieval and real-time updates to display data in a meaningful way. RxDB can provide the necessary data synchronization and querying capabilities for these applications.


RxDB documentation: https://rxdb.info/
Well ... Hello!
Tags: beginners, hello, devjournal
Published: 2023-03-23 00:23:13

> Well, I just came to say hello.

I'm a DevOps Engineer. I have almost 20 years of experience in the IT market. I'm a former network administrator. So the short story is: I pass from networking, developing, system administrator, back office engineer, It manager, and DevOps.
What do I see in my future? It could be great working in my terrain, with my child and wife and my four dogs running there.
Binance Server Location Test
Tags: binance, api, latency, go
Published: 2023-03-22 23:15:00

Was doing some tests with Binance API and since the server location it's not public, I tried to rent pin point it's location, here is what I found

## Requirements

- Same exact server configuration
- Same bandwith 
- Exact same code, used Go to test this out

## API api.binance.com

### Japan

- 2.08ms

### Singapour

- 1 ms

### Seol

- 1.5 ms

### Frankfurt

- 7.4 ms

## Conclusion
Well hard to tell but I would point out to Singapour, 
Binance do not disclose it's servers location,
They do not run replicas in other location as we can see Frankfurt have high ping so no European site
Day 719 : Case Study
Tags: hiphop, code, coding, lifelongdev
Published: 2023-03-22 22:23:14

_liner notes_:
- Professional : Had a pretty good day. Got up early to check out a talk prep session from a team member. It was a pretty interesting case study. I didn't really have a lot of experience with the subject so it was cool to hear. Basically spent the rest of the day working on the proof of concept demo for work and updating Web Components at the same time. I finished a little earlier so that I could go out to a meetup in town that I live stream at https://otech.events.

- Personal : Last night, I refactored some code in my side project to send certain data to the "database" that I'm using to store and pull info. Went through some tracks for the radio show and ended the night watching an episode of "Spy x Family". Called it an early night since I had to get up early in the morning.

![Smooth rounded stones all over the surface of Kunashir Island with a mountain and ocean in the distance at sunset.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4avxfd81nbpnqqfey3j.jpg)

So I made it to the venue. Made sure to get here early because there isn't a lot of available parking spaces. Picked up some food on the way. Probably won't get much done on my side project or go through tracks for the radio show. I'm doing this blog post while keeping an eye out for the event organizers so I can set up to live stream.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube sEQT_oERWR4 %}
Build counter
Tags: webdev, javascript, bash
Published: 2023-03-22 22:09:35

I asked myself, "how often did I build this project"?

Therefore, I'm using Vite (with SvelteKit), I searched for a build-in build-counter, but it seems, that there is nothing like that.  
Okay, I didn't search that long, because this is a well working solution:


```bash
#!/bin/bash

# read the .env file
source .env

# Increase the version number in .env
NEW=$(($PUBLIC_BUILD_COUNT+1))

# write the new version number to .env
sed -i~ '/^PUBLIC_BUILD_COUNT=/s/=.*/='$NEW'/' .env
```

So in my `package.json` I added this:

```json
"build": "bash increase.sh && vite build",
```

and the `.ENV` file will have a counter:

```bash
PUBLIC_BUILD_COUNT=39
PUBLIC_BUILD_DATE=22.03.2023-15:52
```

Oh wait, there is more:

```BASH
# Get the current date and time
DATE=$(date +'%d.%m.%Y-%H:%M')

# write the new date to .env
sed -i~ '/^PUBLIC_BUILD_DATE=/s/=.*/='$DATE'/' .env
```

I think, you got it  ;-)
The CodeNewbie Podcast, S23:E6: From Site Reliability Engineer to Principal Software Engineer
Published: 2023-03-22 21:36:00

In S23E6 of the CodeNewbie Podcast, Saron talks with [Alice Goldfuss](alicegoldfuss.com), Principal Software Engineer and Systems Programmer specializing in building resilient distributed systems at scale. Listen in at the link below!

{% embed https://www.codenewbie.org/podcast/coding-in-2020-and-beyond %}

[Alice Goldfuss](https://www.twitter.com/alicegoldfuss) is a systems punk with years of experience working on cutting-edge container platforms, as well as an international speaker and community builder. She also enjoys building modern infrastructure at-scale and writing fiction on the weekends.

- [Listen on Apple Podcasts](https://podcasts.apple.com/us/podcast/s23-e6-from-site-reliability-engineer-to-principal/id919219256?i=1000605314911)

- [Listen on Spotify](https://open.spotify.com/episode/4AnhbnsFAqbiXa91Gxo9J7?si=1a86a7db4f73493b)

Or, listen wherever you normally get your podcasts!

***

**Make sure to subscribe to the CodeNewbie podcast if you haven't yet!**

Happy coding! We hope you enjoy this season of the CodeNewbie Podcast 💜
custom cancel component call with react-toastify
Tags: react, webdev, javascript, programming
Published: 2023-03-22 21:35:44

By project behavioral need requirements are vary on situation demand, so that for custom toast component with additional functionality with the help of react-toastify...

File ==> Service.js
```js
import { apiCancelToast } from '../components/utils/ApiCancelBtn';
import { taskInProgress } from './memory';
import { toast } from 'react-toastify';

export class Service {

  constructor( ... ... ) {
	this. ... ...
  }

  async handleApiCall( callBack ) {

	... ...
	
    taskInProgress.status = true;

    try {
      toast.dismiss(); // 1st toast cancel
      const data = await callBack();
      if (data.id !== '') apiCancelToast(data.id);
      return data;
    } catch (e) {
	  ... ...
    }
	
  }
  
  ... ...
}
```


---


File ==> ApiCancelBtn.jsx [custom cancel component]
```js
import { taskInfoMap, taskInProgress } from '../../../memory';
import { taskTokenCalculation } from '../../../actions/dropdown';
import { useDispatch } from 'react-redux';
import { toast } from 'react-toastify';
import loading from '../../../assets/loading.gif';
import api from '../../../api';
import 'react-toastify/dist/ReactToastify.css';


function ApiCancelBtn({ taskId }) {
  
  const dispatch = useDispatch();
  
  const handleTaskCancel = async (taskId) => {

    toast.dismiss();  // 2nd toast cancel
    taskInProgress.status = false;
  
	try {
      if (taskId) {
        const { consumed } = await api.ai.cancelTask(taskId);
        if (consumed) dispatch(taskTokenCalculation(consumed);
        taskInfoMap.delete(taskId);
      }
    } catch (error) {
      // console.log(error);
    }
  };

  return (
    <div className="toast-custom-cancel-button">
      <img src={loading} alt="loading" />
      <div>
        <p> Processing your request... </p>
        <button onClick={() => handleTaskCancel(taskId)}> 
           Abort 
        </button>
      </div>
    </div>
  );

}


export function apiCancelToast(taskId) {
  toast.info('', {
    icon: false,
    pauseOnHover: true,
    toastId: taskId,
    autoClose: false,
    draggable: false,
    closeOnClick: false,
    closeButton: <ApiCancelBtn taskId={taskId} />,
  });
}
```

---


File ==> app.css
```css
.toast-custom-cancel-button {
  user-select: none;
  display: flex;
  gap: 10px;
  padding: 8px 0;
}

.toast-custom-cancel-button img {
  width: 20px;
  height: 20px;
}

.toast-custom-cancel-button p {
  font-size: 16px;
}

.toast-custom-cancel-button button {
  border-radius: 10px;
  padding: 10px 18px;
  outline: none;
  border: none;
  cursor: pointer;
  transition: 0.3s;
}

.toast-custom-cancel-button button:hover {
  background: #e86a54 !important;
  color: white;
}
```