DeveloperBreeze

Find the code you need

Search through tutorials, code snippets, and development resources

Tutorial

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

مثال بسيط بلغة PHP:

class Logger {
    public function log($message) {
        echo $message;
    }
}

class UserService {
    protected $logger;

    public function __construct(Logger $logger) {
        $this->logger = $logger;
    }

    public function create() {
        $this->logger->log("User created.");
    }
}

Dec 01, 2025
Read More
Tutorial

How to Stop SSH From Timing Out

Edit the SSH daemon config:

sudo nano /etc/ssh/sshd_config

Aug 21, 2025
Read More
Tutorial

How to Translate URLs in React (2025 Guide)

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 />,
  },
];

Update App.js:

May 04, 2025
Read More
Tutorial

Globalization in React (2025 Trends & Best Practices)

new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD'
}).format(4999.99);

// Output: $4,999.99

Make this dynamic in React:

May 04, 2025
Read More
Tutorial

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

Example en.json:

{
  "welcome": "Welcome to our platform!",
  "language": "Language",
  "date_example": "Today's date is {{date, datetime}}",
  "price_example": "Price: {{price, currency}}"
}

May 04, 2025
Read More
Tutorial

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

Install Vue + Webpack in the analytics-app:

npm init vue@latest
cd analytics-app
npm install

May 04, 2025
Read More
Tutorial

State Management Beyond Redux: Using Zustand for Scalable React Apps

Zustand supports middleware for logging, persisting state, and more. For example, integrating with Redux DevTools:

import create from 'zustand';
import { devtools } from 'zustand/middleware';

const useStore = create(devtools((set) => ({
  count: 0,
  increase: () => set((state) => ({ count: state.count + 1 })),
})));

May 03, 2025
Read More
Tutorial

Mastering React Rendering Performance with Memoization and Context

This approach ensures that the expensive computation runs only when data changes, improving performance.

The Context API allows for sharing state across components without prop drilling. However, improper use can lead to performance issues, as any change in context value triggers re-renders in all consuming components.([Medium][6], [GeeksforGeeks][2])

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

Edit AppArmor profile for MySQL:

sudo nano /etc/apparmor.d/usr.sbin.mysqld

May 01, 2025
Read More
Tutorial

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

Composer is essential for managing PHP dependencies:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
sudo mv composer.phar /usr/local/bin/composer
composer --version

May 01, 2025
Read More
Tutorial

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

Run:

sudo ubuntu-drivers devices

Apr 14, 2025
Read More
Tutorial

Avoiding Memory Leaks in C++ Without Smart Pointers

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;
}

Not elegant. Easy to forget or misplace deletes. Let's go better.

Apr 11, 2025
Read More
Tutorial

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

  • What shallow vs deep copy means
  • The problems caused by shallow copy
  • How to implement deep copy correctly
  • A practical class example with dynamic memory
  • When to use Rule of Three vs Rule of Five

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.

Apr 11, 2025
Read More
Tutorial

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

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

Most humans take a few seconds to fill a form. Bots fill and submit instantly.

Apr 04, 2025
Read More
Tutorial

Build a Custom Rate Limiter in Node.js with Redis

Create a .env file:

REDIS_URL=redis://localhost:6379

Apr 04, 2025
Read More
Tutorial

Arduino Basics: A Step-by-Step Tutorial


// Arduino LED Blink Example

// The setup function runs once when you press reset or power the board.
void setup() {
  // Initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

// The loop function runs repeatedly forever.
void loop() {
  digitalWrite(13, HIGH);  // Turn the LED on (HIGH is the voltage level)
  delay(1000);             // Wait for one second (1000 milliseconds)
  digitalWrite(13, LOW);   // Turn the LED off by making the voltage LOW
  delay(1000);             // Wait for one second
}
  • setup(): Initializes digital pin 13 as an output.
  • loop(): Alternates the LED state every second.

Feb 12, 2025
Read More
Tutorial
javascript

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

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Real-Time Object Detection</title>
  <style>
    body {
      text-align: center;
      background: #222;
      color: #fff;
      font-family: sans-serif;
    }
    canvas {
      border: 2px solid #fff;
    }
  </style>
</head>
<body>
  <h1>Real-Time Object Detection Web App</h1>
  <!-- p5.js and TensorFlow.js -->
  <script src="https://cdn.jsdelivr.net/npm/p5@1.6.0/lib/p5.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@4.6.0/dist/tf.min.js"></script>
  <!-- Pre-trained model: COCO-SSD -->
  <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/coco-ssd"></script>
  <script src="sketch.js"></script>
</body>
</html>

This HTML file loads p5.js, TensorFlow.js, and the COCO-SSD model library. We also reference our custom script file (sketch.js), which will contain our application logic.

Feb 12, 2025
Read More
Tutorial

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

To install the Tauri CLI globally, run:

npm install -g @tauri-apps/cli

Feb 12, 2025
Read More
Tutorial

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

Example DSL Code:

(3 + 4) * (5 - 2) / 2

Feb 12, 2025
Read More