AI 资讯
# 📓 TanStack Query: Core Concepts & Summary
1. Introduction: What is TanStack Query? TanStack Query (formerly React Query) is a framework-agnostic state management library designed specifically to manage Server State —handling data fetching, caching, background updating, and cache invalidation. 2. Server State vs. Client State & The Memory Reality Client State: Owned and controlled entirely by the browser (e.g., isModalOpen , selected UI theme). Server State: Owned by the remote backend database (e.g., user profiles, posts, cart items). The browser only holds a read-only temporary snapshot . Where is data physically stored? Physical Location: By default, cached data lives strictly in the browser tab's JavaScript RAM (In-Memory) . Backend ("The Server"): Refers to your remote API/database (regardless of whether it runs on Kubernetes, Docker containers, serverless functions, or bare metal). Optional Persistence: You can opt to sync this RAM cache to localStorage , sessionStorage , or IndexedDB using TanStack Query Persisters. import React , { useState } from ' react ' ; import { QueryClient , QueryClientProvider , useQuery , useMutation , useQueryClient , } from ' @tanstack/react-query ' ; // 1. Initialize QueryClient (manages the RAM cache) const queryClient = new QueryClient ({ defaultOptions : { queries : { staleTime : 10000 , // Data stays fresh in RAM for 10 seconds }, }, }); // Mock API functions async function fetchPost ( postId ) { const res = await fetch ( `[https://jsonplaceholder.typicode.com/posts/$](https://jsonplaceholder.typicode.com/posts/$){postId}` ); if ( ! res . ok ) throw new Error ( ' Network error ' ); return res . json (); } async function createPost ( newPost ) { const res = await fetch ( ' [https://jsonplaceholder.typicode.com/posts](https://jsonplaceholder.typicode.com/posts) ' , { method : ' POST ' , headers : { ' Content-Type ' : ' application/json ' }, body : JSON . stringify ( newPost ), }); return res . json (); } // 2. Query Component (Fetching & Reading Data) function PostViewe
AI 资讯
I built a Python library to stop AI agents from leaking secrets (ModelFuzz)
I've been building AI agents lately, and honestly, their security model terrifies me. We give LLMs access to powerful tools like shell.run , http.post , and fs.read . But if an agent reads a malicious email or a poisoned webpage, it can be tricked by prompt injection into using those tools to exfiltrate data. Hoping the LLM refuses the attack isn't a real security strategy. So, I built ModelFuzz. It's an open-source Python library that intercepts the tool call at the execution layer. The defense: @shield_tool Instead of trying to filter prompts, ModelFuzz checks the arguments before the tool runs. If it detects a policy violation, like a stolen API key or an unsafe URL, the tool simply doesn't execute. from modelfuzz import shield_tool @shield_tool def send_email ( to_address : str , subject : str , body : str ) -> None : smtp . send ( to_address , subject , body ) Even if the LLM is completely tricked by a prompt injection, the tool never fires. The offense: modelfuzz scan I also built a CLI scanner that red-teams your agent. It fires deceptive prompt injection attacks at your local model to see if it can be tricked into calling a tool. modelfuzz scan --endpoint http://localhost:11434/v1 --model qwen2.5:1.5b I tested it against a local qwen2.5:1.5b model, and it got breached 4 out of 5 times. Try it out It's 100% open source and live on PyPI. pip install "modelfuzz[scan]" GitHub: higagan/modelfuzz Website: modelfuzz.com I'd love to know what security policies you think are missing, or what agent frameworks you want supported next!
开发者
US government says Iran-linked hackers are disrupting American water and energy providers
An updated government advisory warns that Iranian hackers are exploiting systems used by water and energy providers.
AI 资讯
Corsair’s PC case with a panoramic glass design is $70 off
On the hunt for a PC case that’s loaded with features and has a unique look? Amazon, Best Buy, and Corsair are selling the Corsair Frame 4500X RS for $119.99, a $70 discount from the usual price. The versatile case supports motherboards up to EATX, GPUs up to 460mm in length, and has a seamless […]
科技前沿
Qobuz overhauls its music player and adds real-time lyrics
The latest updates to Qobuz make it an even better alternative to Spotify.
产品设计
AngelList Link
An MCP server for GPs Discussion | Link
AI 资讯
Tesla’s robotaxi promises are clashing with reality
In an earnings call yesterday, Tesla CEO Elon Musk did his best to paint a positive portrait of the company's robotaxi program. New cities are being added, more miles are being driven, and more people are experiencing Tesla's unsupervised vehicles. But Musk's typical bullishness seemed to be absent from the call, as the occasional trillionaire […]
AI 资讯
Runway launches AI model router as generative media gets crowded
The Media Router is a tool that automatically selects the best image, video, or audio generation model for a request based on whether a developer prioritizes quality, speed or cost.
AI 资讯
OpenAI makes ChatGPT Health available to all US users
Users can also integrate their personal data from services like Apple Health, Function, and MyFitnessPal.
产品设计
Geekbench 7 will push your computer or phone even harder for better benchmarking
Primate Labs is releasing Geekbench 7, the latest generation of its popular benchmarking tool. Geekbench 7 features new video and audio encoding / decoding tests, a redesigned multi-core test, and larger, more demanding datasets for CPUs and GPUs to crunch through. It otherwise looks and acts just like Geekbench 6, and a Pro license will […]
AI 资讯
Supercooled kidneys have been transplanted into pigs in a “landmark achievement”
When it comes to organ donation, time is everything. As soon as an organ has been carefully removed from a donor’s body, it starts to deteriorate. Surgeons have a matter of hours to get it into a recipient. Leave it too long and the organ will become unusable. In most cases, organs will be kept…
AI 资讯
A woman got a UTI. Two years later, the bacteria had evolved, invaded her brain.
The case provides a novel report of the emergence of heterovirulence.
AI 资讯
The EU Fines Google $1 Billion for Prioritizing Its Own Services in Search
The European Commission claims that Google boosted its own apps and products to the top of search rankings to the detriment of its competitors.
开发者
Google hit with $1 billion in fines as EU braces for Trump battle
Google becomes third tech giant to face huge fines under the Digital Markets Act.
AI 资讯
Amazon puts Luna cloud-streamed games like Fallout 4 inside Prime Video
The new strategy that Amazon gaming exec Jeff Gattis talked to The Verge about last month is getting clearer now that Prime Video has added a new Games tab on Fire TV devices. With Prime Gaming, Amazon Game Studios, and Luna now combined into one organization, it's aiming at the more casual audience of people […]
AI 资讯
Tesla’s robotaxis are moving in reverse
The number of paid robotaxi miles traveled fell 36% in the second quarter, despite expanding to new cities, according to Tesla's own figures.
AI 资讯
Meta launched a new AI optimism ad set to a song about human extinction
David Bowie's song "Five Years," which Meta used in a supposedly inspiring advertisement, is about humans learning that they have five years left to live before the apocalypse.
科技前沿
Sony's decision to ditch discs was practically inevitable, data shows
Circana numbers show US gamers overwhelmingly voting with their wallets.
AI 资讯
Google just had its first negative cash flow quarter due to massive AI spending
Google continues to report big quarterly revenue, but its AI spending has skyrocketed.
AI 资讯
Microsoft is testing free, ad-supported cloud gaming for Xbox Insiders
Xbox Insiders can stream games from their libraries for free in ad-supported streaming sessions starting today. The free streaming sessions are limited to games you already own, and sessions are capped at one hour. However, ads will only play "before sessions begin." It's also optional - you won't need to watch ads if you have […]