Find the code you need
Search through tutorials, code snippets, and development resources
ما هو حقن التبعيات (Dependency Injection)؟
بهذه الطريقة، يصبح كل كائن أقل اعتماداً على التفاصيل الداخلية، وأكثر مرونة وقابلاً للاختبار.
عندما تعتمد الكائنات على إنشاء التبعيات داخلياً، فإن النظام يصبح مترابطاً بشكل كبير. حقن التبعيات يفصل عملية الإنشاء عن الاستخدام، مما يقلل الترابط ويجعل البنية أكثر تنظيماً.
How to Stop SSH From Timing Out
If your SSH session closes after a minute of inactivity, it’s usually caused by idle timeouts. You can fix this with keep-alive settings on both the server and client.
Edit the SSH daemon config:
How to Translate URLs in React (2025 Guide)
Create pages/Home.js:
import { useTranslation } from 'react-i18next';
export default function Home() {
const { t } = useTranslation();
return (
<div>
<h1>{t('title')}</h1>
</div>
);
}Globalization in React (2025 Trends & Best Practices)
- GDPR requires local-language privacy policies
- China's Cybersecurity Law needs local hosting + Mandarin support
- Saudi localization laws mandate Arabic for all government services
Your React app must support legal localization where applicable.
Implementing Internationalization (i18n) in a Large React Application (2025 Guide)
npm install i18next react-i18next i18next-browser-languagedetectorCreate a new file: src/i18n.js
Building Micro-Frontends with Webpack Module Federation (2025 Guide)
npm install -D webpack webpack-cli webpack-dev-server html-webpack-pluginCreate a webpack.config.js:
State Management Beyond Redux: Using Zustand for Scalable React Apps
import create from 'zustand';
import { persist } from 'zustand/middleware';
const useStore = create(persist(
(set) => ({
count: 0,
increase: () => set((state) => ({ count: state.count + 1 })),
}),
{
name: 'counter-storage',
}
));Zustand allows you to select specific parts of the state to prevent unnecessary re-renders:
Mastering React Rendering Performance with Memoization and Context
const increment = useCallback(() => setCount(c => c + 1), []);Implementing these practices ensures that only components dependent on specific context values re-render when those values change.([Medium][7])
How to Disable MySQL Password Validation on Ubuntu 25.04
If you want to bring back strong password policies:
INSTALL COMPONENT 'file://component_validate_password';How to Move the MySQL Data Directory to a New Location on Ubuntu 25.04
Ensure MySQL can access the new directory:
sudo chown -R mysql:mysql /mnt/data/mysqlHow to Install PHP, MySQL, and phpMyAdmin on Ubuntu 25.04 (LAMP Stack Setup Guide)
php -vInstall the MySQL server package:
How to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)
If your NVIDIA GPU isn’t detected properly on Ubuntu, or nvidia-smi shows an error like "couldn't communicate with the NVIDIA driver", this guide will walk you through how to fix that.
This was tested and confirmed working on a Dell Vostro 3521 with an NVIDIA GeForce MX350 GPU.
Avoiding Memory Leaks in C++ Without Smart Pointers
C++ developers often face memory management headaches, especially when working on legacy systems that don’t use C++11 or newer. Smart pointers like std::unique_ptr and std::shared_ptr are powerful, but what if you’re stuck with raw pointers?
In this tutorial, you'll learn:
Deep Copy in C++: How to Avoid Shallow Copy Pitfalls
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;
}
};String a("Hello");
String b = a; // deep copy
String c("World");
c = a; // deep assignmentProtect Your Forms Like a Pro: Anti-Spam Techniques That Actually Work
A honeypot is a hidden form field that users don’t see, but bots do. If the field is filled, you know it’s a bot.
<input type="text" name="phone_number" style="display:none" autocomplete="off">Build a Custom Rate Limiter in Node.js with Redis
curl http://localhost:3000After 100 requests within an hour, you’ll get:
Arduino Basics: A Step-by-Step Tutorial
Table 2: Digital vs. Analog signals in Arduino projects.
One of the simplest and most popular starter projects is blinking an LED. Follow these steps:
Building a Real-Time Object Detection Web App with TensorFlow.js and p5.js
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.
Create a new file called sketch.js in your project folder. We’ll use p5.js to access the webcam and display the video on a canvas:
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:
Implementing a Domain-Specific Language (DSL) with LLVM and C++
#ifndef DSL_LEXER_H
#define DSL_LEXER_H
#include <string>
#include <vector>
enum class TokenType {
Number,
Plus,
Minus,
Asterisk,
Slash,
LParen,
RParen,
EndOfFile,
Invalid
};
struct Token {
TokenType type;
std::string text;
double value; // Only valid for Number tokens.
};
class Lexer {
public:
Lexer(const std::string& input);
Token getNextToken();
private:
const std::string input;
size_t pos = 0;
char currentChar();
void advance();
void skipWhitespace();
Token number();
};
#endif // DSL_LEXER_HImplementation: Lexer.cpp