teleren/devto huggingface dataset:
Regular Expresstions in javascript
Published: 2023-04-14 06:04:04

Regular expressions are an essential feature of JavaScript, and they are used for pattern matching and manipulation of strings. Here are some of the reasons why regular expressions are needed in JavaScript:
1.Searching and replacing text: Regular expressions can be used to search and replace text in strings. They can help you find specific patterns of text and replace them with something else.
2.Data validation: Regular expressions can be used to validate user input. For example, you can use them to check if an email address is valid or if a phone number is in the correct format.
3.Parsing data: Regular expressions can be used to extract specific data from a string. For example, you can use them to extract all the URLs from a block of text.
4.URL manipulation: Regular expressions can be used to manipulate URLs. For example, you can use them to extract the domain name from a URL.
5. String manipulation: Regular expressions can be used to manipulate strings. For example, you can use them to remove unwanted characters from a string.
Overall, regular expressions are a powerful tool for working with strings in JavaScript, and they are essential for many programming tasks
SQL Rewriter: SQL Statement Rewriting
Tags: opengauss
Published: 2023-04-14 05:54:28

**Overview**

SQL Rewriter is an SQL rewriting tool. It converts query statements into more efficient or standard forms based on preset rules to improve query efficiency.

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

**Usage Guide**
**Prerequisites**
The database and connection are normal.

**Example**
Use the **tpcc** database as an example:

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

**queries.sql** is the SQL statement to be modified. The content is as follows:

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

The result is multiple rewritten query statements, which are displayed on the screen (the statements that cannot be rewritten are displayed as null), as shown in the following.

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

**Obtaining Help Information**

Before using the SQL Rewriter tool, run the following command to obtain help information:

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

The following information is displayed:

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

Passwords are entered through pipes or in interactive mode. For password-free users, any input can pass the verification.

**Command Reference**
Table 1 Command line parameters

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

**Troubleshooting**
**·** If the SQL statement cannot be rewritten, check whether the SQL statement complies with the rewriting rule or whether the SQL syntax is correct.
Apache AGE & Python(Pt. 1)
Tags: apacheage, postgres, database, apache
Published: 2023-04-14 05:00:56


Python is a well-liked programming language with many applications, including web development and data processing. However, working with databases is frequently required when conducting data analysis or creating web applications. Users of the graph database Apache AGE can run graph queries using SQL. We'll look at how the Python driver in Apache AGE enables Python programmers to communicate with the database in this blog article.

