今日已更新 133 条资讯 | 累计 37382 条内容
关于我们

标签:#compute

找到 161 篇相关文章

AI 资讯

I taught my hand gestures to run an AI coding agent

A few weekends ago I got annoyed at typing prompts into a terminal and decided the fix was, obviously, to control my AI agent with hand gestures instead. This is the story of building that, and the two hours I lost fighting a GPU crash that had nothing to do with my code. The idea: a webcam watches your hand, MediaPipe tracks the landmarks, and three gestures map to three actions on an Anthropic-powered coding agent. Pinch (thumb and index touching) - the agent writes code Spinning your index finger in a circle - the agent brainstorms an idea Two fingers "running" up and down - it runs whatever code it just wrote No keyboard. No prompt box. Just your hand in front of a webcam, like you're a conductor telling an orchestra what to play. The MediaPipe detour I started with MediaPipe's newer Tasks API (HandLandmarker), because it's the one all the docs point you to now. It crashed immediately on my Mac with a Metal/GPU service error, even when I forced it onto the CPU delegate. Spent way too long assuming it was my setup before realizing the new API just doesn't play nice with this machine. Switched to the legacy mp.solutions.hands API, pinned to mediapipe==0.10.21, and the problem vanished. Sometimes the fix for a shiny new API is to not use it yet. Gestures are messier than they sound Detecting "pinch" is easy: measure the distance between thumb and index tip, threshold it, done. The other two took more work. "Running" fingers needed the vertical oscillation of the index and middle fingertips, counted by sign crossings, so it doesn't false trigger on a hand that's just drifting. "Spinning" tracks the index fingertip's trajectory and accumulates the signed angle around a center point, so a real circle reads differently than a shaky hand. Both run on a rolling 1.5 second buffer of landmarks, edge triggered so a gesture fires once, not once per frame. Letting the agent run its own code, unsandboxed, on purpose The runner executes whatever the agent wrote as a subprocess

2026-08-30 原文 →
AI 资讯

Nine puzzle solvers, one browser tab, zero servers: a tour of classic search algorithms

I recently finished building a small suite of puzzle and game solvers that all run entirely in the browser — no backend, no API calls, no machine-learning models. You paste in a Sudoku, a chess position, or a crossword pattern, and the answer comes back instantly, computed on your own device. The fun part wasn't the UI. It was that each puzzle turned out to be a textbook excuse to reach for a different classic algorithm. Nine solvers, and I got to use constraint propagation, adversarial search, heuristic search, brute-force scanning, and plain old pattern matching — the stuff that shows up in an algorithms course and then, in most day jobs, never again. This is a tour of which algorithm fits which puzzle, and a few of the potholes I hit along the way. Everything here is vanilla JavaScript running in a Web Worker. The one design constraint: no server Before the algorithms, the rule that shaped all of them: it has to run client-side. That's a privacy choice (your puzzle never leaves the tab) and a cost choice (no compute bill), but it's also a fun forcing function. You can't lean on a beefy backend or a hosted model — you get one browser thread (well, a Worker thread) and whatever you can compute in a few hundred milliseconds. That budget is exactly why classic algorithms shine here. They're fast, deterministic, and small enough to ship as a script. Let's group the solvers by the technique each one leans on. Family 1: Constraint propagation Sudoku Sudoku is the poster child for constraint propagation. A cell that can only be one value forces that value; that in turn shrinks its neighbours' options, which forces more cells, and so on. Most "easy" and "medium" boards fall over from propagation alone (naked singles + hidden singles), and only the hard ones need a backtracking search on top. The nice property: the same engine that solves the board also powers the hint feature (find the next forced cell and explain why it's forced) and a uniqueness check — count solutions,

2026-08-29 原文 →
AI 资讯

MEU COMEÇO NA ÁREA DA TECNOLOGIA

