SShortSingh.

Programming

0
ProgrammingDEV Community ·

How to fix Python full-text search failing to index C++, C#, and R&D terms

Python's Whoosh search library uses a standard text analyzer that treats symbols like &, +, and # as word boundaries, causing tech terms such as C++, C#, R&D, and .NET to be stripped out during indexing. As a result, searching for these terms returns zero results even when they appear in the source text. Widening the default word pattern globally is discouraged, as it can corrupt tokenization for ordinary text across an entire corpus. A targeted fix involves building a custom RegexTokenizer that prioritizes specific patterns for symbol-bearing tech tokens while leaving standard word rules intact. Applying this scoped TechAnalyzer to the relevant field in Whoosh ensures tech terms are correctly indexed and matched at query time without affecting unrelated content.

0
ProgrammingDEV Community ·

Microservices vs Monolith: Why Rate Limiting Comes Down to Shared State

A software engineering team facing API latency spikes during traffic surges began evaluating whether their rate limiter should live inside their existing monolith or be extracted into a microservice. In a monolith, rate-limiting state can be stored in memory since all requests run through the same process, making enforcement straightforward. However, in a microservices architecture, each independently scaled instance maintains its own in-memory counter, causing the effective rate limit to multiply with every additional instance. The recommended solution is to centralize the shared counter in a fast external datastore such as Redis, which all service instances consult before processing a request. This approach ensures exact limit enforcement regardless of scale, delivers sub-millisecond latency, and simplifies monitoring and tuning to a single location.

0
ProgrammingHacker News ·

Developer Experiments with Moving AI Reasoning Into Latent Space on DeepSeek

A developer has shared an experimental project that attempts to shift the 'thinking' process of DeepSeek's AI model into latent space, rather than performing it in the standard token output space. The approach, dubbed 'latent reasoning,' packages this modified reasoning mechanism as a standalone model. The project was shared on Hacker News as a personal showcase post, attracting modest early attention. Details of the methodology are outlined on the developer's personal blog. The work appears aimed at exploring more efficient or internalized reasoning architectures for large language models.

0
ProgrammingDEV Community ·

How to Build Reliable Webhook Handlers: Retries, Idempotency, and Deduplication

Webhooks commonly fail in production due to network timeouts, slow endpoints, and duplicate deliveries, as senders like Stripe and GitHub retry any request that does not receive a timely 2xx response. This at-least-once delivery model means receivers can process the same event multiple times, making idempotency a critical responsibility of the handler, not the sender. The recommended fix is to store a stable provider-supplied event ID in a database with a unique constraint, using an atomic insert to reject duplicates before any side effects are applied. Wrapping both the deduplication claim and the business logic in a single database transaction prevents partial failures from causing inconsistent state. Applying these patterns — fast acknowledgment, database-backed deduplication, and transactional side effects — eliminates most categories of webhook-related production incidents.

0
ProgrammingDEV Community ·

Developer builds open-source TypeScript library to model SCHD dividend growth

A software developer has released an open-source TypeScript library called dividend-math, designed to simulate dividend reinvestment growth over time. The library centers on a pure function called dripCalculator, which models year-by-year share accumulation, price appreciation, and dividend growth. It was built to illustrate how ETFs like SCHD, which have historically grown dividends at roughly 10–12% annually, can outperform higher but stagnant yields over long holding periods. The tool powers several calculators on dividendpayoutcalculator.com, including a dedicated SCHD calculator that accounts for quarterly dividend payments. The library is available on npm under an MIT license, with source code hosted on GitHub.

0
ProgrammingHacker News ·

Engineer revives four-year-old reMarkable 2 tablet using SSH access

A hobbyist successfully restored a four-year-old reMarkable 2 e-ink tablet that had stopped functioning properly. The fix was documented in a personal blog post published on August 9, 2026. The process involved accessing the device over SSH, a secure remote shell protocol that reMarkable devices support by default. The author shared technical steps taken to diagnose and revive the hardware without replacing it. The project highlights how SSH access can extend the lifespan of consumer electronics through DIY repair.

0
ProgrammingDEV Community ·

How ESP32's LEDC Module Uses PWM to Control LED Brightness

