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

今日精选

HOT

最新资讯

共 32289 篇
第 1189/1615 页
AI 资讯 Dev.to

Modeling Money in PHP: Your Own Value Object vs brick/money Behind a Port

Book: Decoupled PHP — Clean and Hexagonal Architecture for Applications That Outlive the Framework Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub Open a PHP REPL and type 0.1 + 0.2 . You get 0.30000000000000004 . Now imagine that drift sitting in a total column on an invoice. The bug report does not say "IEEE 754 rounding." It says "the customer was charged one cent too much and finance wants to know why." Money is not a number. It is an amount paired with a currency, and it follows rules a float does not know about. You cannot add 10 USD to 10 EUR. You cannot store 19.99 in a binary fraction and expect it back. You cannot round a third of a cent without deciding how to round it, and that decision belongs to your business, not to your storage engine. This post builds a small Money value object that gets the currency safety right, then shows when to stop hand-rolling and wrap brick/money behind a domain port instead. The point of the port is the same point as every port: the rounding rules live in your domain, and the library stays swappable. Why a float is the wrong type Three separate problems hide inside float $amount . The first is representation. A float is a binary fraction. Decimal amounts like 0.10 have no exact binary form, so they round on every store and load. Sum a few thousand line items and the error compounds into real cents. The second is the missing currency. A bare number cannot tell you whether 1000 means ten dollars or one thousand yen. Two amounts in different currencies are not comparable, but the type system lets you add them anyway. The third is the rounding rule. When you split 10.00 across three line items, you get 3.333... per item. Someone has to decide who absorbs the leftover cent. A float makes that decision silently and inconsistently. The fix

Gabriel Anhaia 2026-06-14 05:39 12 原文
AI 资讯 Dev.to

Hand-Rolled Mappers vs AutoMapper: Keeping the PHP Domain Pure at the Boundary

Book: Decoupled PHP — Clean and Hexagonal Architecture for Applications That Outlive the Framework Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub You add a column to a table. discount_cents , nullable, default zero. A small migration, a five-minute ticket. The next morning a teammate pings you: orders placed overnight have a discount of null where the domain expected zero, and the total calculation now throws a TypeError deep inside a value object. You trace it back. A reflection-based mapper copied the new column straight onto a property the domain class did not declare, then the next read pulled it back as null and handed it to Money . Nobody wrote the line that connected discount_cents to the domain. The mapper guessed, and the guess leaked the table's shape into a class that was supposed to know nothing about tables. This is the case against automatic mapping at the persistence boundary. A hand-rolled mapper is more typing. It is also the seam that stops the database schema from reaching into your domain. What the boundary is for In a hexagonal layout the domain Order knows about line items, currencies, and the rule that an order needs at least one item. It does not know there is a orders table with a discount_cents column. The repository adapter is the only place those two worlds touch, and the mapper is the translator that stands at that seam. A reflection or annotation-driven mapper collapses the seam. It reads the persistence shape, walks the domain object's properties, and copies whatever names line up. When the two shapes match, it feels free. When they drift, the drift travels silently across the boundary you built it to protect: a renamed column, a new field, a type that does not round-trip. The whole point of the adapter is that the domain and the table can cha

Gabriel Anhaia 2026-06-14 05:37 10 原文
AI 资讯 Dev.to

Arch Linux Supply Chain Malware, repo-slopscore & AI Model Security Concerns

Arch Linux Supply Chain Malware, repo-slopscore & AI Model Security Concerns Today's Highlights This week highlights a significant supply chain attack on Arch Linux, affecting over 1,500 packages. We also cover a new open-source tool, repo-slopscore, for detecting AI-generated code, and the implications of the US government's directive to suspend access to Anthropic's Fable 5 and Mythos 5 models. Arch Linux Now Believes Malware Incident Under Control: More Than 1,500 Packages (Hacker News) Source: https://www.phoronix.com/news/Arch-Linux-AUR-More-Than-1500 This report details a substantial malware incident impacting the Arch Linux ecosystem, specifically targeting over 1,500 packages within the Arch User Repository (AUR). This compromise represents a significant supply chain attack, demonstrating how malicious code can infiltrate and propagate through widely trusted open-source distribution channels. While the specifics of the exploit vectors and the full extent of the malware payload are still being investigated and disclosed, the sheer scale of affected packages underscores a critical vulnerability in the software supply chain, where the integrity of upstream components directly impacts the security of downstream users. Such large-scale incidents necessitate a robust re-evaluation of verification processes for third-party contributions and proactive, continuous monitoring within community-driven repositories. For Arch Linux users, this incident serves as a stark reminder of the importance of verifying the integrity of their installed packages, utilizing tools for signature validation, and being vigilant about suspicious activity or unexpected package behavior. The event emphasizes that even meticulously maintained distributions are not immune to sophisticated supply chain compromises, reinforcing the need for multi-layered security strategies, including stringent repository governance, automated vulnerability scanning, and enhanced user-side integrity checks to mi

soy 2026-06-14 05:36 10 原文
AI 资讯 Dev.to

AI Agents Level Up Workflows: Terraform MCP, WebMCP, Pinecone Integrations

AI Agents Level Up Workflows: Terraform MCP, WebMCP, Pinecone Integrations Today's Highlights This week showcases significant advancements in AI agent orchestration and workflow automation, with new tools enabling AI to manage infrastructure, interact with the web, and leverage enterprise data. These developments highlight the growing maturity of applied AI frameworks for real-world production use cases. Terraform MCP Server Enables AI Assistants to Interact with Terraform Infrastructure (InfoQ) Source: https://www.infoq.com/news/2026/06/terraform-mcp-server-ga/?utm_campaign=infoq_content&utm_source=infoq&utm_medium=feed&utm_term=global The Terraform MCP (Machine Code Platform) Server has recently achieved general availability, marking a significant step forward in the integration of AI assistants with infrastructure-as-code paradigms. This new server allows AI agents to directly interpret and execute operations on Terraform-provisioned infrastructure, providing a robust and standardized interface for AI-driven automation. Instead of relying on complex scripting or indirect API calls, AI assistants can now receive natural language instructions, translate them into appropriate Terraform commands, and manage resources like virtual machines, networks, and databases across various cloud providers. This capability introduces unprecedented potential for advanced workflow automation within DevOps environments. Teams can leverage AI for tasks ranging from autonomous resource provisioning based on demand surges to intelligent incident response that dynamically scales or reconfigures infrastructure. The MCP Server acts as a crucial middleware, ensuring secure and controlled interaction between intelligent agents and critical infrastructure, thereby reducing manual operational burdens and enhancing system resilience through automated, intelligent responses. This direct interaction paves the way for a new era of self-managing, AI-orchestrated cloud environments. Comment: This i

soy 2026-06-14 05:36 7 原文
AI 资讯 HackerNews

Show HN: Trace – Offline Mac meeting transcripts you can flag mid-call

I'm the developer of Trace, a non-intrusive, shortcut-driven Mac app that records and transcribes your meetings on-device. I know, another meeting transcription app. Please bear with me though, I'm confident that this is at least a little novel. I primarily built Trace for myself. I'd been using MacWhisper, but there was enough fiddling before each call that I'd forget to start it and walk out of an hour-long meeting with nothing written down. So the things I cared about most were that it's quic

AG342 2026-06-14 04:41 4 原文
AI 资讯 Product Hunt

Notum

AI-powered research and document intelligence for law firms. Discussion | Link

2026-06-14 04:35 4 原文
开发者 The Verge AI

X-Men ’97 has what Master of the Universe is missing

In 2026, Marvel and Mattel are both releasing projects designed to capitalize on people's love for iconic animated heroes from their childhoods. Masters of the Universe has put a live-action He-Man on the big screen, and the second season of X-Men '97 is about to fling some of Charles Xavier's mutants into an apocalyptic future. […]

Charles Pulliam-Moore 2026-06-14 04:00 11 原文