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

标签:#p

找到 12368 篇相关文章

AI 资讯

Day 23/30: Expose Tools with MCP

I still remember the frustration when our team's support bot, powered by LangGraph and MCP, couldn't retain context between user interactions. It was as if the bot had a case of conversational amnesia, forcing users to repeat themselves over and over. We later discovered that the issue stemmed from our lack of a centralized tooling server, making it impossible for the bot to access and leverage external tools in a scalable manner. This experience taught us the importance of building a robust MCP server to expose tools to our AI applications. In this post, we'll walk through the process of setting up an MCP server, focusing on exposing a single tool to any MCP-compatible AI app. Let's consider a simple tool that performs sentiment analysis on text input. We want this tool to be accessible from our support bot, allowing it to gauge user sentiment and respond accordingly. The first step in building an MCP server is to define the tool and its interface. MCP provides a set of APIs and protocols for tool definition, including the Tool class and the MCPTool interface. We'll use these to create our sentiment analysis tool. Here's a simplified example of how we might define this tool in Python: from MCP import Tool , MCPTool class SentimentAnalysisTool ( Tool , MCPTool ): def __init__ ( self ): super (). __init__ () self . name = " SentimentAnalysis " self . description = " Analyzes the sentiment of the input text " def execute ( self , input_text ): # Simplified sentiment analysis logic for demonstration if " love " in input_text or " great " in input_text : return " Positive " elif " hate " in input_text or " bad " in input_text : return " Negative " else : return " Neutral " # Create an instance of our tool sentiment_tool = SentimentAnalysisTool () Next, we need to set up an MCP server to host our tool. MCP servers can be configured to expose tools over various interfaces, including REST and gRPC. For simplicity, let's use a basic REST server. We'll use Flask, a lightweig

2026-08-02 原文 →
开发者

"iota ใน Go — อักษรกรีกตัวจิ๋วที่กลายเป็นเครื่องมือทรงพลัง"

