teleren/devto huggingface dataset:
Difference between innerText and textContent in HTML
Published: 2024-04-14 14:46:36

## innerText

innerText retrieves or sets the text content of an element and all its descendants, and it is aware of the current styling applied to the elements. This means that if there are any styles applied to an element that hide it (like display: none), innerText will not return the text content of that element.

Here's an example:

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>innerText Example</title>
</head>
<body>
  <div id="exampleDiv">
    This is some <span style="display: none;">hidden</span> text.
  </div>

  <script>
    const div = document.getElementById('exampleDiv');
    console.log(div.innerText); // Output: This is some text.
  </script>
</body>
</html>

```html


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



In this example, innerText returns only the visible text inside the #exampleDiv element, ignoring the hidden span.

## textContent

textContent returns the text content of all elements, including hidden elements or those with visibility set to hidden. It doesn't consider CSS styling and simply returns all text contained within the specified element.

Here's an example:

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>textContent Example</title>
</head>
<body>
  <div id="exampleDiv">
    This is some <span style="display: none;">hidden</span> text.
  </div>

  <script>
    const div = document.getElementById('exampleDiv');
    console.log(div.textContent); // Output: This is some hidden text.
  </script>
</body>
</html>

```

In this example, textContent returns all the text within #exampleDiv, including the text inside the hidden span.

## Conclusion

- Use innerText when you want to retrieve only the visible text content of an element, considering CSS styles.
- Use textContent when you want to retrieve all text content within an element, regardless of CSS styling or visibility.

If you liked this blog, please share it with others who might find it useful. You can also keep up with me for more stuff about JavaScript, React, Next.js, MongoDB & Web Development.

