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

标签:#an

找到 1559 篇相关文章

AI 资讯

PARA Method for Engineers: Organize Knowledge by Action

Organizing notes by topic sounds logical until you have notes on PostgreSQL in five different folders and cannot find the one that matters for today's problem. The issue is not discipline. The issue is that topic-based organization asks the wrong question. "What is this about?" is useful for libraries. For engineers, the better question is "What am I doing with this?" That is the premise of PARA. PARA is a simple four-bucket system created by Tiago Forte as the organizational backbone of his Building a Second Brain framework. The idea is that all information can be sorted into four categories: Projects, Areas, Resources, and Archives. Each category represents a different level of actionability, and that distinction drives where every note lives. This guide applies PARA to engineering work specifically — codebases, documentation, learning material, and the tension between active project work and long-term reference. The Problem With Topic-Based Organization Most engineers organize knowledge the way they organize code: by domain. databases/ postgresql/ redis/ api/ rest/ graphql/ devops/ kubernetes/ terraform/ That structure makes sense when you are browsing. It breaks down when you need something for a specific task. You remember a useful note about database migration safety, but it could be in databases/postgresql/ , devops/deployments/ , api/versioning/ , or nowhere because you saved it somewhere temporary. Topic folders force you to decide where knowledge belongs before you understand its context. PARA delays that decision — instead of asking what something is about, it asks what you are currently doing with it. The Four Buckets Projects A project is active, time-bound work with a defined outcome. For engineers, projects are things like: Migrate billing service to queue v2 Upgrade PostgreSQL from 14 to 16 Write architecture decision record for auth service redesign Implement rate limiting on public API Publish article about distributed tracing Every project has a c

2026-06-21 原文 →
AI 资讯

1.4.10 Planner Hook: When It Fires, How to Use It

Everything from 1.4.1 through 1.4.9 happened inside a single function, standard_planner() . Building paths, costing them, searching for a join order, estimating cardinality from statistics: all of it runs inside that one function. Yet PostgreSQL does not call standard_planner() directly. It puts another function, planner() , one step ahead of it, and has planner() call standard_planner() . And planner() can be made to call some other function instead of standard_planner() . That replacement is what the planner hook enables. When pg_stat_statements measures per-query planning time, or pg_hint_plan rewrites a plan according to hints, it all goes through this hook. Let's look at how PostgreSQL provides a way to observe or change planning behavior without touching a single line of the core, and how external code plugs into it. All planner() does is check the hook The body of planner() is essentially this. if ( planner_hook ) result = ( * planner_hook ) ( parse , query_string , cursorOptions , boundParams ); else result = standard_planner ( parse , query_string , cursorOptions , boundParams ); planner_hook is a global function pointer. Its default value is NULL , in which case standard_planner() is called right away. A plain PostgreSQL build always takes this path: planner_hook is empty, so the incoming query goes straight to standard_planner() . The key here is the type of planner_hook . typedef PlannedStmt * ( * planner_hook_type ) ( Query * parse , const char * query_string , int cursorOptions , ParamListInfo boundParams ); This signature is identical, down to the character, to that of planner() and standard_planner() . It takes the same Query and returns the same PlannedStmt (the execution plan). So external code only has to write a planner function matching this type and store its address in planner_hook . Let's call this function, written by external code to register in planner_hook , a custom planner function. The moment its address is stored, every planning reque

2026-06-21 原文 →
AI 资讯

PostgreSQL Indexing Deep Dive - Choosing the Right Index

