DeveloperBreeze

Find the code you need

Search through tutorials, code snippets, and development resources

Tutorial

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

وتستخدم أقل، حيث يتم تعيين التبعية مباشرة في خاصية داخل الكائن.

تستخدم العديد من الأُطر الحديثة—مثل Laravel، Symfony، Spring، Angular—حاويات (Containers) تقوم بإدارة وإنشاء التبعيات تلقائياً. يسمح هذا للمطور بالتركيز على منطق العمل بدلاً من إدارة إنشاء الكائنات يدوياً.

Dec 01, 2025
Read More
Tutorial

How to Stop SSH From Timing Out

This makes the server send a keep-alive packet every 60 seconds, allowing up to 3 missed replies before disconnecting.

Restart SSH:

Aug 21, 2025
Read More
Tutorial

How to Translate URLs in React (2025 Guide)

Create routes.js:

import Home from './pages/Home';
import About from './pages/About';

export const routes = (t) => [
  {
    path: `/${t('routes.home')}`,
    element: <Home />,
  },
  {
    path: `/${t('routes.about')}`,
    element: <About />,
  },
];

May 04, 2025
Read More
Tutorial

Globalization in React (2025 Trends & Best Practices)

Or customize promotions, payment options, and availability by locale.

In 2025, users expect more than just language translation — they want your app to feel native to their region, culture, and behavior.

May 04, 2025
Read More
Tutorial

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

/locales
  /en
    home.json
    dashboard.json
  /fr
    home.json
    dashboard.json

Then load them like:

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

Key Features:

  • Simplicity: Create stores using a straightforward API without the need for reducers or action types.
  • Performance: Optimized for performance with selective rendering and minimal re-renders.
  • Flexibility: Supports custom hooks, middleware, and integration with other libraries.
  • No Providers: Unlike Redux, Zustand doesn't require wrapping your app with context providers.

May 03, 2025
Read More
Tutorial

Mastering React Rendering Performance with Memoization and Context

React re-renders components when there's a change in state or props. While this ensures the UI stays in sync with data, it can also lead to redundant renders, especially in large component trees. Identifying and mitigating these unnecessary re-renders is key to optimizing performance.([GeeksforGeeks][2])

React.memo is a higher-order component that prevents functional components from re-rendering if their props haven't changed. It performs a shallow comparison of props and reuses the previous render result when possible.([JavaScript in Plain English][3])

May 03, 2025
Read More
Tutorial

How to Disable MySQL Password Validation on Ubuntu 25.04

Query OK, 0 rows affected

Check that the validation system is gone:

May 01, 2025
Read More
Tutorial

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

datadir = /var/lib/mysql

Change it to:

May 01, 2025
Read More
Tutorial

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

  • When prompted to choose a web server, select apache2.
  • Choose Yes when asked to configure the database for phpMyAdmin with dbconfig-common.
  • Set a password for the phpMyAdmin application.

Enable the mbstring PHP extension and restart Apache:

May 01, 2025
Read More
Tutorial

How to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)

If prime-run doesn't exist, create it:

sudo nano /usr/bin/prime-run

Apr 14, 2025
Read More
Tutorial

Avoiding Memory Leaks in C++ Without Smart Pointers

In this tutorial, you'll learn:

  • How memory leaks happen.
  • How to structure your code to avoid them.
  • A design pattern to manage dynamic memory safely (RAII without smart pointers).
  • A reusable ScopedPointer class to emulate unique_ptr in old C++.

Apr 11, 2025
Read More
Tutorial

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

A shallow copy copies the values of member variables as-is. If your class has a pointer member, both the original and copy point to the same memory.

class Shallow {
public:
    int* data;

    Shallow(int val) {
        data = new int(val);
    }

    ~Shallow() {
        delete data;
    }
};

Apr 11, 2025
Read More
Tutorial

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

if (!empty($_POST['phone_number'])) {
  die("Bot detected");
}

Why it works: Bots usually fill every field, including hidden ones. Real users never see it.

Apr 04, 2025
Read More
Tutorial

Build a Custom Rate Limiter in Node.js with Redis

{
  "error": "Too many requests. Try later."
}

Instead of IP address, use API keys for user-specific limits:

Apr 04, 2025
Read More
Tutorial

Arduino Basics: A Step-by-Step Tutorial

Table 1: A comparison of popular Arduino boards.

Choose your board based on the complexity and size of your project.

Feb 12, 2025
Read More
Tutorial
javascript

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

let video;
let detector;
let detections = [];

function setup() {
  // Create the canvas to match the video dimensions
  createCanvas(640, 480);
  // Capture video from the webcam
  video = createCapture(VIDEO);
  video.size(640, 480);
  video.hide();

  // Load the pre-trained COCO-SSD model
  cocoSsd.load().then(model => {
    detector = model;
    console.log("Model Loaded!");
    // Begin detecting objects every frame
    detectObjects();
  });
}

function detectObjects() {
  detector.detect(video.elt).then(results => {
    detections = results;
    // Continue detection in a loop
    detectObjects();
  });
}

function draw() {
  // Draw the video
  image(video, 0, 0);

  // Draw detection boxes and labels if available
  if (detections) {
    for (let i = 0; i < detections.length; i++) {
      let object = detections[i];
      stroke(0, 255, 0);
      strokeWeight(2);
      noFill();
      rect(object.bbox[0], object.bbox[1], object.bbox[2], object.bbox[3]);
      noStroke();
      fill(0, 255, 0);
      textSize(16);
      text(object.class, object.bbox[0] + 4, object.bbox[1] + 16);
    }
  }
}
  • 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.

Feb 12, 2025
Read More
Tutorial

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

npm install -g @tauri-apps/cli

We’ll start by creating a new Svelte project. You can use a template via degit:

Feb 12, 2025
Read More
Tutorial

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

  • Numeric literals (e.g., 42, 3.14)
  • Basic arithmetic operators: +, -, *, /
  • Parentheses for grouping expressions

Later, you can extend it to include variables, functions, or even control flow constructs.

Feb 12, 2025
Read More