SShortSingh.

Programming

0
ProgrammingDEV Community ·

Theta Harvesting Explained: Concepts, Code Structure, and Hidden Failure Modes

A technical article by Shakti Tiwari on DEV Community breaks down theta harvesting — an options strategy focused on collecting time decay — from first principles, without citing live market data. The piece emphasizes that the strategy appears straightforward in demos but frequently breaks in production due to overlooked implementation details. Tiwari identifies three core components — observation, decision, and cost — noting that most tutorials omit the third, which covers realistic fill models, fee schedules, and tax rules. He warns that skipping proper timestamping, past-only data rules, or realized fill costs introduces look-ahead bias, data leakage, or inflated profitability. The article frames disciplined system design — not the trading idea itself — as the true differentiator between a working strategy and a flawed one.

0
ProgrammingDEV Community ·

Why AI Models Get Locale-Specific Number Formatting Consistently Wrong

AI language models frequently produce malformed numbers when generating locale-specific output, such as writing '1,234,56' in German by applying the decimal comma rule while ignoring the corresponding shift to a period for thousands grouping. The decimal and thousands separators are a matched pair, and applying only one half renders the number unparseable. The problem is compounded across locales: French, Russian, Polish, and Swedish use non-breaking spaces as group separators, which break standard string comparisons and regex patterns written against ordinary spaces. Swiss German adds a third distinct pattern — apostrophe grouping with a decimal point — while Indian English uses non-uniform digit grouping under the lakh-crore system. The International Bureau of Weights and Measures recommends thin spaces for digit grouping in scientific documents precisely to avoid ambiguity between decimal and grouping characters across conventions.

0
ProgrammingDEV Community ·

BlocSignal offers Flutter devs a codegen-free alternative to Riverpod with incremental migration

A new Flutter package called BlocSignal, paired with bloc_signals_riverpod, aims to address common pain points faced by Riverpod developers as their projects scale. Developers using Riverpod often encounter friction from code generation overhead via build_runner, complex nested provider trees, and the difficulty of trialing new architectures without a full codebase rewrite. BlocSignal introduces zero-codegen, signal-graph-based reactivity through standard handwritten Dart classes, allowing reactive derivations to be declared inline using computed signals. The package is designed for incremental, screen-by-screen migration, meaning teams can adopt it gradually alongside existing Riverpod code rather than committing to an all-or-nothing switch. A side-by-side comparison using the classic Todos app demonstrates that BlocSignal can replicate Riverpod's compile-time safety and synchronous reactivity without requiring any code generation tooling.

0
ProgrammingDEV Community ·

A Simple Formula to Calculate Your CPU's Local AI Inference Speed Limit

Running large language models locally on a CPU is often slow, and the key bottleneck during text generation is memory bandwidth, not processing power. For every token generated, the CPU must read all active model weights from RAM into cache, meaning decode speed is capped by how fast data crosses the memory bus. A straightforward ceiling can be calculated by dividing a machine's memory bandwidth — derivable from its DDR standard — by the model's file size in gigabytes. For example, a 70B parameter model at Q4_K_M quantization cannot exceed roughly two tokens per second on a dual-channel DDR5 desktop, regardless of CPU core count. Apple Silicon chips perform notably better at local inference due to their significantly higher unified memory bandwidth, not superior CPU architecture.

0
ProgrammingDEV Community ·

How to Build a Contract Test Suite for Your LLM Gateway Layer

Developers running a proxy in front of AI model providers face bugs not in the models themselves, but in the gateway layer — such as mishandled headers, incorrect error translations, or accidentally buffered streams. A purpose-built contract test suite should verify two core promises: that the gateway speaks an OpenAI-compatible contract downstream and faithfully translates requests upstream. Rather than relying on live model calls, the recommended approach uses a fake local HTTP server to return controlled fixtures, making tests fast, deterministic, and suitable for every pull request. Tools like Mock Service Worker's Node interceptor allow the gateway's real HTTP client, timeout, and retry logic to execute against these stubs. One of the most critical test assertions is confirming that unknown or unrecognized fields from upstream responses are preserved, since a gateway that silently drops them can cause users to lose data like log probabilities or cache metrics.

0
ProgrammingHacker News ·

Developer builds browser-based SysEx librarian for vintage 80s/90s synthesizers

A developer has created a browser-native SysEx librarian tool designed to work with synthesizers from the 1980s and 1990s. The tool is accessible directly through a web browser without requiring additional software installation. It is built to handle SysEx (System Exclusive) MIDI messages, which are used to store and transfer patch data on vintage synthesizers. The project was shared on Hacker News, where it attracted initial attention from the tech and music communities. The tool is available at bipluk.com for musicians and enthusiasts looking to manage their vintage synthesizer libraries.

0
ProgrammingDEV Community ·

Batch vs Streaming in Data Engineering: How to Choose the Right Approach

