teleren/devto huggingface dataset:
Build a modern API with Slim 4 - Set up your filesystem
Tags: php, api, tutorial
Published: 2023-02-12 13:00:00

By now you should have a folder structure that looks a bit like the below:

```
- vendor
.env
.gitignore
composer.json
composer.lock
README.md - always a good idea to have one of these
```

You may notice something fairly major missing at this point: where do we actually write the scripts to actually run the API? Well here is where we set that up.

There is any number of differing schools of thought on how best to set up your filesystem for simplicity and ease of development and the world really doesn't need yet another person's opinion on that. So, here's my opinion on that!

At the very minimum, you will need a public directory containing index.php, this is what all requests will be processed through when they come to your API. For now though it needn't contain anything beyond the `<?php` opener.

```
- public
  - index.php
- vendor
.env
.gitignore
composer.json
composer.lock
README.md
```

In theory, this index file could contain everything: routes, controllers, modules, middleware, documentation, all of it. This can certainly be made to work, though I would not at all rate it highly on the ease-of-development scale!

Firstly I would certainly separate out the routes and controllers, in your root directory you can `mkdir src/routes src/controllers` in order to do that. What I end up with is below:

```
- aws
- config
- database
- docs
- encryption
- keys
- logging
- public
  - index.php
- src
  - controllers
  - middlewares
  - routes
  - schemas
  - scripts
  - utils
- vendor
.env
.gitignore
composer.json
composer.lock
README.md
```

Some of the above will be fairly obvious as to what they will do: `src` is your source code (well, it all is in a sense), logging is where we'll build a logging module unless you install one with Composer. Many options are available but I have built my own so that will be part of this series. If you've guessed that `aws` means connecting to AWS you'd be correct, do you need to do this? Of course not, but again, I have. Next we'll get possibly the shortest bit out of the way: generating the keys to go into the keys folder, and just what they're for.
Learn Prisma Easy Way
Tags: javascript, prisma, node, beginners
Published: 2023-02-12 12:47:15

**After sequlize ORM Tutorial, I have created another video about prisma ORM.**

if you use prisma then easily you can able to design a database and interact with database, so  prisma will be really helpful in your next project.
 prisma allow us to make relationship very easily.
Video link:- https://youtu.be/vGenO_2sxqg
How to Improve Node.js Application Performance
Tags: webdev, javascript, programming, tutorial
Published: 2023-02-12 12:39:25

Node.js has become a popular choice for building server-side applications, thanks to its fast performance and easy-to-use JavaScript runtime environment. However, as applications grow in size and complexity, performance can become a concern. In this article, we'll take a look at how you can improve the performance of your Node.js applications.

- **Use a Production-Ready Server**

Node.js is typically used in development environments, where performance is not a primary concern. However, when you deploy your application in a production environment, you need to use a production-ready server that can handle the increased traffic and demands. For example, you can use a load balancer to distribute incoming requests across multiple servers, or use a reverse proxy server to cache frequently-accessed data.

- **Use Async Functions**

Node.js uses an event-driven, non-blocking I/O model, which makes it possible to handle a large number of concurrent requests. To take full advantage of this model, you should use async functions in your code. Async functions allow you to write asynchronous code that runs in the background, without blocking the main event loop. This can significantly improve the performance of your application, especially in situations where you need to perform I/O-bound or CPU-bound operations.  

- **Optimize Database Queries**

If your application uses a database, it's important to optimize your database queries to minimize their impact on performance. This can include using indexes to speed up query times, caching frequently-used data, and avoiding complex joins or subqueries. You can also consider using a caching layer, such as Redis or Memcached, to cache frequently-accessed data and reduce the load on your database.   

- **Use a CDN**

A Content Delivery Network (CDN) is a network of servers that deliver content to users based on their geographical location. By using a CDN, you can reduce the load on your server and improve the performance of your application. A CDN can cache static assets, such as images and videos, and deliver them to users from the nearest server. This can significantly improve the loading time for your users, especially for those who are located far from your server.   

