teleren/devto huggingface dataset:
Angular Directive
Tags: angular, directive, angulardirective, webdev
Published: 2023-04-11 04:34:28

Directives are used to extend the HTML syntax and provide additional functionality to elements in the DOM. Directives can be used to add behavior to an existing element, create a new element, or modify the behavior of an existing element. Here is an example of how to use directives in Angular:

**1. Built-in Directives:** Angular comes with some built-in directives, including ngIf and ngFor.

**ngIf Directive:** The ngIf directive is used to conditionally render an element based on a condition. For example, if we have a boolean variable named showElement, we can use the ngIf directive to show an element only if showElement is true.

```
<div *ngIf="showElement">This element will only be shown if showElement is true</div>
```

**ngFor Directive:** The ngFor directive is used to iterate over a collection and render an element for each item in the collection. For example, if we have an array of items, we can use the ngFor directive to render a list of items.

```
<ul>
  <li *ngFor="let item of items">{{item}}</li>
</ul>
```

**2. Custom Directives:** In addition to the built-in directives, Angular allows you to create custom directives.
Here is an example of a custom directive that changes the background color of an element when it is clicked:

```

import { Directive, HostBinding, HostListener } from '@angular/core';

@Directive({
  selector: '[clickable]'
})
export class ClickableDirective {
  @HostBinding('style.backgroundColor') backgroundColor: string;

  @HostListener('click') onClick() {
    this.backgroundColor = 'blue';
  }
}
```

In the above example, we are creating a directive named clickable that changes the background color of an element when it is clicked. The @HostBinding decorator is used to bind the backgroundColor property to the style.backgroundColor property of the element. The @HostListener decorator is used to listen for the click event on the element and change the backgroundColor property.
We can use this directive in our HTML as follows:

```
<div clickable>This element will change its background color when clicked</div>
```
When the user clicks on the element, the background color will change to blue.

Thanks For reading.

Any Queries please comment.
Javascript Object #6
Tags: javascript, webdev, beginners, programming
Published: 2023-04-11 04:22:59

Welcome All,

Till our Last Post we've seen only pretty basics in Javascript.From now we are going to Jump into little deep about Objects in Javascript,as i've told you that Javascript Object are very Deep and He is very Strong one,as most of the things in javascript is an Object.

Let's Quick Dive into it,in this Post we are Going to know about **Prototype** in Javascript.

## Prototype 

As in many Programming Languages,they have _Inheritance_ to access the Feature from his Parent class or Object.As like that Javascript can inherit features from one Object to another Object via Prototype.Unlike in other Programming languages like Java,C++ they have Classical Inheritance but in Javascript it is **Prototypal Inheritance**.

Every Object has it's own Property called Prototype.And Prototype itself is an another Object and it contains another prototype and it is somewhat called as the _Prototype Chain_.This Chain ends when it's Prototype is null.

Suppose you have an object person with a property called name:

```
`let person = {'name' : 'John'}`
```
When examining the person object in the console, you’ll find that the person object has a property called prototype denoted by the [[Prototype]]



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

The prototype itself is an object with its own properties:


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

Suppose if you want to access a property from an Object it'll return the value if exist,or else if the Property is not present in the Object the Javascript engine will search for the Property in the Object Prototype and even if it can't find it there it'll search it in the Prototype's Prototype untill it finds the Property or reaches the end of the prototype Chain.

For example, you can call the toString() method of the person object like this:


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

The toString() method returns the string representation of the person object. By default, it’s [object Object] which is not obvious.

In this example on calling the toString() method,the Javascript engine will search for it in the Person Object and it could not find it there and it continue to search for it in the Object Prototype and it will find it there.

Since the person’s prototype has the toString() method, JavaScript calls the toString() of the person’s prototype object


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

for now that's it,we'll see more intresting things about the Prototype and it's inheritance in upcoming post.

Many Thanks for Your Time,
Sam
DBMind Mode
Tags: opengauss
Published: 2023-04-11 03:49:19

You can run the gs_dbmind command to invoke all functions of AI4DB. This command provides the following basic functions:

**·** Service functions: You can use the service subcommand to implement service related functions, including creating and initializing configuration directories, starting background services, and stopping background services.
**·** Invoking components: You can use the component subcommand to invoke components. AI4DB functions (such as index recommendation and parameter tuning) can be invoked in real time in this mode.
**·** Setting parameters: You can use the set subcommand to modify the configuration file in the configuration directory. The configuration file can also be modified by using the text editor.

You can use the –help option to obtain the help information about the preceding modes. For example:

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