Olá, comunidade dev.to! Meu nome é Neto, tenho 17 anos e sou estudante de Ciência da Computação no UNIPÊ, em João Pessoa. Atualmente, estou cursando o segundo semestre da graduação e também estudando design profissional, área que considero importante para a criação de soluções digitais mais úteis, intuitivas e visualmente agradáveis. Minha trajetória na tecnologia ainda está no começo, mas já tem sido marcada por descobertas, aprendizados e desafios. Escolhi Ciência da Computação porque sempre tive curiosidade sobre como aplicativos, sites e sistemas funcionam. Quero aprender não apenas a programar, mas também a compreender todo o processo de desenvolvimento de um produto, desde a identificação de um problema até a construção de uma solução. Durante o curso, tive a oportunidade de desenvolver, com alguns colegas, um projeto relacionado à criação de um aplicativo. Essa experiência foi importante porque me mostrou que desenvolver um produto vai muito além de escrever código. Foi necessário discutir ideias, organizar tarefas, pensar nas necessidades dos usuários e encontrar soluções para os problemas que surgiram durante o processo. Mesmo enfrentando desafios simples, percebi como cada obstáculo pode contribuir para o nosso crescimento. Em alguns momentos, precisamos revisar decisões, corrigir erros e adaptar o projeto. Também aprendemos que uma equipe precisa manter uma boa comunicação, pois cada integrante possui habilidades, responsabilidades e pontos de vista diferentes. O estudo de design profissional complementa minha formação em computação. Estou aprendendo que uma aplicação não deve apenas funcionar corretamente: ela também precisa oferecer uma boa experiência ao usuário. Elementos como cores, tipografia, organização das informações, acessibilidade e facilidade de navegação influenciam a maneira como as pessoas utilizam um produto. Ainda tenho muito a aprender sobre programação, design e desenvolvimento de projetos. Porém, entendo que a evolução acontece aos po

2026-08-26 原文 →
AI 资讯

Vision-in-the-Loop: When the AI Rewrites Its Own Prompts from the Generated Frame

On the AI video ad platform I work on, every scene goes through the same painful loop: write a prompt, send it to an AI video model provider, wait two minutes, open the result, squint at the frame, and decide what went wrong. Camera too wide. Product missing from the hero shot. Color palette drifted warm when the brand brief says cool neutrals. Avatar looks like a different person than scene three. That loop was manual, slow, and expensive. Each regeneration burns GPU credits. Operators were becoming prompt engineers by accident — and still missing subtle failures until stitch time, when fixing scene four means re-rendering everything downstream. The insight behind vision-in-the-loop prompt authoring is simple: the model that wrote the prompt can also look at its own output and rewrite the prompt with surgical fixes. Not a full replan — a per-scene correction grounded in the actual generated frame, not the operator's memory of what they hoped would appear. The manual loop we were trying to kill Before this work shipped, the swipe iteration flow looked like this: Plan — Claude generates a scene-by-scene script with visual prompts Generate — each scene renders independently through an AI video model provider Review — operator opens the portal, compares frames to the reference ad Rewrite — operator edits prompts in a text field, often guessing at what the model misread Regenerate — repeat until acceptable or budget exhausted Steps three and four are where throughput dies. An experienced operator can spot "product not visible" in three seconds, but translating that into prompt language — "medium close-up, product centered in lower third, shallow depth of field" — takes another minute per scene. Multiply by twelve scenes and three swipe iterations, and a single ad creative consumes an hour of human attention that should be spent on brand strategy, not frame inspection. The generated frame is ground truth. The original prompt is a hypothesis. Vision-in-the-loop closes the

2026-08-26 原文 →
AI 资讯

My Nand2Tetris Journey #2 - Building Basic Chips And ALU

