teleren/devto huggingface dataset:
Understanding PostgreSQL
Tags: postgressql, productivity, discuss, opensource
Published: 2023-08-18 12:09:15

****PostgreSQL** - is a popular OPen -Source Object-Relational Database Management System.That is used to store data and allowing them to be restored when their need arises.

PostgreSQL is a cross-platform and runs on various operating systems such as _Microsoft,Windows ,UNIX,Mac OS ,linux and so on.

              **Features Of PostgreSQL**
1.It is compatible with various languages such as JAVA,Python,Ruby,Perl, C++.

2.It is an open-source,hence easy to download from the official PostgreSQL.

3.It is compatible on several operating systems.

4.It is secure since it supports and follows several aspects of security.


              ** Advantages of PostgreSQL**

1. It is very easy to use
2. It requires low maintenance
3. PostgreSQL manages data in relational database hence its very powerful.
                  **Disadvantages of PostSQL**
1. it is not very first compared to MySQl
2. Does not support some open-source applications compared to MySQL




**Conclusion**
it is now clear that you have understood what is PostgreSQL,its features, advantages and drawbacks.Happy Learning
Noopener Noreferrer
Tags: development, programming, security, websecurity
Published: 2023-08-18 12:08:54

Yesterday, I asked about **noopener** and noreferer on my facebook timeline
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yac613f7w0go5159e0rs.png), and, in relations to that post, I will give a brief details about what they means and how they are generally useful in development.

Noopner is a web features that helps to take basic security measures in your development.

They are use in the <a href> tag and call with the "rel" attribute.

Noopener are used when you are targeting a blank page for your link, that is, when you want a certain link to be opened in a new tab when a user clicked on it, the attribute <_target>.

The "Noopener" attribute ensures that, the new tab does not have access or any information from the original tab. 

Just say, "It helps to mitigated security risk that has to do with opening of tabs in development.

This measure is safe for security purpose.

Now, "Noreferrer" just like noopener:

Noreferrer ensures, the new tab does not carry on with any information from the original tab to the new tab.

Thr browser prevents the newly opened tab or window from passing any referrer information to the linked page.

No referrer protect users privacy and security and ensures it is not transmitted.

To summarize this, in any stages of development, if you must allow users to open a link in another tab or window, ensure to use the "noopener and "noreferrer" tag in your "rel" attribute. It helps to protect users privacy and security.

I hope you find this helpful?

I am Oluwatoyin
For Tech, For Innovation
Exploring Vagrant: Port Forwarding - Part 4
Tags: devops, ubuntu, virtualmachine, linux
Published: 2023-08-18 12:08:02

Port forwarding in Vagrant allows you to expose ports from your virtual machine (VM) to your host machine, making services running inside the VM accessible from the host or even from other devices on the network. This is particularly useful when you're running applications inside a VM and want to interact with them from your host machine's web browser or other tools.

> By default port 22 (ssh) of the guest vm is mapped to port 2222 of the host machine 


To set up port forwarding in Vagrant is simple and the following 

```ruby 
Vagrant.configure("2") do |config| 
	#  other configuration settings 
	config.vm.network "forwarded_port", guest: <guest_port>, host: <host_port> end
```

Example:
```ruby 
Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/jammy64"
  config.vm.provider "virtualbox" do |vb|
    vb.memory = 2048
    vb.cpus = 2
  end 
  config.vm.provision :ansible do|ansible| 
    ansible.playbook = "playbook.yml"
  end 
  
  config.vm.network "forwarded_port", guest: 80, host: 8080 ,auto_correct: true 
end
```

> `autocorrect: true` part will relocate the port forwarding to other port if the host port is busy  

After making the changes to your Vagrantfile, save the file and run the following commands in the directory where your Vagrantfile is located:

```bash 
vagrant up 
```

or if your vm is already running 

```bash 
vagrant reload --provision
```

With the port forwarding set up, you can now access the service running inside the VM using the host machine's IP address and the host port you specified. For the example above, you would access the service in a web browser at `http://localhost:8080`


### Multi port forwarding

To forward multiple ports in Vagrant, you can simply add multiple `config.vm.network "forwarded_port"` entries in your Vagrantfile. Each entry will define the port forwarding for a specific service running inside the VM. Here's how you can do it:

