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

今日精选

HOT

最新资讯

共 37249 篇
第 1751/1863 页
AI 资讯 Dev.to

6 Advanced JavaScript Questions That Separate Seniors from Mid-Levels

1. Stale closure & primitive capture What is the output of the following code? function createIncrement () { let count = 0 ; const message = `Count is ${ count } ` ; function increment () { count ++ ; } function log () { console . log ( message ); } return { increment , log }; } const { increment , log } = createIncrement (); increment (); increment (); log (); Test your understanding of closures, lexical scope, and primitive value capture. ✅ Output Count is 0 🧠 Explanation This is a classic stale closure trap — but not in the way most developers expect. Step-by-step execution: createIncrement() is invoked → new lexical environment created: count = 0 (mutable binding) message = "Count is 0" (primitive string, interpolated immediately at assignment) Inner functions increment and log are defined. Both close over the same lexical environment. increment() is called twice: count mutates: 0 → 1 → 2 ✓ This works as expected. log() is called: It references the variable message message still holds the original string value "Count is 0" The template literal was evaluated once, at the moment of assignment — not re-evaluated when log() runs. 🔑 Core Concept > Closures capture variables , not expressions . > But if a variable holds a primitive value (string, number, boolean), that value is fixed at assignment time. message is not a live reference to count . It is a snapshot . 🛠 How to fix it (if dynamic output is desired) Re-evaluate the template literal inside log() : function log () { console . log ( `Count is ${ count } ` ); } 🎯 What this question tests Concept Why it matters Template literal evaluation timing They run at assignment, not at access Primitive vs reference types Primitives are copied by value; objects/arrays are referenced Closure capture semantics Closures close over bindings, but the value of a primitive is immutable once assigned Mental model of "live" variables Not all variables in a closure are "live views" — only the bindings themselves are 2. JavaScript co

Vitaly Obolensky 2026-05-31 02:42 10 原文
开发者 Reddit r/programming

Looking at code behind File Pilot

I go over some basics and implement a simple feature live on the Wookash Podcast. It might be interesting to those who have tried File Pilot and wondered why its UI is so fast and responsive. I do some actual UI programming. Not much, since we were short on time, but enough to give you a glimpse into how it works. submitted by /u/vkrajacic89 [link] [留言]

/u/vkrajacic89 2026-05-31 02:40 5 原文
AI 资讯 Dev.to

Claude Does Not Need More Prompts. It Needs Reasoning Discipline.

Large language models are good at sounding structured. That is not the same as being structured. Ask an AI assistant to "use first principles" and it may produce a confident answer with the phrase "first principles" near the top. Ask it to "red-team this plan" and it may list generic risks. Ask it to "apply OODA" and it may give you four headings without doing the hard part: orienting against assumptions, constraints, and evidence. That failure mode is subtle because the answer looks responsible. It has the right vocabulary. It has the right shape. But the method did not actually control the analysis. I built methodology-toolkit to target that gap. The goal is not to add more clever prompts to Claude Code. The goal is to add a small layer of discipline around non-trivial decisions: classify the problem, choose methods that fit, apply those methods explicitly, verify load-bearing claims, and stress-test plans before they harden into action. Repository: https://github.com/gagharutyunyan1993/methodology-toolkit The Problem: Methodology Theater Methodologies are useful because they constrain attention. First Principles asks you to strip assumptions and rebuild from base facts. ACH asks you to compare competing hypotheses by disconfirming evidence, not by collecting confirmations for your favorite answer. OODA asks you to separate raw observation from orientation, where bias and context do most of the work. Pre-mortem asks you to imagine the plan has already failed so optimism does not screen out obvious risks. When an AI assistant merely names those methods, you get the cost without the benefit. The answer becomes longer, more formal, and more convincing, but not necessarily more correct. That is worse than a short intuitive answer because the structure creates false confidence. methodology-toolkit treats that as the core anti-pattern: If a method is named, its steps must be walked. Not hinted at. Not summarized. Applied. Methodology theater: right vocabulary, no method

Gagik Harutyunyan 2026-05-31 02:40 6 原文
AI 资讯 Dev.to

An Introduction to AI Hub, Part 2: Custom MCP Servers