You can find me on [Twitter](https://twitter.com/MadhuSaini22), [LinkedIn](https://www.linkedin.com/in/madhu-saini/), and [GitHub](https://github.com/MadhuSaini22).

Thanks for reading🌻
Launch your startup in 450+ communities
Tags: launch, nocode, notion, airtable
Published: 2024-04-14 14:12:58

📣 Exciting Opportunity for Founders!

Are you struggling to get your first users and get maximum traction on your launch? Don't worry I was also in your shoes sometime back.

I made a comprehensive guide that helps founders like yourself save 200+ hours in launch planning and gaining maximum visibility. 📈
https://gum.co/startuplaunchkit

What's Inside?
✅ A curated list of 400+ communities with a combined traffic of over 300 million.
✅ Exclusive access to 50+ Slack/Discord list
✅ Detailed, step-by-step documentation for submissions to 80+ platforms, designed to save you over 200+ hours of research and effort.
✅ Perfect for solopreneurs and small teams looking to make a big impact fast.

Why spend countless hours on research when you can get a head start on your growth journey today? 

Elevate your product’s presence effortlessly with our tailored guide.
https://gum.co/startuplaunchkit
4 Best Practices for Building a Robust Backend
Tags: backend, webdev, codenewbie, productivity
Published: 2024-04-14 14:06:46

When developing a backend system, following best practices is crucial for ensuring a reliable, scalable, and maintainable codebase. Here are four essential best practices to keep in mind:

## 1. **Modular Architecture**

Embrace a modular approach to your backend architecture. Break down your codebase into smaller, reusable components or modules that handle specific functionalities. This approach promotes code organization, reusability, and testability. Each module should have a well-defined responsibility and a clear interface for interacting with other modules.

## 2. **Separation of Concerns**

Adhere to the principle of Separation of Concerns (SoC) by separating your application's logic into distinct layers or components. Common layers include the presentation layer (e.g., APIs, web services), the business logic layer, and the data access layer. This separation promotes code maintainability, testability, and flexibility, as changes in one layer have minimal impact on the others.

## 3. **Error Handling and Logging**

Implement robust error handling and logging mechanisms throughout your backend application. Proper error handling ensures that your application gracefully handles and recovers from unexpected situations, providing meaningful error messages to users or logging critical information for debugging purposes. Incorporate centralized logging to aid in troubleshooting and monitoring your application's performance and behavior.

## 4. **Security Best Practices**

Security should be a top priority when building a backend system. Implement industry-standard security practices, such as:

- **Input Validation**: Validate and sanitize all user input to prevent vulnerabilities like SQL injection, cross-site scripting (XSS), and other code injection attacks.
- **Authentication and Authorization**: Implement secure authentication and authorization mechanisms to control access to your application's resources and functionalities.
- **Encryption**: Encrypt sensitive data, both at rest (e.g., in databases) and in transit (e.g., during network communication), using strong encryption algorithms and key management practices.
- **Regular Updates and Patches**: Keep your backend software, frameworks, libraries, and dependencies up-to-date with the latest security patches and updates to mitigate known vulnerabilities.

By following these best practices, you can create a robust, maintainable, and secure backend system that serves as a solid foundation for your application. Additionally, consider implementing industry-specific best practices, adhering to coding standards and guidelines, and leveraging automated testing and continuous integration/continuous deployment (CI/CD) practices for a more efficient and reliable development process.
UseEffect
Tags: javascript, react, webdev, programming
Published: 2024-04-14 13:34:39

Syntax - 

```javascript
// 1. Import *useState* and *useEffect*
import React, {useState, useEffect} from 'react';
import './App.css';

function App() {
    // 2. Create our *dogImage* variable as well as the *setDogImage* function via useState
    // We're setting the default value of dogImage to null, so that while we wait for the
    // fetch to complete, we dont attempt to render the image
  let [dogImage, setDogImage] = useState(null)

    // 3. Create out useEffect function
  useEffect(() => {
    fetch("https://dog.ceo/api/breeds/image/random")
    .then(response => response.json())
        // 4. Setting *dogImage* to the image url that we received from the response above
    .then(data => setDogImage(data.message))
  },[])

  return (
    <div className="App">
        {/* 5. Using *dogImage as* the *src* for our image*/}
    {dogImage && <img src={dogImage}></img>}
    </div>
  );
}

export default App;

```
Prisma를 사용 하는 이유
Published: 2024-04-14 13:27:54

Prisma를 프로덕션 환경에서 2년 이상 사용한 경험이 있습니다. 현재도 새로운 프로젝트에서 Prisma의 장점 때문에 선택하고 있습니다.

### **1. Model 작성만으로도 충분합니다.**

새로운 프로젝트를 시작하거나 기능을 개발할 때, 테이블 간의 Relation를 정의해야 합니다. Prisma의 경우 모델을 정의함으로써 Prisma Client가 생성됩니다. 이는 ERD를 작성하고 테이블 간의 Relation를 명시적으로 정의하는 것보다 훨씬 간편하며, 별도의 Entity를 작성할 필요가 없으며 Type safe합니다.

### **2. Slow Query를 걱정하지 않아도 됩니다.**

RDBMS를 사용하는 대부분의 경우 JOIN을 사용하여 쿼리를 작성합니다. 그러나 JOIN하는 열에 인덱스가 없으면 데이터베이스는 전체 테이블을 스캔하여 데이터를 찾게 됩니다. 이는 성능에 영향을 줄 수 있습니다. Prisma는 메인 테이블을 먼저 조회하고 중복을 제거한 열의 값을 사용하여 JOIN을 수행합니다. 이로 인해 DB에 부담을 줄이면서도 쿼리 성능을 향상시킬 수 있습니다.

그러나 Prisma를 사용하기 위해서는 테이블 간의 Relation 설정해야 합니다. 이는 Index나 FK 조건을 사용할 때 성능 저하가 발생할 수 있으며, 테이블 구조를 변경하거나 부모 데이터를 삭제할 때 자식 테이블 레코드도 처리 해줘야합니다.

결론적으로, 스타트업에서 빠르게 제품을 개발하고 제품-시장-적합성(PMF)을 검증하는 단계에서 Prisma를 사용하는 것은 매우 유용합니다. Prisma는 개발자가 효율적으로 작업할 수 있도록 도와주며, Query 작성과 DB 관리에 대한 부담을 줄여줍니다.
Novità Milano
Published: 2024-04-14 13:25:59

[Novità Milano](https://giorno24.it/): Giorno24 ti porta le notizie più rilevanti della città e oltre. Con approfondimenti su politica, economia, sport, cultura e moda, resterai sempre al passo con gli eventi più importanti. Non perdere l'opportunità di formarti una tua opinione informata grazie alle nostre notizie accurate e imparziali. Segui Giorno24 per essere sempre al centro del dibattito politico. Visita giorno24.it per essere sempre informato sulle ultime novità!
Hotbet4d: Platform Resmi Scatter Hitam Slot
Published: 2024-04-14 13:22:02

[Hotbet4d](#) adalah platform resmi situs [slot gacor](#) dengan fitur scatter hitam yang memiliki keunggulan tambahan freespin (spin gratis) hingga 50x dan tambahan saldo hingga 5 juta rupiah (langsung ke akun). Fitur [Scatter hitam slot](#) hanya tersedia di beberapa situs saja salah satunya situs Hotbet4d.

[![Hotbet4d](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8m6p48l1dd9616zt7jvz.png)](https://rebrand.ly/y7waxcx)
IGNOU Solved Assignment 2023-24 pdf free download
Tags: ignnousolvedassignment, ignouhandwrittenassignment, ignouproject
Published: 2024-04-14 13:13:29

For any [**IGNOU Solved Assignment**](https://ignouassignmentsolve.com/) that you may require, you are welcome to ask for assistance. The best product is what we offer. So, as we know best for students, obtain assistance. A lot of students did not turn in their assignments for this session. You can now submit if you are one of them.
The greatest array
Tags: perl, python, theweeklychallenge
Published: 2024-04-14 12:54:40

## Weekly Challenge 264

Each week Mohammad S. Anwar sends out [The Weekly Challenge](https://theweeklychallenge.org/), a chance for all of us to come up with solutions to two weekly tasks. My solutions are written in Python first, and then converted to Perl. It's a great way for us all to practice some coding.

[Challenge](https://theweeklychallenge.org/blog/perl-weekly-challenge-264/), [My solutions](https://github.com/manwar/perlweeklychallenge-club/tree/master/challenge-264/sgreen)

## Task 1: Greatest English Letter

### Task

You are given a string, `$str`, made up of only alphabetic characters `[a..zA..Z]`.

Write a script to return the greatest English letter in the given string.

A letter is greatest if it occurs as lower and upper case. Also letter `b` is greater than `a` if `b` appears after `a` in the English alphabet.

### My solution

For this challenge, I work backwards from `z` to `a` and return the first letter that appears in both cases. If `str` was going to be very long, it would be faster to convert this to a set (hash in Perl) for faster lookup. However this is definitely not needed for a small string.

```python
def greatest_letter(s: str) -> str | None:
    for letter in string.ascii_uppercase[::-1]:
        if letter in s and letter.lower() in s:
            return letter

    return None
```

### Examples

```bash
 ./ch-1.py PeRlwEeKLy
L

$ ./ch-1.py ChaLlenge
L

$ ./ch-1.py The
''
```

## Task 2: Target Array

### Task

You are given two arrays of integers, `@source` and `@indices`. The `@indices` can only contains integers `0 <= i < size` of `@source`.

Write a script to create target array by insert at index `$indices[i]` the value `$source[i]`.

### My solution

One thing the challenge does not specify is what happens if the value of `indices` is outside the current length of the of the solution. Python's `insert` and Perl's `splice` will append the value to the end of the array (without padding), so I'm following that for this task. It would be trivial to raise an exception if that was the desired behavior.

With that in mind, the task is pretty straight forward. I create an empty list (array in Perl) called `solution`. I then iterate through the two lists, adding the value in the `source` list at the position in the `indices` list.

```python
def target_array(source: list, indices: list) -> list:
    solution = []
    for i in range(len(source)):
        solution.insert(indices[i], source[i])

    return solution
```

### Examples

```bash
$ ./ch-2.py "(0, 1, 2, 3, 4)" "(0, 1, 2, 2, 1)"
(0, 4, 1, 3, 2)

$ ./ch-2.py "(1, 2, 3, 4, 0)" "(0, 1, 2, 3, 0)"
(0, 1, 2, 3, 4)

$ ./ch-2.py "(1)" "(0)"
(1)

```
Hotbet4d: Bocoran RTP Live Slot Gacor Hari Ini
Published: 2024-04-14 13:10:53

Hotbet4d memiliki keunggulan berupa info bocoran rtp live [slot gacor hari ini](#). Bocoran [RTP Slot](#) yang di sediakan tentunya sangat lengkap dan sangat akurat karna memiliki persentase tingkat kemenangan yang tinggi hingga 98%.

[![rtp hotbet4d](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9eanmeo6ye8ntjzb1og9.png)](https://hotbet4d.store/)
Exploring the Seam Between Sewing and Programming
Tags: sewing, programming, webdev, javascript
Published: 2024-04-14 13:00:27

In the intricate world of crafting, where needles weave stories through fabric, lies a surprising intersection with the digital realm of programming. Welcome to the [sewing house](https://shopthesewinghouse.com/), where the art of stitching and the science of coding entwine in unexpected harmony.

Much like coding, sewing requires meticulous attention to detail and a systematic approach. From selecting patterns to decoding instructions, both endeavors demand logical thinking and problem-solving skills. Just as a programmer constructs algorithms to achieve desired outcomes, a seamstress follows a blueprint to piece together fabric into a cohesive whole.

Moreover, the parallels extend to the language of both disciplines. In programming, syntax dictates the structure of code, while in sewing, patterns serve as the syntax guiding the assembly of garments. Both rely on precision and adherence to rules to achieve desired results.

In today's digital age, technology has even blurred the lines further with the emergence of computerized sewing machines and software designed for pattern drafting and design. Seamstresses are akin to developers, utilizing these tools to bring their creative visions to life.

In essence, the sewing house is not merely a sanctuary for needle and thread but a realm where the artistry of crafting and the logic of programming converge, weaving a tapestry of innovation and creativity.
Hotbet4d: Platform Game Online Simulator Resmi
Published: 2024-04-14 12:59:20

[Hotbet4d](#) merupakan situs platform game online simulator resmi indonesia yang telah berkembang sejak tahun 2010 dan memiliki beragam pilihan permainan terbaik.

Daftar sekarang juga di hotbet4d dan nikmati penawaran spesial yang tersedia di situs hotbet4d


[![Daftar Hotbet4d](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5pm8hc8oi3xx9lsi9nv.png)](https://rebrand.ly/y7waxcx)
OCI - Oracle Cloud Nomenclature & Diagrams for Cloud Architects
Tags: oci, oracle, documentation, diagrams
Published: 2024-04-14 12:52:35

One of the most painful and difficult tasks for Cloud Architects is to document the desired Architecture to present to the customers or higher management. This is for me **THE** most important tool to showcase the technical prowess of one's understanding of the OCI Project. As the adage says picture says a thousand times better than words. 

## Why the Nomenclature and Diagrams , what does it serve

As per the webster dictionary nomenclature means "_<u>a system or set of terms or symbols especially in a particular science, discipline, or art</u>_". The point in our case is OCI - how do we describe the OCI architecture using diagrams.
There are many times you need to showcase a presentation before it's actually implemented in Oracle Cloud , this blog attempts to help people do that.

## How to use the Nomenclature and Diagrams

Now for the best part - Oracle provides this **free** , I mean absolutely **free** . Developers , Architects , Sales Consultants can make use of this to ensure you have all the necessary documentation tools.

The OCI official documentation link for downloading the nomenclature is [here](https://docs.oracle.com/en-us/iaas/Content/General/Reference/graphicsfordiagrams.htm)

[Draw.io Templates](https://docs.oracle.com/iaas/Content/Resources/Assets/OCI-Style-Guide-for-Drawio.zip) - This is my absolute favourite because draw.io is free to use , I suggest engineers to try this one [draw.io](https://app.diagrams.net/) . An empty template with downloaded OCI Lobrary is marked in red below in draw.io

![Example of OCI Library in draw.io](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/soy0j9ag69rm35pucb9u.png)

[MS Power Point Template - Download here](https://docs.oracle.com/iaas/Content/Resources/Assets/OCI_Icons.pptx)
For those who are proficient in MS Power Point , you could come up with something like this.

![Example of MS Power Point Diagrams](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mrqxksh77rsm2rf7f2hj.png)


[Visio Templates](https://docs.oracle.com/iaas/Content/Resources/Assets/OCI_Icons_Visio.zip) - For those proficient with Visio

[SVG and PNG Files](https://docs.oracle.com/iaas/Content/Resources/Assets/OCI_Icons_PNG_SVG.zip)
If you are in need of just the OCI Icons , this is the best resource you can find.

There are Cacoo and OmniGraffle stencils as well , however I have not used them much. Draw.io and MS Power Point were more than enough for my needs

[Cacoo Templates](https://cacoo.com/templates/oracle-cloud-infrastructure-template)

[Graffle Stencils](https://docs.oracle.com/iaas/Content/Resources/Assets/OCI_Icons_Omnigraffle.zip)

As you can see there are a host of options available to document OCI Architeture. I highly recommend the use of this to continuosly document and improve the architecture. Sometimes documentation leads to brighter ideas to improve the existing setup.
Call Vue library in Angular
Tags: angular, vue
Published: 2024-04-14 08:30:00

---
title: Call Vue library in Angular
published: true
description: Call Vue library in Angular
tags: angular,vue
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-04-14 08:28 +0000
---

- Previously implemented the call to the [React library](https://wszgrcy.github.io/wszgrcy-blog/article/angular/angular%E8%B0%83%E7%94%A8react%E5%BA%93.html) Currently, Vue library calls are supported
- React and Vue have similarities in some designs, so their implementations and calls are basically the same

## demo

- [https://wszgrcy.github.io/cyia-bridge/](https://wszgrcy.github.io/cyia-bridge/)

## npm 

- [https://www.npmjs.com/package/@cyia/ngx-bridge](https://www.npmjs.com/package/@cyia/ngx-bridge)

## Currently supports calling

- Directly calling the vue component in the ng component

```html
<vue-outlet [component]="xxxx" [root]="true" #root></vue-outlet>
```

- Directly calling the ng component in the vue component

```tsx
<NgOutletVue component={OutletRefTestComponent}></NgOutletVue>
```

- When ng calls the Vue component, children can be either the Vue component or the ng component (projection)

```html
<vue-outlet [component]="xxxx" #child></vue-outlet>
<!-- named slot -->
<vue-slot-group [name]="'xxx'">
  <ng-template #child let-input1="input1"></ng-template>
</vue-slot-group>
```

## example

- `ant-design-vue` 


```html
<vue-outlet [component]="Tree" [root]="true" [(model)]="bindModel" [props]="props">
  <vue-slot-group [name]="'title'">
    <ng-template #child let-key="key" let-title="title">
      @if (key === '0-0-1-0') {
      <span style="color: #1890ff">{{ title }}</span>
      }@else{ {{ title }} }
    </ng-template>
  </vue-slot-group>
</vue-outlet>
```

```ts
import { Component } from '@angular/core';
import { VueOutlet, VueSlotGroup } from '@cyia/ngx-bridge/vue-outlet';
import { Button, Tree, TreeProps } from 'ant-design-vue';
const treeData: TreeProps['treeData'] = [
  {
    title: 'parent 1',
    key: '0-0',
    children: [
      {
        title: 'parent 1-0',
        key: '0-0-0',
        disabled: true,
        children: [
          { title: 'leaf', key: '0-0-0-0', disableCheckbox: true },
          { title: 'leaf', key: '0-0-0-1' },
        ],
      },
      {
        title: 'parent 1-1',
        key: '0-0-1',
        children: [{ key: '0-0-1-0', title: 'sss' }],
      },
    ],
  },
];
const expandedKeys = ['0-0-0', '0-0-1'];
const selectedKeys = ['0-0-0', '0-0-1'];
const checkedKeys = ['0-0-0', '0-0-1'];
@Component({
  selector: 'app-ant-design-vue-demo',
  standalone: true,
  imports: [VueOutlet, VueSlotGroup],
  templateUrl: './ant-design-vue-demo.component.html',
  styleUrl: './ant-design-vue-demo.component.scss',
})
export class AntDesignVueDemoComponent {
  Tree = Tree;
  treeData = treeData;
  bindModel = { expandedKeys, selectedKeys, checkedKeys };
  props = {
    checkable: true,
    treeData: treeData,
  };
}
```
Handling URL Redirections in Next.js with Middleware
Tags: nextjs, middleware, seo, webdev
Published: 2024-04-14 12:47:38


In the evolving world of web development, managing user navigation and routing effectively is crucial for creating a seamless user experience. At [itselftools.com](https://itselftools.com), having developed over 30 web applications using Next.js and Firebase, we've gathered numerous insights on various features of Next.js. One of the powerful features we've leveraged is the middleware functionality of Next.js to handle URL redirections efficiently. Today, let's dive deep into how to implement a URL redirection using Next.js middleware.

## Understanding the Code Snippet
Here's a basic code snippet that demonstrates URL redirection via middleware in a Next.js application:

```javascript
import { NextResponse } from 'next/server';

export function middleware(request) {
  if (request.nextUrl.pathname === '/old-page') {
    return NextResponse.redirect(new URL('/new-page', request.url));
  }
  return NextResponse.next();
}
```

### Breakdown of the Code
- **Importing NextResponse**: `NextResponse` is an API from `next/server`. It's used to manipulate responses in the middleware.
- **Middleware function**: This function is triggered for every incoming request. Here, the main focus is on handling specific URL paths.
- **Conditionally Redirecting**: The middleware checks if the requested pathname is `/old-page`. If true, it redirects the user to `/new-page` using `NextResponse.redirect()`.
- **Continuing with Other Requests**: If the condition is not met, `NextResponse.next()` is called to continue processing the request normally.

## Use Cases for Middleware Redirects
1. **SEO Optimization**: Redirect old URLs to new ones to preserve search rankings.
2. **User Experience**: Redirect deprecated pages to new ones without user interaction.
3. **A/B Testing**: Dynamically route users to different variants of a page.
4. **Maintenance or Downtime Handling**: Redirect traffic from pages under maintenance.

## Conclusion
Mastering URL redirections using Next.js middleware can significantly enhance your application’s navigation and user experience. If you're keen to see this code in action, explore some of our well-crafted applications like [explore languages](https://translated-into.com), [word finder tool](https://find-words.com), and [high capacity disposable emails](https://tempmailmax.com). Each uses Next.js capabilities to ensure smooth and efficient user experiences.

Feel free to dive into these tools and see how advanced Next.js features are utilized in real-world applications.
SAP Basis snippets #1
Tags: sap, sapbasis, database, db2
Published: 2024-04-14 12:30:39

## DB2 database operations
In this post let’s look at some of the basic db2 database commands.

• Logging into database

`su - db2<sid>`

All the below commands need to be executed as db2<sid> user

• Checking db2 status

`db2pd -`

• Starting db2

db2start

• Stopping db2

`db2stop`

• Check the installed db2 version and the path

`db2ls`