In data engineering, choosing between batch and streaming processing is an operational decision with real consequences for cost, complexity, and reliability. Batch processing suits use cases where latency of minutes or hours is acceptable, such as incremental ETL pipelines and business dashboards, offering simplicity and lower infrastructure costs. Streaming is better suited for time-sensitive scenarios like fraud detection or operational alerts, where data loses value within seconds, but it comes with higher complexity and continuous infrastructure overhead. A practical hybrid approach — using batch for dashboards and streaming only for fraud detection — can reduce costs while maintaining system reliability. Experts warn against common pitfalls such as assuming everything needs to be real-time, underestimating streaming complexity, and selecting technology before clearly defining the problem.

0
ProgrammingDEV Community ·

Dashboard Audit Reveals One Metric Is Reliable, Another Fluctuates by 1,000 Places

A developer tracking their browser extension discovered that a third-party dashboard reports two very different types of data quality from the same page. The extension's install count proved consistent, returning the same figure across multiple readings of the same date, while the rank metric shifted by roughly a thousand places between readings. This discrepancy only became visible after the developer switched to logging one row per reading instead of one per day, which had been masking the disagreement. The finding led to a practical rule: rank movements under a thousand places carry no meaningful signal and should not be acted upon. The developer concludes that reliability is a property of individual data fields, not of sources as a whole, and recommends repeated readings before trusting any metric used for decision-making.

0
ProgrammingDEV Community ·

Why Closing Disclosure Extraction Requires Regulation-Anchored Schema Design

A Closing Disclosure is a federally regulated mortgage form introduced by the Consumer Financial Protection Bureau under Regulation Z, with a fixed layout that makes structure inference unnecessary and unreliable. Because every section of closing costs is assigned a stable letter designation, extraction pipelines can anchor to those letters rather than searching for fee names, enabling checkable subtotals and meaningful detection of empty sections. The critical challenge lies in the closing cost details page, where each line item can carry up to five distinct amounts across borrower, seller, and third-party payment columns. A schema that captures only one amount per line will silently misattribute costs — for example, recording a seller-paid title premium as borrower-paid — and because totals are extracted rather than derived, the errors go undetected. The correct data model maps each line item to a column-keyed amount structure tied to its lettered section, allowing totals to be independently verified against their printed subtotals.

0
ProgrammingDEV Community ·

Why Extracting Clinical Trial Eligibility Criteria Is Harder Than It Looks

Clinical trial protocols contain eligibility criteria written for human readers, making automated extraction structurally complex and error-prone. Two key source documents exist — the full protocol and the trial registry entry — and they are not interchangeable, with the registry often omitting important qualifications found in the protocol. Inclusion and exclusion criteria must be kept as separate lists rather than merged with a polarity flag, since mechanically negating criteria containing internal negations can cause downstream rule engines to evaluate conditions incorrectly. Bundled criteria, where a single numbered item contains multiple evaluable conditions joined by 'and', must be split into atomic units to be reliably assessed against individual patients. Multi-arm trials add further complexity, as arm-specific criteria flattened into a single list produce a criteria set that no individual trial arm actually holds.

0
ProgrammingDEV Community ·

How AI Can Extract Complex Dosing Schedules From Clinical Trial Protocols

Clinical trial protocols contain a dense 'schedule of activities' table that maps visits against procedures, presenting significant challenges for automated data extraction. The table is often wider than a page, uses merged header cells across two rows, and carries information purely through cell position rather than explicit values. Column headers follow compressed notations like 'C1D1' (Cycle 1, Day 1) and include event-anchored milestones such as End of Treatment that cannot be mapped to absolute dates. A critical convention is that there is no Day 0 — the first dose day is Day 1, meaning zero-based indexing will consistently produce incorrect calculations. Accurate extraction also requires capturing footnote markers on individual cells, which often convert a scheduled procedure into a conditional one.

0
ProgrammingDEV Community ·

Why Extracting Vital Signs From Clinical Notes Is Harder Than It Looks

Extracting patient vital signs from clinical notes presents significant technical challenges despite appearing straightforward, according to a detailed analysis published on DEV Community. The same measurements often appear twice in different formats — once as an inline text fragment and once in a structured flowsheet table — and the two entries may legitimately reflect different time points. Units such as Fahrenheit or Celsius are rarely written explicitly, requiring systems to infer them from context, which can introduce conversion errors. Blood pressure readings like 128/82 represent two distinct clinical observations and should be split at the point of extraction rather than stored as a single display string. Properly structured extraction requires each vital sign to be recorded as a separate observation with its own value, unit, timestamp, and source, rather than flattened into a single object.

0
ProgrammingDEV Community ·

How a Simple Markov Chain Model Can Predict User Clickstream Behavior

A first-order Markov chain built over page-type categories — such as home, search, product, cart, and exit — offers a practical starting point for predicting a user's next action during a web session. The model works by estimating transition probabilities from observed session data, where each probability represents how often a user moves from one page type to another. Analysts are advised to begin with a coarse state alphabet rather than individual URLs, since modeling millions of possible page transitions yields too little data per cell to be reliable. A key limitation is that unseen transitions are assigned zero probability, which can misrepresent real user behavior, and additive smoothing is recommended to correct this, though it introduces its own distortions on small datasets. Tuning the smoothing parameter alpha downward, rather than using the default Laplace value of 1, helps balance the trade-off between correcting zero probabilities and preserving the signal in observed counts.

