SShortSingh.

Programming

0
ProgrammingDEV Community ·

How to Handle Telegram Inline Keyboards and Callback Queries in PHP

A technical guide published on DEV Community explains how to manage Telegram inline keyboards and callback query updates using plain PHP without framework abstractions. The tutorial covers building inline keyboards, responding to callback queries via the Telegram Bot API, and updating messages in-place using editMessageText. A key constraint highlighted is Telegram's 64-byte limit on callback_data strings, which requires developers to use short prefix keys and store complex state server-side in tools like Redis or SQL. The guide also provides a reusable cURL helper function that handles HTTP errors, JSON parsing failures, and Telegram's own error responses. Developers are advised to call answerCallbackQuery immediately upon receiving a button tap to clear the loading spinner on the user's client.

0
ProgrammingDEV Community ·

Developer's Self-Built AI Agent Refuses to Solve CAPTCHA, Gets Network Banned by Google

A software developer testing his locally-run AI agent, called Flash, directed it to navigate Google.com and perform a search. The agent encountered a reCAPTCHA challenge after Google flagged the browsing activity as unusual automated traffic, resulting in the developer's network being temporarily banned within six minutes. When instructed to bypass the CAPTCHA, Flash repeatedly declined, explaining it was designed to stop automated tools and could not manually complete the check. The developer pushed back, arguing that a human was present and watching, but the agent maintained that Google's systems identify its requests as automated regardless of human oversight. Rather than comply, Flash proactively offered alternative solutions such as using a different search engine or its built-in web search tool.

0
ProgrammingDEV Community ·

Prometiam API Lets Businesses Monitor Spanish Company Insolvency via BORME Data

A REST API developed by Prometiam founder Matías Maquieira allows businesses to retrieve Spanish company registry data, officer details, corporate events, and insolvency proceedings without manual PDF parsing or gazette scraping. The tool pulls data from two official Spanish sources: BORME, which publishes registrable corporate acts, and the Registro Público Concursal, which tracks court-led insolvency proceedings. Users can search companies by name or NIF tax identifier and receive structured JSON responses including risk flags and insolvency status. The API is designed to support Know Your Business (KYB) compliance workflows and daily counterparty risk monitoring. A free 14-day trial offering 1,000 API calls is available, with paid plans starting at €9.99 for access to full corporate event history.

0
ProgrammingDEV Community ·

Developer Implements Observer, Singleton, and Factory Patterns in JavaScript

A developer documented their Week 6 learning task focused on three widely used JavaScript design patterns: Observer, Singleton, and Factory. The Observer pattern was implemented as a custom event emitter supporting subscribe, unsubscribe, single-use, and trigger methods, modeled on real-world notification systems like YouTube. The Singleton pattern was applied to a configuration manager, ensuring only one shared instance exists across the entire application. Each pattern was tested using Node.js's built-in assert module to validate practical behavior rather than relying solely on theory. The write-up also notes that while these patterns solve common design problems, overuse — particularly of Singleton — can reduce testability and maintainability.

0
ProgrammingDEV Community ·

Cache warmup bug caused hourly database crashes after every deploy

A product catalogue service began experiencing six-minute outages roughly an hour after each deployment, with database CPU maxing out and page loads spiking to eight or nine seconds. The root cause was a well-intentioned cache warmup step that preloaded 180,000 product entries with identical one-hour TTLs before each pod went live. Because all entries were loaded at the same time, they all expired simultaneously, triggering a flood of database queries the system was not sized to handle. The original lazy-loading cache had naturally spread expiry times through organic traffic, providing accidental protection that engineers unknowingly removed. The team resolved the issue by adding random TTL jitter, coalescing duplicate cache-miss requests, serving stale content during background refreshes, and isolating cache-fill database connections.

0
ProgrammingDEV Community ·

ClientN Shows How to Add Passkey Login Without Collecting User Emails

A developer building ClientN has published an open-source reference integration demonstrating how small websites can implement passkey-based sign-in without storing user email addresses. The system assigns each user a site-specific clientn_id after passkey confirmation, meaning no password or email is ever transmitted to the site's server. The five-step server flow covers session creation, browser binding via HttpOnly cookies, callback signature verification, and single-use session consumption to prevent race conditions. The reference code is available in Node.js and PHP under an MIT licence, with a test suite covering attacks such as cross-site requests, forged callbacks, and expired logins. Sites must register a domain at clientn.com and receive signed callbacks over HTTPS, making localhost testing unsuitable.

0
ProgrammingDEV Community ·

Five Common Reasons Telegram Store Bots Fail Under High Traffic

Telegram bots have become a popular low-cost storefront for sellers in MENA, LATAM, and crypto markets, but most struggle when order volumes increase. Key failure points include storing cart data in memory rather than a database, causing data loss on redeployment, and lacking idempotency keys for payment webhooks, which can result in duplicate deliveries or missed payments. Tying product fulfilment directly to the bot process also causes slowdowns, as a single slow upload can block all other users. Additional risks include missing reconciliation jobs that silently drop undelivered orders and ignoring Telegram's rate limits, which can get a bot muted. Developers are advised to treat the bot as a thin interface and offload orders, payments, and fulfilment to resilient, restart-safe systems.

