Dev.to
Idempotency Keys: The One API Pattern That Prevents Duplicate Payments (and Worse)
You hit "Submit Order" and nothing happens. The spinner just spins. Is it processing? Did the request get lost? You click again. If the API on the other end does not implement idempotency, you just placed two orders. Maybe two charges to your card. This is a solved problem — and the solution is simpler than you think. What Is Idempotency? An operation is idempotent if doing it multiple times produces the same result as doing it once. GET requests are naturally idempotent — fetching a resource does not change it. DELETE is also idempotent in practice. The trouble is POST and PATCH : create an order twice, and you get two orders. An idempotency key is a client-generated unique identifier (usually a UUID) that you send with a mutating request. The server stores this key with the result. If the same key arrives again — whether due to a retry, a network blip, or an impatient user — the server returns the cached result instead of executing the operation again. Implementing Idempotency on the Server Here is a minimal Express implementation backed by Redis: const express = require ( " express " ); const redis = require ( " ioredis " ); const { v4 : uuidv4 } = require ( " uuid " ); const app = express (); const cache = new redis (); app . use ( express . json ()); // TTL for idempotency records: 24 hours const IDEMPOTENCY_TTL = 86400 ; async function idempotencyMiddleware ( req , res , next ) { const key = req . headers [ " idempotency-key " ]; if ( ! key ) return next (); // optional on GET/DELETE const cached = await cache . get ( `idem: ${ key } ` ); if ( cached ) { const { status , body } = JSON . parse ( cached ); return res . status ( status ). json ( body ); } // Intercept the response to cache it const originalJson = res . json . bind ( res ); res . json = async ( body ) => { if ( res . statusCode < 500 ) { await cache . setex ( `idem: ${ key } ` , IDEMPOTENCY_TTL , JSON . stringify ({ status : res . statusCode , body }) ); } return originalJson ( body ); }; next ();
Mean
2026-05-31 11:02
👁 5
查看原文 →
Dev.to
CONFIGURING SEMANTIC MODEL IN POWER BI
INTRODUCTION Configuring a Power BI semantic model involves refining data structures, creating relationships, and setting up calculations. Semantic model is the last stop in the data pipeline before reports and dashboards are built. It is the end product of the raw data that has been extracted, transformed, loaded, modeled, built relationship, and written calculation. The Semantic model consist of Data connections to one or more data sources, Transformations that clean and prepare the data for reporting, Defined calculations and metrics based on business rules to ensure consistent reports and Defined relationships between tables. Key words to note in Semantic Modelling are; 1. Fact table and Dimension table: The Fact table records the quantitative and numerical data. It is where every single details are recorded. The Dimension table act as the descriptive companion to the fact table, containing the attributes or characteristics that provide context to the data. 2. Primary and Foreign Key: Primary Keys are unique identifier assigned to a specific record with a database table ensuring that no two rows are identical or repeated. foreign Keys are columns or group of columns in one table that provides a link between data in two tables by referencing the primary key of another. 3. Star Schema Star Schema is a data modeling technique where a central fact table is surrounded by several dimension tables that provide descriptive content. 4. Cardinality Cardinality defines the kind of relationship between two tables. They are; One to Many (1.*) Many to one (*.1) One to One (1.1) Many to Many ( . ) The cardinality of a relationship is described by the "one" (1) or "many" (*) icons located at the ends of the relationship line. 5. Cross Filter Direction The direction determine how filters propagate. Possible cross filter options are dependent on the relationship cardinality type. One to Many - Single or Both sides One to One - Both sides Many to Many - Single to either table or b
Timothy Atinuke
2026-05-31 11:01
👁 11
查看原文 →
Reddit r/webdev
How To: Re-engineer element to create pagination type layouts - walkthru pages/guides, etc...
This requires both CSS and JS, but is otherwise fairly lightweight and minimal. You can see the effect in action here: https://stephenmthomas.github.io/ico2go/ (Just drag and drop the "ICO2GO" logo in the upper left down into the drop zone to begin the conversion. Its also a single filed - embedded CSS and JS so right click view source, save, whatever...) I recently built an SVG to ICO converter (couldn't find one online that did exactly what I wanted, though doubtless one exists) - and I decided for really no reason at all to tweak the details summary elements to serve the main areas of the document in a "step 1 2 3" fashion. I had styled the elements with CSS already - initially to serve as an "about this app" sections - styling it so it fades in and slides to size. Then decided to just use them as a sort of walkthrough wizard... I'm going to present the steps backwards because the CSS at the bottom is technically optional, although it adds a nice touch and I highly recommend both using that CSS and saving it for later use - its a good way to style those elements outside of this somewhat ridiculous use-case. So, essentially, we are going to be using scaffolding like this - completely hidden sections of the page, as large or small as you want, able to be turned on, off or toggle as you see fit. Each page or section or chapter of the DOM will live inside of a detail summary block like so: <details id="areaHelloWorld"> <summary style="display: none;">HIDDEN AREA - HELLO WORLD/summary> <!-- YOUR CONTENT HERE --> </details> Debatable practice abound here, but because the summary is hidden and inlined, you can still use normal detail-summary sections elsewhere. Anyway, depending on your content... there are now sections of the DOM that are unrendered. There is no conventional way - as far as I know - to open/reveal the content in the details section when the summary is not displayed. To hide or show these areas, you simply add the open attribute to the appropriate detai
/u/woroboros
2026-05-31 10:50
👁 5
查看原文 →
Reddit r/webdev
I'm looking for an Android Studio template that build Apk from Html ?
HI people. I'm looking for a template like that. I made a simple Html note app by Claude and want to make it a propher Android app. I don't know coding. I don't think i want to spend year learning this too. I make it just for personal use and won't publish it on google story or anywhere else. I liked Web2apk Builder but it's not free (i don't have money, honestly). But with Android studio i have to deal with hundreds unknow unknow so i wonder if there is a template outhere (maybe on github) that could help me out ? Thank you for your attention to this matter !!! submitted by /u/Moonnnz [link] [留言]
/u/Moonnnz
2026-05-31 10:33
👁 6
查看原文 →
Reddit r/MachineLearning
[D] Monthly Who's Hiring and Who wants to be Hired?
For Job Postings please use this template Hiring: [Location], Salary:[], [Remote | Relocation], [Full Time | Contract | Part Time] and [Brief overview, what you're looking for] For Those looking for jobs please use this template Want to be Hired: [Location], Salary Expectation:[], [Remote | Relocation], [Full Time | Contract | Part Time] Resume: [Link to resume] and [Brief overview, what you're looking for] Please remember that this community is geared towards those with experience. submitted by /u/AutoModerator [link] [留言]
/u/AutoModerator
2026-05-31 10:30
👁 5
查看原文 →
Reddit r/MachineLearning
Bayesian Opt. GPs vs Linear models and Neural Networks for parameter optimizations [R]
Hi, Relatively new to deep learning. I wanted some opinions on which of these approaches might be best for time series data and spectral analysis. I currently use a GP and it works pretty well, but I’m wondering what the computational tradeoffs and so forth might be. Any ideas? submitted by /u/InevitableCut1243 [link] [留言]
/u/InevitableCut1243
2026-05-31 09:57
👁 5
查看原文 →
Reddit r/artificial
mlx-code — local LLM coding agent for Apple Silicon
Lightweight local coding agent with emphasis on subagenting rather than stuffing everything into one giant context. The idea is to reduce context rot and kv cache size so as to scale to larger coding tasks using focused parallel workers. submitted by /u/Turbulent-Guest154 [link] [留言]
/u/Turbulent-Guest154
2026-05-31 09:35
👁 6
查看原文 →
Reddit r/artificial
Llama Surgery: Continuous Sparsification of Pre-Trained Language Models via Differentiable Ultrametric Topology Injection
Sequel to: Learning to Skip Blocks: Self-Discovered Ultrametric Routing for Hardware-Accelerated Sparse Attention Abstract We present Llama Surgery , a method for injecting learned block-sparse attention topologies into pre-trained dense language models without retraining from scratch, distillation, or post-hoc pruning. Starting from a frozen Llama 3.1 8B, we surgically replace each attention layer with a Dynamic Topology Router that maps token embeddings onto the branches of a Bruhat-Tits p-adic tree via factorized Gumbel-Softmax routing. A Continuous Logit Homotopy guarantees that at initialization the injected topology bias is identically zero, preserving the pre-trained manifold exactly. Over training, temperature annealing polarizes the soft routing assignments into hard binary masks, and a Switch Transformer-style load-balancing loss prevents routing collapse. We identify and resolve two critical failure modes: (1) gradient collapse through discrete masking operations, solved by a Straight-Through Estimator bridge that decouples the hard forward mask from the soft backward gradient; and (2) Attention Sink instability, where hard-masking the initial token causes softmax entropy collapse and syntactic degeneration, solved by permanently anchoring Token 0 in the visibility set. The resulting architecture is validated on Llama 3.1 8B fine-tuned on WikiText-2, achieving stable convergence and producing coherent, mathematically sophisticated text while maintaining dynamic block-sparse routing across all 32 transformer layers. A custom Triton forward kernel with Attention Sink and Local Window support, pipelined for Ampere and Hopper architectures ( num_warps=4 , num_stages=3 ), executes the block-sparse prefill phase at O(N) theoretical complexity. To our knowledge, this is the first demonstration of differentiable ultrametric topology injection into a production-scale pre-trained LLM. https://github.com/sneed-and-feed/adelic-spectral-zeta/blob/main/papers/llama_sur
/u/LooseSwing88
2026-05-31 09:34
👁 5
查看原文 →
Reddit r/artificial
Candide question
My understanding is that AI won’t do anything if we don’t ask him something, so i was wondering what will happen to AI if no one ask him to do anything. submitted by /u/mansithole6 [link] [留言]
/u/mansithole6
2026-05-31 09:32
👁 5
查看原文 →
Reddit r/webdev
Need some advice from my peers who have gained some years of experience
Hey folks i am reaching out in a bit of distress. i am software engineer i been in the industry for 3 years 2 years as a freelancer and over a year as a corporate employee. I have shipped hundreds of features, fixed legacy code base others wouldn't dare to touch. My latest feat was to ship a fully fledged Crypto Trading platform to production. My clients are secretive but their projects are really interesting. Multi encryption dashboards with AES. And what not. Automations through kestea. Long story i have massive exposure to industry practices and modern trends in tech. i am writing APIs in Elysia and Go. Changing legacy redux to modern zustand. I am experienced with docker and Kubereeties and i manage multiple servers for my clients. I kinda lean towards bare metal more What im struggling at is im getting paid dirt cheap cause i live a 3rd world country. 300 dollars/ month. I been struggling to get clients online and so much so i have spent hundreds of dollars on upwork and been trying different platforms. But nothing. I know its a luck's game too but i still feel like im doing smth wrong. My rates are all over the place i have charged clients 30$/ hour and im getting paid like 300/ month at the same time If i do find a client its someone local who also pays dirt cheap but way more then my job does very rarely i am satisfied with the work I've given. The argument my job place gives is i lac experience and we don't have clients. What should i do form here on out im getting anxious about my future and doubting myself now. Like i know how the code works how systems work what the trend is but getting client's is where i am struggling Ps i am working 2 jobs like 15-16 hrs a day one is my secure permanent job that pays dirt cheap and other ones are my freelance cleints that pay me decently ig. But i find them once every 3 months Ps ill appreciate some reconditions Oh and another PS : i made a promotional post earlier and was lazy to edit that so now i made a full post
/u/TheLoveDoctor_
2026-05-31 09:13
👁 5
查看原文 →
HackerNews
Anyone seen a CC- serial prefix on legacy networking hardware?
don't want to file a decom report with a gap so I figured I would ask here. On a contract job clearing out a data center doing routine stuff like taking inventory and audits before we decommission hardware. The issue is there is one node that keeps coming back that isn't in the documentation. ip is in the 46.28.x.x range Its not in the facilities registry though. Ran it through RIPE and ARIN to find nothing. The latency is what is getting me though. 0.4 round trip every time. Tested from multipl
Throwaway_sys
2026-05-31 09:01
👁 2
查看原文 →
Dev.to
Octorato: an open-source AI agent OS with built-in per-client FinOps
Most agent frameworks assume one agent, one app, one bill. The moment you run agents for many clients, two problems appear that no runtime solves for you: you can't prove which client burned which tokens , and nothing stops one client's workspace from leaking into another's . I built Octorato to fix exactly that. What Octorato is Octorato is an open-source AI agent operating system: one file-native "brain" — rules, 190+ skills, 180+ specialist agents, all plain markdown under git — that a single operator runs across many sealed client "arms," with per-client token attribution and opt-in budget caps. It's not a runtime you import. It's the agent's self as files you can read, diff, fork, and own — runtime-agnostic (it runs on Claude Code today). The octopus model One brain , many arms . The brain holds the shared self: rules (the constitution), skills (HOW to do things), agents (WHO does them). Each arm is a sealed deployment serving exactly one client. Knowledge flows down (generic skills cascade to every arm) and lessons flow up (anonymized patterns get distilled back into the brain). Like a real octopus, most of the neurons live in the arms, not the head. Why "file-native" matters Your agent's identity, skills, and memory normally live trapped inside vendor code and a cloud console — you can't read the whole self, diff a change, or move it. Octorato keeps all of it as plain markdown under version control. Identity becomes diffable, reviewable, portable, and ownable . Text outlives runtimes. The part nobody else does: FinOps and isolation are the same wall Because each arm is a sealed cell that no other arm can see, every token an arm spends is attributable to exactly one client by construction. Cellular isolation is per-client FinOps — the wall that seals a client is the wall that meters it. Concretely: per-arm USD rollup (estimated from local session logs at list price), cost-spike alerts, and an opt-in PreToolUse budget gate — wire the hook and set a client's cap
dataqbs
2026-05-31 08:42
👁 9
查看原文 →
Dev.to
RAG Explained for Beginners: How AI Assistants Stop Making Things Up
I once submitted an essay with three citations that I hadn't personally verified. The AI had suggested them, and they sounded right. None of them existed. That's not a quirk or a bug — it's exactly how LLMs work. And once you understand why, a technique called RAG starts to make a lot of sense. AI assistants are remarkably good at sounding right. The model isn't lying — it's doing its best with what it knows. The problem is that what it knows has limits, and it doesn't always know where those limits are. Ask one about a recent event, a niche regulation, or anything from a source it's never seen — and it fills the gap anyway. Confidently. That's the gap RAG was built to close. Once you understand how it works, you'll have a much clearer picture of why some AI tools are genuinely reliable and others are just very convincing guessers. Here's what's actually going on. First, What's the Problem? Large language models (LLMs)—the technology powering AI assistants like ChatGPT and Claude—are trained on vast amounts of data from across the internet. That training gives them a remarkable ability to reason, summarize, and generate content. But it also comes with some real limitations: They have a knowledge cutoff. An LLM trained last year doesn't know what happened last month. They can hallucinate. When they don't know something, they don't say "I don't know"—they generate a confident-sounding answer anyway. Wrong facts, fake statistics, invented sources. All delivered with a straight face. They don't know your specific sources. Think of a software engineer asking an AI assistant about their company's internal API documentation, deployment runbooks, or architecture decisions. None of that is in the training data. The model has never seen it — and it will still try to answer. The model isn't lying — it's generating the most plausible answer it can. It just has no way to know when it's wrong. So, what do you do when you need an AI that's accurate, current, and knows your specifi
aashna mahajan
2026-05-31 08:41
👁 10
查看原文 →
Dev.to
I don't want to write HTML or fight global CSS, so I built a TypeScript DSL
TL;DR I got tired of writing HTML and chasing global CSS rules. I had a hunch: what if you could write a page the same way you write an app — same declarative tree, same modifier chains, scoped style per node? I spent a year quietly testing the bet on my own side projects. It... seems okay? I've open-sourced it as DraftOle ( npm / live demo ). page() writes plain static HTML + scoped CSS — zero runtime JavaScript shipped. app() adds reactive state() and event handlers — TypeScript arrow functions get serialized into a minimal runtime at build time. Same DSL, same modifiers, in both cases. No bundler, no JSX, no template language, zero production dependencies. pnpm add draft-ole # or npm install draft-ole # or yarn add draft-ole This is the 0.9.0 pre-1.0 release. The API surface is essentially settled and 1.0 is the next tag, but I'm intentionally holding back the 1.0 promise until I hear from real users. If you try it and it feels great or terrible, please tell me — both signals are useful. (Yes, AI can generate HTML/CSS now. I'm not making a claim about how DraftOle compares — that's a separate experiment I haven't run. This article is just about what I built and why.) ## Honestly? I just don't want to write HTML or global CSS anymore Let me be candid about the motivation. It's not a refined "type safety extends to the leaves" pitch. It's two embarrassingly small frustrations I kept hitting on every side project. 1. I don't want to write HTML I'm building logic in TypeScript — typed values, typed functions, typed data flow — and then at the last mile I have to drop into stringly-typed HTML. Attribute names are strings. Class names are strings. Five levels of nesting and I can't tell which element carries which style anymore. The logical layer is type-safe, and then the presentation layer reverts to "paste these strings together carefully." That mismatch grates every time. 2. I don't understand global CSS CSS-in-JS, CSS Modules, Tailwind — pick your weapon, eventual
kazuyuki shimizu
2026-05-31 08:40
👁 11
查看原文 →
Dev.to
FSx for ONTAP Audit Logs with Data Residency in your region with Sumo Logic
TL;DR We built a serverless Lambda pipeline that ships FSx for ONTAP audit logs to Sumo Logic's JP (Tokyo) region deployment. For Japanese enterprises with data residency requirements under APPI (Act on the Protection of Personal Information), this means audit logs never leave Japan. FSx for ONTAP → S3 Access Point → EventBridge Scheduler → Lambda → Sumo Logic HTTP Source (JP) │ ▼ ┌───────────────────┐ │ Sumo Logic JP │ │ (Tokyo) │ │ │ │ • 500 MB/day FREE │ │ • Data stays in │ │ Japan │ │ • 7-day retention │ │ (free tier) │ └───────────────────┘ Key advantages: 500 MB/day free tier (~15 GB/month) — covers most FSx for ONTAP deployments at zero vendor cost JP region deployment — data residency in Tokyo Simplest auth model — URL-embedded token, no header management 30-minute end-to-end — HTTP Source URL is the only credential needed Verified on Sumo Logic JP region. Logs searchable via _sourceCategory=aws/fsxn/audit . This is Part 12 of the Serverless Observability for FSx for ONTAP series. Why Sumo Logic for Japanese Enterprises? For organizations operating under Japanese data protection regulations, the choice of observability platform often comes down to one question: where does the data physically reside? Requirement Sumo Logic JP Other Options Data residency in Japan ✅ Tokyo deployment Varies by vendor APPI compliance consideration ✅ Data stays in JP May require cross-border assessment Free tier for validation ✅ 500 MB/day Most offer 14-day trials only No agent installation ✅ HTTP Source (agentless) Some require collectors Sumo Logic's JP deployment ( service.jp.sumologic.com ) processes and stores all data within Japan, making it a straightforward choice for organizations that need to demonstrate data residency compliance. Compliance note : This integration provides a technical path for data residency. Evaluate your specific regulatory requirements with your compliance team — data residency alone does not constitute full regulatory compliance. Architecture ┌────
Yoshiki Fujiwara(藤原 善基)@AWS Community Builder
2026-05-31 08:37
👁 12
查看原文 →
Reddit r/artificial
Zig president says AI coding contributions are 'invariably garbage,' so he banned them
submitted by /u/Hot-Upstairs9603 [link] [留言]
/u/Hot-Upstairs9603
2026-05-31 08:37
👁 7
查看原文 →
Reddit r/webdev
I built a tool to visualize architectures and visualized popular web frameworks
Hi all, my friends and I build an open-source tool which uses static analysis and a slim layer of LLMs to visualize the architecture of a project. The tool is open-source: https://github.com/CodeBoarding/CodeBoarding We have also generated quite a few projects over time you can find them all on github as well: https://github.com/CodeBoarding/awesome-architecture-mds What are some projects that are interesting to you, I will visualize them to see how are they build! submitted by /u/ivan_m21 [link] [留言]
/u/ivan_m21
2026-05-31 08:33
👁 6
查看原文 →
Dev.to
My website has two audiences now. I only built for one of them.
The conversation about who reads your website has been shifting. Agents are part of it now. ChatGPT fetches URLs. Perplexity reads content. Shopping agents try to complete purchases. Coding agents hit your API. Most of those products were built for humans, tested against humans. The agents showed up later and quietly. When they can't figure something out, they don't complain. They just bounce. I heard the phrase "second audience" at a hackathon where you.com was one of the hosts. It stuck. That's what agents are: a second audience the web wasn't designed for and isn't being measured against. And now, I want to build something about it. A scanner that tells you what an AI agent experiences when it tries to use your website or your API. The internal name is Perseus Clew and the public product is Agentis Lux. The split is intentional: Perseus Clew is the engine name, part of a suite of AI builder tools , and Agentis Lux is the product-facing name (Latin for "light of the agent") that describes what agent users see. This isn't a launch post. I just finished a docs phase, and I'm about to write code. Before I do, I want to put this in front of dev.to builders and find out what I'm missing. What it will do Three layers: Deterministic scanning. Twelve check categories — six for frontends, six for APIs — looking at HTML, ARIA, structured data, OpenAPI specs, error responses, idempotency patterns. Same input, same score, every time. The methodology will be published, the weights will be public, and anyone can audit it. AI-readiness scoring tools have a reputation for inflating numbers and hiding their methodology, so the trust floor is making everything inspectable. That's the foundation the rest sits on. An AI-written verdict. After the score, a Bedrock call reads the top findings and writes one sentence about what an agent experiences. Something like: "An agent visiting this page can read your product descriptions, but can't tell which button starts checkout, so it can't f
L. Cordero
2026-05-31 08:32
👁 6
查看原文 →
Dev.to
AI-Powered Root Cause: Correlating File Access with APM via Dynatrace
TL;DR We built a serverless Lambda pipeline that ships FSx for ONTAP audit logs to Dynatrace via the Log Ingest API v2. The real value: Dynatrace's Davis AI can automatically correlate file access anomalies with application performance degradation — answering "why is the app slow?" with "because 500 users hit the same NFS share simultaneously." FSx for ONTAP → S3 Access Point → EventBridge Scheduler → Lambda → Dynatrace Log Ingest API v2 │ ▼ Davis AI ┌───────────────────┐ │ Correlates: │ │ • File access │ │ anomalies │ │ • APM metrics │ │ • Infrastructure │ │ health │ │ │ │ → Root cause │ │ in seconds │ └───────────────────┘ Verified on Dynatrace SaaS Trial (Tokyo-equivalent region). Logs visible in Logs Viewer within 1-2 minutes. This is Part 11 of the Serverless Observability for FSx for ONTAP series. Why Dynatrace for FSx for ONTAP? Most observability tools treat storage logs as isolated data. Dynatrace is different — it builds a topology map of your entire stack and uses Davis AI to find causal relationships through time-window correlation and entity connectivity: Scenario Without Dynatrace With Dynatrace App latency spike "Check the logs" Davis AI detects temporal correlation: file access to /vol/data/ increased 10x within the same 5-minute window as app response time degradation, connected via topology (app → NFS mount → SVM) Storage I/O anomaly Manual investigation Automatic correlation via shared topology entities — Davis identifies which services are affected based on entity relationships User reports slow file access Grep through audit logs DQL query + topology view showing the full dependency path from user request to storage operation The key differentiator: Davis AI correlates events across entities that share topology connections within overlapping time windows — not just keyword matching or manual dashboard correlation. Architecture ┌─────────────────────────────────────────────────────────┐ │ Event Sources │ ├─────────────────────────────────────────
Yoshiki Fujiwara(藤原 善基)@AWS Community Builder
2026-05-31 08:26
👁 11
查看原文 →
Reddit r/artificial
built a small open source tool to stop AI agents from regressing after changes
one of the most annoying problems when building AI agents: fix a failure, change something, same failure comes back quietly. built replayd for this. captures failed runs as regression tests and replays them before you ship. catches the failure if it returns after a prompt, model, or tool change. v0.1.2, pip installable, open source. pip install replayd star it if you want to follow progress. submitted by /u/taimoorkhan10 [link] [留言]
/u/taimoorkhan10
2026-05-31 08:24
👁 5
查看原文 →