What I Built HalfAdder, FullAdder, Add16, Inc16, And ALU. How I Solved Like when I built logic gates, I started with analyzing truth table of HalfAdder , FullAdder . HalfAdder was really easy. After looking at the truth table, I could map the sum and carry outputs to logic gates pretty quickly. FullAdder was also not hard since it's really similar to HalfAdder except that it can add 3 bits. I realized that I could build it by combining some chips and logic gates I had already made instead of designing everything again from scratch. Once I finished building them, I was also able to build Add16 . At first, I had no idea how to sum all the 16 bits. But I soon realized that I could build a 16-bit adder by combining the smaller adders I had already built and passing carry information to the next bit. It looks not beautiful, but still works. And about Inc16 , it's basically add exactly 1(0000000000000001) . So I could easily build it using Add16 . (But I did something weird at first.. check the Reflection below) ALU was the core part of project 2. Once I realized that Mux can be used as if , I could make proper outputs using logic gates. ALU is also a combination of logic gates and chips, after all. What I Learned How to build basic chips using logic gates and already-built chips Why I should reuse the chips for another chip(check the Reflection section below) Mux can be used like if How to use bit slicing and fan-out in HDL and why it's important Reflection Before I started this part, I didn't know two things: I could use bit slicing and true , false for each bit. So when I first tried to build Inc16 , it looked really weird, since I calculated all the bits one by one. It's not logically wrong. But not beautiful either. I was not sure if it was right or not. Then I realized that I already built Add16 . But I had no idea how I could use it to add exactly 1(0000000000000001) . After googling, I realized that I could use bit slicing like Python's list slicing and construct

2026-08-25 原文 →
AI 资讯

Leetcode 31: Next Permutation

Question : Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replacement must be in-place and use only constant extra memory. Here are some examples. Inputs are in the left-hand column and its corresponding outputs are in the right-hand column. Example : 1,2,3 → 1,3,2 3,2,1 → 1,2,3 1,1,5 → 1,5,1 Idea : Scan from right to left and find the first element that is less that its previous. eg: 1 6 3 5 -> here it is 3. Let's name it as index. Again scan from right to left and find the first element that is greater than 3 and that's 5. Let's mark it as idx. 3.In this step we swap 3 and 5. Reverse elements from index+1 till the array length. Code: public void nextPermutation(int[] nums) { int index = -1; for(int i=nums.length-1;i>0;i--){ if(nums[i]>nums[i-1]){ index = i-1; break; } } if(index==-1){ reverse(nums,0,nums.length-1); return; } int idx=0; for(int i=nums.length-1;i>=index+1;i--){ if(nums[i]>nums[index]){ idx=i; break; } } swap(nums,index,idx); reverse(nums,index+1,nums.length-1); } void swap(int[] nums,int i,int j){ int temp =nums[i]; nums[i] = nums[j]; nums[j] = temp; } void reverse(int[] nums,int i ,int j){ while(i<j){ swap(nums,i,j); i++; j--; } } Code Explanation : We first initialize index=-1 and traverse backward to find the first one with i that satisfy the condition nums[i]>nums[i-1] . We assign this to index and break out of the loop. for(int i=nums.length-1;i>0;i--){ if(nums[i]>nums[i-1]){ index = i-1; break; } } Next step we are discussing a corner case. For example if the given array is 3,2,1 then we cannot find the element that satisfies the previous condition. So when the array is given in decreasing order we just reverse it and return. if(index==-1){ reverse(nums,0,nums.length-1); return; } Next iteration we are considering another variable idx and traverse backw

2026-08-24 原文 →
AI 资讯

LeetCode 3116 (Hard) — binary search + inclusion-exclusion makes it easy

Full walkthrough: https://www.youtube.com/watch?v=vFuFA3ByCs0 LeetCode 3116 — Kth Smallest Amount With Single Denomination Combination. Here’s the trick everyone misses: Brute force (generate all multiples, pick k-th) fails because k can reach 2×10⁹. The real approach: Binary search the answer X Count valid amounts ≤ X using inclusion-exclusion Odd subsets add, even subtract (bitmask over coins) LCM via GCD, break when LCM > X O(n · 2ⁿ · log(k·M)) — passes cleanly. The 26% acceptance rate makes this look harder than it is. Once you see the count(X) monotonic trick, it clicks.

