Sunday, 30 November 2025

How to Specify Multiple Return Types Using Type Hints in Python

How to Specify Multiple Return Types Using Type Hints in Python

In Python, type hints improve code readability and help developers understand what kind of values are expected for function arguments and returns. But sometimes, a function can return multiple types, which raises the question: how can we specify these multiple return types?

In this blog post, I’ll walk you through different ways to handle multiple return types using Python type hints, covering various versions of Python and how to use unions, tuples, and type-checking libraries.

Read more »

Labels:

Saturday, 29 November 2025

Mastering Variable Names with Perl’s Data::Dumper

Debugging in Perl can often involve delving into complex data structures, making readability of the output a crucial factor. The default behavior of Data::Dumper to generate generic variable names like $VAR1, $VAR2, etc., can be unhelpful for more intricate debugging or when aiming to produce easily reusable code snippets. This blog explores several approaches to customize Data::Dumper output, each illustrated with unique code examples to demonstrate their practical applications.

Read more »

Labels:

Thursday, 27 November 2025

How to Use Both Python 2.x and Python 3.x in Jupyter Notebook

Working with multiple Python versions can be crucial when maintaining legacy systems while exploring the latest Python features. Jupyter (formerly IPython Notebook) supports this need by allowing users to switch between different Python versions within the same notebook environment. Below, I will guide you through the steps to set up both Python 2.x and Python 3.x kernels, without relying on Anaconda, using virtual environments.

Why Multiple Kernels?

In many projects, you may encounter libraries or code written specifically for either Python 2.x or Python 3.x. It’s often inconvenient to switch the Python version globally, especially if you’re juggling multiple projects that depend on different versions. Jupyter offers a way to install and use both Python 2.x and Python 3.x kernels side-by-side, so you can work in both environments seamlessly.

Read more »

Labels:

Wednesday, 26 November 2025

Understanding Terraform Drift: A Comprehensive Guide

In the era of cloud computing, Infrastructure as Code (IaC) has revolutionized how organizations manage their infrastructure. Tools like Terraform enable teams to define, version, and deploy resources declaratively, ensuring consistency, scalability, and reproducibility. However, even the most robust IaC workflows face a persistent challenge: infrastructure drift.

Terraform drift occurs when the actual state of your cloud resources diverges from the desired state defined in your Terraform configurations. This discrepancy can lead to security vulnerabilities, compliance failures, and operational chaos. In this comprehensive guide, we’ll dissect Terraform drift, exploring its root causes, detection strategies, resolution techniques, and prevention best practices. By the end, you’ll have the knowledge to safeguard your infrastructure against drift and maintain IaC integrity.

Table of Contents

  1. What is Terraform Drift?
    • Defining Drift
    • The Role of Terraform State
  2. Why Does Drift Occur?
    • Manual Changes
    • External Automation
    • Resource Deletion
    • Provider Updates
    • State File Corruption
  3. Detecting Drift
    • Terraform Commands
    • Third-Party Tools
    • Manual Audits
  4. Resolving Drift
    • Reapplying Configurations
    • Importing Resources
    • Lifecycle Policies
  5. Preventing Drift
    • Enforce IaC Workflows
    • CI/CD Pipelines
    • State Locking
    • Monitoring and Alerts
  6. Real-World Example: Drift in Action
  7. Best Practices for Managing Drift
Read more »

Labels:

Sunday, 23 November 2025

What happens first when Linux server is started?

The Linux boot process is a meticulously orchestrated sequence of events that transforms a powered-off machine into a fully operational system. For system administrators, developers, and enthusiasts, understanding this process is critical for troubleshooting, optimizing performance, and securing infrastructure. In this comprehensive guide, we’ll dissect every stage of the Linux boot process, from the moment you press the power button to the user login prompt. We’ll explore modern components like UEFI, initramfs, and systemd, and provide practical examples to solidify your understanding.

Table of Contents

  1. Introduction: Why Understanding the Boot Process Matters
  2. Stage 1: Power-On Self-Test (POST)
  3. Stage 2: UEFI/BIOS Initialization
  4. Stage 3: Bootloader (GRUB2) Execution
  5. Stage 4: Kernel Initialization and initramfs
  6. Stage 5: systemd – The Modern Init System
  7. Stage 6: Targets, Services, and Dependency Management
  8. Stage 7: User Login and Session Management
  9. Troubleshooting Boot Issues
