AI 资讯
Baseline – a production FastAPI starter kit
What a "production-ready" FastAPI starter actually needs Every FastAPI project I've started begins the same way: an hour of boilerplate before I write a single line of actual logic. Auth. A database session dependency. A folder structure that won't fall apart once there's more than one resource. A test setup that doesn't take longer to configure than the tests themselves. I got tired of rebuilding it, so I built it once, properly, and wrote down why each piece is shaped the way it is. The structure Every resource in the project follows the same four layers: Router — HTTP in/out only. Parses the request, calls a service, serializes the response. No business logic lives here. Service — business rules. Ownership checks, "does this already exist" decisions, orchestration. No FastAPI imports — this layer doesn't know it's running inside a web framework. Repository — persistence only. SELECT/INSERT/UPDATE/DELETE via SQLAlchemy. No business rules. Schema — Pydantic models for request/response shapes, kept separate from the ORM models. This feels like overkill for a single resource. It stops feeling that way the first time you need the same ownership check enforced in two different routes, or the first time you want to unit-test a business rule without spinning up the whole ASGI app to do it. The decisions that actually mattered Testing against real Postgres, not SQLite. A SQLite-backed test suite gives you false confidence — native UUID types, enum handling, and constraint behavior all differ enough that "tests pass" stops meaning "the Postgres-specific code works." Each test runs inside a SAVEPOINT that gets rolled back afterward, so isolation doesn't cost a schema rebuild per test. Two token types, not one. Short-lived access tokens (15 min) plus longer-lived refresh tokens (30 days), with the token's type claim checked on every decode — a refresh token presented where an access token is expected gets rejected on that alone, not just on signature validity. One error shap
AI 资讯
Juinper Networks
Upgrading Juniper MX Networks from 100GbE to 400GbE: What Engineers Need to Know Moving a production network from 100 Gigabit Ethernet to 400 Gigabit Ethernet sounds simple on paper: Replace a 100G interface with a 400G interface and get four times the bandwidth. In a real carrier or data-center network, however, the interface is only one part of the equation. The router's forwarding silicon, switch fabric, midplane, power system, cooling, optics, software release, slot selection, redundancy configuration, and licensing can all determine whether the expected capacity is actually available. Juniper's MX240, MX480, and MX960 platforms provide an interesting example because these systems can be upgraded with newer generations of Modular Port Concentrators rather than requiring an immediate chassis replacement. One particularly useful case study is the Juniper MPC10E-15C , a Trio 5-based line card capable of supporting both 100GbE and 400GbE interfaces. This article isn't about whether you should buy a particular line card. Instead, we'll use the MPC10E-15C to examine the engineering questions that should be answered before attempting a 100G-to-400G upgrade on an existing Juniper MX network. Video Overview The video provides a short overview of the hardware. Below, we'll go deeper into the architecture and the deployment considerations that matter when integrating this class of line card into an existing MX environment. Why Moving from 100G to 400G Isn't Just a Port Upgrade Suppose an edge router has four heavily utilized 100GbE connections. At first glance, replacing those links with 400GbE interfaces appears straightforward. But consider what happens behind the physical port. Traffic entering that 400G interface must travel through several parts of the system: Interface → Packet Forwarding Engine → Fabric → Other line cards/interfaces Every component in that path needs sufficient capacity. A 400GbE optic connected to a router that cannot move 400 Gbps through its inte
开源项目
Research roundup: 7 cool science stories we almost missed
"Black hole stars," making cookies from plastic, tiny sound-powered drones, and more.
AI 资讯
# Stop hardcoding AWS Lambda layer ARNs, and use AWS Systems Manager Parameter Store public parameters instead
To add the AWS AppConfig Agent Lambda extension to an AWS Lambda function, you can open the documentation, scroll through a table of ARNs, find the one that matches your AWS Region and architecture, copy it, and paste it into your template. However, a few months later, AWS publishes a new version and now your deployment is silently using an older one. There’s a better approach that uses public parameters in AWS Systems Manager Parameter Store (Parameter Store). What are public parameters in Parameter Store? Many AWS services use Parameter Store to publish read-only public parameters with names that start with aws/service/{service-name} . These public parameters contain up-to-date metadata about AWS services. You've probably seen them used for AMI lookups for fetching the latest Amazon Linux AMI ID without hardcoding it. The same mechanism is available for Lambda layer ARNs, ECS-optimized AMIs, and other resources that AWS updates regularly. The key idea is instead of looking up a value in documentation and pasting it into your code, you query Parameter Store at deploy time and get the current value. The only IAM permission that's required is ssm:GetParameter . The parameters are public and readable from any AWS account. The problem with hardcoded layer ARNs The AWS AppConfig Agent Lambda extension is distributed as a Lambda layer. To attach it, you need the layer's ARN, which includes a version number at the end: arn:aws:lambda:us-east-1:027255383542:layer:AWS-AppConfig-Extension:128 That version number changes every time AWS releases an update. If you hardcode it, you get a working deployment, but you also get silent drift. A few months from now, you'll be running an older version without realizing it. Imagine a team that's managing dozens of functions in multiple AWS Regions, and you can see how this can become a maintenance problem. Someone has to regularly check the documentation, update the ARN, and redeploy. It's not difficult work, but it's the kind of thing
AI 资讯
Is Someone Hacking DoD Refrigerators?
It sure seems like it. The stores confirmed to be affected include Fort Irwin , Calif.; F.E. Warren Air Force Base , Wyo.; Fort Huachuca , Ariz.; Naval Station Newport , R.I.; Columbus Air Force Base , Miss.; and Travis Air Force Base , Calif., according to announcements made online by each installation. Naval Air Station Lemoore, Calif., also experienced an outage, according to M. Elizabeth, writer of the Substack newsletter Signal and Silence . Each service declined to answer questions about how many bases are affected by the outages, referring all questions to the Defense Department. Pentagon officials did not respond to questions...
AI 资讯
FastAPI for AI Engineers - Part 8: Uploading Files with FastAPI
In the previous article, we learned how to secure our APIs using JWT Authentication and protect routes from unauthorized access. Now let's explore another feature used in almost every AI application— file uploads . If you've built applications like ChatGPT, document Q&A systems, resume analyzers, legal contract reviewers, or medical report analyzers, one thing is common across all of them: The user uploads a file. Without file uploads, there is nothing for the AI model to process. If you haven't read the previous article, check it out first to continue the series: Protecting routes with JWT Tokens Why Do We Need File Uploads? Consider some popular AI applications: ChatGPT allows you to upload PDFs and images. Resume analyzers require your resume. Legal AI assistants analyze contracts. Medical AI systems analyze lab reports. RAG applications build knowledge bases from documents. The workflow usually looks like this: User │ ▼ Upload File │ ▼ FastAPI │ ▼ Save / Read File │ ▼ Process using AI FastAPI makes uploading files extremely simple. Installing Required Package FastAPI uses python-multipart to process uploaded files. Install it using: pip install python-multipart Your First File Upload API FastAPI provides two important classes: File UploadFile Let's import them. from fastapi import FastAPI , File , UploadFile app = FastAPI () Creating the Upload Endpoint @app.post ( " /upload " ) def upload_file ( file : UploadFile ): return { " filename " : file . filename } Run the application. Open Swagger UI. Click POST /upload . You'll notice FastAPI automatically provides a file picker. Upload a file. Response: { "filename" : "resume.pdf" } Our API successfully received the uploaded file. Understanding UploadFile You might wonder: Why didn't we simply use a string or bytes? FastAPI provides the UploadFile class because it contains useful information about the uploaded file. Some commonly used attributes are: file . filename Returns: resume.pdf file . content_type Returns: a
AI 资讯
New York Governor Kathy Hochul thinks AI should be ‘less evil’
Today, I’m talking with New York Governor Kathy Hochul, and I’ll just warn you — this episode moves really fast. It’s an election year, after all, with a shocking amount of tech policy at stake, and Governor Hochul has taken strong positions on almost every major tech issue there is. For example, Meta just reached […]
AI 资讯
Mainstreaming RakuAST
Yes, it looks like the next release of Rakudo (2026.09, tentatively planned for 26 September) will be the first Rakudo release that will use the new Raku backend (based on a new grammar producing RakuAST) as the default when compiling a writting in the Raku Programming Language . Until then one had to specify the RAKUDO_RAKUAST=1 environment variable to activate the new backend. It is a major step towards releasing the next Raku language level, tentatively still called "6.e" for historical reasons, later this year. Note that the 2026.09 Rakudo release will not remove the old backend from the core just yet: you will be able to activate the old backend by specifying the RAKUDO_LEGACY=1 environment variable. However, the old backend will be removed when the 6.e Raku language level is released. So it is very important to check what these changes will mean for you! Immediate effects So what will a user of this Rakudo release notice with their apps and libraries? Nothing In the past weeks the Raku ecosystem has been thoroughly scoured for code that would stop functioning in RakuAST. Some finds turned out to be omissions / errors in the RakuAST implementation (which then have been fixed). Others turned out to be modules doing (semi-)naughty things, for which Pull Requests were made to ensure they will continue to operate in RakuAST. Running slower It could well be that your code is running without issues, but all of a sudden runs slower than before. Years of optimizing the old backend were mostly lost in RakuAST. And had to be re-created in the RakuAST-based backend. Which may have lost a few nooks and crannies that affect the execution speed of your code. Slower execution should be reported as a bug, so that it can be fixed! Running faster One of the goals of the RakuAST projects was to be able to provide better optmizations. Some of the ideas for these optimizations have already been implemented in RakuAST. And as a part of this work, a lot of aspects of the runtime have
AI 资讯
I Built My Own Fail-Fast HashMap — Here's Why a Boolean Flag Wasn't Enough
If you've done LeetCode's Design HashMap , you've implemented put , get , and remove . What that exercise usually skips is the part that actually breaks in production: what happens when someone mutates the map while another piece of code is iterating over it. I ran into this directly while building MyHashMap , a from-scratch single-threaded HashMap (separate chaining, resize on load factor). Getting put / get / remove right was the easy 80%. Getting entrySet().iterator() to correctly detect concurrent mutation — including the case where a second, completely separate iterator is the one that should notice — took three wrong turns before landing on the pattern the JDK actually uses. The problem, concretely Iterator < Entry < K , V >> it = map . entrySet (). iterator (); it . next (); map . put ( someNewKey , someValue ); // structural change, mid-iteration it . next (); // ??? — undefined behavior if we don't guard against this Without a guard, next() might return a stale entry, skip entries entirely, or throw an unrelated exception depending on internal bucket-array state. Java's real collections handle this with ConcurrentModificationException (CME) — but the interesting part isn't the exception, it's the mechanism that detects when to throw it. First idea: a boolean "dirty" flag Obvious first attempt: a boolean modified field on the map, flipped to true on any put / remove , checked by the iterator. This works for exactly one iterator. It falls apart the moment two iterators are alive at once: Iterator A calls next() , sees modified == false , proceeds. Something else mutates the map. modified flips to true . Iterator B — created after that mutation — checks the same shared modified flag, sees true , and incorrectly throws, even though nothing has changed since B was created. A single shared boolean can't represent "changed since this specific iterator was created" for more than one iterator at a time. Resetting it on read doesn't help either — now the other iterat
AI 资讯
Cómo detectar y frenar estafas con voces deep‑fake en 2024
Detecta y neutraliza estafas telefónicas con voces deep‑fake: guía práctica y herramientas de clonación vocal Introducción Imagina que recibes una llamada de tu jefe pidiéndote una transferencia urgente… pero la voz es una réplica perfecta generada por IA. En 2024 esa escena ya no es ficción: las estafas con voces deep‑fake están a la orden del día en EE. UU., Europa y América Latina. Gracias a plataformas como ElevenLabs , iSpeech o a modelos de código abierto como Coqui‑TTS y VITS‑OpenAI , crear una copia casi idéntica de la voz de cualquier persona cuesta menos de 100 USD y se hace en cuestión de minutos. En este artículo verás cómo funciona la tecnología , cómo identificar una voz sintética y qué medidas tomar tanto si eres usuario particular como si gestionas la seguridad de una empresa. 1. Tecnologías de clonación vocal: panorama rápido Tipo Ejemplo Precio (mensual) Necesita GPU? Privacidad Comentario SaaS (API) ElevenLabs, iSpeech, Resemble AI $0‑$49 (plan básico) No Los datos se envían a la nube Fácil de integrar, ideal para pruebas rápidas OSS (auto‑alojado) Coqui‑TTS, Mozilla TTS, VITS‑OpenAI Gratis (coste de infraestructura) Sí (GPU recomendada) 100 % bajo tu control Requiere instalación y ajuste fino 2. Detecta una voz deep‑fake en 3 pasos (y sin ser ingeniero) Paso 1 – Escucha los “errores humanos” Señal auditiva Qué indica Respiraciones muy cortas o inexistentes Síntesis sin modelo de respiración Entonación monótona en frases largas Falta de variabilidad prosódica “Cortes” o chasquidos en palabras compuestas Artefactos de concatenación de fonemas Falta de “cierre” de consonantes (p. ej. “s” muy suave) Modelo TTS de baja calidad Paso 2 – Analiza el espectro con una herramienta gratuita # Instala DeepSpeech-detect (Python) pip install deepvoice-detect # Analiza la llamada guardada como audio.wav deepvoice-detect audio.wav --output report.json El archivo report.json contiene un score de probabilidad (0‑1). Valores > 0.7 suelen corresponder a voces generad
AI 资讯
Nginx Load Balancing with DNS-Based Service Discovery on Incus
Nginx Load Balancing with DNS-Based Service Discovery on Incus Hari ini saya buat satu practical lab untuk memahami Nginx Load Balancing , DNS-based Service Discovery , dan operational logging dalam persekitaran self-hosted menggunakan Incus. Lab ini bermula dengan architecture yang simple: Client │ ▼ Nginx LB │ ├──► web01 └──► web02 Kemudian saya tambah satu DNS server supaya backend tidak perlu bergantung sepenuhnya kepada hard-coded IP address. 1. Architecture Final architecture: DNS dns / dnsmasq 10.107.109.18 ▲ │ DNS lookup: web.incus │ │ Nginx LB 10.107.109.69 │ Load Balancing ┌──────────┼──────────┐ ▼ ▼ ▼ web01 web02 web03 .100 .253 .xxx Ada dua jenis communication flow dalam architecture ini. DNS resolution Nginx LB ──────► DNS │ └── web.incus ↓ .100, .253, .xxx DNS hanya digunakan untuk mengetahui IP address backend. HTTP traffic Client │ ▼ Nginx LB │ ├────► web01 ├────► web02 └────► web03 DNS tidak membawa HTTP traffic . DNS hanya menjawab: Where is web.incus ? Nginx kemudian menggunakan IP yang diperoleh daripada DNS untuk melakukan load balancing. 2. Static / Hard-Coded Upstream Cara paling mudah untuk configure Nginx Load Balancer ialah dengan meletakkan IP backend secara terus. Contoh: upstream backend { server 10.107 .109.100 ; server 10.107 .109.253 ; } Architecture: Nginx LB │ ├──► 10.107.109.100 │ └──► 10.107.109.253 Kelebihan Simple Mudah difahami Predictable Sesuai untuk environment kecil Tidak memerlukan DNS service discovery Kekurangan Kalau tambah web03 : web01 web02 web03 Nginx configuration perlu diubah: upstream backend { server 10.107 .109.100 ; server 10.107 .109.253 ; server 10.107 .109.xxx ; } Kemudian configuration perlu divalidasi dan biasanya Nginx perlu di-reload. 3. DNS-Based Service Discovery Pendekatan kedua ialah menggunakan hostname sebagai service identity. Contohnya: web.incus DNS: web.incus ├── 10.107.109.100 ├── 10.107.109.253 └── 10.107.109.xxx Nginx tidak perlu mengetahui backend IP secara hard-coded. Contoh: resolver 10.
AI 资讯
Standing Up a GPU Cluster on AKS for vLLM
This article is Part of a series on running vLLM on AKS and walks through creating an AKS cluster with a GPU node pool, deploying vLLM onto it, and wiring up Prometheus and Grafana for visibility. Companion pieces: Choosing the right GPU | Why your autoscaler flaps | Source Setup Summary Cloud: Azure GPU node: Standard_NV36ads_A10_v5 (1× A10, 24 GB) Image / model: vllm/vllm-openai:latest serving Qwen/Qwen2.5-7B-Instruct-AWQ Observability: kube-prometheus-stack (Prometheus + Grafana), KEDA, NVIDIA DCGM exporter All commands below are bash. The steps are ordered and each one depends on the previous. Dependency chain The build order follows one chain: model → VRAM requirement → GPU SKU → region availability → quota. Step 0 — Prerequisites (one-time, survives resource group deletion) GPU quota. Request through Portal → Quotas → Compute → This article: Requested Standard NVADSA10v5 Family vCPUs = 108 in westus (108 = 3 nodes × 36 vCPUs, matching the autoscaler's max-count 3 set in step 3). Quota is granted per-subscription and survives resource group deletion, so this step happens once, not on every rebuild. A quota is Azure's per-subscription limit on how much of a resource (here, GPU vCPUs in a specific VM family) you're allowed to provision at once. New subscriptions start at 0 for GPU families since it's expensive and can be abused. You need it because without an approval, az aks nodepool add for a GPU will fail outright. The request goes through manual Azure approval, so it has to happen before you plan to build. * Prerequisites * Existing Azure Subscription: Local tooling: Helm 3+ kubectl Bash Bash Variables to set for use through the setup RG = <resource-group-name> CLUSTER = <cluster-name> LOCATION = <preferred-location> Step 1 — Create Resource group az group create -n $RG -l $LOCATION Step 2 — Create AKS cluster, on a CPU system pool az aks create -g $RG -n $CLUSTER \ --node-count 1 --node-vm-size Standard_D2s_v5 \ --generate-ssh-keys The GPU does not go on thi
产品设计
NASA’s Nancy Grace Roman Space Telescope Has a Hidden Technological Leap
Astronomers will test equipment that, if it’s successful, will one day be crucial for discovering Earthlike planets.
产品设计
How Sweden built one of Europe’s hottest startup ecosystems
Sophia Bendz, general partner at Cherry Ventures, stopped by Equity to break down the latest in the Swedish tech ecosystem.
AI 资讯
The iPhone Fold could make concerts even worse
You know the person blocking your view of the concert because their phone is swaying in the air, recording the entire thing? Get ready for the unfolded version of it. This week on The Vergecast, we dive right into the big week of Apple news. First, it's the refreshed Mac Mini and Mac Studio, as […]
开源项目
Uber Builds GitFarm to Run Git Operations as a Service for Large-Scale Monorepos
Uber’s GitFarm provides Git operations as a centralized service, eliminating local repository clones across large scale monorepo workloads. The platform uses prewarmed checkouts, ephemeral sandboxes, repository synchronization, and gRPC streaming to reduce resource consumption and startup latency for automation services operating across thousands of repositories. By Leela Kumili
AI 资讯
AI Agents Are Hacking Systems. Could That Push the US and China to Cooperate?
This week on “Uncanny Valley,” senior writer Will Knight talks his recent visit to China and the future of AI collaboration.
AI 资讯
The iconic T-38 jets flown by astronauts just got a spiffy new look
"Everyone wants to take that aircraft up now..."
AI 资讯
OpenAI’s executive exodus has one big winner
Today on Decoder, I’m talking to Verge senior AI reporter Hayden Field about some pure Decoder bait: the seemingly-endless org chart changes at OpenAI, and how all of them seem to consolidate power under cofounder Greg Brockman, the company’s president. While Sam Altman is the CEO and still OpenAI’s most public face, Brockman has amassed […]
AI 资讯
How AI Helps Us Explore the Universe
How AI Helps Us Explore the Universe Modern telescopes and space missions generate more data in a single night than a team of human astronomers could review in a lifetime. The Vera C. Rubin Observatory in Chile, for instance, is expected to produce up to seven million alerts every night once it reaches full operational cadence, each one flagging something in the sky that changed since the last image. No group of humans can look at that stream and make sense of it in real time. Machine learning can, and increasingly does. This is the quiet story behind most recent breakthroughs in astronomy: it is not just bigger telescopes, but bigger telescopes paired with models that can filter, classify, reconstruct, and predict faster than any manual pipeline. Here is a tour of where AI is actually doing that work, and why it matters to anyone who writes code. The Data Problem Comes First Space science has quietly become a big data problem. The Rubin Observatory's ten-year Legacy Survey of Space and Time will produce roughly 60 petabytes of raw imagery and catalog around 20 billion galaxies and a similar number of stars. Every image the telescope takes is compared, pixel by pixel, against previous images of the same patch of sky, and any meaningful difference (a moving asteroid, a brightening supernova, a flaring galactic nucleus) triggers an alert within about two minutes of the exposure being taken. That alert stream is too large and too fast for manual triage. So astronomers built software "brokers": machine learning classifiers that sit between the telescope's raw output and the scientists, deciding in near real time which alerts are worth a second look. This is a pattern you will see across almost every domain of modern astronomy: instruments generate more signal than humans can parse, and a model is inserted into the pipeline to do the first pass of filtering. Finding Planets in a Sea of Noise Exoplanets are found mostly through the transit method: a planet passes in front