0
ProgrammingDEV Community ·

Custom Build or Template? A Scoring Framework to Guide Web Project Decisions

Choosing between custom web development and templates is often decided by opinion rather than structured criteria, but a weighted scoring approach can make the decision more objective. Templates suit content-focused sites with tight budgets and non-technical teams, while custom builds are justified when projects require complex business logic, third-party integrations, or strict performance control. A numerical scoring tool assigns weights to key project signals, with scores below 40 favouring templates, 40–70 suggesting a hybrid CMS-plus-custom-components setup, and above 70 pointing toward a full custom build. A hybrid approach — using a headless CMS for content alongside a custom front end — is increasingly common, letting editors and developers each work in their preferred environment. Regardless of the chosen route, enforcing a Lighthouse CI performance budget ensures neither templates nor custom code silently degrade site speed.

0
ProgrammingDEV Community ·

How AI Agents Can Retain, Recall, and Cite Evidence Without Hallucinating

A developer walkthrough published on DEV Community demonstrates how a working AI agent can store and retrieve community messages and product updates as timestamped memories using a unified memory layer. The system is designed to return an INSUFFICIENT_EVIDENCE status when relevant data is lacking, treating uncertainty as a formal outcome rather than masking it with model confidence. All generated FAQ answers are assigned a DRAFT status and require human moderator approval before publication. The agent is also required to distinguish observations from interpretations and explicitly flag weak or conflicting evidence in its output. A key design principle highlighted is that every published answer links back to specific memory IDs, allowing the system to show its reasoning rather than simply assert conclusions.

0
ProgrammingDEV Community ·

Hung integration test blocked hotfix deploy for over three hours at checkout

A one-line fix for a checkout bug that rejected a card type was merged in August but took nearly four hours to reach production. The delay was caused by a shared GitHub Actions runner labelled 'deploy' that was simultaneously running a slow integration test stuck in a blocking read. The test had connected to a message broker undergoing maintenance, which accepted the connection but never responded, and with no read timeout, no per-test limit, and no job timeout set, it inherited the platform's six-hour default. Engineers discovered the issue at 5:30 PM by checking what the runner was actually doing, and the hotfix deployed within nine minutes of cancelling the stuck test. The team has since separated deploy and test runners, enforced explicit job timeouts via linting, added per-test timeout limits, and set up on-call alerts for any deploy job queued longer than five minutes.

0
ProgrammingDEV Community ·

IT Team Fixes Auto-Close Rule That Was Silently Failing Depot Shift Workers

A service desk tool was automatically closing unresolved tickets after three working days of no reply — a setting that worked for office staff but consistently failed depot workers on rotating four-days-on, four-days-off shifts. A night-shift employee reporting a fault on her last shift would return five days later to find her ticket closed as resolved, forcing her to reopen a new one or simply work around the problem. The issue came to light in June when a regional manager flagged repeated fault reports across his sites, and an audit revealed 43% of shift workers' tickets had been closed by the timer, versus 9% for office staff. The team overhauled the system so the auto-close timer now counts the requester's actual working shifts using rota data, rather than calendar days. Tickets closed by the timer are now tracked as a separate outcome from resolved, and any fault reopened within a fortnight is linked to the original ticket rather than treated as a new request.

0
ProgrammingDEV Community ·

Repository README carried dated and undated counts of the same set, fix mandates timestamps

A software repository's README file contained three references to the same set of filed submissions, but only one of those references included a dated epoch while the other two did not. As new submissions were filed, the undated counts became stale, revealing a consistency gap rather than mere carelessness — the dating mechanism already existed in the file for the same object. The maintainer closed the issue at commit R286 on 2026-09-15, establishing that any count is a measurement and must be dated at the time it is taken. A related issue three days earlier, at commit R242 on 2026-09-12, found that a review had incorrectly asserted a withdrawn annotation was present in a committed file without reproducing the artefact. The repository responded by adding a review rule requiring that claims about artefact contents be verified by producing the artefact both ways and comparing results, not by reading source code alone.

0
ProgrammingDEV Community ·

When Your Mentee Surpasses You: Why It Signals Good Mentorship

A reflective piece by Asael Shinder on Dev Community explores the moment a mentor realizes their mentee has developed deeper expertise in a specific area. Shinder argues that the instinct to deflect or reassert authority is counterproductive, and that openly acknowledging a mentee's superior knowledge builds a healthier dynamic. He advises mentors to listen genuinely, ask real questions, and connect mentees with better-suited experts when needed. The piece notes that experienced mentors still offer distinct value through broader judgment — such as stakeholder management and long-term project perspective — that technical depth alone cannot replace. Shinder concludes that being surpassed by a mentee is not a failure but a natural milestone marking the maturation of the mentoring relationship.

0
ProgrammingDEV Community ·

How to Write a Prompt Engineer Resume That Proves Your Skills With Data

