AI 资讯
🟩 Team Matrix or ⬜ Team Paper? | Alan Babychan
🚀 Shipping a major update to my portfolio After weeks of designing, developing, and refining, I'm excited to share the latest version of my personal portfolio. Rather than building another static portfolio, I wanted to treat it like a real product—focusing on performance, interaction design, accessibility, analytics, and user experience. 🌐 Live: https://www.alanbabychan.online What I built 🟩 Matrix Theme A cyberpunk-inspired dark mode featuring animated binary effects, glowing UI elements, and an immersive developer experience. ⬜ Paper Theme A clean, modern light mode designed with readability, visual hierarchy, and clarity in mind. 🎵 Interactive Audio System •Background music •UI sound effects •Dedicated settings panel •Adjustable volume controls •Built using the Web Audio API 🖱️ Interactive Cursor A custom mouse-follow glow and subtle cursor interactions that enhance the browsing experience without becoming distracting. ✨ Micro-interactions Hover states, smooth page transitions, animated UI components, and responsive visual feedback to make every interaction feel intentional. 📖 UX & Accessibility Built around clear typography, intuitive navigation, responsive layouts, and accessibility-focused design to provide a consistent experience across devices. 📊 Performance & Analytics Built with Next.js and optimized for speed, SEO, and scalability. Implemented a complete Google Analytics 4 setup including: •SPA page tracking •Google Consent Mode v2 •Custom event tracking •User interaction analytics Tech Stack: Next.js • React • Tailwind CSS • Framer Motion • Web Audio API • Google Analytics 4 • Microsoft Clarity Coming Soon... 👀 I'm currently building a personal AI assistant that will allow visitors to interact with my portfolio, ask questions about my projects, experience, and skills, and explore everything conversationally. What I learned This project pushed me to dive deeper into: •Theme architecture •Frontend performance optimization •Animation systems •Custom UI inte
AI 资讯
NPM vs Yarn vs pnpm vs Bun Which Package Manager Is Best for Modern Web Development?
As developers, we use package managers almost every day. Whether we are working with Node.js, React, Next.js, TypeScript, Express, Prisma, or other technologies in the JavaScript ecosystem, choosing the right package manager can have a meaningful impact on our development workflow. Recently, I spent some time comparing the most popular package managers: npm, Yarn, pnpm, and Bun. After looking at them from the perspective of performance, dependency management, disk efficiency, ecosystem compatibility, and developer productivity, my current preference is pnpm. Why pnpm? For me, pnpm provides one of the best overall balances between speed, disk efficiency, reliability, dependency management, and developer experience. One of the key differences is how pnpm handles dependencies. It uses a content-addressable store and links packages into projects instead of unnecessarily keeping separate copies of the same packages for every project. This can reduce disk usage and make package installation more efficient, especially when working on multiple JavaScript or TypeScript projects. Another advantage is pnpm's stricter dependency management. It encourages projects to explicitly declare the packages they actually depend on, which can help prevent accidental reliance on transitive dependencies. This becomes particularly useful when working on larger applications, monorepos, or team-based projects. What about Bun? Bun is extremely interesting because it is much more than a package manager. It provides a JavaScript/TypeScript runtime, package manager, test runner, and bundler. Its performance is impressive, especially when it comes to package installation and certain development workflows. However, I don't think raw speed should be the only factor when choosing a technology for production. Compatibility, ecosystem maturity, team familiarity, tooling support, and long-term maintainability are equally important. That is why I see Bun as an excellent and promising tool, but I would not
AI 资讯
The Kernel Trick Is the Oldest Move in Engineering
Classic Machine Learning Through the Eyes of an SRE — Part 4 When a computation is too hard, don't compute harder. Change coordinates until it becomes easy. Every engineer has made this move. Pick the right data structure and the impossible query goes O(1). Re-index the table and the report that took an hour takes a second. Move the problem into a space where it's trivial, solve it there, come back. That's the kernel trick. SVM's famous move isn't building a curvy model — it's finding a FLAT cut in a transformed space, which corresponds to a curved boundary back in your original features. The separator stays linear in the transformed space. The space did the work. And here's the part that makes it a trick rather than just a projection: the data never actually goes up there. The optimization only ever needs inner products between pairs of points, and a kernel function computes what that inner product would be in the high-dimensional space, directly from the original coordinates. You get the geometry of a space you never built. Some kernels correspond to infinitely many dimensions, which would otherwise be an awkward amount of memory to allocate. The bet it makes SVM bets that the most ROBUST boundary is the one with the widest margin — maximum distance from the nearest points on each side. And here's the part that rewired me: only those nearest points matter. They're the support vectors. The non-support-vector points don't directly determine the final boundary at all. Compare that to the forest, which averages over EVERYTHING. SVM is the opposite extreme: the borderline cases that become support vectors define the decision boundary. In delivery-risk terms — the projects that teach you where the line is aren't the disasters or the easy wins. They're the borderline ones that barely breached and barely survived. SVM formalizes that. Everything old returns After trees and forests threw away gradient descent, SVM brings some of the regression toolkit back: an explicit los
AI 资讯
What you save when project context stops repeating
Qarinah compiles a compact, cited project-memory pack instead of asking every new coding-agent session to replay the entire available history. The published estimate Across six committed software-task fixtures, the full-history baseline contained 442,113 portable estimated input-context tokens . The Qarinah path used 5,682 . Every required target was still directly covered in the top five results. That is: 436,431 fewer estimated input-context tokens; 98.71% less repeated context; and a 77.81:1 baseline-to-pack ratio. The ratio is not a claim that every provider bill drops by 98.71%, or that an agent session lasts 77.81 times longer. It measures the compared input-context volume in the published six-fixture estimate. What the same token rate would cost The table applies four flat, uncached input-token rates to the same two token estimates. It is arithmetic, not a provider invoice. Flat uncached input rate Full-history baseline Qarinah pack Estimated saving $1 / million tokens $0.442113 $0.005682 $0.436431 $3 / million tokens $1.326339 $0.017046 $1.309293 $5 / million tokens $2.210565 $0.028410 $2.182155 $15 / million tokens $6.631695 $0.085230 $6.546465 The calculation is: estimated tokens / 1,000,000 x flat input rate It deliberately excludes provider-native tokenization, caching, output tokens, reasoning tokens, tool calls, retrieval, hosting, and fixed fees. Real cost depends on the provider, model, cache behavior, context composition, and how often the same history would otherwise be resent. Why the pack remains useful Compression only matters if the next task can still find its evidence. The benchmark checks both volume and retrieval coverage: every required target had to be directly present in the top five. Qarinah preserves the source event ID and content hash for selected context, so a later agent receives a bounded handoff that can be inspected instead of an opaque story. Qarinah also passed 380 of 380 deterministic file-specific exact and typo-tolerant que
开发者
React DataGrid: A Free, Open-Source React Data Grid with an Enterprise Edition (An AG Grid Alternative)
If you've ever needed to build a serious data table in React, you've probably run into this problem....
AI 资讯
The Real Cost Structure of an AI Agent
Almost every cost discussion about AI agents opens with a model price per million tokens, which is the one number that tells you the least. The bill you actually receive is a stack of four things: API calls, infrastructure, the one time build, and the recurring costs nobody put in the estimate. Here is how the stack usually breaks down and which layer is worth attacking first. Where The Money Actually Goes For a typical business agent, a support bot or an internal automation running on a managed platform, monthly operating cost lands between 200 and 1,000 dollars. API calls are 40 to 60 percent of that. Hosting, a vector database for memory, and monitoring share the rest. The spread on either side is wide: a solo developer on open source models and a small VPS can stay under 50 dollars a month, while an enterprise running multi agent systems on frontier models regularly spends 5,000 to 13,000 a month before anyone counts the build. Infrastructure has its own shape. Serverless is the cheapest entry, and a moderate agent handling 10,000 to 20,000 interactions a month usually runs 50 to 200 dollars in compute with no idle charge. Containers on ECS, Cloud Run or Kubernetes cost 100 to 500 and buy persistent connections and steady latency. Self hosted GPU starts around 200 a month for a T4 class instance and passes 1,000 for A100 or H100 class, which only pays off at volumes high enough to amortize it. Vector storage adds 20 to 500, and pgvector on a Postgres you already run removes that line entirely. Model Choice Is A Routing Decision The price spread between tiers is large enough that treating model selection as one global choice is the expensive mistake. Frontier reasoning models sit at the top of the range, mid tier models cost a fraction of that, and the lightweight tier is cheaper again by roughly an order of magnitude. An agent that sends every step to the top tier is paying reasoning prices for string formatting. The fix is routing per step rather than per agent
AI 资讯
Secure Boot's October 2026 Deadline: Two Years' Notice Wasn't Enough
The deadline nobody missed Every expiry story we've written here has the same shape. A certificate lapses, nobody was watching, something breaks, and everyone is surprised. A Splunk license at a federal agency. Microsoft's own network connectivity tool. Same plot, different logo. This one is the opposite, and that's what makes it worth reading. On October 19, 2026, roughly ten weeks from this writing, the Microsoft Windows Production PCA 2011 certificate expires. It sits under the trust chain for the Windows boot process on essentially every PC shipped in the last fifteen years. Nobody forgot it. The expiry date has been printed inside the certificate since 2011. Microsoft has been publishing guidance for over two years, shipping replacement certificates through Windows Update since 2024, running OEM briefings, and pushing an automatic rollout that requires most users to do nothing at all. It is August. It still isn't done. What's actually expiring Three certificates, four replacements, three dates, all in 2026: Certificate Expires Replaced by Microsoft Corporation KEK CA 2011 June 24, 2026 Microsoft Corporation KEK 2K CA 2023 Microsoft Corporation UEFI CA 2011 June 27, 2026 Microsoft UEFI CA 2023 Microsoft Corporation UEFI CA 2011 June 27, 2026 Microsoft Option ROM UEFI CA 2023 Microsoft Windows Production PCA 2011 October 19, 2026 Windows UEFI CA 2023 Both June dates have already passed. October is the one that matters most, because that's the certificate used to sign the Windows Boot Manager itself. Devices that don't pick up the 2023 certificates keep booting and keep taking normal Windows updates. What they lose is the ability to receive new protections for the early boot path: updates to Boot Manager, Secure Boot database changes, revocation lists, and mitigations for bootkit vulnerabilities discovered from here on. In other words, the machine doesn't fail. It just quietly stops being patchable in the one layer that sits below your antivirus, your EDR agent, a
AI 资讯
I spent twenty hours testing hypotheses about a publishing failure. The platform had written the reason on screen
Yesterday I tried to publish an article on a writing platform I use. The click did nothing. Not an error, not a refusal: the dialog stayed open, the page changed to a url containing the word submission, and nothing appeared publicly. I tried again. Same. Then I stopped, because I have a rule against stacking attempts, and started diagnosing properly. What I did over the next twenty hours I checked whether the button was disabled. It was not: no disabled attribute, no aria-disabled, pointer events enabled, full opacity, not covered by another element. I checked whether my test for success was valid. I was verifying by loading the post's short url in a clean session and looking for a Not Found. It occurred to me that I had never confirmed that url form works for a published post, so I tested it against one that had published fine an hour earlier. It rendered in full. The test was sound. I checked the public profile. The post was not listed. Confirmed unpublished. I instrumented the network. Enabled the protocol domain, clicked, and watched: three requests, all returning two hundred. So the click was firing and the server was answering without error. That eliminated a dead button, a lost click and an overlay in one measurement, which felt like progress. I formed a hypothesis and wrote it down as a hypothesis: a daily publishing limit, three per calendar day, since two had gone out that day. I waited for midnight and tested it. It failed again. So the hypothesis was refuted, cleanly, and I recorded that. Where the answer was In the dialog. The whole time. After the failed attempt past midnight, I ran one more read of the page, this time asking for elements with an alert role rather than for the button state. One came back: The author of this story has published or scheduled the maximum of two stories in the past 24 hours. Please try to publish or schedule again in 24 hours. Two per rolling twenty four hours. Not three, and not per calendar day. My hypothesis was wrong o
AI 资讯
I Built 75+ Free Developer Tools — Here's What I Learned
Hey everyone! I'm jinyuan, an indie developer. I recently launched DevTools Box — a free online toolbox with 75+ developer tools. What's in the box? DevTools Box includes tools like: JSON Formatter — beautify and validate JSON Regex Tester — test regular expressions with live matching Base64 Encoder/Decoder — quick encoding and decoding QR Code Generator — generate QR codes instantly Hash Calculator — MD5, SHA-1, SHA-256 and more Color Picker — pick colors and convert between formats ...and 69 more tools! Why I built it I was tired of jumping between different websites for simple dev tasks. Each tool runs entirely in your browser — no login, no ads, no data sent to any server. Tech stack Next.js 14 with App Router TypeScript Tailwind CSS Static export to Cloudflare Pages Try it out Check it out at tdboxs.com . All tools are 100% free. Would love to hear your feedback! What tools would you add?
AI 资讯
Your terragrunt (or terraform) plan is 4,000 lines. Only two of them matter.
You know the ritual. terragrunt run --all -- plan Then you scroll. Past forty units of Refreshing state… . Past the ninth identical count instance. Past a tags_all.LastModified that changes on every single run because your CI stamps a timestamp into it. Somewhere in there are the two lines you actually needed to see — probably the # forces replacement on a database. You scroll back up. You lose it. You pipe it to a file and grep for must be replaced . You approve anyway, because it's 6pm. I got tired of that, so I wrote tgsieve . What it does It runs the plan for you, reads the structured output instead of the prose, throws away the noise you declared as noise, collapses everything that repeats, and prints what's left. DESTROY / REPLACE (1) envs/prod/a ± aws_db_instance.main engine_version "14.7" → "15.3" forces replacement UPDATE (5) 5 units envs/dev/a, envs/dev/b, envs/prod/a, +2 more ~ null_resource.pin triggers.region "eu-central-1" → "us-west-2" SUMMARY ±1 replace ~5 update severity: 1 high, 5 medium hid 214 attributes across 3 rules (--explain to see them) That's five units of a real terragrunt plan — the same run terraform prints as several hundred lines. The report nests three deep — where , then what , then which fields : UPDATE (5) envs/prod/c ← the unit, said once ~ aws_s3_bucket.this ← the resource tags_all.entity "tgb" → "tgc" ← the attributes that changed A change that's identical across units replaces the directory with the set it covers, so the first column always answers the same question: where . It doesn't scrape text This matters, because the obvious implementation is fragile garbage. You might reach for terragrunt run --all -- plan -json . It doesn't work: terragrunt forwards terraform's own NDJSON straight through, so lines from units running in parallel interleave with no way to tell them apart. So tgsieve asks terragrunt for machine-readable artifacts and reads those: What Flag it passes What it gets per-unit plans --json-out-dir one tfplan.j
AI 资讯
The Bug Wasn't in My Code --- It Was in My Assumptions 🤯
We've all been there. The code looks correct. No obvious syntax errors. The logic seems fine. You read the same function 10 times. And somehow... It still doesn't work. 😭 After wasting way too much time debugging situations like this, I realized something: Sometimes the bug isn't in your code. It's in what you assumed about your code. The classic debugging trap Imagine you're calling an API and expecting this: { "user" : { "name" : "Ash" } } So naturally, you write: const name = response . user . name ; Everything looks perfectly reasonable. But the actual response is: { "data" : { "user" : { "name" : "Ash" } } } Now you're staring at your JavaScript wondering: "Why is user undefined?!" The JavaScript isn't necessarily the problem. Your assumption about the API response was. This happens everywhere It's not just API responses. You can make incorrect assumptions about: What data a function receives Whether a value can be null What an API actually returns Environment variables being available File paths Database records Authentication state Time zones User input Production vs development environments What a third-party library actually does And these assumptions can create some seriously confusing bugs. My new debugging approach Instead of immediately changing the code, I try to verify my assumptions first. 1. What do I think is happening? Write down your assumption. For example: "The API is returning the user object." 2. What is actually happening? Inspect the data. console . log ( response ); Don't guess. Look at it. 3. Where does reality differ from my assumption? Maybe the API response changed. Maybe the value is undefined . Maybe the environment variable isn't loaded. Maybe the backend is returning an error that the frontend isn't handling. 4. Fix the actual problem Only after understanding the mismatch should you change the code. This saves a surprising amount of time. The debugging rule I now follow When something doesn't make sense, I ask: "What am I assuming
AI 资讯
Turn a DevOps API into Governed Agent Skills with NodeJS
It's 3 AM. A production service is misbehaving, you're on-call, and you'd love an agent that can pull the service's health and tee up a restart for you. The catch is obvious: an agent with raw access to a DevOps API is a liability. One bad call could scale you into a huge bill or delete an incident record you needed. So the real question isn't "can the agent reach the API." It's "which calls should it be allowed to make at all, and how should the dangerous ones be treated differently from the safe ones." That decision is what Skillgate handles, and it's the part we actually build and run in this post. Scope, up front This post is about the classification and curation layer: turning an OpenAPI spec into a governed set of skills. Skillgate decides which endpoints become tools, marks which are read-only, flags which writes should require approval, and denies the destructive ones outright. Wiring an approval flag to a live human-approval pause, and making that pause survive a crash, is the job of the Agent OS runtime, not Skillgate. We link to it at the end. The demo here does not implement that runtime, and this post does not pretend it does. The problem Skillgate solves Point an LLM at a DevOps API and you have three bad options: Expose nothing. The agent is useless. Expose everything. Now the model can call DELETE and scale on a whim. Hand-whitelist every route. It works until the API changes, then it rots. Skillgate replaces all three with opt-in curation plus automatic risk classification. You choose a small surface, and every endpoint on it gets a class based on its method and shape. From REST endpoint to agent skill Skillgate's input is an ordinary REST API described by an OpenAPI spec. Nothing about the API is agent-aware. It's the same deploy, scaling, and incident routes your platform already exposes. Each endpoint is described in the standard OpenAPI shape: a method, a path, some parameters, a description, and tags. A representative operation from the DevOps
AI 资讯
The bug report that never left the browser
This is a submission for DEV's Summer Bug Smash: Clear the Lineup powered by Sentry . There's a shape of bug I've learned to distrust: the one where the safety net is bolted to the thing it's supposed to catch. I was reading Element Web's reporting code looking for something worth fixing when I hit a function that builds the whole Sentry payload as a single object literal — with two await calls sitting inside it. One of them asks the crypto layer for diagnostics. Optional diagnostics. Nice-to-have detail on a report that is already complete without them. I stopped there, because I could already see how that sentence ends. If the optional thing rejects, the object never exists. If the object never exists, there is no capture call. And the same pattern was waiting one directory over, in the rageshake path. The subsystem being diagnosed could prevent the diagnostic report from leaving the browser. Somebody decides to tell you what broke, and the broken part gets a veto. One deliberate press of a button, both explicit channels gone: the rageshake bundle and the manual Sentry event. I measured it at the boundary that actually counts — a real Sentry Browser SDK with a local, network-free transport. Under the same synthetic failure: zero serialized events before the fix, exactly one after. Same synthetic crypto rejection Before After collectBugReport(): rejected report completed with available diagnostics Sentry envelopes: 0 Sentry events: 1 unrelated context families: retained auxiliary error message or stack: absent Project Overview Element Web is the web client behind Element, a Matrix-based communication app. Its bug-report dialog can send two independent things: a rageshake bundle — logs and diagnostics packed into multipart form data and posted to a configured endpoint — and, when Sentry is configured, a single manually captured Sentry event. Both are explicit. Nothing leaves the browser unless a person opens that dialog and submits it. That framing shaped every deci
AI 资讯
Stop Waiting 10 Minutes to Fail: How CDK Comprehensive Validation Catches Misconfigurations Before Deploy
The 10-Minute Tax For many years, as a CDK developer, I'd run cdk synth , then cdk deploy , and then cross my fingers — either it deployed cleanly, or it failed somewhere in the middle of a CloudFormation run that had already been going for ten minutes: ❌ MyStack failed: UPDATE_ROLLBACK_COMPLETE Resource handler returned message: "The runtime parameter of nodejs16.x is no longer supported" (HandlerErrorCode: InvalidRequest) Ten minutes. For something CDK could have told you before it ever talked to CloudFormation. These days I let AI agents write a good chunk of my CDK code, which made this even worse — an agent can't iterate when every failed attempt costs it ten minutes. 🤖 AI Agent development loop: Attempt 1: cdk deploy → ⏱️ 10 min → ❌ deprecated runtime Attempt 2: cdk deploy → ⏱️ 10 min → ❌ invalid memory size Attempt 3: cdk deploy → ⏱️ 10 min → ❌ security group rule conflict Attempt 4: cdk deploy → ⏱️ 10 min → ✅ finally works Total time wasted: 30 minutes on things that were knowable at synth time. And if you're deploying something heavy like an Amazon EKS cluster, the penalty stretches to 25-30 minutes per failed attempt. What if the CDK could catch all of those on cdk synth — in seconds? The CDK Lifecycle: Where Validation Fits Before I show off the new validation, it helps to see where it plugs into the lifecycle every cdk deploy goes through: Stage What Happens Executed By 1. Construction Execute main.ts , call new Stack() , build the construct tree in memory CDK App (local) 2. Synth app.synth() traverses the tree, produces CloudFormation template to cdk.out/ CDK App (local) 3. Template Validation 🆕 Post-synth offline validation — default rule set + registered policy plugins CDK App (aws-cdk-lib, local) 4. Create Change Set 🆕 CloudFormation pre-deployment validation — 6 types of online checks against real account state CloudFormation (AWS) 5. Execute Change Set CloudFormation provisions/updates/deletes actual AWS resources CloudFormation (AWS) The gap was a
AI 资讯
Stop context-switching to manage your distributed SQL infra
I remember the old days of manual scaling. You'd jump into a CLI, check your metrics, realize you needed another node or a capacity adjustment, log into a web console, navigate three layers deep into some proprietary dashboard, and hope you didn't click the wrong thing while trying to find a specific cluster ID. Now we have AI agents. But most people are using them wrong. They treat Claude or Cursor as just better search engines for code, rather than giving them hands. If you're running high-availability workloads on something like TiDB Cloud, the friction isn't in writing the SQL—you already know how to do that. The friction is in the operational visibility: knowing exactly what’s happening across your serverless instances versus your dedicated clusters without leaving your IDE. The Gap Between Code and Infrastructure The reason I spend so much time building things like MCPFusion is precisely because of this disconnect. An LLM might help you write a complex join perfectly, but if it doesn't know whether the target TiDB X instance is actually healthy or which project ID handles your staging environment, it's basically flying blind. You end up copy-pasting JSON blobs from your terminal into the chat window just to give the model context. That's slow, prone to error, and frankly, beneath what modern tooling should look like. This is why we released the TiDB Cloud (Serverless Distributed SQL) MCP server on Vinkius. It closes that loop. What This Actually Does (And Doesn't) Let's be very clear about what this tool allows you to do through an agent like Claude or Cursor. We aren't looking for "magic" here; we want predictable utility. The current implementation focuses on discovery and inspection. In DevOps terms, it provides a controlled read-only view of your topology. Here is what's available: Organization Discovery: You can call list_projects to see everything sitting under your umbrella and pull metadata via get_project . This solves the "what was that project ID ag
AI 资讯
Ayo GitHub Quietly Killed the Unreviewable Mega-PR
If you've ever opened a PR with 47 changed files and a diff so long GitHub just gives up and shows you "Load Diff" seventeen times, this one's for you. GitHub quietly shipped what might be the biggest pull request update in years, and it's aimed squarely at that problem. Let's talk about stacked pull requests. The problem, in one sentence Big PRs are where good reviews go to die. Nobody reads a 2000 line diff carefully. Some folks reach for AI code review tools like LiveReview to take the edge off, and honestly that helps, but even the best reviewer (human or model) does a better job on a tight, focused diff than on a 2000 line wall. Smaller inputs, better reviews. That's true no matter who's doing the reviewing. Stacked PRs are GitHub's answer: break one massive change into a chain of small, dependent PRs, where each one only reviews the diff it actually introduces, not everything below it. What a stack actually is The rule is simple. You need two or more PRs in the same repo where: The bottom PR targets your trunk branch (usually main ) Every PR after that targets the PR below it, not main That's it. That's the whole trick. Foundational stuff (schemas, shared types) goes at the bottom. Stuff that depends on it (API routes, UI) goes higher up the chain. And here's the part that surprised me: if you just do this manually with plain git, by opening PR #11 against the branch for PR #10 instead of against main , GitHub now recognizes that as a stack automatically. No special tool required. It just notices the base branches form a chain and lights up a banner. Stacking isn't a git concept at all, it's purely a GitHub UI concept layered on top of branches you were already making. Let's actually build one Enough theory. I built a real stack in one of my own repos ( peektea , a terminal file browser I maintain), using a harmless scratch file so nothing real got touched. Here's the actual terminal session, copy pasted, warts and all. First I tried to be fancy and use the CL
AI 资讯
Index as Key Is Not a Knowledge Problem. Your AI Already Knows the Rule. It Just Does Not Always Follow It.
Ask any AI coding assistant directly whether using array index as a React key is a good idea, and it will tell you no. It will explain why. Reordering, insertion, and deletion of list items can cause React to misidentify which DOM node corresponds to which data, leading to state bugs and unnecessary re-renders. This is not obscure knowledge. It is one of the most commonly repeated pieces of React advice that exists, and every model has clearly seen it thousands of times during training. And yet, if you look through a codebase where the AI generated a meaningful portion of the list rendering, you will very likely find at least one instance of exactly this pattern. A map over an array, using the index as the key prop, sitting quietly in a component that otherwise looks perfectly reasonable. This is a strange thing to observe once you notice it. The AI is not confused about the rule. Ask it directly and it recites the correct answer immediately and confidently. But somewhere between knowing the rule in the abstract and applying it consistently during generation, something gets lost. Why knowing a rule and applying it are different things There is a meaningful difference between an AI model having encountered information during training and that information reliably surfacing during every relevant generation task. When you ask directly whether index as key is a good idea, you are prompting the model to retrieve and state a fact it has strong, well reinforced associations with. This is a different cognitive task than generating a list rendering component from scratch while simultaneously handling several other decisions about structure, naming, data shape, and styling. During active generation, the model is not running through a checklist of best practices for every line it writes. It is producing output token by token based on patterns, and in the moment of writing a map function, the path of least resistance is often exactly the pattern that gets flagged as wrong when
AI 资讯
Adding a “Control de Obra” Module to Ventas Desarrollos (NestJS + Next.js)
Adding a “Control de Obra” Module to Ventas → Desarrollos (NestJS + Next.js) TL;DR: I built a brand‑new Construction feature (Control de Obra) inside the Ventas → Desarrollos flow, wiring a NestJS controller, a migration for branding_settings , and a Next.js page. While doing that I also fixed the setToken bug that stopped the BrokerDashboard from refreshing its session. The result is a clean, testable API endpoint and a functional UI component that talks to it. The Problem Our product needed a way for sales teams to track the construction status of each development (obra). The UI already had a “Desarrollos” list, but the backend had no endpoint to create, read, update, or delete construction records. At the same time the BrokerDashboard ( apps/web/src/app/portal-broker/page.tsx ) was failing to refresh the user session after a token rotation. The console showed: Error: setToken is not a function at Object.<anonymous> (src/portal-broker/page.tsx:78:15) Both issues were blockers: No API → the UI could only display static data. Stale token handling → users were logged out unexpectedly after a token refresh. What I Tried First I first tried to reuse the existing VentasPropertiesController ( apps/api/src/ventas/ventas-properties.controller.ts ). The controller was already imported in AppModule , but it was dead code (the class had no routes) and its methods lacked the AuthGuard we use across the API. I added a couple of ad‑hoc routes inside that controller, but: The routes conflicted with the existing /ventas namespace. The controller’s @UseGuards(AuthGuard) was missing, causing 401 errors in the browser. The migration for branding_settings was still out of sync, leading to a “column does not exist” error when the new endpoint tried to read branding data. After a few hours of chasing 404s and 401s, I decided the cleanest path was to create a dedicated module for construction and keep migrations in sync. The Implementation 1. Register the new controller in AppModule // a
AI 资讯
Architectural Foundation: The Host-Guest Split
A compiled application cannot hot-reload itself if its main loop, window context, and memory allocations live inside the binary being recompiled. The application must be split into two layers:Host Shell (Stable Execution Root):Statically compiled once.Manages the OS window, render loop, event polling, network sockets, and high-level heap allocations.Exposes a dynamic symbol loader (dlopen / LoadLibrary or a dynamic WebAssembly runtime execution context).Guest Module (Hot-Swappable Logic):Compiled as a shared dynamic library (.so, .dylib, .dll) or an isolated WebAssembly (.wasm) module.Contains frame updates, business rules, rendering instructions, and component tree logic.Exports explicit interface hooks (init, update, render, pre_reload, post_reload).The Hot-Reload PipelineWhen a developer edits source code in a compiled language (e.g., modifying a Rust UI render function or a C# algorithm), the dev server orchestrates a zero-downtime swap through this explicit pipeline:1.File Watcher & Fast Incremental Compile:Sub-second artifact generation.The watcher detects source changes and invokes an incremental compilation pass using dynamic linking configurations (e.g., -rdynamic, dynamic C-runtime links, or fast lld/mold linkers) to output a versioned binary artifact (logic_v2.so).2.Live Manifest Update:Atomic state & symbol mapping emit.The dev server emits an updated JSON manifest containing module hash, exposed symbol tables, binary payload locations, and updated asset hashes over a WebSocket/IPC stream to the Host Shell.3.State Snapshot & Freeze:Preserving user context.The Host Shell signals pre_reload() to the currently loaded logic_v1.so. The guest logic serializes volatile runtime state into a host-managed memory buffer or leaves pointers active inside a host arena.4.Dynamic Unload & Library Swap:Operating system symbol rotation.The Host Shell unloads logic_v1.so (releasing file locks via temporary copy paths on OS platforms like Windows), loads logic_v2.so, and re
AI 资讯
Generating daily horoscopes and zodiac videos with an automated AI pipeline
Astrology content has a brutal property: it has to be fresh every single day , for every sign, ideally in a few languages, forever. Writing that by hand doesn't scale. For AstroZodify I built a pipeline that generates daily horoscopes and short zodiac videos on a schedule, with humans reviewing rather than writing. Here's the shape of it. The content problem Per day you need: 12 signs x N content types (daily horoscope, love, career) x M languages. That's hundreds of pieces of copy a day that all have to feel written, not templated, and stay consistent with each sign's "voice". Templating alone reads robotic. Free-form generation drifts. The trick is constraining an LLM enough to stay on-brand while still sounding human. The generation pipeline Structured prompts per sign. Each sign has a persona and constraints (tone, themes, length). The model fills the daily specifics, not the whole thing from scratch. Scheduled batch runs. A cron job kicks off generation ahead of time so content is ready before it's needed, never on the critical path of a page request. Validation. Output is checked for length, banned phrasing, and structure before it's allowed near the site. Store, then serve. Everything lands in Postgres. Pages are SSR and just read pre-generated rows, so the LLM is never in the user's request path. Keeping generation offline from serving is the single most important decision - it keeps pages fast and costs predictable. Adding video Text was step one. Short vertical zodiac videos (for social) are step two, and that's a heavier pipeline: script -> imagery -> voiceover -> render. That part runs on Cloud Run as a separate job so a slow render never touches the web app, and we pilot one item before any batch. Cost and safety rails Anything that calls a paid API in a loop is a footgun. The rules I follow: Always pilot on 1-10 items before a full batch. Never an unbounded loop against a paid API. Cache and pre-generate so serving is basically free. Takeaways Separate