The ESP32 microcontroller includes a built-in peripheral called LEDC (LED PWM Controller) that dims LEDs using Pulse Width Modulation, a technique that switches LEDs on and off faster than the human eye can detect. The original ESP32's LEDC module contains 4 timers and 16 channels, all configured by writing to 32-bit peripheral registers. Dimming an LED requires three main steps: configuring a timer with the desired frequency and bit resolution, linking an LEDC channel to that timer, and writing a duty cycle value to set brightness. Once configured, the LED runs autonomously at the set brightness with no CPU involvement, and brightness can be updated at runtime by writing a new duty cycle value or triggering a hardware-managed smooth fade.

0
ProgrammingDEV Community ·

Distributed Storage Explained: How It Works and When It Makes Sense

Distributed storage spreads data across multiple nodes so that individual hardware failures do not cause outages or data loss, unlike single-node systems where one crash can mean total downtime. Around 68% of mid-size and larger organizations already run distributed storage, with high availability and failure tolerance cited as the primary driver by 74% of them. Core mechanisms include consistent hashing to distribute data across nodes, replication for hot data, and erasure coding for capacity-sensitive cold storage. Systems must also choose between strong consistency, which prevents data conflicts but may reduce availability during network splits, and eventual consistency, which prioritizes uptime at the risk of temporary staleness. Experts caution that distributing too early adds significant complexity, cost, and a steep learning curve, making single-node setups the practical choice for workloads under 10TB with no strict uptime requirements.

0
ProgrammingDEV Community ·

Silent 200 Responses Can Hide Empty Pages in Automated Policy Checks

A developer running automated legal-document checks discovered their script was silently passing client-rendered pages that returned HTTP 200 but contained almost no actual text. Pages like peerlist.io/terms and daily.dev/terms delivered under 100 characters of content — essentially empty JavaScript shells — while a real legal document typically contains 20,000 or more characters. Because the script used a negative assertion, treating 'no clause found' as a pass, an empty document produced the same result as a genuinely clean one. The Substack publisher agreement, which contained a clause the developer needed to flag, was nearly missed entirely due to this flaw. The fix involves validating input before grepping: checking minimum text length, confirming legal-document markers are present, and returning an 'UNRESOLVED' verdict rather than silently defaulting to clean.

0
ProgrammingDEV Community ·

Developer Launches 'Clear To Fly', an International Travel Guide Website

'Clear To Fly' is a newly launched website designed to serve as a comprehensive travel guide for international travelers. The platform aims to provide users with essential information and guidelines needed for international travel. The project was shared by a web developer marking their 150th day in the web development community. The site is hosted on Firebase and is publicly accessible online.

0
ProgrammingDEV Community ·

Why Magic Links in Logs and Support Tools Create Hidden Security Risks

Passwordless authentication systems can inadvertently expose login credentials when full magic link URLs are recorded in logs, traces, and support dashboards. Despite being considered temporary, a valid magic link functions as a credential and should be treated with the same care as a password. Security standards from OWASP and NIST warn against storing sensitive authenticators in adjacent systems with weaker access controls and longer data retention. The risk is largely internal rather than external, as developers and support staff routinely copy full URLs during normal debugging workflows. Experts recommend logging only redacted metadata — such as attempt IDs, delivery status, and masked recipient hints — rather than complete verification URLs or raw token values.

0
ProgrammingDEV Community ·

Developer's LLM spend cap failed 4.2x over budget under parallel load, exposes billing flaw

A developer built a local spending cap for LLM API calls after finding that provider-side limits are billing alerts rather than hard stops, with documented cases including a $250 cap resulting in a $10,138 overnight charge and an AWS Bedrock run costing $30,141 with no alert fired. The custom solution intercepted API calls by patching Node.js's global fetch before any SDK code loaded, blocking requests once a cost threshold was reached. During sequential testing the cap worked correctly, but running 20 parallel calls exposed a critical race condition: all requests read a zero-spend state before any completed, allowing all 20 to pass unchecked and exceeding a $0.05 cap with $0.21 in actual spend. The fix required reserving an estimated worst-case cost synchronously before each call rather than logging cost after the response, exploiting Node.js's single-threaded event loop to prevent interleaving. The key insight is that the reservation read-modify-write must contain no await statements, as any async yield point reopens the race condition the fix is designed to close.

0
ProgrammingHacker News ·

Study: Switching from gas to electric stoves sharply reduces indoor air pollution

A study published by Stanford University in December 2025 examined the health impact of cooking appliances on indoor air quality. Researchers found that gas and propane stoves release nitrogen dioxide, a pollutant linked to respiratory health risks. The findings indicate that switching to electric stoves can dramatically lower occupants' exposure to this harmful gas. The research highlights the public health implications of stove choice, particularly in homes with limited ventilation.