Read more »

Labels:

Saturday, 22 November 2025

Exploring Grafana: Powerful Visualization for Multiple Use Cases


Grafana has emerged as a vital open-source platform widely utilized for creating powerful dashboards, visualizing data, and efficiently monitoring complex systems. Grafana’s flexibility, extensive integration capabilities, and robust visualization features have made it an indispensable tool for developers, IT administrators, data scientists, and DevOps professionals alike. In this in-depth exploration, we’ll uncover numerous use cases for Grafana, illustrating how it addresses a variety of needs across multiple sectors.

What is Grafana?

Grafana is an open-source analytics and monitoring solution known for its interactive and visually appealing dashboards. It supports a broad array of data sources, from traditional relational databases to real-time monitoring tools such as Prometheus, Elasticsearch, InfluxDB, and cloud services. Its interactive visualizations and intuitive user interface simplify understanding and analyzing complex datasets.

Read more »

Labels:

Thursday, 20 November 2025

Exiting Loops in Perl: last Instead of break


In Perl, if you’re looking to exit a loop prematurely, you might reach for a break statement similar to other programming languages. However, Perl does not use break. Instead, Perl provides the last statement to exit loop constructs.

Why Doesn’t break Work in Perl?

In Perl, break is not a recognized keyword for exiting loops. If you try to use break while use strict; is enabled, you’ll encounter an error because Perl interprets it as a bareword (an undeclared subroutine or variable). Here’s what typically goes wrong:

for my $entry (@array) {
    if ($entry eq "text") {
        break;  # Incorrect! Perl doesn't recognize 'break'
    }
}
Read more »

Labels:

Wednesday, 19 November 2025

How to Iterate Over a Range of Numbers Defined by Variables in Bash

When working with Bash, iterating over a range of numbers is common in scripting. One might naturally reach for brace expansion (e.g., {1..5}) when the range is hardcoded, but things get a bit trickier when the range is defined by variables. In this blog post, we’ll explore different ways to iterate over a range of numbers when the endpoints are determined by variables.

Read more »

Labels:

Tuesday, 18 November 2025

How to Run a Local Shell Script on a Remote Machine via SSH

If you want to run a local shell script on a remote machine using SSH, there are several ways to achieve this depending on whether you’re using a Windows or Unix-based system. Here’s a guide for both environments:

For Unix-Based Systems (Linux/macOS)

You can use ssh to execute a local shell script on a remote machine without needing to copy the script over. The command works by sending the script via standard input to be executed on the remote server:

ssh user@MachineB 'bash -s' < local_script.sh
Read more »

Labels:

Saturday, 15 November 2025

Removing Duplicates from an Array in Perl

When working with arrays in Perl, you might encounter situations where you need to remove duplicate elements. Perl, with its versatile data structures, offers several ways to accomplish this task. Let’s explore different approaches to remove duplicates from an array, demonstrating the flexibility and power of Perl.

Approach 1: Using a Hash to Filter Unique Elements

One of the simplest and most efficient ways to remove duplicates from an array is by using a hash. Hashes in Perl inherently prevent duplicate keys, which makes them ideal for this task.

Read more »

Labels:

Wednesday, 12 November 2025

Developing an Asset Tracking System in ServiceNow

Asset management is a critical component of IT operations, ensuring that an organization’s assets are accounted for, deployed, maintained, and disposed of when necessary. ServiceNow offers robust capabilities for managing these assets. In this post, we’ll walk through how to develop a custom asset tracking system on ServiceNow to help streamline the asset management process.

Objective

Our goal is to create a custom application on ServiceNow that automates asset tracking, from procurement to disposal, and provides real-time visibility into asset status and location.

Step 1: Setting Up Your Environment

First, ensure you have access to a ServiceNow developer instance. You can obtain a free developer instance from the ServiceNow Developer Program, which includes all the tools and resources needed for building applications.

