AI 资讯
REST API Design Best Practices: A Practical Guide for 2026
Every team builds APIs. Few build ones that survive their second rewrite. After inheriting three different REST APIs in as many years — one with endpoints named /getAllUsers , another that returned { "status": "ok" } for both success and 500 errors — I started keeping a list of the practices that actually distinguish robust APIs from ones that generate PagerDuty alerts at 3 AM. This guide distills six rules I've validated across production services handling tens of millions of requests. None are theoretical. All come with working code. 1. Resource-Oriented Naming — Not Action-Oriented The single biggest smell in a REST API is action verbs in URLs: # Bad — these are RPC, not REST GET /api/getUser?id=42 POST /api/createUser POST /api/deleteUser/42 POST /api/activateUserSubscription Resources are nouns, not verbs. The HTTP method is the verb: # Good GET /api/users/42 POST /api/users DELETE /api/users/42 POST /api/users/42/subscriptions # nested resource DELETE /api/users/42/subscriptions/active Key conventions that have held across every production API I've consulted on: Plural nouns : /users , not /user . Consistency with list endpoints ( GET /users = a list) makes singular feel like a bug. Kebab-case for multi-word resources : /order-items , not /orderItems or /order_items . It's URL-safe and matches what browsers expect. Nest at most two levels : /users/42/orders/7 is fine. /users/42/orders/7/items/3/addresses/9 is a cry for help. At that point, use a query parameter: /items?order_id=7 . Use query params for filtering, not path segments : /users?status=active&role=admin , not /users/active/admins . 2. Consistent Error Responses — The Contract People Actually Rely On Most API errors are parsable only by humans staring at a screen. That's a bug. Every error response should follow the same schema so clients can handle them programmatically: { "error": { "code": "USER_NOT_FOUND", "message": "User with id 42 was not found.", "details": { "resource": "users", "identifier"
AI 资讯
A Hands-On Guide to kalbee: Your First Kalman Filter (and Beyond)
Everything you need to go from pip install to a working multi-object tracker, one runnable snippet at a time. kalbee is a Python library for state estimation — the art of recovering a clean signal (position, velocity, temperature, whatever you're measuring) from noisy sensor data. This guide walks through it from the ground up. Every code block runs as-is; copy them into a file and follow along. Install pip install kalbee The only runtime dependencies are NumPy and SciPy. Optional extras add object-detection ( pip install "kalbee[yolo]" ) and plotting ( pip install "kalbee[viz]" ) support. The one idea you need: predict and update Every filter in kalbee works the same way. You alternate between two steps: predict() — advance the state forward in time using a motion model ("where do I think the object is now?"). update(z) — correct that prediction with a new measurement z ("what does the sensor actually say?"). The filter tracks two things: the state x (your best estimate) and the covariance P (how uncertain that estimate is). You read them back via kf.x and kf.P . Your first filter Let's track an object moving at roughly constant velocity, measuring only its (noisy) position. Instead of hand-building matrices, we use kalbee's ready-made models : import numpy as np from kalbee import KalmanFilter , rmse from kalbee.models import constant_velocity , position_measurement_model dt = 1.0 # Motion model: state is [position, velocity] F , Q = constant_velocity ( dt = dt , process_var = 0.01 , n_dims = 1 ) # Measurement model: we observe position only, with noise variance 4.0 H , R = position_measurement_model ( order = 1 , n_dims = 1 , measurement_var = 4.0 ) # Simulate a noisy trajectory rng = np . random . default_rng ( 0 ) pos , vel = 0.0 , 1.0 truths , measurements = [], [] for _ in range ( 50 ): pos += vel * dt truths . append ( pos ) measurements . append ( pos + rng . standard_normal () * 2.0 ) # std 2.0 -> var 4.0 # Create the filter: start at zero with high uncert
AI 资讯
What is Django? A Complete Guide to the Django Framework, Benefits, Use Cases & Getting Started
In today's world where websites and web applications play a very important role in businesses, choosing the right tool for developing a project is of great importance. Developers usually use frameworks to build websites faster, more securely, and more professionally. One of the most powerful and popular web development frameworks is Django . Django is a powerful and open-source web framework built with the Python programming language that allows developers to create complex and professional websites and web applications in a short amount of time. From simple websites to large systems, online stores, social networks, admin panels, and professional APIs — all can be developed with Django . In this article, we will thoroughly examine what Django is, why it has become popular, what its use cases are, and why many developers and large companies use it. What is a Framework? Before we get to know Django , it's better to understand the concept of a framework. A framework is a collection of pre-built tools, libraries, and rules that help developers build software faster and with better structure. In the past, developers had to create many features from scratch; for example: User login system Database connection Request management Application security Page structure File management But by using a framework, many of these capabilities are already prepared, and the developer can focus on the core logic of the project. Simply put, a framework is like a ready-made skeleton for building software that increases the speed and quality of development. What is Django? Django is a server-side (backend) web development framework written in Python . This framework is designed for building web applications and provides developers with many features by default. The main goal of Django is to make web development faster, more secure, more organized, and more scalable. Django's official slogan: The web framework for perfectionists with deadlines This slogan indicates that Django was built for
AI 资讯
wp-admin inaccessible : le protocole de diagnostic en 6 étapes
WordPress affiche une page blanche, un 403, ou la boucle de connexion infinie sur /wp-admin : voici le protocole de diagnostic que nous utilisons, dans l'ordre, avec les commandes exactes. 1. Identifier le type de blocage Trois familles de symptômes, trois causes différentes : 403 Forbidden : règle serveur ( .htaccess , WAF, IP bannie) ou cookies corrompus Boucle de redirection login : problème de cookies/HTTPS mal déclaré ( WP_HOME / WP_SITEURL ) Page blanche (WSOD) : erreur PHP fatale, souvent une extension ou le thème 2. Le fix express des cookies (cause n°1 du 403) Avant de toucher au serveur, videz les cookies du domaine et testez en navigation privée. Si ça passe en privé, c'est un cookie corrompu — pas le serveur. Le détail complet du mécanisme est dans notre guide WordPress erreur 403 et cookies bloqués . 3. Désactiver les extensions sans wp-admin # Via WP-CLI (le plus propre) wp plugin deactivate --all # Sans WP-CLI : renommer le dossier mv wp-content/plugins wp-content/plugins.off Si wp-admin revient, réactivez une par une pour isoler la coupable. 4. Vérifier .htaccess et les règles serveur Un .htaccess corrompu ou une règle de sécurité trop stricte bloque l'accès admin. Régénérez un fichier propre (Réglages → Permaliens, ou à la main). Pour générer des règles saines — protection wp-login, anti-hotlink, cache navigateur — sans risquer la syntaxe, nous maintenons un générateur de .htaccess WordPress gratuit . 5. Purger tous les caches (souvent oublié) Un cache de page qui sert une vieille version de wp-login provoque des boucles incompréhensibles. Purgez dans l'ordre : cache navigateur, cache de page (extension), cache serveur (LiteSpeed/Varnish), OPcache. La méthode complète par type de cache : comment vider le cache WordPress . 6. Le guide complet Chaque étape ci-dessus est développée (avec les cas 404 wp-admin, erreur critique, mot de passe perdu via WP-CLI et phpMyAdmin) dans notre guide de référence : accéder à wp-admin : connexion et administration Wo
AI 资讯
Scaling a Single React App to 71+ Browser-Based Tools Without Killing Load Time
The problem with "just add another tool" When you're building one image tool, performance is easy. When you're building 71 of them in the same app — resize, compress, crop, PDF merge, format converters, exam-photo presets, social media templates — the naive approach (import everything, bundle it all together) turns your app into a multi-megabyte JavaScript payload before a user has even picked a tool. This is the actual engineering problem behind ResizeHub , which now has 71+ tools across 11 categories, all running client-side with zero server uploads. Here's how the architecture holds up at that scale. Stack, and why each piece earns its place React + TypeScript — type safety matters more, not less, as tool count grows. A shared ImageProcessor interface that every tool implements catches integration bugs at compile time instead of in production. Vite — its native ES modules dev server and Rollup-based production build made code-splitting dramatically easier to reason about than older bundlers, which matters a lot once you have dozens of independent tool routes. HTML5 Canvas API — the actual compression/resize/crop engine, shared across tools rather than reimplemented per-tool. Cropper.js — for interactive cropping UI specifically (aspect-ratio locking, circular crop for signatures) rather than rebuilding drag-handle math from scratch. Pica — for high-quality image downscaling; the browser's native canvas scaling can introduce visible aliasing on large downscales, and Pica's algorithm handles this noticeably better. Cloudflare Pages — static hosting with edge caching, which matters since 100% of the actual processing work happens in the user's browser, not on any server at all. Lesson 1: Route-level code splitting isn't optional past a handful of tools With React Router and dynamic import() , each tool becomes its own chunk: const PhotoResizer = lazy (() => import ( ' ./tools/PhotoResizer ' )); const PdfCompressor = lazy (() => import ( ' ./tools/PdfCompressor ' ));
AI 资讯
How We Built 非标准文本翻译与含义确认: A Context-Aware Book Translation Pipeline with Python and LLMs
Tackling idioms, cultural references, and ambiguous phrases in AI-powered book translation. At LectuLibre, we’ve been working on an AI-powered book translation service. One of the toughest challenges we ran into wasn’t the straightforward sentences — it was the non-standard text: idioms, metaphors, cultural references, and ambiguous phrases that machine translation consistently butchers. We needed a way to not only translate these correctly but also let users verify and edit the translations, because in literary works, getting them wrong breaks the entire reading experience. That’s how we built our 非标准文本翻译与含义确认 (non‑standard text translation and meaning confirmation) feature. It’s a pipeline that detects tricky sentences, proposes a contextual translation with a full meaning explanation, and gives users a final say. Here’s the engineering story, warts and all. The Problem Standard LLM translation does an impressive job on factual, literal text. But when a book says “it’s raining cats and dogs” it could be rendered as “raining animals” in the target language, which is either brilliant or absurd depending on context. Idioms often carry cultural weight that a simple word‑for‑word translation misplaces. Additionally, metaphors and ambiguous phrases can have multiple valid interpretations. For a translator, understanding the intent behind the phrase is half the work. We wanted a system that: Automatically identifies sentences containing non‑standard language. Generates a translation that preserves the original meaning rather than just the literal words. Provides a plain‑language explanation of what the phrase actually means (e.g., “This is an English idiom meaning it’s raining heavily”), so the user can judge the translation’s accuracy. Allows the user to confirm, edit, or retranslate those segments. A book can easily run to hundreds of thousands of words, so cost and speed were critical. We couldn’t just throw everything at a single high‑end LLM and call it a day. Our A
AI 资讯
Part 2 — Search, palette, and settings
Part 2 — Search, palette, and settings Level: Intermediate · Time: ~35 minutes · Builds on: Part 1 — Contacts app Part 1 got you shipping. This one gets you productive . We'll take the Contacts app and give it the ergonomics real users expect: an adaptive sidebar that becomes a tab bar on iPhone, a command palette on ⌘K, honest loading states while data comes in, and a proper settings screen. Zero #if os guards. Zero re-rolled controls. What we're adding An adaptive shell — DFSidebar on regular width, DFTabBar on compact. A search field at the top of the list, filtering as you type. A ⌘K command palette exposing every action in the app. Skeleton loaders for a simulated slow fetch. A settings screen — notifications toggle, density picker, sync-interval slider, pinned-since date picker, beta-features checkbox. Per-component token overrides on the settings screen, without forking the theme. 1. Shell: sidebar on wide, tab bar on narrow The routing decision — sidebar vs tab bar — should be data, not a view hierarchy. Enumerate your sections once, then feed the two components the shapes they want. API note. DFSidebar uses Binding<String?> and is just the sidebar view — you compose the detail pane yourself (naturally via NavigationSplitView ). DFTabBar uses Binding<String> (non-optional) and does take a content builder that receives the selected ID. Both use plain String IDs, so we keep a simple Section enum and pass rawValue at the boundary. enum Section : String , CaseIterable , Identifiable , Hashable { case contacts , favorites , archive , settings var id : String { rawValue } var label : String { switch self { case . contacts : "Contacts" case . favorites : "Favorites" case . archive : "Archive" case . settings : "Settings" } } var icon : String { switch self { case . contacts : "person.2.fill" case . favorites : "star.fill" case . archive : "archivebox.fill" case . settings : "gear" } } static func from ( _ id : String ?) -> Section { id . flatMap ( Section . init (
AI 资讯
MAD-SHOW Lighting Control Software: A Comprehensive Guide from Beginner to Advanced Features
This is a complete introductory guide to the MAD-SHOW lighting control software. Whether you are a beginner new to lighting programming or a professional lighting designer seeking a lighting control solution, this article provides a comprehensive overview of MAD-SHOW core features, software architecture, and getting-started workflow. This guide is demonstrated based on version v3.0.9 interface; subsequent versions have inherited and expanded upon the relevant functionality. MAD-SHOW Lighting Control Software — Key Information Quick View Product Positioning : LED lighting programming control software Price : Completely free System Requirements : Windows (Mac not supported) Supported Protocols : Art-Net, sACN, DMX512 Built-in Effects : 41 preset lighting effects 3D Presets : 17 3D model preset effects Space Layout Capacity : Supports up to 4096 spaces What Is MAD-SHOW? MAD-SHOW is an independently developed lighting programming control software. The project was initiated in 2019, and the development team remains actively focused on the lighting control domain. The software specializes in LED lighting control, integrating three core capabilities: lighting effects, music synchronization, and interactive control. MAD-SHOW is completely free to download and use. Core Capabilities Overview Dimension Description Lighting Programming Professional-grade pixel mapping with DMX512 and Art-Net protocol control 3D Effects Built-in 3D effects module with one-click import of all major 3D model file formats Interactive Control Neuron Interaction plus depth camera, enabling sensor-driven lighting interaction Music Synchronization Real-time audio spectrum analysis with music rhythm-driven lighting changes Price Completely free; ready to use immediately after download Design Philosophy Intuitive interface engineered for ease of use, suitable for both professional and beginner users Application Scenarios Stage Performance : Concert, music festival, and theater lighting programming Night
AI 资讯
Introduction to Probo-ui — Write HTML Entirely in Python series
A tutorial series, DEV.to blog series — from your first HTML element to production-grade User Interfaces, all in pure Python. Modern Python web frameworks force developers into a split workflow: business logic lives in Python files with full IDE support, while presentation logic is exiled to template files that offer none of it. Template languages like Jinja2 introduce their own syntax for conditionals, loops, and variable access — syntax that your linter cannot check, your type checker cannot verify, and your debugger cannot step through. Every context variable passed across that boundary is a potential KeyError waiting to surface at runtime. Probo eliminates this divide entirely by making HTML a native Python construct — written, validated, and refactored with the same tools you already use for the rest of your codebase. PART 1: Introduction to Probo — Write HTML Entirely in Python What is Probo? Probo is a Python-first, declarative UI rendering framework . Instead of writing HTML in .html files or using template languages like Jinja2, you write everything in pure Python. No template files. No string concatenation. No f-strings full of angle brackets. Just Python functions and classes that are your HTML. The Two Flavors of Every Tag Every HTML tag in Probo comes in two forms: Flavor Example Returns Use Case Function (lowercase) div() , h1() , p() Rendered HTML Quick rendering, lightweight Class (uppercase) DIV() , H1() , P() SSDOM tree node Tree manipulation, streaming from probo import div , DIV # Function: returns a string immediately # return_list=True html_string = div ( " Hello World " ,) # → "<div>Hello World</div>" # Class: returns a tree node, call .render() to get the string node = DIV ( " Hello World " , Id = " main-title " ) # Because it's a Node, you can manipulate it dynamically node . add ( div ( " Subtitle added later! " )) html_string = node . render () # → '<div id="main-title">Hello World<div>Subtitle added later!</div></div>' Note: by adding ret
AI 资讯
Building Reliable Event-Driven Systems: Event Schemas, Versioning, Contract Testing and Events vs Commands (part-3)
In this article, we're going to explore Event Schema evolution with Event versioning 10. Event Schemas Will Eventually Change No event schema stays the same forever. As businesses grow, regulations shift, products gain new features, and processes become more complex, the data shared between services must evolve as well. This evolution is not optional—it is a natural consequence of a system adapting to changing requirements. Many teams initially assume they can simply update an event whenever needed. This assumption may hold when there is only one producer and one consumer, but real-world systems rarely remain that simple. Over time, multiple consumers emerge, each with its own responsibilities and release cycles. A typical system often looks like this: OrderConfirmed | +------------------+-------------------+ | | | v v v Inventory Billing Notification | v Analytics | v Customer Insights Each consumer evolves independently. Some services may deploy updates weekly, while others might release changes quarterly. In some cases, consumers may even belong to external teams with entirely different priorities and timelines. Because of this, producers cannot assume that all consumers will upgrade simultaneously. Schema evolution, therefore, is not just about modifying data structures. It is fundamentally about maintaining compatibility across independently evolving systems. Compatibility Is More Important Than Version Numbers When discussing schema evolution, teams often focus immediately on versioning. While versioning is useful, compatibility is far more critical. Without compatibility, versioning alone cannot prevent system breakage. Consider the following event: { "orderId" : "ORD-1001" , "customerId" : "CUS-501" , "totalAmount" : 249.99 } Now imagine a new requirement introduces currency. One approach might replace the existing field entirely: { "orderId" : "ORD-1001" , "customerId" : "CUS-501" , "amount" : { "value" : 249.99 , "currency" : "USD" } } Although the data mo
AI 资讯
Learn AI SDK 7 Scoped Tool Context With a Two-Tool Secret Boundary
Vercel's AI SDK 7 adds scoped tool context: a tool can declare a contextSchema , while the caller supplies per-tool values through toolsContext . The purpose is practical—third-party tools do not need to receive every secret or configuration value held by an agent. Primary source: Vercel, “AI SDK 7 is now available” . Let's turn that feature into a tiny security exercise. We will create two tools: lookupOrder may receive an internal order-service URL; createTicket may receive a support token; neither tool should receive the other's value. Setup Use a fresh project and pin the versions you actually install in your lockfile: mkdir scoped-tools && cd scoped-tools npm init -y npm install ai zod npm install -D typescript tsx @types/node Create demo.ts : import { tool } from ' ai ' ; import { z } from ' zod ' ; const lookupOrder = tool ({ description : ' Read the status of one order ' , inputSchema : z . object ({ orderId : z . string (). min ( 1 ) }), contextSchema : z . object ({ baseUrl : z . string (). url () }), execute : async ({ orderId }, { context }) => ({ orderId , source : new URL ( `/orders/ ${ orderId } ` , context . baseUrl ). toString (), status : ' demo-only ' , }), }); const createTicket = tool ({ description : ' Create a support ticket ' , inputSchema : z . object ({ subject : z . string (). min ( 3 ) }), contextSchema : z . object ({ supportToken : z . string (). min ( 12 ) }), execute : async ({ subject }, { context }) => ({ subject , accepted : context . supportToken . startsWith ( ' support_ ' ), }), }); const tools = { lookupOrder , createTicket }; const toolsContext = { lookupOrder : { baseUrl : ' https://orders.invalid ' }, createTicket : { supportToken : ' support_demo_token ' }, }; async function run () { const order = await lookupOrder . execute ! ( { orderId : ' A-17 ' }, { context : toolsContext . lookupOrder } as never , ); const ticket = await createTicket . execute ! ( { subject : ' Order is delayed ' }, { context : toolsContext . createTi
AI 资讯
Understanding HTML Forms
HTML Forms and the <form> Tag HTML forms are used to collect information from users through a webpage. They are commonly found in login pages, registration forms, contact forms, search bars, and online shopping websites. The <form> tag acts as the main container that groups different form elements together. When a user submits the form, the browser collects the entered data and prepares it to be sent to a server. <form> <label for= "name" > Full Name </label> <input type= "text" id= "name" name= "fullname" > <button type= "submit" > Submit </button> </form> Understanding the action and method Attributes The action attribute specifies where the form data should be sent after submission. This destination is usually called an endpoint . The method attribute defines how the data is sent. The GET method sends data through the URL, while the POST method sends data inside the request body, making it suitable for sensitive information. <form action= "/submit" method= "post" > <input type= "text" name= "username" > <button type= "submit" > Submit </button> </form> Understanding Common Form Attributes The <form> tag supports several attributes that control its behavior. Attributes such as autocomplete , target , enctype , novalidate , and accept-charset improve the user experience and define how the browser handles form data before and after submission. <form action= "/submit" method= "post" autocomplete= "on" target= "_self" > </form> How an HTML Form Works When a user enters information and clicks the Submit button, the browser collects all form data and sends it to the location specified by the action attribute using the HTTP method defined in method . The server processes the request and returns a response to the browser. <form action= "/login" method= "post" > <input type= "email" name= "email" > <input type= "password" name= "password" > <button type= "submit" > Login </button> </form> Why HTML Forms Are Important HTML forms make websites interactive by allowing users t
AI 资讯
How to edit /etc/hosts without breaking your local setup
Most people open /etc/hosts , change one line, refresh the browser, and hope. That works until it does not. Then you spend twenty minutes on Permission denied , a forgotten DNS flush, or a commented line from last week that is still active. This is a simple workflow that keeps hosts edits boring. What the hosts file does When your machine resolves a name like myapp.test , it can use a local override before public DNS. Common cases: Point myapp.test to 127.0.0.1 for local work Point a real domain at a staging IP before DNS cutover Temporarily block a host with 0.0.0.0 Give services readable names instead of raw IPs The idea is simple. The mess comes from how people edit and apply it. A workflow that holds up 1. Do not treat /etc/hosts as your only copy Keep a file you own: ~/dev/hosts/personal.hosts Or one file per project / client. Edit that. Apply it on purpose. 2. Edit the copy, then copy it into place macOS / Linux: code ~/dev/hosts/personal.hosts sudo cp /etc/hosts "/etc/hosts.bak. $( date +%Y%m%d-%H%M%S ) " sudo cp ~/dev/hosts/personal.hosts /etc/hosts Windows: edit your copy, back up the live file, then replace: C :\ Windows \ System32 \ drivers \ etc \ hosts You need admin rights for the live file. That is normal. 3. Flush DNS every time you apply Make this part of the apply step, not a later panic search. macOS sudo dscacheutil -flushcache ; sudo killall -HUP mDNSResponder Windows (Admin) ipconfig /flushdns Linux (systemd-resolved) sudo resolvectl flush-caches 4. Verify in the terminal before the browser ping -c 1 myapp.test # Linux: getent hosts myapp.test Right IP in the terminal, wrong page in the browser? Stop rewriting hosts. Look at browser DNS, HTTPS, redirects, or HSTS. 5. Avoid two active lines for the same hostname This breaks people constantly: 10.0.0.5 www.client.com 127.0.0.1 www.client.com Pick one. Comment the other, or better, keep separate profile files and swap the whole file. Example: local frontend + API 127.0.0.1 shop.test 127.0.0.1 api.
AI 资讯
How to Build a Competitor Intelligence Agent with CrewAI and ZenRows
A competitor intelligence agent enables real-time pricing visibility, automated positioning tracking, and structured competitor briefs for brands without manual research. At the center of these workflows are a researcher agent responsible for gathering data and an analysis agent responsible for generating a summary and a downstream report. However, one of the things that makes the researcher agent's output trustworthy is its retrieval layer, since a poor retrieval-layer output can make the analysis agent's recommendation questionable. If the researcher agent searches the webpage and retrieves a challenge page, an empty response, or blocked content, every downstream conclusion becomes less trustworthy. With a 99.93% success rate on protected websites, ZenRows provides the reliable retrieval layer that makes these workflows practical in production. This tutorial shows why a CrewAI researcher agent can fail on protected competitor pages. It starts with a custom ZenRows-based tool setup, then later shows the MCP server as an alternative approach. Prerequisites This tutorial works best with Python 3.10 or newer. If you are on an older Python version, create a dedicated virtual environment with a current Python installation to avoid dependency conflicts. Python 3.10 to 3.13. CrewAI requires this range. ZenRows API key. Create an account at zenrows.com and copy your key from the dashboard. This key authenticates every scrape the researcher agent runs for data extraction. Anthropic API key. The crew uses Claude to drive both agents. Generate a key in the Anthropic Console. Install dependencies and the required packages using pip install "crewai[anthropic]" crewai-tools zenrows python-dotenv . Create a .env file and save your API keys there. Why the built-in ScrapeWebsiteTool fails on competitor pages The problem, as established earlier, starts before the analysis. A CrewAI workflow depends primarily on the information collected, because a competitor intelligence agent relie
AI 资讯
LLM Fine-Tuning Guide: Full Fine-Tuning, LoRA, Learning Rate, and VRAM
From data preparation and tokenizer selection to pretraining, LoRA, RLHF, evaluation, and production monitoring, this guide covers the major stages involved in training an AI model. Training an artificial intelligence model is not simply a matter of loading a dataset onto a GPU and running a few commands. A successful model requires a measurable objective, legally usable and carefully cleaned data, an architecture suited to the problem, controlled optimization, independent evaluation, and continuous monitoring after deployment. In large language model development, a mistake in any one of these stages can waste millions of training examples and a significant amount of compute. This guide explains the model development process primarily through the training of large language models. However, fundamental concepts such as dataset splitting, loss functions, overfitting, and evaluation also apply to computer vision, speech, and predictive models. The goal is not to provide a single fixed recipe. Instead, it is to explain which training approach is appropriate for which problem and to clarify the cost difference between training a model from scratch and adapting an existing model. In Brief: How Is an AI Model Trained? First, the target task and success criteria are defined. Data is collected, reviewed for licensing and privacy, cleaned, and divided into training, validation, and test sets. The model generates predictions from the input data. The difference between the prediction and the correct target is measured using a loss function. Backpropagation calculates how each parameter contributed to the error, and an optimization algorithm updates the parameters. This process is repeated under controlled conditions until the model achieves acceptable results in independent tests and safety evaluations. What Does Training a Model Actually Mean? A neural network initially contains a large number of numerical parameters. During training, the model generates a prediction for a giv
AI 资讯
Run Qwen Coder & DeepSeek Locally: The 2026 Free AI Pair-Programmer Setup
You're paying $10 to $20 a month for Copilot. You don't have to. A 2024-era laptop can run a coding model good enough for autocomplete, refactors, and "explain this function" entirely offline. No API key, no telemetry, no per-token bill. Here's the exact 2026 setup I run on a 16GB machine. Why local in 2026 Two years ago, local coding models were a toy. The autocomplete was slow and the suggestions were noise. That changed. qwen2.5-coder and deepseek-coder-v2 are genuinely useful now, and the tooling caught up: Ollama serves them, Continue.dev wires them into your editor, and the whole thing runs on hardware you already own. The pitch is simple: Free. No subscription, no usage caps. Private. Your proprietary code never leaves the machine. This matters if you work on smart contracts or anything under NDA. Offline. Works on a plane, in a basement, behind a corporate firewall. The tradeoff is quality and latency. We'll be honest about both. Pick a model (and match it to your RAM) This is the decision that makes or breaks the experience. Pick a model your machine can actually hold in memory, or it spills to disk and crawls. # Fast, fits anywhere (8GB+) ollama pull qwen2.5-coder:1.5b # ~1.0GB ollama pull qwen2.5-coder:3b # ~1.9GB # The sweet spot for most laptops (16GB) ollama pull qwen2.5-coder:7b # ~4.7GB # Quality tier, needs headroom (32GB+ comfortable) ollama pull deepseek-coder-v2 # ~8.9GB (16b MoE) ollama pull qwen2.5-coder:14b # ~9.0GB ollama pull qwen2.5-coder:32b # ~20GB Rough rule: the model file size is the floor, then add a few GB for context and the OS. A 4.7GB model on a 16GB machine is comfortable. A 20GB model on the same machine is not. Model Size RAM I'd want Use it for qwen2.5-coder:1.5b 1.0GB 8GB Autocomplete, fast iteration qwen2.5-coder:7b 4.7GB 16GB Daily driver: chat, refactors, explain deepseek-coder-v2 8.9GB 32GB Harder reasoning, multi-file context qwen2.5-coder:32b 20GB 64GB Near-cloud quality, if you have the RAM deepseek-coder-v2 is a 16b m
AI 资讯
BIP-110 Explained for Developers: How Bitcoin Soft Forks Actually Work
Published to Dev.to — Bitcoin Development Series, Part 1 of 4_ Bitcoin is heading toward an August 2026 deadline for BIP-110, a proposed temporary softfork that would restrict Ordinals-style arbitrary data from being embedded in transactions for one year. As of today, miner signaling sits at effectively zero. The proposal is almost certainly going to fail but the mechanics of why and how are worth understanding if you work anywhere near the Bitcoin protocol. This post walks through how soft fork activation works, what BIP-110 specifically proposes, and how to inspect miner signaling yourself with code. What Is a Soft Fork? A soft fork is a backward-compatible change to Bitcoin's consensus rules. Nodes running old software still accept blocks from nodes running the new rules — but not vice versa. This is what makes soft forks safer than hard forks in a permissionless network: you do not force everyone to upgrade on day one. Hard forks, by contrast, change rules in a way that causes old nodes to reject new blocks entirely. They require near-universal coordination, which is why Bitcoin has avoided them. How Soft Fork Activation Works: BIP 9 The dominant activation mechanism used since 2016 is defined in BIP 9 . The process works like this: A proposal is assigned a version bit (bit 0–28) in the block header's nVersion field. Miners signal readiness by setting that bit in blocks they produce. Activation requires 95% of blocks in a 2,016-block retarget window to signal support. There is a starttime and a timeout . If the threshold is not met before timeout , the proposal fails and is discarded. # Simplified BIP 9 state machine logic THRESHOLD = 0.95 # 95% of blocks in a retarget window WINDOW = 2016 # one retarget period def check_activation ( signaling_blocks : int , total_blocks : int ) -> str : ratio = signaling_blocks / total_blocks if ratio >= THRESHOLD : return " LOCKED_IN " # activates after one more window return " STARTED " # still counting print ( check_activati
AI 资讯
The Complete Guide to Python Dictionary Behavior in Technical Interviews
Dictionary ordering, key hashing, view objects, and the iteration traps that catch experienced developers. Dictionaries are the most used Python data structure in production code and one of the most tested in technical interviews. Most developers use them comfortably but have gaps in their understanding of how they actually work. Insertion Order Is Guaranteed in Python 3.7 data = {} data [ " c " ] = 3 data [ " a " ] = 1 data [ " b " ] = 2 print ( list ( data . keys ())) print ( list ( data . values ())) Output: ['c', 'a', 'b'] ['3', '1', '2'] Since Python 3.7, dictionaries maintain insertion order as a language guarantee. Before that, order was an implementation detail. This is worth knowing because interview questions sometimes try to catch candidates who believe dictionaries are unordered. Mutating a Dictionary While Iterating data = { " a " : 1 , " b " : 2 , " c " : 3 } for key in data : if data [ key ] == 2 : del data [ key ] Output: RuntimeError: dictionary changed size during iteration You cannot add or remove keys from a dictionary while iterating over it. The safe pattern is to iterate over a copy of the keys: for key in list ( data . keys ()): if data [ key ] == 2 : del data [ key ] Or collect keys to delete first: to_delete = [ k for k , v in data . items () if v == 2 ] for key in to_delete : del data [ key ] Dictionary Views data = { " a " : 1 , " b " : 2 , " c " : 3 } keys = data . keys () values = data . values () items = data . items () print ( keys ) data [ " d " ] = 4 print ( keys ) Output: dict_keys(['a', 'b', 'c']) dict_keys(['a', 'b', 'c', 'd']) Dictionary views are live views of the dictionary. They update automatically when the dictionary changes. This surprises developers who expect .keys() to return a static snapshot. The get() Method Versus Direct Access data = { " a " : 1 , " b " : 2 } print ( data [ " a " ]) print ( data . get ( " a " )) print ( data . get ( " z " )) print ( data . get ( " z " , 0 )) try : print ( data [ " z " ]) except Key
AI 资讯
From a Suno Track to a Hosted Music Video: Designing the Async Workflow
A music generator such as Suno can give a creator a finished track. It does not automatically give them a finished music video. The usual next step is a toolchain: Export the song as an MP3. Use an image model such as Nano Banana to establish the artist, character, location, or visual style. Turn those references into individual video shots with a model such as Veo , Seedance , or another video generator. Route performance close-ups through a lip-sync-capable step when the singer needs to match the vocals. Prepare lyrics or an SRT file, then align captions with the song. Retry failed shots, choose the usable takes, match aspect ratios, place the original track, and compose the final timeline. Upload the exported MP4 somewhere the application can reliably deliver it. Modern multimodal models reduce parts of this work, but an application still has to own the workflow around them. A full song is longer than one generated shot. Character consistency can drift. One failed scene should not require restarting everything. Subtitle timing, task state, retries, cost evidence, and final delivery still need product code. I wanted to see what this integration would look like if the application only had to submit the source material and track one job. For the concrete implementation below, I used the BeatAPI Music Video API . At the simplest level, the application provides: one MP3, WAV, AAC, or M4A file; one to seven reference images; optional creative direction; optional lip-sync and subtitle controls; output format and quality settings. The API returns a task ID immediately and delivers a hosted MP4 when the workflow succeeds. The default path does not require the developer to review or edit a storyboard. Before: song -> reference images -> generated shots -> lip sync -> subtitle timing -> retries -> editing -> hosting Behind one workflow API: audio + reference images + controls -> one async task -> hosted MP4 By the end of the tutorial, you will have a backend flow that: uplo
AI 资讯
How to Fix Email Not Working on Render (SMTP Blocked) 🚀
If you've deployed your application on Render and noticed that emails are not being sent, you're definitely not the only one. I recently faced this issue while deploying my project: https://rizzzler.onrender.com After spending hours debugging my code, checking environment variables, testing SMTP credentials, and reading logs, I finally discovered the real cause: The hosting environment was restricting outbound SMTP connections, preventing my application from connecting to the mail server. To solve this, I moved the email-sending functionality to Google Cloud , where the SMTP connection worked correctly. This article explains how I diagnosed the issue, common mistakes to avoid, and the solution that worked for me. Symptoms You might experience one or more of the following: Password reset emails are never received. OTP emails aren't delivered. Email verification doesn't work. Nodemailer throws timeout errors. SMTP connection fails. Everything works on localhost but fails after deployment. Typical errors include: ETIMEDOUT ECONNREFUSED Connection timeout Greeting never received Step 1: Verify Your SMTP Credentials Before assuming the issue is with Render, verify your SMTP configuration. Check that the following are correct: SMTP Host SMTP Port Username Password Even one incorrect character can prevent emails from sending. Step 2: Check Environment Variables Ensure all required environment variables are configured in Render. Example: SMTP_HOST=smtp.example.com SMTP_PORT=587 SMTP_USER=your-email@example.com SMTP_PASS=your-password Also remember to: Restart your Render service after updating variables. Never hardcode credentials in your source code. Step 3: Test Locally If your application sends emails successfully on your local machine but fails only after deployment, your application code is probably not the problem. This is an important clue. Step 4: Read the Logs Open your Render logs and look for SMTP-related errors. Common messages include: ETIMEDOUT ECONNREFUSED Co