teleren/devto huggingface dataset:
5 Mistakes That Every Angular Developer Should Avoid
Tags: webdev, programming, angular, typescript
Published: 2023-06-02 11:29:09

As an Angular developer, there are several mistakes you should avoid to ensure the efficiency and effectiveness of your code. Here are five common mistakes that you should be aware of and try to avoid:

1. Not following Angular best practices: Angular has a set of best practices and guidelines that help developers write clean and maintainable code. Ignoring these practices can lead to code that is difficult to understand, debug, and maintain. Make sure to familiarize yourself with the Angular style guide and follow the recommended practices.

2. Overusing or misusing Observables: Observables are a powerful feature in Angular, used for handling asynchronous operations. However, using them excessively or inappropriately can lead to unnecessary complexity. It's important to use Observables judiciously and understand when to use them versus other techniques, such as promises or regular function callbacks.

3. Not optimizing change detection: Angular employs change detection to track and update the UI when data changes. However, inefficient use of change detection can lead to performance issues, especially in large applications. Avoid triggering unnecessary change detection cycles by utilizing strategies such as OnPush change detection and immutability.

4. Poor component and module design: Improper component and module design can lead to a tangled and hard-to-maintain codebase. Avoid creating overly complex components that perform too many tasks. Instead, aim for single responsibility components that are easier to understand, test, and reuse. Similarly, structure your modules logically, separating concerns and promoting code organization.

5. Neglecting testing: Testing is a crucial aspect of software development, but it's often overlooked by developers. Neglecting testing can result in code that is prone to bugs and difficult to refactor. Make sure to include unit tests, integration tests, and end-to-end tests in your development process. Utilize tools like Karma and Jasmine to automate your testing efforts.

By being aware of these common mistakes and actively working to avoid them, you can improve the quality of your Angular code and enhance your overall development experience.
Amazon Danışmanlık Firması
Published: 2023-06-02 11:28:48

[Amazon Danışmanlık Firması](https://www.onlinemek.com/)

Kurumsal bir firma olan Onlinemek E-Ticaret için, Amazon Danışmanlığı, Pazarlama Danışmanlığı, Marka Danışmanlığı, Hesap Yönetim Danışmanlığı, Ürün Üretim Danışmanlığı, Marka ve Patent Danışmanlığı, Marka ve Patent için yetkili avukatlar ile takip ve danışmanlık, alanında uzman ve yetkili Muhasebeciler ile finans Danışmanlığı ve birçok danışmanlık kolunda hizmet veren, sürekli beyin fırtınası yapan, işini iyi bilen ve detay odaklı bir ekibiz. Amacımız sürdürülebilir iş modelleri ile kazançlı olmanızı sağlamaktır.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8vexajep9i6wpplgiojc.jpg)
Amazon Danışmanlık Hizmeti
Published: 2023-06-02 11:26:53

Amazon Danışmanlık Hizmeti Amazon danışmanlık hizmeti, Amazon üzerinde satış yapmak isteyen işletmelerin satış stratejilerini geliştirmek ve uygulamaya yönelik danışmanlık çalışmalarını kapsar. 

