teleren/devto huggingface dataset:
> Remove formatting for test data
Tags: notetoself, html
Published: 2023-09-24 13:05:43

Use `<pre>` tags during development to print data with unformatted text. It will:

- display a fixed-width font, and
- preserve spaces and line breaks.

FYI, most browsers use these styles to format `<pre>` tags:


```
  display: block;
  font-family: monospace;
  white-space: pre;
  margin-top: 1em;
  margin-bottom: 1em;
```
Dominando o Poder dos Testes Unitários em Java com JUnit: Construa Código Sólido e Confiável! 🚀🧪🔨
Tags: java, beginners, junit, braziliandevs
Published: 2023-09-24 14:06:12

**O que são Testes Unitários em Java com JUnit?** 🧪

Os Testes Unitários em Java com JUnit são uma maneira de verificar se partes pequenas e específicas do seu código estão funcionando corretamente. É como verificar se cada peça de um quebra-cabeça se encaixa perfeitamente antes de montar o quadro completo.

**Por que Testes Unitários são importantes?** 🤔

Testes Unitários ajudam a encontrar e corrigir bugs no seu código mais cedo, o que economiza tempo e esforço no longo prazo. Eles também tornam seu código mais confiável, porque você pode ter certeza de que as partes individuais funcionam conforme o esperado.

**Como criar Testes Unitários com JUnit?** 🛠️

Primeiro, você precisa adicionar a biblioteca JUnit ao seu projeto Java. Você pode fazer isso configurando o JUnit no seu ambiente de desenvolvimento, como o Eclipse ou o IntelliJ IDEA, ou adicionando as dependências do JUnit ao seu arquivo de construção (como o pom.xml em projetos Maven).

No meu caso vou utilizar o maven:

```
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.13.2</version>
</dependency>
```

_Não esqueça de deixar seu like_ ❤️

Aqui está um exemplo simples de classe Java que queremos testar:


![Exemplo teste 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wwvux7sfn1wevjdsq9p6.png)

Agora, vamos criar um teste unitário com JUnit para a classe Calculadora.


![Exemplo teste 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/futpp43ju3lrn46yzu1u.png)

Neste exemplo, criamos um método testSomar que verifica se o método somar da classe Calculadora retorna o resultado esperado. Usamos assertEquals para comparar o resultado real com o valor esperado.

**Como executar os Testes Unitários?** ▶️

Na maioria dos ambientes de desenvolvimento, você pode executar os testes unitários clicando com o botão direito na classe de teste (como CalculadoraTest) e selecionando "Executar teste" ou uma opção semelhante.

**Resultado dos Testes Unitários?** ✅❌

Quando os testes são executados, você verá se eles passaram (✅) ou falharam (❌). Se um teste falhar, isso significa que algo no seu código não está funcionando como deveria, e você precisa corrigi-lo antes de continuar.

**Conclusão** 🎉

Testes Unitários com JUnit são uma ferramenta poderosa para garantir a qualidade do seu código Java. Eles ajudam a encontrar e corrigir problemas de forma eficiente, tornando seu código mais confiável. Comece pequeno, crie testes para cada parte do seu código e veja sua confiança no código aumentar!