```ruby
Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/jammy64"
	
  config.vm.network "forwarded_port", guest: 80, host: 8080
  config.vm.network "forwarded_port", guest: 443, host: 8443
  config.vm.network "forwarded_port", guest: 3306, host: 3306
end

```

In the example above, three ports are being forwarded: port 80 on the guest VM to port 8080 on the host, port 443 on the guest VM to port 8443 on the host, and port 3306 on the guest VM to port 3306 on the host.
Paginação em typescript
Published: 2023-08-18 12:04:45

Para criar um paginador em typescript genérico

```
interface SortFilter<T> {
    [key: string]: 'asc' | 'desc';
  }
  
  interface PaginatableSortable<T> {
    sort( filter: SortFilter<T>): T[];
    paginate(items: T[], page: number, size: number): T[];
  }
  
  class BaseEntity<T> implements PaginatableSortable<T> {
 
     items:T[]
     constructor(items:T[]){
        this.items=items
     }
     sort( filter: SortFilter<T>): T[] {
      const keys = Object.keys(filter) as (keyof T)[];
      return this.items.slice().sort((a, b) => {
        for (const key of keys) {
          const direction = filter[key] as 'asc' | 'desc';
          const aValue = a[key];
          const bValue = b[key];
  
          if (typeof aValue === 'string' && typeof bValue === 'string') {
            return direction === 'asc'
              ? aValue.localeCompare(bValue)
              : bValue.localeCompare(aValue);
          } else {
            if (aValue < bValue) {
              return direction === 'asc' ? -1 : 1;
            }
            if (aValue > bValue) {
              return direction === 'asc' ? 1 : -1;
            }
          }
        }
        return 0;
      });
    }
  
    paginate(items: T[], page: number, size: number): T[] {
      const startIndex = (page - 1) * size;
      return items.slice(startIndex, startIndex + size);
    }
  }
  
  class Employee  {
    name?: string;
    age?: number;
    salary?: number;
  
    // Resto da definição da classe Employee
  }
  
  // Exemplo de uso
  const employeesData: Employee[] = [
    {name:'JOdn',age:25,salary:3000},{name:'Jadn',age:25,salary:
    6000},
    {name:'alef',age:22,salary:4000},{name:'Maria',age:28,salary:
    9000}
  ];

const employees= new BaseEntity(employeesData)
  
  // Ordenar por nome (ascendente) e, em caso de empate no nome, ordenar por salário (ascendente)
  const sortedEmployees = employees.sort({ name: 'asc', salary: 'desc' ,age:'desc'});
  
  console.log(sortedEmployees);
  
  // Paginar
  const page = 1;
  const pageSize = 2;
  const paginatedEmployees = employees.paginate(sortedEmployees, page, pageSize);
  
  console.log(paginatedEmployees);

```
Mastering Email Address Validation in JavaScript
Tags: javascript, learning, beginners, tutorial
Published: 2023-08-18 11:56:30

Validating an email address in JavaScript involves using regular expressions to check if the email address follows a specific pattern. Here's a comprehensive explanation along with code blocks to demonstrate the process:



![javascript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2cfie1m35apuq1in316y.png)

**Explanation:**

1. We start by defining a regular expression pattern emailPattern using the `/pattern/` syntax. This pattern follows the general structure of an email address.

2. The pattern uses character classes and quantifiers to match various parts of an email address:

- `[a-zA-Z0-9._-] `matches the local part of the email address (before the `"@" `symbol), allowing letters, numbers, dots, underscores, and hyphens.

