Find the code you need
Search through tutorials, code snippets, and development resources
ما هو حقن التبعيات (Dependency Injection)؟
توجد ثلاث طرق رئيسية لحقن التبعيات:
وهي الطريقة الأكثر شيوعاً، حيث تُمرَّر التبعيات للكائن عبر المُنشئ.
How to Stop SSH From Timing Out
ClientAliveInterval 60
ClientAliveCountMax 3This makes the server send a keep-alive packet every 60 seconds, allowing up to 3 missed replies before disconnecting.
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:
Globalization in React (2025 Trends & Best Practices)
- Use language-based subpaths:
/en,/fr,/ar - Generate
hreflangtags for each locale - Translate meta tags:
<title>,<meta description> - Avoid client-only routing for indexable pages
- Pre-render pages via SSR (e.g., with Next.js)
Use IP detection (via backend or service like IPinfo):
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}}"
}Building Micro-Frontends with Webpack Module Federation (2025 Guide)
Now let’s set up the main container app.
npx create-react-app app-shell
cd app-shell
npm install -D webpack webpack-cli webpack-dev-server html-webpack-pluginState Management Beyond Redux: Using Zustand for Scalable React Apps
Zustand presents a compelling alternative to Redux for state management in React applications. Its minimalistic API, ease of use, and performance optimizations make it suitable for a wide range of projects, from simple applications to more complex systems.
By reducing boilerplate and simplifying state management, Zustand allows developers to focus more on building features and less on configuring their state management setup.
Mastering React Rendering Performance with Memoization and Context
Implementing these practices ensures that only components dependent on specific context values re-render when those values change.([Medium][7])
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])
How to Disable MySQL Password Validation on Ubuntu 25.04
If disabled, this will return an empty result set.
Now that validation is disabled, try creating a user with a weak password:
How to Move the MySQL Data Directory to a New Location on Ubuntu 25.04
sudo mv /var/lib/mysql /mnt/data/mysql> This moves all database files including system schemas like mysql and performance_schema.
How to Install PHP, MySQL, and phpMyAdmin on Ubuntu 25.04 (LAMP Stack Setup Guide)
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curlDuring installation:
How to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)
lspci -k | grep -EA3 'VGA|3D|Display'You’ll see something like:
Avoiding Memory Leaks in C++ Without Smart Pointers
Let’s build a small ScopedPointer class.
template <typename T>
class ScopedPointer {
private:
T* ptr;
public:
explicit ScopedPointer(T* p = nullptr) : ptr(p) {}
~ScopedPointer() {
delete ptr;
}
T& operator*() const { return *ptr; }
T* operator->() const { return ptr; }
T* get() const { return ptr; }
void reset(T* p = nullptr) {
if (ptr != p) {
delete ptr;
ptr = p;
}
}
// Prevent copy
ScopedPointer(const ScopedPointer&) = delete;
ScopedPointer& operator=(const ScopedPointer&) = delete;
};Deep Copy in C++: How to Avoid Shallow Copy Pitfalls
When your class uses raw pointers:
- Avoid shallow copies.
- Always implement deep copy logic.
- Follow the Rule of Three (or Rule of Five).
- Prefer
std::string,std::vector, or smart pointers in modern C++.
Protect Your Forms Like a Pro: Anti-Spam Techniques That Actually Work
Use Redis or your database for tracking:
// pseudo-code
if (requestsFromIP > 3 in 60 seconds) {
block temporarily
}Build a Custom Rate Limiter in Node.js with Redis
If you're building any kind of real API, this knowledge will serve you well.
Have questions or want a follow-up tutorial? Leave a comment or reach out—we’d love to help.
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
Before you begin, make sure you have the following installed and set up:
- A modern web browser that supports webcam access (Chrome, Firefox, or Edge).
- Basic knowledge of HTML, CSS, and JavaScript.
- Familiarity with p5.js (optional, but helpful).
- A code editor (Visual Studio Code, Sublime Text, etc.).
Building a Cross-Platform Desktop App with Tauri and Svelte: A Step-by-Step Tutorial
npx tauri devThis command opens your Svelte app inside a native window powered by Tauri. Changes you make to your Svelte code will update in real time.
Implementing a Domain-Specific Language (DSL) with LLVM and C++
For this tutorial, we’ll create a DSL for evaluating mathematical expressions. Our language will support:
- Numeric literals (e.g.,
42,3.14) - Basic arithmetic operators:
+,-,*,/ - Parentheses for grouping expressions