AI 资讯
I Moved My Next.js Dashboard Logic Into Postgres. My Frontend Got Boring (And That's the Point).
My dashboard had a useMemo doing arithmetic it had no business doing. It was a Pokémon TCG Pocket collection tracker, but that part doesn't matter. What matters is that the home page needed to show three things: overall completion, completion per set, and which set you were closest to finishing. The way I'd built it, the browser was fetching every card and every owned record, then grinding through the math on each render to figure all of that out. It worked. It also got slower and harder to read every time the data grew or I added a metric. So I moved the aggregation out of React and into Postgres, and the surprising result was that my frontend got boring . Fewer hooks, less state, almost nothing left to break. That's the whole argument of this post: aggregation belongs in the database, and when you put it there, the React code that's left over is the kind of boring you actually want in the layer your users touch. What "fetching everything into React" actually looks like Here's the shape of the original dashboard. Load all the cards, load the user's owned rows, then derive everything on the client. const [ cards , setCards ] = useState < Card [] > ([]); const [ owned , setOwned ] = useState < OwnedCard [] > ([]); useEffect (() => { ( async () => { const { data : allCards } = await supabase . from ( " cards " ). select ( " * " ); const { data : ownedRows } = await supabase . from ( " user_cards " ) . select ( " card_id " ); setCards ( allCards ?? []); setOwned ( ownedRows ?? []); })(); }, []); const ownedIds = useMemo (() => new Set ( owned . map (( o ) => o . card_id )), [ owned ]); const perSet = useMemo (() => { const groups : Record < string , { total : number ; have : number } > = {}; for ( const card of cards ) { const g = ( groups [ card . set_id ] ??= { total : 0 , have : 0 }); g . total += 1 ; if ( ownedIds . has ( card . id )) g . have += 1 ; } return groups ; }, [ cards , ownedIds ]); const overall = useMemo (() => { const total = cards . length ; const ha
工具
Back online after a summer cold knocked me out for a bit. Excited to catch up on everyone’s posts and share some progress on my networking tools!
AI 资讯
Bitcoin Isn’t Just Money It’s One of the Most Interesting Systems Engineers Can Study
When most people hear Bitcoin , the conversation usually starts with price. But for developers, Bitcoin is much more than a chart. Bitcoin is a distributed system operating without a central authority. It combines networking, cryptography, game theory, economics, and software engineering into a protocol that has remained operational for years while processing value globally. As a software developer, what fascinates me most is not speculation it’s the architecture. Some concepts every developer can appreciate: ⚡ Distributed Consensus Thousands of nodes independently verify the same rules without trusting each other. 🔐 Cryptography in Practice Digital signatures make ownership verifiable without revealing private keys. ⛏️ Proof of Work A mechanism that converts computation into security and coordination. 🌍 Open Source at Global Scale Anyone can inspect the code, run a node, contribute, or build on top of the ecosystem. 📦 Immutability Through Design Data integrity is achieved through incentives, validation rules, and chained blocks. Studying Bitcoin changes how you think about: System reliability Security models Network design Incentive structures Building software that survives failure Whether you plan to build in blockchain or not, Bitcoin is worth studying because it teaches principles that extend far beyond finance. Curious to hear from other developers: What concept in Bitcoin architecture changed the way you think about software systems?
AI 资讯
01: What Is a Keyboard Simulator? A Complete Introduction to Interactive Keyboard Visualization
If you've ever wondered how to visualize, teach, or explore keyboards without owning physical hardware, a keyboard simulator is the answer. In this in-depth guide, we explore what keyboard simulators are, how they work, and why they are changing the way people learn to type. Defining a Keyboard Simulator A keyboard simulator is a software application that digitally recreates the visual, functional, and interactive behavior of a physical keyboard. Unlike a simple on-screen keyboard that merely serves as a typing aid, a true keyboard simulator renders the keyboard in detail — often in three dimensions — and responds to keystrokes in real time, creating an immersive and educational experience. The best keyboard simulators go far beyond static images. They animate individual key presses, replicate the visual design of specific keyboard models, support multiple layouts (QWERTY, Dvorak, AZERTY), and even show animated hands performing the typing — making them extraordinarily useful for remote teaching, accessibility testing, content creation, and learning to type. 💡 Did you know? The Keyboard Simulator by Roboticela is one of the most advanced free and open-source keyboard simulators available today, featuring 3D interactive rendering powered by React Three Fiber, five authentic laptop keyboard models, and eight beautiful visual themes. The Core Components of a Keyboard Simulator A fully-featured keyboard simulator typically includes several key components that work together to create a complete experience: 🎮 3D Rendering Engine: Displays the keyboard model from any angle with smooth rotations and zoom capabilities. ⌨️ Real-Time Key Feedback: Every keystroke on your physical keyboard mirrors instantly on the 3D model. 🖐️ Hand Animation: Animated hands show proper finger placement and movement as you type. 📝 Document Editor: A built-in text editor captures your input and links it to the keyboard visualization. 🎨 Theme System: Multiple visual themes make the experience beau
科技前沿
New York Is About to Feel Hotter Than Phoenix
Extreme heat coupled with humidity will make it feel like 109 degrees Fahrenheit as the holiday weekend approaches.
开发者
We moved our Bluesky data to Eurosky
产品设计
How to use Ninja with the BUSY build system
submitted by /u/suhcoR [link] [留言]
AI 资讯
X now offers an MCP server to make its platform easier for AI tools to use
X has launched a hosted MCP server, making it easier for developers to connect AI applications with the company’s API.
开发者
Supreme Court rejects Trump bid to restrict birthright citizenship
开发者
Scientists reverse autism-like symptoms in mice
创业投融资
Arcturus could halve the grid’s electrical losses using its nano-infused copper
Stealthy startup Arcturus uses lasers to infuse carbon nanomaterials into copper, dramatically improving its ability to conduct electricity.
AI 资讯
Podcasting platform Riverside enters the newsletter publishing game
Users will be able use AI to create newsletters based on their recordings.
AI 资讯
Amazon launches new $1 billion FDE org, following OpenAI and Anthropic
Engineers on the new team will embed within companies to deploy purpose-built agents, focusing on fast deployments and customer self-sufficiency.
AI 资讯
Show HN: OM Core – multidimensional models without spreadsheet cell formulas
AI 资讯
Show HN: Curvytron 2, I rewrote my browser party game, 10 years later
Hi everyone, french web dev here, About 10 years ago I did a little party game in the browser inspired by Achtung die Kurve genre, it reached HN ( https://news.ycombinator.com/item?id=9494619 ) and everything went crazy, it's still largely played in open-spaces all over the world today. This past year, I've been working on a sequel: https://curvytron2.com is live. Same goal as the first one: challenge myself, perfect my skills, have fun and give back to the internet community the best way I know
开发者
Supreme Court upholds broad conception of birthright citizenship
AI 资讯
Buzzy
Your creative AI co-director Discussion | Link
AI 资讯
Presentation: Trustworthy Productivity: Securing AI-Accelerated Development
Sriram Madapusi Vasudevan discusses industry-converging patterns for securing autonomous AI agents in production. He explains the critical vulnerabilities hidden inside the ReAct loop across context, reasoning, and tool execution. He shares how to mitigate risks like memory poisoning and rogue tool execution using defense-in-depth strategies, LLM-as-a-judge critics, and MAESTRO threat modeling. By Sriram Madapusi Vasudevan
开发者
Changes to Our Contribution Policies
开发者
Switching a million lines of code from Java threads to Kotlin coroutines, by rewriting three files
I wrote a technical deep dive about how we migrated one of Denmark's most used Android apps with one million lines of code powered by Java threads, into Kotlin coroutines just by rewriting three files in our internal threading library Check it out if you are interested in how coroutines use threads, and interop between them :) submitted by /u/adrianblancode [link] [留言]