Notes


Backing Up and Restoring PostgreSQL Databases

This guide outlines the steps to back up and restore PostgreSQL databases using command-line tools on Windows. Backing Up a Database To back up a PostgreSQL database, use the `pg_dump` utility: .\pg_dump.exe -U <username> -d <database_name> > <dump_path> Example: .\pg_dump.exe -U postgres -d testdb > C:\Users\Ercan\Desktop\dump.sql Restoring a Database To restore a PostgreSQL database from a backup, use the `psql` utility: .\psql.exe -U <username> -d <database_name> < <dump_path> Example: .\psql.exe -U postgres ..

Backing Up and Restoring MongoDB

This guide outlines the steps to back up and restore MongoDB databases using the official MongoDB Database Tools. 1. Download MongoDB Database Tools Obtain the MongoDB Database Tools from the official website: https://www.mongodb.com/try/download/database-tools 2. Backing Up a Database Use the `mongodump` utility to create a backup of your database: .\mongodump.exe --db=<<db_name>> --out <<dump_path>> Replace `<<db_name>>` with the name of your database and `<<dump_path>>` with the desired output directory. 3. Restoring ..

Installing PHP Xdebug on Windows

This guide outlines the steps to install and configure Xdebug for PHP on a Windows environment. 1. Download the Appropriate Xdebug DLL Visit the official Xdebug downloads page to obtain the DLL that matches your PHP version: https://xdebug.org/download#releases 2. Rename and Move the DLL File Rename the downloaded file to `php_xdebug.dll` and move it to the `ext` directory within your PHP installation path (e.g., `C:\php\ext`). 3. Update php.ini Configuration Open your `php.ini` file and add the following configuration: [xdebug] zend_extension=xdebug xdebug.mode=deb..

Backing Up and Restoring GPG Keys

This guide outlines the steps to back up and restore your GPG keys, ensuring the security and continuity of your cryptographic identity. Backing Up GPG Keys 1. Export the Secret Key To back up your secret GPG key, use the following command: gpg --export-secret-keys --armor > secret.asc This command exports your secret key in ASCII format to the file `secret.asc`. 2. Export the Trust Database (Optional) To back up your trust database, execute: gpg --export-ownertrust > trustdb.txt This will save your trust settings to `trustdb.txt`. Restoring GPG Keys ..

Installing Podman on Windows

This guide outlines the steps to install Podman on a Windows environment. 1. Enable Required Windows Features Open PowerShell as Administrator and execute: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart Restart your computer to apply the changes. 2. Install WSL 2 Download and install the latest WSL 2 update from: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi 3. Set WSL 2 as Default Version In PowerShell,..

Changing Podman Data Directory on Windows

This guide outlines the steps to change the Podman data directory on a Windows environment by exporting and importing the WSL instance. 1. Stop the Podman Machine Execute the following command to stop the Podman machine: podman machine stop 2. Export the WSL Instance Export the existing WSL instance to a backup file: wsl --export <<instance_name>> backup.tar 3. Unregister the WSL Instance Unregister the current WSL instance: wsl --unregister <<instance_name>> 4. Import the WSL Instance to New Location Import the WSL instance to t..

Using OpenStreetMap Data with PostgreSQL

This guide outlines the steps to import OpenStreetMap (OSM) data into a PostgreSQL database with PostGIS support on a Windows environment. 1. Install PostGIS Extension Add spatial support to PostgreSQL by installing the PostGIS extension: https://postgis.net/install/ 2. Create a PostgreSQL Database Create a new database in PostgreSQL to store the OSM data. Then, enable the necessary extensions by executing: CREATE EXTENSION postgis; CREATE EXTENSION hstore; 3. Download OSM Data Obtain the desired .osm.pbf file from Geofabrik: https://download.geofabrik.de/ 4. Downloa..

Installing PostgreSQL on Windows

This guide outlines the steps to install and initialize PostgreSQL on a Windows environment using the ZIP archive. 1. Download PostgreSQL Visit the official PostgreSQL website and download the ZIP archive: https://www.enterprisedb.com/download-postgresql-binaries 2. Extract the ZIP File Extract the downloaded ZIP file to your desired location, for example: D:\Dev\pgsql-14.1 3. Create Necessary Directories Within the extracted folder, create the following directories: mkdir <<postgresql_path>>\data mkdir <<postgresql_path>>\log 4. Initialize Po..

Installing MongoDB on Windows

This guide outlines the steps to install MongoDB on a Windows environment. 1. Download MongoDB Visit the official MongoDB website and download the Community Server version in ZIP format: https://www.mongodb.com/try/download/community 2. Extract the ZIP File Extract the downloaded ZIP file to a desired location, for example: D:\Dev\mongodb-7.0.2 3. Create Necessary Directories Within the extracted folder, create the following directories: mkdir <<mongodb_path>>\conf mkdir <<mongodb_path>>\data mkdir <<mongodb_path>>\log 4. Create C..

PostgreSQL Date based Query Examples

Today select current_date; --2024-01-17 Yesterday select current_date - 1; --2024-01-16 Tomorrow select current_date + 1; --2024-01-18 Format Date select to_char(current_date,'DD/MM/YYYY'); --17/01/2024 This year select extract(year from current_date); --2024 Next year select extract(year from current_date + interval '1 year'); --2025 Last year select extract(year from current_date - interval '1 year'); --2023 First day of current month select cast(date_trunc('month', current_date) as date); --2024-01-01 Last day of current month select cast(date_trunc('month',current_da..

Showing 1 to 10 of 15 (2 Pages)