- `@[a-zA-Z0-9.-]+\`. matches the `"@"` symbol and the domain part of the email address (after the `"@"` symbol), allowing letters, numbers, dots, and hyphens.

- `[a-zA-Z]{2,4}` matches the top-level domain `(TLD)` of the email address, allowing 2 to 4 letters (e.g., com, org, io).

3. The `validateEmail `function takes an email address as input and uses the test method of the regular expression pattern to check if the email matches the pattern. It returns true for a valid email and false otherwise.

4. In the example usage section, we provide an email address to the `validateEmail `function and check if it's valid or not. The console.log statements display the result.

Keep in mind that while this regular expression provides a basic validation, no email validation is foolproof due to the complexity of email standards. You might consider using more robust validation libraries or server-side validation for critical applications

`LinkedIn Account` : [LinkedIn](https://www.linkedin.com/in/matthew-odumosu/)
`Twitter Account `: [Twitter](https://twitter.com/iamcymentho)
**Credit**: Graphics sourced from [Edureka](https://www.edureka.co/blog/javascript-email-validation/)
Why Google Pixel 4a Is The Best Budget Phone For Students
Tags: pixel4a, mobile
Published: 2023-08-18 11:45:34

So are you looking for a budget phone and cannot get to decide ?  Look no further as I have a great recommendation for you ,the Google pixel 4a ,among the phones released by Google being released in 2020.Also,I highly recommend pixel 4a to students who are searching for a budget phone with capabilities of handling academic load.
Pixel 4a is a comfy pocket size phone with its display standing at 5.81’’,with a FHD (1080*2340)OLED;the image quality is enhanced in size with the OLED ensuring high blacks thus rendering high contrast. Also it has an Always-on display, good for a busy individuals or anyone who likes their phone on silent  mode as you wont miss out on notifications.
Coming with a 128GB of storage and a RAM size 6GB, which is good for huge academics documents while running apps on the background thanks to the RAM this comes with a  hefty backup on google drive and google photos.Also coupled with a strong processor which is good for demanding tasks, the Qualcomm®5 SnapdragonTM 730G with a  moderately high CPU speed, making response time faster for applications and booting while turned on,RAM speed has also increased thanks to the processor.
Being a student in this age means doing dumps, pixel 4a camera doesn’t disappoint with 8mp for the front camera with a 84 degree field of view and 12.2 MP dual camera for the rear camera with a an autofocus that ensures the image is sharp and always nail focus thus providing a good image. Below is an example:
![A sample picture taken in 2x mode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lpyxp2d5tsre2m0sbtxi.jpg)
Taken in 2x mode

![A sample picture taken in 1x mode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdhe2c03q0nc9cjkmjn7.jpg)Taken in 1x mode

All this comes with a first charging battery of 3140mAh. Lasting for around 6.5 – 7 hours with medium usage.
AWS Elastic Container Registry (ECR): A Secure and Scalable Container Registry
Tags: aws, cloud, containers, docker
Published: 2023-08-18 11:28:07

AWS Elastic Container Registry (ECR) is a fully managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images. ECR is a regional service, which means that each AWS Region has its own ECR registry.

ECR offers a number of features to help you manage your container images securely, including:

Private repositories: ECR supports private repositories, which means that only authorized users can access your images.

Image scanning: ECR can scan your images for vulnerabilities. This helps you to identify and fix security vulnerabilities in your images before they are deployed.

Lifecycle policies: ECR can be configured to automatically delete unused images. This helps you to save storage space and costs.

Integrated with Docker: ECR integrates with the Docker CLI, so that you can push and pull images from your ECR repositories using the same commands that you would use for local repositories.

Benefits of Using AWS ECR
Here are some of the benefits of using AWS ECR:

Secure storage: ECR stores your images in Amazon S3, which is a highly secure object storage service.

Scalable: ECR can scale to meet the needs of your application.

Cost-effective: ECR is a pay-as-you-go service, so you only pay for the storage and bandwidth that you use.

Easy to use: ECR is easy to use and integrate with your existing Docker workflows.

Best Practices for AWS ECR.
Here are some best practices for using AWS ECR:

Use private repositories: Use private repositories to protect your images from unauthorized access.

Scan your images for vulnerabilities: Use ECR's image scanning feature to identify and fix security vulnerabilities in your images.

Configure lifecycle policies: Configure lifecycle policies to automatically delete unused images. This helps you to save storage space and costs.

Use the Docker CLI: Use the Docker CLI to push and pull images from your ECR repositories. This will make it easier to integrate ECR with your existing Docker workflows.

Conclusion
AWS ECR is a secure and scalable container registry that makes it easy for developers to store, manage, and deploy Docker container images. It is a good choice for any organization that needs to manage container images securely and efficiently.
AWX, ansbile-callback not working
Tags: awx
Published: 2023-08-18 11:25:30

Hello,

I'am using AWX 22.7.0 on a kubernetes environment. Kubernetes is using MetalLB and Ingress. AWX is configured to use ingress in with type loadbalancer.

Everything is working fine, expect the ansible-callback. As seen many time: 
/usr/bin/curl -k -s -H 'Content-Type: application/json' --data '{"host_config_key":"#######"}' https://awx.example.com/api/v2/job_templates/11/callback/
{"msg":"No matching host could be found!"}

Solutions provided are the setting of: HTTP_X_FORWARDED_FOR, but this does not work for me.

Can anybody help me out?

Kind regards
   Jurgen Ponds
How Can a Mobile App Support the Growth of the Food Hall Business in 2023?
Tags: foodappdevelopment, mobileappdevelopment, appdvelopment, iosappdevelopment
Published: 2023-08-18 11:21:09

The food hall industry makes it convenient to sample a variety of cuisines in one location in today's modernizing world. However, the concept originated in Western countries and is constantly spreading all over the world. Involving such an evolving business is a good plan of action. But you need to do several things to set up the business and run it successfully. Curious about those things? 

**Factors for the betterment of food hall business**
Conducting a thorough market analysis is essential for every business, especially in the context of the emerging food hall industry. Identifying the optimal business locations and understanding customer behavior are vital components of this analysis.

The process of Concept Development holds significant importance in the business development journey. It is imperative to address and eliminate any conceptual barriers that might impede progress.

A well-crafted marketing plan is indispensable for the sustainability of any business. Establishing a strong connection between the business and its customers is a fundamental prerequisite. Only through this connection can the company bolster its customer base and enhance customer flow.

**Mobile Applications for Development**
Mobile App development is essential for your business. The use of a mobile app as a marketing tool could help the food court industry grow. You can use paid advertisements, social media campaigns, influencer marketing, and other forms of promotion to advertise your food court.

Offering welcome gifts, gift cards, and other incentives in the beginning can help you attract more end users.

Making a **[food delivery app](https://www.uplogictech.com/food-ordering-delivery-app-development-company)** will enable you to support your vendors' ability to take customer online orders. In return, you can charge them a commission for every order they place using your mobile app. It enables you to increase the revenue from your current business. 

**In closing**
In a tech-based situation, standing out from the competition is most important in business. **[Mobile app development](https://www.uplogictech.com/mobile-app-development-company)** will help in doing analysis and marketing to a great extent. Don't miss out the Uplogic Technologies experts in the app development for businesses for your food hall business development.
Database Transactions in Laravel
Tags: laravel, php, database
Published: 2023-08-18 11:17:02

In Laravel, database transactions are used to manage the integrity and consistency of the database when performing multiple database operations together. A transaction is a set of database operations that are executed as a single unit of work. If any part of the transaction fails, all the changes made within that transaction are rolled back, ensuring that the database remains in a consistent state.

```
DB::beginTransaction();

