teleren/devto huggingface dataset:
A Deep Dive into Base Backup and Point-in-time Recovery in PostgreSQL
Tags: apache, agedb, database, postgres
Published: 2023-07-12 08:28:20

Welcome to the ninth article of my blog series, in this blog I will discuss Base Backup and Point-in-time Recovery in PostgreSQL.


There are two types of online database backups in PostgreSQL: logical backups and physical backups. Physical backups involve capturing an image of the actual physical files that compose the database, while logical backups involve creating a backup by exporting the logical structure and data of the database.

Although logical backups offer advantages such as flexibility in extracting and modifying data, they can be time-consuming, particularly for large databases. In contrast, physical backups are more efficient and faster for backing up and restoring extensive databases.

## Base Backup
A base backup is the technical term for the creation of a physical backup in PostgreSQL. The steps below make up the normal process for making a basic backup:

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


To initiate the backup process in PostgreSQL, you can use the pg_backup_start command (or pg_start_backup in previous versions). This command ensures that the database is prepared for backup by switching to the current Write-Ahead Log (WAL) segment file and creating a checkpoint. It also generates a backup_label file that contains essential information about the base backup, such as the checkpoint location.

Once the backup process is complete, you can use the pg_backup_stop command (or pg_stop_backup in earlier versions) to finalize the backup. This command performs several actions, including switching the WAL segment file, writing a backup end XLOG record, resetting the full-page write mode, and creating a backup history file. The backup history file includes the contents of the backup_label file and additional data.

With a base backup and the archive logs created through continuous archiving, you can utilize PostgreSQL's Point-in-Time Recovery (PITR) functionality to restore the database cluster to any desired point in time. This feature is useful for resolving critical errors or reverting the database to a specific state.

During the recovery process, PostgreSQL reads the checkpoint location from the backup_label file to determine the starting point. It then reads the archive logs from the archival path specified in the archive_command option and replays the WAL data from those logs.

Upon completion of the recovery operation, a timeline history file is created in the pg_xlog (or pg_wal in version 10 or later) subfolder. This file records the Log Sequence Number (LSN) where the WAL segment switches occurred, the cause of the timeline change, and the timelineId of the restored database cluster. The timeline history file serves as a vital reference for future PITR procedures and provides a history of recovered clusters.

References:
If you want to read it further, please click the link below.
[Chapter-9 The Internals of PostgreSQL](https://www.interdb.jp/pg/pgsql10.html)
Selenium Page Factory
Tags: selenium
Published: 2023-07-12 08:15:05

[how it works](https://www.seleniumeasy.com/selenium-tutorials/page-factory-pattern-in-selenium-webdriver)

##FindBys - AND Condition

Eg: @FindBys({@FindBy(id = "foo"), @FindBy(className = "bar")})

HTML source code of a WebElement:

<div id =”searchId_1>
	<button id=”1” , name=”search_field”/>
	<input id =”2”/>
</div>
In POM:

@FindBys({
 @FindBy(id = "searchId_1"),
 @FindBy(name = "search_field")
 })

WebElementSearchButton;

In the above example, the WebElement ‘SearchButton’ is located only if it matches both the criteria whose id value is “searchId_1” and the name value is “search_field”. Please note that the first criteria belong to a parent tag<div> and the second criteria for a child tag<button>.

##FindAll - OR Condition 


##@CacheLookUp
if a Webelement is approched several time, you can store it in cache

[extended](https://www.softwaretestinghelp.com/page-object-model-pom-with-pagefactory/#POM_Using_Page_Factory)
Best Squint Specialist in Delhi | Bharti Eye Foundation
Tags: squinteyesurgery, squinttreatment, squinteyespecilaist, squinteyesurgeon
Published: 2023-07-12 08:13:05



Are you in search of the best squint specialist in Delhi? Look no further than Bharti Eye Foundation. With its team of [highly skilled ophthalmologists](url=https://bhartieyefoundation.in/Findeyespecialist.html) and state-of-the-art facilities, Bharti Eye Foundation is renowned for providing top-notch care and treatment for squint-related conditions.
**
What is Squint?**
[Squint](url=https://bhartieyefoundation.in/squint_treatment.html), also known as strabismus, is a condition that causes misalignment of the eyes. It occurs when the eyes fail to work together in the same direction, leading to one eye looking straight ahead while the other eye turns inward, outward, upward, or downward. Squint can occur at any age and is more common in children.
**
Bharti Eye Foundation: The Best Squint Specialist in Delhi**
When it comes to squint treatment in Delhi, Bharti Eye Foundation stands out as the best choice. Here's why:

**Highly Experienced Specialists**
Bharti Eye Foundation boasts a team of highly skilled and experienced ophthalmologists who specialize in treating squint. These specialists have years of expertise in diagnosing and managing various squint-related conditions, ensuring the best possible outcomes for patients.

for more info visit us: https://bhartieyefoundation.in/index.html
#LearnedToday: Build Your Own X
Tags: learnedtoday, javascript, github, webdev
Published: 2023-07-12 08:12:00

🔨  [Build Your Own X](https://github.com/codecrafters-io/build-your-own-x) is a GitHub repository which collects step-by-step guides for re-Creating technologies from scratch, such as Docker, git, a web server and many more!
AntDB Visual Monitoring and Alerting
Tags: database
Published: 2023-07-12 07:55:36

AntDB monitors more than 30 professional data indicators, such as incoming and outgoing network traffic monitoring, Set/Get numbers, CPU load, QPS, etc. The visual data display is clear at a glance. The constantly enriched interfaces provide flexible and diverse query services for the visualization and automation of overall system operation and maintenance.
The toolkit-use npm package has added commonly used DOM methods.
Tags: npm, rollup, typescript, opensource
Published: 2023-07-12 07:44:11


[dom utils](https://github.com/KenNaNa/toolkit-use/blob/main/src/dom/index.ts)

## Get Hexadecimal Color
```ts
import { getColor } from 'toolkit-use/dist/dom/index.esm'
const color = getColor()
```

## Event Utilities

```ts
import { eventUtils } from 'toolkit-use/dist/dom/index.esm'
// Add event listener
eventUtils.addHandler(element, type, handler)
// Remove event listener
eventUtils.removeHandler(element, type, handler)
// Get compatibility event
eventUtils.getEvent(event)
// Get actual target
eventUtils.getTarget(event)
// Prevent default event
eventUtils.preventDefault(event)
// Stop event propagation
eventUtils.stopPropagation(event)
// Get related target
eventUtils.getRelatedTarget(event)
// Get button code
eventUtils.getButton(event)
// Get wheel delta
eventUtils.getWheelDelta(event)
// Get char code
eventUtils.getCharCode(event)
```

## Add Class Name
```ts
import { addClass } from 'toolkit-use/dist/dom/index.esm'
addClass(elem, className)
```

## Remove Class Name
```ts
import { removeClass } from 'toolkit-use/dist/dom/index.esm'
removeClass(elem, className)
```

## Get offsetLeft
```ts
import { getElementLeft } from 'toolkit-use/dist/dom/index.esm'
getElementLeft(elem)
```

## Get offsetTop
```ts
import { getElementTop } from 'toolkit-use/dist/dom/index.esm'
getElementTop(elem)
```

## Get Offset
```ts
import { getOffset } from 'toolkit-use/dist/dom/index.esm'
getOffset(elem)
```

## Get Viewport Width and Height
```ts
import { getViewport } from 'toolkit-use/dist/dom/index.esm'
getViewport()
```

## Traverse Element Attributes
```ts
import { outputAttributes } from 'toolkit-use/dist/dom/index.esm'
outputAttributes(elem)
```
Proxyium Free Web Proxy
Tags: proxyium, freewebproxy, lalicat, unblockedbrowser
Published: 2023-07-12 07:42:53

[**Proxyium**](https://www.lalicat.com/proxyium) provides a free web proxy service that can help users unblock all websites and anyonmously browse websites. If you are looking for a method to protect your privacy online, using Proxyium web proxy and Lalicat antidetect browser can help you. Lalicat can camouflage different browser fingerprints and Proxyium offers different proxy IP, so any platforms can't detect your real information.

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

## 1. Create a new virtual browser in Lalicat client
![Create a new virtual browser](https://help.lalicat.com/lalicat/wp-content/uploads/2023/06/image-12.png)

## 2. Enter profile details
Including profile name, group, operating system, browser version, user-agent.

Here I set "proxyium.com" as the default homepage.

Then save the profile.

![Enter profile details](https://help.lalicat.com/lalicat/wp-content/uploads/2023/06/image-13.png)

## 3. Run the browser
![Run the browser](https://help.lalicat.com/lalicat/wp-content/uploads/2023/06/image-14.png)

## 4. Use Proxyium free web proxy
Select a proxy country, including Poland, US, India, Singapore, and others.

Enter a website URL, click “Go" to browser. Here I use "ipinfo.io" to check the IP address.

![Use Proxyium free web proxy](https://help.lalicat.com/lalicat/wp-content/uploads/2023/06/image-15.png)

Then the browser will enter the website using proxy.

![Proxyium Check IP address](https://help.lalicat.com/lalicat/wp-content/uploads/2023/06/image-16.png)

You can also enter youtube.com, google.com, and so on to anyonmously browse these websites using the free web proxy.

![Proxyium Youtube](https://help.lalicat.com/lalicat/wp-content/uploads/2023/06/image-17.png)  

![Proxyium Google](https://help.lalicat.com/lalicat/wp-content/uploads/2023/06/image-18.png)  

Another free web proxy - [CroxyProxy](https://www.lalicat.com/croxy-proxy)

If you need to manage multiple accounts, or fast and safe proxy network, here are some paid proxy servers:

[911 Socks5 Proxy](https://www.lalicat.com/911-socks5-proxy) (Closed)  
[YiLu Socks5 Proxy](https://www.lalicat.com/yilus5-proxy)  
[Proxy-Seller](https://www.lalicat.com/proxy-seller)  
[Oxylabs Proxy](https://www.lalicat.com/lalicat-browser-integrate-with-oxylabs-proxy)  
[Infatica P2B Proxy Network](https://www.lalicat.com/infatica-p2b-proxy-network)  
[Smartproxy](https://www.lalicat.com/how-to-use-smart-proxy-in-lalicat)  
[NetNut Proxy](https://www.lalicat.com/netnut-proxy)  
[Luminati/BrightData Proxy](https://www.lalicat.com/luminati-brightdata-proxy)  
[Pia S5 Proxy](https://www.lalicat.com/pia-proxy)  
[922 S5 Proxy](https://www.lalicat.com/922-s5-proxy)  
[IP2World](https://www.lalicat.com/ip2world-proxy)  
[Dove Proxy](https://www.lalicat.com/dove-proxy-2)  

The article is from [https://www.lalicat.com/proxyium](https://www.lalicat.com/proxyium).
Method Madness: Cast Your Vote
Tags: poll, discuss, programming, sql
Published: 2023-07-10 09:58:15

When it comes to handling conditional logic in SQL, developers have long debated the merits of two prominent approaches: the traditional if-else method and the powerful CASE statement

Are you a staunch supporter of if-else or an advocate for the versatility of CASE? 


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

**<u>Logic 1</u>**: Using If-Else Statment 
```
CREATE PROCEDURE FlagOrderPriority
    @OrderID INT,
    @OrderValue DECIMAL(10, 2)
AS
BEGIN
    SET NOCOUNT ON;

    DECLARE @Priority VARCHAR(20);

    IF @OrderValue > 30
        SET @Priority = 'Big Customer Order';
    ELSE IF @OrderValue >= 10 AND @OrderValue <= 30
        SET @Priority = 'Medium Order';
    ELSE
        SET @Priority = 'Low priority order';

    -- Log the order priority
    INSERT INTO OrderLog (OrderID, Priority)
    VALUES (@OrderID, @Priority);
END;
```

**<u>Logic 2</u>**: Using Case Statement

```
CREATE PROCEDURE FlagOrderPriority
    @OrderID INT,
    @OrderValue DECIMAL(10, 2)
AS
BEGIN
    SET NOCOUNT ON;

    DECLARE @Priority VARCHAR(20);

    SET @Priority = CASE
        WHEN @OrderValue > 30 THEN 'Big Customer Order'
        WHEN @OrderValue >= 10 AND @OrderValue <= 30 THEN 'Medium Order'
        ELSE 'Low priority order'
    END;

    -- Log the order priority
    INSERT INTO OrderLog (OrderID, Priority)
    VALUES (@OrderID, @Priority);
END;

```


**Question 1**: [Method Madness If-else V/s Case statment](https://strawpoll.com/XmZRxLXMmnd)

**Question 2**: [Code Maintainence](https://strawpoll.com/7MZ0A2GKRyo)

**Question 3**:[Code Performance](https://strawpoll.com/XOgON6bG3n3)

**Question 4**:[Code enhancement](https://strawpoll.com/xVg7jNzKenr)

**Question 5**:[Code Quality](https://strawpoll.com/3RnYlL6OAye)

**Question 6**:[Persona](https://strawpoll.com/kogjkBWQ3Z6)

Cast your vote and let your voice be heard in this methodology faceoff
Leveraging Pre-commit Hooks with Husky and Lint-Staged
Published: 2023-07-12 07:33:26

There exists a debate over the necessity of pre-push or pre-commit hooks. Critics argue that developers shouldn't be limited in their ability to push code to the codebase and that code checks should instead be executed during the PR review process. However, pre-commit hooks, such as those with lint-staged, can provide substantial benefits, particularly for new teams starting on a project. Before diving into the of Github actions or anything like that, these hooks offer a straightforward way to ensure consistent code quality.

To illustrate this, let's begin by installing Husky in our project:

`yarn add husky -D`

Next, we need to add a prepare script to our package.json file. This script allows every team member to run it once, setting up the necessary hooks for their local development environment. The prepare script should look like this:

`"prepare": "husky install"`

After adding the script, run yarn prepare to set up Husky. Subsequently, create a pre-commit hook with the command npx husky add .husky/pre-commit "yarn lint". This command creates a hook that runs every time a commit is made, although we'll modify it shortly to run only on modified files.

Once the above steps are completed, you should see a .husky directory in your project root.

Next, let's introduce lint-staged:

`yarn add lint-staged -D`

Lint-staged is a tool that allows you to run scripts on files staged in git. We use it here to run our linter only on files that have been changed in the commit.

To configure lint-staged, we add the following to our package.json file:

```JSON
"lint-staged": {
  "*.{js,jsx,ts,tsx}": [
    "eslint",
    "prettier --write"
  ]
},
```

Then, add a script to the package.json file that will call lint-staged:

`"pre-commit": "lint-staged"`

Finally, modify the .husky/pre-commit file to use yarn pre-commit instead of yarn lint. With this change, the linter will only run on files modified in the commit.

In conclusion, pre-commit hooks using Husky and lint-staged offer an efficient way to maintain code quality across a team. These tools ensure that only consistent, well-formatted code is committed to the codebase, thereby simplifying the PR review process.
Buffer Manager: PostgreSQL
Tags: apacheage, postgressql, database, programming
Published: 2023-07-12 07:32:22

The database management system (DBMS)'s performance is significantly impacted by the buffer manager in PostgreSQL's management of data transfers between shared memory and persistent storage. The buffer manager effectively manages data file pages, including tables and indexes, and keeps track of the metadata for the pages that are being stored. 

 **Buffer Manager Structure**:

- A buffer pool, buffer descriptors, and a buffer table make up the buffer manager.
- The relationships between buffer tags and IDs are stored in the buffer table.
- Metadata about the pages that are kept in the buffer pool is saved in buffer descriptors.
- Data file pages are kept in an array called the buffer pool.


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



 **Buffer Tag:**

- A specific buffer tag made up of the RelFileNode, fork number, and block number is given to each page in PostgreSQL.
- A specific page within a relation can be identified using the buffer tag.

 **What Pages a Backend Process Reads**

- Backend processes make requests to the buffer manager with the appropriate buffer tag whenever they want to read a table or index page.
- The slot that houses the requested page's buffer ID is returned by the buffer manager.
- The buffer manager loads the page from persistent storage into a buffer pool slot and returns the buffer ID if the page is not already in the buffer pool.
- The buffer ID can then be used by the backend process to view the appropriate page.


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

**Page replacement algorithm:**

The buffer manager chooses a victim page to replace itself when all buffer pool slots are filled and a new page needs to be loaded.
Page replacement in PostgreSQL uses the clock sweep technique, which is more straightforward and effective than the LRU algorithm used in previous iterations.

 **Flushing dirty pages**

Eventually, dirty pages that have undergone modification but have not yet been flushed to storage must be written back.
Checkpointer and background writer are two background processes used by PostgreSQL to handle the flushing of dirty pages.

 **Buffer Manager Locks**

For the objectives of synchronization and data integrity, the buffer manager uses a variety of locks.
When performing lookups, insertions, and deletions, the _BufMappingLock_ is utilized to safeguard the buffer table's integrity.
The _content_lock_ function, which can be acquired in shared or exclusive mode, is used to restrict access to the stored page.
To wait for I/O operations on a buffer to finish, use _io_in_progress_lock_.
For effective buffer descriptor field inspection and manipulation, spinlocks are used.
Ways of Managing Pain Using the CBD Oil and its Effectiveness
Tags: cbd, oil
Published: 2023-07-12 07:23:44







Pain is a pesky visitor that can disrupt our lives and lower our spirits. Fortunately, there's a natural remedy making waves in the pain management realm of CBD oil. Derived from the versatile hemp plant, CBD oil is gaining popularity for its potential effectiveness in alleviating various types of pain. So, let's dive into the world of CBD oil and explore the ways it can help manage pain effectively.

**• A Natural Alternative**

CBD oil offers a natural approach to pain management, avoiding the potential side effects associated with some conventional medications. By interacting with our body's endocannabinoid system, CBD oil promotes a sense of balance and homeostasis, potentially helping to reduce pain and inflammation.


![Image description](https://imageio.forbes.com/specials-images/imageserve/1160117377/0x0.jpg?format=jpg&width=1200)

**• Soothing the Sore Spots**

Whether you're dealing with chronic pain or the occasional ache CBD oil may provide relief. From joint discomfort to muscle soreness, CBD's anti-inflammatory properties have the potential to ease those nagging twinges. Applying CBD topicals directly to the affected area can target the pain more directly, offering targeted relief.

**• Calming the Mind, Easing the Pain**

Pain can often take a toll on our mental well-being. CBD oil is known for its potential calming effects on the mind, reducing anxiety and stress levels. By promoting a sense of relaxation, CBD oil helps create a positive environment for pain management.

**• Tailor-Made Dosage**

CBD oil comes in various forms, including tinctures, capsules, and edibles, allowing you to choose a dosage method that suits your preferences. Start with a low dose and gradually increase it until you find the sweet spot that provides optimal pain relief. It's crucial to consult with your healthcare professional to determine the correct dosage and ensure it aligns with any existing medications.

**• Quality Matters**

When venturing into the world of CBD oil, quality is paramount. Look for reputable brands that prioritize transparency and provide third-party lab testing results to ensure the product's purity and potency. What a great resource to explore the top CBD oil brands for pain management in 2023! At **[www.chicagomag.com](https://www.chicagomag.com/promotion/best-cbd-oil-for-pain-in-2023-top-5-brands-that-stand-out-for-pain-management/)**, you can read more info abut Cbd oil and its effects.

**Conclusion**

In pain management, CBD oil is emerging as a promising natural alternative. Its potential effectiveness in reducing pain and inflammation, coupled with its calming properties, makes it an appealing option for those seeking relief. Remember to consult your healthcare professional before incorporating CBD oil into your pain management routine, especially if you have any underlying medical conditions or are taking medications
Common CSS Interview questions - Opacity Zero vs Display none
Published: 2023-07-12 07:19:50

So it's a common question. 

Many of you are familiar with it. 

However, having information can be beneficial not only for interviews but also for our actual development.

**Opacity - zero**
Imagine a dark room with no light. You are present inside, but you cannot see anything. Nevertheless, that room does exist in reality.

Therefore, in the end, something is present, but it remains unseen.

**Display none**
In this case, there is no room at all. You cannot enter the room, and it simply does not exist.


All the best :blush:
Streaming Application : PostgreSQL
Tags: apacheage, postgressql, database, datascience
Published: 2023-07-12 07:16:42

Single-master-multi-slave replication utilizing log shipping is made possible by PostgreSQL's streaming replication, which was added in version 9.1. Three processes are involved: walsender on the main server, walreceiver on the backup server, and startup on the standby server. A TCP connection is used for the communication between the walsender and walreceiver.

The standby server starts the startup process during the startup sequence, followed by the _walreceiver_ procedure. When the primary server receives a connection request from the _walreceiver_, it launches a _walsender_ process and creates a TCP connection between them. During handshaking, the _walreceiver_ transmits the most recent LSN (Log Sequence Number) of the standby's database cluster.

The walsender delivers the pertinent WAL data to the walreceiver for catch-up transmission if the standby's LSN lags behind the primary's LSN. When the standby server catches up, streaming replication starts, keeping it in sync with the primary.


By using _sync_priority_ and _sync_state_, the primary server controls a number of standby servers. Each standby server's priority is shown by its _sync_priority_ value, while the server's status (sync, potential, or async) is indicated by its _sync_state_ value. To guarantee consistency and synchrony, the primary watches for ACK responses from synchronous standbys.

The primary server keeps waiting forever for ACK responses if a standby server dies. Several standby servers can be utilised to prevent this, or the synchronous mode can be manually changed to the asynchronous mode by using the synchronous_standby_names parameter.

Mechanisms for detecting failures in backup servers are in place. In this, dropped connections, network issues, and unresponsiveness depending on customizable timeouts are all included.

PostgreSQL users may successfully establish and maintain streaming replication for high availability and data synchronization by comprehending the launch procedure, communication, and management of many backup servers.