Step 2: Creating the Asset Tracking Application

  1. Launch ServiceNow Studio: Access the Studio from your ServiceNow dashboard by typing ‘Studio’ in the left-hand filter navigator.

  2. Create a New Application:

    • Click on ‘Create Application’.
    • Fill in the application details:
      • Name: Advanced Asset Tracking
      • Description: Automate and manage your asset tracking efficiently.
      • Application Scope: Ensure to specify a new scope for this application.

Step 3: Designing the Database Structure

  1. Create Tables:

    • Define a new table named Asset Register.
    • Add relevant fields such as Asset ID, Asset Type, Purchase Date, Status, Current User, and Location.
  2. Set Up Relationships:

    • Establish relationships between Asset Register and other existing ServiceNow tables like User table to link assets to current users or departments.

Step 4: Implementing Business Logic

  1. Business Rules:
    • Create a business rule to automatically update the Status field when an asset is checked out or checked in.
    • Script Example:
      (function executeRule(current, previous) {
          // This rule triggers when the 'Location' field changes
          if (current.Location != previous.Location) {
              if (current.Location == 'Storage') {
                  current.Status = 'In Stock';
              } else {
                  current.Status = 'Checked Out';
              }
              gs.addInfoMessage('Asset status updated to ' + current.Status);
          }
      })();
      

Step 5: Workflow Automation

  1. Create Workflows:
    • Develop a workflow to automate notifications when an asset’s status changes, such as when it is due for maintenance or replacement.
    • Use the workflow editor to drag and drop workflow elements like notifications, approvals, and conditions.

Step 6: User Interface and User Experience

  1. Customize Forms and Views:
    • Design user-friendly forms for asset entry and updates.
    • Customize views for different users, like IT staff and department heads, to provide relevant information tailored to their needs.

Step 7: Testing and Quality Assurance

  1. Conduct Thorough Testing:
    • Test all aspects of the application, including form submissions, workflow triggers, and business rules.
    • Ensure that notifications are sent correctly and that data integrity is maintained.

Step 8: Deployment and Training

  1. Deploy Your Application:

    • Move the application from development to the production environment.
    • Ensure all configurations and customizations are correctly transferred.
  2. Train End Users:

    • Organize training sessions for different user groups to ensure they are familiar with how to use the new system effectively.

By following these steps, you can develop a comprehensive asset tracking system within ServiceNow that not only enhances the efficiency of asset management processes but also improves visibility and control over organizational assets. This custom application will help ensure that assets are utilized optimally, reducing the total cost of ownership and supporting better investment decisions.

Labels:

Monday, 10 November 2025

14 Essential Free Courses Every Developer Should Learn

In today's fast-paced world, technology is constantly evolving, and it's essential for developers to stay up-to-date with the latest tools and trends. Whether you're a seasoned pro or just starting out, there are certain technologies that are must-knows for any developer. In this article, we'll explore 14 essential tools and technologies that every developer should master to take their skills to the next level.


1. Git: The Foundation of Version Control 💻

Git is a version control system that allows developers to track changes in code over time. It's an essential tool for collaborative work and is used by many organizations worldwide. Learn how to use Git effectively with our comprehensive course on LinkedIn Learning. 🔗 https://t.co/tjoVxVoKk4

Read more »

Labels:

Sunday, 9 November 2025

Building an ETL Pipeline with Perl and Amazon Redshift

Creating an ETL pipeline that interacts with a data warehouse (e.g., Amazon Redshift, Google BigQuery, Snowflake, etc.) is a common use case in modern data engineering. In this blog post, we’ll walk through building an ETL pipeline in Perl that extracts data from a data warehouse, transforms it, and loads it into another data warehouse or database. For this example, we’ll use Amazon Redshift as the data warehouse.

Overview

This ETL pipeline will:

  1. Extract: Fetch data from an Amazon Redshift data warehouse.
  2. Transform: Perform transformations on the data (e.g., cleaning, aggregations, or calculations).
  3. Load: Insert the transformed data into another Amazon Redshift table or a different data warehouse.
Read more »

Labels:

Saturday, 8 November 2025