Devamı için linke bakınız: [Amazon Danışmanlık Hizmeti](https://www.onlinemek.com/amazon-danismanlik-hizmeti/)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/omcnc4x16g4gn35z8akh.jpg)
AdGuardian-Term: A Terminal-based, Real-time Traffic Monitoring and Statistics Tool for AdGuard Home
Tags: opensource, programming, stackfoss, terminal
Published: 2023-06-21 21:24:32

---
title: AdGuardian-Term: A Terminal-based, Real-time Traffic Monitoring and Statistics Tool for AdGuard Home
published: true
date: 2023-06-02 11:24:45 UTC
tags: opensource, programming, stackfoss, terminal
canonical_url: 
---

AdGuardian-Term is a terminal-based, real-time traffic monitoring and statistics tool for AdGuard Home. It allows you to view a variety of information about the traffic that is being blocked by AdGuard Home, including:

- The number of requests that have been blocked
- The domains that have been blocked
- The countries that have been blocked
- The types of requests that have been blocked

AdGuardian-Term also allows you to view statistics about the performance of AdGuard Home, including:

- The number of requests that have been processed
- The average time it takes to process a request
- The number of requests that have been dropped

AdGuardian-Term is a powerful tool that can help you to keep your network safe from ads and trackers. It is easy to use and can be installed on any system that runs Linux, macOS, or Windows.

**Features:**

- Real-time traffic monitoring
- Statistics about blocked requests and domains
- Easy to use
- Compatible with Linux, macOS, and Windows

**How to use:**

1. Install AdGuardian-Term on your system.
2. Start AdGuardian-Term.
3. AdGuardian-Term will automatically start monitoring traffic.
4. To view statistics, press Enter.

* * *

AdGuardian-Term is a powerful tool that can help you to keep your network safe from ads and trackers. It is easy to use and can be installed on any system that runs Linux, macOS, or Windows.

If you are looking for a way to block ads and trackers, I encourage you to try AdGuardian-Term.
The website is currently unable to handle this request.
Tags: webdev, programming, productivity, opensource
Published: 2023-06-02 11:20:28

If you are encountering the error message "website is currently unable to handle this request," it typically indicates a problem on the server side of the website you are trying to access. This error message suggests that the server hosting the website is experiencing difficulties in processing or responding to your request.

Here are a few suggestions to troubleshoot the issue:

1. Refresh the page: Sometimes, the error might be temporary, and a simple refresh of the page can resolve it.

2. Clear browser cache: Clearing your browser's cache and cookies can help eliminate any cached data that might be causing conflicts with the website. After clearing the cache, try accessing the website again.

3. Try a different browser: If the issue persists, try accessing the website using a different browser to determine if the problem is specific to the browser you were initially using.

4. Check for maintenance or downtime: The website may be undergoing maintenance or experiencing downtime. Check the website owner's social media accounts or any announcements for any information regarding scheduled maintenance or known issues.

5. Contact website support: If none of the above steps resolve the problem and you continue to encounter the error, it's advisable to reach out to the website's support team or administrator. They may be able to provide further assistance or insights into the issue.

Please note that without specific details about the website or the exact error message you are encountering, it is challenging to provide more targeted guidance.
10 Funny Things About React 😄
Tags: javascript, react
Published: 2023-06-02 11:18:57

React is a popular JavaScript library for building user interfaces. It's known for its declarative nature, its use of virtual DOM, and its performance. But React can also be a bit funny at times. Here are 10 funny things about React:

### 1\. React components are like cats.

They're independent, they can be nested, and they can sometimes be a pain in the neck.

### 2\. React state is like a bag of holding.

You can put anything in it, but it's hard to find anything when you need it.

### 3\. React props are like a game of telephone.

What you say is not always what they hear.

### 4\. React errors are like a box of chocolates.

You never know what you're going to get.

### 5\. React debugging is like a game of whack-a-mole.

You fix one bug, and two more pop up.

### 6\. React performance is like a roller coaster.

It can be great one day, and terrible the next.

### 7\. React documentation is like a maze.

It's easy to get lost in it.

### 8\. React community is like a family.

They're always there to help you out.

### 9\. React is like a love-hate relationship.

You love it when it works, but you hate it when it doesn't.

### 10\. React is like life.

It's full of challenges, but it's also full of rewards.

I hope you enjoyed them. And if you're a React developer, I hope you can laugh at yourself a little bit.
localGPT: A Local Chatbot for Your Documents
Tags: opensource, programming, stackfoss, chatgpt
Published: 2023-06-21 21:25:47

---
title: localGPT: A Local Chatbot for Your Documents
published: true
date: 2023-06-02 11:14:46 UTC
tags: opensource, programming, stackfoss, chatgpt
canonical_url: 
---

localGPT is a new tool that allows you to chat with your documents on your local device using GPT models. No data leaves your device, and it is 100% private.

**How does it work?**

localGPT uses the power of LangChain to run the entire pipeline locally, without any data leaving your environment, and with reasonable performance.

**Ingesting Documents**

The first step is to ingest your documents into localGPT. This can be done using the [ingest.py](http://ingest.py) script. This script uses LangChain tools to parse the document and create embeddings locally using InstructorEmbeddings. It then stores the result in a local vector database using Chroma vector store.

**Chatting with Your Documents**

Once your documents have been ingested, you can start chatting with them using the [chat.py](http://chat.py) script. This script will prompt you for a question, and then use GPT to generate a response.

**Privacy**

localGPT is designed to be completely private. No data leaves your device, and your documents are never stored on a remote server.

**Performance**

localGPT is designed to be performant, even on low-end devices. It uses a variety of techniques to optimize performance, including:

- Using a local vector database
- Using a lightweight language model
- Optimizing the GPT code

* * *

localGPT is a powerful new tool that allows you to chat with your documents on your local device. It is 100% private and performant, making it a great choice for anyone who wants to use GPT models without compromising their privacy.

Here are some additional features of localGPT:

- You can use localGPT to generate summaries of your documents.
- You can use localGPT to find similar documents.
- You can use localGPT to answer questions about your documents.

> localGPT is still under development, but it is already a powerful tool that can be used for a variety of tasks. If you are interested in using GPT models, I encourage you to try localGPT.
100 Days of Java: Day 2
Tags: java, web, beginners, programming
Published: 2023-06-02 11:05:37

Welcome to Day 2 of the 100 Days of Code challenge! Today, we'll be diving into a Java code snippet that deals with date and time manipulation. Let's break down the code and understand what each part does.

```java
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public final class MyDateFormatter {

    private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss");

    public static void main(String[] args) {
        LocalDateTime currentDateTime = LocalDateTime.now();
        String formattedDateTime = currentDateTime.format(FORMATTER);
        System.out.println(formattedDateTime);
    }

}

```


To begin, we import two classes from the java.time package: LocalDateTime and DateTimeFormatter. These classes provide functionalities to handle dates, times, and their formatting.

Next, we define a class called MyDateFormatter. The final keyword means that this class cannot be extended, ensuring that it remains as is. This class will contain our code for today.

Within the class, we declare a constant variable called FORMATTER of type DateTimeFormatter. This formatter object is used to specify the desired format for the date and time.

Moving on to the main method, we create a LocalDateTime object named currentDateTime using the now() method. This object represents the current date and time.

We then format this currentDateTime using the FORMATTER object, and store the formatted date and time as a string in the variable formattedDateTime.

Finally, we use System.out.println() to print the formattedDateTime string to the console.

Now that we understand the code, let's summarize what it does. When we run this program, it will display the current date and time in the format specified by the FORMATTER. In this case, the format is "dd/MM/yyyy HH:mm:ss", which means the date will be displayed as day/month/year, followed by the time in hours:minutes:seconds.

This simple code snippet demonstrates how to work with dates and times in Java using the java.time package. Feel free to experiment with different formats or explore more functionalities provided by this package.

That's it for Day 2! Stay tuned for the next code snippet and explanation tomorrow. Happy coding!

Code credits: https://github.com/hbelmiro/
Confusion while coding
Tags: books, programming, learning, review
Published: 2023-06-02 11:03:42

This is the first post in my book review series.

The reason I've decided to write this serie is because I struggled a lot with reading and understanding code written by other developers, and I still do. It got even harder when I started focusing more on backend programming instead of frontend. Backend coding is quite different, and it requires a different way of reading.
 
I always wondered if other developers have a natural ability to read code like it's a regular language. For me, it wasn't that easy. I realised that it's a skill that can be acquired, so I looked for some guidance.

My current company provides free access to [O'Reilly](https://learning.oreilly.com), an awesome platform with tons of engineering books. I found a book there called **The Programmer's Brain by Felienne Hermans**, and it caught my attention.

In the first chapter, the book directly addresses the challenge I face in understanding code: *"Decoding your confusion while coding."*

Confusion is what I've been feeling all along. Often, I find myself perplexed when deciphering patterns, classes, methods, and variables. Occasionally, I even forget the purpose of a method or variable as I navigate through the codebase.

According to the author, before we can truly grasp code, we must understand the reasons behind our confusion.

To put it simply, there are three types of confusion when reading code:

- **Lack of knowledge:** Imagine reading code in a language you're not very familiar with. Every new syntax becomes a roadblock in your code-reading flow.

- **Lack of information:** Imagine reviewing code in a pull request on GitHub. You come across a method that requires you to navigate to another method to understand what it does. But you can't do it directly in the GitHub interface without the help of your editor. You don't have enough information.

- **Lack of processing power:** Think of a function where you understand every syntax and variable. But it involves calculations that are too complex to process mentally without writing down each step of the program.

These confusions stem from issues in different aspects of memory. Lack of knowledge relates to long-term memory (LTM), while lack of information relates to short-term memory (STM). On the other hand, lack of processing power refers to the working memory.

I find the metaphor used by the author quite insightful. It's like comparing LTM to the hard drive of a computer, STM to the RAM or cache, and the working memory to the brain's processor.


![Information filter flow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hq1qdmn4qdg2voisysjw.png)


So, whenever we read code, our brain utilizes various areas of memory. I guess to enhance our ability to read code, we need to train ourselves to better utilize these cognitive processes.
Advance Reusable Astro Components using Typescript
Tags: astro, typescript, webdev, react
Published: 2023-06-02 10:47:20

Perfect Pattern to built reusable component with typescript support, with few lines of code


## How would you add a **id** prop conditionally in Astro

In below example we are conditionally rendering the html based on id prop undefined or present.
Yet, from first look you may get intuition it's not the way!!!

```astro
---
type Props = { id?: string };
const { id } = Astro.props;
---
{id ? <h1 id={id}> ... </h1> : <h1> ... </h1>}
```

Problems such as adding more props like **class**, **style** you can't go on checking conditionally, so just let see how can we solve this issue,

## Using HTMLAttributes from **astro/types**

Below, snippet just provides us the HTMLAttributes type for **h1** and we used spread operator instead of doing `class={class}` or `style={style}` in pretty shorthand syntax.

```astro
---
import type { HTMLAttributes } from "astro/types";
export type Props = HTMLAttributes<"h1">;
---

<h1 {...Astro.props}>...</h1>
```

Yet, another problem which you might face is Astro by default binds the **slot** type with HTMLAttributes which is not needed So, we can fine tune it By using **Omit**

```astro
---
import type { HTMLAttributes } from "astro/types";
export type Props = Omit<HTMLAttributes<"h2">, "slot">;
---

<h1 {...Astro.props}>...</h1>
```

Okay, Bonus tip do you want to use **tailwindcss** without duplicating the styles in your reuseable component use [tailwind-merge](https://github.com/dcastil/tailwind-merge) for solving duplicate classes issue.

install tailwind-merge

```bash
# npm
npm i -D tailwind-merge
# pnpm
pnpm i -D tailwind-merge
# yarn
yarn add -D tailwind-merge
```

Now, Import it into your file

```astro
---
import type { HTMLAttributes } from "astro/types";
import { twMerge } from "tailwind-merge";
export type Props = Omit<HTMLAttributes<"h1">, "slot">;
const { class: className, ...attrs } = Astro.props;
---

<h1 class={twMerge("font-bold text-2xl dark:text-white text-slate-800", className)} {...attrs}>
    <slot />
</h1>
```

Use Reusable component in your code base with ease
MOT Checkpoint Concepts
Tags: opengauss
Published: 2023-04-20 07:39:28

In openGauss, a Checkpoints is a snapshot of a point in the sequence of transactions at which it is guaranteed that the heap and index data files have been updated with all information written before the checkpoint.

At the time of a Checkpoint, all dirty data pages are flushed to disk and a special checkpoint record is written to the log file.

The data is stored directly in memory. The MOT does not store its data it the same way as openGauss so that the concept of dirty pages does not exist.

For this reason, we have researched and implemented the CALC algorithm, which is described in the paper named Low-Overhead Asynchronous Checkpointing in Main-Memory Database Systems, SIGMOND 2016 from Yale University.

Low-overhead asynchronous checkpointing in main-memory database systems.

**CALC Checkpoint Algorithm – Low Overhead in Memory and Compute**

The checkpoint algorithm provides the following benefits –

**· Reduced Memory Usage** – At most two copies of each record are stored at any time. Memory usage is minimized by only storing a single physical copy of a record while it is live and stable versions are equal or when no checkpoint is actively being recorded.
**· Low Overhead** – CALC's overhead is smaller than other asynchronous checkpointing algorithms.
**· Uses Virtual Points of Consistency** – CALC does not require quiescing of the database in order to achieve a physical point of consistency.

Checkpoint Activation
MOT checkpoints are integrated into openGauss's envelope's Checkpoint mechanism. The Checkpoint process can be triggered manually by executing the CHECKPOINT; command or automatically according to the envelope's Checkpoint triggering settings (time/size).

Checkpoint configuration is performed in the mot.conf file – see the CHECKPOINT (MOT)section.
Comment utiliser le moteur de modèle EJS dans votre application Node.js
Published: 2023-06-02 10:39:17

Introduction

Bonjour, dans cet article, vous allez apprendre comment utiliser le moteur de modèle EJS dans une application Node.js/Express.

Qu’est-ce qu’un moteur de modèle ?
En général, chaque moteur de template utilise un langage différent pour définir un template HTML et y injecter des données. Il y a quelques moteurs de template autres que EJS comme:
Pug, Jade, Vash, Mustache, Dust.js, Nunjucks, …

Moteur de modèles EJS
EJS est l’acronyme de Embedded JavaScript Templates. Nous pouvons utiliser EJS à la fois du côté client et du côté serveur. Il peut également injecter des données dans un modèle HTML.

EJS Tags

<% %> Flux de contrôle
<%= %>Affichage
<%- %>Sortie brute non escamotée
Example:

```
<% if (user) { %>
<p><%= user.username %></p>
<% } %>
```

Utiliser EJS avec Express
Pour commencer à utiliser EJS comme moteur de modèle, nous devons d’abord installer EJS et Express :

```
npm i express ejs --save
```

Après avoir installé EJS et Express, la première chose à faire est de créer un serveur web en utilisant Express pour définir EJS comme notre moteur de vue.


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

Activer EJS comme moteur de template
Après l’avoir fait, nous devons créer un dossier views puisque EJS cherche dans le dossier ‘views’ les modèles à rendre. Après avoir créé le dossier, il faudra créer les fichiers avec l’extension .ejs exemple “index.ejs”.

Enfin vous pouvez écrire les codes HTML avec le balise de EJS et dynamiser nos contenus avec différentes fonctionnalités comme l’affichage, les conditions, boucles, etc

Conclusion
Pour résumer, EJS est un très bon moteur de template qui est fait pour Node.JS. Il est bon d’utiliser EJS pour les raisons suivantes :

Basique, facile à utiliser
Accélère la période de développement Web
Flexible


Merci de nous avoir lu !
URL rewrite in Asp.net Web Forms for Specific Pages
Tags: webdev, programming, productivity, aspdotnet
Published: 2023-06-02 10:21:44

In ASP.NET Web Forms, you can use URL rewriting to modify or prettify the URLs of specific pages. URL rewriting allows you to present cleaner and more user-friendly URLs to your website visitors while internally mapping those URLs to the actual physical pages on the server.

To implement URL rewriting for specific pages in ASP.NET Web Forms, you can follow these steps:

Step 1: Install the URL Rewrite module
If you haven't already installed the URL Rewrite module, you'll need to do so. You can download it from the official Microsoft website or through the Web Platform Installer.

Step 2: Configure the rewrite rule
Once the URL Rewrite module is installed, you can add rewrite rules to your web.config file to specify how the URLs should be rewritten.

```xml
<system.webServer>
  <rewrite>
    <rules>
      <rule name="Rewrite to Clean URL">
        <match url="^specific-page-url$" />
        <action type="Rewrite" url="actual-page.aspx" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>
```

In the above example, `specific-page-url` is the URL you want to present to the user, and `actual-page.aspx` is the physical page on the server that should handle the request. Adjust these values according to your specific requirements.

Step 3: Test the rewritten URL
Save the web.config file and test the rewritten URL in a browser. When a user navigates to `specific-page-url`, the server will internally route the request to `actual-page.aspx` without changing the URL displayed in the browser.

You can add multiple rewrite rules for different pages as needed. Make sure to adjust the URL patterns and corresponding physical pages in the rewrite rules accordingly.

Remember to also consider any SEO implications when implementing URL rewriting, such as maintaining proper redirection and avoiding duplicate content issues.

Note: URL rewriting in ASP.NET Web Forms is typically used for simple scenarios. For more complex routing requirements, you might want to consider using ASP.NET MVC or ASP.NET Core, which provide more advanced routing capabilities out of the box.