teleren/devto huggingface dataset:
Zerando HackerRank ( 19 )
Published: 2023-03-22 03:08:04

E no décimo nono episodio desta serie que queima os miolos, vamos abordar um problema envolvendo uma contagem de vales que serão percorridos.

Neste Problema, um alpinista registra os locais que ele passa, marcando tanto as subidas quanto as descidas. Cada passo é representado por "u" para subida e "d" para descida.

Por exemplo, seu último registro foi de 8 passos com a seguinte sequência: dduuudd

Uma montanha é definida como uma sequência consecutiva de degraus acima do nível do mar, começando com um passo acima do nível do mar e um passo abaixo do nível do mar.

Um vale é definido como uma sequência consecutiva de degraus abaixo do nível do mar, começando com um passo abaixo do nível do mar e terminando com um passo subindo até o nível do mar.

Para resolver este problema nos criaremos a função "countingValleys", essa função recebe dois argumentos: steps (um número inteiro que representa o número de passos) e path (uma string que representa uma sequência de subidas e descidas, onde "U" significa subida e "D" significa descida). A função conta o número de "vales" percorridos pelo caminhante. Um vale é definido como uma sequência de passos onde o caminhante começa em um nível do mar, desce para um vale e depois sobe de volta para o nível do mar.

A função começa definindo três variáveis: traversedValleyCount, isInValley, e altitude. traversedValleyCount é inicializada como zero sendo usada para contar o número de vales percorridos. isInValley é inicializada como false sendo usada para determinar se o caminhante está atualmente em um vale ou não. Altitude é inicializada como zero sendo usada para manter o registro da altitude atual do caminhante.

Em seguida, a função usa um loop for para iterar através da sequência path. Para cada passo no caminho, a função verifica se o caminhante está subindo ou descendo. Se o caminhante está descendo (path[i] === "D"), a função decrementa a variável altitude. Se o caminhante está subindo (path[i] === "U"), a função incrementa a variável altitude. Em seguida, a função verifica se o caminhante está em um vale. Se o caminhante estiver abaixo do nível do mar (altitude < 0) e não estiver atualmente em um vale (isInValley === false), a função define isInValley como true. Se o caminhante já estiver em um vale (isInValley === true) e retornar ao nível do mar (altitude === 0), a função incrementa traversedValleyCount e redefine isInValley como false.

Por fim, a função retorna o número total de vales percorridos pelo caminhante, que foi contado pela variável traversedValleyCount.

Nossa função vai ficar desta forma:

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

E assim fechamos mais um desafio.
openGauss：gs_dump
Tags: opengauss
Published: 2023-03-22 03:07:56

gs_dump
Background Information
gs_dump is a tool used by openGauss to export database-related information. Users can customize the export of a database or its objects (schemas, tables, views, etc.), except for recycle bin objects. The database that supports export can be the default database postgres or a custom database.

The gs_dump utility is executed by the operating system user omm.

When the gs_dump tool is exporting data, other users can access the openGauss database (read or write).

The gs_dump tool supports exporting complete and consistent data. For example, start gs_dump at time T1 to export database A, then the exported data result will be the data state of database A at time T1, and the modification to database A after time T1 will not be exported.

Generated columns will not be dumped during gs_dump.

gs_dump supports exporting text format files compatible with v1 database.

gs_dump supports exporting database information to SQL script files or other archive files in plain text format.

SQL script file in plain text format: Contains the SQL statements required to restore the database to its saved state. Run the SQL script file through gsql to restore the database. Even on other hosts and other database products, as long as the SQL script file is slightly modified, it can also be used to rebuild the database.
Archive format file: contains the data required to restore the database to its saved state, which can be in tar format, directory archive format or custom archive format, see Table 1 for details. The export result must be used in conjunction with gs_restore to restore the database. When the gs_restore tool is imported, the system allows the user to select the content to be imported, and even sort the content waiting to be imported before importing.
7 types of Databases you must master to excel as a Devops Engineer
Tags: database, programming, devjournal, devops
Published: 2023-03-22 02:30:00

As a DevOps engineer, it is important to be familiar with a variety of database technologies in order to effectively manage and maintain the performance and reliability of a system. 