- **Monitor Performance**

Finally, it's important to monitor the performance of your application and identify bottlenecks that are affecting performance. You can use tools like New Relic, AppDynamics, or Datadog to monitor your application and identify areas that need improvement. You can also use performance profiling tools, like the built-in Node.js profiler, to identify slow functions and optimize them.

In conclusion, there are several steps you can take to improve the performance of your Node.js applications. By using a production-ready server, optimizing your database queries, using a CDN, and monitoring performance, you can ensure that your application is fast and efficient, even as it grows in size and complexity.

Thanks for reading...

**Happy Coding!**
fairy cat : the new crypto game
Published: 2023-02-12 12:37:50

Fairy Cat is a sub-project of the "Save every cat in the world" project initiated by Japanese cat lover Rock. It is developed by Kia Game Studio team. A kind of blockchain game.
In Fairy Cat Forest, you can let your elven cats find treasures for you. These treasures will become your assets in Fairy Cat Forest. Your assets can be converted to dollars at any time. Withdraw your assets, we hope your proceeds in the game can be used to save the stray cats or other stray pets around you, treat every pet around you sincerely!
All proceeds from this project will be used to save stray cats on the street, buy cat food and provide cat nests for them, under the supervision of players
The sacred tree, the home of the elven cats
On a small hill in the Elven kingdom, there is a sacred oak tree called the Divine Tree, a giant tree with nine roots that connects the nine worlds of the universe. One goes to the Land of Fire, one to the Land of Fog, one to the Land of the Gods of Warner, and one to the Land of the Gods of Assa. There is also the Land of the Light Elves, the Land of the Dark Elves, the World of the Dwarves, the Land of the Giants, and the Land of the Dead. The land of the gods of Assa is connected to the human world by a rainbow of fire.
The sacred trees are guarded by elven cats, and each green tree canopy becomes the home of an elven cat.
Divine Tree Essence
What is the divine tree essence?
The sacred tree essence is one of the very important sources of the nutrition for the elven cats, and they are produced from the sacred trees in the elven kingdom. Elf cats will grow by absorbing this essence, and will produce baby elves and sometimes rare treasures after each absorption. The essence is also essential for fusing into a new generation of elven cats.
How to have the sacred tree essences?
These sacred tree essences will be harvested every day according to your play, and each VIP level will have a different quantity of them!

Fairy Cat  is a promotional game where you get paid to invite your friends to play the game and get paid a percentage of the hosting fee.
Why I decided to create my photo organizer
Tags: ir, media, photoorganizer, product
Published: 2023-02-12 12:31:37

As a child, I used to flip through family photo album to see my relatives whom I had not seen in real life.

At that time we had film cameras only, so the number of photos was not so large.

Time has passed and currently, let's say, almost everyone owns a camera or a smartphone with a camera, or even both.
Given that, the size of my photo album increased significantly. However, I think it's not just for me.

![An average photo album](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/42z077ryqc5ddn4vluly.gif)

Once my friend and me decided to recall an event we both attended. We took my photo album and tried to search there. 
That time my album kept more than 30 thousand items inside. That search process looked like

![A search in photo album with 30 thousand photos](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lalobjp1kji81g6ldpc3.gif)