Which Version of Perl Should I Use on Windows?

 When it comes to using Perl on Windows, there are two main distributions to choose from: ActivePerl and Strawberry Perl. Both have their own advantages, and the choice largely depends on your specific needs and preferences. Let’s explore the differences between these two popular Perl distributions to help you decide which is the best fit for your environment.

ActivePerl: A Long-Standing Favorite

ActivePerl, provided by ActiveState, has been the go-to Perl distribution for Windows users for many years. It’s often chosen by enterprise environments and developers who value stability and ease of deployment. Here are some key features:

Read more »

Labels:

Thursday, 6 November 2025

Automating Package and Service Deployment in DevOps

In today’s digital era, where software delivery speed and reliability are paramount, DevOps has emerged as the backbone of modern IT organizations. One of the most critical aspects of DevOps is the automation of package and service deployment. Manual deployments are error-prone, slow, and unscalable. Automation, on the other hand, brings consistency, speed, and confidence to the release process.

In this comprehensive guide, we’ll explore why deployment automation matters, the key concepts and tools involved, a step-by-step approach to automating deployments, and best practices to ensure your automation journey is successful. Whether you’re a DevOps engineer, developer, or IT manager, this post will equip you with the knowledge to transform your deployment process.

Table of Contents

  1. Why Automate Deployments?
  2. Key Concepts in Deployment Automation
  3. Popular Tools for Deployment Automation
  4. Step-by-Step Guide to Automating Deployments
  5. Best Practices for Deployment Automation
  6. Common Challenges and How to Overcome Them
  7. Real-World Example: Automating a Web Service Deployment
Read more »

Labels:

Tuesday, 4 November 2025

Automating Image Optimization and Upload to Google Cloud Storage Using Python and Cloud Functions

In the digital landscape, images are a fundamental component of web design, marketing, and content creation. They enhance user engagement, convey messages, and create visual appeal. However, high-resolution images can significantly affect website performance, leading to slower load times and increased bandwidth consumption. This is where image optimization comes into play. In this comprehensive blog post, we will explore how to create a Python script using Google Cloud Functions to automatically optimize images and upload them to Google Cloud Storage (GCS).

The Importance of Image Optimization

Before we delve into the technical details, let’s discuss why image optimization is crucial for modern web applications:

1. Faster Load Times

Optimized images load faster, which is essential for providing a seamless user experience. Studies have shown that users are likely to abandon a website if it takes more than a few seconds to load. By reducing image sizes, we can significantly improve load times, leading to higher user retention and satisfaction.

2. Reduced Bandwidth Usage

Large images consume more bandwidth, which can lead to increased costs, especially for websites with high traffic. By optimizing images, we can reduce the amount of data transferred, saving both bandwidth and costs associated with data transfer.

3. Improved SEO

Search engines like Google prioritize fast-loading websites in their rankings. Optimized images contribute to better page load speeds, which can improve your website’s search engine optimization (SEO) and visibility.

4. Storage Efficiency

Storing high-resolution images can quickly consume storage space, leading to increased costs in cloud storage solutions. Optimizing images not only reduces their size but also helps in managing storage more efficiently.

Read more »

Labels:

Saturday, 1 November 2025

How to Deploy a Node.js App on AWS ECS and Automate It with GitHub Actions [Hands-On Guide]

Deployments can be intimidating, but with a robust platform like AWS ECS and the automation power of GitHub Actions, it doesn’t have to be. If you’re a developer, tech enthusiast, or DevOps engineer wanting to deploy a Node.js app, this guide walks you through every detailed step — from setting up AWS ECS to automating the process using GitHub Actions.

By the time you finish, your Node.js app will be live in an AWS ECS cluster with continuous deployment in place. Let’s get started!

Read more »

Labels:

Getting the Current Date and Time in Python: A Practical Guide

Python offers a variety of ways to retrieve the current date and time, breaking it down into individual components such as year, month, day, hour, and minute. This functionality is crucial in many applications, ranging from logging events to timestamping data entries. In this post, we will explore different methods to achieve this, highlighting a few alternatives beyond the commonly used datetime module.

Method 1: Using time and struct_time

The time module provides a straightforward way to access the current time and break it down into its components. Here’s how you can use time.localtime():

Read more »

Labels: