Find the code you need
Search through tutorials, code snippets, and development resources
How to Stop SSH From Timing Out
sudo nano /etc/ssh/sshd_configAdd these lines:
How to Translate URLs in React (2025 Guide)
Sample fr.json:
{
"routes": {
"home": "accueil",
"about": "a-propos"
},
"title": "Bienvenue sur notre site !"
}Globalization in React (2025 Trends & Best Practices)
Red = luck in China, danger in the West.
- Adapt units and metrics
Implementing Internationalization (i18n) in a Large React Application (2025 Guide)
Update i18n.js:
import ICU from 'i18next-icu';
i18n
.use(ICU) // Enables datetime and currency formatting
.use(LanguageDetector)
.use(initReactI18next)
.init({
...
interpolation: {
format: (value, format, lng) => {
if (format === 'datetime') {
return new Intl.DateTimeFormat(lng).format(value);
}
if (format === 'currency') {
return new Intl.NumberFormat(lng, {
style: 'currency',
currency: lng === 'fr' ? 'EUR' : 'USD',
}).format(value);
}
return value;
},
}
});Building Micro-Frontends with Webpack Module Federation (2025 Guide)
We’ll build two apps:
/app-shell (React)
webpack.config.js
src/
bootstrap.js
/analytics-app (Vue)
webpack.config.js
src/
main.jsState Management Beyond Redux: Using Zustand for Scalable React Apps
- Project Size: For small to medium-sized projects, Zustand's simplicity can accelerate development.
- Team Experience: Teams new to state management may find Zustand's learning curve more approachable.
- Boilerplate Reduction: If minimizing boilerplate is a priority, Zustand offers a cleaner setup.
- Performance Needs: Zustand's selective rendering can enhance performance in applications with frequent state updates.
However, for large-scale applications requiring complex state interactions, middleware, and extensive tooling, Redux might still be the preferred choice.
Mastering React Rendering Performance with Memoization and Context
import React, { useState, useCallback } from 'react';
function Counter() {
const [count, setCount] = useState(0);
const increment = useCallback(() => setCount(c => c + 1), []);
const decrement = useCallback(() => setCount(c => c - 1), []);
return (
<div>
<button onClick={increment}>+</button>
<span>{count}</span>
<button onClick={decrement}>-</button>
</div>
);
}By wrapping increment and decrement with useCallback, their references remain stable across renders, preventing unnecessary re-renders in child components that receive these functions as props.([GeeksforGeeks][2])
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
Before making any changes, stop the MySQL service:
sudo systemctl stop mysqlHow to Install PHP, MySQL, and phpMyAdmin on Ubuntu 25.04 (LAMP Stack Setup Guide)
Secure your MySQL installation:
sudo mysql_secure_installationHow to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)
sudo prime-select nvidia # Always use NVIDIA
sudo prime-select intel # Use Intel only
sudo prime-select on-demand # Default hybrid mode- Reboot after switching modes.
Avoiding Memory Leaks in C++ Without Smart Pointers
- Prevents memory leaks.
- Simplifies exception handling.
- Keeps your code clean and maintainable.
In newer projects, always prefer std::unique_ptr and std::shared_ptr. But in legacy systems, RAII with simple wrappers like ScopedPointer can save you.
Deep Copy in C++: How to Avoid Shallow Copy Pitfalls
- 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++.
Understanding deep copy is essential for writing robust, bug-free C++ code.
Protect 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
Create a .env file:
REDIS_URL=redis://localhost:6379Arduino Basics: A Step-by-Step Tutorial
- Connect the other end of the resistor to the Arduino’s GND pin.
Open the Arduino IDE and enter the following code:
Building a Real-Time Object Detection Web App with TensorFlow.js and p5.js
This guide will walk you through setting up your development environment, loading a pre-trained model, capturing video input, and overlaying detection results on the video feed.
Before you begin, make sure you have the following installed and set up:
Building a Cross-Platform Desktop App with Tauri and Svelte: A Step-by-Step Tutorial
npx degit sveltejs/template tauri-svelte-app
cd tauri-svelte-app
npm installThis command creates a fresh Svelte application in the tauri-svelte-app directory and installs all required dependencies.
Implementing a Domain-Specific Language (DSL) with LLVM and C++
Main Entry Point: main.cpp
#include "DSL/Lexer.h"
#include "DSL/Parser.h"
#include "DSL/AST.h"
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Module.h>
#include <llvm/Support/TargetSelect.h>
#include <iostream>
#include <memory>
extern llvm::Function* generateFunction(llvm::LLVMContext& context, llvm::Module& module, ASTNode* root);
extern void optimizeModule(llvm::Module& module);
int main() {
// Initialize LLVM.
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
llvm::LLVMContext context;
llvm::Module module("MyDSLModule", context);
std::string input;
std::cout << "Enter an expression: ";
std::getline(std::cin, input);
Lexer lexer(input);
Parser parser(lexer);
std::unique_ptr<ASTNode> astRoot;
try {
astRoot = parser.parseExpression();
} catch (const std::exception& ex) {
std::cerr << "Parsing error: " << ex.what() << std::endl;
return 1;
}
llvm::Function* func = generateFunction(context, module, astRoot.get());
if (!func) {
std::cerr << "Failed to generate LLVM function." << std::endl;
return 1;
}
optimizeModule(module);
// For demonstration, print the LLVM IR.
module.print(llvm::outs(), nullptr);
// In a full implementation, you could now JIT compile and execute the function.
return 0;
}دليل عملي: بناء روبوت دردشة (Chatbot) باستخدام Python و NLP
pip install nltknltk هي مكتبة قوية لمعالجة اللغة الطبيعية. أولاً، سنقوم بتنزيل الموارد اللازمة: