teleren/devto huggingface dataset:
FDW Performance in PostgreSQL: An Overview
Tags: apacheage, postgres
Published: 2023-07-12 17:01:50

To utilize the Foreign Data Wrapper (FDW) feature in PostgreSQL, you need to install the relevant extension and execute setup commands, including creating foreign tables, servers, and user mappings. For detailed instructions, refer to the official PostgreSQL documentation.

Once the necessary settings are in place, the functions provided by the FDW extension come into play during query processing to access foreign tables.

## Query Tree Creation:
The query analyzer (or analyser) constructs the query tree based on the input SQL statement.

## Remote Server Connection:
The planner (or executor) establishes a connection with the remote server that hosts the foreign table.

## Cost Estimation:
If the use_remote_estimate option is enabled (off by default), the planner executes EXPLAIN commands on the remote server to estimate the cost of various plan paths.

## SQL Statement Generation:
The planner generates a plain text SQL statement from the plan tree, a process known as deparsing.

## Remote Execution and Result Retrieval:
The executor sends the plain text SQL statement to the remote server for execution and retrieves the resulting data.
By following these steps, FDW allows PostgreSQL to seamlessly interact with foreign tables on remote servers. The performance of FDW queries depends on factors such as network latency, the efficiency of the foreign server, and the data volume being transferred.

PostgreSQL's FDW feature enables efficient access to and manipulation of foreign tables located on remote servers. By executing setup commands and leveraging the provided extension, you can seamlessly integrate remote data sources into your PostgreSQL database.

The performance of FDW queries involves steps such as query tree creation, remote server connection, cost estimation, SQL statement generation, and remote execution. Taking into account factors like network latency and server efficiency, FDW empowers PostgreSQL to process queries on foreign tables effectively.
Foreign Data Wrappers (FDW): Accessing Remote Data in PostgreSQL
Tags: apacheage, postgres
Published: 2023-07-12 16:55:59

In 2003, the SQL Management of External Data (SQL/MED) specification was introduced as part of the SQL standard. PostgreSQL has been actively developing its Foreign Data Wrappers (FDW) feature since version 9.1 to implement a portion of SQL/MED.

## The Concept of FDW:
In SQL/MED, a table residing on a remote server is referred to as a foreign table. PostgreSQL's FDW leverages SQL/MED to manage these foreign tables, making them similar to local tables in terms of access and manipulation.

Accessing Foreign Tables:
To access foreign tables on remote servers, you need to install the required extension and configure the appropriate settings. Let's consider an example with two remote servers: "postgresql" and "mysql," each hosting a foreign table, "foreign_pg_tbl" and "foreign_my_tbl," respectively. By issuing SELECT queries as shown below, you can access these foreign tables from the local server.

```
-- Accessing the foreign_pg_tbl on the remote postgresql server
SELECT count(*) FROM foreign_pg_tbl;

```

```
-- Accessing the foreign_my_tbl on the remote mysql server
SELECT count(*) FROM foreign_my_tbl;
```

## Joining Foreign Tables:
FDW enables executing join operations with foreign tables stored on different servers, just like local tables. For instance, you can perform a join operation between "foreign_pg_tbl" and "foreign_my_tbl" using the following query:

`SELECT count(*) FROM foreign_pg_tbl AS p, foreign_my_tbl AS m WHERE p.id = m.id;
`

## FDW Extensions:
Various FDW extensions have been developed and listed in the Postgres wiki. However, it's worth noting that most of these extensions are not actively maintained. The "postgres_fdw" extension stands out as the officially developed and maintained FDW extension by the PostgreSQL Global Development Group. It allows access to remote PostgreSQL servers.

## Conclusion:
PostgreSQL's Foreign Data Wrappers provide a powerful mechanism for accessing and managing remote data through foreign tables. With FDW, you can seamlessly integrate remote data sources into your local PostgreSQL database, enabling efficient querying and joining of foreign tables. While various FDW extensions exist, it's advisable to use the officially supported "postgres_fdw" extension for accessing remote PostgreSQL servers.
How many pods can run by default on an EKS node ?
Tags: kubernetes, aws
Published: 2023-07-12 16:46:55

As you know, in EKS each of your pod has a private IP assigned. Which means that the max number of pods that a node can handle is directly linked to the the max number of [ENI](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html) possible (Elastic Network Interfaces), and their IP adresses, for the EC2 instance type of the node you are using.

I discovered recently that there were two hard limits applicable here, so I am sharing them in this small post if that can help you to gain some time.