Table 1 gs_dbmind options

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nguks0k2417eqydbml1w.png)
What are some legally licensed datasets for COMMERCIAL use to train a model with images and videos?
Tags: ai, machinelearning, datascience
Published: 2023-04-11 03:44:45

As a novice in the field of Artificial Intelligence and Machine Learning, I would appreciate some guidance on:-
1. The various platforms that professionals use to acquire datasets for training/fine tuning their models with images and videos.
2. Is that data legally licensed for commercial use or do we have to check it ourselves?
3. Can we download that data in bulk?
#day 1 react create react app
Tags: webdev, javascript, react, programming
Published: 2023-04-11 03:43:15

How To Create react app!

We have two types to create react.

1. Simple Create-react-app
2. npm create vite .

Next step to continue these steps:

npm install
npm run dev

Check it out the Vite official site 

Link
https://vitejs.dev/guide/

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6zhjxao8tu579hzgietl.jpg)
How to Create Custom Form in Magento 2
Tags: webdev, magento, magento2tutorials
Published: 2023-04-11 03:40:28

Magento 2 is a vigorous online business stage that offers a huge number of customization choices to fabricate custom structures for different purposes. Whether it's a contact structure, input structure, or some other kind, Magento 2 furnishes the capacity to make structures effortlessly. Custom structures are a significant piece of any internet business site as they give a way to clients to speak with the storekeepers and give important criticism. A very much planned structure can increment client commitment and assist with further developing the general client experience.

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

In this aide, we will adopt a bit by bit strategy for **_how to create custom form in Magento 2_**, beginning from making a module to refreshing the design to show the structure on the frontend. By following these means, you will actually want to make a custom structure for your web based business store that meets your particular requirements and upgrades the client experience.

For more info, visit **_https://webguru.dev/how-to-create-custom-form-in-magento-2/_**
Syndication
Tags: meta, writing, indieweb
Published: 2023-04-11 06:58:30

---
title: Syndication
published: true
date: 2023-04-11 00:00:00 UTC
tags: meta,writing,indieweb
canonical_url: https://pbarker.dev/posts/2023-04-10/syndication/
---

