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

标签:#p

找到 12386 篇相关文章

AI 资讯

Converting a JavaScript-Rendered Web Page to PDF

If you've ever tried to turn a modern web page into a PDF programmatically, you've probably hit the wall: the file comes out blank, half-empty, or frozen on a loading spinner. The page looks perfect in the browser, so what gives? The answer is timing. Most PDF approaches grab the HTML before the JavaScript has rendered the content. On a server-rendered page that's fine — the markup is already there. On a React/Vue/Angular app, the server sends an near-empty shell and the browser builds the DOM afterward. Capture too early and you save the shell. Here's how to do it properly. Why the naive approaches fail wkhtmltopdf is the classic Google answer. It's fast and it's been around forever, but it uses an ancient WebKit build with effectively no modern JavaScript support. For a static page it's fine. For anything client-rendered, it captures the empty state. Browser window.print() / Ctrl+P works because it is a real browser — but it's manual, single-page, and impossible to automate cleanly at scale. Hitting the raw HTML with an HTTP client (axios/fetch then pipe to a PDF lib) has the same fatal flaw as wkhtmltopdf : no JS execution, no rendered content. What you actually need is a real browser engine that runs the page's JavaScript, waits for it to settle, and then prints. That's Puppeteer. The Puppeteer approach Puppeteer drives a headless Chromium. It executes the page exactly like a normal Chrome tab, so whatever renders on screen is what you capture. const puppeteer = require ( ' puppeteer ' ); async function pageToPdf ( url , outPath ) { const browser = await puppeteer . launch ({ args : [ ' --no-sandbox ' , ' --disable-setuid-sandbox ' ], // needed in most containers }); const page = await browser . newPage (); await page . goto ( url , { waitUntil : ' networkidle0 ' , timeout : 60000 }); await page . pdf ({ path : outPath , format : ' A4 ' , printBackground : true , // otherwise CSS backgrounds/colors are dropped margin : { top : ' 20px ' , bottom : ' 20px ' , left

2026-08-01 原文 →
AI 资讯

How AI Is Transforming Software Development Workflows in 2026

How AI Is Transforming Software Development Workflows in 2026 By 2026, AI has moved far beyond autocomplete and boilerplate generation. It has become an integral, intelligent partner in the entire software development lifecycle. From writing initial architecture to diagnosing production incidents, AI agents are embedded into the fabric of modern engineering workflows. This transformation is not just about speed—it's a fundamental shift in the way developers think, collaborate, and deliver software. The Rise of AI-Native Development Environments The days of classic IDEs with a chat sidebar bolted on are behind us. In 2026, AI-native development environments are the norm. These IDEs are built around context-aware AI models that understand not just the syntax but the semantic intent of the codebase. Tools like Cursor and Windsurf have evolved into full-blown autonomous agents that can navigate large codebases, propose cross-file refactors, and even execute multi-step changes with minimal supervision. Consider a common task: adding a new payment gateway. In a traditional workflow, a developer would manually trace API routes, update database schemas, and write integration tests. In 2026, the developer simply describes the requirement in natural language. The AI agent explores the existing adapter patterns, creates the new integration, updates configuration files, and runs the test suite. The developer reviews the diff, tweaks edge cases, and signs off. This paradigm shift has accelerated feature delivery by an order of magnitude. Intelligent Automated Testing and Debugging Testing has always been a critical yet time-consuming part of development. AI in 2026 has revolutionised this domain. Instead of writing every test case manually, developers use AI to generate exhaustive test suites that cover edge cases, security vulnerabilities, and performance bottlenecks. The AI analyses the code's control flow, historical bug data, and production logs to generate tests that would

2026-08-01 原文 →
AI 资讯

Build a Spanish WhatsApp booking landing page with plain HTML, CSS, and JavaScript

Many independent service businesses already use WhatsApp to confirm appointments. The missing piece is often a small, clear landing page that answers the obvious questions before the first message: what is offered, how much it costs, and what a visitor should do next. I built a dependency-free Spanish booking-page pattern around that handoff. The booking flow A useful booking page does not need a heavy scheduling stack to start doing its job. Its core flow can be simple: Show a small set of services with understandable prices and durations. Put a clear call to action on every relevant section. Open WhatsApp with enough context that the owner does not have to ask the same first question again. Keep the page fast and editable. The key implementation detail is generating the WhatsApp link from a service-specific message: const phone = " 56900000000 " ; document . querySelectorAll ( " .whatsapp-link " ). forEach (( link ) => { const message = link . dataset . message ; if ( message ) { link . href = `https://wa.me/ ${ phone } ?text= ${ encodeURIComponent ( message )} ` ; } }); That lets a CTA such as “Reserve a hair ritual” arrive as a message like “Hola, quiero reservar el Ritual de cabello.” It is a small interaction, but it removes friction for both the customer and the business. Design choices that help Mobile-first layout: appointment links are frequently opened from a phone. Visible prices and durations: clearer expectations usually mean better-quality enquiries. Short FAQs: rescheduling, location, and confirmation are common blockers. Semantic HTML: headings, buttons, and disclosure details work without a framework. No fake live contact details: the phone number, copy, price, and social links are clearly marked for replacement. Live demo You can inspect the working beauty-studio demo here: WhatsApp Booking Landing Kit — Interactive Demo Editable bundle I also made the complete editable source available as a paid digital kit. It now includes three standalone Spani

2026-08-01 原文 →
AI 资讯

My Shell Scripts Speak C# Now

Every couple of weeks I need a twenty-line program. Find what's bloating a build agent's disk, dedupe a CSV, hash-check a folder. For fifteen years the honest answer to "which language?" was not C# — by the time I'd done mkdir , dotnet new console , and named yet another throwaway csproj, the moment had passed. So those little jobs went to bash or Python, and I grumbled quietly every time. .NET 10 removed the ritual. You write one .cs file and run it. I'd been meaning to check how well this actually holds up for real scripts, so this week I did — nothing fancy, one Linux container and a stopwatch. One file, no project Here's biggest.cs , a small utility that lists the largest files under a directory. The whole program is this one file — no csproj anywhere: # !/ usr / bin / env dotnet # : package Humanizer @ 3.0 . 10 using Humanizer ; var root = args . Length > 0 ? args [ 0 ] : "." ; var top = args . Length > 1 && int . TryParse ( args [ 1 ], out var n ) ? n : 10 ; var files = new DirectoryInfo ( root ) . EnumerateFiles ( "*" , new EnumerationOptions { RecurseSubdirectories = true , IgnoreInaccessible = true , AttributesToSkip = FileAttributes . ReparsePoint }) . OrderByDescending ( f => f . Length ) . Take ( top ) . ToList (); foreach ( var f in files ) { var size = f . Length . Bytes (). Humanize ( "#.#" ); var age = ( DateTime . UtcNow - f . LastWriteTimeUtc ). Humanize (); Console . WriteLine ( $" { size , 10 } { f . FullName } (modified { age } ago)" ); } Two lines are new. #:package Humanizer@3.0.10 is a NuGet reference written as a directive, right in the source. The shebang we'll get to in a minute. Everything else is the C# you already write, top-level statements and all. $ dotnet run biggest.cs -- ~/.dotnet 5 Top 5 files under /root/.dotnet: 37.6 MB .../FSharp.Compiler.Service.dll (modified 46 seconds ago) 18.7 MB .../Microsoft.CodeAnalysis.CSharp.dll (modified 46 seconds ago) 18.7 MB .../Roslyn/bincore/Microsoft.CodeAnalysis.CSharp.dll (modified 45 seconds

2026-08-01 原文 →
AI 资讯

Chinese AI Models Are 10-30x Cheaper Than GPT-5.5. Here's How to Actually Use Them.

Chinese AI Models Are 10-30x Cheaper Than GPT-5.5. Here's How to Actually Use Them. I almost paid $300/month for what costs $15 Last month I was building an internal code review tool. My initial stack: GPT-5.5 for analysis, Claude Opus for refactoring suggestions, Gemini for documentation. Estimated cost: $280-320/month for our team's usage. Then I ran the same tasks through Chinese models. Same quality for our use cases. Actual cost: $14.70/month. This isn't a "Chinese models are catching up" story. They already caught up. The problem is that most Western developers don't know how to access them legally, reliably, and without getting scammed by gray-market resellers. The six models you should know These are production-ready, API-available models with English documentation and international payment support. Prices verified 2026-08-01 from official pages and Artificial Analysis. Model Best For Input (¥/1M) Output (¥/1M) vs GPT-5.5 DeepSeek V4-Flash Batch processing, simple tasks ¥0.559 ¥1.117 ~50x cheaper DeepSeek V4-Pro Coding, reasoning ¥1.806 ¥3.612 ~28x cheaper GLM-5.2 Complex reasoning, agentic tasks ¥6.09 ¥18.90 ~8x cheaper Kimi K3 Long context (1M tokens), coding ¥12.60 ¥63.00 ~5x cheaper Qwen3.7-Max Chinese/English mixed, general ¥10.50 ¥31.50 ~6x cheaper MiniMax M3 Cost-sensitive production ¥1.26 ¥5.04 ~25x cheaper Exchange rate: 1 USD ≈ 6.76 CNY. GPT-5.5 pricing: $5 input / $30 output per 1M tokens (Artificial Analysis). But are they actually good? Yes. Here's the evidence, not marketing: GLM-5.2 ranks #5 globally on aitier.net (2026-06-19), tied with GPT-5.5 (high) and Gemini 3.5 Flash (high), above Gemini 3.1 Pro Preview. Kimi K2.6 beat Claude and GPT-5.5 in a public coding challenge (thinkpol.ca, HN 380 points). Simon Willison ran GLM-4.5 Air on a 2.5-year-old laptop and built a playable game (HN 577 points). Artificial Analysis cross-provider benchmarks show the same model can vary 5-10x in throughput depending on provider. Kimi K3: 35 t/s official dire

2026-08-01 原文 →
AI 资讯

I built an AI dev team that reviews its own work — here's what I learned about multi-agent loops

Most multi-agent demos are impressive for five minutes and useless for five hours. After months of building Task Hounds — an open-source, local multi-agent development workspace — here are the design decisions that actually mattered. The setup Task Hounds runs three agents in a loop around one project: A Manager that understands context, maintains the plan, and assigns exactly one concrete task per cycle A Worker that implements the task and files a structured report: files changed, test results, known issues A Reviewer that inspects the result for bugs, UX problems, and risks — before the Manager decides what happens next A human writes a Directive (the mission), and can inject thoughts or new tasks mid-run. Everything — plans, todos, reports, feedback, live agent streams — persists in local SQLite and renders in a real-time dashboard. Lesson 1: One task at a time beats parallel everything My first instinct was parallel workers. It demoed great and shipped nothing: agents stepped on each other's files and the Manager couldn't attribute failures. Serializing to one task per loop looks slower and finishes dramatically more work. Lesson 2: Give the human a write-protected anchor Goal drift is the silent killer of long loops. Around loop 10, the plan subtly stops resembling what you asked for. Our fix: the Human Directive is copied into every session and the loop is forbidden from editing it. Only a human can change the mission. Drift now shows up as visible divergence from a fixed anchor instead of quiet mutation. Lesson 3: Structured handoffs, not chat history Passing conversation history between agents fails in two ways: it blows the context window, and it lets downstream agents anchor on upstream reasoning noise. Every hop in Task Hounds is a fixed document: the Manager's memory is an explicit JSON handoff read once per loop; the Worker's output is a fixed report schema. If the machine-readable todo JSON is invalid, the loop repairs it before any work is released.

2026-08-01 原文 →
AI 资讯

Singularity and the Chevalier in the Supermarket

My favorite metaphor for brutal cognitive dissonance — the one we will likely experience when the Singularity actually arrives — is “ the knight in the supermarket .” I prefer the word “chevalier,” though, so I’ll be using that going forward. Try to imagine the following scene: a medieval chevalier, somewhere on the land of current Germany, riding his horse, heavily armored, helmet on, big sword. The year is 1450, and our chevalier is just charging in a small battle against some equally armed neighbors. But then something happens. A short circuit in the space-time continuum and our chevalier is fast forwarded to the current times, but in the exact same location. Where, of course, there is a supermarket now. The lights. The shiny shelves with thousands of small, colored objects. The cold near the meat sector. The TVs rotating ads with faces of women talking in a slightly similar language, but saying words he cannot understand. At this moment, it’s safe to say that our chevalier is completely lost. He has no idea how light is made (no “electricity” concept in his mind), no way to know how cold is made inside a building (no “refrigerator”), no way to understand what the tiny packages on the shelves are (“chemistry” is closer to alchemy for him) and no way to understand remote communication (“television” doesn’t simply exist). He can still walk around, but the world will feel almost hostile to him. We’re Not in the Singularity. Not Yet Now let’s get back to the current X timeline, where everybody is screaming that we’re in AGI. In the Singularity. The world will never be the same. This changes everything. But does it, really? Are we experiencing the same cognitive gap as our chevalier in the supermarket? I don’t think so. The world is keep worlding right now, except for a very small percentage of people who are subjecting themselves to some AI-related psychosis. All we’ve done so far is cramming a LOT of compute into tiny digital artifacts that are nothing more than ver

2026-08-01 原文 →
开源项目

Autocomplete in vscode

Hey guys, What is currently the best tool for autocomplete in vscode given the recent changes to GitHub copilot free tier usage limits? Thanks in advance! submitted by /u/TalkHot2112 [link] [留言]

2026-08-01 原文 →
AI 资讯

Day 166 of Learning MERN Stack

Hello Dev Community! 👋 It is officially Day 166 of my full-stack engineering track! Today, I designed and implemented the active messaging canvas component ( ChatContainer.jsx ) for my messaging app, QuickChat ! 💬📷⚡ Focusing on dynamic chat alignment, text bubble rendering, image attachments, and input controls was today's core milestone. Here is how I structured the component. 🛠️ Technical Breakdown: ChatContainer & Attachment Pipeline As captured in my UI and VS Code setup ( Screenshots ): 1. Dynamic Alignment & Sender Detection Conditioned flexbox directions based on authentication state so sender messages lock to the right while recipient messages render on the left: javascript

2026-08-01 原文 →
开发者

I stopped reviewing my own code. Here's what had to be true first.

Most days now, I merge pull requests without reading the diff. That sentence used to describe someone I would not have hired. So let me be precise about what changed, because it isn't confidence and it isn't recklessness. It's that I moved the things review was catching to somewhere that catches them earlier. Here's the honest version of how that happened. The problem was arithmetic, not philosophy I run several coding agents in parallel. That produces more diff per day than I can read. Not "more than I feel like reading" — genuinely more than fits in a working day. When that happens you have exactly two options: Generate less, so it fits what you can read. Make it safe to not read. I picked the second one. Not because I'm brave, but because option 1 means throwing away the reason I set this up. The uncomfortable part: option 2 is not a mindset. It's a list of specific things that have to be true. Here's mine. 1. The rules live in a file, not in review comments Every code review I've ever done, the majority of my comments were mechanical. This function is too long. This nesting is too deep. Why is this any ? Machines can say all of that. So I made them say it, as errors : " max-lines-per-function " : [ " error " , { max : 60 , skipBlankLines : true }], complexity : [ " error " , 20 ], " max-depth " : [ " error " , 4 ], " max-nested-callbacks " : [ " error " , 4 ], Plus eslint-plugin-sonarjs with cognitive-complexity as an error, and @typescript-eslint 's strict preset — any banned, non-null assertions banned. Nothing here is novel. What's different is the next part. 2. The rules are stricter than a human team would tolerate This is the part I find genuinely interesting. If you put those thresholds on a human team, you get a PR relaxing them within a week. Not because engineers are lazy — because "this function is 63 lines and splitting it makes it worse" is sometimes true , and arguing about it every time is exhausting. Lint strictness has always been a trade-off be

2026-08-01 原文 →