First take the number from [this file](https://github.com/awslabs/amazon-eks-ami/blob/master/files/eni-max-pods.txt) regarding your node instance type.

If your node is inside a managed node group where the AMI is pinpointed :
- the number above is your max

If your node is inside a managed node group where the AMI is NOT pinpointed :
- if the number above is < 110 then this is your max
- if the number above is > 110 and your instance type has less than 30 vCPU, then 110 is your max (explained [here](https://docs.aws.amazon.com/eks/latest/userguide/create-managed-node-group.html#:~:text=maximum%20number%20is-,110,-.%20For%20instances%20with))
- if the number above is > 110 and your instance type has more than 30 vCPU, then 250 is your max (explained [here](https://docs.aws.amazon.com/eks/latest/userguide/create-managed-node-group.html#:~:text=number%20jumps%20to-,250,-.%20These%20numbers%20are))

So technically you multiply this final number with the number of nodes in your cluster (assuming they have all the same instance type) and you have the maximum number of pods that can run inside your EKS cluster.

If you want to double check this value for a node, you can simply run this kubectl commands :
`kubectl get nodes`
`kubectl describe node NODE_NAME | grep 'pods\|PrivateIP'`
CAT Software Services: Application Development Services for Your Business Needs
Published: 2023-07-12 16:41:58

**CAT Software Services: Application Development Services for Your Business Needs**

If you're looking for top-quality Application Development Services for your business, you can't go wrong with CAT Software Services. We have years of experience in creating custom applications that meet the specific needs of our clients. We understand the importance of meeting deadlines and budgets, and we always work closely with our clients to ensure that they're completely satisfied with the end product.

**What are Application Development Services?**

Application Development Services are a type of professional service that helps businesses create custom software applications. These applications can fulfill a wide range of needs, such as helping a business manage its operations, improve customer engagement, or increase sales.

There are many different types of Application Development Services, each with its own set of specialized skills. Some common types of Application Development Services include mobile app development, web application development, and enterprise application development.

When choosing an application development service, it is important to consider the company's experience, skills, and track record. The company should also be able to provide a detailed proposal that outlines the proposed application, the cost, and the timeline.

**What are the benefits of using Application Development Services?**

There are many benefits of using Application Development Services. One of the biggest benefits is that you can get your app developed and launched much faster. Another benefit is that you can get access to experts who can help you create a high-quality app. additionally; you can save money by outsourcing the development of your app.

**How can CAT Software Services help with your application development needs?**

CAT Software Services is a trusted provider of Application Development Services. We have a team of experienced developers who can help you with your project. We can help with everything from the initial planning stages to the final deployment of your application. We also offer support and maintenance services to help you keep your application running smoothly. Contact us today to learn more about our services and how we can help you with your application development needs.

**Conclusion:**

If you're looking for an experienced and reliable team of developers to create a custom application for your business, CAT Software Services is the perfect choice. We have a proven track record of success and always put our clients' needs first. Contact us today to learn more about our services and how we can help you take your business to the next level.

**For More Details Visit Us:**

**[https://www.catsoftwareservices.com/services/application-development](https://www.catsoftwareservices.com/services/application-development)**
Mastering Apache AGE: A Comprehensive Tutorial for Crafting Dynamic Graphs with Nodes and Edges
Tags: apacheage, database, postgres
Published: 2023-07-12 16:41:36

Before we start mastering anything, it is imperative we understand what a graph is. A graph consists of a set of vertices and edges, while, each vertex and edge has a map or certain properties. 
![Picture of a graph](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oyu6v0swqp9b8jvykony.png)

From now on we'll be assuming you have Apache AGE installed and configured correctly with postgreSQL. Start the postgres server with the following command
`pg_ctl -D agedemo -l logfile start`

In my case, I have created a database named agedemo and connected to it with the command: 
`psql agedemo`

Now, I've created a graph called Halo based on the game as follows: 

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

The load and SET lines are standard for setting up the configs for Apache AGE. The create_graph is a function in the ag_catalog and is used to create a graph and accepts the name of the graph you want to create as a parameter.

Another function we will be using will be the Cypher function used for constructing cypher queries. 


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

Now with the SELECT * FROM cypher command we have created a vertice with name and title properties: 

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

So Far, So Good!

Similarly, we have created an addtional two more for two more characters:

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


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

Alright now let's create a relationship between the two vertices. We will make Master Chief a "LOVER_OF" Cortana cause let's face it we all know that is what they really are. We will do it as follows:


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

And there you have it. Now for bonus points, if you have Apache AGE-Viewer installed then you can visualized what you have created as follows: 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g8ztff5urcor2q7m1f1o.png)
Best dotfiles manager is GIT
Tags: git, dotfiles
Published: 2023-07-12 16:39:18

Long story short. Tried lot of dotfiles managers including custom solutions. All of them have a big disadvantage. You have a copy of a file or symlink.
What do we need? Just git. Let's start!

First of all we need a shell alias to manage our files.

I'm using fish so creating alias looks like this.

```bash
$ alias hi "echo hello"
```

But you can do same thing in bash as well:

```bash
$ alias hi="echo hello"
```

Let's name our alias `dot`.

Just add such a line in your shell config file.

Depending on our needs we can:

Allow to backup files on whole disk:

```bash
alias dot "git --git-dir=$HOME/.dotfiles --work-tree=/"
```

Or just in the home directory:

```bash
alias dot "git --git-dir=$HOME/.dotfiles --work-tree=$HOME"
```

Great. We're just made an dot manager!

Let's init out repo

```bash
$ dot init
```

One more thing! Need to set up one thing:

```bash
$ dot config --local status.showUntrackedFiles no
```

And we're done. All git files are in `$HOME/.dotfiles` directory.

To add a file or directory we can simply:

```bash
$ dot add ~/.config
```

and commit it with

```bash
$ dot commit
```

The backup is a `git` repository. We can push it to github for example. Just add remote like on every other git repository.

Just like you saw. There is no copying, linking, just adding a files when something changed.
What is Cookies | Cookies in JS (javascript)
Tags: javascript, programming, beginners
Published: 2023-07-12 16:35:10

JavaScript cookies are utilized by websites to store small data fragments on a user's browser. These fragments serve the purpose of retaining user-related information or monitoring their browsing behavior. As a standard practice, cookies accompany each website request, enabling the server to access the stored data.

**Here's how you can work with cookies in JavaScript:-**

1- Setting a Cookie:

```js
document.cookie = "cookieName=cookieValue; expires=expiryDate; path=/";
```

`cookieName` is the name of the cookie.

`cookieValue` is the value you want to store.

`expires` (optional) specifies the expiration date of the cookie. It should be in the format expires=Thu, 01 Jan 2023 00:00:00 GMT.

`path` (optional) sets the scope of the cookie. By default, it applies to the current path.

2- Getting a Cookie:

```js
var cookies = document.cookie;
```

The `document.cookie` property contains all the cookies as a string. You'll need to parse and extract the specific cookie you want.

3- Parsing and extracting a specific cookie:
```js
function getCookie(name) {
  var cookieValue = null;
  var cookies = document.cookie.split(';');
  for (var i = 0; i < cookies.length; i++) {
    var cookie = cookies[i].trim();
    if (cookie.startsWith(name + '=')) {
      cookieValue = cookie.substring(name.length + 1);
      break;
    }
  }
  return cookieValue;
}
```

You can use the `getCookie` function to extract the value of a specific cookie by providing its name.

4- Deleting a cookie:

To delete a cookie, you have to set its expiration date to a past date:
```js
document.cookie = "cookieName=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
```
Cookies are limited in size and can be accessed by client-side code. Sensitive information should not be stored in cookies. Modern web development uses local storage or session storage for data persistence.

if you want to know about Local and session storage click here ,i have another blog on it 

Thank you for reading this blog, follow me on Twitter, I regularly share blogs and post on Javascript, React, Web development and opensource contribution 

Twitter- https://twitter.com/Diwakar_766

Github- https://github.com/DIWAKARKASHYAP
Next.js Hangout Thread
Tags: nextjs, discuss, watercooler
Published: 2023-07-12 16:29:58

Hey, this is a weekly hangout thread.

This is a post where you can discuss anything related to Next.js.

You can also share anything new you've worked on with Next.js or any new articles you've created which talk about Next.js.

Feel free to ask any questions as well!
Nhà Cái Uy Tín 333666 Top 1 Thị Trường Game Online
Tags: android, ios, webdev, tutorial
Published: 2023-07-12 16:13:47

[Nhà cái uy tín 333666](https://333666.fyi/nha-cai-uy-tin-333666-top-1-thi-truong-game-online/) là một nhà cái cá cược online có mặt tại Việt Nam. Cung cấp rất đa dạng các sản phẩm cá cược cho người chơi như game bài, xổ số, thể thao, casino trực tuyến.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zznejqx505ag89s5zw51.png)
Invalid byte 2 of 2-byte UTF-8 sequence.
Tags: java, maven
Published: 2023-07-12 16:12:05

I encounter the error when I am following a tutorial, the most common solution is to change the encoding of the `pom.xml` to UTF8 and explicitly state it. However, that does not work for me, luckily, I have a workable version of code that I can compare with.


I solve the problem by removing the `mapper-locations:
   com/myProject/reggie/mapper/**` in the `application.yml` file. I added this because `mybatis` does not work earlier (adding this to the yml file did not help). not sure why but at least now I can get the project running.
Chơi nổ hũ online – Cơ hội trúng lớn chỉ trong một cú nhấp chuột
Tags: android, ios, webdev, tutorial
Published: 2023-07-12 16:11:20

[Nổ hũ online](https://333666.fyi/no-hu-online/) là một trong những trò chơi giải trí trực tuyến ngày càng được ưa chuộng và thu hút người chơi trên toàn thế giới. Với sự phát triển nhanh chóng của công nghệ, người chơi có thể trải nghiệm cảm giác hồi hộp và thú vị của việc chơi nổ hũ chỉ với một cú nhấp chuột.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1730zhgwpamhtxvul0bv.png)
Generate an API Changelog with Git and Optic
Tags: api, git, openapi
Published: 2023-07-12 16:04:19

One of the most important parts of a public API's documentation is the Changelog. During the initial discovery + integration phase, new consumers will spend most of their time reading your docs. After your consumers are integrated it becomes really important to keep them up-to-date on changes to the API. 

[Stripe](https://stripe.com/docs/changelog) has a great changelog that many API companies wish to emulate. It's unfortunately very difficult to keep track of, and manually document, every historical API change. 

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

That's where Optic (the open source API version control tool) can help. Its new `history` command will use Git history to write a date-based changelog in markdown. 

```
optic history openapi.yml > changelog.md
```


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

That's it! Now you have a Stripe-style changelog!
Caption This! 🤔💭
Tags: watercooler
Published: 2023-07-12 15:50:04

Calling all captioneers! 📣

We got an image below and need your help coming up with a clever caption to fit it.

![Kids from the nineties surfing their keyboards all around the world.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v7z9noo9fqojthwj22yb.jpeg)

Follow the DEVteam for more online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
Start Managing Your Files In Early 80s.
Tags: tooling, programming
Published: 2023-07-12 15:46:23

For the last 3 days, I started writing a file manager in C and Raylib.
![myFiles screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3yd40xem1lqiwb37bdp0.png)
The download link is at the bottom of the post.
Right now, you can:

- Browse through directories with the Arrow Keys.
- Preview Images (.png) and Text files.
- Execute programs when you press Enter.

https://blueberry077.itch.io/myfiles
How to Conditionally Add Property to the Object in JavaScript
Tags: javascript, data, programming, webdev
Published: 2023-07-12 15:35:39

In **JavaScript**, there are several ways to conditionally add elements to an object based on certain conditions. This flexibility allows us to dynamically modify objects as needed. In this post, i will talk about two different ways to accomplish this task. Let's dive in!


**Method 1:** Spread Operator and Logical AND Operator
This method allows you to add items to the object depending on the condition. If the condition is not true, no new item is added to the object.

Example:
```javascript
let object = {
   ...(condition here) && {prop: propvalue},
   ...otherprops
}
```

**Method 2:** Ternary Operator
This method only allows you to add the value of the key conditionally, the element is defined to the object in both conditions.

Example:
```javascript
let object = {};

object.newKey = condition ? value : defaultValue;
```


**Can be useful:**
[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_AND](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_AND)
[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_operator)
Why should you use a hidden replica set member
Tags: mongodb, database, production
Published: 2023-07-12 15:19:55

MongoDB brought a lot of innovation to the database ecosystem.
One of this innovation is the concept of a hidden replica set member.
A hidden replica set is a member that keeps a copy of primary's data set, but it is invisible for the client.
This means that this member won't receive any read when the client is connect using the replica set connection string.

## Use Cases for the Hidden Replica set member

You can do the backup in production from the hidden member without causing any performance issues to your production workflow.

You can connect your BI (Business Intelligence) to the hidden member, doing a lot of heavy queries without compromising your production workflow .

You can create a new index from a big collection in the hidden member, so you can create the index faster.

## Configuring a Hidden Replica Set member

Use `mongosh` to connect to a MongoDB node

```sh
 mongosh mongodb://mongo1:27017,mongo2:27017/db?replicaSet=rs0
```

Run `rs.status()` to see what node is a `SECONDARY`

```sh
rs.status()
```

Example output:

```jsx
members: [
    {
      _id: 0,
      name: 'mongodb1:27017',
      stateStr: 'PRIMARY',
    },
    {
      _id: 1,
      name: 'mongodb2.mongo-prd:27017',
      stateStr: 'SECONDARY',
    },
]
```

We need to modify the replica set config like this:

```sh
const config = rs.config();

config.members[1].hidden = true;
config.members[1].priority = 0;

rs.reconfig(config)
```

This will set the members in the position 1 of the array (mongodb2) to the be a hidden replica set member.

## In Conclusion

Production environment are much more sensitivity than localhost and staging.
You need to design your process to avoid affecting production workflow.
A hidden member is perfect for backups, running heavy queries in your BI and doing database maintenance like building a new index for a big collection.

## References

[https://www.mongodb.com/docs/manual/core/replica-set-hidden-member/](https://www.mongodb.com/docs/manual/core/replica-set-hidden-member/)

---
Woovi
[Woovi](https://www.woovi.com) is a Startup that enables shoppers to pay as they like. To make this possible, Woovi provides instant payment solutions for merchants to accept orders.

If you want to work with us, we are [hiring](https://woovi.com/jobs/)!