try {
    // Perform database operations here
    User::where('age', '>', 25)->delete();
    if(User::where('status',User::DRAFT)->first()){
      // Performing Database Operations
    }

    // Commit the transaction
    DB::commit();
} catch (\Exception $e) {
    // Something went wrong, rollback the transaction
    report($e);
    DB::rollback();
}

```
Lexicon 💬 A ChatGPT Language Learning App with Adventures, Speech and Feedback!
Tags: chatgpt, ai, mobile, flutter
Published: 2023-08-18 11:01:26

Hey there! I'm a solo developer (23, just graduated university), and I'm thrilled to share my latest project with you (my first try at software development!). In my spare time outside work, I've built a language learning app called Lexicon that takes a unique approach to language acquisition. The idea came from loving language learning but not having enough time to practice my speaking and finding tutors too expensive to use regularly.

**The Idea**

I wanted to create an immersive language learning experience that goes beyond just vocabulary and grammar. My app lets users practice speech, improve listening skills, and engage in realistic conversations with realistic characters, all while receiving live model feedback and tracking their progress. 

**The twist: AI-Driven Adventures**

But here's the twist: I've also integrated "adventures" into the app. Imagine stepping into plot-driven scenarios where the AI acts as a dungeon master in D&D, guiding users through language-rich quests that make learning fun and engaging: from roaming the Wild West, the depths of the Marianas Trench or Renaissance Italy.

If you're interested, you can [check out the app](lexicon-ai.tech) (Android & iOS). I'd be super grateful to hear your thoughts on the idea, the UI, marketing tips or anything else, as I'm totally new to business, software development and marketing.

Thank you so much! 

Looking forward to your feedback and suggestions. Thanks so much for taking the time to check it out!
Compare Data in Two MySQL Tables
Published: 2023-08-18 11:01:10

dbForge Studio for MySQL provides a sophisticated tool for error-free MySQL data comparison and synchronization. Give it a try and propel your routine database update process to the next level!

- Compare and synchronize live MySQL databases and scripts folders
- Deploy changes to MySQL, MariaDB, and Percona
- Generate data synchronization scripts
- Support for command-line interface
- Automate and schedule database synchronization
- Synchronize databases of any size quickly and flawlessly
- Generate data comparison reports
- Compare two databases in one IDE

Read more: https://www.devart.com/dbforge/mysql/studio/mysql-data-comparison.html
NextAuth.js: create a custom OAuth provider
Tags: nextjs, react, nextaut, javascript
Published: 2023-08-18 10:39:01


Hello World! In this post I going to explain how to create in NextAuth.js a Custom provider. Auth provider in NextAuth.js are OAuth definition that allow yours users to sign in with their favorite existing logins.

NextAuth.js contains several built-in providers where it just needs to have as parameter the client id and the client secret (Facebook, Google etc.)

## Prerequisites
For those unfamiliar with the services, I reccomend reading the following links:

- https://auth0.com/intro-to-iam/what-is-openid-connect-oidc
- https://auth0.com/intro-to-iam/what-is-oauth-2

Let's start!

### 1. Create [...nextauth].ts
In pages at the path api/auth create the [...nextauth].tsx file

![nextauth file into pages/api/auth](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dhiqockbgk7p5vxf8yr6.png)

## 2. Create Authentication Provider

Here a custom provider has been created for authorization for ClickUp, a project management tool:

```typescript
const clickUpProvider: OAuthConfig<any> = {
  id: 'clickup',
  name: 'clickUp Report',
  version: '2.0',
  type: 'oauth',
  authorization: 'https://app.clickup.com/api',
  token: 'https://api.clickup.com/api/v2/oauth/token'
  userinfo: 'https://api.clickup.com/api/v2/user',
  clientId: process.env.CLIENT_ID,
  clientSecret: process.env.CLIENT_SECRET,
  checks: ['state'],
  profile: (profile: any) => {
    console.log('profile', profile)
    return {
      id: profile.user.id.toString(),
      name: profile.user.username,
      email: profile.user.email
    }
  },
}
```
Now let's see the fields:
- **id**: identication provider
- **name**: project name
- **authorization**: nextAuth.js will use it to redirect to the provider's login page
- **token**: nextAuth.js will use it to get the token
- **userInfo**: nextAuth.js will use it to get the user profile
- **clientId and clientSecret**: keys generated from clickUp provider. I reccomend to insert them in .env files
- **callback**: set the profile info (default values are id, name, email and picture)

## 3. Insert the custom provider in AuthOptions
After the provider object is created, you insert it into the "providers" array of authOptions.

```typescript
export const authOptions: AuthOptions = {
  providers: [
    clickUpProvider,
  ],
...
}

