teleren/devto huggingface dataset:
How to set port in Next.js
Tags: nextjs, react
Published: 2023-04-09 08:09:03

By default, when you run `npm run dev`, it will start the Next.js app in port 3000. There can be times when port 3000 is used by another application or you have a requirement to start the server in another port.
We will see how to achieve it in this article.

{% embed https://youtu.be/LHswg5Azi8c %}

## Creating a Next.js Project

First, create a new Next.js project using the following command:

```bash
npx create-next-app@latest next-set-port
```

## Updating the port

Now let's say you want to change the port to 8090. You can open the `package.json` and update the `dev` script as follows:

```json
"dev": "next dev -p 8090",
```

Now if you run `npm run dev`, you should be able to access the app at http://localhost:8090.

## Setting the port for production build

If you want to run the project in a different port after it is built (after running `npm run build`),
you can do so by updating the `start` script:

```json
"start": "next start -p 8090",
```

Now you can run `npm start` to see the page served at port 8090.
Meningkatkan Penghasilan dengan Menggunakan Aplikasi Penghasil Uang Tanpa Paypal
Published: 2023-04-09 08:00:08

Tingkatkan pemasukan dgn memakai aplikasi penghasil duit tnpa PayPal bisa jadi metode yg efisien buat menciptakan duit bonus dengan cara online. Tetapi, semacam perihalnya dgn bidang usaha apa juga, berarti buat mempunyai strategi serta konsep yg pas buat tingkatkan pemasukan Kamu.

Salah satu metode terkeren buat tingkatkan pemasukan dgn aplikasi penghasil duit tnpa PayPal merupakan dgn mengutip profit dri bermacam ajuan yg ada. Bnyk aplikasi penghasil duit menawarkan ajuan hadiah buat menuntaskan kewajiban khusus, semacam memuat survey, memainkan permainan, ataupun mendownload aplikasi lain. Dgn menggunakan ajuan ini dengan cara efisien, konsumen bisa menciptakan terlebih bnyk duit dgn kilat.

Tidak hanya itu, mengutip durasi buat menjelajahi aplikasi penghasil duit yg berlainan bisa menolong konsumen menciptakan aplikasi dgn ajuan terkeren serta pembayaran paling tinggi. Sebagian aplikasi bisa jadi menawarkan terlebih bnyk kewajiban ataupun survey yg bisa dituntaskan, sebaliknya yg lain bisa jadi mempunyai sistem nilai yg terlebih besar ataupun tingkatan pembayaran yg terlebih besar. Dgn mengenali aplikasi yg sangat profitabel, konsumen bisa mengoptimalkan pemasukan mereka.

Tidak hanya itu, membuat nama baik serta keyakinan di antara konsumen **[aplikasi penghasil uang tanpa PayPal](https://lastekno.com/aplikasi-penghasil-uang-tanpa-paypal/)** pula bisa menolong tingkatkan pemasukan. Dlm sebagian aplikasi, konsumen bisa memperoleh tambahan ataupun hadiah bonus dgn mereferensikan sahabat ataupun keluarga ke aplikasi itu. Dgn mengiklankan aplikasi serta merekomendasikannya pada orang lain, konsumen bisa mendapatkan hadiah bonus serta meluaskan capaian mereka dlm aplikasi itu.

Terakhir, semacam dlm bidang usaha apa juga, ketabahan serta kestabilan bisa menolong tingkatkan pemasukan dgn aplikasi penghasil duit tnpa PayPal. Dgn lalu melakukan kewajiban serta survey dengan cara tidak berubah- ubah serta menggunakan ajuan serta hadiah yg ada, konsumen bisa dengan cara berangsur- angsur tingkatkan pemasukan mereka dri aplikasi penghasil duit. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/977l44e5k9ov5bk4528s.jpg)
Arduino flip flop #1
Tags: arduino
Published: 2023-04-09 07:48:15


![flip flop demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ye3dq8sefpkbet2lr9x9.GIF)

Berikut kode untuk membuat rangkaian flip flop seperti gambar diatas.

```c
void setup () {
   digitalWrite(0, HIGH);
   digitalWrite(7, HIGH);
}

int curr = 0;
int isUp = 1;

void loop() {
   delay(500);
   if(curr==0) isUp =1;
   if(curr==3) isUp = 0;
   digitalWrite(curr, LOW);
   digitalWrite(7-curr, LOW);
   if(isUp) {
      curr++;
   } else {
      curr--;
   }
   digitalWrite(curr, HIGH);
   digitalWrite(7-curr, HIGH);
}
```

Cara kerjanya pertama pin 0 dan pin 7 akan menyala, lalu akan looping increment hingga pin ke - 3. Setelah sampai posisi pin 3 maka akan looping ke bawah dan seterusnya,
Controlling External Libraries: Why It's Important for Developers
Published: 2023-04-09 07:45:42

As a developer, it's important to have control over the external libraries that you use in your projects. One way to achieve this is by wrapping those libraries into self-created facades.

A facade is a design pattern that provides a simplified interface to a complex system. In the context of external libraries, a facade acts as a wrapper around the library's API, providing a simpler and more consistent interface to the library. By creating a facade for an external library, you can gain the following benefits:

1. **Independence from the library's API:** By using a facade, you can shield your code from changes to the external library's API. This means that if the library changes its API in a future version, you only need to update your facade to accommodate the changes, rather than updating all the code that uses the library directly.
2. **Control over changes:** When you wrap an external library in a facade, you have complete control over how you use the library. This means that you can choose which parts of the library to expose to your code, and how you want your code to interact with those parts. You can also add additional functionality to the facade, such as caching or error handling, without affecting the rest of your code.
3. **Improved code maintainability:** By using a facade, you can simplify your code and reduce its complexity. This makes it easier to maintain in the long term, as well as easier for other developers to understand and work with.

In addition to these benefits, there are several other reasons why you might want to create a facade for an external library. For example:

- **Testing:** By using a facade, you can mock the external library's API in your tests, making it easier to write and maintain your test suite.
- **Security:** By controlling how your code interacts with an external library, you can reduce the risk of security vulnerabilities caused by unexpected interactions with the library.
- **Performance:** By creating a custom facade, you can optimize the library's usage to improve the performance of your code.

If you create a simpler and more consistent way to use an external library, it can help you manage your code better. 

Therefore, it is recommended that you wrap all your external libraries in facades to achieve these benefits.
How to Add CI/CD using Github Action in a Project.
Tags: githubactions, gatsby, firebase, automation
Published: 2023-04-09 07:00:36

Developers Life is always need a shortcut. In my development journy I was using manual deployment of my own projects. That's very time taking and repetable work for me. Then I go through and search for the internet about CI/CD and I come to know that we can use Github action for automate our build and deploy process.
Before this I done this work in these steps manually:

1. First Commit my code to github
2. Then make a build in local
3. Then finally run deploy command

so, By the help of Github action I skip the last two steps, I just have to only push my code to my github and rest of the work will manage by the Github Actions.

In this blog I am writing a begginer guide to start with Github action implementation in your project.

For making any github action you have to make a folder called `.github` in your root directory. Inside that folder make a new folder and named it `workflows`. Inside Workflows folder you can define your github action file using `.yml extension`.

I make a file: .github/workflows/deploy.yml

```
name: Gatsby Build and Firebase Deploy

on:
  push:
    branches:
      - main

jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Use Node.js
      uses: actions/setup-node@v2
      with:
        node-version: '16.x'

    - name: Install dependencies
      run: |
        yarn install

    - name: Build Gatsby project
      run: |
        yarn build

    - name: Deploy to Firebase Hosting
      uses: w9jds/firebase-action@v1.4.0
      with:
        args: deploy --only hosting --token ${{ secrets.FIREBASE_TOKEN }}

```

This workflow will trigger whenever there is a push to the 
`main branch`. It checks out the code, installs the necessary dependencies, builds the Gatsby project, and then deploys the project to Firebase Hosting.

Make sure to replace `${{ secrets.FIREBASE_TOKEN }}` with your own Firebase token, which you can create in the Firebase console. You'll also need to make sure that your Firebase project is properly set up for hosting, and that the necessary Firebase CLI tools are installed.
What Makes Working in Tech Truly Rewarding?
Tags: discuss, beginners, codenewbie
Published: 2023-04-09 07:00:00

Working in tech offers the opportunity to solve real-world problems and make a difference in people's lives. It also provides continuous learning and growth opportunities due to new technologies and advancements. Additionally, collaborating with like-minded individuals who share the passion for technology and innovation can be a rewarding and fulfilling experience. 

What do you find most rewarding about working in tech?

---

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more engaging, thought-provoking, and sometimes silly discussions just like this.
K3S Node Status (NotReady)
Tags: kubernetes, k3s, k8s, kubelet
Published: 2023-04-09 06:56:24

K3S is a lightweight production grade kubernetes platform.
Its light weight because a lot of unnecessary components have been removed; the unnecessary components include cloud providers, beta features, defaults and the deployment runs in a single binary.

Having a single binary makes the deployment a whole lot easier. And now back to the topic of discussion.

NotReady status can be caused by a lot of things, it might be that the node was initially connected to the cluster but is no longer able to communicate with the cluster or the underlying machine is not active. This can be fixed by either starting up the machine if it's off or making sure that the node is able to establish two communication with other nodes in the cluster. This in most cases will turn out to be the underlying host machines networking.

If upon checking on the machine, and it turns out that the machine is running and network connectivity is just fine. Check on the status of the node status using `kubectl`.

```bash
kubectl describe node <node-hostname>
```

The above command gives an very verbose out put of the state of the node. Among the things to look out for in this output are, memory pressure, disk pressure, PID pressure.

A pressure in any of the above can cause the kubelet to fail to run and hence, the node not being usable.

If you notice that the kubelet is not able to start due to memory pressure or CPU & memory limits going going beyond 100%. This is a sign of over-committing resources on your node. This happens when the sum of all Kubernetes resource limits is bigger than the capacity of that resource. When you are over-committing resources in your cluster, everything might run perfectly in normal conditions, but in high load scenarios, the containers could start consuming CPU and memory up to their limit. And in some instances make your node unavailable.

To make your node available with over-committed resources, you'll need to allow this in your kernel, by creating a file in `/etc/sysctl.d`, lets call this file `/etc/sysctl.d/50-kubelet.conf`. In that file, add the following:

```conf
kernel.panic=10
kernel.panic_on_oops=1
vm.overcommit_memory=1
```
To enble the changes just added, execute:

```bash
sysctl --system -p
``` 

After this, restart the k3s daemon if need be (K3S is set to auto-restart by default).

Another issue that might bring up such an issue is the the `invalidDiskCapacity 0`. This is just a warning that normally clears up after sometime, but during the time it shows up, the node wont be available. For further debugging check the github issue [#1857](https://github.com/k3s-io/k3s/issues/1857).

While the above will allow the node to be available with over-committed resources, this is not good practice. To solve this issue you might need to add compute resource limits in your service deployment files that are well within your nodes range.

An even better approach is to set the limits with role(s)/clusterRole(s) so pods cannot use more than allocated.
Comparing Graph Analytics Tools: A Deep Dive into Apache Age and NetworkX
Tags: apacheage, postgres
Published: 2023-04-09 06:47:37

Graph analytics is a rapidly growing field with many tools and frameworks available for working with graphs. Two popular graph analytics tools are Apache Age and NetworkX. While both tools can be used for graph analytics, they have different strengths and weaknesses. In this blog post, we will provide a comprehensive comparison of Apache Age and NetworkX.


**Apache AGE** 
It is an extension for PostgreSQL that enables users to leverage a graph database on top of existing relational databases. The basic principle of the project is to create a single storage that handles both the relational and graph data model so that the users can use the standard ANSI SQL along with openCypher, one of the most popular graph query languages today. Inspired by Bitnine's AgensGraph, a multi-model database fork of PostgreSQL, AGE aims to provide an efficient and flexible platform for storing and querying graph data.
What is NetworkX?

**NetworkX** 
It is a Python library for working with graphs. It provides a set of tools for constructing, analyzing, and visualizing complex networks. NetworkX supports various graph types, including directed and undirected graphs, weighted and unweighted graphs, and bipartite graphs. It also includes algorithms for graph analytics, such as centrality measures, clustering, and community detection.

Comparison of Apache Age and NetworkX

Now let's compare Apache Age and NetworkX based on several criteria:

Scalability: Apache Age is designed for large-scale graphs and can distribute computation across a cluster of machines. NetworkX is a single-machine library that can handle graphs up to a few million nodes.

Performance: Apache Age can handle large-scale graphs with high performance due to its distributed architecture. NetworkX is a single-machine library that can be slower for large-scale graphs.

Language Support: Apache Age supports Gremlin traversal language and can be used with various programming languages, including Java, Python, and Scala. NetworkX is a Python library.

Ease of Use: NetworkX is easy to use and has a simple API that makes it easy to construct and analyze graphs. Apache Age has a steeper learning curve due to its distributed architecture and query language.

Functionality: NetworkX provides a comprehensive set of graph analytics algorithms and tools, including centrality measures, clustering, and community detection. Apache Age provides more advanced graph analytics, such as subgraph isomorphism and shortest path algorithms.

**Conclusion**

Apache Age and NetworkX are both useful tools for graph analytics, but they have different strengths and weaknesses. Apache Age is designed for large-scale graphs and provides advanced graph analytics, but has a steeper learning curve. NetworkX is easy to use and provides a comprehensive set of graph analytics algorithms, but has limited scalability. Depending on your needs, you may choose one tool over the other.
Forget Selenium or any automation library - this is what you need!
Tags: webdev, automation, gpt3
Published: 2023-04-09 05:58:31

if you are on linux set as: `_PLATFORM` as linux [By default is `windows`]

- 4. Run this file `main.py` by passing your query.

```py

python main.py

```

- 5. Use `SingularGPT` bot if you are stuck or raise a issue

- 6. Make sure your instructions are in `script.py` file.


## :star2: Quickstart

Create a `.env` file with `OPENAI_API` and place your openai_api api there or pass as environment variable.

Put automation scripts in `script.py` and run it.

Write your prompt query in `Prompts/prompts.txt` file or,
pass as a string in the `main.py` file.

```py
# Run the main script.
python main.py
```

---


**To visualize this see this bot on Poe**

![](https://user-images.githubusercontent.com/64596494/230727123-b01d6607-9f08-4abe-ae00-bda1eacbc5bf.PNG)


![djlkdj](https://user-images.githubusercontent.com/64596494/230751800-1100bfa5-f9a7-4971-9224-6f0c442b5df1.PNG)


Project: [https://github.com/abhiprojectz/SingularGPT](https://github.com/abhiprojectz/SingularGPT)

---
How to migrate from a relational database to a graph database: best practices and considerations using apache AGE
Tags: apacheage
Published: 2023-04-09 05:22:13

Migrating from a relational database to a graph database can be a complex process, but it can also bring significant benefits in terms of scalability, performance, and flexibility. Apache AGE (Apache Graph Extensions) is an open-source graph database that supports the Apache TinkerPop API, making it a popular choice for organizations looking to make the switch. In this article, we will explore best practices and considerations for migrating from a relational database to Apache AGE.

### Identify use cases and data requirements
The first step in migrating to a graph database is to identify the use cases and data requirements that the new database will need to support. Graph databases excel at modeling complex relationships between entities, so it is important to determine which relationships are critical for your business and how they will be represented in the new database.

### Plan the data model
Once the use cases and data requirements have been identified, the next step is to plan the data model for the new graph database. This involves identifying the entities and relationships that need to be modeled and determining how they will be represented as nodes and edges in the graph. Apache AGE supports the Gremlin query language, which can be used to define the schema for the new database.

### Extract and transform data
After planning the data model, the next step is to extract the data from the existing relational database and transform it into the new graph format. This involves mapping the data from the relational schema to the graph schema and creating nodes and edges in the new database. Apache AGE supports bulk loading of data, which can make the migration process more efficient.

### Test and optimize queries
Once the data has been migrated to the new graph database, the next step is to test and optimize queries to ensure that the new database is performing as expected. Graph databases are optimized for certain types of queries, such as those that involve traversing relationships between entities. It is important to test these queries and make adjustments as needed to ensure that they are performing efficiently.

### Plan for ongoing maintenance and updates
Finally, it is important to plan for ongoing maintenance and updates to the new graph database. This may involve implementing data governance policies, monitoring performance and capacity, and updating the data model as needed to reflect changes in the business.

In conclusion, migrating from a relational database to a graph database can be a complex process, but it can also bring significant benefits in terms of scalability, performance, and flexibility. Apache AGE is a popular choice for organizations looking to make the switch, and following best practices and considerations such as those outlined in this article can help ensure a successful migration.
Design pattern (part 1): Wait, pattern ?
Tags: designpatterns, beginners
Published: 2023-04-09 04:11:38

A pattern in design ? What are you talking about ?

Hey, let me tell you a little secret. As a beginner, one of the best ways to enhance your skills as a software engineer is to learn design patterns. They can make your code more flexible, maintainable, and easier to change or fix.

With the "why" out of the way, let's jump to the "how"!

## What ***exactly*** does a design pattern do ?

Think of a spoon.

Is it the best tool you can use to stir your coffee ? Yes.

Are there only one way to stir your coffee using the spoon ? No.

Design patterns are the same.

They are a proven way to solve a particular problem.

They have a certain idea behind them to solve that particular problem, but the idea can be applied in many different ways.

## Okay, but what does it look like ?

The descriptions of these patterns are usually formalized to enable their application in various contexts. They are usually described in the following way:

- **Intent**: What is the problem that the pattern is trying to solve ? What is the general idea behind the pattern ?
- **Motivation**: Explain the problem in more detail, and why the pattern is a good solution.
- **Structure**: Describe the structure of the pattern, and how it is implemented.
- **Example**: Provide a code example of the pattern in action.

## What are the most common design patterns types ?

Most common design patterns are divided into three categories:
- Creational patterns: The idea behind these patterns is to create objects in a controlled way so that the characteristics of the objects are suitable for the problem at hand.
- Structural patterns: The idea behind these patterns is to make it easier to design systems by identifying a simple way to realize relationships between entities.
- Behavioral patterns: The idea behind these patterns is to make the communication between objects more flexible and efficient.

In this post, we have discussed about design pattern definition, roles and types. We will dive deeper in the most common patterns in the next posts. Stay tuned!
How to get the size a file or folder in bytes
Tags: python
Published: 2023-04-09 05:01:57

It is extremely easy to get the size of a file in python.

```
import os
if os.path.isdir(file_dr):
   size = str(get_size(file_dr))

else:
   
   size = str(os.path.getsize(file_dr))
print(size)
```
How to get the type of a file or folder in python
Published: 2023-04-09 04:58:14

Hey:)
It is very easy to get the file type using os
you can get it by the following code snippet

```
import os
if os.path.isdir(file_dr):
   file = "folder"
else:
   file_ = name.split(".")
   file = repr(file_[-1])
print(file")
```