Some of the types of databases that you should be familiar with:

## 1. Relational databases:
These are the most common type of database, and are based on the relational model of data organization. 
Examples include MySQL, Oracle, and Microsoft SQL Server.


## 2. NoSQL databases:
These are non-relational databases that are designed to handle large amounts of unstructured data. 
Examples include MongoDB, Cassandra, and Apache HBase.

## 3. Graph databases:
These are specialized databases that are used to store and query graph data, such as networks or relationships between entities. 
Examples include Neo4j and Amazon Neptune.


## 4. Time series databases:
These are specialized databases that are optimized for storing and querying time-series data, such as metrics or sensor readings. 
Examples include InfluxDB and Prometheus.


## 5. In-memory databases:
These are databases that store data in memory, allowing for faster access and processing than traditional disk-based databases. 
Examples include Redis and Apache Ignite.


## 6. Object-oriented databases:
These are databases that are designed to store and manage objects, allowing for more flexible data modeling and easier integration with object-oriented programming languages. 
Examples include ObjectDB and Apache Sling.


## 7. NewSQL databases:
These are databases that combine the scalability of NoSQL databases with the consistency and transactional support of relational databases. 
Examples include CockroachDB and Google Cloud Spanner.



![Databases](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/arb8w3ezgftp2cbid5bx.png)


Comment below which databases you think DevOps engineers must learn.

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/).
Introducing Muerta Toolbox: The Ultimate Developer's Toolkit!
Tags: webdev, programming, react, javascript
Published: 2023-03-22 02:12:22

Hi everyone,