export default NextAuth(authOptions)
```

I recommend to read the doc for more info: https://next-auth.js.org/configuration/providers/oauth#using-a-custom-provider
#LearnedToday: Pushable 3D button
Tags: css, scss, learnedtoday, webdev
Published: 2023-08-18 10:31:22

🏖  I've been on vacation for almost 2 weeks and I think I only turned on my PC to write last week's post.... And so I will do this week!

😎 I focused on something "lighter" like **CSS** and I created a configurable & responsive 3D **button** using a mixture of `box-shadows`, `isolation: isolate`, `:before` and `:after` pseudo elements and a bit of **math**, without using additional elements but a button tag!

💪  Actually, I used **SCSS** harnessing the power of mixins to make it reusable and configurable. At the moment, you can decide the min/max/viewport based size and you can change the aspect ratio, depth, color and font size.

⚠️ This is a very first version and I'm sure the calculations can be simplified, but I'd say it's working decently 😎 


![Doomsday app preview](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/426gt2nm2x8kmdaqglu6.png)

⏱  You can see it in action in the [Doomsday project demo](https://doomsday.danielzotti.it) which is a sort of countdown to the doomsday.

📰  I'll add the link to a [Codepen project](https://codepen.io/danielzotti/pen/LYMYxor) where you can find the SCSS code to play with it.