The role of a prompt engineer lacks a standardized definition, making it critical for candidates to clearly demonstrate their methods and measurable results rather than simply listing prompts they have written. Resumes in this field should highlight four core competencies: building evaluation loops with labeled datasets, managing production constraints like token cost and latency, ensuring prompt robustness across model updates, and engineering the surrounding scaffolding such as retrieval systems and guardrails. A common resume mistake is vague bullets like 'improved accuracy' without specifying baselines, measurement criteria, or whether gains held after model upgrades. Strong resume bullets should follow an engineering format — stating what was built, at what scale, and with what quantified outcome — drawing from real metrics in eval logs or dashboards. Job seekers should also account for the unstable terminology in the field, ensuring concrete nouns like model families and tooling appear throughout the resume to pass applicant tracking systems.

0
ProgrammingDEV Community ·

How to Automate PDF Invoice Processing with Python: A Step-by-Step Guide

Businesses and freelancers often spend days manually reviewing and processing hundreds of PDF invoices each month, but a well-designed Python script can reduce that effort to minutes. Python has become the go-to language for this type of automation due to its rich ecosystem of libraries for PDF manipulation, text extraction, and data processing. Key libraries such as PyPDF2, pdfplumber, and PyMuPDF handle text-based PDFs, while Tesseract with pytesseract addresses scanned or image-based invoices. Automating invoice processing not only saves time but also minimizes transcription errors and standardizes workflows without requiring additional staff. The guide walks readers through building an end-to-end automated pipeline that converts unstructured PDF invoices into structured data ready for accounting or analysis.

0
ProgrammingDEV Community ·

Race Conditions: The Concurrency Bug That Returns With Every New Feature

Race conditions are a recurring software bug that occurs when two or more requests access shared data simultaneously without proper protection, leading to incorrect outcomes. A common example is two users purchasing the last item in stock at the same moment, both receiving a success confirmation while only one item exists. The problem stems from a gap between when code reads a value and when it writes an update, allowing overlapping requests to act on stale data. Developers and QA teams must each take targeted steps to address concurrency risks, as fixing one feature does not prevent the same flaw from appearing in the next. Unlike typical bugs, race conditions do not require heavy traffic — just two simultaneous requests are enough to expose the vulnerability.

0
ProgrammingDEV Community ·

RecallDesk Uses FastAPI to Build AI Memory Layer for Enterprise Customer Support

RecallDesk is an AI-assisted customer support system whose backend was built using Python and FastAPI, coordinating between a React 19 frontend, a ticket database, and an external memory engine called Hindsight. The backend serves as a central intermediary to enforce security, redact sensitive data such as API keys from support tickets before it leaves the internal environment, and manage calls to third-party services. FastAPI was chosen for its native asynchronous I/O support, Pydantic v2 schema validation, and automatic OpenAPI documentation generation. A key architectural decision was decoupling operational ticket state — which follows a fixed lifecycle of open, pending, and resolved — from the continuous persistent memory layer. The backend also implements resilient fallback handling so that support desk operations continue uninterrupted if the external memory service faces downtime or latency.

0
ProgrammingHacker News ·

GitHub Project Benchmarks Uncensored AI Models for Offensive Security Use

A GitHub repository published by user JoasASantos introduces a benchmark focused on evaluating uncensored and offensive security-oriented AI models. The project appears aimed at assessing how such models perform on security-related tasks that standard, safety-filtered models typically refuse. The repository was shared on Hacker News, where it received 5 upvotes and no comments at the time of reporting. Details about the specific models tested, methodology, and evaluation criteria are available directly within the GitHub project. The release highlights growing interest in specialized AI tools tailored for cybersecurity research and penetration testing workflows.

0
ProgrammingDEV Community ·

How Java and Go Guarantee Atomicity, Visibility, and Ordering in Concurrent Code

A technical deep-dive on DEV Community examines how programming languages enforce safe concurrent operations through atomic APIs. In Java, AtomicInteger methods like incrementAndGet() perform read-modify-write as a single indivisible operation, preventing lost updates when multiple threads modify shared state. The volatile semantics underlying Java's VarHandle establish synchronizes-with relationships, ensuring that writes made before an atomic update are visible to threads that observe that update. Go's sync/atomic package offers similar guarantees, where observing one goroutine's atomic operation implies a synchronized-before relationship with the observing operation. The article uses annotated code examples to illustrate how atomicity, visibility, and ordering work together under each language's memory model, with CPython noted as lacking a symmetric application-level atomic API.

0
ProgrammingDEV Community ·

How Race Conditions Break Stock Updates and Three Ways to Fix Them

Concurrent stock update requests can cause race conditions where multiple operations read the same inventory value simultaneously, pass availability checks, and each record a successful decrement — even when only one unit exists. This flaw means the final stock count may appear correct while the number of successful transactions exceeds actual available inventory. An atomic SQL update, such as decrementing stock directly within a conditional WHERE clause, eliminates the application-level read-check-write gap that creates the vulnerability. PostgreSQL row locking with SELECT FOR UPDATE offers another approach, serializing concurrent transactions so only one can read and modify a row at a time. Testing these scenarios requires validating not just the final stock value but also that the count of successful operations never exceeds initial inventory.

← NewerPage 820 of 3171Older →