Are you tired of manually converting Excel files to JSON format? Are you looking for a tool that can help you work with multiple worksheets tab and customize JSON? Look no further than [Muerta Toolbox](https://muerta-toolbox.vercel.app/)!

[Muerta Toolbox](https://muerta-toolbox.vercel.app/) is an online website that offers a wide range of tools for developers. With Muerta Toolbox, you can easily convert Excel files to JSON format, work with multiple worksheets tab, and customize JSON according to your needs. Plus, you can download your JSON files with just a few clicks.


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

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

But that's not all! Muerta Toolbox also includes other useful features such as base64 encoding and decoding, text diff checker, and generate curl. Whether you're a seasoned developer or just starting out, Muerta Toolbox has everything you need to streamline your workflow and boost your productivity.


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

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

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

And the best part? Muerta Toolbox is constantly being updated and improved, with new features and improvements added every day. So why wait? Head over to Muerta Toolbox today and see how it can transform the way you work!

We hope you find this introduction helpful, and we can't wait to hear your feedback on Muerta Toolbox. If you have any questions or comments, please feel free to reach out to us.
[Muerta-Toolbox-report-issues](https://github.com/dereknguyen269/Muerta-Toolbox-report-issues/issues)
Thank you!
Creating a Database in openGauss
Tags: opengauss
Published: 2023-03-22 02:10:21

After the database is installed, a database named postgres is generated by default. You need to create your own database.

**Syntax**

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




**Parameter Description**

- database_name

Specifies the name of the database to be created, modified, or deleted.

- new_name

Specifies the new name of a database.

**Examples**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dm0wiuae1gfh10g2onbv.png)
ส่อง Dockerfile for Go
Tags: go, docker
Published: 2023-03-22 01:59:34

พอดีได้เห็น tweet หนึ่งมีคนเอา Dockerfile สำหรับ build Go แบบ basic สุดๆมาวาง แล้วให้คนใน twitter ช่วยๆกันทำให้มันดูดีขึ้น จาก tweet นี้ [tweet](https://twitter.com/sidpalas/status/1637839918448754688?s=20) เลยได้เห็นการใช้ [tini](https://github.com/krallin/tini) แล้วก็สงสัยว่า ทำไมเราถึงจำเป็นต้องใช้มันด้วยนะ

พอได้ลองไปอ่านๆดูก็พบว่า มันดูมีอะไรพอสมควร เพราะตั้งแต่ docker version 1.13 เป็นต้นมา เวลาที่เราสั่งคำสั่ง `docker run` เราสามารถเพิ่ม flag `--init` เข้าไป เพื่อสั่งให้มันใช้เจ้า tini นี้ด้วยได้

แต่เข้าใจว่า ถ้าเราจะเขียน Dockerfile เราอาจจะยังต้องตั้งใจเขียนมันขึ้นมาเพื่อให้มันใช้ tini อยู่ดีครับ

ทีนี้ tini มันมีประโยชน์อย่างไร เขาอธิบายว่า ปกติแล้ว เมื่อเรากำหนดคำสั่ง ENDPOINT เข้าไปใน Dockerfile มันจะถูกกำหนดค่า PID ให้เป็นเลข 1 ซึ่งเราอาจจะไม่รู้ว่า ที่จริงแล้ว ความรับผิดชอบของ PID เลข 1 นั้น มันมีความหมายอื่น นั่นก็คือ มันมีหน้าที่ที่จะต้องคอยเก็บพวก Zombie process และสิ่งนี้ tini จะเข้ามาช่วยจัดการให้ และยังรับประกันว่า พวก signal ต่่างๆที่ถูกส่งเข้ามา จะยังถูก forward มาให้เราได้เหมือนเดิม

ส่วนรายละเอียดเกี่ยวกับ Zombie process และ tini ผมแนะนำให้ลองเข้าไปอ่านในหน้า github ของ tini เอง ก็จะมีข้อมูลที่มากกว่านี้ให้อ่านนะครับ
Software Architecture of openGauss
Published: 2023-03-22 01:08:03

Software Architecture
openGauss is a standalone system that supports one primary and up to eight standby servers.

Service data is stored on a single physical node, and data access tasks are pushed to service nodes and then executed. The high concurrency of servers enables quick response to data processing. In addition, data can be copied to the standby server through log replication, ensuring high reliability and scalability.

Software Architecture
Figure 1 shows the logical components of openGauss.

Figure 1 openGauss logical architecture

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

Table 1 Architecture description



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j7hf6qpfgvao15nwtlqk.png)
A Quick Guide to Meaningful Commits!
Tags: beginners, programming, tutorial, discuss
Published: 2023-03-22 01:06:50

**What are commits?**

A commit is a command from [Git](https://git-scm.com/) that allows a user to save snippets of code in the order they were added/changed. Think of commits as snapshots of your code in a timeline. Commits allow a user to be able to go back to each addition/change done to the local repository and control the version afterwards. 

**Why are commit messages important?**

Commit messages are important because it lets the current coder know what was changed during that point in the timeline. 

**Be specific with your commits!**

 Commit messages should be specific! You should be able to describe what was added/changed in your commit. 

Example of a bad commit:
`git commit -m "pushing fixes"`
- Vague
- Does not help the user or the team figure out what was fixed

Example of a good commit:
`git commit -m "addition function was missing a variable"`
- More descriptive
- Identified the error and describes where it was

You can be as descriptive as you want but make sure to keep your commits short. So long as you are able to summarize and understand what was changed or added.

If you got this far thank you!
Resolvendo NPM warning config global `---global`, `---local` are deprecated.
Tags: tutorial, terminal, beginners
Published: 2023-03-22 00:46:12

Faaaaaaala turma!!👋

Esse é apenas o meu primeiro post, fiquei muito em dúvida do que escrever aqui, maaaaas... 

Até que olhei pro meu terminal e me deparei com esse **_warning!!_**

![imagem do npm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5a3whkv0axstb5k3xcx9.png)

Logo pensei, hmmm... isso pode gerar um conteúdo, então bora resolver essa parada!!

Em algum momento nas instalações da vida, você deve ter utilizado `npm install -g` e não `npm install --location=global`, e a partir disso começou a aparecer essa mensagem no seu terminal. Pra gente resolver isso é bem simples, precisaremos ir até a pasta **_\nodejs_**.

![imagem referente ao windows explorer na pasta do nodejs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2oy1q9mz5lj5pt6a67w.png)

Abra esses arquivos que estão selecionados na imagem acima.  No meu caso, irei abri-los no VS Code.

![imagem referente aos arquivos selecionados](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/09xyhj6mevsv24syh1oh.png)

Agora basta dar **_CTRL+F_**, pesquisar por **_prefix -g_** e substituí-lo por **_prefix --location=global_**, logo após você salvar o arquivo irá aparecer esse pop-up no canto inferior direito com uma mensagem de erro!!😢

![imagem referente ao pop-up](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/row5ku656cwwye1tu1v4.png)

Mas calma lá meu(minha) jovem, o VS Code não tem a permissão para fazer a mudança, então ele vai pedir para tentar novamente como administrador.

![imagem referente ao botao](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mw7bos682azqjpu325nb.png)

Basta permitir a alteração nos 4 arquivos, reiniciar seu terminal (por garantia) e rodar o npm no seu projeto eeeee **_voilà_**, sem warning!!🐱‍👤 

É isso pessoal... espero que esse post tenha ajudado e até a próxima!!😎
Best morning routine hacks to switch on to for a more productive day 🌄.
Published: 2023-03-22 00:25:40

1.Get a good night sleep.🛌
2. Don't hit the snooze button ⏰get up at once
3.drink a glass of water.🥛
4.step up with a cup of tea or coffee ☕
5.go for a quick workout 🏃🏃🏽‍♀️
6.prepare a healthy breakfast 🥗
7. listen to a soul uplifting song while you do this 🎶
Note: After this, prioritize your schedule and task📅
for the day serially according to their importance.

Make sure you execute🎯 them bit by bit, having in mind that doing little, is better than doing nothing.
instead of procrastinating set your mind and get them to work you'll see how much more you can achieve.[](https://bento.me/pmg)
A Guide to Combining React and Google Model Viewer
Tags: javascript, modelviewer, react, beginners
Published: 2023-03-22 00:15:21

Have you ever wondered how to embed 3D models into a web page or website? In this article, we will explore the simple steps for integrating Google Model Viewer into a React app.

Model Viewer is an open source web component created by Google and managed through GitHub. Its purpose is to make it easy to display 3D content on the web by using just a few lines of HTML code.

To integrate Model Viewer into your React app, you will need to install the NPM package by running the following command:


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

An alternative method (recommended method) is to add the following link in the body of your index.html file, located in the public directory, as shown in the code snippet below:


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

Next, you will need to use the <model-viewer> component in any React component of your choice. In this example, we will add it to our App.js file. Before doing so, you will need to import your 3D model in either glb or gltf format, as only these formats are compatible with Google Model Viewer.


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

In the code above, we imported our glb file and referenced it in the src attribute of the <model-viewer> tag. We also added additional attributes, such as ar, which enables an augmented reality experience, and set the ar-modes attribute.

The webxr mode allows the use of AR in browsers that support the WebXR API, such as Chrome for Android or Safari for iOS.

The quick-look mode enables AR on iOS devices using the Quick Look feature, which allows users to view AR content directly from the Safari browser without needing to download a separate app.

The scene-viewer mode enables AR in the Google Scene Viewer app, which is available on Android devices.

By including all three modes in the ar-modes attribute, the <model-viewer> element becomes compatible with various AR platforms and devices, providing a more seamless experience for users.

We added camera controls that allow users to interact with and control the camera view of the 3D model displayed in the <model-viewer> element. This feature enhances the user experience by allowing them to examine the 3D model more closely and from different angles, making the model feel more like a real object that the user can manipulate and explore.

Finally, the xr-environment is an attribute that can be added to the <model-viewer> element in order to specify the environment in which the 3D model will be displayed.

These steps cover the basic process of integrating Google Model Viewer with React. By following these steps, you can embed 3D models into your React app and allow users to interact with them in a variety of ways, including augmented reality.
🌌 Fixing Kubernetes OpenLens Blank Screen Issue
Tags: devops
Published: 2023-04-22 19:28:28

---
title: 🌌 Fixing Kubernetes OpenLens Blank Screen Issue
published: true
date: 2023-03-22 00:00:00 UTC
tags: DevOps
canonical_url: https://bstefanski.com/openlens-blank-screen-fix-kubectl
---

I recently attempted to set up OpenLens to work with `kubectl`, but all I encountered was a blank white screen. Despite having everything configured correctly and being able to list all the clusters, the connection seemed established. To verify if you have a similar connection, you can try running this command:

```

$ kubectl get pods

```

The expected output of this command should display a list of your available pods. If the connection is established correctly, you'll see something like:

```

NAME READY STATUS RESTARTS AGE 

your-pod-name-11/1 Running 01d 

your-pod-name-21/1 Running 01d 

```

I soon discovered that OpenLens is built using Electron and React, which led me to a simple solution. **By pressing `cmd + R` to refresh the view, I managed to fix the issue, and the clusters view appeared as expected**. This quick refresh can be a helpful trick if you ever find yourself facing the same problem when working with OpenLens and kubectl.
😎 Unlocking Next.js Benefits: No SSR? No Problem!
Tags: nextjsperformancedev
Published: 2023-04-22 19:28:25

---
title: 😎 Unlocking Next.js Benefits: No SSR? No Problem!
published: true
date: 2023-03-22 00:00:00 UTC
tags: NextJSPerformanceDev
canonical_url: https://bstefanski.com/nextjs-advantages-without-ssr
---

Next.js is a powerful framework built on top of React.js, offering numerous advantages over using React.js on its own.  
<!-- -->A common misconception in the industry is that if your application doesn't require Server Side Rendering (SSR), then you shouldn't use Next.js, which is simply not true. Here are some of the beneficial features Next.js offers that can enhance app development:

  

- **Granular Error Handling** at the component level in the app directory
- **SSR (Server Side Rendering)** enables moving some heavy logic to the server without involving the backend team, speeding up development. SSR and Static Site Generation (SSG) also prevent Layout Shifts and Loading Screens.
- **SSG (Static Site Generation)** improves page transitions even when SEO isn't a crucial factor. You can easily switch between SSG and client-side pages with minimal code changes.
- **Code Splitting** is supported out of the box, with page-based splitting as the default behavior, unlike bare React. This can be achieved using `next/dynamic`.
- Next.js provides a **production-ready, battle-tested Webpack config** that is open for extensions, ensuring optimal performance and short build times.
- The `next/image` component, co-created with Google developers, **optimizes image loading and display** , following best practices.
- The `next/font` module **prevents Layout Shifts** and enhances developer experience by handling 95% of the work, while ensuring top-notch performance.
- **API Routes** allow moving heavy logic to the server and work best on AWS Lambda, acting as simple, small, independent Node servers.
- **Opinionated routing** creates a consistent app architecture, making it easier to understand across millions of apps.
- **Prefetching links** speeds up subsequent requests by prefetching links when hovered or visible in the viewport, which is difficult to achieve in bare React.
- **Layouts** contribute to a consistent and clean architecture in the app directory, which is hard to achieve in bare React without complex abstraction.
- Most common **polyfills** are included by default, ensuring compatibility across various browsers.
- **Advanced i18n support** allows for flexible i18n features without altering routing structures.

In conclusion, Next.js offers numerous performance-related features and accelerates development without sacrificing flexibility. Contrary to requiring more code or configuration, Next.js simplifies development. Configuring React (especially Webpack) to match Next.js's capabilities is no easy task, and every library in the React ecosystem is compatible with Next.js.
Typing x Testing
Published: 2023-03-21 22:51:32

I'm curious about the "strong typing _or_ strong testing" idea.

In Dev/DevOps teams people think the overall process is "Speed *versus* Quality", but in fact it's not that simple:

- you can have neither: a slow test/CICD process that also is unreliable, flaky
- you can have fast-reliable tests... for a subset of your code (e.g. small scope)
- low quality CD will deploy the project but sometimes leave it in a broken state (= :fire:) 
- worse: CD deploys project, it's broken, and it's hard to tell (not trustworthy)
- you can have *both* speed *and* quality

## Easy Mode

The last bit is the "DevOps Dream" aka "Startup Easy Mode". The test/CICD process is both fast (low latency), and high quality (finds errors, is trusted by developers and the business).
If you can get to Easy Mode it means the Dev process is *so much* easier. Deploy to production, find bug, fix bug then redeploy to production. The business and the Devs are thrilled.
Otherwise when a bug appears in production it requires rolling back the change, which can be a pain. In Easy Mode you just fix the bug and move on.

I think "strong typing or strong testing" is related to "Speed or Quality".
What do you think?

https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/