📅 เขียนเมื่อ: กรกฎาคม 2026 ⚠️ ตรวจสอบข้อมูลจาก Go Specification, APL documentation, และบันทึกของผู้พัฒนา ถ้าคุณเขียน Go มาระยะหนึ่ง คุณคงเคยเห็น iota — เจ้า identifier ประหลาดที่ไม่มีใครรู้ว่ามันคืออะไรตอนเจอครั้งแรก const ( Monday = iota + 1 // 1 Tuesday // 2 Wednesday // 3 ) มันไม่ใช่ keyword, ไม่ใช่ type, ไม่ใช่ function — มันคืออะไรกันแน่? และที่สำคัญ — ทำไมต้องชื่อ iota ? คำตอบพาเราย้อนกลับไปถึงปี 1962 — ถึงนักคณิตศาสตร์ชาวแคนาดาคนหนึ่ง และภาษาโปรแกรมมิ่งที่เปลี่ยนโลก iota คืออะไรใน Go ใน Go spec — iota คือ predeclared identifier ที่ใช้ เฉพาะใน const declaration เท่านั้น มันทำสิ่งเดียว: นับเลขให้อัตโนมัติ const ( _ = iota // 0 (skip) KB = 1 << ( 10 * iota ) // 1 << 10 = 1024 MB // 1 << 20 = 1,048,576 GB // 1 << 30 ) ค่า iota เริ่มที่ 0 และเพิ่มทีละ 1 ทุกครั้งที่เจอบรรทัดใหม่ใน const block — แม้ว่าบรรทัดนั้นจะไม่ได้ใช้ iota ก็ตาม สิ่งที่ทำให้ iota ทรงพลังคือมันเป็น expression (ไม่ใช่แค่ตัวเลข) — คุณเอาไปคูณ บวก ลบ shift ได้หมด const ( Read = 1 << iota // 1 << 0 = 1 Write // 1 << 1 = 2 Execute // 1 << 2 = 4 ) นี่คือวิธีมาตรฐานในการสร้าง enum, bitmask, และ constant series ใน Go — ทั้งหมดด้วย keyword เดียว iota — อักษรกรีกตัวเล็กที่สุด ก่อนจะเป็นชื่อใน Go — ιώτα (iota) คืออักษรตัวที่ 9 ของกรีกโบราณ: ι มันคืออักษรที่ เล็กที่สุด ในภาษากรีก — แค่เส้นตรงหนึ่งเส้น ไม่มีหาง ไม่มีขีด ในพระคัมภีร์ไบเบิล มีวลี famous: "not one iota" — แปลว่า "ไม่แม้แต่นิดเดียว" — เพราะ iota คือสิ่งที่เล็กที่สุด และมันคือชื่อที่สมบูรณ์แบบสำหรับสิ่งที่ "เพิ่มทีละหนึ่ง" จุดเริ่มต้น — APL และ Kenneth Iverson นักคณิตศาสตร์ผู้สร้างภาษา ปี 1962 — Kenneth E. Iverson ตีพิมพ์หนังสือ "A Programming Language" (ที่มาของชื่อ APL) Iverson เป็นนักคณิตศาสตร์ชาวแคนาดา (ต่อมาได้ Turing Award ปี 1979) — เขาไม่ได้แค่ออกแบบภาษาใหม่ แต่ปฏิวัติวิธีคิดเรื่อง programming แทนที่จะเขียน for i = 1 to 10 — Iverson คิดว่า programming ควรเหมือนคณิตศาสตร์: สั้น, สัญลักษณ์, และทรงพลัง เกิดเป็น ⍳ (iota) ใน APL, Iverson สร้าง operator ⍳ — เรียกว่า iota — ที่ทำสิ่งเดียว: สร้างลำดับเลข ⍳ 5 → 1 2 3 4 5 ⍳ 10 → 1 2 3 4 5 6 7 8 9 1

2026-08-02 原文 →
AI 资讯

LLM中如果一个问题容易验证 那么AI就容易学会解决!说说这个特性与P与NP问题的关联性

大模型来了,有个说法是如果一个问题容易验证 那么ai就容易学会解决!说说这个特性与p np问题的关联性 这个说法听起来很直观,但其实 混淆了"验证的复杂性"和"学习/求解的复杂性"这两件不同的事 。我们把它拆开看。 先把"容易验证"在 P/NP 里的精确定位理清 在计算复杂度理论中: NP = 给定候选解(证书),能在多项式时间内验证其正确性的问题 P = 能在多项式时间内直接求解的问题 P ≠ NP ? = 是否所有容易验证的问题,也都容易求解? 所以"容易验证"在 CS 里的严格含义是: 验证者在多项式时间内工作 , 不是说 AI 训练成本低 。 "容易验证 ⇒ AI 容易学会"——部分成立,但有重要的限定 这个直觉 在某些场景下确实成立 ,原因是"验证"提供了 稠密的训练信号 : ✅ 成立的情形:验证器可作奖励/过滤 当一个问题具备"易于验证"的结构时,我们可以用它来: 生成训练数据 :比如 SAT 问题,随机生成一个赋值,代入公式验证,正确就得到一对 (公式, 赋值) 训练样本—— 数据无限且免费 RL 中的奖励塑形 :LLM 生成代码 → 编译器/单元测试验证 → immediate reward Self-play / 自我蒸馏 :AlphaGo 等用模拟器验证落子结果 Verifier-Guided Search :用"易于验证"的判据引导 beam search / MCTS,如 AlphaCode、AlphaGeometry 💡 这就是为什么像 代码生成、形式化证明、数学解题 这些领域近期进展飞快——它们都有"相对容易的验证器"(单元测试、类型检查器、证明校验器)。 ❌ 但这个推论远非普遍成立 "容易验证"≠"AI 容易学会",有几个关键原因: 1. 验证器只给二值信号,梯度稀疏 验证器通常只输出 0/1(对/错),而深度学习需要平滑的损失曲面。对于复杂的 NP 问题,绝大多数随机猜测都是错的 → 奖励恒为 0 → 梯度消失,学不到东西 。这就是"稀疏奖励"难题。 2. P ≠ NP 意味着:验证简单 ≠ 求解简单 即使验证是 O(n),找到那个能通过验证的解可能仍需 O(2ⁿ)。AI 模型本质上是在做启发式搜索,面对组合爆炸, 没有 free lunch 。例如: 数独:验证 O(n²),但最难的数独对人类和 AI 都极具挑战 TSP:验证一条回路 O(n),但找最优回路是 NP-Hard 3. 分布偏移与泛化 NP 问题的"容易验证"是** worst-case 复杂度**意义下的。AI 学到的是训练分布的统计规律,遇到分布外的实例会失效。比如 LLM 在数学竞赛题上表现好,但换个数字或换种表述就可能崩。 4. 验证本身也可能不在 NP 里 很多现实问题是 PSPACE 或更难 (如围棋先手胜负),验证一个"策略"需要指数时间——这种问题连"提供证书让 AI 模仿"都很困难。 一张对照表 问题类型 验证复杂度 AI 易学吗? 例子 P 类 多项式 通常容易 (有高效算法可直接教) 排序、最短路径 NP-Complete,且有稠密验证信号 多项式 中等 (RL + 验证器有效) SAT、数独、TSP 近似 NP-Complete,但验证信号稀疏 多项式 困难 (奖励太稀) 某些密码学难题 超出 NP(PSPACE 等) 超多项式 极难 (验证本身就很贵) 围棋先手胜、QSAT 不可判定 不存在 不可能 (理论上限) 程序等价性 真正的关联在哪里 "容易验证 ⇒ AI 容易学会"更准确的说法应该是: 📌 如果一个问题有"多项式时间的验证器",并且我们能从中提取稠密的训练信号(如 partial credit、逐步验证),那么 AI 可以通过"生成 + 验证"的循环去逼近求解。 这本质上就是 用 NP 的"验证侧"去攻击"求解侧" ——也是当前 LLM + Verifier 范式(如 RLHF 中的 reward model、AlphaProof 的 formal verifier)的理论基础。 但要注意: 这不是 P=NP 的证明,AI 找到的解在 worst-case 仍可能不是最优的 AI 解决的是 平均情况(average-case) 或 特定分布 ,而非 worst-case 一旦问题规模增大到超出训练分布,性能会急剧下降 一个更深的视角:平均-case 复杂度 理论计算机科学里有个分支叫 Average-Case Complexity ,研究"典型实例"的难度。很多 NP-Complete 问题在 average-case 下其实有不错启发式算法——这也解释了为什么 AI 在某些 NP 问题上表现惊喜,但在 adversarial 构造的 hard instance 上翻车。 所以回到你的说法: "

2026-08-02 原文 →
开发者

Apache Hadoop Installation

This guide is a collection or a summary on how to install and use a footprint of Apache Hadoop. I tried to follow an old version 2.7.1 guide that I created few years ago and adjusted this to use the latest version. Apache Hadoop 3.5.0 is used below; check the Apache releases page before future installations. These instructions target Linux (Ubuntu/Debian) for development or testing. Production clusters need Kerberos, network controls, encryption, monitoring, backups, and an upgrade plan. Do not expose HDFS or YARN ports to the internet. Native single-node installation Prerequisites sudo apt-get update sudo apt-get install -y openjdk-17-jdk openssh-client openssh-server pdsh curl tar java -version Hadoop requires Java and SSH; pdsh is recommended by the current Apache single-node documentation. Find JAVA_HOME if needed: readlink -f "$(command -v java)" | sed 's:/bin/java::' Download and install Pin the version for repeatable installs and verify Apache's SHA-512 checksum: export HADOOP_VERSION=3.5.0 cd /tmp curl -fLO "https://archive.apache.org/dist/hadoop/common/hadoop-${HADOOP_VERSION}/hadoop-${HADOOP_VERSION}.tar.gz" curl -fLO "https://archive.apache.org/dist/hadoop/common/hadoop-${HADOOP_VERSION}/hadoop-${HADOOP_VERSION}.tar.gz.sha512" sha512sum -c "hadoop-${HADOOP_VERSION}.tar.gz.sha512" sudo tar -xzf "hadoop-${HADOOP_VERSION}.tar.gz" -C /opt sudo ln -sfn "/opt/hadoop-${HADOOP_VERSION}" /opt/hadoop sudo chown -R "$USER":"$USER" "/opt/hadoop-${HADOOP_VERSION}" Add this to ~/.bashrc, adjusting JAVA_HOME if necessary: export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 export HADOOP_HOME=/opt/hadoop export HADOOP_CONF_DIR="$HADOOP_HOME/etc/hadoop" export HADOOP_HDFS_HOME="$HADOOP_HOME" export HADOOP_YARN_HOME="$HADOOP_HOME" export HADOOP_MAPRED_HOME="$HADOOP_HOME" export PATH="$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin" Then load and verify it: source ~/.bashrc sed -i "s|^# export JAVA_HOME=.*|export JAVA_HOME=${JAVA_HOME}|" "$HADOOP_HOME/etc/hadoop/hadoop-env.sh" had

2026-08-02 原文 →
AI 资讯

Day 1: Understanding Cloud Computing — Service and Deployment Models Explained with a Biryani Analogy

Yesterday I announced I'm blogging daily on AWS & DevOps. Here's Day 1 — the fundamentals everything else builds on. ## What is Cloud Computing? Instead of setting up and maintaining infrastructure on-premises, you now access computing resources remotely over the internet — this is Cloud Computing. "Cloud" refers to a network that provides resources over the internet, accessible whenever needed. It evolved from grid computing, virtualization, and distributed computing. All you need to use it is a web browser. As per NIST , cloud computing is a model for enabling convenient, on-demand network access to a shared pool of configurable computing resources (networks, servers, storage, applications, services) that can be rapidly provisioned and released with minimal management effort. Key characteristics: uses virtualization, enables on-demand access, and offers "pay-as-you-use" pricing. Traditional companies had to spend heavily on infrastructure, hardware, and operations. With cloud computing, providers manage all of this — handling troubleshooting, recording activity, and sending analytics data to users. Service Models — IaaS, PaaS, SaaS IaaS : Providers offer databases, servers, storage, and networking as a service, and you pay per use. Examples: AWS, Azure, GCP. PaaS : Gives you an on-demand environment for developing, testing, and delivering apps, with ready dev tools already set up. Examples: Heroku, Google App Engine. SaaS : Delivers ready-to-use software over the internet, usually via subscription, with the provider managing everything underneath. - Examples: Gmail, Microsoft 365, Google Drive. The layered view: moving from On-Premise to IaaS to PaaS to SaaS, each model hands you a bigger pre-managed slice. On-premise means you manage everything yourself. IaaS shifts virtualization, servers, storage, and networking to the vendor. PaaS additionally hands over OS, middleware, and runtime. SaaS means the vendor manages everything — you just use the app. The biryani a

2026-08-02 原文 →
产品设计

"Plan 9 — ระบบปฏิบัติการที่โลกลืม แต่เปลี่ยนวิธีคิดเรื่อง OS ไปตลอดกาล"

📅 เขียนเมื่อ: กรกฎาคม 2026 ⚠️ อ้างอิงจากเอกสารต้นฉบับของ Bell Labs และบันทึกของผู้พัฒนา ถ้าผมถามว่า "ระบบปฏิบัติการที่เจ๋งที่สุดในโลกคืออะไร" — คุณคงตอบ Linux, macOS, หรือ Windows แต่ถ้าถาม Ken Thompson และ Dennis Ritchie — สองคนที่สร้าง Unix ขึ้นมา — พวกเขาจะตอบว่า Plan 9 Plan 9 คือระบบปฏิบัติการที่ Bell Labs สร้างขึ้นในช่วงปลายยุค 80 ถึงต้นยุค 90 โดยทีมเดียวกับที่สร้าง Unix แต่มันไม่ใช่แค่ "Unix เวอร์ชันใหม่" — มันคือการเริ่มต้นใหม่ทั้งหมด และถึงแม้วันนี้แทบไม่มีใครใช้ Plan 9 — แนวคิดของมันแทรกซึมอยู่ในทุกระบบปฏิบัติการที่คุณใช้อยู่ จุดเริ่มต้น — "Unix เริ่มแก่แล้ว" ปัญหาที่ Unix สะสมมา Unix เกิดในปี 1969 — ตอนนั้นคอมพิวเตอร์คือเครื่องเดียวที่มี terminal ต่อพ่วง พอยุค 80 มาถึง โลกเปลี่ยน — network กลายเป็นเรื่องปกติ, graphics เริ่มสำคัญ, distributed computing เริ่มเกิด แต่ Unix ไม่ได้ถูกออกแบบมาเพื่อสิ่งเหล่านี้ มันถูก patch, extend, retrofit — จนกลายเป็นระบบที่ซับซ้อนเกินกว่าที่ผู้สร้างจะภูมิใจ Ken Thompson เคยพูดประมาณว่า: "Unix เริ่มต้นด้วยความเรียบง่าย แต่มันค่อย ๆ สะสมความซับซ้อนเข้าไปเรื่อย ๆ — ถึงเวลาที่ต้องเริ่มใหม่" ทำไมต้องชื่อ Plan 9 ชื่อ "Plan 9" มาจากหนัง B-movie สุดคลาสสิกเรื่อง "Plan 9 from Outer Space" (1959) ของ Ed Wood — ที่ได้ชื่อว่าเป็น "หนังที่แย่ที่สุดตลอดกาล" แต่ชื่อนี้ไม่ได้หมายความว่า OS นี้แย่ — มันคือมุกวงในของทีม Bell Labs ที่ชอบตั้งชื่อแปลก ๆ (Unix เองก็เป็นมุก — มันล้อ Multics) หัวใจของ Plan 9 — "ทุกอย่างคือไฟล์" จริง ๆ จาก Unix สู่ Plan 9 — ทำให้สุดทาง Unix มีแนวคิด famous: "everything is a file" filesystem เป็นไฟล์ → /home/user/document.txt devices เป็นไฟล์ → /dev/sda , /dev/tty processes เป็นไฟล์ → /proc/1234 แต่มันมีข้อยกเว้น — network sockets, graphics, window system — สิ่งเหล่านี้ไม่ใช่ไฟล์ใน Unix Plan 9 เอาแนวคิดนี้ไป สุดทาง — ใน Plan 9, ทุกอย่างคือไฟล์ ไม่มีข้อยกเว้น 9P — โปรโตคอลเดียวที่เชื่อมทุกอย่าง หัวใจของ Plan 9 คือ 9P — โปรโตคอลที่ทำให้ทุกอย่างสื่อสารกันผ่าน filesystem หน้าต่าง GUI → mount เป็นไฟล์ network connection → mount เป็นไฟล์ เครื่องอื่นใน network → mount เป็นไฟล์ ลองนึกภาพ: คุณ ls ดูไฟล์ในเครื่องคนอื่นได้เหมือน

2026-08-02 原文 →
AI 资讯

I built CleanSlate, an open-source coding agent for the IDE, CLI, and SDK

CleanSlate is an open-source platform for running coding agents across your local machine and the cloud. Today, it works through an IDE, CLI, and SDK. Agents can understand a codebase, make changes, run commands, browse the web, and verify their work. We are now building longer-running autonomous cloud agents that can continue working without keeping your machine active. CleanSlate supports multiple model providers and is not tied to a single ecosystem. GitHub: https://github.com/TheWariend/CleanSlate Website: https://thewariend.com/cleanslate The project is still early, and I would appreciate honest feedback from developers who use coding agents.

2026-08-02 原文 →
AI 资讯

Architecting Mainline-Friendly Products

Mainline-friendly products are designed so their board support lives in upstream Linux, U-Boot, and standard build systems instead of a vendor fork. The decision is architectural, not aspirational: it is made when you choose the SoC, design the add-on connectors, and write the device tree — not when the product is already shipping. This article gives the strategic case, the product design rules that follow from current kernel work on hot-pluggable add-on boards, a vendor checklist for tech leads, and the concrete steps to upstream your own board support. We have covered why silicon vendors are moving to upstream-first BSPs . This article covers the product team's side of that shift: what you should do about it. Building mainline-friendly products means making a set of design decisions — SoC selection, connector design, device tree structure, and an upstreaming plan — so that mainline Linux and U-Boot treat your board as a normally supported board rather than as a permanent private port. Each section below turns one of those decisions into rules you can apply on your next board. Why mainline-friendly products are a strategic decision The cost of a vendor-fork BSP is not paid at bring-up; it is paid for the life of the product. Every kernel upgrade becomes a forward-port of private patches. Every security fix arrives on the vendor's schedule, not the kernel's — and for devices in scope of regulations such as the EU Cyber Resilience Act, patch latency is now a compliance question, not just an engineering one. Hiring is harder, because engineers must learn your fork before they can touch it, and the knowledge they build does not transfer in either direction. Board support that lives in mainline inverts each of these. New kernels are more likely to boot your board without forward-porting private support patches, because your board is part of the kernel's own build-and-test surface; LTS security fixes are easier to consume because the code paths you depend on are already

2026-08-02 原文 →
AI 资讯

Pixel Chef AI: A Memory Kitchen That Learns Your Taste

This is a submission for Frontend Challenge - Comfort Food Edition, Perfect Landing 🍳 Pixel Chef AI — A Memory Kitchen That Learns Your Taste What I Built Pixel Chef AI is an interactive AI cooking companion built around a simple idea: Food is not only about recipes. It is about memories, habits, emotions, and personal taste. Instead of being a traditional recipe generator, Pixel Chef AI creates a complete AI-powered cooking journey: 🧊 Enter the Memory Kitchen 🥬 Choose ingredients 🤖 Let AI analyze flavors and nutrition 🔥 Cook with real-time AI guidance 🍽️ Reveal your final dish 🧬 Build your personal Taste DNA Every cooking session becomes a memory. Over time, the AI learns your cooking preferences, flavor choices, and habits to create a more personalized kitchen experience. The core question behind this project: What if your AI assistant could remember how you cook and become your personal kitchen companion? ✨ Features 🧠 AI Taste Intelligence Pixel Chef AI is designed around the idea that cooking decisions are personal. The AI analyzes: Ingredient combinations Flavor balance Nutrition information User preferences It can: Predict flavor direction Suggest ingredient improvements Recommend better combinations Adapt suggestions based on cooking goals 🤖 AI Cooking Companion A pixel AI chef accompanies users throughout the entire cooking process. The AI provides: Ingredient analysis Flavor recommendations Cooking suggestions Real-time guidance during cooking Personalized feedback The goal is to make AI feel like a kitchen partner, not just a chatbot. 🧊 Interactive Pixel Kitchen The experience starts inside a cozy pixel-art kitchen. Users can: Open the fridge Select ingredients Create their own combinations Watch AI analyze their choices The kitchen becomes a place where users interact with AI through cooking. 🔥 AI Cooking Simulation Cooking becomes an interactive experience instead of a simple result page. During cooking: A cooking timeline controls progress Different coo

2026-08-02 原文 →
AI 资讯

Confident Is Not Correct: Three Signs That Claude Is Guessing

The answer arrives clean, well-formatted, and certain. You run it. The config flag doesn't exist. Nothing in the response told you the difference between the parts it was sure about and the parts it filled in. The syntax was right. The explanation was reasonable. The flag had a sensible name and a clear purpose. It just wasn't real. This is a calibration problem, not a trust problem. "Don't trust AI" is useless advice. It tells you to doubt everything, which is the same as doubting nothing, because you can't actually work that way. What you need instead is a way to tell which parts of an answer are grounded and which were filled in. There are patterns to look for, and once you know them, they are hard to miss. 🔍 Why this affects beginners specifically This isn't about intelligence. It's about experience. An engineer with a few years behind them has already lost time to a function that didn't exist. They have wasted an afternoon on a config parameter that turned out to belong to a different engine. They have built up a collection of "that looked right but wasn't" memories, and those memories now activate automatically. A small feeling that says check this one before they run it. Beginners haven't had those afternoons yet. The pattern recognition that comes from repeated failures doesn't exist, because the failures haven't happened. Everything arrives in the same confident tone, and without past mistakes to compare against, there is no internal signal separating a grounded answer from a made-up one. That's not a character flaw. It's missing experience, and it can be partly replaced with three concrete things to look for. ✅ The three signs These aren't perfect. They are a minimum standard, and they catch the common cases. I'll be clear about what they miss at the end. Sign 1: Very specific details with no source When the answer includes a precise detail (a specific config flag, a particular function signature, an exact version number) and doesn't say where that detail

2026-08-02 原文 →
开发者

Database Views in Your ERD: Read-Only Entities, Not Fake Tables

Disclosure: I build Schemity , a desktop ERD tool - this post is from our blog and uses it for the examples. TL;DR: Database views carry real responsibilities - reporting layers, security boundaries, API surfaces - but ERD tools either leave them out entirely (DBML has no view support despite requests since 2022) or draw them as if they were ordinary tables. Schemity displays views and materialized views as read-only entities with italic names and a bold view or mview token in the entity footer, so derived relations are distinguishable from base tables at a glance, and they can be imported into context views like any other entity. A database view belongs in your ERD, but not disguised as a table: it is a derived, read-only relation, and the diagram should say so at a glance. Schemity draws views and materialized views as read-only entities with italic names - present on the canvas, visually distinct from the base tables they are built on. That sentence would be unremarkable if the rest of the tooling world agreed with it. Mostly, it does not. In most ERD tools your views are simply absent, and in the rest they are dressed up as something they are not. The reporting layer your diagram pretends does not exist Views are not decoration. They are where schemas put their public face: the reporting layer that joins five tables into one readable relation, the security boundary that exposes a subset of columns to an application role, the compatibility shim that survives a refactor. On Supabase , views are how you shape what PostgREST exposes as an API. A materialized view may be the single most performance-critical object in an analytics schema. Whoever reads your diagram to understand the system needs to see them. Yet the diagram usually cannot show them. DBML - the schema language behind dbdiagram.io - has no syntax for views at all: a user proposed designing views with join definitions in December 2022, others were still upvoting the request in July 2024, and there has be

2026-08-02 原文 →
开发者

Variations on a theme of sorting

Semisort Reorder an array so that identical keys are grouped contiguously Keys do not need to be in sorted order Stable Partition Group by predicate, preserve order K-smallest selection, single Get the k-smallest key from the array K-smallest selection, list Get the k-smallest key from the array, and everything smaller (or equal), in any order K-smallest selection, list sorted Get the k-smallest key from the array, and everything smaller (or equal), in sorted order submitted by /u/Grouchy-Trade-7250 [link] [留言]

2026-08-02 原文 →
AI 资讯

How Is ""2" > "10"" "true" in JavaScript?

What is output of ""2">"10"" true or false At first glance, this looks completely wrong. We all know that: 2 > 10 is obviously: false Because 2 is smaller than 10. But what happens when we add quotation marks? "2" > "10" The result is: true 😱 Wait… how can 2 be greater than 10? The answer is simple: ""2"" and ""10"" are not numbers. They are strings. 🔢 Numbers vs. Strings In JavaScript, these two values are different: 2 This is a number. While: "2" This is a string. The quotation marks tell JavaScript that the value should be treated as text. So: 2 > 10 compares two numbers: 2 > 10 → false But: "2" > "10" compares two strings. And that's where things get interesting! 🔤 How Does JavaScript Compare Strings? When JavaScript compares two strings, it uses lexicographical comparison. You can think of this as comparing text in a dictionary-like order, based on the character values. Let's compare: "2" "10" JavaScript looks at the first character of each string: "2" → first character is 2 "10" → first character is 1 Since the character ""2"" comes after ""1"" in the ordering used for the comparison, JavaScript determines: "2" > "10" as: true So: console.log("2" > "10"); outputs: true 🧪 Let's Compare Both Cases Case 1: Numbers console.log(2 > 10); Output: false Because JavaScript compares the actual numerical values: 2 is less than 10 Case 2: Strings console.log("2" > "10"); Output: true Because JavaScript performs a string comparison. The important thing is: 2 → Number "2" → String The quotation marks can completely change how JavaScript interprets the value. ⚠️ What About Mixed Types? Now look at this: console.log("2" > 10); Here, one value is a string and the other is a number. JavaScript handles this differently. In this case, it converts the string ""2"" into a number for the comparison. So the comparison effectively becomes: 2 > 10 The result is: false This is why understanding data types is extremely important when programming. 💡 The Big Lesson These three comparisons

2026-08-02 原文 →
AI 资讯

Stop Leaking PII! Local Data Masking with Transformers.js and WASM

In an era where data privacy is no longer a "nice-to-have" but a legal mandate (looking at you, GDPR and HIPAA), sending raw user data to the cloud is like playing with fire. If you are building health-tech or fintech apps, the risk of exposing Personally Identifiable Information (PII) is a constant headache. But what if the data never leaves the user's browser in its raw form? Enter Edge AI and Privacy-preserving AI . By leveraging Transformers.js and WebAssembly (WASM) , we can perform complex Named Entity Recognition (NER) to de-identify sensitive information directly on the client side. In this tutorial, we’ll build a "Privacy Shield" that detects and masks names, locations, and health identifiers before they ever hit your API. The Architecture: Privacy First 🏗️ The traditional approach involves sending raw text to a server-side LLM or NLP service. Our approach intercepts the data at the "Edge" (the browser). graph TD A[User Inputs Sensitive Health Data] --> B{Browser-side Privacy Shield} B --> C[Transformers.js / WASM] C --> D[NER Model Analysis] D --> E[Data Masking / Redaction] E --> F[Clean Data] F --> G[Cloud Storage / Analytics] G -.-> H[Compliance & Security ✅] style B fill:#f9f,stroke:#333,stroke-width:2px style C fill:#bbf,stroke:#333,stroke-width:2px By using WebAssembly , we get near-native performance for running BERT-based models in the browser, ensuring the UI remains snappy while keeping the data 100% local. Prerequisites 🛠️ To follow along, you'll need: Tech Stack : TypeScript, Vite, and Transformers.js . Basic understanding of NER (Named Entity Recognition) . A passion for not getting sued for data leaks. 🥑 Step 1: Setting up the Privacy Pipeline First, let's install the library: npm install @xenova/transformers Now, let's create our PrivacyShield service. We will use a lightweight NER model (like Xenova/bert-base-NER ) that has been optimized for the web. // src/services/privacyShield.ts import { pipeline , env } from ' @xenova/transformers ' ;

2026-08-02 原文 →
AI 资讯

The Open-Weight Inflection Point: Kimi K3, Claude Opus 5, and Microsoft MAI Signal a Market Shift

The Open-Weight Inflection Point: Kimi K3, Claude Opus 5, and Microsoft MAI Signal a Market Shift Subtitle: Three major releases in one day point to the same conclusion — the AI industry is shifting from "who can build the strongest model" to "who can build the most cost-effective one." July 28, 2026, might be remembered as the day the AI industry's center of gravity shifted. Three announcements — from Moonshot AI, Anthropic, and Microsoft — each independently signaled the same underlying trend: open and cost-efficient models are becoming the new competitive baseline. Here's what happened and why it matters. 1. Kimi K3 Goes Open-Weight: First 3T-Class Open Model Moonshot AI publicly released Kimi K3's full model weights on HuggingFace — a 2.8-trillion-parameter Mixture-of-Experts model with 104B activated parameters. This is the first 3T-class model ever made openly available to the public. Key technical highlights: Architecture: Kimi Delta Attention (KDA) + Attention Residuals (AttnRes), 896 experts with 16 activated per token Native Multimodality: Text, images, and video understanding via MoonViT-V2 vision encoder Context Window: 1,048,576 tokens (~1M tokens) Benchmarks: Terminal-Bench 2.1: 88.3, BrowseComp: 91.2, MCPMark-Verified: 94.5 — competitive with Claude Fable 5 and GPT-5.6 Sol Why it matters: Kimi K3 raises the "open-source model ceiling" to an unprecedented level. For the first time, a model that competes with top-tier closed-source models is available with fully public weights — giving startups, researchers, and enterprises a genuine alternative to API-dependent workflows. For developers, this is the practical part: you can now self-host a model that holds its own against frontier closed models. That changes cost models, data-privacy decisions, and vendor lock-in math overnight. 2. Claude Opus 5: Anthropic's "Daily Driver" Strategy Anthropic launched Claude Opus 5 — a mid-premium model positioned as the "daily driver" for 90% of knowledge work. The key

2026-08-02 原文 →
AI 资讯

136 raw removals, 17 real ones: what a spec diff over-reports

Originally published at mendapi.com . Between two published snapshots of the Cloudflare OpenAPI schema — 7abe88500e55 (2026-03-31) → c92b9b0fde23 (2026-07-27) — a raw structural diff produced 6,354 change records. 136 of them were endpoint path removals, the scariest kind a diff can report: the route your code calls is simply gone from the spec. Except 119 of those 136 were not gone at all. This is the accounting of how we know, per record, with machine evidence. The trap in a raw diff A path removal in a spec diff means one thing: the string key disappeared from the paths object. It does not mean the runtime URL stopped working. Specs get refactored — concrete routes collapse into templated ones, path parameters get renamed, methods get merged — and every one of those refactors shows up as a "removal" if you only look at one side of the diff. An alerting tool that pages you 136 times for this corridor is training you to ignore it. The whole job of the curation layer is to keep that from happening without silently dropping a real break. The ledger: 17 + 119 = 136 Every one of the 136 raw removals has an adjudicated destination. 17 were kept as genuinely client-breaking: the runtime URL or method really disappeared, with no surviving successor. The other 119 were excluded, each with machine evidence from the two spec snapshots that the surface actually survives: Template consolidation — 107 records. Concrete Workers AI model routes like /ai/run/@cf/baai/bge-m3 collapsed into the pre-existing generic /ai/run/{model_name} route. The runtime URL a client sends never changed; the spec just stopped enumerating each model. The evidence rule requires the templated route to exist in both snapshots and to swallow the removed path with a literal-anchored match, so a template that is merely a shape prefix of a genuinely removed endpoint does not count. Parameter rename, runtime-identical — 11 records. Path parameters renamed ( {postfix_id} to {investigate_id} and friends). Afte

2026-08-02 原文 →
AI 资讯

Why I Fell in Love with Rust’s Memory Model (Even Though It’s Hard)

I’ve worked with languages like JavaScript and Go , and I enjoyed both for different reasons. JavaScript gave me speed and flexibility. Go gave me simplicity and practical concurrency. Then I met Rust and at first, it felt difficult. But once I understood how Rust handles memory without a garbage collector , I fell in love with it. Memory Safety Without a Garbage Collector Most modern languages solve memory management with a garbage collector (GC) . A GC periodically finds memory that is no longer used and frees it automatically. Rust takes a different path: No runtime garbage collector No manual free() like in C Memory safety guaranteed at compile time (in most cases) Rust uses three core ideas: Ownership Borrowing Lifetimes These rules are checked by the compiler before your program runs. 1) Ownership: One Owner at a Time In Rust, every value has a single owner. When the owner goes out of scope, Rust automatically drops the value and frees memory. { let s = String :: from ( "hello" ); // s owns the string memory here } // s goes out of scope, memory is freed automatically This avoids memory leaks and double-frees in normal code paths, without needing a GC pause. 2) Borrowing: Use Data Without Taking Ownership Instead of copying or transferring ownership all the time, Rust lets you borrow references: Immutable borrow: &T Mutable borrow: &mut T But Rust enforces strict aliasing rules: Many immutable references OR One mutable reference Not both at the same time This rule prevents data races at compile time. 3) Lifetimes: References Must Always Be Valid Lifetimes describe how long references are valid. Often, Rust infers lifetimes automatically. When needed, you can annotate them. This helps prevent dangling references references to memory that no longer exists. How Rust “Behaves” in Practice When writing Rust, you feel the compiler acting like a strict mentor: “Who owns this value?” “How long does this reference live?” “Are you mutating while also sharing?” “Could th

2026-08-02 原文 →