DeveloperBreeze

Find the code you need

Search through tutorials, code snippets, and development resources

Tutorial

ما هو حقن التبعيات (Dependency Injection)؟

يتم تمرير التبعية عند استدعاء وظيفة معينة تحتاج إليها.

public function handle(Logger $logger) {
    $logger->log("Handling action...");
}

Dec 01, 2025
Read More
Tutorial

How to Stop SSH From Timing Out

Add these lines:

ClientAliveInterval 60
ClientAliveCountMax 3

Aug 21, 2025
Read More
Tutorial

How to Translate URLs in React (2025 Guide)

npx create-react-app react-i18n-routing
cd react-i18n-routing

Install necessary dependencies:

May 04, 2025
Read More
Tutorial

Globalization in React (2025 Trends & Best Practices)

By implementing full globalization in your React application, you gain:

  • Wider reach
  • Better SEO
  • User trust and satisfaction
  • Competitive advantage

May 04, 2025
Read More
Tutorial

Implementing Internationalization (i18n) in a Large React Application (2025 Guide)

detection: {
  order: ['localStorage', 'navigator', 'htmlTag'],
  caches: ['localStorage'],
}

This saves the user's preferred language so it's remembered on the next visit.

May 04, 2025
Read More
Tutorial

Building Micro-Frontends with Webpack Module Federation (2025 Guide)

Each micro-frontend should be versioned and deployed separately.

Use shared in Module Federation to prevent loading duplicate libraries (like react, vue, etc.).

May 04, 2025
Read More
Tutorial

State Management Beyond Redux: Using Zustand for Scalable React Apps

   import React from 'react';
   import useStore from './store';

   function Counter() {
     const { count, increase, decrease } = useStore();
     return (
       <div>
         <h1>{count}</h1>
         <button onClick={increase}>Increase</button>
         <button onClick={decrease}>Decrease</button>
       </div>
     );
   }

   export default Counter;

With these steps, you've set up a basic state management system using Zustand without the need for additional boilerplate or context providers.

May 03, 2025
Read More
Tutorial

Mastering React Rendering Performance with Memoization and Context

In this example, Greeting will only re-render when the name prop changes. This optimization is particularly beneficial for components that render frequently with the same props.([React][4], [Content That Scales][5])

Passing functions as props can cause child components to re-render unnecessarily because functions are recreated on every render. The useCallback hook memoizes functions, ensuring they maintain the same reference unless their dependencies change.([React][4])

May 03, 2025
Read More
Tutorial

How to Disable MySQL Password Validation on Ubuntu 25.04

Then you'll need to restart MySQL:

sudo systemctl restart mysql

May 01, 2025
Read More
Tutorial

How to Move the MySQL Data Directory to a New Location on Ubuntu 25.04

If needed, recreate the MySQL socket directory:

sudo mkdir -p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld

May 01, 2025
Read More
Tutorial

How to Install PHP, MySQL, and phpMyAdmin on Ubuntu 25.04 (LAMP Stack Setup Guide)

Enable the mbstring PHP extension and restart Apache:

sudo phpenmod mbstring
sudo systemctl restart apache2

May 01, 2025
Read More
Tutorial

Avoiding Memory Leaks in C++ Without Smart Pointers

What’s wrong? If someCondition() returns true, buffer is never deallocated.

void loadData() {
    char* buffer = new char[1024];
    try {
        if (someCondition()) {
            throw std::runtime_error("Something went wrong");
        }
        // more code...
    } catch (...) {
        delete[] buffer;
        throw;
    }
    delete[] buffer;
}

Apr 11, 2025
Read More
Tutorial

Deep Copy in C++: How to Avoid Shallow Copy Pitfalls

You must implement all three. This is called the Rule of Three.

class String {
private:
    char* buffer;

public:
    String(const char* str) {
        buffer = new char[strlen(str) + 1];
        strcpy(buffer, str);
    }

    // Copy constructor
    String(const String& other) {
        buffer = new char[strlen(other.buffer) + 1];
        strcpy(buffer, other.buffer);
    }

    // Assignment operator
    String& operator=(const String& other) {
        if (this != &other) {
            delete[] buffer;
            buffer = new char[strlen(other.buffer) + 1];
            strcpy(buffer, other.buffer);
        }
        return *this;
    }

