AI 资讯
The Union‑Find Fellowship: Finding Your Tribe in Code
The Quest Begins (The "Why") I still remember the first time I stared at a LeetCode problem that asked me to count the number of islands in a grid. My initial instinct? Run a BFS/DFS from every unvisited land cell, mark everything reachable, and repeat. It worked, but each query felt like I was re‑exploring the same territory over and over again—like walking the same hallway in a dungeon every time I wanted to open a new door. Then a friend tossed me another problem: “Given a list of friendships, tell me if two people are in the same social circle.” Again, the naive solution was to rebuild the whole graph for every query. I felt like I was stuck in a grind‑fest, repeating the same low‑level work while the real challenge—understanding the structure of the connections—remain. That frustration sparked a question: Is there a way to remember what we’ve already discovered about connectivity, so future queries are instant? The answer, as many of you have guessed, lives in a humble but mighty data structure called Union‑Find (also known as Disjoint Set Union, DSU). The Revelation (The Insight) At its core, Union‑Find is about two simple ideas : Each element starts in its own set – think of every person as a lone adventurer. When we learn that two elements belong together, we merge their sets – we call that a union . The magic isn’t just in merging; it’s in how we find the representative (or “root”) of a set later on. If we naïvely walked up a chain of parents every time, we could end up with O(n) per find—still a grind. Two optimizations turn this into near‑constant time: Union by rank (or size) – always attach the smaller tree under the root of the larger one. This keeps the overall tree shallow, guaranteeing that the height never exceeds log n. Path compression – during a find operation, we make every node we pass point directly to the root. It’s like handing every traveler a map that instantly shows the shortest route to the campfire, so next time they don’t need to trek
AI 资讯
AWS Lambda MicroVMs alternative: agent sandboxes in the EU
On 23 June 2026, AWS shipped Lambda MicroVMs : isolated VMs you launch, suspend, resume and terminate through an API, built explicitly for "workloads that execute user- or AI-generated code." Up to 16 vCPUs, 32 GB of memory, 8 hours of runtime, a dedicated HTTPS endpoint per VM. We've been shipping that product for a while. So has E2B, so has Modal. The interesting thing about the launch isn't that AWS caught up - it's that the biggest infrastructure company in the world looked at agent sandboxes, agreed with the design, and then shipped it with one European region and a price roughly three times ours per vCPU . That's the whole post. If you want an AWS Lambda MicroVMs alternative, "can anyone else do this" isn't the question - the isolation technology is literally the same on both sides. The questions are who operates the machine, where in Europe you can put it, and what it costs to leave running. AWS wins some of these outright, and we'll say where. The short verdict Pick Lambda MicroVMs if you're already deep in AWS, need more than 4 vCPUs or 8 GB in a single sandbox, or your agent has to reach private resources inside your VPC. The IAM integration and the size of the fleet are real advantages. Pick orkestr sandboxes if you're an EU company that wants execution, snapshots and logs inside one EU legal entity, you want to pay for CPU you actually burned rather than CPU you reserved, and your sandboxes are small and numerous rather than huge. The same primitive Both products run on Firecracker. AWS says so on the docs page - "Lambda MicroVMs deliver these core capabilities through Firecracker virtualization" - and so do we. Each sandbox is a hardware-isolated VM with its own kernel and rootfs, not a container sharing the host kernel. That distinction matters exactly when an LLM is writing shell commands you haven't read yet. The lifecycle is the same too. Create, exec, read and write files, pause, resume, terminate. Here's ours: from orkestr import Sandbox with Sand
开发者
Your code reviewer should never be the first to read your code
the most useful habit i have hasn't changed in years: your reviewer should never be the first person to read your code. it doesn't matter if the change is one line. you read it first. the trick is reading it in the diff view, the same tool your reviewer will use, not your editor. the diff is a different lens. the debug print you forgot, the block you commented out, the variable you renamed everywhere but one place, all of it looks fine while you're writing and wrong sitting next to everything else that changed. this matters more now that an agent writes the code, not less. you're no longer the author who remembers every keystroke. you're the first reviewer of a change you mostly watched happen. so read it like a stranger wrote it. in a sense, one did. https://starikov.co/commit-lifecycle/ submitted by /u/iGotYourPistola [link] [留言]
开发者
Conditional Operator (`?:`) in Java
The conditional operator ( ?: ) — The Only Ternary Operator is one of the most useful operators in Java. It lets you write simple decision-making logic in a single line, making your code cleaner and more concise. It's also a favorite topic in Java interviews because of its syntax, nesting behavior, and type compatibility rules. In this article, you'll learn: What the conditional operator is Why it's called a ternary operator Syntax and working Nested conditional operators Difference between ?: and if-else Practical examples Interview questions Memory tricks What is the Conditional Operator? The conditional operator is represented by: ? : It is the only ternary operator in Java . A ternary operator takes three operands , unlike: Operator Type Number of Operands Example Unary 1 ++x , !flag , ~5 Binary 2 a + b , a > b , a && b Ternary 3 (a > b) ? a : b Syntax result = ( condition ) ? valueIfTrue : valueIfFalse ; How It Works condition │ Is it true? / \ Yes No │ │ valueIfTrue valueIfFalse │ │ └────── Result ──────┘ If the condition is true , Java returns the value before the colon ( : ). If the condition is false , Java returns the value after the colon ( : ). Example 1 int x = ( 10 > 20 ) ? 30 : 40 ; System . out . println ( x ); Output 40 Step-by-Step Evaluate the condition: 10 > 20 ↓ false Since the condition is false, Java selects the value after : . 40 Therefore, x = 40 Example 2: Finding the Maximum int a = 10 ; int b = 20 ; int max = ( a > b ) ? a : b ; System . out . println ( max ); Output 20 This is one of the most common uses of the conditional operator. Example 3: Even or Odd int number = 7 ; String result = ( number % 2 == 0 ) ? "Even" : "Odd" ; System . out . println ( result ); Output Odd Example 4: Absolute Value int x = - 5 ; int absolute = ( x < 0 ) ? - x : x ; System . out . println ( absolute ); Output 5 Nested Conditional Operators One of the biggest advantages of the conditional operator is that it can be nested . Example int x = ( 10 > 20 ) ? 30 :
AI 资讯
I Ran 10 AI Coding Models Through 5 Tasks: A Data Scientist's Take
I Ran 10 AI Coding Models Through 5 Tasks: A Data Scientist's Take I'll be honest — I went into this expecting a clear winner. I came out with a scatter plot, three regressions, and a deeper appreciation for why "best" is the most dangerous word in machine learning. Over the past three weeks I've been grinding through prompts with ten different LLMs, all routed through the same endpoint, scoring every output on a 1–10 rubric that I tried very hard not to bias. The pricing data is pulled directly from the provider pages. The scores are mine. If you disagree with a score, you're probably right — n=1 per task per model is a laughably small sample size, and I say that as someone who publishes papers with bigger samples. But trends still emerged. Let me walk you through what I found. The Lineup Before I touch a single benchmark, here's the cast. I've grouped them by family so you can see the obvious concentration in the open-source Chinese ecosystem, which personally I find fascinating — three of the top five are DeepSeek or Qwen variants. # Model Provider Output $/M Category 1 DeepSeek V4 Flash DeepSeek $0.25 General (strong code) 2 DeepSeek Coder DeepSeek $0.25 Code-specialized 3 Qwen3-Coder-30B Qwen $0.35 Code-specialized 4 DeepSeek V4 Pro DeepSeek $0.78 Premium general 5 DeepSeek-R1 DeepSeek $2.50 Reasoning (code thinking) 6 Kimi K2.5 Moonshot $3.00 Premium general 7 GLM-5 Zhipu $1.92 Premium general 8 Qwen3-32B Qwen $0.28 General purpose 9 Hunyuan-Turbo Tencent $0.57 General purpose 10 Ga-Standard GA Routing $0.20 Smart routing One quick note on Ga-Standard — it's a routing layer that picks a backend model per request. So the score fluctuates. I averaged across runs. How I Tested Five prompts. Each one designed to probe a different cognitive layer: Function implementation — flatten a nested list recursively in Python Bug fix — chase down an async/await race condition in JavaScript Algorithm — Dijkstra's shortest path in TypeScript with proper types Code review — sec
开发者
Why design matters for a web framework: a 7-year evolution
submitted by /u/matijash [link] [留言]
开发者
git rebase -i is not that scary
submitted by /u/cachebags [link] [留言]
开发者
I Could've Rickrolled the Entire FIFA World Cup. All I Needed Was My ID.
submitted by /u/IanisVasilev [link] [留言]
产品设计
How I Used Spec-Driven Development to Build a Game (TanStack Start)
I've been deep in spec-driven development (SDD) lately, and I want to walk through what it actually...
产品设计
I Want to Build a Sandboxed, Cross-Platform Software Distribution System
submitted by /u/maximecb [link] [留言]
开发者
Beautiful Type Erasure with C++26 Reflection
submitted by /u/Ok_Statistician_781 [link] [留言]
AI 资讯
LeetCode 78. Subsets
Link https://leetcode.com/problems/subsets/description/ Problem Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example Example 1: Input: nums = [1,2,3] Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] Example 2: Input: nums = [0] Output: [[],[0]] Solution First, create a variable subsets, initialized to [[]], as the return value. Loop through nums, and for each element, create new subsets by appending that element to each existing subset. Then, append these new subsets to subsets. Sample code class Solution : def subsets ( self , nums : List [ int ]) -> List [ List [ int ]]: """ 0: [[]] 1: [[]]+[1] -> [[], [1]] 2: [[],[1]] + [2],[1,2] -> [[], [1], [2], [1, 2]] 3: [[], [1], [2], [1, 2]] + [3], [1, 3], [2, 3], [1,2,3] -> [[], [1], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]] """ subsets = [[]] for num in nums : new_subsets = [ subset + [ num ] for subset in subsets ] subsets += new_subsets return subsets
开发者
Using self-hosted Umami for iOS app analytics
submitted by /u/Sankra [link] [留言]
AI 资讯
Stop Writing try/catch in Every Controller
When I first started building APIs with Express.js, every async controller looked the same. I would write a try block, perform some database operations, and then write a catch block that called next(error) . It worked, so I copied the same pattern into every controller. One controller became ten. Ten became fifty. Eventually, I realized that half of my controller code wasn't actually business logic, it was just repetitive error handling. That's when I discovered the Async Handler pattern. The Problem A typical Express controller often looks like this: export const getUser = async ( req , res , next ) => { try { const user = await User . findById ( req . params . id ); if ( ! user ) { throw new Error ( " User not found " ); } res . json ( user ); } catch ( error ) { next ( error ); } }; There's nothing wrong with this code. The problem is that every async controller ends up looking exactly the same. Every file contains: try, catch and next(error) over and over again. Besides being repetitive, it's also easy to forget. Miss one try-catch block, and Express won't automatically catch errors thrown inside async functions. What Is an Async Handler? An async handler is a small wrapper function that automatically catches errors from async controllers. Instead of every controller handling its own errors, the wrapper does it for you. A Simple Analogy Imagine an office where every employee has to stop working whenever someone rings the front door. Besides doing their own job, they also have to greet every visitor. This quickly becomes repetitive and inefficient. Instead, the company hires a receptionist to handle every visitor. Now the employees can focus on their actual work while the receptionist takes care of the door. An async handler works the same way. Controllers focus on handling requests, while the async handler catches errors and passes them to Express's error handler. Without an Async Handler export const createUser = async ( req , res , next ) => { try { const user
开发者
Beyond Sonic Pi: Tau5 & the Art of Coding • Sam Aaron
submitted by /u/goto-con [link] [留言]
AI 资讯
A Dash of dev.to: My Blog Stats Now Live in the Terminal
Hello, I'm Maneshwar. I'm building git-lrc, a Micro AI code reviewer that runs on every commit. It is...
开发者
Python Is So Slow. Can Julia Solve the Two-Language Problem?
submitted by /u/araujoms [link] [留言]
AI 资讯
The (no longer) missing multi-agent pattern: triggering dynamic workflows from an agent
When building multi-agent systems, rigid state graphs quickly fall apart in the face of dynamic user inputs. Imagine building a smart assistant: a user hands you a checklist of three household chores today, but tomorrow it might be a list of ten software debugging tasks. Because the number of tasks, their sequence, and their execution details are entirely runtime-dependent, you cannot hardcode this path at design time. Forcing dynamic lists of work into a static graph-based workflow can lead to fragile, over-engineered code. You need a workflow that adapts dynamically at runtime. The Google Agent Development Kit (ADK) provides a flexible programming model to define dynamic workflows . With the release of ADK 2.4.0 , triggering these workflows has become even more seamless: you can register a Workflow directly in an agent's tools list, allowing the coordinator agent to execute it automatically as a first-class tool. In this article, you learn how to configure and trigger a dynamic workflow directly from a coordinator agent. This guide uses a task list coordination example, but you can adjust this pattern to other dynamic orchestration needs. The architecture of a dynamic workflow Static workflows define the execution path at design time. Dynamic workflows, however, allow agents to invoke tools, spawn other nodes, and schedule sub-agents conditionally at runtime. The system consists of three main components: Root agent ( root_agent ) : Gathers the list of tasks from the user, requests final approval, and directly calls the tasks_workflow tool. The workflow ( tasks_workflow ) : A Workflow that iterates over the approved tasks. Sub-agent ( task_explainer ) : An Agent tasked with generating a step-by-step execution plan for each task. Here is the architectural diagram of the solution: Technical implementation Let's break down how to implement this solution using the Google ADK library in Python. The complete code resides in the devrel-demos repository with core logic in
开发者
two case studies of NaN
submitted by /u/Dear-Economics-315 [link] [留言]
开发者
Writing a bindless GPU abstraction layer
submitted by /u/Dear-Economics-315 [link] [留言]