2026-08-21 原文 →
AI 资讯

Part 1 — What Actually Happens When Code Runs

When we write: const result = add ( 10 , 20 ); it feels like the computer simply "runs the code." But the CPU doesn't understand JavaScript. There are several layers between the code we write and the hardware actually executing instructions. That's what I wanted to understand first. From JavaScript to the CPU In Node.js, JavaScript is handled by V8 , the JavaScript engine. A simplified view looks like this: JavaScript ↓ V8 ↓ Bytecode ↓ JIT compilation ↓ Machine instructions ↓ CPU V8 doesn't simply "interpret JavaScript" or "compile JavaScript" once and forget about it. It can start with bytecode and progressively compile frequently executed ("hot") code into more optimized machine code. Eventually, the CPU is executing instructions that operate at a much lower level than the JavaScript we originally wrote. What does the CPU actually do? At its core, a CPU repeatedly executes instructions. A simplified mental model is: Fetch → Decode → Execute → Repeat The CPU has several important pieces involved in this process. Registers are tiny, extremely fast storage locations inside the CPU. They're used to hold values the CPU is actively working with. The ALU (Arithmetic Logic Unit) performs many arithmetic and logical operations. The Program Counter (PC) keeps track of where the next instruction comes from. And the CPU runs according to a clock, measured in GHz. A 3 GHz CPU has roughly 3 billion clock cycles per second, but that does not mean it executes 3 billion instructions per second. Different instructions and architectures have different costs. Modern CPUs are far more sophisticated than this simplified model, using pipelining, multiple execution units, branch prediction, out-of-order execution, and more. But the basic model is enough to start reasoning about performance. The CPU doesn't get everything from RAM One of the most important things I learned here is that where data lives matters . A simplified hierarchy looks like: Registers ↓ L1 Cache ↓ L2 Cache ↓ L3 Cache

2026-08-20 原文 →
AI 资讯

Computer Fundamentals: No BS

I've been working with software for a few years now, and I've noticed something uncomfortable. I can build things. I can work with React, Node.js, databases, APIs, cloud services, and all the usual stuff that comes with being a software engineer. But if I stop and ask: "What is the computer actually doing underneath all of this?" My mental model gets surprisingly fuzzy. I know the concepts. I've used them. I've probably explained some of them before. But knowing how to use something and understanding what is actually happening underneath it are two very different things. And I want to fix that. Why I'm writing this This isn't a course, and I'm not writing this as an expert teaching computer science. These are essentially my notes while rebuilding my computer fundamentals from the ground up . I'm trying to connect the things I use every day as a software engineer with what is actually happening inside the machine. Instead of learning concepts because they're on a traditional CS syllabus, I'm starting with a question: What do I actually need to understand to reason about a production system? For me, that means being able to look at a system and understand what's happening underneath my code. Why is something slow? Where is the bottleneck? What happens when something fails? Why does adding more memory help in one situation but not another? What actually happens when two things execute concurrently? Why does a database query become slow? What happens to a simple HTTP request between two machines? I don't want to just know the answer. I want the mental model that lets me reason about the answer . The path I'm taking I'm roughly following the layers that a typical request passes through: CPU → Memory → OS → Network → Storage → Concurrency → Distributed Systems So the series will go through: 1. What Actually Happens When Code Runs Starting from the bottom: CPU mental model, memory hierarchy, and number representation . 2. Operating Systems Then moving up into processes, th

2026-08-20 原文 →
AI 资讯

The Matte Learns Only Inside the Band

A bad cutout rarely announces itself as a bad cutout. The car lands on a new backdrop, the paint looks clean, then a thin piece is gone. An antenna. A tire lip. The dark seam under a rocker panel. The complaint that comes back is never technical. The vehicle looks wrong. I wanted the last correction stage to fix fuzzy edges without handing it the whole car to rewrite. That sounds like a small distinction. It stops being small the first time a model improves one boundary and quietly damages another. So the rule is physical. Edit the uncertain strip. Leave the settled area alone. This is Part 2. Part 1, "Negative Space Is a Label", was about supervision: what the pixels beside an object teach a model, and why a shadow touching a tire has to be labeled as evidence against foreground. This one moves from training to runtime. A mask already exists. Where is a learned stage allowed to act? 1. The contract lives in the band CarSegNet is the research implementation here. Its pipeline module splits the route by media type, and the docstring says the design more clearly than any diagram I could draw after the fact. Stills run SAM 3 text concept, then NSJ alpha, then composite. A detector box prompt and a depth prior are optional inputs. Video runs SAM 3.1 multiplex propagation, per-frame NSJ with temporal handling, a depth-parallax plate, composite, encode. The list matters less than the handoff. SAM gives a semantic prior. NSJ receives a trimap band. The compositor receives a matte only after the prior and the refiner have each done bounded work. flowchart TD image[Vehicle Image] segment[Concept Mask] trimap[Trimap Band] refiner[NSJ Alpha Refiner] depth[Depth Prior] composite[Showroom Composite] frozen[Prior Frozen Outside Band] image --> segment segment --> trimap trimap --> refiner image --> depth depth --> refiner refiner --> composite segment -.-> frozen frozen --> composite The diagram is a contract. It is not a model zoo. The refiner edits the uncertain strip. The sema

2026-08-18 原文 →
AI 资讯

How Garbage Collection Works: Let's Build One From Scratch

Introduction Your program keeps creating objects. Every function call, every loop iteration, every parsed JSON response produces new ones. You don't manually delete most of them. You've never written a line of code that says "free this memory now." And yet your application doesn't immediately exhaust all available RAM and crash. So who cleans everything up? The answer is a garbage collector, a piece of the runtime that runs quietly in the background, deciding what your program no longer needs and reclaiming that memory for future use. Most developers interact with it only when something goes wrong: an unexpected pause, a memory leak, or an out-of-memory error that shouldn't be happening. Understanding how it actually works turns those confusing moments into solvable problems. And as a bonus, the core algorithm is simple enough to build yourself. We'll do that by the end of this article. -- 1. The Memory Problem Every time your program creates an object, the runtime allocates a chunk of memory to hold it. A string, a dictionary, a class instance: they all need memory, and that memory has to come from somewhere. The somewhere is a region called the heap , a pool of memory that the program draws from as it runs. When you create an object, the runtime finds a suitable slot in the heap and reserves it. When that object is no longer needed, that slot should be freed so it can be used for something else. In languages like C, you manage this manually. You allocate memory when you need it, and you free it when you're done. This gives you control, but it creates two classic failure modes. Free memory too early and you have a dangling pointer, a reference to memory that's now being used for something else. Forget to free it at all and you have a memory leak: the program slowly consumes more and more memory until it runs out. Automatic memory management exists to eliminate these failure modes. Instead of relying on the programmer to track every allocation and release, the runti

2026-08-15 原文 →
AI 资讯

Lean 创始人访谈全记录:当形式化验证遇上 AI,手写数学与软件验证将如何被重塑

