Posts

Overcoming Dynamic Route Handling in a Static Next.js + Firebase Hosting Project

Image
In one of the recent projects we worked on the SEO of a full-featured e-commerce website using Next.js which was hosted on Firebase Hosting . While this stack offers excellent performance and scalability, it also posed some unique challenges—especially when it came to handling dynamic routes in a statically exported Next.js project. Let me share one particularly interesting problem we solved: Enabling dynamic country-based brand pages (e.g., /pages/brands/india) while using static exports. The Challenge Next.js typically supports dynamic routing through its file-based system, where you can create pages like [slug].jsx. However, when using next export , all routes need to be known at build time since the project becomes a collection of static HTML files. This limitation became obvious when we needed a page like: /pages/brands/[country] We didn’t want to create a new file for every country. Instead, we wanted to use a single brands.jsx file that adapt...

A Triumph Over Adversity: The WordPress IONOS Hosting User’s Guide to Redirecting .aspx Files

Image
Redirecting a URL should be straightforward, correct? That’s what we thought, too. However, as we discovered, redirecting a specific .aspx path to an external URL in a WordPress site hosted on IONOS proved to be more of a trial by fire than anticipated. This article describes the frustrating—but ultimately successful—journey of making the redirect work. The Goal We wanted a basic redirect: https://example.com/stub/example.aspx to send visitors to: https://www.foobar.com/stub/example.aspx That’s it. A one-line change, right? Well… no. Attempt 1: The Obvious .htaccess Redirect We started with the simplest approach: Redirect 301 /stub/example.aspx https://www.foobar.com/stub/example.aspx Placed neatly above the WordPress block in .htaccess. Result: Didn’t work. The browser tried to download the .aspx file instead. Attempt 2: mod_rewrite to the Rescue We escalated to Apache’s rewrite rules: RewriteEngi...

How to implement Job Queuing in Spring Boot with RabbitMQ

Image
RabbitMQ’s Springboot usage code and RabbitMQ Admin Panel side by side While working on a microservice in my current organization I noticed that I had the need to do some very large jobs in queues. This was because the jobs that I was attempting to perform were sometimes taking a long time and blocking the system. Hence, to increase its responsiveness and to ensure future scalability I decided that I needed to implement a queueing system. So, I looked at the web and decided on RabbitMQ because of its free and open-source nature and also because of its easy integration with Linux since ultimately, I host my microservice on Nginx on Ubuntu. So, here are some steps which I followed and which you can also roughly follow in order to implement a queuing system. Installing RabbitMQ on Ubuntu The following steps will be able to install RabbitMQ: 1.      Update the package list: sudo apt update -y 2.      Install Erlang (this is required for RabbitMQ): sudo ap...

How to Use Google Apps Script to Automate Google Sheets

Image
Google Apps Script (GAS) is a powerful tool for automating, customizing, and enhancing Google Sheets.  Recently, I investigated various automation techniques using GAS, and I am sharing a step-by-step guide to help others use it for their own projects.Whether you are a developer or new to scripting, this guide will walk you through basic automation to UI enhancements. Why Use Google Apps Script? Automate repetitive tasks in Google Sheets Improve data processing efficiency Create custom functions and triggers Enhance user experience with UI elements like modals and loaders Getting Started: Writing Your First Google Apps Script How to Access Google Apps Script Open  Google Sheets . Click on  Extensions > Apps Script . The above command opens the  apps script editor , where you can start coding. Writing Your First Script Try this simple script to write “Hello, World!” into a cell: function writeHelloWorld() { var sheet = Spread...

How I Upgraded My Honor MagicBook 14 from 512GB to 2TB SSD

Image
Especially if you routinely work with big files or require extra space for programs, upgrading the storage of a laptop is one of the finest methods to boost its performance and usability. I recently changed my Honor MagicBook 14 from a 512GB SSD to a 2TB SSD, and I would want to let you know how I managed to finish the operation successfully. Step 1: Choosing the Right SSD I had to decide on the right kind of SSD for my laptop before I bought anything. Since the Honor MagicBook 14 features an M.2 2280 NVMe PCIe SSD, I made sure the replacement drive fit these criteria. Following extensive investigation, I decided on the Black SN770 2TB NVMe SSD from Western Digital (WD), which boasts exceptional speed and dependability. My old NVME SSD zoomed in. I had to be extra careful as the WD SSD didn’t have a return policy and it cost 11K INR! Why WD BLACK SN770? High Speed: PCIe 4.0 x4 (backward compatible with PCIe 3.0) Capacity: 2TB (a massive upgrade from 51...

How to Fix ‘429 Too Many Requests’ When Fetching Images From Google APIs In Java

Image
Sometimes requesting a large number of image resources to fast leads to a 429 error from Google Summary Excessive queries to any Google Cloud API may result in a 429 Too Many Queries error. This occurs due to Google’s imposition of rate limitations on API calls. In this article we are going to solve the problem of encountering 429 error when requesting images many times from the Google Cloud APIs or any Google service like Google Photos, Google Drive, etc. Resolution Establish a Retry Mechanism: Upon encountering a 429 error, pause and attempt the request again. Cache API Responses: Retain image URLs locally to prevent redundant API requests. Implement Exponential Backoff: Augment the interval between attempts. Step 1: Implement a Retry Mechanism Add the following methods to fetch and cache the images: private String CACHE_DIR = "/usr/local/storage"; //Or any other local path in your environment public String fetchAndCacheImage(Stri...

Compromised ecosystem of WordPress plugins

Image
Compromises and backdoors have been found even on plugins from the official wordpress.org marketplace These days the websites on the internet comprise a large number of WordPress websites; over 37% of the total websites on the internet are WordPress websites alone. This is a staggering number, as there are several web technologies that are available, but WordPress has become the choice of so many people. While this is good for standardization of content management systems and for developing standard practices for management of websites, it also makes WordPress websites a target for cyberattacks. One of the major routes through which attacks on WordPress websites take place is plugins. Plugins on WordPress can be installed from the WordPress marketplace or using zip files. The developers can also develop their own plugins and install them on the sites. The problem arises when a malicious agent modifies any established plugin in such a way that it allows the agent to access the ...