In the earlier posts of this series, we looked at practical query tuning tips and how to read and interpret query plans . A recurring theme in both was: "add an index here." But "add an index" is a bit like saying "use the right tool" — the interesting part is which one. PostgreSQL ships with several index types, each tuned for a different kind of data and query. Picking the wrong one means PostgreSQL quietly ignores your index and goes back to a sequential scan. In this post, we'll walk through the main index types, when each shines, and the special index variations (composite, partial, covering, expression) that often matter more than the type itself. Setting the Scene: Schema and Sample Data We'll reuse the same schema from the previous posts, with one small addition — a metadata JSONB column and a tags array on orders , so we can explore the more exotic index types. CREATE TABLE customers ( id SERIAL PRIMARY KEY , customer_name VARCHAR ( 255 ), email VARCHAR ( 255 ), created_at TIMESTAMPTZ DEFAULT NOW () ); CREATE TABLE orders ( id SERIAL PRIMARY KEY , customer_id INT REFERENCES customers ( id ), order_date TIMESTAMPTZ DEFAULT NOW (), total_amount NUMERIC ( 10 , 2 ), status VARCHAR ( 20 ), tags TEXT [], metadata JSONB ); -- Insert sample customers INSERT INTO customers ( customer_name , email ) SELECT 'Customer ' || i , 'customer' || i || '@example.com' FROM generate_series ( 1 , 1000000 ) AS s ( i ); -- Insert sample orders INSERT INTO orders ( customer_id , order_date , total_amount , status , tags , metadata ) SELECT ( RANDOM () * 1000000 ):: INT , NOW () - interval '1 day' * ( RANDOM () * 365 ):: int , ( RANDOM () * 500 + 20 ), ( ARRAY [ 'pending' , 'shipped' , 'delivered' , 'cancelled' ])[ FLOOR ( RANDOM () * 4 + 1 )], ARRAY [( ARRAY [ 'gift' , 'priority' , 'fragile' , 'bulk' ])[ FLOOR ( RANDOM () * 4 + 1 )]], jsonb_build_object ( 'channel' , ( ARRAY [ 'web' , 'mobile' , 'store' ])[ FLOOR ( RANDOM () * 3 + 1 )]) FROM generate_series ( 1 , 1000000 ) AS s ( i

2026-06-21 原文 →
AI 资讯

Show OS: Universal Uploader – Zero-dependency, stream-based file uploading with transparent XHR fallback

Hey everyone, I wanted to share an open-source library I’ve been developing to solve a persistent issue in frontend file ingestion: handling large-file uploads efficiently without blocking the main thread, consuming excessive client-side memory, or introducing heavy npm dependencies. The core architecture leverages Fetch Duplex streams combined with Web Streams API to achieve constant memory usage during large file transfers. For browsers lacking full duplex stream support (such as Safari), it seamlessly switches to an automated chunked XHR fallback at runtime. ⚙️ Core Architecture & Features Constant Memory Footprint: Streams large chunks sequentially using Fetch duplex streaming where supported. Intelligent Runtime Fallback: Detects capabilities instantly and falls back to a robust, chunked XMLHttpRequest pipeline to ensure cross-browser compatibility (including Safari). Resilient Lifecycle Management: Built-in hooks for pause, resume, manual abort, and automated chunk-level retries with a configurable exponential backoff algorithm. Zero Dependencies & Tree-shakeable: Written entirely in vanilla TypeScript with no external runtime dependencies (npm install u/universal-uploader/core). The architecture is highly modular, ensuring that unused upload strategies are completely tree-shaken during compilation. React Primitive Included: Ships with a declarative React hook that maps the entire upload lifecycle to state primitives without causing redundant re-renders. 🛠️ Why Existing Solutions Didn't Fit Most mainstream uploading libraries either rely on heavy multi-part form encodings that require buffering files entirely into browser memory, or pull in heavy polyfill architectures that bloating the initial bundle size. I designed this to isolate the transport layer logic via a composition-based approach, separating the stream controller from the network client. To ensure deterministic behavior, the codebase is fully covered by 127 integration/unit tests validating network

2026-06-21 原文 →
AI 资讯

Building a no-root Android automation app taught me that trust is harder than features

I’m building ScriptTap, a no-root Android automation app for user-controlled phone workflows. The app lets people create scripts with taps, swipes, routines, screen-aware checks, OCR/text detection, image/pixel checks, variables, logic, and AI-assisted script creation. The technical side is hard, but the trust side may be harder. ScriptTap needs Android Accessibility permission because user-authored input automation requires it. That is a powerful permission. I do not want to minimize it, hide it behind vague onboarding copy, or expect people to click through without understanding what they are enabling. That creates a product-design problem. If the copy is too soft, it feels dishonest. If the copy is too warning-heavy, a legitimate automation tool can feel suspicious before the user even understands what it does. The explanation I am trying to make clear is: ScriptTap is no-root. Scripts are created and controlled by the user. Screen capture is user-controlled. It does not bypass Android permissions, lock screens, app security, or consent flows. Accessibility is required for overlay/input automation, so users should understand why it is being requested. The short version I keep coming back to is: ScriptTap uses Accessibility so your scripts can interact with the screen the way you tell them to. This is a powerful permission. You should only enable it if you understand and trust what the app is doing. For developers who have built apps with sensitive permissions: How did you explain the permission without either hiding the risk or scaring users away from a legitimate feature?

2026-06-21 原文 →
AI 资讯

The Botfather: Building Your First Crypto Trading Bot

The Quest Begins (The "Why") Honestly, I was tired of staring at charts at 2 a.m., trying to catch that perfect entry while my coffee went cold. I’d set a manual alert, jump onto the exchange, click “buy”, and then second‑guess myself as the price slipped away. It felt like I was playing a never‑ending game of Whac‑A‑Mole, and I kept losing the mole. One night, after yet another missed opportunity, I thought: What if I could offload the repetitive bits to a script? Not a fancy AI that predicts the future—just a simple bot that watches the market, checks a condition, and places an order when the condition is met. If I could automate the boring part, I could focus on strategy, learning, and maybe even get some sleep. That was the dragon I wanted to slay: the exhaustion of manual trading. The Revelation (The Insight) The big “aha!” moment came when I realized I didn’t need to build a high‑frequency trading engine from scratch. There are solid, well‑tested libraries that handle the messy bits—authentication, rate limits, WebSocket connections—so I could concentrate on the logic. Using CCXT (a unified crypto exchange library) and a touch of asyncio , I could write a bot that: Connects to an exchange (I used Binance’s testnet so I wouldn’t lose real money). Polls the ticker for a symbol at a reasonable interval. Checks a simple condition—like “price > 20 % above the 20‑period moving average”. Places a market order if the condition holds, then waits for the next cycle. It felt like Neo dodging bullets in The Matrix when the bot finally executed a trade without crashing or getting rate‑limited. The relief was genuine: I could now let the code do the watching while I worked on the next idea. Wielding the Power (Code & Examples) The Struggle – A Naïve Loop My first attempt was a blocking while True loop with time.sleep . It looked harmless, but it had two nasty traps: Trap #1 – No error handling. A network hiccup would raise an exception and kill the whole script. Trap #2 – I

2026-06-21 原文 →
AI 资讯

How I Built a Counter Program in Anchor and Learned to Trust My Tests

I spent a week building a counter program in Anchor — the Rust framework for writing Solana programs. By the end I had two instructions, one authorization constraint, and a test suite I could actually trust. Here is what I built, how I tested it, and the moment I proved the tests were real. Start Here: The Accounts Struct If you come from Web2, this is the part that looks the strangest: #[derive(Accounts)] pub struct Initialize { #[account( init, payer = authority, space = 8 + Counter::INIT_SPACE, )] pub counter : Account , #[account(mut)] pub authority : Signer , pub system_program : Program , } In a Web2 backend, your handler receives a request object and talks to a database. On Solana, there is no database; there are accounts. Every account your instruction needs to read or write must be declared upfront, before the handler runs. Anchor validates them before your code ever executes. Here is what each field does: counter — the account being created. The init constraint tells Anchor to make a CPI to the System Program, allocate 8 + Counter::INIT_SPACE bytes, and fund it from authority . The 8 is for the discriminator Anchor stamps on every account so the program can later verify "this is mine." authority — the wallet signing and paying for the transaction. mut because its SOL balance is decreasing to fund the new account. system_program — required any time you create accounts. Anchor checks that the address matches the real System Program. The accounts struct is the schema. The handler is the logic. The Handlers pub fn initialize ( ctx : Context ) -> Result { let counter = & mut ctx .accounts.counter ; counter .authority = ctx .accounts.authority .key (); counter .count = 0 ; Ok (()) } ctx.accounts gives you typed access to every account declared in the struct. The handler is short because Anchor already did the hard work: allocating the account, checking the signer, paying the rent. Your code just sets the initial values. pub fn increment ( ctx : Context ) -> Resu

2026-06-21 原文 →
AI 资讯

How I Built CarbonCompass with Google Antigravity — A Personal Sustainability Coach, Not Just a Calculator

Most carbon footprint apps do the same thing: Quiz → "Your footprint is 120 kg CO₂/week" → Generic tips → User never returns. That's not a coaching experience. That's a guilt trip with no follow-through. For PromptWars Virtual — Challenge 3 (Carbon Footprint Awareness & Reduction), I built CarbonCompass with a different premise: Not just measure. Guide. Live demo: https://prompt-wars-virtual-hackathon-8u1kxxwh1-mithunvisveshs-projects.vercel.app/ The Problem with Existing Carbon Tools I started by looking at what already exists — Capture, Klima, JouleBug. Each of them calculates a footprint accurately. But they all fail at the same step: the recommendation layer. "Install solar panels." "Buy an EV." "Go vegan." These are structurally correct but useless for a hostel student in Chennai who travels by bus and eats at the mess. They're recommendations designed for a demographic that already has money and flexibility. CarbonCompass is built around two real Indian users: Aditi — a college student in Chennai. Bus commute, hostel mess food, shared room electricity. Her biggest carbon lever is food waste, not transport. Rohan — a tech professional in Bengaluru. Petrol car + scooter commute, air-conditioned 2BHK, frequent food delivery. His biggest lever is home energy, not diet. The same app, two users with different lifestyles receive coaching tailored to their highest-impact opportunities. That's the core product promise. The Architectural Decision That Made Everything Work Before writing a single line of code, I ran this prompt in Google Antigravity's Plan Mode: You are a senior product architect. Before coding: Generate user personas Design a SINGLE shared calculation module that the Dashboard, Impact Simulator, and AI Coach all call with the same inputs Create the data schema Propose page architecture Flag risks for a one-week build Do not write code yet. Create an Implementation Plan. The agent produced a full Implementation Plan artifact — a structured document I cou

2026-06-21 原文 →
AI 资讯

Venture capital

Il venture capital con progetti a 4-5 anni incarna perfettamente la tensione tra la teoria di Manso e la filosofia di Taleb. È un orizzonte temporale che suona contro-intuitivo: troppo lungo per la logica del "fail fast" da incubatore, troppo corto per la pazienza della ricerca fondamentale. Eppure è proprio qui che si gioca la partita dell'innovazione dirompente. Il problema strutturale I fondi VC operano tipicamente su cicli di 10 anni. Un progetto a 4-5 anni occupa il cuore del fondo: non è un esperimento rapido da liquidare, ma nemmeno un investimento da tenere per un'intera generazione. Manso ci dice che il contratto ottimale per l'innovazione richiede tolleranza nel breve termine e ricompensa nel lungo. Ma cosa significa "breve" e "lungo" quando il progetto stesso dura 4-5 anni? Qui emerge un paradosso. Il VC tollerante — quello che Manso celebrerebbe — potrebbe essere tentato di mantenere vivo un progetto che sta fallendo, perché il fallimento prematurato distruggerebbe il valore dell'opzione. Ma Taleb ci avverte: l'antifragilità non è la persistenza a oltranza, è la capacità di trarre beneficio dallo stress. Un progetto che assorbe risorse per 5 anni senza generare informazioni utili non è antifragile: è semplicemente costoso. La soluzione di Manso: il contratto come orologio Per Manso, la risposta sta nella struttura contrattuale. Il contratto ottimale per un progetto a 4-5 anni non è lineare: non è un flusso costante di finanziamento legato a milestone arbitrarie. È qualcosa di più sofisticato. Il principale (il VC) deve commettere a un livello di finanziamento iniziale che copra la fase esplorativa — i primi 12-18 mesi — senza richiedere risultati misurabili. Questa è la fase di "tolleranza eccezionale per il fallimento" di cui parlava Holmström. Poi, a intervalli predeterminati, il VC ha l'opzione — non l'obbligo — di continuare. Ma la soglia di abbandono deve essere più bassa del livello ottimale ex-post. In altre parole: il VC deve essere disposto a co

2026-06-20 原文 →
AI 资讯

Contro il Jobs Act e il merito liquido

Gustavo Manso (Haas School of Business, UC Berkeley) e Nassim Taleb affrontano entrambi il problema centrale dell'innovazione, ma da angolazioni complementari: Manso con la precisione del contratto ottimale, Taleb con la filosofia dell'antifragilità . Entrambi convergono su un'idea contro-intuitiva: per generare innovazione dirompente, bisogna proteggere il fallimento. Manso: Il contratto come strumento di tolleranza Il lavoro di Manso si concentra sui meccanismi di incentivazione che rendono l'innovazione possibile all'interno delle organizzazioni. La sua ricerca fondamentale (2011) modella esplicitamente il trade-off tra exploration (esplorazione di azioni nuove e non testate) e exploitation (sfruttamento di azioni note). Manso dimostra che i contratti ottimali per motivare l'innovazione richiedono una combinazione specifica: tolleranza per i fallimenti nel breve termine e ricompensa per il successo nel lungo termine . Questo è l'esatto opposto del classico "pay-for-performance" (paga in base alle prestazioni), che funziona bene per compiti routine ma soffoca l'innovazione. Come ha osservato Bengt Holmström (1989), citato da Manso, le attività innovative "richiedono una tolleranza eccezionale per il fallimento" perché il processo è imprevedibile e idiosincratico. Uno studio empirico fondamentale — che applica direttamente la teoria di Manso al venture capital — ha mostrato che i VC più tolleranti verso il fallimento generano startup significativamente più innovative. Un aumento dell'1% nella tolleranza al fallimento del VC porta a un aumento dello 0,5% nelle citazioni per brevetto. L'effetto è amplificato nelle recessioni e per le startup in fase iniziale. Manso ha anche esteso questa logica al finanziamento della ricerca scientifica, mostrando come la struttura dei fondi influenzi gli studi dirompenti. La sua analisi suggerisce che le leggi del lavoro che proteggono i dipendenti dal licenziamento arbitrario — attraverso quello che gli studiosi chiamano "effetto a

2026-06-20 原文 →
AI 资讯

Inside Atlassian’s Forge Billing Architecture for Distributed Usage Tracking at Scale

Atlassian details the Forge billing platform built for usage-based pricing across its cloud ecosystem. It processes large-scale usage events with correct attribution, deduplication, and aggregation using a streaming pipeline, idempotent processing, and layered storage to enable accurate billing, near real-time visibility, and reliable reconciliation across distributed services. By Leela Kumili

2026-06-20 原文 →
AI 资讯

Conversion Tracking for Developers: From Zero to Full Funnel Visibility

You can't optimize what you don't measure. Every blog post about conversion optimization, A/B testing, or paid ads assumes you have reliable tracking in place. But most developers set up analytics as an afterthought — dropping a script on the page and calling it done. The result is data that's incomplete, untrustworthy, and ultimately useless for making decisions. This guide gives you a developer-first approach to conversion tracking. We'll cover event instrumentation, attribution setup, funnel visualization, and the specific tracking architecture you need to answer real business questions. No marketing jargon. No vague advice. Just the exact setup that turns your analytics from a vanity dashboard into a decision-making tool. The Tracking Mindset Before you write any code, understand what you're trying to learn. Tracking every possible event creates noise. Tracking the wrong events leads to wrong conclusions. Start with one question: "What are the 3-5 actions a user takes between discovering my product and paying me money?" Map these actions in order. That's your funnel. Every event you track should map directly to a step in that funnel. For a typical SaaS product, the funnel looks like this: Discovery: User visits your site from a traffic source Engagement: User reads content, explores features, or uses a tool Intent: User clicks "Sign Up" or "Start Trial" Conversion: User completes signup and activates Revenue: User upgrades to a paid plan If you track these five steps reliably, you can answer 90% of the marketing questions that matter: Which traffic source brings the most valuable users? Where do users drop off? What's my true cost per acquisition? Event Instrumentation: What to Track and How Events are the atomic unit of conversion tracking. An event is any action a user takes that you want to measure. Let's build your event taxonomy from the ground up. Foundational Events (Track These First) These four events are non-negotiable. Set them up before you do anythi

2026-06-20 原文 →