Inspired by [Cory Doctorow](https://pluralistic.net/), I've been thinking about the IndieWeb idea of [POSSE](https://pluralistic.net/) (Publish on your Own Site, Syndicate Elsewhere) and how to extend the reach of my blog posts. So I'm trying something new and syndicating blog posts to dev.to.

dev.to makes this quite nice with native support a "canonical URL" for posts originally published elsewhere. It's also pretty easy to repost existing content to since it supports Markdown (my posts are written in reStructuredText for my website but can be easily converted to Markdown using [pandoc](https://pandoc.org/)) and future posts can be automatically shared to dev.to via an RSS feed.

Existing posts on dev.to is variable in quality, and there are [multiple](https://dev.to/samuelfaure/is-dev-to-victim-of-its-own-success-1ioj) [posts](https://wagslane.dev/posts/collapsing-quality-of-devto/) criticising the platform for low-quality blogspam, but I don't think that's a reason to avoid posting to the platform (as long as it's not the exclusive home to your posts). My goal here is to extend the reach of my writing, not to gain some sort of prestige-by-association from the sites where I syndicate my posts, so the presence of blogspam on dev.to doesn't put me off from sharing my posts there. And blogspam is sadly a fact of life on any platform that's easy to post to.

It's also worth noting that I've considered and rejected syndicating my posts to Medium due to their monetisation & obnoxious popups, and SubStack due to their [problematic hosting of TERFs](https://gen.medium.com/substack-is-not-a-neutral-platform-8fc5bdf8e5f2).

So, assuming I don't find any reason to cancel this experiment, you'll be able to read my writing at [dev.to/pbarker](https://dev.to/pbarker) as well as [on Mastodon](https://social.afront.org/@pbarker) and [on my website](https://pbarker.dev).
openGauss FAQs
Tags: opengauss
Published: 2023-04-11 03:21:09

How Do I Delete Temporary Files Generated During Compilation?
Question
How do I delete temporary files generated during compilation?

Answer
Go to the /sda/openGauss-server directory and run the following command to delete temporary files generated during compilation.

Delete the files generated by configure and make.

""
make distclean -sj
Delete the files generated by make.

""
make clean -sj
How Do I Resolve the “Configure error: C compiler cannot create executables” Error?
Question
How do I resolve the “Configure error: C compiler cannot create executables” error reported during version compilation?

Answer
Error cause: The binarylibs file is incomplete or damaged.

Solution: If binarylibs is built using open-source software, rebuild the open-source third-party software. If binarylibs is downloaded from code, download the code again. Then run the current script or command again.

How Do I Handle the “g++: fatal error: Killed signal terminated program cclplus” Error?
Question
How do I resolve the “g++: fatal error: Killed signal terminated program cclplus” error that occurs during compilation.

Answer
Error cause: The -sj parameter is added to the compilation process in the script. The number of concurrent tasks is too large.

Solution: Reduce the number of concurrent make tasks during compilation or run the make command directly. If the one-click script is used, you need to modify the script.

How Do I Handle the “out of memory allocating xxx bytes after a total of xxx bytes” Error?
Question
How do I resolve the “out of memory allocating xxx bytes after a total of xxx bytes” error that occurs during compilation.

Answer
Error cause: The -sj parameter is added to the compilation process in the script. In addition, the machine configuration is low, the memory is insufficient, and the number of concurrent tasks is too large. As a result, an error is reported.

Solution: Reduce the number of concurrent make tasks during compilation or run the make command directly. If the one-click script is used, you need to modify the script.
AI4DB: Autonomous Database O&M
Tags: opengauss
Published: 2023-04-11 03:20:22

As mentioned above, AI4DB is mainly used for autonomous O&M and management of databases, helping database O&M personnel reduce O&M workload. In implementation, the AI4DB framework of DBMind is monitored and service-oriented. It also provides instant AI toolkits and out-of-the-box AI O&M functions (such as index recommendation). AI4DB mainly uses the open-source Prometheus for monitoring. DBMind provides a monitoring data producer exporter, which can be interconnected with the Prometheus platform. The following figure shows the AI4DB service architecture of DBMind.

Figure 1 AI4DB service architecture of DBMind

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

Key components in the figure are described as follows:
**·** DBMind Service: DBMind background service, which can be used for periodic offline computing, including slow SQL root cause analysis and time series prediction.
**·** Prometheus-server: server for storing Prometheus monitoring metrics.
**·** metadatabase: After the offline computing is complete, DBMind stores the computing result. Databases such as openGauss and SQLite are supported.
**·** client: client used to read the DBMind offline computing results. Currently, only the CLI client is supported. If databases such as openGauss are used to store and calculate the DBMind computing results, you can configure visualization tools such as Grafana to visualize the results.
**·** openGauss-exporter: collects monitoring metrics from the openGauss database nodes for DBMind to calculate.
**·** node-exporter: exporter provided by Prometheus, which can be used to monitor system metrics of the node, such as CPU and memory usage.
**·** reprocessing-exporter: processes metrics collected by Prometheus, for example, calculating the CPU usage.

**Environment Configuration**
DBMind must run on Python 3.6 or later. The required third-party dependency packages are recorded in the **requirements.txt** file (**requirements-x86.txt** or **requirements-arrch64.txt**, depending on the platform type) in the AI function root directory ($GAUSSHOME/**bin/dbmind**). You can run the **pip install** command to install the dependencies. For example:

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

If you do not install all required dependencies, the system will prompt you to install third-party dependencies when you run the gs_dbmind command. Note that this file provides the third-party dependencies required by DBMind. If a third-party package conflict exists in the user environment, you can handle the problem based on the actual situation.
2390. Leetcode Solution in cpp
Tags: cpp
Published: 2023-04-11 03:04:12

```cpp
class Solution {
public:
    string removeStars(string s) {
           stack<char> st;
           for(char ch : s) {
               if(ch == '*') {
                   st.pop();
               }
               else {
                   st.push(ch);
               }
           }
        string ans;
        while(st.size() > 0) {
            ans += st.top();
            st.pop();
        }
        
        reverse(ans.begin(), ans.end());
        return ans;
    }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/removing-stars-from-a-string/
openGauss Setting up the Compilation Environment
Tags: opengauss
Published: 2023-04-11 02:39:53

Hardware Requirements
Hardware requirements for compiling the openGauss are as follows:

Number of servers: 1
Hardware specifications:
CPU: 4U (64-bit)
Memory: 8 GB
Free disk space: 100 GB
Software Requirements
OS Requirements

The following OSs (Linux 64-bit) are supported:

CentOS 7.6 (x86_64 architecture)
openEuler-20.03-LTS (aarch64 architecture)
openEuler-20.03-LTS (x86_64 architecture)
Kylin-V10 (aarch64 architecture)
Asianux 7.6 (x86_64 architecture)
Asianux 7.5 (aarch64 architecture)
FusionOS 22 (aarch64 architecture)
FusionOS 22 (x86 architecture)
Software Dependency Requirements

Table Software dependency requirements lists the software requirements for compiling the openGauss.

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

Table 1 Software dependency requirements


Software

Recommended Version

libaio-devel

0.3.109-13

flex

2.5.31 or later

bison

2.7-4

ncurses-devel

5.9-13.20130511

glibc-devel

2.17-111

patch

2.7.1-10

redhat-lsb_core

4.1

Configuring Environment Variables
The environment variable configuration for compiling the openGauss has been written into the one-click compilation and packaging script. Therefore, you do not need to configure the environment variables.

If you do not want to use the one-click compilation script, you need to manually configure environment variables. For details, see Software Compilation and Installation.
10 concepts essential for gaining a deep understanding of Kubernetes networking
Tags: devops, kubernetes, devjournal, developers
Published: 2023-04-11 02:31:00

Kubernetes is a powerful container orchestration platform that has become widely adopted in the world of cloud-native computing. 

10 concepts that are essential for anyone looking to gain a deep understanding of Kubernetes networking: 

## 1. Pods: 
A Kubernetes Pod is a group of one or more containers that are deployed together on the same host. Pods are the smallest deployable units in Kubernetes.


## 2. Services: 
A Kubernetes Service is an abstraction that defines a logical set of Pods and a policy by which to access them. Services enable the connectivity and load balancing of traffic to the underlying Pods.


## 3. Labels: 
Labels are key-value pairs that are attached to Kubernetes objects, such as Pods. Labels can be used to organize and select subsets of objects based on their metadata.


## 4. Ingress: 
Ingress is a Kubernetes resource that enables inbound connections to be routed to the correct service. It can be used to provide external access to services, load balance traffic, and implement layer 7 routing rules.


## 5. Namespaces: 
Kubernetes Namespaces are virtual clusters that can be used to partition resources within a Kubernetes cluster. This allows multiple teams to share the same cluster while still maintaining their own isolated environments.


## 6. Network Policies: 
Network Policies are rules that are used to define how groups of Pods are allowed to communicate with each other and with external networks. Network Policies are used to implement network segmentation within a Kubernetes cluster.


## 7. Service Discovery: 
Service Discovery is the process of locating a service instance in order to route traffic to it. Kubernetes provides built-in service discovery mechanisms that enable Pods to discover each other and establish communication.


## 8. DNS: 
Kubernetes includes a built-in DNS server that automatically assigns DNS names to Kubernetes services. This allows Pods to easily discover and communicate with each other using DNS names instead of IP addresses.


## 9. Load Balancing: 
Kubernetes includes built-in support for load balancing traffic to Pods. This allows multiple replicas of a Pod to be created and distributed across the cluster, and enables incoming requests to be evenly distributed among the available replicas.


## 10. CNI: 
The Container Network Interface (CNI) is an interface that defines how container runtime environments, such as Kubernetes, interact with network providers. CNI plugins are responsible for allocating and configuring network interfaces for Pods.



These concepts will provide a strong foundation for working with Kubernetes in production environments and enable you to confidently troubleshoot and debug networking issues as they arise.


Thanks for reading this.

If you have an idea and want to build your product around it, schedule a call with me.

If you want to learn more about DevOps and Backend space, follow me.

If you want to connect, reach out to me on Twitter and LinkedIn.
Sloan's Top 4 Newbie Memes of the Week
Tags: beginners, codenewbie
Published: 2023-04-11 02:10:28

Over at the [CodeNewbie Team](https://dev.to/codenewbieteam), we have been trying to kickstart a little weekly [CodeNewbie Meme Monday](https://dev.to/codenewbieteam/codenewbie-meme-monday-1463) of newbie-related memes. We decided recently that we wanted to spice things up and try something new out to keep things fresh on the CodeNewbie team. **We landed on a Sloan's Newbie Memes of the Week!**
 

Here are some of our favorites from this week:

![Beginner Coder: I need help making a certain mechanic. Experienced Coder: have you tried doing said thing that I will not explain to you?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87e2dbavkvpbupc9g8n8.jpg)

![Person kissing another person's hand: "Frontend". Person kissing same person's hand over a cliff: "Backend"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/igjgq91pcc309juiw9i3.png)

![Give a man a fish and you feed him for a day. Teach a man to fish, and you feed him for a lifetime. What are some other examples for this? "Give a man a program, frustrate him for a day. Teach a man to program, frustrate him for a lifetime"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3al0enzb3egxy55n7nc5.jpg)

![The pupil of your eye can expand over 45% when you see something you love. "Code compiled successfully"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mgbzwgme4vqo7ncix6ql.jpg)

**If you'd like to join in— drop your beginner-related, job-related, starting-a-new-career-related memes down below!**

Happy coding y'all!