Find the code you need
Search through tutorials, code snippets, and development resources
ما هو حقن التبعيات (Dependency Injection)؟
عندما تعتمد الكائنات على إنشاء التبعيات داخلياً، فإن النظام يصبح مترابطاً بشكل كبير. حقن التبعيات يفصل عملية الإنشاء عن الاستخدام، مما يقلل الترابط ويجعل البنية أكثر تنظيماً.
يسهل حقن التبعيات استبدال العناصر الحقيقية بمحاكاة (Mocks) أثناء الاختبارات، مما يقلل التعقيد ويزيد دقة نتائج الاختبار.
How to Stop SSH From Timing Out
sudo nano /etc/ssh/sshd_configAdd these lines:
How to Translate URLs in React (2025 Guide)
/src
/locales
en.json
fr.json
/pages
Home.js
About.js
i18n.js
App.js
routes.jsCreate i18n.js:
Globalization in React (2025 Trends & Best Practices)
In 2025, more users are accessing the web from non-English regions than ever before. Some reasons to globalize your React app:
- Reach global markets (especially MENA, LATAM, Asia-Pacific)
- Improve SEO for localized queries
- Build trust with users by reflecting their cultural norms
- Comply with regional laws and accessibility standards
Implementing Internationalization (i18n) in a Large React Application (2025 Guide)
- Add
langattribute dynamically to<html lang="..."> - Use language subpaths (e.g.,
/en/home,/fr/home) for SEO indexing - Translate all visible UI, not just text
- Localize URLs and metadata (title, description)
- Use
hreflangtags in SSR setups (Next.js, Remix)
Use localStorage via i18next-browser-languagedetector:
Building Micro-Frontends with Webpack Module Federation (2025 Guide)
Use shared in Module Federation to prevent loading duplicate libraries (like react, vue, etc.).
Use a design system or tokens for consistent UI/UX across micro-apps.
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 Developer Tools provides a Profiler tab to analyze component rendering behavior. Use it to identify components that re-render frequently and assess the impact of optimization strategies.([tenxdeveloper.com][8])
Steps:
How to Disable MySQL Password Validation on Ubuntu 25.04
If successful, you'll see:
Query OK, 0 rows affectedHow to Move the MySQL Data Directory to a New Location on Ubuntu 25.04
AppArmor may block MySQL from accessing the new path.
Edit AppArmor profile for MySQL:
How to Install PHP, MySQL, and phpMyAdmin on Ubuntu 25.04 (LAMP Stack Setup Guide)
sudo phpenmod mbstring
sudo systemctl restart apache2You can now access phpMyAdmin at http://localhost/phpmyadmin.
How to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)
This means your system has both Intel integrated graphics and an NVIDIA discrete GPU.
Install Mesa utilities:
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
ScopedPointerclass to emulateunique_ptrin old C++.
Deep Copy in C++: How to Avoid Shallow Copy Pitfalls
A deep copy duplicates the actual data pointed to, not just the pointer.
class Deep {
public:
int* data;
Deep(int val) {
data = new int(val);
}
// Copy constructor for deep copy
Deep(const Deep& other) {
data = new int(*other.data);
}
// Assignment operator for deep copy
Deep& operator=(const Deep& other) {
if (this != &other) {
delete data;
data = new int(*other.data);
}
return *this;
}
~Deep() {
delete data;
}
};Protect Your Forms Like a Pro: Anti-Spam Techniques That Actually Work
If you’re serious about user experience and stopping spam, avoid relying on just one method. Bots are getting smarter, but stacking simple techniques gives you a major edge.
Have a clever spam prevention trick you use? Share it with us!
Build a Custom Rate Limiter in Node.js with Redis
// server.js
require("dotenv").config();
const express = require("express");
const rateLimiter = require("./rateLimiter");
const app = express();
const PORT = 3000;
app.use(rateLimiter(100, 3600)); // 100 requests/hour per IP
app.get("/", (req, res) => {
res.send("Welcome! You're within rate limit.");
});
app.listen(PORT, () => {
console.log(`Server running on http://localhost:${PORT}`);
});Use Postman or curl:
Arduino Basics: A Step-by-Step Tutorial
Key features include:
- Open-source hardware and software
- User-friendly programming environment
- A large community with plenty of tutorials and libraries
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.
Building a Cross-Platform Desktop App with Tauri and Svelte: A Step-by-Step Tutorial
This simple component displays a title, a count, and a button to update the count.
To run your app in development mode, use:
Implementing a Domain-Specific Language (DSL) with LLVM and C++
Header: Parser.h
#ifndef DSL_PARSER_H
#define DSL_PARSER_H
#include "Lexer.h"
#include "AST.h"
#include <memory>
class Parser {
public:
Parser(Lexer& lexer);
std::unique_ptr<ASTNode> parseExpression();
private:
Lexer& lexer;
Token currentToken;
void eat(TokenType type);
std::unique_ptr<ASTNode> factor();
std::unique_ptr<ASTNode> term();
};
#endif // DSL_PARSER_H