    ~String() {
        delete[] buffer;
    }

    void print() const {
        std::cout << buffer << std::endl;
    }
};

Apr 11, 2025
Read More
Tutorial

Protect Your Forms Like a Pro: Anti-Spam Techniques That Actually Work

// pseudo-code
if (requestsFromIP > 3 in 60 seconds) {
  block temporarily
}

You can also use middleware like:

Apr 04, 2025
Read More
Tutorial

Build a Custom Rate Limiter in Node.js with Redis

You’re no longer blindly relying on a package—you understand and control the system.

Want to extend this?

Apr 04, 2025
Read More
Tutorial

Arduino Basics: A Step-by-Step Tutorial

  • Arduino board (e.g., Arduino Uno)
  • Breadboard
  • LED
  • 220Ω resistor
  • Jumper wires
  • Connect the longer leg (anode) of the LED to digital pin 13.
  • Connect the shorter leg (cathode) to one end of the 220Ω resistor.

Feb 12, 2025
Read More
Tutorial
javascript

Building a Real-Time Object Detection Web App with TensorFlow.js and p5.js

  • Setup: The setup function initializes the canvas and video capture. The video is hidden by p5.js’s default element so that we can draw it onto the canvas manually.
  • Model Loading: We load the COCO-SSD model asynchronously. Once the model is ready, we start continuous object detection by calling detectObjects().
  • Detection Loop: The detectObjects function uses the loaded model to analyze the current video frame and stores the detection results. It recursively calls itself so that new frames are analyzed continuously.
  • Drawing: In the draw loop, the video feed is displayed and for each detected object, a rectangle and label are drawn. The bounding box coordinates and object class are provided by the model.

Now that you have a basic real-time object detection app, consider extending its functionality:

Feb 12, 2025
Read More
Tutorial

Building a Cross-Platform Desktop App with Tauri and Svelte: A Step-by-Step Tutorial

Tauri leverages web technologies to build native desktop applications while offloading critical operations to Rust. Paired with Svelte—a fast, compile-time JavaScript framework—you can create modern apps that are both visually appealing and highly performant. This tutorial will walk you through setting up your development environment, creating a Svelte project, integrating Tauri, and building your first desktop app.

Before diving in, ensure you have the following installed:

Feb 12, 2025
Read More
Tutorial

Implementing a Domain-Specific Language (DSL) with LLVM and C++

#include "DSL/Parser.h"
#include <stdexcept>

Parser::Parser(Lexer& lexer) : lexer(lexer) {
    currentToken = lexer.getNextToken();
}

void Parser::eat(TokenType type) {
    if (currentToken.type == type) {
        currentToken = lexer.getNextToken();
    } else {
        throw std::runtime_error("Unexpected token: " + currentToken.text);
    }
}

std::unique_ptr<ASTNode> Parser::factor() {
    if (currentToken.type == TokenType::Number) {
        auto node = std::make_unique<NumberExprAST>(currentToken.value);
        eat(TokenType::Number);
        return node;
    } else if (currentToken.type == TokenType::LParen) {
        eat(TokenType::LParen);
        auto node = parseExpression();
        eat(TokenType::RParen);
        return node;
    }
    throw std::runtime_error("Invalid syntax in factor.");
}

std::unique_ptr<ASTNode> Parser::term() {
    auto node = factor();
    while (currentToken.type == TokenType::Asterisk || currentToken.type == TokenType::Slash) {
        TokenType op = currentToken.type;
        eat(op);
        auto right = factor();
        node = std::make_unique<BinaryExprAST>(op, std::move(node), std::move(right));
    }
    return node;
}

std::unique_ptr<ASTNode> Parser::parseExpression() {
    auto node = term();
    while (currentToken.type == TokenType::Plus || currentToken.type == TokenType::Minus) {
        TokenType op = currentToken.type;
        eat(op);
        auto right = term();
        node = std::make_unique<BinaryExprAST>(op, std::move(node), std::move(right));
    }
    return node;
}

Our AST nodes will represent numeric literals and binary operations. Later, these nodes are traversed to generate LLVM IR.

Feb 12, 2025
Read More