Find the code you need
Search through tutorials, code snippets, and development resources
ما هو حقن التبعيات (Dependency Injection)؟
وتستخدم أقل، حيث يتم تعيين التبعية مباشرة في خاصية داخل الكائن.
تستخدم العديد من الأُطر الحديثة—مثل Laravel، Symfony، Spring، Angular—حاويات (Containers) تقوم بإدارة وإنشاء التبعيات تلقائياً. يسمح هذا للمطور بالتركيز على منطق العمل بدلاً من إدارة إنشاء الكائنات يدوياً.
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:
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 />,
},
];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.
Implementing Internationalization (i18n) in a Large React Application (2025 Guide)
/locales
/en
home.json
dashboard.json
/fr
home.json
dashboard.jsonThen load them like:
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.).
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.
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])
How to Disable MySQL Password Validation on Ubuntu 25.04
Query OK, 0 rows affectedCheck that the validation system is gone:
How to Move the MySQL Data Directory to a New Location on Ubuntu 25.04
datadir = /var/lib/mysqlChange it to:
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:
How to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)
If prime-run doesn't exist, create it:
sudo nano /usr/bin/prime-runAvoiding 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
ScopedPointerclass to emulateunique_ptrin old C++.
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;
}
};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.
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:
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.
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
setupfunction 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
detectObjectsfunction 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
drawloop, 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.
Building a Cross-Platform Desktop App with Tauri and Svelte: A Step-by-Step Tutorial
npm install -g @tauri-apps/cliWe’ll start by creating a new Svelte project. You can use a template via degit:
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.