AI 资讯
Dictionary Pattern Matching in Some Languages Ignores Unspecified Keys, Risks Unexpected Bugs
Introduction Pattern matching, a powerful feature in many programming languages, allows developers to deconstruct complex data structures with elegance and precision. However, when it comes to dictionaries , this elegance can mask a critical issue: non-strict shape matching . Unlike sequence patterns, which demand an exact match, dictionary pattern matching in certain languages silently ignores unspecified keys. This behavior, while seemingly flexible, can lead to unexpected bugs and security vulnerabilities if developers assume strict shape enforcement. To illustrate, consider a dictionary pattern match in a language like Python or Rust. If you write a pattern to match a dictionary with keys {'a', 'b'} , and the actual dictionary contains {'a', 'b', 'c'} , the match will succeed, and the key 'c' will be ignored. This might seem harmless, but it violates the developer’s expectation of a strict shape match, akin to what sequence patterns provide. The causal chain here is straightforward: impact (developer assumes strict matching) → internal process (language ignores unspecified keys) → observable effect (unexpected behavior or bugs). The root of this issue lies in the design choice of prioritizing flexibility over strictness. Languages often default to this behavior to accommodate varying data shapes, but this comes at the cost of clarity and predictability. Compounding the problem is the lack of clear documentation or understanding of this behavior, leading developers to make incorrect assumptions based on their experience with sequence patterns. For instance, in a system where data integrity is critical, such as financial transactions or security protocols, silently ignoring keys could lead to data corruption or unauthorized access . If a developer expects a dictionary to have exactly three keys but the pattern matches a dictionary with four, the extra key might contain malicious data or disrupt downstream logic. The mechanism of risk formation here is the mismatch
科技前沿
Can You Kill Salmonella in Eggs Without Cooking Them? I Tried It
With advice from infectious disease experts, I tested a low-effort way to pasteurize eggs at home.
开发者
Zillow and Redfin settle FTC antitrust case
Zillow and Redfin reached a settlement with the FTC, which requires Redfin to reenter the rental advertising business.
开发者
The Best Kitchen Gadget to Prevent Salmonella Is a Good Meat Probe
Salmonella outbreaks are seemingly everywhere right now. A good temperature probe is the last and best line of defense.
创业投融资
Uber faces fine of nearly $1B over automated driver suspensions
The Dutch Data Protection Authority is fining Uber €825 million in the second largest penalty issued under Europe’s GDPR.
AI 资讯
Michael Polansky is training an AI model on skin that’s still alive
Michael Polansky — better known publicly as Lady Gaga's partner and a former top deputy to Sean Parker — has quietly spent years building an AI-driven startup that keeps living human skin tissue alive for weeks outside the body to discover new skincare compounds, and is only now going public about it.
AI 资讯
The $225 Pebble Time 2 is a refreshingly fun smartwatch
The $225 Pebble Time 2 pairs quirky watch faces and apps with physical buttons, an e-paper display, weeks of battery life, and a playful hacker spirit.
科技前沿
Personalized pricing is “abhorrent,” but FTC limits may increase costs, critics say
Some Americans fear the FTC may be thinking about personalized pricing all wrong.
AI 资讯
OpenAI is gaining on Anthropic with business users, new data indicates
Businesses are willing to flop back and forth as each lab releases new models, volatility that should give both companies' investors pause about how "sticky" enterprise AI spending really is.
产品设计
Patreon launches 30 new creator features, including short-form Clips and revamped discovery
Patreon is overhauling how creators get discovered, adding short-form Clips, topic-based communities, and a revamped recommendation system designed to give smaller creators more visibility.
AI 资讯
Reduce LLM Cost for Catalog: Compare Small Models to Summarize, Classify, and Extract JSON
Short answer: the best way to reduce LLM cost for a product catalog is to measure cost per accepted record, then route each job by difficulty. Count prompt tokens before the call, use a small model for the easy summarize/classify/extract-JSON cases, reserve a stronger model for exceptions, and batch work that can wait. The winning option is the one that preserves the required fields at the lowest cost per accepted result, not the one with the lowest token rate. I build RAG and agent features in Python, so I want this decision to survive contact with production. A catalog description such as “blue jacket, recycled nylon, sizes S–XL” looks easy until one tenant sends HTML, another sends translated attributes, and a third puts three products in one paragraph. The useful unit is therefore a tenant-scoped record with an outcome, a token count, a retry count, and a review decision. Start with the record, not the model For this workflow, the data path is short: normalize a description, count the tokens in the planned prompt, choose a route, request a typed result, validate it, and write the result and its cost to an append-only ledger. A rejected result must remain visible. Otherwise, a cheap model can appear successful simply because invalid JSON and missing attributes disappeared from the report. The ledger needs enough identity to answer a boring but important question: which tenant paid for this retry? I use a job ID, tenant ID, source revision, model route, input token count, output token count, latency, validation status, and review status. Keep the raw description out of ordinary cost dashboards when it contains customer data; the ledger can hold a reference to the source revision instead. Prompt-token counting is a gate, not a decorative metric. If an HTML description expands the prompt beyond its budget, the worker can strip markup, split the record, send it to review, or select a different route. Those choices have different quality consequences, so record the re
AI 资讯
Stripe didn’t really buy OpenRouter because of the ‘singularity’
What does a payments giant want with a startup that routes prompts between different AI models? Stripe says it's because of "the singularity" but it's really for a far more real and powerful reason.
开发者
Flight attendants freaked out that Google is buying tons of Spirit employee data
Bankrupt Spirit accused of selling out workers in massive data sale to Google.
AI 资讯
AI was supposed to win people over by now — it hasn’t
As AI becomes harder to avoid, consumers are growing more wary of the technology — and Silicon Valley is discovering that widespread adoption doesn’t necessarily lead to acceptance.
AI 资讯
Google Pixel Watch 5 Review: More Health, More AI
With smarter gym tracking, new health alerts, and offline Gemini, the Pixel Watch 5 fine-tunes a winning formula—for a price.
AI 资讯
A practical guide to live streaming protocols, latency and scaling
Live video looks simple until you build it. Then you discover that "low latency" means five different things, that your CDN and your latency target are fighting each other, and that the box which handled ten viewers falls over at ten thousand for reasons nobody warned you about. This is the guide I wish existed when I started. No vendor talk, just how the pieces fit. 1. Ingest and delivery are separate decisions The single most common mistake is treating "streaming protocol" as one choice. It is two. Ingest is getting video from a camera, encoder or browser into your server. Delivery is getting it from your server to viewers. They have different constraints and you almost never use the same protocol for both. A typical stack ingests over RTMP or SRT and delivers over HLS. Another ingests WebRTC and delivers WebRTC. Mixing is normal and expected. Once you separate them, most of the confusion disappears. 2. The ingest protocols RTMP is old, TCP-based, and still everywhere. Every encoder speaks it, OBS defaults to it, and it just works. Latency is typically 2 to 5 seconds. Classic RTMP is limited to H.264 and AAC, though the Enhanced RTMP spec has added HEVC and AV1. Being TCP, it degrades badly on lossy networks: packet loss becomes head-of-line blocking, and your stream stalls instead of gracefully dropping quality. SRT is the answer to that. UDP-based with its own retransmission layer (ARQ), a configurable latency buffer, and built-in AES encryption. It is designed for pushing broadcast-quality video across the public internet, which is exactly where RTMP struggles. If your source is on a flaky connection, a 4G link, or a different continent, SRT is usually the right call. # Publishing over SRT with ffmpeg ffmpeg -re -i input.mp4 -c copy -f mpegts \ "srt://your-server:4200?streamid=live/stream1" RTSP is what IP cameras speak. If you are pulling from surveillance hardware, you are pulling RTSP whether you like it or not. WHIP (WebRTC-HTTP Ingestion Protocol) is the n
开发者
We Bought a $500 Counterfeit Rolex So Good, Even Rolex Didn’t Spot It
The replica watch industry is in its “super clone” era. Following tips from murky internet forums, we bought three budget fakes that were good enough to pass as real—but ultimately disposable.
AI 资讯
Etched’s valuation doubles to $21B in a month
Jane Street has installed Etched's first shipped AI cluster system, and was so impressed, it led another massive round, the startup says.
创业投融资
Daniel Ek’s body-scanning startup Neko Health opens first US office, in New York
The scanning and bloodwork health startup founded by Spotify's founder will officially launch in New York in about a month.
创业投融资
Reddit begins testing a new audio and video experience, similar to popular TikTok videos
Reddit is beginning to test video and audio versions of popular posts, allowing users to watch or listen to Reddit stories instead of just reading them.