_Agora podemos testar nossas expressões lambdas_
[Clique aqui para aprender sobre lambda](https://dev.to/antoniorws/simplificando-expressoes-lambdas-em-java-4nla)🚀

Repositório com a trilha de java: https://github.com/antoniorws/basic-java

Linkedin: https://www.linkedin.com/in/antonio-rodrigo-wanderley-serra/
GitHub: https://github.com/antoniorws
Running a PHP script or Worker as a Systemd Service
Tags: linux, php, worker
Published: 2023-09-24 14:03:27

[Systemd](https://en.wikipedia.org/wiki/Systemd) is one of the best ways to run a PHP script as a service or to configure a worker. I have used it to configure multiple workers on the same server and it works seamlessly. You do not need to install, supervisor anymore to run your workers. 

In this article I have covered the step by step process to configure a service on Linux. 

**Step 1:** Choose a name for your service. Choose the name in relation to the application or the use case so that you remember it in the future. 

**Step 2:** Create a service file with the chosen name. 

```
sudo touch /etc/systemd/system/worker-name-service.service
```
**Step 3:** Edit the file and add the service information to it and save the file. 

```
sudo nano /etc/systemd/system/worker-name-service.service
```

```
[Unit]
Description=My App Notification Worker
After=network.target
 
[Service]
User=root
Group=www-data
Restart=always
WorkingDirectory=/var/www/html/path-to-worker
ExecStart=/usr/bin/php artisan queue:work
 
[Install]
WantedBy=multi-user.target
```

**Step 4:** Reload the systemd daemon so that the new service is recognised. 
```
sudo systemctl daemon-reload
```

**Step 5:** Enable the new service. 
```
sudo systemctl enable worker-name-service
```

**Step 6:** Start the new service. 
```
sudo systemctl start worker-name-service
```

**Step 7:** Check the status of the service to ensure it is up and running. 
```
sudo systemctl status worker-name-service
```

If you see the green light then you have successfully configured your worker or php script as a systemd service.

_Originally posted on my [personal blog](https://www.krish.website/blog/post/running-a-php-script-or-worker-as-a-systemd-service)._
Never limit your tech stack
Tags: programming, javascript, career, learning
Published: 2023-09-24 13:51:03

To grow by leaps and bounds, you shouldn't limit yourself to a specific tech stack.

You need to choose one skill, master it, secure your job around it, and then start learning all relevant fields gradually.

Let's say you are currently working as a JavaScript developer, mainly on frontend projects, in your daily job. In your free time, you should be learning Node.js and building backend projects, and if your project needs a backend engineer, you can fill this role.

Similarly, if you have backend engineering experience, you can learn about data stacks, ML, and DevOps.

As you gradually start mastering hard tech skills along with soft ones, it will be easier for you to reach higher positions such as CTO, VP of Engineering, etc. because you will be a person who can get things done in any stack.

The people in higher tech positions are generalists rather than specialists in just one tech stack.

On the other hand, there are benefits to being a specialist in just one field, but those can't outperform the other one. It's often a personal choice and can offer amazing opportunities such as offering consultancies.

Thanks for reading.

If you want to excel in your career and learn building scalable apps and architectures, you can subscribe to my newsletter at https://lnkd.in/d7Du5QmS
find the shortest substring in a string c#
Published: 2023-09-24 12:17:12

```
static void Main(string[] args)
        {
            Program program = new Program();
            int totalStudent = 3;
            int totalSubject = 5;
            int[,] marks = {{75,76,65,87,87},
                            {78,76,68,56,89},
                            {67,87,78,77,65}};

            string firstString = "this is a test string";
            string secondString = "tist";

            program.Shortest(firstString, secondString);

        }

        public void Shortest(string input1, string input2)
        {
            int minLength = input1.Length;
            string smallestSubstring = string.Empty;

            for (int i = 0; i < input1.Length; i++)
            {
                for(int j = i; j < input1.Length; j++)
                {
                    string substr = input1.Substring(i, j - i + 1);
                    if (ContainsAllCharacters(substr, input2))
                    {
                        int currentLength = substr.Length;
                        if (currentLength < minLength)
                        {
                            minLength = currentLength;
                            smallestSubstring = substr;
                        }
                    }
                }
            }
            Console.WriteLine(smallestSubstring);

        }

        private bool ContainsAllCharacters(string input1, string input2) 
        {
            int[] count = new int[256];

            foreach (char ch in input2)
                count[ch]++;

            foreach (char ch in input1)
            {
                if (count[ch] > 0)
                    count[ch]--;
            }

            foreach (int val in count)
            {
                if (val > 0)
                    return false;
            }

            return true;
        }
```
PostgreSQL 16 Installation on Ubuntu 22.04
Tags: database, postgres, sql
Published: 2023-09-24 11:43:55

**Overview**
PostgreSQL 16 is the latest major release of the popular open source relational database. It comes with many new features and improvements such as enhanced monitoring capabilities, improved performance, logical replication enhancements, additional server configurations, and security advancements.

In this tutorial, we will cover how to install PostgreSQL 16 on Ubuntu 22.04 We will also look at some basic configuration to allow remote connections, enable password authentication, and get started with creating users, databases etc.

**Prerequisites**
Ubuntu 22.04
Root privileges or sudo access
use `sudo su` to get into root instead of ubuntu(default user)

### Step 1 - Add PostgreSQL Repository
First, update the package index and install required packages:
```
sudo apt update
sudo apt install gnupg2 wget nano
```

Add the PostgreSQL 16 repository:

```
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
```

Import the repository signing key:
```
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
```

Update the package list:
```
sudo apt update
```

### Step 2 - Install PostgreSQL 16
Install PostgreSQL 16 and contrib modules:

```
sudo apt install postgresql-16 postgresql-contrib-16
```

Start and enable PostgreSQL service:
```
sudo systemctl start postgresql
sudo systemctl enable postgresql
```

Check the version and ensure it's Postgresql 16:
`psql --version`
You should get something like 
> psql (PostgreSQL) 16.0 (Ubuntu 16.0-1.pgdg22.04+1)


### Step 3 - Configure PostgreSQL 16
Edit postgresql.conf to allow remote connections by changing listen_addresses to *:
```
sudo nano /etc/postgresql/16/main/postgresql.conf
listen_addresses = '*'
```


Configure PostgreSQL to use md5 password authentication by editing pg_hba.conf , this is important if you wish to connect remotely e.g. via [PGADMIN](https://pgadmin.org/) :
```
sudo sed -i '/^host/s/ident/md5/' /etc/postgresql/16/main/pg_hba.conf
sudo sed -i '/^local/s/peer/trust/' /etc/postgresql/16/main/pg_hba.conf
echo "host all all 0.0.0.0/0 md5" | sudo tee -a /etc/postgresql/16/main/pg_hba.conf
```

Restart PostgreSQL for changes to take effect:
```
sudo systemctl restart postgresql
```

Allow PostgreSQL port through the firewall:
```
sudo ufw allow 5432/tcp
```

### Step 4 - Connect to PostgreSQL
Connect as the postgres user:
```
sudo -u postgres psql
```

Set a password for postgres user:
```
ALTER USER postgres PASSWORD 'VeryStronGPassWord@1137';
```

**Conclusion**
We have successfully installed PostgreSQL 16 on Ubuntu, performed some basic configuration like enabling remote connections, set up password authentication, created a database and users. PostgreSQL is now ready to be used for development or production workloads.
Junior React JS Developer Seeking Opportunities to Grow and Contribute
Tags: react, javascript, webdev
Published: 2023-09-24 11:36:17

Hello,

I hope you're doing well. I'm Mohamad, a junior developer eager to enhance my skills in React JS. I have hands-on experience with React JS, HTML, CSS, JavaScript, and some TypeScript and Next.js knowledge. I'm also proficient in Git and GitHub and have contributed to open-source projects.

If you have any specific project needs or opportunities, please feel free to reach out.
Browse Personalized Leather Bracelets - Unique Gifts Collection | Mazezy
Published: 2023-09-24 11:31:46

https://mazezy.com/c/jewelry-accessories/bracelets/leather+bracelets Elevate Your Style with Mazezy's Leather Bracelets✔️ Mazezy's Leather Bracelets are more than accessories; they're expressions of love and style✔️ Crafted with care, they cater to various occasions and relationships, including Dad, Husband✔️, Boyfriend, Birthday, and Christmas Bracelets✔️ Their To My Dad Message Card Bracelet combines sentiment with style✔️✔️✔️
+1 (601) 602-7601
sales@mazezy.com
200 Foxgate Avenue, Unit 11C, Hattiesburg, MS 39402, United States
https://ameblo.jp/leatherbraceletmazezy
https://band.us/band/92479653
https://boosty.to/leatherbraceletmazezy
https://comicvine.gamespot.com/profile/leatherbracelet/blog
Apache AGE:Code Style Guide
Tags: apacheag, coding, postgres, database
Published: 2023-09-24 11:24:15

In this blog we will look at the coding style guide to make a pull request in Apache AGE repository. In our previous blog we explored that how we can create a PR in apache AGE repository. If you want to know about doing a [Pull request to Apache AGE](https://dev.to/muhammadzeeshan03/creating-a-pull-request-to-any-open-source-project-like-apache-age-a34) you can checkout this blog first.

## Indentation

In AGE's official coding style guide they mentioned about using 4 spaces per indentation level instead of using a tab for indentation. Use the same method to indent code even working with switch statement. 

```
switch (suffix) {
    case 'G':
    case 'g':
        mem <<= 30;
        break;
    case 'M':
    case 'm':
        mem <<= 20;
        break;
    case 'K':
    case 'k':
        mem <<= 10;
        // fall through
    default:
        break;
}
```
In the code above we have used 4 spaces instead of a single tab.

## Breaking long lines and Strings
Line length is 79 columns. So, if the length of code line exceeds 79 columns, move the string to next line. And if there is a case in which the String is exceeding 79 columns we don't need to break the string.

## Placing Braces and Spaces

All opening or closing braces are to be placed on a single line solely. Example
``` 
void function(int x)
{
    body of function
}

if(x is true)
{
do task a
}
else if(y is true)
{
do task b
}
else
{
do task c
}
```
The main thing to keep in mind in the above code is braces, each opening or closing brace is placed on a single line and no code on that line.
**Note**
If all the bodies of if/else statements contains a single line, omit braces. Example
```
if(x is true)
    do task a
if(y is true)
    do task b
else
    do task c
```

## Naming
Use the underscore name convention for all variables, functions, structs, and enums.

## Commenting

For multi-line comments, use C style multi-line commments. And for single line comments use the style format as shown below.

```
/*
 * This function
 * does x
 */
void f(void)
{
    // This is to check...
    if (y is true)
        we do b
/*
 * We need to do this here
 * because of ...
 */
for (;;)

}
```
## NewLines
For newlines, only \n is allowed, not \r\n and \r.

## Note

For a list of all the coding style guidelines, visit the [clang-format.5](https://github.com/apache/age/blob/master/clang-format.5) in the official AGE git repository.

## Reference

[https://age.apache.org/contribution/guide/#code-style-guilde](https://age.apache.org/contribution/guide/#code-style-guilde)
Identifying the Best ERP Software Company
Tags: erpsoftwarecompany, erp, odooerpp
Published: 2023-09-24 11:23:29


An [ERP software company](https://www.seeroo.com/services/odoo-erp-software-company/) is a partner that can transform the way your business functions. These businesses focus on creating and implementing Enterprise Resource Planning (ERP) systems to assist businesses in effectively managing their processes. When choosing the finest ERP software company for your organization, keep the following essential things in mind:

Every business is unique, and the best ERP software company understands this. They should offer the flexibility to customize the ERP system to align with your specific processes and workflows, ensuring a tailored fit.

Successful implementation is essential for the ERP software to work seamlessly within your organization. The best ERP software company will have a team of experts who can guide you through the implementation process and provide necessary training.

Your business may grow, and your requirements will evolve. The best ERP software company will offer scalable solutions that can adapt to your changing needs, allowing your business to thrive.

A user-friendly ERP system is essential for smooth adoption by your team. The best [ERP software company](https://www.seeroo.com/services/odoo-erp-software-company/) designs intuitive interfaces that simplify complex processes, making it easier for your employees to use the system effectively.

Ongoing support and maintenance are crucial for the long-term success of your ERP system. Ensure the ERP software provider offers reliable customer support and regular updates to keep your software running smoothly.

Look for customer reviews and references to gauge the satisfaction of existing clients. The best ERP software company will have a track record of successful implementations and satisfied customers. And also Consider your budget when choosing an ERP software company.

Selecting the best [ERP software company](https://www.seeroo.com/services/odoo-erp-software-company/) for your business is a crucial decision. It's an investment in the future of your business. By carefully assessing your business's unique needs and considering the factors mentioned above, you can find the ERP software company that will help your business grow.
#13 All Buttons In Android |Toggle Button Android Tutorials |#SoftwareTechIT
Tags: tutorial, android, programming, beginners
Published: 2023-09-24 10:57:00

{% embed https://www.youtube.com/watch?v=yLffWMBUKUE&list=PLmwJLue37PZfiGUAwQ6uhh5bbYkeFUOpj&index=13&ab_channel=SoftwareTechIT %}

Subscribe Channel SoftwareTechIT 
And Visit:- https://SoftwareTechIT.com
More Here:- https://home.softwaretechit.com
Buy Anything From Here :-https://shop.softwaretechit.com

{% embed https://softwaretechit.com/all-buttons-in-android-toggle-button-android-tutorials-softwaretechit/ %}

Questions:- 
What is toggle button in android?
Why We Use toggle button in android app?
How to Create toggle button in android studio?
How We Create Android app using toggle button ?
What is android toggle button in android studio?
What does android toggle button use in android app?
What is An toggle button in android app?
How to Code toggle button android app project?
how does android toggle button work ?
how does android toggle button work in android studio?

Download Our App:- https://play.google.com/store/apps/details?id=com.softwaretechit
Read More Here :- https://softwaretechit.com/top-10-quetions-on-ai-and-chatgpt-ai-tool-can-ai-is-new-future-of-world/
https://softwaretechit.com/what-is-chatgpt-develope-chatgpt-11-things-you-can-do-with-chatgpt/
Watch Other Video:-https://youtube.com/shorts/7MmZi6GHizM?feature=share
🌎 Website :- https://softwaretechit.com
📰 Blog:- https://blog.softwaretechit.com
🛒 Shopping :- https://shop.softwaretechit.com 
📑 Product Review :- https://productsellermarket.softwaretechit.com
🔎 Business & More:- https://golbar.net/
🏡 https://home.softwaretechit.com

💬 https://instagram.com/softwaretechit

LeetCode Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZeATQcUaHddx4-TJ5cjkT0t
Angular Project Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZfQTgu-AXNee3EDj7oIlqeh
Android Playlist :-https://www.youtube.com/playlist?list=PLmwJLue37PZcEUyMLhaa3jnfyq3lETiSe
Python Flask Project Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZdqqr9wj6c5uY2iXQsSVxZK
Java Project Link :- https://www.youtube.com/playlist?list=PLmwJLue37PZcvpGWO8tjlFzXCRS7FDfwA
Installation Tutorial Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZeRGo1hOc3Mh4QcHVSIKQ9Y
Kali Linux Installation:- https://youtu.be/7uqH2om9itY

Thank You... #softwaretechit #2023 #tech
ezy - desktop gRPC client
Tags: grpc, protobuf, api, opensource
Published: 2022-08-13 17:01:46

Hi! I just released new desktop gRPC client called [ezy](https://github.com/getezy/ezy).

*Why another one?*
I'm working with gRPC every day and for my opinion all existed GUI clients do not well designed or do not have fully gRPC features support. And some of them like [BloomRPC](https://github.com/bloomrpc/bloomrpc/issues/398) unfortunately are unmaintained.

## ezy

### Features

✅ Localy persisted collections.
✅ Multi-tabs.
✅ Environments.  

#### gRPC
✅ Unary calls.
✅ Client/Server/Bidirectional streaming.
✅ Metadata support.
✅ TLS (Server-side/Mutual) support.
✅ Good errors output.

![Preview](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hzd5yxw60rz4bdiigoyi.gif)

### Plans
Actual roadmap available [here](https://github.com/orgs/getezy/projects/1/views/1).

If you are interested in this project, please share your feedback/ideas here or in [discussions](https://github.com/getezy/ezy/discussions) 🙏
Seeding Database With Drizzle ORM
Tags: tutorial, typescript, database
Published: 2023-09-24 09:52:03

## Database

This post assume using PostgreSQL for database, check [orm.drizzle.team/docs/overview](//orm.drizzle.team/docs/overview) for more information how to connnect to your database.

## Setup

### Dependencies

```bash
npm i drizzle-orm pg dotenv
npm i -D drizzle-kit @types/pg esbuild-register @faker-js/faker
```

### Environment Variables

```sh
# .env.development
DATABASE_URL=postgres://user:pass@127.0.0.1:5432/db
```

### Drizzle Config

```typescript 
// drizzle.config.ts
import type { Config } from "drizzle-kit";
import * as dotenv from "dotenv";
dotenv.config({ path: "./.env.development" });

if (!("DATABASE_URL" in process.env))
        throw new Error("DATABASE_URL not found on .env.development");

export default {
        schema: "./src/db/schema.ts",
        out: "./src/db/migrations",
        driver: "pg",
        dbCredentials: {
                connectionString: process.env.DATABASE_URL,
        },
        strict: true,
} satisfies Config;
```

### Schema

```typescript 
// src/db/schema.ts
import { pgTable, serial, text, varchar } from "drizzle-orm/pg-core";

export const users = pgTable("users", {
        id: serial("id").primaryKey(),
        username: text("username"),
        email: varchar("email", { length: 256 }),
});
```

### Scripts

```json 
// package.json
{
        "scripts": {
                "drizzle:generate": "drizzle-kit generate:pg",
                "drizzle:push": "drizzle-kit push:pg",
                "drizzle:seed": "node --loader esbuild-register/loader -r esbuild-register ./src/db/seed.ts"
        }
}
```

### Migrations & Push

```bash
npm run drizzle:generate
npm run drizzle:push
```

## Seed

```typescript
// src/db/seed.ts
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
import { users } from "./schema.ts";
import { faker } from "@faker-js/faker";
import * as dotenv from "dotenv";
dotenv.config({ path: "./.env.development" });

if (!("DATABASE_URL" in process.env))
        throw new Error("DATABASE_URL not found on .env.development");

const main = async () => {
        const client = new Pool({
                connectionString: process.env.DATABASE_URL,
        });
        const db = drizzle(client);
        const data: (typeof users.$inferInsert)[] = [];

        for (let i = 0; i < 20; i++) {
                data.push({
                        username: faker.internet.userName(),
                        email: faker.internet.email(),
                });
        }

        console.log("Seed start");
        await db.insert(users).values(data);
        console.log("Seed done");
};

main();
```

```bash
npm run drizzle:seed
```