Welcome back to a series of introductory articles on AI Hub, the new product feature currently in an early access program! (links: EAP Site for download, documentation ) In the last article, we covered how to create agents and agent tools directly in ObjectScript using the new %AI classes. However, sometimes, instead of creating a new agent, you just want to add some custom tools to an existing agent so you can ask your local claude code, codex, copilot or other agent of choice to query your data directly. This is where MCP Servers might come in. In this guide, we will walk through how you can create your own MCP Servers to access your data. Disclaimer: AI Hub is an early access preview, with features likely to change before production releases, any issues identified can be raised as issues on the documentation GitHub repo linked above. The EAP preview is not to be used in production settings. A very brief intro to MCP I'm going to keep this brief because there are loads of other good articles on MCP Servers Model context protocol (I recommend starting with this article from @pietro .DiLeo or this brilliant introductory video from InterSystems President Don Woodlock). Model Context Protocol is a transport protocol allowing external tools to be added to an agent . There is a discovery 'handshake' where the MCP server sends a list of tools to the MCP Client. After the tools are discovered, the agent can send requests for tool executions, including parameters, to the MCP server, which executes the tool call and returns the result. MCP servers can be remote servers, i.e. running on a different machine to a client, this usually uses a streamable http/https connection or Server-Side Events. Or MCP servers can be local servers, i.e. running on the same machine, usually using a stdio connection. An important distinction AI hub allows you to create custom MCP servers within your IRIS environment, allowing agents to access or monitor your IRIS databases, productions and statu

InterSystems Developer 2026-05-31 02:39 5 原文
AI 资讯 Dev.to

I built a RAG pipeline from scratch — no LangChain, just FastAPI + FAISS

Most RAG tutorials I found were either "pip install langchain and you're done" or 50-page academic papers. I wanted something in between — a pipeline I could actually explain in an interview, where I understood every line. So I built one from scratch. No LangChain, no LlamaIndex, no frameworks. Just FastAPI, FAISS, sentence-transformers, and an LLM API. Here's what I built, what worked, and what broke. The architecture PDF --> extract text (pypdf) --> chunk (500 char, 50 overlap) --> embed (MiniLM-L6-v2) | v question --> embed --> FAISS top-k search --> build prompt with chunks --> LLM --> answer + sources Five Python files, ~300 lines total: File Responsibility main.py FastAPI app, 3 endpoints, prompt engineering pdf_loader.py PDF text extraction via pypdf rag.py Chunking + embedding store.py FAISS vector store wrapper llm.py Swappable LLM client (Groq / OpenAI / Anthropic) How the upload works When you POST a PDF to /upload , three things happen: 1. Text extraction — pypdf reads each page and returns the raw text. Pages with no extractable text (scanned images) are skipped. 2. Chunking — each page is split into ~500-character chunks with 50 characters of overlap. The overlap prevents losing context at chunk boundaries. CHUNK_SIZE = 500 CHUNK_OVERLAP = 50 def chunk_pages ( pages ): chunks = [] chunk_id = 0 for text , page_num in pages : start = 0 while start < len ( text ): end = min ( start + CHUNK_SIZE , len ( text )) chunk_text = text [ start : end ]. strip () if chunk_text : chunks . append ( Chunk ( chunk_id = chunk_id , text = chunk_text , page = page_num )) chunk_id += 1 if end == len ( text ): break start = end - CHUNK_OVERLAP return chunks 3. Embedding — each chunk is embedded into a 384-dimensional vector using all-MiniLM-L6-v2 . This runs locally on CPU, no API call needed. Vectors are normalized so we can use inner product as cosine similarity. def embed_texts ( texts ): model = get_embed_model () # lazy-loaded singleton vectors = model . encode ( texts

Santanu Mohanta 2026-05-31 02:38 11 原文
AI 资讯 Dev.to

How I built a dependency risk scanner with Coral in 7 days