0
ProgrammingDEV Community ·

How HTTP Request Smuggling Works and How to Defend Against It

HTTP Request Smuggling is a web attack that exploits inconsistencies in how front-end proxies and back-end servers parse HTTP/1.1 requests, particularly when both Content-Length and Transfer-Encoding headers are present. Attackers can craft malformed requests that cause one server to treat leftover data as a new, separate request, effectively bypassing security controls. The technique enables serious harms including WAF bypass, cache poisoning, session hijacking, and credential theft. Mitigations include adopting HTTP/2 end-to-end, rejecting requests with conflicting length headers, and normalizing requests at the proxy layer. Application-level defenses such as strict HTTP parsing, connection timeouts, and anomaly monitoring further reduce the attack surface.

0
ProgrammingDEV Community ·

Developer builds honest local LLM benchmark tool after finding standard metrics misleading

A developer created an open-source tool called homebench after finding that standard token-per-second metrics failed to reveal whether a local LLM was actually useful or correctly quantized. The tool measures output token speed during generation only, deliberately excluding model load time and prompt processing to reflect what users actually experience during text output. Memory reporting presented a separate challenge, as RAM usage figures vary depending on whether weights, KV cache, or theoretical model-card sizes are counted, so the tool labels each metric transparently rather than blending them into a single figure. The developer also built a concurrency sweep feature to capture how batching servers like vLLM behave under simultaneous requests, since single-stream benchmarks do not reflect real throughput gains from batching. Throughout the project, the author prioritized clearly labelling measurement limitations over producing misleadingly precise numbers.

0
ProgrammingDEV Community ·

Developer Builds Zero-Cost Ecommerce MVP Using Next.js, Vercel, and Supabase

A developer built a lightweight ecommerce MVP for a founder who needed a simple way to display products and collect orders via WhatsApp, without online payments or a Shopify subscription. The solution was built using Next.js for the frontend and admin panel, with Supabase handling product data storage and Vercel hosting the application — all on free tiers, bringing monthly infrastructure costs to zero. The MVP covers only three core steps: browsing products, adding them to a cart, and sending the order directly to WhatsApp. Features like authentication, payment gateways, and email notifications were deliberately excluded, as they were not required to validate the business idea. The developer noted that added complexity such as online payments and order tracking can be introduced later, once the business gains real traction and justifies the need.

0
ProgrammingDEV Community ·

Why 1-to-Many Transaction Matching Is a Hard Engineering Problem

Exact transaction matching assumes a one-to-one relationship between bank and ledger records, but real-world reconciliation often involves a single bank transaction that corresponds to multiple ledger entries. A basic row-to-row matcher will flag these as failures even when the ledger amounts correctly sum to the bank total. The core challenge shifts from simple equality checks to identifying valid combinations of ledger rows that explain a given bank transaction. Candidate selection becomes computationally complex at scale, as testing every possible combination across thousands of records risks both high processing costs and false positives. Reconciliation systems that handle only one-to-one matching will push legitimate transactions into manual review, making one-to-many logic a critical engineering requirement.

0
ProgrammingDEV Community ·

How a Browser Turns a URL Into a Webpage: A Step-by-Step Breakdown

When a user types a URL into a browser and hits Enter, a multi-step process begins before any webpage appears on screen. The browser first uses DNS to translate the human-readable domain name into a numerical IP address needed for network routing. It then establishes a network connection with the destination server, securing it via TLS encryption when the URL uses HTTPS. The browser sends an HTTP request to the server, which responds with HTML, CSS, and JavaScript files. Finally, the browser parses and renders those files to display the completed webpage to the user.

0
ProgrammingDEV Community ·

Developer Turns Old Android Phone into Low-Cost IP Geolocation Server

A software developer repurposed a 2021 Samsung Galaxy A32 with a cracked screen as a functional IP geolocation server, replacing a $38-per-month VPS. The 38-line Python application, built with Flask and Redis, handles around 4,000 daily requests while keeping upstream API calls under 1,000 per day through one-hour caching. The setup runs entirely inside Termux, a Linux-like environment for Android, requiring no rooting or custom firmware. The motivation was practical: the developer needed IP intelligence to combat fraud on a small SaaS product, but commercial geolocation services cost more than the app earned. Despite known limitations of using phones as servers — such as background app killing and thermal throttling — the stateless, read-only workload proved tolerant enough to make the experiment viable.

← NewerPage 56 of 1128Older →