https://www.youtube.com/watch?v=KzdYKeAqWhY 题目:《Lean 创始人访谈全记录:当形式化验证遇上 AI,手写数学与软件验证将如何被重塑》 第(一)部分 开场与核心命题:从“测试只能证明有 bug”到“证明可确保无 bug” (0% - 8%) Dijkstra 名言引出形式化验证的根本价值:主持人以 Dijkstra 的名言“程序测试可用于揭示 bug 的存在,但永远无法证明 bug 的不存在”开场,指出 Lean 与形式化证明的意义恰恰在于“证明 bug 不可能发生”。 Lean 的基础定位:Lean 既是一门编程语言(可以写代码),也是一个证明系统(可以对代码写性质并用机器可检查的证明来验证)。它提供绝对正确的保证,并拥有多个独立的检查器。 Lean 应被视为平台:用户可以在 Lean 上写代码、写关于代码的性质命题、并给出证明;本期节目将围绕它如何工作、以及它如何改变数学和软件验证的未来展开,并提出“手写数学是否会终结”这一核心疑问。 第(二)部分 Lean 是什么:编程语言与证明助手的一体两面 (8% - 18%) Lean 的双重身份:Lean 不仅可用于数学证明,也可用于软件验证。基于依赖类型论(Dependent Type Theory)的一族证明助手(如 Rocq/Coq 和 Lean)天然就是“编程语言 + 证明助手”。 软件验证的两种主流路径: • 浅嵌入(Shallow Embedding):通过工具(如把 Rust 翻译到 Lean 的工具)把其他语言映射到 Lean 中进行验证。 • 深嵌入/语义建模:在 Lean 中为 C 语言等编写语义,把 C 程序表示为 Lean 中的数据结构,从而对其陈述性质并进行推理。 具体例子——数组越界验证:以 C 语言访问数组为例,可在 Lean 中把“索引 i 满足 0 ≤ i < 10”写成数学命题;原来的 C 源文件可对应一份“元数据式”的 Lean 证明,由 Lean 逐行检查。 自动化与可维护性:人们会建立自动化框架(如基于前置条件-语句-后置条件的三元组),把证明过程变得更易管理;复杂度是软件验证的大敌,而 AI 的出现让“自动证明”成为可能,但前提是把证明写得模块化以便扩展。 第(三)部分 从“测试套件”到“形式化规格”:为什么规格优于测试 (18% - 28%) 测试 vs. 证明的本质差异:测试套件再全面,也只覆盖了有限场景,角落案例仍可能遗漏;而形式化证明覆盖所有可能情况,真正做到了“bug 的不存在”。 Zlib 压缩库的震撼案例:主持人的同事 Kim Morrison 发起项目,让 AI 把 C 写的 Zlib 压缩库翻译进 Lean,要求通过原测试套件,并证明“压缩后再解压得到原始数据”这一强性质。结果仅用一周就完成了整个形式化,目前只需再做性能优化,且优化不能破坏既有证明。 规格说明(Specification)的成本讨论:写出一份好的规格,工作量因程序而异。一个实用技巧是:先用“低效但正确”的实现作为规格(Spec),再让 AI 生成高效版本并证明其与规格等价。 Jane Street 与工业界实践:Jane Street 等公司已在投资形式化验证,例如对微内核 seL4 的完整验证。过去这类工作在没有 AI 时“手动证明 + 维护证明”的成本极高(往往是写程序本身的 10 倍),而 AI 正在消除这种痛苦——AI 非常擅长撰写和维护形式化证明,即使人已经忘了当初为何这么证。 第(四)部分 Lean 作为编程语言的工程实践与工具链 (28% - 36%) 不仅是证明助手,更是生产级编程语言:AWS 内部有一个约 50 万行 Lean 写的 AI 加速器编译器,主要把 Lean 当编程语言用,顺带获得一些性质证明作为“额外红利”。 工具链体验接近现代语言:构建系统 Lake 相当于 Rust 的 Cargo;编辑器用 VS Code,提供 IntelliSense 等熟悉体验。 Info View——Lean 独有的核心交互界面:屏幕通常一分为二,左侧是代码/证明文件,右侧 Info View 实时显示当前证明目标的状态变化,给用户持续反馈。 Tactic 模式:把证明当成“游戏”:用户通过 by 进入领域特定语言(DSL)来写证明,每一步可简化目标、应用已知引理等,看着目标逐步减少直到归零,过程极具“通关”快感,不少用户戏称自己“沉迷其中”。 第(五)部分 内核信任问题:Lean 自身是否被 Lean 验证? (36% - 42%) 只需信任极小的内核:Lean 整体庞大且规格频繁变动(如简化器的行为不断被用户定制),难以对全部进行形式化;但证明检查的核心——“内核”是可以被规格化的。 多内核策

2026-08-15 原文 →