— Captain's Log entry for the Pirates of the Coral-bean Hackathon. Why this project Every developer has 5-10 side projects with rotting dependencies and doesn't know it. The 2024 xz-utils backdoor was caught by accident — one engineer noticed SSH was 500 ms slower than usual. That's how close it came. Tools like Snyk and Dependabot catch known CVEs after they're published. Nothing checks the three signals that together predict a future supply-chain attack: active CVEs · abandoned maintainer · collapsing downloads . That three-way signal only exists if you can JOIN across OSV (Google's vulnerability database), the npm registry , and the npm download API . Which is exactly what Coral does. The query that took me 6 days to earn WITH pkg AS ( SELECT name , latest_version , repository__url , time__modified AS last_publish_at FROM npm . packages WHERE package_name = : pkg ), cves AS ( SELECT affected__package__name AS package_name , COUNT ( * ) AS cve_count , MAX ( CASE database_specific__severity WHEN 'CRITICAL' THEN 4 WHEN 'HIGH' THEN 3 WHEN 'MODERATE' THEN 2 WHEN 'LOW' THEN 1 ELSE 0 END ) AS worst_sev_rank FROM osv . vulnerabilities WHERE package_name = : pkg AND ecosystem = 'npm' AND withdrawn IS NULL GROUP BY affected__package__name ), dl_month AS ( SELECT downloads FROM npm_downloads . downloads_last_month WHERE package_name = : pkg ) SELECT pkg . * , COALESCE ( cves . cve_count , 0 ) AS cve_count , COALESCE ( cves . worst_sev_rank , 0 ) AS worst_severity_rank , dl_month . downloads FROM pkg LEFT JOIN cves ON cves . package_name = pkg . name LEFT JOIN dl_month ON 1 = 1 ; One query. Three live systems — three different hosts ( registry.npmjs.org , api.osv.dev , api.npmjs.org ). Zero glue code. No ChatGPT instance on earth can run this. Verified against minimist : 2 CVEs, worst severity CRITICAL, 531M downloads/month. Day 1 — The OSV source spec OSV is a public REST API. The Coral source spec is a single YAML file, and the skeleton came together quickly. The hard part

M Rayhan Khan 2026-05-31 02:33 4 原文
AI 资讯 Reddit r/artificial

The next AI problem might not be intelligence. It might be responsibility.

AI systems are moving from answering questions to taking actions. That changes the risk. A wrong chatbot answer is annoying. A wrong action inside email, CRM, payments, customer support, or internal data can create real damage. So maybe the next big AI challenge is not just better reasoning. It is knowing: what the AI can access what it can do alone what needs approval who is accountable when it fails As AI agents become more common, who do you think should be responsible when they make a bad decision? submitted by /u/Alpertayfur [link] [留言]

/u/Alpertayfur 2026-05-31 02:28 5 原文
AI 资讯 Dev.to

Local-first: a Model on Your Own Machine, Zero Cloud

This is the concrete, runnable walkthrough for Post 1 of the Portway series . The goal: stand up a single model behind an OpenAI-compatible endpoint on hardware you already own, call it from the official OpenAI SDK, and internalize the stateless contract. Everything here runs locally for $0. What this post covers A demo.py script with two blocks: Round-trip — one chat call via the OpenAI SDK, printing the content and the usage object. Stateless proof — the same final question sent as a 1-turn message and as the last turn of a 5-turn fabricated history; both prompt_tokens values are printed alongside an explanation of the delta. Engine choice on this machine Apple Silicon Mac, 48 GB unified memory, Ollama already installed. The demo uses Ollama's OpenAI-compatible endpoint at http://localhost:11434/v1 and the gpt-oss:20b model (~14 GB). The wider Portway series uses llama.cpp on Mac (Ollama is called out as problematic for Qwen3.5 in Post 2). For Post 1 — one model, prove the contract — Ollama is fine and already on the box. Model options by available RAM The demo script works with any Ollama-served model — just substitute the model name in demo.py . The table below covers machines from 9 GB unified memory upward. Model Pull command Approx size Min RAM Notes llama3.2:3b ollama pull llama3.2:3b ~2 GB 8 GB Fastest; good for testing the contract gemma3:4b ollama pull gemma3:4b ~3 GB 8 GB Google; solid instruction-following mistral:7b ollama pull mistral:7b ~4.1 GB 8 GB Classic 7B baseline llama3.1:8b ollama pull llama3.1:8b ~4.7 GB 9 GB Best quality under 10 GB qwen2.5:7b ollama pull qwen2.5:7b ~4.4 GB 9 GB Strong at instruction + reasoning gpt-oss:20b ollama pull gpt-oss:20b ~14 GB 24 GB Used in this post's sample output On a 9 GB machine, replace gpt-oss:20b in demo.py with llama3.1:8b or qwen2.5:7b — the contract demonstration is identical. Prerequisites Ollama running locally ( curl -s http://localhost:11434/api/tags should return JSON) uv installed ( uv --version )

Dale Nguyen 2026-05-31 02:27 13 原文
AI 资讯 Reddit r/artificial

Gemini core part 4

https://preview.redd.it/pv22tsg2ib4h1.png?width=1918&format=png&auto=webp&s=dfeda1000090dc99c57c8150e4de46cfe2ba2e29 I just wanted him to give me a prompt, which then i can give to Nano Banana pro and generate me a completely random thumbnail, i wanted to test its capabilities, but instead of a prompt, he gave me this... 😭😭😭😭😭 submitted by /u/ObjectiveOrchid5344 [link] [留言]

/u/ObjectiveOrchid5344 2026-05-31 02:26 5 原文
AI 资讯 Dev.to

2487. Remove Nodes From Linked List

In this post i'm gone explain liked list an famous leetcode problem that is " Remove Nodes from linked list ". Problem Statement: You are given the head of a linked list. Remove every node which has a node with a greater value anywhere to the right side of it. Return the head of the modified linked list. Example 1: Input: head = [5,2,13,3,8] Output: [13,8] Explanation: The nodes that should be removed are 5, 2 and 3. Node 13 is to the right of node 5. Node 13 is to the right of node 2. Node 8 is to the right of node 3. Explanation: In this problem statement state that remove the nodes which have the right side (any place) element greater than. let's understand with given example. Node 13 is the right side of the 5,2 nodes thats why 2,5 should be remove. Node 8 is the right side of 3 node thats why 3 should be remove. final result would be [13,8] Solution of the problem: `/** * Definition for singly-linked list. * function ListNode(val, next) { * this.val = (val===undefined ? 0 : val) * this.next = (next===undefined ? null : next) * } */ /** * @param {ListNode} head * @return {ListNode} */ const reverList = function(head){ let prev = null; let curr = head; let next = null; while(curr!=null){ next = curr.next; curr.next = prev; prev = curr; curr = next; } return prev; } var removeNodes = function(head) { // reverse list let reversList = reverList(head); let maxNode = reversList; let prevNode = reversList; let currNode = reversList.next; // removed list while(currNode != null){ if(maxNode.val > currNode.val){ currNode = currNode.next; }else{ maxNode = currNode; prevNode.next = currNode; prevNode = prevNode.next; currNode = currNode.next; } } prevNode.next = null; // reverse list return reverList(reversList); };` If you have any query or suggestions leave your expression👨🏿‍💻🙌.

ramnayan 2026-05-31 02:22 14 原文
AI 资讯 Dev.to

C_STD : A Leak-Free, Cross-Platform Standard Library for Modern C

c_std: A Leak-Free, Cross-Platform Standard Library for Modern C Bringing the comfort of the C++ STL and Python's standard library to C17 — without leaving C A technical white paper. Executive summary C is still the substrate of the computing world — kernels, databases, language runtimes, embedded firmware, and the inner loops of nearly everything else. Yet the moment you step away from the kernel and try to write ordinary application code in C, you feel the gap: no growable vector, no hash map, no JSON parser, no string type that doesn't invite a buffer overflow. You either pull in a grab-bag of mismatched third-party libraries, each with its own conventions and failure modes, or you re-implement the same dynamic array for the hundredth time. c_std is an attempt to close that gap deliberately and coherently. It is a single, consistent library — written in pure C17 — that reimplements a large slice of the C++ Standard Library (containers, algorithms, smart pointers) alongside many Python-style conveniences ( json , regex , random , statistics , csv , config , even turtle graphics). It targets Windows and Linux from one source tree, compiles cleanly under -Wall -Wextra , and — this is the part I care about most — is verified leak-free under Valgrind , module by module, example by example. This paper explains the design philosophy, the architecture, and the engineering discipline that makes a library like this trustworthy enough to build on. 1. The problem: C's missing middle Every C programmer knows the two extremes. At the bottom, the language itself: pointers, malloc , memcpy , raw arrays. At the top, whatever the platform hands you — <windows.h> or POSIX, OpenSSL, a JSON library someone wrapped a decade ago. The middle — the layer the C++ STL and Python's batteries-included standard library occupy — is missing. That missing middle has a real cost. It shows up as: Re-invention. Teams write their own vector, their own string builder, their own linked list, each subt

amin tahmasebi 2026-05-31 02:20 7 原文
AI 资讯 Dev.to

How to build your professional network as a developer — authentic strategies

How to build your professional network as a developer — authentic strategies Building a Genuine Professional Network in Tech: A Practical Guide for Introverts and Extroverts Networking in tech isn’t about collecting business cards or forcing yourself to “work the room.” It’s about building real relationships with people you can learn from, collaborate with, and support over the long term. Whether you’re an introvert who prefers deep one-on-one conversations or an extrovert who thrives in crowds, you can build an authentic network that opens doors to mentorship,Jobs, collaborations, and career growth. Redefine Networking: It’s About Relationships, Not Transactions Forget the image of awkward name tags and empty promises to “grab coffee sometime.” Real networking is: Swapping war stories about debugging nightmares Sharing a job posting with someone who’d be a great fit DMing a speaker to say their talk inspired you Helping someone solve a problem without expecting anything back Quality over quantity isn’t just a buzzword-it’s your career strategy. You need 5-10 real connections, not hundreds of superficial contacts. Leverage Twitter (X), LinkedIn, and Dev Communities Effectively Twitter/X for Developer Networking Dev Twitter is alive and vibrant. Use it to: Share what you’re learning (builds credibility) Comment thoughtfully on others’ posts (starts conversations) DM speakers after webinars to say you enjoyed their talk Join tech conversations using relevant hashtags (#100DaysOfCode, #BuildInPublic) LinkedIn Profile Optimization Write a clear headline that explains what you do and what you’re curious about Share project updates, lessons learned, or thoughtful commentary on industry trends Join niche developer groups related to your tech stack Send personalized connection requests mentioning something specific you admired about their work Developer Communities (Discord, GitHub, Open Source) Join Discord servers for your favorite languages/frameworks Contribute to open

Rizwan Saleem 2026-05-31 02:20 7 原文
AI 资讯 Reddit r/artificial

🚀 Prompt Logic Gates (PLG): Are Prompts Becoming Systems?

GitHub: Prompt-Logic-Gates-PLG Over the past few days, I've shared my research project Prompt Logic Gates (PLG) and received a lot of interesting feedback. Some people loved the idea, some were skeptical, and many raised valid questions. The most common reaction was: > "Natural language is already the abstraction layer. Why add logic gates?" That's a fair question. My goal isn't to replace natural language prompting. In fact, natural language remains at the center of PLG. The idea is to explore what happens when prompts stop being a single request and start becoming systems. The Problem When we write prompts, we're converting our ideas, requirements, constraints, and expectations into text. For simple tasks, this works perfectly. But as prompts grow, they often include: Multiple objectives Business rules Style constraints Context dependencies Exclusions Fallback instructions Tool orchestration At that point, prompts become harder to maintain. Contradictions appear. Priorities become unclear. Context gets mixed together. The prompt is still text, but the complexity starts to resemble a system. What is PLG? Prompt Logic Gates (PLG) is a visual prompt engineering experiment that explores whether prompts can be organized before being sent to an AI model. Instead of writing one giant prompt, users create prompt components and connect them using semantic logic gates. The AI then analyzes the graph and compiles a final structured prompt. How It Works AND Gate When multiple instructions exist, the system evaluates them against the current context and determines which instruction is more foundational. The higher-priority instruction is applied first. OR Gate When multiple options are available, the system selects the most contextually relevant option instead of blindly including everything. NOT Gate Defines exclusions and negative constraints. It explicitly tells the system what should not be done, reducing contradictions and ambiguity. Ask Questions Gate If the system detec

/u/withsj 2026-05-31 02:19 6 原文
AI 资讯 Reddit r/programming

When Architecture Diagrams Stop Scaling

Interesting engineering write-up from Netflix on maintaining a real-time service topology in a large microservices ecosystem. The takeaway for me: observability isn't just about metrics, traces, and logs—understanding service relationships is equally critical as systems scale. Curious how others approach dependency mapping in production environments. https://netflixtechblog.com/from-silos-to-service-topology-why-netflix-built-a-real-time-service-map-0165ba13a7bc submitted by /u/mukeshsri369 [link] [留言]

/u/mukeshsri369 2026-05-31 02:18 5 原文
AI 资讯 Reddit r/artificial

"Act as..." effectiveness

Do you use the "Act as..." segment in your prompts? Do you think it's effective and why? I know it depends on the rest of the prompt, as well as the main goal, but i'm asking if it's working overall. submitted by /u/ObjectiveOrchid5344 [link] [留言]

/u/ObjectiveOrchid5344 2026-05-31 02:17 5 原文
AI 资讯 Reddit r/webdev

I made a game where you draw country borders from memory

Hi r/webdev ! I've been building my geography games site for a while now, and I just added a new game I wanted to share with you called Draw the Country . The idea is simple: you get a country name and a blank canvas, you sketch the border, and then the real outline slides over your drawing so you can see how close you got. You can play freehand, or draw with border anchors guiding you if you want it easier or you just want to learn. There's also a daily freehand challenge same country for everyone, every day. It's completely free. No ads, no sign-up. It's built with Nuxt, Vue, Tailwind, and Supabase. Check it out: https://www.geographygames.net/draw-country Any feedback is appreciated and I hope you enjoy it! PS: The video is recorded on my laptop so drawing with the trackpad is a bit tricky. submitted by /u/ExtremeMotor3772 [link] [留言]

/u/ExtremeMotor3772 2026-05-31 02:11 5 原文