Tuesday, May 21, 2024

WooCommerce Perform Bulk Operations from the Database

 SQL queries to perform following bulk operations from the database:


Bulk Delete All Orders

DELETE FROM wp_woocommerce_order_itemmeta;

DELETE FROM wp_woocommerce_order_items;

DELETE FROM wp_comments WHERE comment_type = 'order_note';

DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' );

DELETE FROM wp_posts WHERE post_type = 'shop_order';

Bulk Delete All Products

DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type IN ( 'product', 'product_variation' ));

DELETE FROM wp_posts WHERE post_type IN ( 'product', 'product_variation' );



Bulk Delete All Trashed Products

DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'product' AND post_status = 'trash' );

DELETE FROM wp_posts WHERE post_type = 'product' AND post_status = 'trash';


Bulk Delete All Order Notes

DELETE FROM wp_commentmeta WHERE comment_id IN ( SELECT ID FROM wp_comments WHERE comment_type = 'order_note' );

DELETE FROM wp_comments WHERE comment_type = 'order_note';




Wednesday, April 24, 2024

Increase the maximum upload file size in WordPress

 There are several ways to increase the maximum upload file size in WordPress, and  one of the most straightforward approaches is editing the .htaccess file.

Steps to Increase Maximum Upload File Size

1. Access Your WordPress Site Directory

2. Locate the .htaccess File

3. Edit the .htaccess File

4. Insert the following Code Snippet after </IfModule>:

php_value upload_max_filesize 500M

php_value post_max_size 500M

php_value memory_limit 500M

php_value max_execution_time 0

php_value max_input_time 300

 

Explanation of Code Snippet

php_value upload_max_filesize 500M: This line sets the maximum size for uploaded files to 500 megabytes (M). You can adjust the value to meet your specific requirements.

php_value post_max_size 500M: Similarly, this line sets the maximum size for post data (including file uploads) to 500 megabytes.

php_value memory_limit 500M: This line defines the maximum amount of memory a script can allocate to 500 megabytes.

php_value max_execution_time 0: Setting the maximum execution time to zero (0) removes any time limit, ensuring that scripts can run for an unlimited duration.

php_value max_input_time 300: This line sets the maximum time in seconds that a script is allowed to parse input data, such as POST and GET requests.




Tuesday, January 30, 2024

Windows - Move App From Non Existent Monitor

Issue:

My laptop was linked to a second monitor the last time I used RSA SecureID Token application. I used the program on the second monitor, shut it, and opened it again on the laptop without the second display while I was out of the house. The application doesn't show up on the desktop, even if it is displayed in the taskbar.

Although the app can show up there if I reconnect the second monitor at home, I'm looking for a way to make it work in situations where I forget to move the app before leaving the house.

So, I need to transfer it back to the laptop.

This issue usually occurs with following applications: Postman, RSA SecureID Token.

Cause:

RSA was opening up minimized.

Solution:

Open Task Manager

click on Process tab.

Locate RSA SecureID Software Token Client

Expand it to see Windows - RSA SecureID Token

Right click on it and click on Maximize.




Thursday, July 27, 2023

Using setx command to add a path to the PATH environment variable

 If you're seeing a message like command is not recognized on Terminal tool window in IntelliJ IDEA or command prompt,  you have the option to permanently add a path to the PATH environment variable using the elevated command prompt with the setx command:

setx /M path "%path%;C:\Program Files\Git\bin"

setx /M path "%path%;C:\Gradle\bin"

Note: path to the bin directory may vary on your system.

Wednesday, April 20, 2022

Install Apache Kafka on Windows | Kafka Installation Step-By-Step

 Kafka Setup Instructions:

1. Download opensource Kafka from official website and extract the binary:

a. go to https://kafka.apache.org/downloads

b. download the recommended version from Binary downloads. 

           eg. Scala 2.13  - kafka_2.13-3.5.1.tgz (asc, sha512)

c. Extract using 7-zip and rename it to kafka

*************************

2. Do some configuration:

Update server.properties and zookeeper.properties files located in config directory.

a. update server.properties::

# A comma separated list of directories under which to store log files

log.dirs=C:/IdeaLab/kafka/kafka-logs   #this is the directory where logs will be residing

b. update zookeeper.properties::

# the directory where the snapshot is stored.

dataDir=C:/IdeaLab/kafka/zookeeper-data    #this will be the data directory for our zookeeper

*************************

3. Kickoff zookeeper and kafka server:

a. start zookeeper:

C:\IdeaLab\kafka\bin\windows\zookeeper-server-start.bat C:\IdeaLab\kafka\config\zookeeper.properties

####NOTE: Don't close the zookeeper terminal window. Instead just open new terminal window to start kafka server.

b. kickoff the kafka server:

when you open the terminal inside kafka directory, you don't need to give the full path. You can just give .\bin\... as well.

.\bin\windows\kafka-server-start.bat .\config\server.properties

OR

C:\IdeaLab\kafka\bin\windows\kafka-server-start.bat C:\IdeaLab\kafka\config\server.properties

*************************

4. Produce the data and consume it from the consumer function.

a. we need to first create a test topic and push some data on it.

C:\IdeaLab\kafka\bin\windows>kafka-topics.bat --create --bootstrap-server localhost:9092 --topic vk_kafka_topic

Created topic  vk_kafka_topic

b.

C:\IdeaLab\kafka\bin\windows> .\kafka-console-consumer.bat --topic  vk_kafka_topic --bootstrap-server localhost:9092 --from-beginning



Thursday, March 24, 2022

IntelliJ Git Tab not Showing Local Changes

IntelliJ has moved Local Changes and Shelf to a new separate Commit tool window on the left. If you don't like the new commit workflow, you're not alone.

However, there is a way to switch back to the old behavior and layout. Simply go to:

File --> Settings --> Version Control  --> Commit  ->> 

and untick on Use non-modal commit interface 

Friday, February 19, 2021

Change Direction of the Extended Monitors

Please follow these steps to change the direction of the extended monitors:

  • First, Right-click a blank area on the desktop.
  • Then, Search for "Display settings" in the search box (Find a setting search box).
  • Click on Display Settings.
  • In the Monitor window that opens you should see your two monitors. Find out which is which by clicking Identify Monitors.
  • Click and drag the right-hand monitor to the left or vice versa. (Drag and drop to the left or right).

That should change the positions of the two monitors so that the mouse motions should be the way you want them.