A basic introduction of AGE is that users can run graph queries using SQL. It is based on Apache Calcite, a framework for dynamic data management, and Apache Arrow, a columnar in-memory data format. For detailed information you can refer [here](https://dev.to/waleedahmed0001/appache-age-4642).


## What is Python Driver?
A Python driver is a piece of software that enables database connectivity and communication for Python programmers. It gives Python applications a method to ask questions of the database and get answers back. For Python writers, the driver provides a higher-level interface by encapsulating the specifics of the underlying network protocol used to communicate with the database.

## Python Driver & AGE Working:
The Python driver in Apache AGE offers a Python API for interfacing with the database. Python programmers can use it to connect to Apache AGE, run queries, and receive results. The Python Package Index (PyPI) hosts the driver, which can be downloaded and installed using pip. The python driver provides support for complex queries as 

## Conclusion:
Python programmers may easily interface with and use the features of the Apache AGE graph database thanks to the Python driver in that graph database. The driver makes it simple for developers to conduct queries, connect to the database, and receive results using Python code. Starting with Apache AGE and Python is simple because to the driver's availability on PyPI and the ease with which it can be deployed using pip.
Node js design patterns series introduction
Tags: javascript, node, programming, backend
Published: 2023-04-14 02:08:25

**Hello Friends** and welcome to the Node JS Design Patterns book summary

the first part will talk about the book in general so lets kick it

The book published on 2020 by Mario Casciaro and Luciano Mammino  and both are very known      engineers on the field, Mario was a team lead in IBM and Luciano is senior architect.

The book contain 13 chapter and it takes you from the concept and the philosophy of node js ( big words huh ) and the very basics and go through the async neutral and async control flow pattern with callbacks and promises and we gonna go through some design patterns like creational and structural and behavioral and take full advantage of node js and then we gonna dive into some advanced shit like scalability  and architectural patterns.

The chapters goes this way:-

1- The node platform: here we gonna talk about what is node 
js in theory how it is works and how is regular js library can have a philosophy and the beauty of JavaScript world.

2- The module system: the modules systems and its patterns and how its works and the hodd
	
3- callback and events : here we gonna start talking asynchronously, and the first way to go async is callback and then we gonna talk about the event loop and what the hill is going async and discover some async design patterns
	
4-  asynchronous control flow patterns with callbacks
	
5- asynchronous control flow promises and Async/Await

6- coding with streams: we gonna see what is streams and use cases of it
	
7- Creational Design Pattern: take a look at some of traditional design patterns like Singleton and Factory and builder
	
8- Structural Design Pattern: some design patterns like Proxy and Decorator and Adapter 
	
9- Behavioral Design Pattern: strategy pattern and more
	
10- Universal JS  for the web applications: here the story gonna be more fun and we gonna see how JavaScript work on browser and cross-platform and some react shit
	
11- Advanced recipes: here we going to the next level in asynchronous functional behavioral and mastering some principles and patterns to solve more complex problems
	
12- Scalability and architectural patterns: in this part we gonna discuss how to design Nodejs architecture that scale in both capacity and complexity and get little DevOps’y
	
13- Messaging and integration patterns: here we gonna see how to design distributed systems and mastering most important types of messaging exchange pattern.

every day i am going to publish a summery for a chapter so stay close my friend and see you tomorrow.
Step-by-Step guide on Installing WSL and PostgreSQL from source code on Windows.
Tags: apacheage, database, postgres
Published: 2023-04-14 03:55:55

PostgreSQL is a powerful open-source relational database management system (DBMS) which is extensible. Apache AGE is a Postgres extension that enables one to make hybrid queries. To Install AGE, we must install PostgreSQL version 11 or 12 from source code, as they are the only AGE compatible version as at the time of this writing. In this post, I am going to show you a clear guide on how to install PostgreSQL from source code. This is a continuation of my previous post about AGE [here](https://dev.to/chidera/apache-agea-quick-overview-ncp). 

**WSL Installation.**
On your Windows machine, do the following; 

1. 
Open settings > apps>  > optional features > more windows features > enable WSL.

2. 
This would prompt you to reboot your system. 

3. 
Visit the Microsoft store, install Ubuntu and follow the prompts.

**PostgreSQL Installation guide.**   

- Create a directory where PostgreSQL will be downloaded in.
    ```
    mkdir postgres-age && cd postgres-age
    mkdir postgres && cd postgres
    ```


- Download the required dependencies.
    ```
    sudo apt-get install build-essential libreadline-dev zlib1g- 
    dev flex bison
    ```

- Download the build tool for multiple PostgreSQL versions using the command below.
    ```
    sudo apt install postgresql-server-dev-all
    ```

- Or this command below.
    ```
    sudo apt install postgresql-common
    ```    

- Download PostgreSQL. This command does the following;
    1. Downloads PostgreSQL from source code.
    2. Extract the file contents.
    3. Removes the download archive.
    ```
    wget https://ftp.postgresql.org/pub/source/v11.18/postgresql- 
    11.18.tar.gz && tar -xvf postgresql-11.18.tar.gz && rm -f 
    postgresql-11.18.tar.gz
    ```


- Enter into the newly downloaded postgresql-11.18 directory.
    ```
    cd postgresql-11.18
    ```

- Run the build configuration and enable debug flags.

    ```
    ./configure --enable-debug --enable-cassert --prefix=$(pwd) 
    CFLAGS="-ggdb -Og -fno-omit-frame-pointer"
    ``` 

- Install PostgreSQL.
    ```
    make install
    ```

 
With this, PostgreSQL is successfully installed. To confirm your download, create a database cluster using the command below. A database cluster is a collection of databases that are managed by a single instance of a running database server.

    ```
    bin/initdb demo 
    ``` 

- Start the server.
    ```
    bin/pg_ctl -D demo -l logfile start
    ``` 

- Stop the server.
    ```
    bin/pg_ctl -D demo -l logfile stop
    ```

Read more about AGE [here](https://dev.to/chidera/apache-agea-quick-overview-ncp)

**Contribute to Apache Age.**
https://age.apache.org/
https://github.com/apache/age
How to Change the Language of Magento 2 Admin Panel
Tags: webdev, magento, magento2tutorials
Published: 2023-04-14 03:43:12

Magento 2 is a strong internet business stage that furnishes storekeepers with many highlights and instruments to deal with their web-based stores. One of the critical highlights of Magento 2 is the capacity to change the language of the stage to all the more likely serve clients from various locales and societies. Moreover, it likewise has a hearty security highlight, which incorporates how to open administrator client in magento 2 if necessary. Of course, the Magento 2 administrator board is in English, however you can undoubtedly transform it to an alternate language of your decision.

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

This is a significant part of restriction, as it assists with making a more customized and easy to use insight for clients. In this blog, we will examine the course of **_how to change the language of Magento 2 admin panel_** in a bit by bit way, making it simple for you to follow and execute. Whether you're a fledgling or an accomplished client, you'll find this guide supportive in changing to your favored language and further developing the client experience on your web-based store.

For for more info,visit **_https://webguru.dev/how-to-change-the-language-of-magento-2-admin-panel/_**
Visual Studio: Live Unit Test is awesome
Tags: visualstudio, unittest, tips
Published: 2023-04-14 03:21:29

I am okay writing unit test, but there are several things I don't like.

- Keep checking the coverage report
- Test failed after changing so many codes as a regression

[Visual Studio Live Unit Testing](https://learn.microsoft.com/en-us/visualstudio/test/live-unit-testing?view=vs-2022) feature helps me to solve these issues.

As the official document is very easy to read, I won't re-write it here but I just want to take note for several important things.

## Prerequisites

- Enterprise edition of Visual Studio
- C# or VB.NET
- Supports xUnit, NUnit and MSTest

## What it does?

Basically, the Visual Studio runs existing unit tests background and let me know:

- Which lines are covered by test
- The test results
- Which tests are covering the line

Every time I change the code, it runs automatically and shows me the results.

![Live Unit Testing](https://learn.microsoft.com/en-us/visualstudio/test/media/vs-2022/lut-code-window.png?view=vs-2017&viewFallbackFrom=vs-2022)

![Detail](https://learn.microsoft.com/en-us/visualstudio/test/media/vs-2022/lut-failed-info.png?view=vs-2017&viewFallbackFrom=vs-2022)

## Caveat

It uses computer power, so recommend not to use it if you see any heavy performance decrease in your PC. Also be careful about the battery life if you work in cafe without AC.

## Summary

I turn it on all the time as my PC is powerful enough to run it without any issues so far. Please try if you meet the prerequisites!
GitHub Workflow - Action
Published: 2023-04-14 03:11:45



**Github Action**
Custom Github Action is for performing task which is re-used. The implementation can be in JS. Repository of the example:
https://github.com/otter13/override-with-secrets-action

_Example structure of Github Action folder_

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



_.github/actions/override-with-secrets-action/action.yaml_
This is the interface to GitHub, specifying inputs.

```
name: 'override-with-secrets-action'
description: 'loverride values in input json with secrets'
inputs:
  jsonString:
    required: true
runs:
  using: 'node16'
  main: 'dist/index.js'
```

_Caller side in workflow_
```
Code snippet for using the action in workflow

      - name: Checkout Source
        with:
          persist-credentials: false
        uses: actions/checkout@v3

      - name: aws-ssm-to-env
        uses: ./.github/actions/override-with-secrets-action
        with:
          jsonString: $

      - name: log envs
        env:
          output_secrets_override: ${{ env.output_secrets_override }}
        run: |
          echo $output_secrets_override
```

_.github/actions/override-with-secrets-action/src/index.js_

```
const core = require('@actions/core');

const configureInputs = () => {
  const inputjsonString = core.getInput('jsonString');

  return {
    jsonString: inputjsonString,
  }
}
const override = async ({
  jsonString
})=> {
  var overridenJsonString = ''
  const obj = JSON.parse(jsonString)
  for (var key in obj) {
    if (obj.hasOwnProperty(key)) {
        // TODO: override here
        console.log(key + " -> " + obj[key]);
    }
  }
  return overridenJsonString
}


const saveToEnv = (overridenJsonString) => {
    core.exportVariable('output_secrets_override', overridenJsonString);
}

const run = async () => {
  try {
    const { jsonString } = configureInputs();
    const overridenJsonString = await override({jsonString});
    saveToEnv(overridenJsonString);
  } catch (error) {
    core.setFailed(error.message);
  }
}

run();
```

_Package.json_
Specifying what packages and the build command

```
{
    "name": "override-with-secrets-action",
    "version": "1.0.0",
    "description": "",
    "main": "src/index.js",
    "scripts": {
        "build": "ncc build src/index.js -o dist"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
        "@actions/core": "^1.6.0",
        "@actions/github": "^5.0.0",
        "build": "^0.1.4"
    },
    "devDependencies": {
        "@vercel/ncc": "^0.33.4"
    }
}

```
516. Leetcode Solution in CPP
Tags: cpp
Published: 2023-04-14 03:05:01

```cpp
class Solution {
 public:
  int longestPalindromeSubseq(string s) {
    const int n = s.length();
    // dp[i][j] := LPS's length in s[i..j]
    dp.resize(n, vector<int>(n));
    return lps(s, 0, n - 1);
  }

 private:
  vector<vector<int>> dp;

  int lps(const string& s, int i, int j) {
    if (i > j)
      return 0;
    if (i == j)
      return 1;
    if (dp[i][j])
      return dp[i][j];

    if (s[i] == s[j])
      dp[i][j] = 2 + lps(s, i + 1, j - 1);
    else
      dp[i][j] = max(lps(s, i + 1, j), lps(s, i, j - 1));

    return dp[i][j];
  }
};

```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/longest-palindromic-subsequence/submissions/933388556/
I would tell you a joke about async javascript
Tags: javascript, jokes, webdev, programming
Published: 2023-04-14 02:32:19

```javascript
const tellJoke = async () => {
  console.log("I would tell you a joke about async JavaScript...");
  try {
    const punchline = await getPunchline();
    console.log(punchline, '🥁 Ba-dum-da-cha!');
  } catch {
    console.log('Joke delivery failed: Maximum call stack size exceeded!');
  }
};

async function getPunchline() {
  console.log(await getPunchline()); // practice for good delivery
  return "But I'm still awaiting for the punchline.";
}

tellJoke();
```
What We Learned About Starting a New Career and Supporting Diversity in the Workplace: CodeNewbie Podcast
Tags: beginners, codenewbie, programming
Published: 2023-04-14 02:06:17

Yesterday on our podcast, [Pariss Chandler]([https://twitter.com/ParissAthena?ref_src=twsrc^google|twcamp^serp|twgr^author](https://twitter.com/ParissAthena?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor)), the Founder and CEO of Black Tech Pipeline, came on and discussed her evolution throughout the tech industry with @saronyitbarek! Pariss also shared insights on her route to finding a community in tech and her company’s work to create more opportunities and support for Black programmers in the industry. 

If you haven’t listened (which you definitely should), you can listen to the full episode below!

{% embed **[https://www.codenewbie.org/podcast/empowering-the-next-generation-of-black-tech-talent](https://www.codenewbie.org/podcast/empowering-the-next-generation-of-black-tech-talent)** %}. 

Upon finishing the episode, we pondered on a few key points/tips that we felt were worth emphasizing and sharing with all of you!

1. If you aren’t sure coding is for you, you can look into different careers inside the tech industry that may relate/resonate with you more. Though—make sure to look at the salary, benefits, and other requirements to make sure they line up with what you need too!
2. When you are looking for your first job in tech you do not have to work at a tech company! You can work at so many different types of companies, because tech jobs are universally needed.
3. Just having a diverse workplace is not enough, we also need to ensure employees from different backgrounds feel supported and included in their workplace.
4. Spend a lot of time learning Vanilla JS before jumping into new frameworks. Make sure you fully understand the fundamentals of a language before moving on!
5. We succeed when we use feedback as both a meaningful tool and an opportunity to advance and support diversity, equity, and inclusion in the workplace.

***

If you listened— what did you learn?

Send us your thoughts below and don't forget to give it a listen here or wherever you listen to your podcasts! 💜
Recipe for becoming a great developer
Tags: beginners, devjournal, software, programming
Published: 2023-04-14 01:38:00

Are you tired of being just another mediocre developer in a sea of professional developers?

Here is the recipe for becoming a great developer:

1. Choose a project beyond current capabilities.

2. Attempt to build.

3. Learn everything that comes as an obstacle.

4. Re-attempt to build.

5. Squeeze the stress ball, necessary to keep your sanity.

6. Repeat for 10+ years!



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


Thanks for reading this.

If you have an idea and want to build your product around it, schedule a call with [me](https://calendly.com/pragyanatvade).

If you want to learn more about DevOps and Backend space, [follow me](https://dev.to/pragyanatvade).

If you want to connect, reach out to me on [Twitter](https://twitter.com/pragyanatvade) and [LinkedIn](https://www.linkedin.com/in/pragyanatvade/).
Figma to Flutter: Parabeac 4.0 Updates to Components
Tags: flutter, tutorial, dart, android
Published: 2023-04-14 00:23:40

In Parabeac 4.0, [Parabeac Cloud](https://parabeac.com) and [parabeac_core’s](https://github.com/Parabeac/parabeac_core) latest update, we’ve simplified the way that components can be referenced. Now, you can directly reference a component as a child. Let’s jump into it!

## Parabeac: An Overview

Parabeac Converts Figma designs to Flutter UI code. In our Components project type, you can convert reusable UI elements to Flutter code. For more information on how we do this, check out our [docs](https://docs.parabeac.com/docs/getting-started).

## Flutter Components: An Overview

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

UI components (as seen above) are pieces of UI that are reusable to build the entire front end of an application (as below). Flutter allows developers to create high-quality, natively compiled applications for mobile, web, and desktop from a single codebase. In Flutter, widgets are the building blocks of any Flutter application—the central idea is that you build your UI out of widgets. Because the word component is more universal and specific to UI, we’ve chosen to use the term component—even if the terms are used interchangeably in some spheres.


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



## Old Component Referencing + Breakages
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9osdwjts1n2xxxyzrye.png)

In the pre-Parabeac 4.0, layout builder was required to reference a component. If you have existing applications that reference components this way and make an update, this may cause breakages. All that is required to resolve this is delete layout builder and reference the component in the new, simplified way (shown below).

## Parabeac 4.0+ Component Referencing

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

To use a component in Parabeac 4.0 or later, simply wrap your component in a size box that describes the desired dimensions of your component and reference the component as a child.


Hope this is useful and helps you to speed up and improve your UI coding process. Head to [Parabeac Cloud](https://parabeac.com) to test it out!

Happy Coding!
Mirroring Repository
Tags: git, mirror
Published: 2023-04-14 00:06:49

$ git clone --bare https://github.com/EXAMPLE-USER/OLD-REPOSITORY.git

$ cd OLD-REPOSITORY.git
$ git push --mirror https://github.com/EXAMPLE-USER/NEW-REPOSITORY.git

//clean up
$ cd ..
$ rm -rf OLD-REPOSITORY.git