0
ProgrammingDEV Community ·

Python List Comprehensions vs Generators: Key Differences and When to Use Each

Python list comprehensions and generator expressions are two powerful tools that go well beyond simple loop shortcuts. List comprehensions build an entire collection in memory at once, making them ideal for reusable, randomly accessible results, while generators produce items one at a time, keeping memory usage minimal for large datasets. The walrus operator (:=), introduced in Python 3.8, allows developers to assign and reuse computed values inside a comprehension, avoiding redundant calls to expensive functions. For tasks like summing millions of values, a generator expression can achieve the same result as a list comprehension while consuming significantly less RAM. Chaining multiple for clauses and conditional filters inside a single comprehension can also replace verbose nested loops with cleaner, more readable one-liners.

0
ProgrammingDEV Community ·

Five Regulators Fine Clearview AI Over Illegal Facial Data Scraping Across Europe

Five data protection authorities across Europe and the UK have separately fined Clearview AI for scraping facial images from the internet to build a searchable biometric database without a legal basis. Italy, Greece, and France each imposed €20 million penalties, while the Netherlands levied the largest fine at €30.5 million, and the UK issued a £7.55 million notice. The fines were issued independently between 2022 and 2024, as Clearview has no EU establishment, meaning no single lead authority could handle the cases collectively. France's CNIL went further by imposing an additional accrued penalty of €5.2 million after Clearview failed to respond to an earlier compliance order, illustrating how non-compliance can increase total exposure. The UK figure remains unsettled after a First-tier Tribunal ruled in October 2023 that the processing fell outside the territorial scope of UK data protection law.

0
ProgrammingDEV Community ·

How Claude Calculates Token Costs for Images: Pixels, Not File Size

Anthropic's Claude charges for images based on pixel dimensions, not file size or format, using the formula: tokens ≈ (width × height) / 750. This means compressing an image reduces upload bandwidth but does not lower API costs, while resizing it reduces both. Two built-in limits cap per-image cost: the long edge is scaled down if it exceeds 1,568 pixels, and a secondary ceiling keeps any single image at roughly 1,600 tokens regardless of resolution. In practice, a 12-megapixel phone photo and a 2-megapixel photo of the same scene cost approximately the same number of tokens after these reductions apply. Developers can use Anthropic's count_tokens endpoint for precise pre-request estimates and are advised to recheck official documentation before building cost budgets around these figures.

0
ProgrammingDEV Community ·

How Claude's Tool Use API Works: A Developer's Practical Breakdown

Anthropic's Claude Messages API supports tool use through two content block types — tool_use and tool_result — that developers wire together in a loop they build themselves. When a tool is declared, the model returns a tool_use block with a unique ID and parsed input, but does not execute any code itself. Developers must run the tool, then append both the assistant's response and a user-role tool_result block containing the output before re-sending the full message array. A mismatched tool_use_id between request and result triggers a 400 API error, making accurate ID echo-back critical. Errors should be returned using the is_error flag rather than suppressed, allowing the model to handle failures gracefully in its final response.

0
ProgrammingDEV Community ·

How Claude API's tool_choice Parameter Controls and Forces Tool Calls

Anthropic's Claude API offers a tool_choice parameter with four settings — auto, any, tool, and none — each controlling whether and how the model invokes tools during a response. When set to auto, the model decides freely and may return plain text or a tool call; when forced via any or tool, the response contains only a tool_use block with no accompanying text. A notable use case involves declaring a dummy tool with a JSON Schema and forcing its call to reliably extract structured output, bypassing inconsistent free-text formatting. However, developers should note that forcing a tool call guarantees schema-compliant field values but not factual accuracy — the model will still emit a valid enum value even if the source material lacks the relevant information. This technique works across all Claude models that support tools and predates the newer structured outputs feature.

0
ProgrammingGitHub Blog ·

GitHub Reports Eight Service Incidents Causing Degraded Performance in July 2026

GitHub experienced eight separate incidents during July 2026 that led to degraded performance across its services. The company disclosed the issues as part of its regular monthly availability reporting. The incidents collectively impacted users relying on GitHub's platform during that period. GitHub publishes these monthly reports to maintain transparency about service reliability and uptime.

0
ProgrammingDEV Community ·

China Requires Two-Step Compliance Process Before Public Generative AI Launch

China's Cyberspace Administration, along with six other central departments, issued the Interim Measures for the Management of Generative AI Services in July 2023, which took effect in August 2023. The rules apply to any generative AI service offering text, image, audio, or video content to the public within mainland China, with exemptions for internal tools and services not targeting domestic users. Providers whose services carry public opinion attributes or social mobilisation capability face an additional two-stage obligation: a security self-assessment submitted to cyberspace and public security authorities, followed by a separate algorithm filing through the CAC's online system. Regulators treat most public-facing generative AI platforms as falling within the scope of these attributes, making the dual requirement broadly applicable in practice. Experts caution that the two steps are sequential and interdependent, and that providers should seek dedicated Chinese legal counsel before launching any service in the market.

← NewerPage 177 of 1337Older →