Of course, we didn't find anything. Therefore, I started looking for a solution to be able to search in [Multimedia Data](https://github.com/dimanikulin/dimanikulin/blob/master/MultimediaData.md) in an automatic way. 
The solution I found were [Multimedia IR systems](https://github.com/dimanikulin/dimanikulin/blob/master/MultimediaIRSystems.md). 

I decided to use [digiKam](https://www.digikam.org/) as Offline [Multimedia IR systems](https://github.com/dimanikulin/dimanikulin/blob/master/MultimediaIRSystems.md) 
and [Synology Moments](https://www.synology.com/en-global/dsm/feature/moments) as Online [Multimedia IR systems](https://github.com/dimanikulin/dimanikulin/blob/master/MultimediaIRSystems.md).
Please note, that they were selected solely based on author's criteria, and there is no aim to advertise anyone.

Then I started using it... 

What I discovered in a flash is that current [Multimedia IR systems](https://github.com/dimanikulin/dimanikulin/blob/master/MultimediaIRSystems.md) do not provide a flexible and automated functionality to import [Multimedia Data](https://github.com/dimanikulin/dimanikulin/blob/master/MultimediaData.md) into [Multimedia IR systems](https://github.com/dimanikulin/dimanikulin/blob/master/MultimediaIRSystems.md).

But that wasn't the only problem.

I realized that I need [Multimedia Organizer](https://github.com/dimanikulin/dimanikulin/blob/master/MultimediaOrganizers.md) as well.
Unfortunately, I didn't find a [Multimedia Organizer](https://github.com/dimanikulin/dimanikulin/blob/master/MultimediaOrganizers.md) that could fully satisfy my needs (fixing problem metadata, working with **digiKam** and **Synology** etc.)
That's why I started creating my [own product](https://github.com/dimanikulin/fva) to cover my needs. 

Honestly, I didn't expect that it would be so hard and in the meantime so interesting.
Features of Apache AGE
Tags: apacheage, graphdatabase
Published: 2023-02-12 12:22:13

The key features of Apache AGE are given below:

**Graph Database Plugin for PostgreSQL**
Gain access to query and visualize graph data in a PostgreSQL compatible relational database.

**Hybrid Queries (OpenCypher And SQL)**
Hybrid query technology simultaneously performs the queries for relational data and graph data.

**Fast Graph Query Processing**
Achieve both fast indexing and efficient query processing.

**Graph Visualization and Analytics**
Provides visualization of graph and relational data for clearer understanding of data.

For more details visit:     https://age.apache.org/overview/

**AGE Github Link:**        https://github.com/apache/age

**AGE Viewer Github Link:** https://github.com/apache/age-viewer
Multiple watchers in Vue 3
Tags: vue, codenewbie, javascript, womenintech
Published: 2023-02-12 12:18:39

In Vue 3, you can use the watchEffect function to create a watcher that automatically tracks the reactive dependencies of a component. To create multiple watchers, you can use watchEffect in combination with the watch function. Here's an example of how to use multiple watchers in Vue 3:


```js
<template>
  <div>
    <input v-model="name" />
    <input v-model="email" />
  </div>
</template>

<script>
import { ref, watchEffect, watch } from 'vue';

export default {
  setup() {
    const name = ref('');
    const email = ref('');

    // First watcher using watchEffect
    watchEffect(() => {
      console.log('Name changed: ', name.value);
    });

    // Second watcher using watch
    watch(email, (newValue, oldValue) => {
      console.log('Email changed: ', newValue, oldValue);
    });

    return {
      name,
      email,
    };
  },
};
</script>

```

In this example, the watchEffect function is used to create a watcher that logs to the console whenever the name property changes. The watch function is used to create a second watcher that logs to the console whenever the email property changes.

By using watchEffect and watch together, you can create multiple watchers that track different reactive dependencies in your component. Note that the watch function is useful when you want to watch a specific property or set of properties, whereas watchEffect will watch all reactive dependencies.


Happy Reading...... :heart: :unicorn:

Follow me, for more updates

{% embed https://dev.to/snehalkadwe %}
What is Apache AGE?
Tags: apacheage, graphdatabase, database, multimodeldatabase
Published: 2023-02-12 11:55:08

Apache AGE was under development since 2019 by a team of engineers at Bitnine Global Inc. The project, originally born out of AgensGraph, a multi-model graph database fork of PostgreSQL, was donated to the Apache Software Foundation and entered incubation in April 2020.

**What is Apache AGE?**
Apache AGE is a PostgreSQL extension that provides graph database functionality. The goal of Apache AGE is to enable Postgres users to gain access to graph query modeling in Postgres’ existing relational model. Apache AGE is a Top-Level Project of the Apache Software Foundation since May 2022. It is licensed under the Apache License 2.0. Apache AGE will be compatible with all relational databases in the future development, starting with MariaDB and MySQL.

**What is Apache AGE Viewer?**
Apache AGE Viewer is a web user interface for Apache AGE that provides data visualization and exploration. Users can enter complex graph queries and explore the results expressed in graph and table data. Apache AGE Viewer handles large graph data. Users will be able to discover meaningful insights with the help of various graph algorithms. Apache AGE Viewer will serve as a central graph data management & development platform for Apache AGE.
For more details visit:     https://age.apache.org/overview/

**AGE Github Link:**        https://github.com/apache/age

**AGE Viewer Github Link:** https://github.com/apache/age-viewer
Day 1 - Programming Fundamental
Tags: dsa, programming, beginners
Published: 2023-02-12 11:45:10

Programming Fundamentals
Thought process to solve a problem

- Understand the problem
- Check inputs in problem
- Final approach

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

**Flowchart**
Flowchart is a graphical representation of an algorithm. Programmers often it use as a program planning tool to solve a problem. It makes use of symbols which are connected among them to indicate the flow of information and processing. The process of drawing a flowchart for an algorithm is known as “Flowchart”

**Component of flowchart**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/njgljpv0ctsuskj4dqa6.png)

**Pseudocode**
Pseudocode is a detailed yet readable description of what a computer program or algorithm must do expressed in a formally-styled natural language rather than in a programming language. Pseudocode is sometimes used as a detailed step in the process of developing a program.

**Ex**
1. Write a pseudocode for difference of two number

```
Step 1: start
Step 2: declear a, b and diff
Step 3: read a and b
Step 4: diff = a – b
Step 5: end
```

2. Write pseudocode to print average of 2 values

```
Step 1: start
Step 2: declear a, b and avg
Step 3: read a and b
Step 4: avg = a + b / 2
Step 5: end
```

**Problem statement on above two topics**

**Ex:** 
1. Add 2 number by taking input

Flowchart

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3x3xkc9w0sj1n94dunl.png)
Pseudocode
```
Step 1: start
Step 2: declear a, b, sum
Step 3: sum = a + b
Step 4: print sum
Step5: end
```

2. Find circumference of a circle
Flowchart

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vq6ej48cvzpihhpjgbq4.png)
Pseudocode
```
Step 1: start
Step 2: declear r, cir
Step 3: cir = 2 * 3.14 * r
Step 4: print cir 
Step 5: end
```

3. Check number is even or odd
Flowchart

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12nfegl070kpq8e6f9mf.png)
Pseudocode
```
Step 1: start
Step 2: declear n
Step 3: if n % 2 = 0 then print even
	  Else print odd
Step 4: end
```

4. Student and grade flowchart
Flowchart

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ts0um353tcqjpo04n10s.png)
Pseudocode
```
Step 1: start
Step 2: read n
Step 3: if n >= 90 then print A
    	  Else if n >= 80 then print B
	  Else if n >= 60 then print C
	Else if n >= 40 then print D
	Else print F
Step 4: end
```

**Homework ( In this homework you only need to draw flowchart and write pseudocode of following questions )**

- Multiply 2 number by taking input
- Find parimeter of a Triangle
- Find Simple Intrest
- Print counting from N to 1
- Find Factorial of a number
- check prime or not
- valid triangle or not
- printing 1 to n but only even numbers
- print max of three numbers
How to Fix the "dyld: lazy symbol binding failed" Error When Using PostgreSQL and Ruby on macOS
Tags: ruby, postgres, macos, devops
Published: 2023-02-12 11:39:37

---
title: How to Fix the "dyld: lazy symbol binding failed" Error When Using PostgreSQL and Ruby on macOS
published: true
description: A guide on how to fix PG gem installation issues when working with PostgreSQL on macOS.
tags: Ruby, PostgreSQL, macOS, DevOps
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-12 11:31 +0000
---

If you're working with Ruby and PostgreSQL on macOS, you may run into issues installing the PG gem. This is due to the fact that the gem relies on the PostgreSQL library, which can be difficult to link with on macOS.

One common issue that you may encounter is a "lazy symbol binding failed" error message. This indicates that the gem is unable to locate the libpq library, which is required for the gem to function properly.

```ruby
dyld: lazy symbol binding failed: Symbol not found: _PQresultMemorySize
  Referenced from: /path/to/gems/pg-1.x.x/lib/pg_ext.bundle
  Expected in: /usr/lib/libpq.5.dylib
```

## Solution

To fix this issue, you can run the following command:

```
gem pristine pg
```

This command will rebuild the PG gem and link it with the libpq library on your system. Once this is done, you should be able to use the PG gem without any issues.

## Conclusion

Working with PostgreSQL on macOS can be tricky, but with the right tools and knowledge, you can overcome any issues that you may encounter. By following the steps outlined in this guide, you should be able to resolve any PG gem installation issues that you may encounter.
Database Notification in Laravel 9
Tags: beginners, php, codenewbie, laravel
Published: 2023-02-12 11:36:07

**Hello Artisans,**

In this blog post we will see what is database notification and how to use it?

In Laravel, **Database Notifications** is a feature that allows you to store notifications in a database, rather than sending them immediately to a user's device. This feature is useful when you need to notify users about events that occurred while they were away from their device or that they may want to access at a later time.

When you use database notifications, you can retrieve notifications for a user and display them on a website or mobile application, or send them in a single email summary. This way, users can access notifications when they have time, rather than being distracted by them when they arrive.

Here's an example of how to use database notifications in Laravel:

- **Define the notification:** Create a new notification class by running the php artisan make:notification command. The notification should have a via method that specifies the channels to use, and a toDatabase method that defines the notification data to store in the database.

```php
php artisan make:notification NewMessageNotification
```

- **Send the notification:** Send the notification to the desired user or users using the notify method on the user object. For example:

```php
$user = User::find(1);
$user->notify(new NewMessageNotification($message));
```

- **Retrieve the notification:** To retrieve the notification for a user, you can use the notifications relationship on the user object, or query the notifications table directly. For example:

```php
$notifications = $user->notifications;
```

Overall, database notifications in Laravel provide a convenient way to manage and deliver notifications to users, and they are particularly useful for applications that want to keep users updated with information that may be important but not urgent.


**Happy Reading...** :heart: :unicorn:
tsParticles 2.9.1 Released
Tags: javascript, typescript, showdev, webdev
Published: 2023-02-12 11:23:21

## tsParticles 2.9.1 Changelog

### Bug Fixes

- Fixed missing plugins in wordpress component
- Fixed confetti bundle package.json
- Fixed confetti.create function in confetti bundle

### Confetti Website

Starting from `2.9.0` there are two new bundle for easier configurations:

- `confetti`, the demos are available [here](https://confetti.js.org/more.html), readme [here](https://github.com/matteobruni/tsparticles/tree/main/bundles/confetti#readme)
- `fireworks`, a demo website is not ready yet, but the readme contains all the options needed [here](https://github.com/matteobruni/tsparticles/tree/main/bundles/fireworks#readme)

--

## v3.0

Probably this will be the last `v2.x` version, except some bug fixes needed before `v3.0` will be released.

You can read more about the upcoming `v3.0` in the post linked below

{% link https://dev.to/tsparticles/preparing-tsparticles-v3-5bai %}

--

## Social links

- [Discord](https://discord.gg/hACwv45Hme)
- [Slack](https://join.slack.com/t/tsparticles/shared_invite/enQtOTcxNTQxNjQ4NzkxLWE2MTZhZWExMWRmOWI5MTMxNjczOGE1Yjk0MjViYjdkYTUzODM3OTc5MGQ5MjFlODc4MzE0N2Q1OWQxZDc1YzI)
- [WhatsApp](https://chat.whatsapp.com/KQyHc9UEbRc2qlqNQR2J5c)
- [Telegram](https://t.me/tsparticles)
- [Reddit](https://www.reddit.com/r/tsParticles/)

---

{% github matteobruni/tsparticles %}